Skip to content

Migration to 14.0.0

This guide describes all breaking changes introduced with v14.0.0.

Updated sdk requirements

Minimum supported versions:

Iris is not supported

Stick to a previous sdk version if it is required.

CommonJS bundles have cjs extension instead js

If you are importing files explicitly from dist folder then you need to update the extension

- https://unpkg.com/@aeternity/aepp-sdk/dist/aepp-sdk.browser-script.js
+ https://unpkg.com/@aeternity/aepp-sdk/dist/aepp-sdk.browser-script.cjs

recover, dump removed (AEX-3 keystore implementation)

Copy the removed implementation to your project or add a previous sdk as a separate dependency

  "dependencies": {
    "@aeternity/aepp-sdk": "^14.0.0",
    "@aeternity/aepp-sdk-13": "npm:@aeternity/aepp-sdk@^13.3.3"
  }

$host is readonly in generated APIs

It is made to don't break caching. If you need to change a server URL, create a new server instance instead.

- node.$host = 'http://example.com';
+ node = new Node('http://example.com');

Aepp

RpcBroadcastError not exported anymore

Because it is not thrown by wallet as well.

Contract delegations used in Iris removed from aepp-wallet connection

Use signDelegation api instead.

Wallet

AeSdkWallet requires onAskToSelectNetwork constructor option

Provide a function throwing RpcMethodNotFoundError if you don't want to support network change by aepp.

Transaction builder

ChannelClientReconnectTx removed

You couldn't use it because it is not supported on the node side.

ORACLE_TTL, QUERY_TTL, RESPONSE_TTL not exported anymore

These values provided by default in buildTx, if necessary define them as

const ORACLE_TTL = { type: ORACLE_TTL_TYPES.delta, value: 500 };
const QUERY_TTL = { type: ORACLE_TTL_TYPES.delta, value: 10 };
const RESPONSE_TTL = { type: ORACLE_TTL_TYPES.delta, value: 10 };

buildTx/unpackTx works only with transactions

If you need to work with node's entry use packEntry/unpackEntry.

Tag include only transactions

Node entries tags moved to EntryTag.

buildTx doesn't accept prefix anymore

Use decode/encode to convert payload to desired format.

NAME_*TTL, CLIENT_TTL not exported anymore

These values provided by default in buildTx, if necessary define them as

const NAME_TTL = 180000;
const NAME_MAX_TTL = 36000;
const NAME_MAX_CLIENT_TTL = 86400;
const CLIENT_TTL = 86400;

Node

Node returns time in KeyBlock and MicroBlockHeader as Date

Apply a change

-const time = new Date(
-  (await node.getTopHeader()).time,
-);
+const time = (await node.getTopHeader()).time;

Account

Save HD wallets methods removed

Namely: deriveChild, derivePathFromKey, getMasterKeyFromSeed, derivePathFromSeed, getKeyPair, generateSaveHDWalletFromSeed, getSaveHDWalletAccounts, getHdWalletAccountFromSeed. Use AccountMnemonicFactory instead.

sign, signMessage removed

Use MemoryAccount:sign, MemoryAccount:signMessage instead.

isValidKeypair removed

Create a MemoryAccount by a secret key and compare it's address with an address in the key pair instead.

getAddressFromPriv removed

Use MemoryAccount instead.

- address = getAddressFromPriv(secretKeyOldFormat)
+ address = new MemoryAccount(secretKeyNewFormat).address

Use SDK tools page to convert secret keys.

generateKeyPair removed

Use MemoryAccount::generate instead. Optionally add decode if you need raw keys. Obtain the secret key via MemoryAccount:secretKey.

generateKeyPairFromSecret removed

Use MemoryAccount instead.

- const keyPair = generateKeyPairFromSecret(rawSecretKey)
+ const secretKey = encode(rawSecretKey.subarray(0, 32), Encoding.AccountSecretKey)
+ const account = new MemoryAccount(secretKey)
+ const keyPair = {
+   publicKey: decode(account.address),
+   secretKey: rawSecretKey,
+ }

MemoryAccount accepts secret key as sk_-prefixed string

Convert secret key as hex to new format as

const oldSk =
  '9ebd7beda0c79af72a42ece3821a56eff16359b6df376cf049aee995565f022f840c974b97164776454ba119d84edc4d6058a8dec92b6edc578ab2d30b4c4200';
const newSk = encode(Buffer.from(oldSk, 'hex').subarray(0, 32), Encoding.AccountSecretKey);
// 'sk_2CuofqWZHrABCrM7GY95YSQn8PyFvKQadnvFnpwhjUnDCFAWmf'

Use SDK tools page to convert secret keys.

AccountBase inheritors required to implement signTypedData, signDelegation

You can throw an exception if the account operation is not doable.

Aens

aens* methods removed

Use Name class instead.

-await aeSdk.aensPreclaim('example.chain')
+const name = new Name('example.chain', aeSdk.getContext())
+await name.preclaim()

Accordingly for other methods:

aensRevoke => Name:revoke
aensUpdate => Name:update
aensTransfer => Name:transfer
aensQuery => Name:getState
aensClaim => Name:claim
aensBid => Name:bid

NAME_BID_MAX_LENGTH not exported anymore

Use isAuctionName function instead.

Oracle

oracle methods removed

Use Oracle, OracleClient classes instead.

-aeSdk.pollForQueries(queryHandler)
+const oracle = new Oracle(account, aeSdk.getContext());
+oracle.pollQueries(queryHandler)

Accordingly for other methods:

extendOracleTtl => Oracle:extendTtl
respondToQuery => Oracle:respondToQuery
getOracleObject => Oracle:getState
registerOracle => Oracle:register
getQueryObject => Oracle:getQuery, OracleClient:getQuery
postQueryToOracle => OracleClient:postQuery
pollForQueryResponse => OracleClient:pollForResponse

pollQueries don't return responded queries by default

Use includeResponded option to restore the previous behavior.

Compiler

CompilerCli uses aesophia@8 by default

CompilerCli8 removed

Use CompilerCli instead.

Contract

encodeFateValue, decodeFateValue not exported anymore

Use ContractByteArrayEncoder:encodeWithType, decodeWithType from @aeternity/aepp-calldata.

AeSdk:initializeContract removed

Use Contract.initialize instead:

- aeSdk.initializeContract(options)
+ Contract.initialize({ ...aeSdk.getContext(), ...options })

createDelegationSignature removed

Use packDelegation and AccountBase::signDelegation instead.

-const dlg = await aeSdk.createDelegationSignature(contractAddress, [name]);
+const dlg = await aeSdk.signDelegation(
+  packDelegation({
+    tag: DelegationTag.AensName,
+    accountAddress: aeSdk.address,
+    contractAddress,
+    nameId: name,
+  }),
+);

Methods to sign specific delegations removed

Namely:

  • signDelegationToContract,
  • signNameDelegationToContract,
  • signAllNamesDelegationToContract,
  • signOracleQueryDelegationToContract.

Use signDelegation instead.