Skip to main content

Transferring Tokens

You will need to transfer tokens for:

  • Implementing various gameplay features such as gifting, trading, and rewards.
  • Supporting secure and efficient token transactions.
  • Providing a seamless user experience by allowing token transfers without leaving the game environment.
What you'll need:
  • Some Enjin Coin on Enjin Matrixchain to pay for Transaction Fees and a deposit of 0.01 ENJ is required for the Token Account Deposit, for each new token holder.
    You can obtain cENJ (Canary ENJ) for testing from the Canary faucet.
  • An Enjin Platform Account.
  • A Collection and a Token to mint.

There are two ways to transfer a token:

  1. Using the Enjin Dashboard
  2. Using the GraphQL API & SDKs

Option A. Using the Enjin Dashboard

In the Platform menu, navigate to "Tokens".
Locate the token you wish to transfer, click the 3 vertical dots () to it's right, then click the "Transfer" button.

Transferring Token

Need to perform multiple transfers?

Click on the "Batch" button, followed by "Batch Transfer".

Fill in the recipient, amount, and other optional arguments in the corresponding fields.
Once you're satisfied with the options, click on the "Transfer" button at the bottom right corner to create the request.

Transfer Token Form

Transfer Token Transaction Banner

Pending Transfer Transaction Clicking "View" on the notification will take you to your Transactions List.

Since this request requires a Transaction

, it'll need to be signed with your Wallet.

  • If a Wallet Daemon is running and configured, the transaction request will be signed automatically.
  • If a wallet is connected such as the Enjin Wallet or Polkadot.js, the transaction must be signed manually by clicking the "Sign" button and approving the signature request in your wallet.

If you're looking to distribute tokens to your community or players, but don't have their account addresses, don't worry! Our solution is Enjin Beam.
Proceed to the Distributing Tokens via QR tutorial to learn more.

Option B. Using the Enjin API & SDKs

Transferring an asset

SimpleTransferToken mutation simplifies the process of transferring a specific token from one wallet to another. It is a straightforward way to facilitate token transfers without the need for complex intermediary steps.

mutation TransferToken{
SimpleTransferToken(
collectionId: 36105 #Specify the collection ID
recipient: "cxLU94nRz1en6gHnXnYPyTdtcZZ9dqBasexvexjArj4V1Qr8f" #Specify the recipent address
params: {
tokenId: {integer: 0} #Specify the token ID
amount: 1 #Choose the transfer amount
}
){
id
method
state
}
}

Transferring ENJ token

To send ENJ / CENJ tokens from one wallet to another, use the TransferAllowDeath mutation, or the TransferKeepAlive if you want to make sure the account doesn't get reaped (Read more about account reaping):

mutation TransferENJTokens {
TransferKeepAlive(
recipient: "cxLU94nRz1en6gHnXnYPyTdtcZZ9dqBasexvexjArj4V1Qr8f" #Specify the recipent address
amount: 5000000000000000000 #Specify the amount of tokens to transfer
) {
id
method
state
}
}
Notes:
  • amount argument
    • In the TransferBalance mutation, the amount argument is denoted in u128. This means that the number you specify is divided by 10^18 to determine the actual amount of ENJ to be transferred.
      In the example above, an amount of 5000000000000000000 will actually send 5 ENJ. Keep this in mind when specifying the amount in your mutations.
  • keepAlive argument
    • Set to true if you want to make sure the account doesn't get reaped.
      Learn more about keepAlive argument here

Batch Transferring ENJ token

To send ENJ / CENJ tokens from one wallet to multiple addresses or in multiple transactions, we use the BatchTransferBalance mutation

mutation BatchSendENJ{
BatchTransferBalance(
recipients: [
{
account: "cxLU94nRz1en6gHnXnYPyTdtcZZ9dqBasexvexjArj4V1Qr8f", #Specify the recipent address
transferBalanceParams: {
value: 5000000000000000000 #Specify the amount of tokens to transfer
}
},
{
account: "cxKy7aqhQTtoJYUjpebxFK2ooKhcvQ2FQj3FePrXhDhd9nLfu", #Specify the recipent address
transferBalanceParams: {
value: 15250000000000000000 #Specify the amount of tokens to transfer
keepAlive: true #Set to true if you want to make sure the account doesn't get reaped
}
},
]
){
id
transactionId
state
}
}

A WebSocket event will also be fired so you can pick up the transfer transaction in real time by listening to the app channel on the WebSocket.

Need to send a transaction request to user's wallet?

This can be done using Enjin Platform API & WalletConnect!
To learn more, check out the Using WalletConnect page.

Explore More Arguments

For a comprehensive view of all available arguments for queries and mutations, please refer to our API Reference. This resource will guide you on how to use the GraphiQL Playground to explore the full structure and functionality of our API.
For instance, you'll find settings such as continueOnFailure to skip data that would cause the whole batch to fail, or the ability to sign using a managed wallet with the signingAccount argument.

:::What's next? Distribute tokens to your players, even if they don't have wallets! Proceed to the Distributing Tokens via QR tutorial to learn more. :::