Migration to 11.0.0
This guide describes all breaking changes introduced with v11.0.0.
Changes to decodeEvents method
- Removed
decodeEventsfrom contract ACI methods (a84d781).
rewrite
cInstance.methods.emitEvents.decodeEvents(log);
to
cInstance.decodeEvents(log);
-
Removed raw fields from the
decodeEventsresponse (45bae5f) use processed fields for the same. -
Renamed decoded events response field
decodedtoargs
old response
// events emitted by contract calls are automatically decoded
const tx = await contractInstance.methods.emitEvents(1337, 'this message is not indexed');
console.log(tx.decodedEvents);
/*
[
{
address: 'ct_6y3N9KqQb74QsvR9NrESyhWeLNiA9aJgJ7ua8CvsTuGot6uzh',
data: 'cb_dGhpcyBtZXNzYWdlIGlzIG5vdCBpbmRleGVkdWmUpw==',
topics: [
'101640830366340000167918459210098337687948756568954742276612796897811614700269',
'39519965516565108473327470053407124751867067078530473195651550649472681599133'
],
name: 'AnotherEvent',
decoded: [
'fUq2NesPXcYZ1CcqBcGC3StpdnQw3iVxMA3YSeCNAwfN4myQk',
'this message is not indexed'
]
},
{
address: 'ct_6y3N9KqQb74QsvR9NrESyhWeLNiA9aJgJ7ua8CvsTuGot6uzh',
data: 'cb_Xfbg4g==',
topics: [
'59505622142252318624300825714684802559980671551955787864303522023309554554980',
1337
],
name: 'FirstEvent',
decoded: [ '1337' ]
}
]
*/
new response
// events emitted by contract calls are automatically decoded
const tx = await contractInstance.methods.emitEvents(1337, 'this message is not indexed');
console.log(tx.decodedEvents);
/*
[
{
name: 'AnotherEvent',
args: [
'fUq2NesPXcYZ1CcqBcGC3StpdnQw3iVxMA3YSeCNAwfN4myQk',
'this message is not indexed'
],
contract: {
name: 'EventEmitter',
address: 'ct_6y3N9KqQb74QsvR9NrESyhWeLNiA9aJgJ7ua8CvsTuGot6uzh'
}
},
{
name: 'FirstEvent',
args: [1337n],
contract: {
name: 'EventEmitter',
address: 'ct_6y3N9KqQb74QsvR9NrESyhWeLNiA9aJgJ7ua8CvsTuGot6uzh'
}
}
]
*/
Removed allowUnsynced option of poll method (6baa15d)
Transaction poll method now checks if Tx is in the node pool (690db5b)
The default polling interval of 5000 is replaced by a method which calculates the default interval using expected mine rate and micro block cycle (d9c6cf9)
Following contract instance methods are dropped(#1368)
topBlock- use
aeSdk.api.getTopHeader()instead contractCall- replace
await aeSdk.contractCall(identityContract, contractId, 'getArg', [42]) - with
(await aeSdk.getContractInstance({ source, contractAddress: contractId })).methods.getArg(42) contractCompile- replace
await aeSdk.contractCompile(CONTRACT_SOURCE) - with
(await aeSdk.getContractInstance({ source: CONTRACT_SOURCE })).compile() contractDeploy- replace
await aeSdk.contractDeploy(bytecode, identityContract) - with
(await aeSdk.getContractInstance({ bytecode, source: identityContract })).deploy() contractCallStatic- replace
await aeSdk.contractCallStatic(identityContract, null, 'init', [], { bytecode }) - with
await contract.deploy([], { callStatic: true }) - Removed property
createdAtfromcontract.deploymethod response call/callStatic- removed
callandcallStaticmethods from deploy response
rewrite
deployed = await contract.deploy([], { onAccount });
await deployed.call('getArg', [42]);
await deployed.callStatic('getArg', [42]);
to
await contract.deploy();
await contract.methods.getArg(42, { callStatic: false });
await contract.methods.getArg(42, { callStatic: true });
The default gas of 25000 limit has been dropped. Instead, SDK attempts to estimate the gas using dry-run feature (#1367)
See documentation on transaction-options.md for detailed explanation.
Removed Wrappers around CompilerApi (#1363)
-
Removed
getBytecodeCompilerVersionmethod. -
Removed
encodeCallmethod fromcontractCompileresponse. -
Removed
getCompilerVersionmethod, useaeSdk. sdk.compilerVersioninstead. -
Removed
contractDecodeCallDataByCodeAPImethod. -
Removed
contractDecodeCallResultAPImethod. -
Removed
getFateAssemblermethod. -
Removed
compileContractAPImethod.
rewrite
const code = await aeSdk.compileContractAPI(identityContract);
const callData = await aeSdk.contractEncodeCallDataAPI(identityContract, 'init', []);
const result = await initiatorCh.createContract({
code,
callData,
deposit: 1000,
vmVersion: 5,
abiVersion: 3,
amount,
gas,
gasPrice,
});
to
contract = await aeSdk.getContractInstance({ source: contractSource });
await contract.compile();
const result = await aeSdk.createContract({
code: contract.bytecode,
callData: contract.calldata.encode('Identity', 'init', []),
deposit: 1000,
vmVersion: 5,
abiVersion: 3,
amount,
gas,
gasPrice,
});
//or
bytecode = (await aeSdk.compilerApi.compileContract({ code: contractSource })).bytecode;
- Removed
contractEncodeCallDataAPI:
rewrite
await aeSdk.contractEncodeCallDataAPI(contractSource, 'getArg', ['42']);
to
contract = await aeSdkInitiator.getContractInstance({ source: contractSource });
await contract.compile();
contract.calldata.encode('Identity', 'getArg', [42]);
- Removed
contractGetACI:
rewrite
const aci = await aeSdk.contractGetACI(contractSource);
to
const aci = await aeSdk.compilerApi.generateACI({ code: contractSource });
- Removed
validateByteCodeAPI:
rewrite
aeSdk.validateByteCodeAPI(bytecode, identityContract);
to
await aeSdk.compilerApi.validateByteCode({ bytecode, source: identityContract });
Native build of claim tx now accepts unencoded name instead of encoded name (eea92be)
rewrite
const name = 'test123test.chain';
const nameHash = `nm_${encodeBase58Check(Buffer.from(name))}`;
const params = { accountId: senderId, nonce, name: nameHash, nameSalt: _salt, nameFee };
const txFromAPI = await aeSdk.nameClaimTx(params);
to
const name = 'test123test.chain';
const params = { accountId: senderId, nonce, name, nameSalt: _salt, nameFee };
const txFromAPI = await aeSdk.nameClaimTx(params);
Removed forceValidation flag from aepp-rpc and wallet-rpc stamps. (9f958c3)
Renamed hd-wallet methods (f6243ad)
- Renamed
generateSaveHDWallettogenerateSaveHDWalletFromSeed - Renamed
getHdWalletAccountFromMnemonictogetHdWalletAccountFromSeed