Transaction

JavaScript Transaction Functions

Batch transaction

Description

Sign and send a batched transaction to the chain. This function is used to maintain an ACID property on the chain for several transactions that need to be sent together. The function will display a widget for the user to sign the transaction. The user can learn about all the transactions that they are about to sign - but will only need to approve them once.

Usage Example

// Some code

Parameters

NameTypeRequiredDefaultDescription

Transactions

String

✔️

The JSON object of the batched transactions

BlockchainId

any

✔️

Blockchain to send the trnasaction to


Send transaction

Description

Send a raw transaction to the blockchain. This method is used mainly to control smart contracts. Returns a URL of a widget for a modal where the user can approve the transaction.

Parameters

NameTypeRequiredDefaultDescription

blockchainId

String

✔️

Blockchain ID

payload

any

✔️

Transaction payload

Return type

Promise<string>

Usage Example

import { TezosToolkit } from '@taquito/taquito'
const tezos = new TezosToolkit('https://mainnet.api.tez.ie')

const contract = await tezos.contract.at('KT1REEb5VxWRjcHm5GzDMwErMmNFftsE5Gpf') //USDS contract address
const payload = await contract.methods['transfer']([
  {
    from_: 'FROM_WALLET_ADDR',
    txs: [
      {
        to_: 'TO_WALLET_ADDR',
        token_id: '0',
        amount: '0',
        value: '0',
      },
    ],
  },
]).toTransferParams()

await sdk.transaction.send({
  blockchainId: 'tezos',
  payload: payload,
})

Last updated