Migration to 13.0.0
This guide describes all breaking changes introduced with v13.0.0.
Wallet
onSign, onMessageSign callbacks were removed on the wallet side
onSign, onMessageSign callbacks were removed on the wallet sideCheck allowance to sign on the account side instead, using aeppOrigin, aeppRpcClientId options.
Aepp
All wallet provided nodes have the same name
Specified in name option of connectToWallet.
Select option removed from connectToWallet
If you are using connectNode then the current node would always be the same as wallet provides.
Contract
ACI format used the same as returned by aesophia_cli
aesophia_http old format
{
"encoded_aci": { contract: <1> },
"external_encoded_aci": [<2>]
}aesophia_cli format
[<2>, { contract: <1> }]params argument in $deploy and $call is required
params argument in $deploy and $call is requiredContract methods accessible on the instance itself
Apply a patch:
-const contract = aeSdk.getContractInstance(<contract args>);
+const contract = aeSdk.getContractInstance<{ foo: (a: bigint) => bigint }>(<contract args>);
-await contract.methods.foo(<arguments>);
+await contract.foo(<arguments>);contract.methods.<name>.get,send removed
contract.methods.<name>.get,send removedUse callStatic option instead.
contract.bytecode,sourceCode moved to contract.$options
contract.bytecode,sourceCode moved to contract.$optionscontract.calldata renamed to contract._calldata
contract.calldata renamed to contract._calldataUse contract._calldata (considered to be a private field) or aepp-calldata package directly.
contract.options renamed to contract.$options
contract.options renamed to contract.$optionscontract.deployInfo removed
contract.deployInfo removedUse the return value of contract.$deploy instead.contract.deployInfo.address moved to contract.$options.address.
contract.decodeEvents renamed to contract.$decodeEvents
contract.decodeEvents renamed to contract.$decodeEventscontract.call renamed to contract.$call
contract.call renamed to contract.$callcontract.compile renamed to contract.$compile
contract.compile renamed to contract.$compilecontract.deploy renamed to contract.$deploy
contract.deploy renamed to contract.$deploycreateAensDelegationSignature, createOracleDelegationSignature removed
createAensDelegationSignature, createOracleDelegationSignature removedUse createDelegationSignature instead.
use sourceCode instead of source
sourceCode instead of sourceIt is related to getContractInstance and signing using Generalized accounts. Apply a change:
-aeSdk.getContractInstance({ source: <contract source code>, ... })
+aeSdk.getContractInstance({ sourceCode: <contract source code>, ... })
-aeSdk.spend(..., { authData: { source: <contract source code>, args: [...] } })
+aeSdk.spend(..., { authData: { sourceCode: <contract source code>, args: [...] } })getContractInstance accepts address instead of contractAddress
getContractInstance accepts address instead of contractAddressApply a change:
-aeSdk.getContractInstance({ contractAddress: <contract address>, ... })
+aeSdk.getContractInstance({ address: <contract address>, ... })getContractInstance function replaced with Contract class
getContractInstance function replaced with Contract classApply a patch:
-contract = await getContractInstance(<options>);
+contract = await Contract.initialize(<options>);AeSdk.getContractInstance renamed to AeSdk.initializeContract
AeSdk.getContractInstance renamed to AeSdk.initializeContractprepareTxParams, getVmVersion are not exported anymore
prepareTxParams, getVmVersion are not exported anymoreUse buildTx instead.
isGA method removed
isGA method removedUse (await aeSdk.getAccount(<address>)).kind === 'generalized' instead.
Transaction builder
writeInt function removed
writeInt function removedUse toBytes util instead.
returnType of contract call result structure is a value of CallReturnType enum
returnType of contract call result structure is a value of CallReturnType enumApply a patch:
-contractCall.returnType === "error"
+contractCall.returnType === CallReturnType.ErrorwriteId, readId functions removed
writeId, readId functions removedUse transaction builder instead.
readPointers, buildPointers functions removed
readPointers, buildPointers functions removedUse transaction builder instead.
formatSalt function removed
formatSalt function removedUse Buffer.from(<salt>.toString(16).padStart(64, '0'), 'hex') instead.
validateParams, unpackRawTx functions removed
validateParams, unpackRawTx functions removedUse transaction builder instead.
AMOUNT constant removed
AMOUNT constant removedIf necessary, use 0 instead.
StateTrees fields decoded as objects mapping key to decoded entry instead of internals
The content of Tag.*Mtree entries decoded and moved to payload field
payload fieldTX_SCHEMA, TxParamsCommon, TxSchema, TxTypeSchemas are not exported anymore
TX_TTL is not exported anymore
TX_TTL is not exported anymoreUse 0 instead.
Enum FIELD_TYPES is not exported anymore
FIELD_TYPES is not exported anymoreNot able to build/unpack CompilerSophia entry (tag 70)
Enums PROTOCOL_VM_ABI, interface CtVersion not exported anymore
PROTOCOL_VM_ABI, interface CtVersion not exported anymoreEnums VM_VERSIONS, ABI_VERSIONS, PROTOCOL_VERSIONS renamed
VM_VERSIONS, ABI_VERSIONS, PROTOCOL_VERSIONS renamedThey are exported as VmVersion, AbiVersion, ConsensusProtocolVersion.
stateHash of Channel entry decoded as st_-prefixed string instead of hex
stateHash of Channel entry decoded as st_-prefixed string instead of hexSpendTx payload doesn't accept arbitrary strings anymore
payload doesn't accept arbitrary strings anymoreProvide a ba_-encoded string instead.
-payload: 'test',
+payload: encode(Buffer.from('test'), Encoding.Bytearray),verifyTransaction doesn't accept parent tx types anymore
verifyTransaction doesn't accept parent tx types anymorebuildTx doesn't accept excludeKeys option anymore
buildTx doesn't accept excludeKeys option anymoreConsider opening an issue, if you need this functionality.
Use version instead of VSN, vsn in unpackTx, buildTx
version instead of VSN, vsn in unpackTx, buildTxbuildTx accepts transaction type and version in the first argument
buildTx accepts transaction type and version in the first argumentApply a change:
-buildTx({ ... }, Tag.SpendTx, { version: 2 })
+buildTx({ ..., tag: Tag.SpendTx, version: 2 })AeSdk.buildTx accepts tag in options
tag in optionsReplace aeSdk.buildTx(Tag.SpendTx, { ... }) with aeSdk.buildTx({ ..., tag: Tag.SpendTx }).
sync buildTx accepts denomination in the first argument
buildTx accepts denomination in the first argument-buildTx({ ... }, { denomination: AE_AMOUNT_FORMATS.AETTOS })
+buildTx({ ..., denomination: AE_AMOUNT_FORMATS.AETTOS })unpackTx return an object of transaction parameters
unpackTx return an object of transaction parametersUse unpackTx(...) instead of unpackTx(...).tx.
unpackTx doesn't return rlpEncoded anymore
unpackTx doesn't return rlpEncoded anymoreUse decode(buildTx(unpackTx(...))) instead.
unpackTx doesn't return txType anymore
unpackTx doesn't return txType anymoreUse unpackTx(...).tag instead.
buildTx return string instead of object
buildTx return string instead of objectUse just buildTx(...) instead of buildTx(...).tx.
buildTx doesn't return txObject anymore
buildTx doesn't return txObject anymoreUse unpackTx(buildTx(...)) instead.
buildTx doesn't return binary anymore
buildTx doesn't return binary anymoreUse require('rlp').decode(decode(buildTx(...))) instead.
buildTx doesn't return rlpEncoded anymore
buildTx doesn't return rlpEncoded anymoreUse decode(buildTx(...)) instead.
key of MtreeValue entry decoded as a buffer instead of a hex
key of MtreeValue entry decoded as a buffer instead of a hexTxBuilder accepts and returns poi field unpacked as TreesPoi
poi field unpacked as TreesPoiget method of MPTree accepts and returns typed values
get method of MPTree accepts and returns typed valuesApply a change:
-unpackTx(tree.get(decode('ak_97...')))
+tree.get('ak_97...')Compiler
Compiler export renamed to CompilerHttp
Compiler export renamed to CompilerHttpremoved AeSdk:compilerUrl, AeSdk:setCompilerUrl
A compiler instance needs to be passed explicitly in onCompiler option:
-import { AeSdk } from '@aeternity/aepp-sdk';
+import { AeSdk, CompilerHttp } from '@aeternity/aepp-sdk';
const aeSdk = new AeSdk({
- compilerUrl: <compiler url>,
+ onCompiler: new CompilerHttp(<compiler url>),
});Methods of CompilerHttp moved to api property
CompilerHttp moved to api propertyApply a patch:
-compilerHttp.generateACI({ code: sourceCode });
+compilerHttp.api.generateACI({ code: sourceCode });Dropped compatibility with aesophia_http below 7.1.1, aesophia_cli below 7.0.1
Account
createGeneralizedAccount accepts sourceCode in options
createGeneralizedAccount accepts sourceCode in optionsApply a patch:
-aeSdk.createGeneralizedAccount('authorize', sourceCode, ['arg-1']);
+aeSdk.createGeneralizedAccount('authorize', ['arg-1'], { sourceCode });createMetaTx removed
createMetaTx removedUse AccountGeneralized.signTransaction instead.
AccountRpc constructor accepts arguments one by one
AccountRpc constructor accepts arguments one by oneApply a change:
-new AccountRpc({ rpcClient: <rpc client>, address: <address> })
+new AccountRpc(<rpc client>, <address>)AccountMemory requires networkId in signTransaction
AccountMemory requires networkId in signTransactionAccountBase simplified
AccountBase simplifiednetworkIdremovedgetNetworkIdmethod removedsignTransaction,signMessagemade abstract
address in AccountBase is a property
address in AccountBase is a propertyApply a change:
-await accountMemory.address(options)
+accountMemory.addressMemoryAccount accepts only secretKey
Apply a change:
-new MemoryAccount({ keypair: { publicKey: 'ak_..', secretKey: <secret key> } })
+new MemoryAccount(<secret key>)MemoryAccount is not compatible with GA
Apply a change:
-new MemoryAccount({ gaId: <address> })
+new AccountGeneralized(<address>)Node
url property of Node removed
url property of Node removedUse autorest's $host property instead.
Oracle
QUERY_FEE is not exported anymore
QUERY_FEE is not exported anymoreUse 30000 instead if necessary.
Oracles created without queryFee by default
Specify queryFee in registerOracle if needed.
AeSdk:extendOracleTtl, AeSdk:respondToQuery doesn't accept oracleId
Remove the first argument.
onQuery callback of pollForQueries, oracle.pollQueries accepts a single query
onQuery callback of pollForQueries, oracle.pollQueries accepts a single queryIt was accepting an array before. Apply a patch:
-aeSdk.pollForQueries(oracleId, (queries) => queries.forEach(handleQuery));
+aeSdk.pollForQueries(oracleId, handleQuery);Chain
send inlined into sendTransaction
send inlined into sendTransactionPass not signed transaction to sendTransaction.
If you need to post signed transaction use Node:postTransaction.
AENS
height removed from the output of aensPreclaim
height removed from the output of aensPreclaimUse blockHeight instead:
const res = aeSdk.aensPreclaim('name.chain');
-res.height
+res.blockHeight - 1Channel
Channel:state returns unpacked entries
Use buildTx to pack them back if needed.
All channel events emitted in snakeCase
Affected events: 'own_withdraw_locked', 'withdraw_locked', 'own_deposit_locked', 'deposit_locked', 'peer_disconnected', 'channel_reestablished'.
Channel:poi returns unpacked TreesPoi
Use just await channel.poi(...) instead of unpackTx(await channel.poi(...)).
Other
onAccount doesn't accept keypair
onAccount doesn't accept keypairApply a change:
-aeSdk.<metnod name>(..., { onAccount: <keypair> })
+aeSdk.<metnod name>(..., { onAccount: new MemoryAccount(<keypair>.secretKey) })bigNumberToByteArray removed
bigNumberToByteArray removedUse toBytes instead.
str2buf function removed
str2buf function removedUse Buffer.from(<data>, <encoding>) instead.
getAddressFromPriv doesn't accept private key as base64-encoded or raw string
getAddressFromPriv doesn't accept private key as base64-encoded or raw stringisValidKeypair doesn't accept public key as base64-encoded string
isValidKeypair doesn't accept public key as base64-encoded stringbytesToHex function removed
bytesToHex function removedUse Buffer.from(<bytes>).toString('hex') instead.
hexToBytes function removed
hexToBytes function removedUse Buffer.from(<hex string>, 'hex') instead.
rename umd export to Aeternity
AeternitySubpaths imports of SDK are not allowed
SDK does versioning only for the API provided in the root export. Replace subpaths imports with imports of the package root.
-import MemoryAccount from '@aeternity/aepp-sdk/es/account/Memory.mjs';
+import { MemoryAccount } from '@aeternity/aepp-sdk';Removed getNetworkId from AeSdkBase
getNetworkId from AeSdkBaseUse Node.getNetworkId instead.
address a getter in AeSdkBase
address a getter in AeSdkBaseApply a change:
-await aeSdk.address()
+aeSdk.addressaddAccount is a sync function
addAccount is a sync functionverifyMessage removed from accounts and AeSdkBase
verifyMessage removed from accounts and AeSdkBaseUse verifyMessage exported in the root instead.
verify and verifyMessage accepts address instead of hex string or Uint8Array
verify and verifyMessage accepts address instead of hex string or Uint8ArrayConvert public key in Uint8Array to address using encode(pk, 'ak').
Convert public key in hex to address using encode(Buffer.from(pk, 'hex'), 'ak').
node@12 not supported
Use [email protected] or newer.
removeAccount throws an error if the account is not found
removeAccount throws an error if the account is not foundsignMessage always returns Uint8Array
signMessage always returns Uint8ArrayUse Buffer.from(signature).toString('hex') to convert it to hex.
encryptKey, decryptKey are not exported anymore
encryptKey, decryptKey are not exported anymoreUse 'sha.js' and 'aes-js' packages directly instead.
sha256hash is not exported anymore
sha256hash is not exported anymoreUse SubtleCrypto.digest or sha.js package instead.
height method removed
height method removedUse getHeight instead.
signUsingGA method removed
signUsingGA method removedUse AccountGeneralized.signTransaction instead.
POINTER_KEY_BY_PREFIX removed
POINTER_KEY_BY_PREFIX removedUse getDefaultPointerKey instead.
ID_TAG_PREFIX, PREFIX_ID_TAG, ID_TAG removed
ID_TAG_PREFIX, PREFIX_ID_TAG, ID_TAG removedUse transaction builder instead.
TX_TYPE removed.
TX_TYPE removed.Use Tag instead.
GAS_MAX removed
GAS_MAX removedThe maximum gas limit depends on transaction size, this value is outdated, sdk check/provides gasLimit by itself while building a transaction.
calculateMinFee removed
calculateMinFee removedUse buildTx to generate a transaction, unpack it and refer to fee field.
salt, createSalt removed
salt, createSalt removedUse genSalt instead.
Pointer removed
Pointer removedUse NamePointer from apis/node instead.
Last updated
Was this helpful?