diff --git a/examples/client/banPeer.ts b/examples/client/banPeer.ts index 74a5e2653..aa6aabe97 100644 --- a/examples/client/banPeer.ts +++ b/examples/client/banPeer.ts @@ -6,7 +6,7 @@ import meow from 'meow'; const cli = meow( ` Usage - $ yarn ts-node [options] + $ yarn run-example [options] Required --peer, -p The ip of the peer to ban. diff --git a/examples/client/dumpStart.ts b/examples/client/dumpStart.ts index 1ee700d99..572a2275e 100644 --- a/examples/client/dumpStart.ts +++ b/examples/client/dumpStart.ts @@ -6,7 +6,7 @@ import meow from 'meow'; const cli = meow( ` Usage - $ yarn ts-node [options] + $ yarn run-example [options] Required --filepath, -f Specifies which file to dump the packages into diff --git a/examples/client/dumpStop.ts b/examples/client/dumpStop.ts index 6384881f3..cf5005ea1 100644 --- a/examples/client/dumpStop.ts +++ b/examples/client/dumpStop.ts @@ -6,7 +6,7 @@ import meow from 'meow'; const cli = meow( ` Usage - $ yarn ts-node [options] + $ yarn run-example [options] Options --help, Displays this message diff --git a/examples/client/getAccountList.ts b/examples/client/getAccountList.ts index 2d59e8ac2..06aecca71 100644 --- a/examples/client/getAccountList.ts +++ b/examples/client/getAccountList.ts @@ -6,7 +6,7 @@ import meow from 'meow'; const cli = meow( ` Usage - $ yarn ts-node [options] + $ yarn run-example [options] Options --help, Displays this message diff --git a/examples/client/getAccountNonFinalizedTransactions.ts b/examples/client/getAccountNonFinalizedTransactions.ts index 2cbaf6507..ccbd16667 100644 --- a/examples/client/getAccountNonFinalizedTransactions.ts +++ b/examples/client/getAccountNonFinalizedTransactions.ts @@ -10,7 +10,7 @@ import meow from 'meow'; const cli = meow( ` Usage - $ yarn ts-node [options] + $ yarn run-example [options] Required --account, -a The account to get transactions from diff --git a/examples/client/getAncestors.ts b/examples/client/getAncestors.ts index c6ca8d6b5..f8c872fc4 100644 --- a/examples/client/getAncestors.ts +++ b/examples/client/getAncestors.ts @@ -6,7 +6,7 @@ import meow from 'meow'; const cli = meow( ` Usage - $ yarn ts-node [options] + $ yarn run-example [options] Required --max-ancestors, -m Maximum amount of ancestors to get diff --git a/examples/client/getAnonymityRevokers.ts b/examples/client/getAnonymityRevokers.ts index 57290fcb2..0a4dc1ef2 100644 --- a/examples/client/getAnonymityRevokers.ts +++ b/examples/client/getAnonymityRevokers.ts @@ -6,7 +6,7 @@ import meow from 'meow'; const cli = meow( ` Usage - $ yarn ts-node [options] + $ yarn run-example [options] Options --help, Displays this message diff --git a/examples/client/getBakerList.ts b/examples/client/getBakerList.ts index e17b7a7bf..cee869f87 100644 --- a/examples/client/getBakerList.ts +++ b/examples/client/getBakerList.ts @@ -6,7 +6,7 @@ import meow from 'meow'; const cli = meow( ` Usage - $ yarn ts-node [options] + $ yarn run-example [options] Options --help, Displays this message diff --git a/examples/client/getBannedPeers.ts b/examples/client/getBannedPeers.ts index db2a75bc7..7e0e3e559 100644 --- a/examples/client/getBannedPeers.ts +++ b/examples/client/getBannedPeers.ts @@ -6,8 +6,7 @@ import meow from 'meow'; const cli = meow( ` Usage - $ yarn ts-node [options] - + $ yarn run-example [options] Options --help, Displays this message diff --git a/examples/client/getBlockChainParameters.ts b/examples/client/getBlockChainParameters.ts index fdc90a50b..2103a158b 100644 --- a/examples/client/getBlockChainParameters.ts +++ b/examples/client/getBlockChainParameters.ts @@ -10,8 +10,7 @@ import meow from 'meow'; const cli = meow( ` Usage - $ yarn ts-node [options] - + $ yarn run-example [options] Options --help, Displays this message diff --git a/examples/client/getBlockFinalizationSummary.ts b/examples/client/getBlockFinalizationSummary.ts index 2367c41cb..5aeb2a99f 100644 --- a/examples/client/getBlockFinalizationSummary.ts +++ b/examples/client/getBlockFinalizationSummary.ts @@ -9,7 +9,7 @@ import meow from 'meow'; const cli = meow( ` Usage - $ yarn ts-node [options] + $ yarn run-example [options] Options --help, Displays this message diff --git a/examples/client/getBlockInfo.ts b/examples/client/getBlockInfo.ts index 9ed268a4f..04762f008 100644 --- a/examples/client/getBlockInfo.ts +++ b/examples/client/getBlockInfo.ts @@ -6,7 +6,7 @@ import meow from 'meow'; const cli = meow( ` Usage - $ yarn ts-node [options] + $ yarn run-example [options] Options --help, Displays this message diff --git a/examples/client/getBlockPendingUpdates.ts b/examples/client/getBlockPendingUpdates.ts index 8a76dd45c..73e8de5e4 100644 --- a/examples/client/getBlockPendingUpdates.ts +++ b/examples/client/getBlockPendingUpdates.ts @@ -6,7 +6,7 @@ import meow from 'meow'; const cli = meow( ` Usage - $ yarn ts-node [options] + $ yarn run-example [options] Options --help, Displays this message diff --git a/examples/client/getBlockSpecialEvents.ts b/examples/client/getBlockSpecialEvents.ts index ba26e16a5..e83305e01 100644 --- a/examples/client/getBlockSpecialEvents.ts +++ b/examples/client/getBlockSpecialEvents.ts @@ -9,7 +9,7 @@ import meow from 'meow'; const cli = meow( ` Usage - $ yarn ts-node [options] + $ yarn run-example [options] Options --help, Displays this message diff --git a/examples/client/getBlockTransactionEvents.ts b/examples/client/getBlockTransactionEvents.ts index f35d9171d..714d14c90 100644 --- a/examples/client/getBlockTransactionEvents.ts +++ b/examples/client/getBlockTransactionEvents.ts @@ -6,7 +6,7 @@ import meow from 'meow'; const cli = meow( ` Usage - $ yarn ts-node [options] + $ yarn run-example [options] Options --help, Displays this message diff --git a/examples/client/getBlocks.ts b/examples/client/getBlocks.ts index cd1e5b1ee..6df169a9d 100644 --- a/examples/client/getBlocks.ts +++ b/examples/client/getBlocks.ts @@ -6,7 +6,7 @@ import meow from 'meow'; const cli = meow( ` Usage - $ yarn ts-node [options] + $ yarn run-example [options] Options --help, Displays this message diff --git a/examples/client/getBlocksAtHeightRelative.ts b/examples/client/getBlocksAtHeightRelative.ts index aebca1d0e..4eaad0eba 100644 --- a/examples/client/getBlocksAtHeightRelative.ts +++ b/examples/client/getBlocksAtHeightRelative.ts @@ -10,14 +10,14 @@ import meow from 'meow'; const cli = meow( ` Usage - $ yarn ts-node [options] + $ yarn run-example [options] Required --height, Height starting from the genesis block at the genesis index. --restrict, -r Whether to return results only from the specified genesis index (true), or allow results from more recent genesis indices as well (false). - --genesis-index, -g The index of a (re)genesis block. The initial genesis block has index 0 - and each subsequent regenesis has an incrementally higher index. + --genesis-index, -g The index of a (re)genesis block. The initial genesis block has index 0 + and each subsequent regenesis has an incrementally higher index. Options --help, Displays this message. diff --git a/examples/client/getBranches.ts b/examples/client/getBranches.ts index 178ffd97e..7295770d5 100644 --- a/examples/client/getBranches.ts +++ b/examples/client/getBranches.ts @@ -6,7 +6,7 @@ import meow from 'meow'; const cli = meow( ` Usage - $ yarn ts-node [options] + $ yarn run-example [options] Options --help, Displays this message diff --git a/examples/client/getConsensusStatus.ts b/examples/client/getConsensusStatus.ts index 7d6d163c1..2ce55aff6 100644 --- a/examples/client/getConsensusStatus.ts +++ b/examples/client/getConsensusStatus.ts @@ -6,7 +6,7 @@ import meow from 'meow'; const cli = meow( ` Usage - $ yarn ts-node [options] + $ yarn run-example [options] Options --help, Displays this message diff --git a/examples/buildAccountSigner.ts b/examples/common/buildAccountSigner.ts similarity index 100% rename from examples/buildAccountSigner.ts rename to examples/common/buildAccountSigner.ts diff --git a/examples/cis0Supports.ts b/examples/common/cis0Supports.ts similarity index 100% rename from examples/cis0Supports.ts rename to examples/common/cis0Supports.ts diff --git a/examples/package.json b/examples/package.json index e7526def6..3a92e118e 100644 --- a/examples/package.json +++ b/examples/package.json @@ -1,8 +1,7 @@ { "type": "module", "dependencies": { - "@concordium/common-sdk": "6.4.1", - "@concordium/node-sdk": "6.3.0", + "@concordium/node-sdk": "workspace:^", "@grpc/grpc-js": "^1.3.4", "@typescript-eslint/eslint-plugin": "^4.28.1", "@typescript-eslint/parser": "^4.28.1", diff --git a/examples/readme.md b/examples/readme.md index 85b4c0a1c..aa356aa97 100644 --- a/examples/readme.md +++ b/examples/readme.md @@ -1,12 +1,12 @@ ## Examples for the Concordium NodeJS-SDK This is a collection of scripts/examples that utilizes the SDK. There are -two directories with examples `client`, containing examples that utilize the -client to interact with a Concordium node, and `common`, that use various general functions from the library. To +three directories with examples `client`, containing examples that utilize the +client to interact with a Concordium node, `cis2` containing examples that helps interact with CIS-2 compliant smart contracts and `common`, that use various general functions from the library. To run an example call: ```shell -yarn ts-node /path/to/example.ts [opts] +yarn run-example /path/to/example.ts [opts] ``` Where opts are any arguments that the example script takes. diff --git a/examples/shared/util.ts b/examples/shared/util.ts index b57b00647..f699a29b3 100644 --- a/examples/shared/util.ts +++ b/examples/shared/util.ts @@ -1,4 +1,4 @@ -import { Base58String, ContractAddress } from '@concordium/common-sdk'; +import { Base58String, ContractAddress } from '@concordium/node-sdk'; export const parseAddress = (input: string): Base58String | ContractAddress => { if (!input.includes(',')) { diff --git a/packages/common/CHANGELOG.md b/packages/common/CHANGELOG.md index 33cd4c363..ef687f914 100644 --- a/packages/common/CHANGELOG.md +++ b/packages/common/CHANGELOG.md @@ -1,6 +1,6 @@ # Changelog -## Unreleased +## 6.5.0 2023-5-03 ### Added - Utility functions `uleb128Decode` and `uleb128Encode` functions for decoding and encoding as unsigned leb128 respectively. diff --git a/packages/common/package.json b/packages/common/package.json index 2b24c0e6a..7dcf2a3f5 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -1,6 +1,6 @@ { "name": "@concordium/common-sdk", - "version": "6.4.2", + "version": "6.5.0", "license": "Apache-2.0", "engines": { "node": ">=14.16.0" diff --git a/packages/common/src/util.ts b/packages/common/src/util.ts index e5e794a60..e6463c440 100644 --- a/packages/common/src/util.ts +++ b/packages/common/src/util.ts @@ -232,7 +232,7 @@ export async function streamToList( /** * Creates a function that takes either a `T` or `T[]` from a function that takes `T[]`. * - * @param {(input: T[]) => Buffer} fun - A function that takes `T[]` + * @param {(input: T[]) => R} fun - A function that takes `T[]` * * @example * const serializer = makeDynamicFunction(serialize); diff --git a/packages/nodejs/CHANGELOG.md b/packages/nodejs/CHANGELOG.md index 041036957..976c1538d 100644 --- a/packages/nodejs/CHANGELOG.md +++ b/packages/nodejs/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 6.4.0 2023-5-03 + +### Changed + +- Bumped @concordium/common-sdk to 6.5.0. (Adds `CIS2Contract`) + ## 6.3.0 2023-3-22 ### Changed diff --git a/packages/nodejs/package.json b/packages/nodejs/package.json index ac4b22c35..2c933d054 100644 --- a/packages/nodejs/package.json +++ b/packages/nodejs/package.json @@ -1,6 +1,6 @@ { "name": "@concordium/node-sdk", - "version": "6.3.0", + "version": "6.4.0", "description": "Helpers for interacting with the Concordium node", "repository": { "type": "git", @@ -60,7 +60,7 @@ "build-dev": "tsc" }, "dependencies": { - "@concordium/common-sdk": "6.4.2", + "@concordium/common-sdk": "6.5.0", "@grpc/grpc-js": "^1.3.4", "@protobuf-ts/grpc-transport": "^2.8.2", "buffer": "^6.0.3", diff --git a/packages/web/CHANGELOG.md b/packages/web/CHANGELOG.md index eb864ad2b..3ee490647 100644 --- a/packages/web/CHANGELOG.md +++ b/packages/web/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 3.5.0 2023-5-03 + +### Changed + +- Bumped @concordium/common-sdk to 6.5.0. (Adds `CIS2Contract`) + ## 3.4.2 2023-4-21 ### Changed diff --git a/packages/web/README.md b/packages/web/README.md index 8b3b78091..56e92cc3f 100644 --- a/packages/web/README.md +++ b/packages/web/README.md @@ -20,6 +20,8 @@ Wrappers for interacting with the Concordium node, for the web environment. - [GetCryptographicParameters.html](#getcryptographicparametershtml) - [GetAccountInfo.html](#getaccountinfohtml) - [GetModuleSource.html](#getmodulesourcehtml) + - [SendCIS2Transfer.html](#sendcis2transferhtml) + - [SendCIS2UpdateOperator.html](#sendcis2updateoperatorhtml) - [Build](#build) - [Building for a release](#building-for-a-release) - [Publishing a release](#publishing-a-release) @@ -87,6 +89,12 @@ An example of getting the info of a given account using a JSON-RPC server. ## GetModuleSource.html An example of getting the source of a model on the chain using a JSON-RPC server. +## SendCIS2Transfer.html +An example of sending a CIS2 "transfer" transaction by utilizing the `CIS2Contract` class. Please note that this example requires the [Concordium Wallet for Web](https://chrome.google.com/webstore/detail/concordium-wallet/mnnkpffndmickbiakofclnpoiajlegmg) to be installed to work. + +## SendCIS2UpdateOperator.html +An example of sending a CIS2 "updateOperator" transaction by utilizing the `CIS2Contract` class. Please note that this example requires the [Concordium Wallet for Web](https://chrome.google.com/webstore/detail/concordium-wallet/mnnkpffndmickbiakofclnpoiajlegmg) to be installed to work. + # Build ## Building for a release diff --git a/packages/web/example/SendCIS2UpdateOperator.html b/packages/web/example/SendCIS2UpdateOperator.html index 1ccf5789e..e53b89a15 100644 --- a/packages/web/example/SendCIS2UpdateOperator.html +++ b/packages/web/example/SendCIS2UpdateOperator.html @@ -30,7 +30,7 @@ const address = {index: BigInt(index.value), subindex: 0n}; const contract = await concordiumSDK.CIS2Contract.create(client, address); - const checkedType = Object.values(type).find(field => field.checked).value; + const checkedType = Object.values(updateType).find(field => field.checked).value; const update = {type: checkedType, address: operator.value}; //const update = {type: checkedType, address}; // Example with contract address, using same address as used to instantiate the contract class @@ -56,9 +56,9 @@ Update type: - Add + Add
- Remove + Remove

diff --git a/packages/web/package.json b/packages/web/package.json index bda7a704b..99b8ce558 100644 --- a/packages/web/package.json +++ b/packages/web/package.json @@ -1,6 +1,6 @@ { "name": "@concordium/web-sdk", - "version": "3.4.2", + "version": "3.5.0", "license": "Apache-2.0", "browser": "lib/concordium.min.js", "types": "lib/index.d.ts", @@ -48,7 +48,7 @@ "webpack-cli": "^4.9.2" }, "dependencies": { - "@concordium/common-sdk": "6.4.2", + "@concordium/common-sdk": "6.5.0", "@concordium/rust-bindings": "0.11.1", "@grpc/grpc-js": "^1.3.4", "@protobuf-ts/grpcweb-transport": "^2.8.2", diff --git a/yarn.lock b/yarn.lock index 20c6b6e75..eaedc129f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1312,7 +1312,7 @@ __metadata: languageName: node linkType: hard -"@concordium/common-sdk@6.4.2, @concordium/common-sdk@workspace:packages/common": +"@concordium/common-sdk@6.5.0, @concordium/common-sdk@workspace:packages/common": version: 0.0.0-use.local resolution: "@concordium/common-sdk@workspace:packages/common" dependencies: @@ -1350,31 +1350,11 @@ __metadata: languageName: unknown linkType: soft -"@concordium/common-sdk@npm:6.4.1": - version: 6.4.1 - resolution: "@concordium/common-sdk@npm:6.4.1" - dependencies: - "@concordium/rust-bindings": 0.11.0 - "@grpc/grpc-js": ^1.3.4 - "@noble/ed25519": ^1.7.1 - "@protobuf-ts/runtime-rpc": ^2.8.2 - "@scure/bip39": ^1.1.0 - bs58check: ^2.1.2 - buffer: ^6.0.3 - cross-fetch: 3.1.5 - hash.js: ^1.1.7 - iso-3166-1: ^2.1.1 - json-bigint: ^1.0.0 - uuid: ^8.3.2 - checksum: 26cce68b496f9799359666d7ddf430c659c0250e16a96c8bfe1956162f737517896a9ab9e0c9a7a3a17117ee6d763a91cbcde20891c76d87444f67299a37c8c6 - languageName: node - linkType: hard - -"@concordium/node-sdk@6.3.0, @concordium/node-sdk@workspace:packages/nodejs": +"@concordium/node-sdk@workspace:^, @concordium/node-sdk@workspace:packages/nodejs": version: 0.0.0-use.local resolution: "@concordium/node-sdk@workspace:packages/nodejs" dependencies: - "@concordium/common-sdk": 6.4.2 + "@concordium/common-sdk": 6.5.0 "@grpc/grpc-js": ^1.3.4 "@noble/ed25519": ^1.7.1 "@protobuf-ts/grpc-transport": ^2.8.2 @@ -1409,18 +1389,11 @@ __metadata: languageName: unknown linkType: soft -"@concordium/rust-bindings@npm:0.11.0": - version: 0.11.0 - resolution: "@concordium/rust-bindings@npm:0.11.0" - checksum: a6c437cb782b7b2e9f217215dd4dbed9ffb8b3ef46fa307952aca3ae8f166cb96687de64efd18490aec7e86d58712dccb7d1a8bf63c151e3ed2a0170f066cd6d - languageName: node - linkType: hard - "@concordium/web-sdk@workspace:packages/web": version: 0.0.0-use.local resolution: "@concordium/web-sdk@workspace:packages/web" dependencies: - "@concordium/common-sdk": 6.4.2 + "@concordium/common-sdk": 6.5.0 "@concordium/rust-bindings": 0.11.1 "@grpc/grpc-js": ^1.3.4 "@protobuf-ts/grpcweb-transport": ^2.8.2 @@ -4373,8 +4346,7 @@ __metadata: version: 0.0.0-use.local resolution: "examples-1f5c57@workspace:examples" dependencies: - "@concordium/common-sdk": 6.4.1 - "@concordium/node-sdk": 6.3.0 + "@concordium/node-sdk": "workspace:^" "@grpc/grpc-js": ^1.3.4 "@typescript-eslint/eslint-plugin": ^4.28.1 "@typescript-eslint/parser": ^4.28.1