Optional
c: { options?: TransactionOptions; provider?: ProviderInterface; signer?: SignerInterface; transaction?: TransactionJson }Optional
options?: TransactionOptionsOptional
provider?: ProviderInterfaceOptional
signer?: SignerInterfaceOptional
transaction?: TransactionJsonOptional
providerProvider to connect with the blockchain
Optional
signerSigner interacting with the smart contracts
Transaction
Optional
waitFunction to wait for the transaction to be mined
Function to prepare the transaction (set headers, merkle root, etc)
Optional
options: TransactionOptionsFunction to push an operation to the transaction. It can be created in several ways. Example:
const koin = new Contract({
id: "15DJN4a8SgrbGhhGksSBASiSYjGnMU8dGL",
abi: utils.tokenAbi,
}).functions;
const signer = Signer.fromSeed("my seed");
const provider = new Provider(["https://api.koinos.io"]);
signer.provider = provider;
const tx = new Transaction({ signer });
// Method 1 (using 2 arguments)
// note that with 2 arguments it is not necessary to
// set "onlyOperation: true". For the rest of the
// methods it's necessary to do that.
await tx.pushOperation(koin.transfer, {
from: "1NRYHBYr9qxYQAeVqfdSvyjJemRQ4qD3Mt",
to: "13UdKjYuzfBYbB6bGLQkUN9DJRFPCmG1mU",
value: "1000",
});
// Method 2
await tx.pushOperation(
koin.transfer({
from: "1NRYHBYr9qxYQAeVqfdSvyjJemRQ4qD3Mt",
to: "13UdKjYuzfBYbB6bGLQkUN9DJRFPCmG1mU",
value: "1000",
},{
onlyOperation: true,
})
);
// Method 3
await tx.pushOperation(
await koin.transfer({
from: "1NRYHBYr9qxYQAeVqfdSvyjJemRQ4qD3Mt",
to: "13UdKjYuzfBYbB6bGLQkUN9DJRFPCmG1mU",
value: "1000",
},{
onlyOperation: true,
})
);
// Method 4
const { operation } = await koin.transfer({
from: "1NRYHBYr9qxYQAeVqfdSvyjJemRQ4qD3Mt",
to: "13UdKjYuzfBYbB6bGLQkUN9DJRFPCmG1mU",
value: "1000",
},{
onlyOperation: true,
});
await tx.pushOperation(operation)
Optional
args: unknownFunction to broadcast the transaction
Optional
options: SendTransactionOptionsFunction to sign the transaction
Optional
abis: Record<string, Abi>Static
computeStatic
prepareFunction to prepare a transaction
A prepared transaction.
Do not set the nonce to get it from the blockchain using the provider. The rc_limit is 1e8 by default.
Optional
provider: ProviderInterfaceProvider
Optional
payer: stringpayer to be used in case it is not defined in the transaction
Generated using TypeDoc
Transaction options