Class Transaction

Hierarchy

  • Transaction

Constructors

Properties

Transaction options

Provider to connect with the blockchain

Signer interacting with the smart contracts

transaction: TransactionJson

Transaction

waitFunction?: WaitFunction

Function to wait for the transaction to be mined

Methods

  • Update the rc limit with a new value and update the transaction ID accordingly. The signatures will be removed if the transaction ID changed

    Parameters

    • newRcLimit: string | number

    Returns void

  • Function to push an operation to the transaction. It can be created in several ways. Example:

    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)

    Parameters

    Returns Promise<void>

  • Parameters

    • Optional type: "byBlock" | "byTransactionId"
    • Optional timeout: number

    Returns Promise<{ blockId: string; blockNumber?: number }>

Generated using TypeDoc