Transfer - Tokens

Send Token Transaction

This API call allows you to create a transaction and send a token to a single address.

Note:
Ethereum ( EVM chains) currently support one sender and one recipient. That means that we can send to only one recipient at a time.

Use the following code:

// Get Wallet Instance
let walletInstance = await liminalJs
            .Coin(CoinsEnum.eth)
            .Token({
                tokenName: "bat",
                tokenAddress: "0xbF7A7169562078c96f0eC1A8aFD6aE50f12e5A99"
                })
            .Wallets()
            .Get({ walletId: 310, allTokens: true });

let recipients = {
         recipients:[
              {
                address:"0xda67DE242bE3582EfE6b5713068BD9bA2f621A0E",
                amount:0.00001
              }
            ],
          sequenceId:'8a3ac341-1591-d17c-9f3b-86916a01120f'
        };

let transactionResponse = await walletInstance.SendMany(recipients);

console.log("Send Many Transaction: =>", transactionResponse);
// Get Wallet Instance
let walletInstance:Wallet=await liminalJs
                                .Coin(CoinsEnum.eth)
                                .Token({
                                    tokenName:"bat",
                                    tokenAddress:"0xbF7A7169562078c96f0eC1A8aFD6aE50f12e5A99"
                                                                 })
                                                            .Wallets()
                                .Get({walletId:310,allTokens:true});

let recipients: PrebuildAndSignTransactionOptions = {
            recipients:[
              {
                address:"0xda67DE242bE3582EfE6b5713068BD9bA2f621A0E",
                amount:0.00001
              }
            ],
                    sequenceId:'8a3ac341-1591-d17c-9f3b-86916a01120f'
        };

let transactionResponse:any = await walletInstance.SendMany(recipients);

console.log("Send Many Transaction: =>", JSON.stringify(transactionResponse));

Token method Parameter:

ParamsData TypeDescription
tokenNamestringSpecify the name of the token.
tokenAddressstringSpecify the token contract address.

Parameters recipients object:

Params

Data Type

Description

recipients

Array

Recipient is the array of objects. It includes a list of the recipient addresses and amounts. There should be at least one recipient.

sequenceId

String

The Sequence ID is a unique wallet identifier that is applied to transfer transactions during creation. It is a mandatory parameter, without the sequence ID you cannot transfer it to the recipient. With Sequence IDs, you can easily track status transfer transactions.
For example, The system confirms only one send a request for each sequence ID (all subsequent attempts fail). You can repeat the transaction without the risk of double sending.

{
   "userid":76,
   "raw":"{\"txHex\":\"02f8b104820c1c843b9aca09843b9aca0982ea6094bf7a7169562078c96f0ec1a8afd6ae50f12e5a9980b844a9059cbb000000000000000000000000da67de242be3582efe6b5713068bd9ba2f621a0e000000000000000000000000000000000000000000000000000009184e72a000c001a0b578eeba96c26bd21c91bd10dac123c2d1dbdba540cae3bcae986d2a4ca895f3a0274190025be69e938a7d1b7c1c4e326ad870247ea0064e38443e118989557c79\",\"nonce\":3100,\"halfSigned\":{\"payload\":\"{\\\"amount\\\":0.00001,\\\"destinationAddress\\\":\\\"0xda67DE242bE3582EfE6b5713068BD9bA2f621A0E\\\",\\\"coinSymbol\\\":\\\"BAT\\\",\\\"transactionHash\\\":\\\"0xe6059f80448dd4596fda6e178ca9132e65ad5d72b19fb2524d1484f41c5dd292\\\"}\",\"txBase64\":\"\",\"txHex\":\"02f8b104820c1c843b9aca09843b9aca0982ea6094bf7a7169562078c96f0ec1a8afd6ae50f12e5a9980b844a9059cbb000000000000000000000000da67de242be3582efe6b5713068bd9ba2f621a0e000000000000000000000000000000000000000000000000000009184e72a000c001a0b578eeba96c26bd21c91bd10dac123c2d1dbdba540cae3bcae986d2a4ca895f3a0274190025be69e938a7d1b7c1c4e326ad870247ea0064e38443e118989557c79\",\"sequenceId\":\"f5717f12-5df8-100d-6957-49f31443fac6\"},\"user\":{\"id\":76,\"displayName\":\"Machine\",\"photoURL\":\"https://cdn.icon-icons.com/icons2/1378/PNG/512/avatardefault_92824.png\",\"lastLoginAt\":\"2021-12-27T10:40:16.000Z\",\"email\":\"[email protected]\",\"phoneNumber\":null,\"status\":1,\"created_at\":\"2021-09-08T14:35:22.000Z\",\"clientid\":\"UT3DKwJuEf1L5LiDU7jkwnhE16JU3NKu\",\"type\":2},\"sequenceId\":\"f5717f12-5df8-100d-6957-49f31443fac6\"}",
   "status":4,
   "walletid":"310",
   "type":1,
   "chain":"ETH",
   "timestamp":"2021-12-27T10:40:24.399Z",
   "transactionSequenceId":4674,
   "sequenceId":"f5717f12-5df8-100d-6957-49f31443fac6",
   "identifier":"0xe6059f80448dd4596fda6e178ca9132e65ad5d72b19fb2524d1484f41c5dd292",
   "txNonce":3100,
   "amount":0.00001,
   "destinationAddress":"0xda67DE242bE3582EfE6b5713068BD9bA2f621A0E",
   "asset":"BAT",
   "usdamount":0.000013579000000000002,
   "id":6512
}

To check the status of the transaction by using sequence ID then please visit the following page:
<<<https://docs.lmnl.app/docs/transaction-status#transaction-status-by-sequence-id>>>

Full Example

import { CoinsEnum,LiminalEnvironment, LiminalJs } from "@lmnl/liminaljs";

const main = async () => {
    try {
        // Instance of Liminal Js
        let liminalJs = new LiminalJs(LiminalEnvironment.test);
        await liminalJs
            .Authenticate({
                clientId: "YOUR_CLIENT_ID",
                clientSecret: "YOUR_CLIENT_SECRET"
            })
            .AuthenticateWithAccessToken();

        let walletInstance = await liminalJs
            .Coin(CoinsEnum.eth)
            .Token({
                tokenName: "bat",
                tokenAddress: "0xbF7A7169562078c96f0eC1A8aFD6aE50f12e5A99"
                })
            .Wallets()
            .Get({ walletId: 310, allTokens: true });

                let recipients = {
             recipients:[
                  {
                    address:"0xda67DE242bE3582EfE6b5713068BD9bA2f621A0E",
                    amount:0.00001
                  }
                ],
              sequenceId:'8a3ac341-1591-d17c-9f3b-86916a01120f'
        };
      
        let transactionResponse = await walletInstance.SendMany(recipients);
        
        console.log("Send Many Transaction: =>", JSON.stringify(transactionResponse));
    }
    catch (ex) {
        throw ex;
    }
};
main().then((resolve) => console.log("Complete")).catch((error) => console.log(error));
import {
    CoinsEnum,
    LiminalEnvironment,
    LiminalJs,
    PrebuildAndSignTransactionOptions,
    PrebuildTransactionResult,
    SignedTransaction,
    Wallet
} from "@lmnl/liminaljs"

const main = async (): Promise<void> => {
    try {
        // Instance of Liminal Js
        let liminalJs = new LiminalJs(LiminalEnvironment.test);
        await liminalJs
            .Authenticate({
               clientId: "YOUR_CLIENT_ID",
                clientSecret: "YOUR_CLIENT_SECRET"
            })
            .AuthenticateWithAccessToken();

        // Get Wallet Instance
              let walletInstance:Wallet=await liminalJs
                                .Coin(CoinsEnum.eth)
                                .Token({
                                    tokenName:"bat",
                                    tokenAddress:"0xbF7A7169562078c96f0eC1A8aFD6aE50f12e5A99"
                                                                 })
                                                            .Wallets()
                                .Get({walletId:310,allTokens:true});

        let recipients: PrebuildAndSignTransactionOptions = {
            recipients:[
              {
                address:"0xda67DE242bE3582EfE6b5713068BD9bA2f621A0E",
                amount:0.00001
              }
            ],
                    sequenceId:'8a3ac341-1591-d17c-9f3b-86916a01120f'
        };


        let transactionResponse:any = await walletInstance.SendMany(recipients);

                console.log("Send Many Transaction: =>", JSON.stringify(transactionResponse));


    }
    catch (ex) {
        throw ex;
    }
}

main().then((resolve) => console.log("Complete")).catch((error) => console.log(error));

Did this page help you?