v1.2.0
- added
contract.callMultiple(...)
feature: Call multiple methods that changes the contract s state
As well as the call
, you will need to pay for every request you make. This is going to change data and store it within the blockchain.
import naxios, { buildTransaction } from "@wpdas/naxios";
const contractApi = new naxios({
contractId: CONTRACT_ID,
network: "testnet",
}).contractApi();
// Using the default instance's contract
const transactionA = buildTransaction('set_greeting', { args: { greeting: 'Hello my dear!' } })
const transactionB = buildTransaction('set_age', { args: { age: 22 } })
// Using diff contract
const transactionC = buildTransaction('update_state', {
receiverId: 'my-state-contract.testnet',
args: { allowed: true },
})
// Optional
const callbackUrl = 'https://my-page.com/callback-success'
// [payable]
contractApi.callMultiple([transactionA, transactionB, transactionC], callbackUrl).then(() => console.log('Done!'))