web-sdk v7.0.0
Breaking changes
- The package is published as an ES module, instead of commonJS. Migration steps can be seen in the upgrade guide
- The package has been split into several entrypoints that can be used to limit the scope of what is included from the SDK.
@concordium/common-sdk
exposes the full API of the SDK.@concordium/common-sdk/cis0
entrypoint exposes functionality for working with contracts adhering to the CIS-0 standard.@concordium/common-sdk/cis2
entrypoint exposes functionality for working with contracts adhering to the CIS-2 standard.@concordium/common-sdk/cis4
entrypoint exposes functionality for working with contracts adhering to the CIS-4 standard.@concordium/common-sdk/grpc
entrypoint exposes the grpc client for interacting with a nodes GRPCv2 interface.@concordium/common-sdk/id
entrypoint exposes functionality for working with ID proofs.@concordium/common-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/common-sdk/types
entrypoint exposes functionality for working with concordium domain types.@concordium/common-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/common-sdk/web3-id
entrypoint exposes functionality for working with web3-id proofs.- This change makes the library incompatible with node versions <16 and requires bundlers to respect the
exports
field ofpackage.json
. - For TypeScript projects the minimum required version of typescript is:
- NodeJS: 4.7,
"moduleResolution": "node16" // or "nodenext"
- Bundled applications (webpack, esbuild, rollup, etc...): 5.0,
"moduleResolution": "bundler"
- NodeJS: 4.7,
- The following functions now parse using
json-bigint
meaning that they return bigints instead of numbers for all numbers no matter sizedeserializeContractState
deserializeReceiveReturnValue
deserializeReceiveError
deserializeInitError
deserializeTypeValue
The API now uses dedicated types instead of language primitives:
- Use
AccountAddress
instead of a string with base58 encoding. UseAccountAddress.fromBase58('<base58>')
to construct it. - Use
BlockHash
instead of a string with hex encoding. UseBlockHash.fromHexString('<hex>')
to construct it. - Use
TranactionHash
instead of a string with hex encoding. UseTransactionHash.fromHexString('<hex>')
to construct it. - Use
Energy
instead of a bigint. UseEnergy.create(<integer>)
to construct it. - Use
ReceiveName
instead of a string. UseReceiveName.fromString('<contract>.<function>')
to construct it. - Use
InitName
instead of a string. UseInit.fromString('init_<contract>')
to construct it. - Use
ContractName
instead of a string. UseContractName.fromString('<contract>')
to construct it. - Use
EntrypointName
instead of a string. UseEntrypointName.fromString('<function>')
to construct it. - Use
Parameter
instead of a string with hex encoding. UseParameter.fromHexString('<hex>')
. - Use
SequenceNumber
(formerly called nonce) instead of a bigint. UseSequenceNumber.create(<integer>)
to construct it. - Use
Timestamp
instead of a bigint. Can be constructed usingTimestamp.fromMillis(<integer>)
. - Use
Duration
instead of a bigint. Can be constructed usingDuration.fromMillis(<integer>)
. - Use
ContractEvent
instead of a string with hex encoding. Can be constructed usingContractEvent.fromHexString('<hex>')
. - Use
CcdAmount
instead of a bigint. Can be constructed usingCcdAmount.fromMicroCcd(<integer>)
. - Use
TransactionExpiry
instead of a Date object. Can be constructed usingTransactionExpiry.fromDate(<date>)
. - Use
ModuleReference
instead of a string with hex encoding. Can be constructed usingModuleReference.fromHexString('<hex-string>')
.
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
CcdAmount
is now a module with functions related to amounts of CCDs:- To refer to
CcdAmount
as a type useCcdAmount.Type
. - Constructing
new CcdAmount(<integer>)
is nowCcdAmount.fromMicroCcd(<integer>)
. - The methods
toMicroCcd
andtoCcd
are now functions refered to asCcdAmount.toMicroCcd
andCcdAmount.toCcd
respectively.
- To refer to
TransactionExpiry
is now a module with functions related to amounts of expiry time of transactions:- To refer to
TransactionExpiry
as a type useTransactionExpiry.Type
. - Constructing
new TransactionExpiry(<expiry>, <allowExpired>)
is nowTransactionExpiry.fromDate(<expiry>)
, and the check of being a time in the future is removed and done when sending the transaction instead.
- To refer to
ModuleReference
is now a module with functions related to references to smart contract modules:- To refer to
ModuleReference
as a type useModuleReference.Type
. - Constructing
new ModuleReference("<hex-string>")
is nowModuleReference.fromHexString("<hex-string>")
. - The static method
ModuleReference.fromBytes
is nowModuleReference.fromBuffer
.
- To refer to
- Removed
JsonRpcClient
and types and functionality associated solely with this class. - Renamed
AccountSequenceNumber
module toSequenceNumber
. - Fix type for
TranferredEvent
fromContractTraceEvent
to only be from contract addresses to account addresses. - Added
effectiveTime
field toPendingUpdate
.
Added
- All JSON serialization in
serialization.ts
is now handled byjson-bigint
meaning that all functions now correctly handles bigint inputs Timestamp
is now a module with functions related to time.- To refer to
Timestamp
as a type useTimestamp.Type
.
- To refer to
Duration
is now a module with functions related to durations of time.EntrypointName
is now a module with functions related to entrypoint names of a smart contract.ReceiveName
is now a module with functions related to receive-function names of a smart contract.ReturnValue
is now a module with functions related to return values from invoking a smart contract.- Functions
jsonStringify
andjsonParse
, which acts as a regularJSON.stringify
andJSON.parse
correspondingly,
with the addition of stringifying concordium domain types in a wrapper object that can be parsed into the respective types. - Introduce function
versionedModuleSourceToBuffer
for serializing a versioned module to a buffer, which can be stored in a file.
Changes
- Added version discriminators to types versioned by the protocol version of Concordium nodes:
MintDistribution
GasRewards
RewardParameters
ChainParameters
Authorizations
RewardStatus
BlockInfo
ConsensusStatus
AccountBakerDetails
ElectionInfo
- Added type discriminator to different forms of
AccountInfo
.