Migration to 12.0.0
This guide describes all breaking changes introduced with v12.0.0.
General
Universal, RpcAepp, RpcWallet, Ae stamps are removed
Universal, RpcAepp, RpcWallet, Ae stamps are removedUse AeSdk, AeSdkAepp, AeSdkWallet, AeSdbBase accordingly.
For example:
-import { Universal } from '@aeternity/aepp-sdk'
+import { AeSdk } from '@aeternity/aepp-sdk'
-const aeSdk = await Universal(options)
+const aeSdk = new AeSdk(options)Node, RpcClient, BrowserWindowMessage classes are using private fields
Node, RpcClient, BrowserWindowMessage classes are using private fieldsAccessing private fields through Proxy will lead to "TypeError: attempted to set private
field on non-instance" (tc39).
This may be an issue if you are using aepp-sdk with Vue@3, because Vue@3 introduced reactivity based
on Proxy class (Vue docs).
Avoid the above error by not making instances of these classes reactive.
all combined exports are inlined (require('@aeternity/aepp-sdk').generateKeyPair())
require('@aeternity/aepp-sdk').generateKeyPair())Import the needed utils directly instead of importing a wrapper object firstly. For example:
-import { Crypto } from '@aeternity/aepp-sdk'
+import { generateKeyPair } from '@aeternity/aepp-sdk'
-console.log(Crypto.generateKeyPair())
+console.log(generateKeyPair())AccountBase and inheritors are classes now
AccountBase and inheritors are classes nowUse new to create an instance.
ChainNode, Contract, Oracle, Aens, GeneralizedAccount stamps not exported
ChainNode, Contract, Oracle, Aens, GeneralizedAccount stamps not exportedTheir methods exported instead. Outside of AeSdkBase context, they may accept onAccount,onNode, onCompiler options.
Node and Compiler
Node, Compiler (previously ContractCompilerHttp) are classes instead of a stamps
Node, Compiler (previously ContractCompilerHttp) are classes instead of a stampsFor example:
import { Node } from '@aeternity/aepp-sdk'
-const node = await Node({ url, ignoreVersion: false })
+const node = new Node(url, { ignoreVersion: false })Node, Compiler doesn't check version on the first request instead of init
Node, Compiler doesn't check version on the first request instead of initDon't handle new Node(...) and new Compiler(...) as a Promise.
getNetworkId returns a promise
getNetworkId returns a promisegetNetworkId ignores force option
getNetworkId ignores force optionSo, it would throw exception in case networkId is not provided. Use try/catch instead.
api is removed in Node
api is removed in NodeUse node.getBalance instead of node.api.getBalance.
static properties are removed in Node
NodeUse node.getStatus() or node.getNodeInfo() to get values of version, revision,genesisHash, nodeNetworkId, consensusProtocolVersion.
Node returns BigInts for coin amount fields instead of string or number
Node returns BigInts for coin amount fields instead of string or numberNode not accepts internalUrl
Node not accepts internalUrlNode doesn't accepts and stores internalUrl, also internal endpoints are not available anymore.
If necessary, create a wrapper of internal API separately (swagger-client package).
removed mempool method in Node
mempool method in NodeCreate a wrapper of internal API by genSwaggerClient and use getPendingTransactions method
instead.
compilerVersion is removed in Compiler
compilerVersion is removed in CompilerUse compilerApi.aPIVersion() method instead.
setCompilerUrl changes compiler URL in sync
setCompilerUrl changes compiler URL in syncDon't handle aeSdk.setCompilerUrl(...) as a Promise.
methods of Compiler requires options object according to their specification
Compiler requires options object according to their specificationmethods of Compiler returns and accepts keys named in camelCase instead of snake_case
Compiler returns and accepts keys named in camelCase instead of snake_caseTransaction builder
removed methods to generate a transaction of specific type
Use aeSdk.buildTx(txType, params) instead.
removed ability to generate transaction on the node side
Use aeSdk.buildTx(txType, params) instead.
nonce, ttl, gas decoded and accepted as numbers instead of strings
nonce, ttl, gas decoded and accepted as numbers instead of stringsgas renamed to gasLimit
gas renamed to gasLimitUse gasLimit instead of gas everywhere except for transaction details returned by node.
unpackTx not accepting transaction as Buffer, only as tx-encoded string
unpackTx not accepting transaction as Buffer, only as tx-encoded stringUse unpackTx(encode(tx, 'tx')) instead.
unpackTx doesn't have binary field in result
unpackTx doesn't have binary field in resultUse require('rlp').decode(unpackTx(tx).rlpEncoded) instead.
encode: since the prefix is evaluated by the type itself the required prefix parameter
is no more accepted For example:
-decode('cb_DA6sWJo=', 'cb')
+decode('cb_DA6sWJo=')calculateMinFee returns BigNumber instead of string
calculateMinFee returns BigNumber instead of stringFee helpers not exported anymore (BASE_GAS, GAS_PER_BYTE, KEY_BLOCK_INTERVAL,
BASE_GAS, GAS_PER_BYTE, KEY_BLOCK_INTERVAL,TX_FEE_BASE_GAS, TX_FEE_OTHER_GAS, calculateFee, DEFAULT_FEE)
Use a general calculateMinFee instead.
buildRawTx, calculateTtl not exported anymore
buildRawTx, calculateTtl not exported anymoreUse a general buildTx method instead.
TX_TYPE mapped to tag (number) instead of string
TX_TYPE mapped to tag (number) instead of stringAlways use TX_TYPE. To get type name by tag use TX_TYPE[tag].
OBJECT_ID_TX_TYPE not exported anymore
OBJECT_ID_TX_TYPE not exported anymoreUse TX_TYPE[tag] instead.
TX_SERIALIZATION_SCHEMA combined with TX_DESERIALIZATION_SCHEMA
TX_SERIALIZATION_SCHEMA combined with TX_DESERIALIZATION_SCHEMAUse TX_SCHEMA[TX_TYPE.*] instead.
Transaction schemas doesn't contain tag anymore
Use OBJECT_ID_TX_TYPE to find tag by transaction type.
AENS
computeBidFee accepts startFee, increment as options
computeBidFee accepts startFee, increment as optionsNAME_BID_TIMEOUTS not exposed anymore
NAME_BID_TIMEOUTS not exposed anymoreUse computeAuctionEndBlock function instead.
computeAuctionEndBlock accepts and returns height as number
computeAuctionEndBlock accepts and returns height as numberremoved ensureNameValid
ensureNameValidUse a TypeScript check instead.
name.update, name.revoke doesn't accept address in onAccount
name.update, name.revoke doesn't accept address in onAccountPass an instance of AccountBase to onAccount option instead.
Oracle
extendOracleTtl accepts oracle ttl in oracleTtlType and oracleTtlValue fields
extendOracleTtl accepts oracle ttl in oracleTtlType and oracleTtlValue fieldsUse oracleTtlType field instead of type, and oracleTtlValue field instead of value.
decode method of getQueryObject removed
decode method of getQueryObject removedUse decode function instead.
Contract
createAensDelegationSignature first argument not an object
createAensDelegationSignature first argument not an objectcontractId accepted as the first argument, name should be passed as option to the second one.
createOracleDelegationSignature first argument not an object
createOracleDelegationSignature first argument not an objectcontractId accepted as the first argument, queryId should be passed as option to the second one.
call arguments in createGeneralizedAccount is required
createGeneralizedAccount is requiredPass an empty array if you need no arguments.
filesystem option renamed to fileSystem
filesystem option renamed to fileSystemContract instance doesn't accept address in onAccount
onAccountIt should be an instance of AccountBase instead.
Chain
removed balance method
balance methodUse getBalance instead.
removed tx method
tx methodUse node.getTransactionByHash/getTransactionInfoByHash instead.
removed getTxInfo method
getTxInfo methodUse node.getTransactionInfoByHash instead.
Other
getAccountNonce removed
getAccountNonce removedUse node.getAccountNextNonce instead.
AeSdk doesn't accept array of accounts
AeSdk doesn't accept array of accountsUse aeSdk.addAccount method instead.
destroyInstance method removed
destroyInstance method removedIt wasn't doing anything, just remove it's usages.
NodePool is removed
NodePool is removedUse AeSdkBase or AeSdk instead.
AccountMultiple is removed
AccountMultiple is removedUse AeSdk instead.
DENOMINATION_MAGNITUDE not exposed anymore
DENOMINATION_MAGNITUDE not exposed anymoreIt is intended for internal use only.
The result of unpackTx returned instead of TxObject
unpackTx returned instead of TxObjectIn txObject option of onSign handler on wallet side.
In tx field of contract call result.
validateKeyObj removed
validateKeyObj removedRely on TypeScript checks instead.
deriveKeyUsingArgon2id removed
deriveKeyUsingArgon2id removedUse argon2-browser package instead.
removed extra implementation of getAddressFromPriv in keystore
getAddressFromPriv in keystoreUse Crypto.getAddressFromPriv instead.
genSwaggerClient removed
genSwaggerClient removedUse swagger-client package instead.
Aepp Wallet communication
BrowserRuntimeConnection, BrowserWindowMessageConnection are classes
Create instances using new.
ContentScriptBridge, WalletDetector rewrited to plain functions
Use connectionProxy, walletDetector accordingly.
RpcClient: removed origin property
origin propertyUse connection property instead.
RpcClient: sendMessage is a private method
sendMessage is a private methodUse request or notify instead.
RpcClient: handlers parameter is removed
handlers parameter is removedProvide a methods parameter instead of handlers[0].
Provide an onDisconnect parameter instead of handlers[1].
RpcClient: doesn't contain aepp info anymore
Get aepp info in onConnection callback, and store somehow to use later.
RpcClient: doesn't contain networkId anymore
networkId anymoreOn wallet side: assume that all aepps uses the same network as the wallet connected to.
On aepp side: use networkId that wallet provided.
In case networkId is not compatible ask user to switch wallet to a compatible network.
RPC helpers are not exposed anymore (isInIframe, sendMessage, getHandler, message,
isInIframe, sendMessage, getHandler, message,responseMessage, sendResponseMessage, isValidAccounts)
Use own implementation if needed.
Aepp
connectToWallet accepts wallet connection as the first argument
connectToWallet accepts wallet connection as the first argumentSee connect-aepp-to-wallet.md for details.
disconnectWallet runs in sync and sendDisconnect arg removed
disconnectWallet runs in sync and sendDisconnect arg removedSo, aepp would always send closeConnection notification.
sendConnectRequest removed
sendConnectRequest removedUse connectToWallet instead.
doesn't accept connection anymore
connection anymoreUse connectToWallet method instead.
removed isConnected, isSubscribedAccount methods
isConnected, isSubscribedAccount methodsDetect is aepp connected by persistence of rpcClient property.
signMessage returns Buffer by default
signMessage returns Buffer by defaultUse returnHex option to get the previous behaviour.
Wallet
BrowserRuntimeConnection requires port parameter
BrowserRuntimeConnection requires port parameterPass require('webextension-polyfill').runtime.connect() to it.
requires id, type in params
id, type in paramsid should be a unique string;type should be one of WALLET_TYPE.window, WALLET_TYPE.extension.
getBrowserAPI helper removed
getBrowserAPI helper removedUse webextension-polyfill package instead.
shareWalletInfo accepts rpc client id instead of callback
shareWalletInfo accepts rpc client id instead of callbackFor example:
const connection = new BrowserRuntimeConnection({ port })
-aeSdk.addRpcClient(connection)
-aeSdk.shareWalletInfo(port.postMessage.bind(port))
+const rpcClientId = aeSdk.addRpcClient(connection)
+aeSdk.shareWalletInfo(rpcClientId)shareNode argument in accept callback of onConnection removed
shareNode argument in accept callback of onConnection removedJust deny the connection if you don't want to share the node url.
can't handle specific set of accounts for an app
If you need this feature, create a custom wallet implementation or fill us an issue.
txObject parameter of onSign callback is removed
txObject parameter of onSign callback is removedUse unpackTx(tx) on wallet side instead.
rpcClients in wallet is not exposed anymore
rpcClients in wallet is not exposed anymoreThis expected to be used only internally.
onDisconnect callback on wallet side accepts client id instead of RpcClient
onDisconnect callback on wallet side accepts client id instead of RpcClientUse sdk.rpcClient[clientId] to get the corresponding instance of RpcClient.
wallet can't selectively notify aepps about selecting/adding account
If you need this feature, create a custom wallet implementation or fill us an issue.
wallet can't provide metadata for accounts
If you need this feature, create a custom wallet implementation or fill us an issue.
removed action.accept in permission callbacks
action.accept in permission callbacksReturn the value you passed to accept instead.
removed action.deny in permission callbacks
action.deny in permission callbacksThrow instances of RpcRejectedByUserError instead.
callbacks accept client id, params, and origin
Last updated
Was this helpful?