Migration to 10.0.0
Last updated
Was this helpful?
Last updated
Was this helpful?
This guide describes all breaking changes introduced with v10.0.0
.
pollForQueryResponse
returns response as string ()replace oldResult.decode
with new Buffer(newResult)
.
replace oldResult.response
with TxBuilderHelper.encode(new Buffer(newResult), 'or')
.
skipArgsConvert
option of contract call and deployment ()Convert arguments in intermediate Sophia representation to JavaScript types. For example:
rewrite to
skipTransformDecoded
option of contract call and deployment ()Decoding to JavaScript types is enforced, please use it instead.
Encode addresses as an ak_
-prefixed string instead.
contractEncodeCall
()Use contractEncodeCallDataAPI
instead.
Use contractDecodeCallResultAPI
instead.
Pass them through getContractInstance
options instead.
Use getContractInstance
instead. Also, these methods will accept JavaScript-type variables instead of
Sophia-encoded. For example:
should be replaced with
Use compiler 6.0.0 and above.
Use validateBytecode
when you need to ensure that the source code/bytecode provided togetContractInstance
corresponds to the on-chain bytecode.
Use node.consensusProtocolVersion
instead.
Numbers in Sophia are not limited in size. Before they were returned from contract methods as usual JavaScript numbers that have limited accuracy. To fix this, we make it return instances of BigInt.
Variant types are now supported by sdk, so replace "RelativeTTL(50)"
with { RelativeTTL: [50] }
.
As an exception Some(value)
is converted to the exact value in JavaScript and None
is converted to undefined
(Sophia's option
type).
Contract methods will accept/return instances of JavaScript's Map
as variables of Sophia's map
type. Objects are not accepted as maps any longer.
Sophia's hash
, signature
, bytes
types return values as Uint8Array
instead of a hex-encoded
string.
Use .decodedResult
instead of .decode()
to get the result of method call.
Most of the errors thrown by contract iterations will be different due to doing validation using
calldata package instead of joi
.
For example:
rewrite to
Contract instance can be generated by ACI and bytecode:
SDK won't use hosted compiler in this case.
Also, contract.compiled
was renamed to contract.bytecode
.
For example, replace
with
Use third-party cryptographic packages instead of Crypto.encryptData
, Crypto.decryptData
methods.
For example, replace
with
Additionally, getDefaultPointerKey
(was named classify
before) helper function can be used
Check the of calldata package for additional info.
To support old environments, you need to set up transpilation of SDK package while building your
app. In Webpack it can be done by node_modules
folder except for this package in babe-loader
rule. In @vue/cli
you can use option.