Multi Transaction Core implementation
pnpm add @multi-transaction/core
import { MultiTransaction, Amount, Gas } from '@multi-transaction/core';
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'),
});
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 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'),
});
const mTransaction = MultiTransaction
.batch('wrap.near')
.ft.transfer({
args: {
receiver_id: 'bob.near',
amount: Amount.parse('8.88', 'NEAR'),
},
});
const mTransaction = MultiTransaction
.batch('core.namesky.near')
.nft.transfer({
args: {
receiver_id: 'bob.near',
token_id: 'apple.near',
},
});
const mTransaction = MultiTransaction
.batch('wrap.near')
.storage.deposit({
attachedDeposit: Amount.parse('0.01', 'NEAR'),
});