@multi-transaction/core
TypeScript icon, indicating that this package has built-in type declarations

1.3.2 • Public • Published

Multi Transaction Core

Multi Transaction Core implementation

Install

pnpm add @multi-transaction/core

Examples

import { MultiTransaction, Amount, Gas } from '@multi-transaction/core';

Normal Transaction

One transaction that contains one action

const mTransaction = MultiTransaction
  .batch('wrap.near')
  .functionCall({
    methodName: 'ft_transfer',
    args: {
      receiver_id: 'bob.near',
      amount: Amount.parse('8.88', 'NEAR')
    },
    attachedDeposit: Amount.ONE_YOCTO,
    gas: Gas.parse('10', 'T'),
  });

Batch Transaction

One transaction that contains multiple actions

const mTransaction = MultiTransaction
  .batch('wrap.near')
  .functionCall({
    methodName: 'ft_transfer',
    args: {
      receiver_id: 'bob.near',
      amount: Amount.parse('8.88', 'NEAR'),
    },
    attachedDeposit: Amount.ONE_YOCTO,
    gas: Gas.parse('10', 'T'),
  })
  .functionCall({
    methodName: 'ft_transfer',
    args: {
      receiver_id: 'carol.near',
      amount: Amount.parse('8.88', 'NEAR'),
    },
    attachedDeposit: Amount.ONE_YOCTO,
    gas: Gas.parse('10', 'T'),
  });

Multiple Transactions

Multiple transactions and each contains one or more actions

const mTransaction = MultiTransaction
  .batch('wrap.near')
  .functionCall({
    methodName: 'ft_transfer',
    args: {
      receiver_id: 'bob.near',
      amount: Amount.parse('8.88', 'NEAR'),
    },
    attachedDeposit: Amount.ONE_YOCTO,
    gas: Gas.parse('10', 'T'),
  })
  .functionCall({
    methodName: 'ft_transfer',
    args: {
      receiver_id: 'carol.near',
      amount: Amount.parse('8.88', 'NEAR'),
    },
    attachedDeposit: Amount.ONE_YOCTO,
    gas: Gas.parse('10', 'T'),
  })
  .batch('usdt.tether-token.near')
  .functionCall({
    methodName: 'ft_transfer',
    args: {
      receiver_id: 'david.near',
      amount: Amount.parse('8.88', 'USDT'),
    },
    attachedDeposit: Amount.ONE_YOCTO,
    gas: Gas.parse('10', 'T'),
  });

Fungible Token Transaction

const mTransaction = MultiTransaction
  .batch('wrap.near')
  .ft.transfer({
    args: {
      receiver_id: 'bob.near',
      amount: Amount.parse('8.88', 'NEAR'),
    },
  });

Non-Fungible Token Transaction

const mTransaction = MultiTransaction
  .batch('core.namesky.near')
  .nft.transfer({
    args: {
      receiver_id: 'bob.near',
      token_id: 'apple.near',
    },
  });

Storage Management Transaction

const mTransaction = MultiTransaction
  .batch('wrap.near')
  .storage.deposit({ 
    attachedDeposit: Amount.parse('0.01', 'NEAR'),
  });

/@multi-transaction/core/

    Package Sidebar

    Install

    npm i @multi-transaction/core

    Weekly Downloads

    7

    Version

    1.3.2

    License

    MIT

    Unpacked Size

    123 kB

    Total Files

    159

    Last publish

    Collaborators

    • hanakannzashi