const contractIns = await client.getContractInstance(contractSourceCode)
console.log(contract)
{
interface: String, // Contract interface source code
aci: String, // Contract interface json schema
source: String, // Contract source code
compiled: String, // Compiled contract code
deployInfo: { address: contractAddress } // Object with deploy transaction,
// Function
compile: () => this, // Compile contract,
deploy: (init = [], options = { skipArgsConvert: false }) => this, // Deploy contract (compile before if needed)
call: (fn, params = [], options = { skipArgsConvert: false, skipTransformDecoded: false, callStatic: false } => CallRersult: Object // Call contract function
}
export const ADDRESS_FORMAT = {
sophia: 1, // return address like `0xHEX_ADDRESS`
api: 2, // return address like `ak_9LJ8ne9tks78hTD2Tp571f7w2MJmzQMRsiZxKCkMA2d2Sbrc4`
}
//
export { ADDRESS_FORMAT } from 'es/account'
await account.address(format: ADDRESS_FORMAT) // default ADDRESS_FORMAT.api
1) Use Compiler instead of node API for encode/decode call-data and compile.
2) Change Contract interface:
- contractCallStatic (address, abi = 'sophia-address', name, { top, args = '()', call, options = {} } = {}) -> (source, address, name, args = [], { top, options = {} } = {}))
- contractCall (code, abi, address, name, { args = '()', options = {}, call } = {}) -> (source, address, name, args = [], options = {})
- contractDeploy (code, abi, { initState = '()', options = {} } = {}) -> (code, source, initState = [], options = {})
- contractEncodeCall (code, abi, name, args, call) -> (source, name, args) // 'source' is -> Contract source code or ACI interface source