Several types have been replaced with a module containing the type itself together with functions for constructing and converting the type:
AccountAddress
is now a module with functions related to account addresses:- To refer to
AccountAddress
as a type useAccountAddress.Type
. - Constructing
new AccountAddress("<address>")
is nowAccountAddress.fromBase58("<address>")
. isAlias
andgetAlias
are now accessable fromAccountAddress.isAlias
andAccountAddress.getAlias
.
- To refer to
ContractAddresss
is now a module with functions related to contract addresses:- To refer to
ContractAddress
as a type useContractAddress.Type
. - To construct the type use
ContractAddress.create(index, subindex)
.
- To refer to
CredentialRegistrationId
is now a module with functions related to credential registration IDs:- To refer to
CredentialRegistrationId
as a type useCredentialRegistrationId.Type
. - Constructing
new CredentialRegistrationId("<hex-string>")
is nowCredentialRegistrationId.fromHexString("<hex-string>")
.
- To refer to
Duration
is now a module with functions related to durations of time.- To refer to
Duration
as a type useDuration.Type
.
- To refer to
Timestamp
is now a module with functions related to timestamps.- To refer to
Timestamp
as a type useTimestamp.Type
.
- To refer to
The API now uses dedicated types instead of language primitives:
- Uses
AccountAddress
instead of a string with base58 encoding. Can be constructed usingAccountAddress.fromBase58('<base58>')
. - Uses
BlockHash
instead of a string with hex encoding. Can be constructed usingBlockHash.fromHexString('<hex>')
. - Uses
TranactionHash
instead of a string with hex encoding. Can be constructed usingTransactionHash.fromHexString('<hex>')
. - Uses
Energy
instead of a bigint. Can be constructed usingEnergy.create(<integer>)
. - Uses
ReceiveName
instead of a string. Can be constructed usingReceiveName.fromString('<contract>.<function>')
. - Uses
InitName
instead of a string. Can be constructed usingInit.fromString('init_<contract>')
. - Uses
ContractName
instead of a string. Can be constructed usingContractName.fromString('<contract>')
. - Uses
EntrypointName
instead of a string. Can be constructed usingEntrypointName.fromString('<function>')
. - Uses
Parameter
instead of a string with hex encoding. Can be constructed usingParameter.fromHexString('<hex>')
. - Uses
SequenceNumber
(formerly called nonce) instead of a bigint. Can be constructed usingSequenceNumber.create(<integer>)
. - Uses
Timestamp
instead of a bigint. Can be constructed usingTimestamp.fromMillis(<integer>)
. - Uses
Duration
instead of a bigint. Can be constructed usingDuration.fromMillis(<integer>)
.
The @concordium/web-sdk
now requires bundlers to respect exports
field of
package.json
of a module. This is due to relying on entrypoints declared in
the exports
field of @concordium/rust-bindings
to make it possible to select
only parts of the SDK to include in your application.
Furthermore, the SDK is now published as an ES module, making it possible to
eliminate dead code.
For TypeScript users, at least typescript version 5 is required along with
the setting compilerOptions.moduleResolution
to "bundler"
to match the
resolution strategy of modern bundlers.
The following entrypoints are made available for consumers of
@concordium/web-sdk
:
@concordium/web-sdk
exposes the full API of the SDK. This can safely be used by projects built with ES modules.@concordium/web-sdk/cis0
entrypoint exposes functionality for working with contracts adhering to the CIS-0 standard.@concordium/web-sdk/cis2
entrypoint exposes functionality for working with contracts adhering to the CIS-2 standard.@concordium/web-sdk/cis4
entrypoint exposes functionality for working with contracts adhering to the CIS-4 standard.@concordium/web-sdk/grpc
entrypoint exposes the grpc client for interacting with a nodes GRPCv2 interface.@concordium/web-sdk/id
entrypoint exposes functionality for working with ID proofs.@concordium/web-sdk/json-rpc
entrypoint exposes the (deprecated) json-rpc client for interacting with a nodes GPRCv1 interface.@concordium/web-sdk/schema
entrypoint exposes functionality for working with smart contract schemas, i.e.(de)serializing types using a smart contract schema.- This uses the wasm entrypoint at
@concordium/rust-bindings/dapp
.
- This uses the wasm entrypoint at
@concordium/web-sdk/types
entrypoint exposes functionality for working with concordium domain types.@concordium/web-sdk/wasm
entrypoint exposes a variety of functionality for working with concordium domain types, which requires WASM.- This uses the wasm entrypoint at
@concorodium/rust-bindings/wallet
.
- This uses the wasm entrypoint at
@concordium/web-sdk/web3-id
entrypoint exposes functionality for working with web3-id proofs.
The @concordium/node-sdk
has been removed in favor of unifying both web and
nodejs SDK's in a single platform agnostic SDK. This means users of
@concordium/node-sdk
looking to upgrade, will need to install
@concordium/web-sdk
instead.
The @concordium/web-sdk
module is not compatible with
node versions <16 and is published only as an ES module.
This, in turn, requires users to also run applications as ES modules.
The easiest way to run your node application as an ES module, is by setting
the type
field of package.json
to be set to "module"
:
{
...
"type": "module",
...
}
Alternatively, files names with the extension mjs
(or mts
for TypeScript)
are always handled as ES modules.
For TypeScript users, at least typescript version 4.7 is required along
with the setting compilerOptions.moduleResolution
to "node16"
or
"nodenext"
to match the resolution strategy of node version 16 and later.
Some classes and types have been renamed or changed, and should be update if used.
Some types in the AccountTransactionType enum have been changed to align with other languages.
- InitializeSmartContractInstance -> InitContract
- UpdateSmartContractInstance -> Update
- SimpleTransfer -> Transfer
- EncryptedTransfer -> EncryptedAmountTransfer
- SimpleTransferWithMemo -> TransferWithMemo
- EncryptedTransferWithMemo -> EncryptedAmountTransferWithMemo
The GtuAmount
class has been renamed to CcdAmount
to reflect the current
name of token. If an object was used in place of a class instance, the field
microGtuAmount
should be renamed to microCcdAmount
.
The field content
has been renamed to source
to align with other languages.
Field names have been renamed to align with other languages. contractAddress
field has been renamed to address
. parameter
field has been renamed to
message
.
Field names have been renamed to align with other languages. contractName
field has been renamed to initName
. parameter
field has been renamed to
params
.