TERNOA Documentation
Learn Build
  • What is Ternoa Chain ?
  • SPECS
    • Polygon CDK zkEVM
    • Polygon AggLayer
    • Avail DA
    • Trusted Execution Environments 
  • BUILD
    • Wallets
    • RPC
    • API
    • Explorer
  • Tools
    • Staking
    • Ternoa Safe
    • TIP
  • Community
    • Ternoa.com
    • Github
    • Discord
    • Twitter
    • Medium
Powered by GitBook
On this page
  • Prerequisites
  • How to transfer GTokens to an address
  • Support
  1. Build
  2. Javascript SDK
  3. NFT features & pallets
  4. Tokens
  5. G-Token

Transfer GTokens

Last updated 1 year ago

Gtoken is a non-fungible utility token used within the Ternoa network, not mineable or tradable with other fungible tokens.

Prerequisites

Before getting started, make sure you have the following ready:

  1. account with Alphanet CAPS

  2. Own a GToken on alphanet created using .

  3. Install and set up your editor of choice (we will use Visual Studio Code [VSC] in this tutorial)

  4. Install & NPM

How to transfer GTokens to an address

This example shows how to transfer a GToken balance to an address using assetTransfer.

import {
	initializeApi,
	assetTransfer,
	getKeyringFromSeed,
	WaitUntil,
} from "ternoa-js";

const main = async () => {
	try {
		await initializeApi ();

		const keyring = await getKeyringFromSeed("REPLACE_WITH_THE_TRANSACTION_SIGNER_SEED");
		const TO_ADDRESS = "REPLACE_WITH_THE_DEST_ADDRESS";
		const GTOKEN_ID = REPLACE_WITH_THE_GTOKEN_ID
		const amount = REPLACE_WITH_THE_GTOKEN_AMOUNT_TO_TRANSFER
	
		const transferData = await balancesTransfer(
			GTOKEN_ID,
			TO_ADDRESS,
			amount,
			keyring,
			WaitUntil.BlockInclusion
		);
		console.log(
			`The amount transferred to ${TO_ADDRESS} is:`,
			transferData.amountRounded,
			"GTOKENS"
		);
		return transferData
	} catch (e) {
		console.error(e);
		process.exit(1)
	} finally {
		process.exit(0)
	}
};

main();

Support

If you face any trouble, feel free to reach out to our community engineers in our .

Create a Ternoa
Polkadot js portal
NodeJS v.14+
Install & initialize Ternoa-JS
Discord