Function getContractInstance

  • Generate contract ACI object with predefined js methods for contract usage - can be used for creating a reference to already deployed contracts

    Returns

    JS Contract API

    Example

    const contractIns = await aeSdk.getContractInstance({ source })
    await contractIns.deploy([321]) or await contractIns.methods.init(321)
    const callResult = await contractIns.call('setState', [123]) or
    await contractIns.methods.setState.send(123, options)
    const staticCallResult = await contractIns.call('setState', [123], { callStatic: true }) or
    await contractIns.methods.setState.get(123, options)

    Also you can call contract like: await contractIns.methods.setState(123, options) Then sdk decide to make on-chain or static call(dry-run API) transaction based on function is stateful or not

    Parameters

    • options: { aci?: <internal>.Aci; bytecode?: `cb_${string}`; contractAddress?: `ct_${string}` | `${string}.chain`; fileSystem?: Record<string, string>; onAccount?: AccountBase; onCompiler: Compiler; onNode: Node; source?: string; validateBytecode?: boolean; [key: string]: any }

      Options object

      • [key: string]: any
      • Optional aci?: <internal>.Aci
      • Optional bytecode?: `cb_${string}`
      • Optional contractAddress?: `ct_${string}` | `${string}.chain`
      • Optional fileSystem?: Record<string, string>
      • Optional onAccount?: AccountBase
      • onCompiler: Compiler
      • onNode: Node
      • Optional source?: string
      • Optional validateBytecode?: boolean

    Returns Promise<ContractInstance>

Generated using TypeDoc