This guide describes all breaking changes introduced with v11.0.0
.
Changes to decodeEvents
method
Removed decodeEvents
from contract ACI methods ().
rewrite
cInstance.methods.emitEvents.decodeEvents(log);
to
cInstance.decodeEvents(log);
Removed raw fields from the decodeEvents
response () use processed fields for the same.
Renamed decoded events response field decoded
to args
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'
}
}
]
*/
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 createdAt
from contract.deploy
method response
call/callStatic
removed call
and callStatic
methods 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 });
Removed getBytecodeCompilerVersion
method.
Removed encodeCall
method from contractCompile
response.
Removed getCompilerVersion
method, use aeSdk. sdk.compilerVersion
instead.
Removed contractDecodeCallDataByCodeAPI
method.
Removed contractDecodeCallResultAPI
method.
Removed getFateAssembler
method.
Removed compileContractAPI
method.
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]);
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 });
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);
Renamed generateSaveHDWallet
to generateSaveHDWalletFromSeed
Renamed getHdWalletAccountFromMnemonic
to getHdWalletAccountFromSeed