Migration to 14.0.0
This guide describes all breaking changes introduced with v14.0.0
.
Updated sdk requirements
Minimum supported versions:
aeternity node 7.1.0
aesophia@8
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)
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
onAskToSelectNetwork
constructor optionProvide a function throwing RpcMethodNotFoundError
if you don't want to support network change by
aepp.
Transaction builder
ChannelClientReconnectTx
removed
ChannelClientReconnectTx
removedYou couldn't use it because it is not supported on the node side.
ORACLE_TTL
, QUERY_TTL
, RESPONSE_TTL
not exported anymore
ORACLE_TTL
, QUERY_TTL
, RESPONSE_TTL
not exported anymoreThese 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
buildTx
/unpackTx
works only with transactionsIf you need to work with node's entry use packEntry
/unpackEntry
.
Tag
include only transactions
Tag
include only transactionsNode entries tags moved to EntryTag
.
buildTx
doesn't accept prefix
anymore
buildTx
doesn't accept prefix
anymoreUse decode
/encode
to convert payload to desired format.
NAME_*TTL
, CLIENT_TTL
not exported anymore
NAME_*TTL
, CLIENT_TTL
not exported anymoreThese 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
sign
, signMessage
removedUse MemoryAccount:sign, MemoryAccount:signMessage instead.
isValidKeypair
removed
isValidKeypair
removedCreate a MemoryAccount by a secret key and compare it's address with an address in the key pair instead.
getAddressFromPriv
removed
getAddressFromPriv
removedUse MemoryAccount instead.
- address = getAddressFromPriv(secretKeyOldFormat)
+ address = new MemoryAccount(secretKeyNewFormat).address
Use SDK tools page to convert secret keys.
generateKeyPair
removed
generateKeyPair
removedUse MemoryAccount::generate instead.
Optionally add decode
if you need raw keys.
Obtain the secret key via MemoryAccount:secretKey.
generateKeyPairFromSecret
removed
generateKeyPairFromSecret
removedUse 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
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
NAME_BID_MAX_LENGTH
not exported anymoreUse 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
pollQueries
don't return responded queries by defaultUse 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
encodeFateValue
, decodeFateValue
not exported anymoreUse ContractByteArrayEncoder:encodeWithType, decodeWithType from @aeternity/aepp-calldata
.
AeSdk:initializeContract
removed
AeSdk:initializeContract
removedUse Contract.initialize
instead:
- aeSdk.initializeContract(options)
+ Contract.initialize({ ...aeSdk.getContext(), ...options })
createDelegationSignature
removed
createDelegationSignature
removedUse 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.
Last updated
Was this helpful?