Constructorsconstructor new Contract < M extends ContractMethodsBase > ( options : { aci : Aci ; address ?: ` ct_ ${ string } ` ; bytecode ?: ` cb_ ${ string } ` ; fileSystem ?: Record < string , string > ; name ?: ` ${ string } .chain ` ; onCompiler ?: CompilerBase ; onNode : Node ; sourceCode ?: string ; sourceCodePath ?: string ; } & Partial < BuildTxOptions < ContractCallTx , "contractId" | "callData" | "callerId" > , > & { omitUnknown ?: boolean } & GetContractNameByEventOptions & Pick < Partial < SendTransactionOptions > , "onNode" | "onAccount" , > & Omit < SendTransactionOptions , "onNode" | "onAccount" > & Omit < { combine ?: boolean ; onNode : Node ; top ?: number | ` kh_ ${ string } ` | ` mh_ ${ string } ` ; txEvents ?: boolean ; } , "onNode" , > & { callStatic ?: boolean } & Partial < BuildTxOptions < ContractCreateTx , "code" | "ownerId" | "callData" > , > , ) : Contract < M > Parameters options : { aci : Aci ; address ?: ` ct_ ${ string } ` ; bytecode ?: ` cb_ ${ string } ` ; fileSystem ?: Record < string , string > ; name ?: ` ${ string } .chain ` ; onCompiler ?: CompilerBase ; onNode : Node ; sourceCode ?: string ; sourceCodePath ?: string ; } & Partial < BuildTxOptions < ContractCallTx , "contractId" | "callData" | "callerId" > , > & { omitUnknown ?: boolean } & GetContractNameByEventOptions & Pick < Partial < SendTransactionOptions > , "onNode" | "onAccount" , > & Omit < SendTransactionOptions , "onNode" | "onAccount" > & Omit < { combine ?: boolean ; onNode : Node ; top ?: number | ` kh_ ${ string } ` | ` mh_ ${ string } ` ; txEvents ?: boolean ; } , "onNode" , > & { callStatic ?: boolean } & Partial < BuildTxOptions < ContractCreateTx , "code" | "ownerId" | "callData" > , > Optional
address ?: ` ct_ ${ string } ` Optional
bytecode ?: ` cb_ ${ string } ` Optional
fileSystem ?: Record < string , string > Optional
name ?: ` ${ string } .chain ` Optional
sourceCode ?: string Optional
sourceCodePath ?: string Optional
omitUnknown ?: boolean Optional
callStatic ?: boolean Properties_calldata _calldata : Encoder
$options $options : Omit < { aci : Aci ; address ?: ` ct_ ${ string } ` ; bytecode ?: ` cb_ ${ string } ` ; fileSystem ?: Record < string , string > ; name ?: ` ${ string } .chain ` ; onCompiler ?: CompilerBase ; onNode : Node ; sourceCode ?: string ; sourceCodePath ?: string ; } & Partial < BuildTxOptions < ContractCallTx , "contractId" | "callData" | "callerId" > , > & { omitUnknown ?: boolean } & GetContractNameByEventOptions & Pick < Partial < SendTransactionOptions > , "onNode" | "onAccount" , > & Omit < SendTransactionOptions , "onNode" | "onAccount" > & Omit < { combine ?: boolean ; onNode : Node ; top ?: number | ` kh_ ${ string } ` | ` mh_ ${ string } ` ; txEvents ?: boolean ; } , "onNode" , > & { callStatic ?: boolean } & Partial < BuildTxOptions < ContractCreateTx , "code" | "ownerId" | "callData" > , > , "aci" , > Methods_estimate Gas _estimateGas < Fn extends string > ( name : Fn , params : MethodParameters < M , Fn > , options ?: Omit < | undefined | Partial < BuildTxOptions < ContractCallTx , "contractId" | "callData" | "callerId" > , > & { omitUnknown ?: boolean } & GetContractNameByEventOptions & Pick < Partial < SendTransactionOptions > , "onNode" | "onAccount" , > & Omit < SendTransactionOptions , "onNode" | "onAccount" > & Omit < { combine ?: boolean ; onNode : Node ; top ?: number | ` kh_ ${ string } ` | ` mh_ ${ string } ` ; txEvents ?: boolean ; } , "onNode" , > & { callStatic ?: boolean } , "callStatic" , > , ) : Promise < number > Parameters name : Fn params : MethodParameters < M , Fn > options : Omit < | undefined | Partial < BuildTxOptions < ContractCallTx , "contractId" | "callData" | "callerId" > , > & { omitUnknown ?: boolean } & GetContractNameByEventOptions & Pick < Partial < SendTransactionOptions > , "onNode" | "onAccount" , > & Omit < SendTransactionOptions , "onNode" | "onAccount" > & Omit < { combine ?: boolean ; onNode : Node ; top ?: number | ` kh_ ${ string } ` | ` mh_ ${ string } ` ; txEvents ?: boolean ; } , "onNode" , > & { callStatic ?: boolean } , "callStatic" , > = {} Returns Promise < number > $call $call < Fn extends string > ( fn : Fn , params : MethodParameters < M , Fn > , options ?: Partial < BuildTxOptions < ContractCallTx , "contractId" | "callData" | "callerId" > , > & { omitUnknown ?: boolean } & GetContractNameByEventOptions & Pick < Partial < SendTransactionOptions > , "onNode" | "onAccount" , > & Omit < SendTransactionOptions , "onNode" | "onAccount" > & Omit < { combine ?: boolean ; onNode : Node ; top ?: number | ` kh_ ${ string } ` | ` mh_ ${ string } ` ; txEvents ?: boolean ; } , "onNode" , > & { callStatic ?: boolean } , ) : Promise < SendAndProcessReturnType & Partial < GetCallResultByHashReturnType < M , Fn > > , > $compile $compile () : Promise < ` cb_ ${ string } ` > Returns Promise < ` cb_ ${ string } ` > bytecode
$deploy $deploy ( params : M extends { init : any } ? Parameters < M < M > [ "init" ] > : [ ] , options ?: Partial < BuildTxOptions < ContractCallTx , "contractId" | "callData" | "callerId" > , > & { omitUnknown ?: boolean } & GetContractNameByEventOptions & Pick < Partial < SendTransactionOptions > , "onNode" | "onAccount" , > & Omit < SendTransactionOptions , "onNode" | "onAccount" > & Omit < { combine ?: boolean ; onNode : Node ; top ?: number | ` kh_ ${ string } ` | ` mh_ ${ string } ` ; txEvents ?: boolean ; } , "onNode" , > & { callStatic ?: boolean } & Partial < BuildTxOptions < ContractCreateTx , "code" | "ownerId" | "callData" > , > , ) : Promise < Omit < SendAndProcessReturnType , "hash" > & { address ?: ` ct_ ${ string } ` ; decodedEvents ?: DecodedEvent [] ; owner ?: ` ak_ ${ string } ` ; transaction ?: ` th_ ${ string } ` ; } , > Returns Promise < Omit < SendAndProcessReturnType , "hash" > & { address ?: ` ct_ ${ string } ` ; decodedEvents ?: DecodedEvent [] ; owner ?: ` ak_ ${ string } ` ; transaction ?: ` th_ ${ string } ` ; } , > deploy info
Static
initialize initialize < M extends ContractMethodsBase > ( __namedParameters : Omit < { aci : Aci ; address ?: ` ct_ ${ string } ` ; bytecode ?: ` cb_ ${ string } ` ; fileSystem ?: Record < string , string > ; name ?: ` ${ string } .chain ` ; onCompiler ?: CompilerBase ; onNode : Node ; sourceCode ?: string ; sourceCodePath ?: string ; } & Partial < BuildTxOptions < ContractCallTx , "contractId" | "callData" | "callerId" > , > & { omitUnknown ?: boolean } & GetContractNameByEventOptions & Pick < Partial < SendTransactionOptions > , "onNode" | "onAccount" , > & Omit < SendTransactionOptions , "onNode" | "onAccount" > & Omit < { combine ?: boolean ; onNode : Node ; top ?: number | ` kh_ ${ string } ` | ` mh_ ${ string } ` ; txEvents ?: boolean ; } , "onNode" , > & { callStatic ?: boolean } & Partial < BuildTxOptions < ContractCreateTx , "code" | "ownerId" | "callData" > , > , "address" | "aci" , > & { aci ?: Aci ; address ?: ` ${ string } .chain ` | ` ct_ ${ string } ` ; validateBytecode ?: boolean ; } , ) : Promise < Contract < M > > Parameters __namedParameters : Omit < { aci : Aci ; address ?: ` ct_ ${ string } ` ; bytecode ?: ` cb_ ${ string } ` ; fileSystem ?: Record < string , string > ; name ?: ` ${ string } .chain ` ; onCompiler ?: CompilerBase ; onNode : Node ; sourceCode ?: string ; sourceCodePath ?: string ; } & Partial < BuildTxOptions < ContractCallTx , "contractId" | "callData" | "callerId" > , > & { omitUnknown ?: boolean } & GetContractNameByEventOptions & Pick < Partial < SendTransactionOptions > , "onNode" | "onAccount" , > & Omit < SendTransactionOptions , "onNode" | "onAccount" > & Omit < { combine ?: boolean ; onNode : Node ; top ?: number | ` kh_ ${ string } ` | ` mh_ ${ string } ` ; txEvents ?: boolean ; } , "onNode" , > & { callStatic ?: boolean } & Partial < BuildTxOptions < ContractCreateTx , "code" | "ownerId" | "callData" > , > , "address" | "aci" , > & { aci ?: Aci ; address ?: ` ${ string } .chain ` | ` ct_ ${ string } ` ; validateBytecode ?: boolean ; } Returns Promise < Contract < M > >
Generate contract ACI object with predefined js methods for contract usage - can be used for creating a reference to already deployed contracts
Param: options
Options object
Returns
JS Contract API
Example
Also you can call contract like:
await contractIns.setState(123, options)
Then sdk decide to make on-chain or static call (dry-run API) transaction based on function is stateful or not