ACI
@aeternity/aepp-sdk/es/contract/aci
ContractACI module
Example
import ContractACI from '@aeternity/aepp-sdk/es/contract/aci'
- @aeternity/aepp-sdk/es/contract/aci
- instance.compile ⇒
ContractInstance
⏏ - instance.deploy ⇒
ContractInstance
⏏ - instance.call ⇒
Object
⏏ - getContractInstance(source, [options]) ⇒
ContractInstance
⏏ - module.exports() ⇒
Object
⏏
- instance.compile ⇒
instance.compile ⇒ ContractInstance
⏏
Compile contract
Kind: Exported member
Returns: ContractInstance
- Contract ACI object with predefined js methods for contract usage
rtype: () => ContractInstance: Object
instance.deploy ⇒ ContractInstance
⏏
Deploy contract
Kind: Exported member
Returns: ContractInstance
- Contract ACI object with predefined js methods for contract usage
rtype: (init: Array, options: Object = { skipArgsConvert: false }) => ContractInstance: Object
Param | Type | Default | Description |
---|---|---|---|
init | Array |
Contract init function arguments array | |
[options] | Object |
{} |
options Options object |
[options.skipArgsConvert] | Boolean |
false |
Skip Validation and Transforming arguments before prepare call-data |
instance.call ⇒ Object
⏏
Call contract function
Kind: Exported member
Returns: Object
- CallResult
rtype: (init: Array, options: Object = { skipArgsConvert: false, skipTransformDecoded: false, callStatic: false }) => CallResult: Object
Param | Type | Default | Description |
---|---|---|---|
fn | String |
Function name | |
params | Array |
Array of function arguments | |
[options] | Object |
{} |
Array of function arguments |
[options.skipArgsConvert] | Boolean |
false |
Skip Validation and Transforming arguments before prepare call-data |
[options.skipTransformDecoded] | Boolean |
false |
Skip Transform decoded data to JS type |
[options.callStatic] | Boolean |
false |
Static function call |
getContractInstance(source, [options]) ⇒ ContractInstance
⏏
Generate contract ACI object with predefined js methods for contract usage - can be used for creating a reference to already deployed contracts
Kind: Exported function
Returns: ContractInstance
- JS Contract API
Param | Type | Default | Description |
---|---|---|---|
source | String |
Contract source code | |
[options] | Object |
{} |
Options object |
[options.aci] | String |
Contract ACI | |
[options.contractAddress] | String |
Contract address | |
[options.filesystem] | Object |
Contact source external namespaces map | |
[options.forceCodeCheck] | Object |
Don't check contract code | |
[options.opt] | Object |
Contract options |
Example
const contractIns = await client.getContractInstance(sourceCode)
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
module.exports() ⇒ Object
⏏
Contract ACI Stamp
Kind: Exported function
Returns: Object
- Contract compiler instance
rtype: Stamp
Example
ContractACI()