Migration to 12.0.0
Last updated
Was this helpful?
Last updated
Was this helpful?
This guide describes all breaking changes introduced with v12.0.0
.
Universal
, RpcAepp
, RpcWallet
, Ae
stamps are removedUse AeSdk
, AeSdkAepp
, AeSdkWallet
, AeSdbBase
accordingly.
For example:
Node
, RpcClient
, BrowserWindowMessage
classes are using private fieldsAccessing private fields through Proxy
will lead to "TypeError: attempted to set private
field on non-instance" ().
This may be an issue if you are using aepp-sdk with Vue@3, because Vue@3 introduced reactivity based
on Proxy
class ().
Avoid the above error by not making instances of these classes reactive.
require('@aeternity/aepp-sdk').generateKeyPair()
)Import the needed utils directly instead of importing a wrapper object firstly. For example:
AccountBase
and inheritors are classes nowUse new
to create an instance.
ChainNode
, Contract
, Oracle
, Aens
, GeneralizedAccount
stamps not exportedTheir methods exported instead. Outside of AeSdkBase
context, they may accept onAccount
,onNode
, onCompiler
options.
Node
, Compiler
(previously ContractCompilerHttp
) are classes instead of a stampsFor example:
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 promisegetNetworkId
ignores force
optionSo, it would throw exception in case networkId is not provided. Use try/catch
instead.
api
is removed in Node
Use node.getBalance
instead of node.api.getBalance.
Node
Use 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 numberNode
not accepts internalUrl
Node
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).
mempool
method in Node
Create a wrapper of internal API by genSwaggerClient
and use getPendingTransactions
method
instead.
compilerVersion
is removed in Compiler
Use compilerApi.aPIVersion()
method instead.
setCompilerUrl
changes compiler URL in syncDon't handle aeSdk.setCompilerUrl(...)
as a Promise
.
Compiler
requires options
object according to their specificationCompiler
returns and accepts keys named in camelCase instead of snake_caseUse aeSdk.buildTx(txType, params)
instead.
Use aeSdk.buildTx(txType, params)
instead.
nonce
, ttl
, gas
decoded and accepted as numbers instead of stringsgas
renamed to gasLimit
Use gasLimit
instead of gas
everywhere except for transaction details returned by node.
unpackTx
not accepting transaction as Buffer
, only as tx-encoded stringUse unpackTx(encode(tx, 'tx'))
instead.
unpackTx
doesn't have binary
field in resultUse require('rlp').decode(unpackTx(tx).rlpEncoded)
instead.
is no more accepted For example:
calculateMinFee
returns BigNumber instead of stringBASE_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 anymoreUse a general buildTx
method instead.
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 anymoreUse TX_TYPE[tag]
instead.
TX_SERIALIZATION_SCHEMA
combined with TX_DESERIALIZATION_SCHEMA
Use TX_SCHEMA[TX_TYPE.*]
instead.
Use OBJECT_ID_TX_TYPE
to find tag by transaction type.
computeBidFee
accepts startFee
, increment
as optionsNAME_BID_TIMEOUTS
not exposed anymoreUse computeAuctionEndBlock
function instead.
computeAuctionEndBlock
accepts and returns height as numberensureNameValid
Use a TypeScript check instead.
name.update
, name.revoke
doesn't accept address in onAccount
Pass an instance of AccountBase
to onAccount
option instead.
extendOracleTtl
accepts oracle ttl in oracleTtlType
and oracleTtlValue
fieldsUse oracleTtlType
field instead of type
, and oracleTtlValue
field instead of value
.
decode
method of getQueryObject
removedUse decode
function instead.
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 objectcontractId
accepted as the first argument, queryId
should be passed as option to the second one.
createGeneralizedAccount
is requiredPass an empty array if you need no arguments.
filesystem
option renamed to fileSystem
onAccount
It should be an instance of AccountBase
instead.
balance
methodUse getBalance
instead.
tx
methodUse node.getTransactionByHash/getTransactionInfoByHash
instead.
getTxInfo
methodUse node.getTransactionInfoByHash
instead.
getAccountNonce
removedUse node.getAccountNextNonce
instead.
AeSdk
doesn't accept array of accountsUse aeSdk.addAccount
method instead.
destroyInstance
method removedIt wasn't doing anything, just remove it's usages.
NodePool
is removedUse AeSdkBase
or AeSdk
instead.
AccountMultiple
is removedUse AeSdk
instead.
DENOMINATION_MAGNITUDE
not exposed anymoreIt is intended for internal use only.
unpackTx
returned instead of TxObject
In txObject
option of onSign
handler on wallet side.
In tx
field of contract call result.
validateKeyObj
removedRely on TypeScript checks instead.
deriveKeyUsingArgon2id
removedUse argon2-browser
package instead.
getAddressFromPriv
in keystoreUse Crypto.getAddressFromPriv
instead.
genSwaggerClient
removedUse swagger-client
package instead.
Create instances using new.
Use connectionProxy
, walletDetector
accordingly.
origin
propertyUse connection
property instead.
sendMessage
is a private methodUse request
or notify
instead.
handlers
parameter is removedProvide a methods
parameter instead of handlers[0]
.
Provide an onDisconnect
parameter instead of handlers[1]
.
Get aepp info in onConnection
callback, and store somehow to use later.
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.
isInIframe
, sendMessage
, getHandler
, message
,responseMessage
, sendResponseMessage
, isValidAccounts
)
Use own implementation if needed.
connectToWallet
accepts wallet connection as the first argumentdisconnectWallet
runs in sync and sendDisconnect
arg removedSo, aepp would always send closeConnection
notification.
sendConnectRequest
removedUse connectToWallet
instead.
connection
anymoreUse connectToWallet
method instead.
isConnected
, isSubscribedAccount
methodsDetect is aepp connected by persistence of rpcClient
property.
signMessage
returns Buffer by defaultUse returnHex
option to get the previous behaviour.
BrowserRuntimeConnection
requires port
parameterPass require('webextension-polyfill').runtime.connect()
to it.
id
, type
in paramsid
should be a unique string;type
should be one of WALLET_TYPE.window
, WALLET_TYPE.extension
.
getBrowserAPI
helper removedUse webextension-polyfill
package instead.
shareWalletInfo
accepts rpc client id instead of callbackFor example:
shareNode
argument in accept callback of onConnection
removedJust deny the connection if you don't want to share the node url.
If you need this feature, create a custom wallet implementation or fill us an issue.
txObject
parameter of onSign
callback is removedUse unpackTx(tx)
on wallet side instead.
rpcClients
in wallet is not exposed anymoreThis expected to be used only internally.
onDisconnect
callback on wallet side accepts client id instead of RpcClient
Use sdk.rpcClient[clientId]
to get the corresponding instance of RpcClient.
If you need this feature, create a custom wallet implementation or fill us an issue.
If you need this feature, create a custom wallet implementation or fill us an issue.
action.accept
in permission callbacksReturn the value you passed to accept
instead.
action.deny
in permission callbacksThrow instances of RpcRejectedByUserError
instead.
See for details.