Skip to content

Releases: Concordium/concordium-node-sdk-js

ccd-js-gen v1.2.0

23 Jan 09:44
0907caf
Compare
Choose a tag to compare
  • Fix issue related to inferring module type names from the input file name, by removing characters, which are not valid in type names.
  • Improve information when reporting progress during code-generation.
  • Generate create<ContractName>ParameterWebWallet and create<EntrypointName>ParameterWebWallet functions for constructing the smart contract parameters in the format used by the Concordium Web-Wallet.
  • Minor breaking change: create<EntrypointName>Parameter function for contract entries and create<ContractName>Parameter function in module are no longer generated when parameter schema type is Unit. These functions are mainly used internally, but are still exposed.
  • Fix bug for generating JSON for schema type ULeb128 and ILeb128.
  • Add optional flag --ts-nocheck, enabling it will add // @ts-nocheck in each generated file.
  • Add --output-type <type> flag to CLI allowing to specify whether to generate TypeScript or JavaScript directly.
  • Fix the executable version of the package on Windows.

web-sdk v7.1.0

13 Nov 13:37
1c859a0
Compare
Choose a tag to compare

Added

  • jsonUnwrapStringify function, which can be used to unwrap concordium domain types to their inner values before serializing, to ease compatibility with dependants deserializing stringified JSON.

web-sdk v7.0.3

06 Nov 14:01
5258133
Compare
Choose a tag to compare

Fixed

  • An issue with the serialization of init contract account transactions.

web-sdk v7.0.1

31 Oct 09:36
14ae952
Compare
Choose a tag to compare

Added

  • Support for using the SDK in a react native environment. Requires polyfilling functionality used within the SDK.
    Please refer to the guide found at the react native compatibility guide

Fixed

  • Export type BlockItem in the public API again, this was removed accidentally in v7.0.0.

ccd-js-gen v1.0.0

23 Jan 09:15
e4bbc88
Compare
Choose a tag to compare

Initial release of the ccd-js-gen package, providing JavaScript code generation for smart contract clients.

web-sdk v7.0.0

19 Oct 13:11
a1c9bf2
Compare
Choose a tag to compare

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.
    • @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.
    • @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 of package.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"
  • The following functions now parse using json-bigint meaning that they return bigints instead of numbers for all numbers no matter size
    • deserializeContractState
    • deserializeReceiveReturnValue
    • deserializeReceiveError
    • deserializeInitError
    • deserializeTypeValue

The API now uses dedicated types instead of language primitives:

  • Use AccountAddress instead of a string with base58 encoding. Use AccountAddress.fromBase58('<base58>') to construct it.
  • Use BlockHash instead of a string with hex encoding. Use BlockHash.fromHexString('<hex>') to construct it.
  • Use TranactionHash instead of a string with hex encoding. Use TransactionHash.fromHexString('<hex>') to construct it.
  • Use Energy instead of a bigint. Use Energy.create(<integer>) to construct it.
  • Use ReceiveName instead of a string. Use ReceiveName.fromString('<contract>.<function>') to construct it.
  • Use InitName instead of a string. Use Init.fromString('init_<contract>') to construct it.
  • Use ContractName instead of a string. Use ContractName.fromString('<contract>') to construct it.
  • Use EntrypointName instead of a string. Use EntrypointName.fromString('<function>') to construct it.
  • Use Parameter instead of a string with hex encoding. Use Parameter.fromHexString('<hex>').
  • Use SequenceNumber (formerly called nonce) instead of a bigint. Use SequenceNumber.create(<integer>) to construct it.
  • Use Timestamp instead of a bigint. Can be constructed using Timestamp.fromMillis(<integer>).
  • Use Duration instead of a bigint. Can be constructed using Duration.fromMillis(<integer>).
  • Use ContractEvent instead of a string with hex encoding. Can be constructed using ContractEvent.fromHexString('<hex>').
  • Use CcdAmount instead of a bigint. Can be constructed using CcdAmount.fromMicroCcd(<integer>).
  • Use TransactionExpiry instead of a Date object. Can be constructed using TransactionExpiry.fromDate(<date>).
  • Use ModuleReference instead of a string with hex encoding. Can be constructed using ModuleReference.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 use AccountAddress.Type.
    • Constructing new AccountAddress("<address>") is now AccountAddress.fromBase58("<address>").
    • isAlias and getAlias are now accessable from AccountAddress.isAlias and AccountAddress.getAlias.
  • ContractAddresss is now a module with functions related to contract addresses:
    • To refer to ContractAddress as a type use ContractAddress.Type.
    • To construct the type use ContractAddress.create(index, subindex).
  • CredentialRegistrationId is now a module with functions related to credential registration IDs:
    • To refer to CredentialRegistrationId as a type use CredentialRegistrationId.Type.
    • Constructing new CredentialRegistrationId("<hex-string>") is now CredentialRegistrationId.fromHexString("<hex-string>").
  • CcdAmount is now a module with functions related to amounts of CCDs:
    • To refer to CcdAmount as a type use CcdAmount.Type.
    • Constructing new CcdAmount(<integer>) is now CcdAmount.fromMicroCcd(<integer>).
    • The methods toMicroCcd and toCcd are now functions refered to as CcdAmount.toMicroCcd and CcdAmount.toCcd respectively.
  • TransactionExpiry is now a module with functions related to amounts of expiry time of transactions:
    • To refer to TransactionExpiry as a type use TransactionExpiry.Type.
    • Constructing new TransactionExpiry(<expiry>, <allowExpired>) is now TransactionExpiry.fromDate(<expiry>), and the check of being a time in the future is removed and done when sending the transaction instead.
  • ModuleReference is now a module with functions related to references to smart contract modules:
    • To refer to ModuleReference as a type use ModuleReference.Type.
    • Constructing new ModuleReference("<hex-string>") is now ModuleReference.fromHexString("<hex-string>").
    • The static method ModuleReference.fromBytes is now ModuleReference.fromBuffer.
  • Removed JsonRpcClient and types and functionality associated solely with this class.
  • Renamed AccountSequenceNumber module to SequenceNumber.
  • Fix type for TranferredEvent from ContractTraceEvent to only be from contract addresses to account addresses.
  • Added effectiveTime field to PendingUpdate.

Added

  • All JSON serialization in serialization.ts is now handled by json-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 use Timestamp.Type.
  • 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 and jsonParse, which acts as a regular JSON.stringify and JSON.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.

web-sdk v6.5.0

19 Oct 08:05
7ab9d75
Compare
Choose a tag to compare

Added

New consensus endpoints:

  • getBakerEarliestWinTime
  • getBlockCertificates
  • getBakersRewardPeriod
  • getWinningBakersEpoch
  • getFirstBlockEpoch
  • commissionRates is now added to the getPoolInfo under bakerPoolStatus.PoolInfo

node-sdk v9.5.0

19 Oct 08:04
7ab9d75
Compare
Choose a tag to compare

Added

New consensus endpoints:

  • getBakerEarliestWinTime
  • getBlockCertificates
  • getBakersRewardPeriod
  • getWinningBakersEpoch
  • getFirstBlockEpoch
  • commissionRates is now added to the getPoolInfo under bakerPoolStatus.PoolInfo

web-sdk v6.4.0

19 Oct 07:59
Compare
Choose a tag to compare

Added

  • sendUpdateInstruction to the gRPC Client.
  • healthCheck to the gRPC Client.
  • Functions calculateModuleReference for getting the module reference and parseModuleInterface for getting the interface from the source of a smart contract module.
  • Smart contract related types ContractName, EntrypointName and helper functions isInitName, isReceiveName, getContractNameFromInit and getNamesFromReceive.

Fixed

  • Added missing fields to getBlockChainParameters response. (rootKeys, level1Keys, level2Keys)
  • Use of bigint exponentiation causing issues in web.

node-sdk v9.4.0

19 Oct 08:00
Compare
Choose a tag to compare

Added

  • sendUpdateInstruction to the gRPC Client.
  • healthCheck to the gRPC Client.
  • Functions calculateModuleReference for getting the module reference and parseModuleInterface for getting the interface from the source of a smart contract module.
  • Smart contract related types ContractName, EntrypointName and helper functions isInitName, isReceiveName, getContractNameFromInit and getNamesFromReceive.

Fixed

  • Added missing fields to getBlockChainParameters response. (rootKeys, level1Keys, level2Keys)
  • Use of bigint exponentiation causing issues in web.