diff --git a/deps/concordium-base b/deps/concordium-base index 9d4d2c62f..cc4997737 160000 --- a/deps/concordium-base +++ b/deps/concordium-base @@ -1 +1 @@ -Subproject commit 9d4d2c62f19e80ca27f5c68cbb96862b03b97219 +Subproject commit cc49977379241c19c3a87b21f803a778ffa849d0 diff --git a/package.json b/package.json index e5fe5a88b..0cad16afa 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "lint-staged": { "*.ts": "yarn lint-fix" }, - "packageManager": "yarn@berry", + "packageManager": "yarn@3.2.1", "repository": { "type": "git", "url": "https://github.com/Concordium/concordium-node-sdk-js" diff --git a/packages/common/CHANGELOG.md b/packages/common/CHANGELOG.md index da6637c64..d60d0be1e 100644 --- a/packages/common/CHANGELOG.md +++ b/packages/common/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 8.1.0 + +### Added + +- `display_type_schema_template` function + ## 8.0.0 ### Breaking changes diff --git a/packages/common/package.json b/packages/common/package.json index e7c5d84d0..7767a9973 100644 --- a/packages/common/package.json +++ b/packages/common/package.json @@ -1,6 +1,6 @@ { "name": "@concordium/common-sdk", - "version": "8.0.0", + "version": "8.1.0", "license": "Apache-2.0", "engines": { "node": ">=14.16.0" @@ -51,7 +51,7 @@ "build-dev": "tsc" }, "dependencies": { - "@concordium/rust-bindings": "1.0.0", + "@concordium/rust-bindings": "1.1.0", "@grpc/grpc-js": "^1.3.4", "@noble/ed25519": "^1.7.1", "@protobuf-ts/runtime-rpc": "^2.8.2", diff --git a/packages/common/src/schemaHelpers.ts b/packages/common/src/schemaHelpers.ts index 67036993a..27394aaa8 100644 --- a/packages/common/src/schemaHelpers.ts +++ b/packages/common/src/schemaHelpers.ts @@ -42,3 +42,11 @@ export function getUpdateContractParameterSchema( ); return Buffer.from(parameterSchema, 'hex'); } + +/** + * @param rawSchema the schema for the type + * @returns JSON template of the schema + */ +export function displayTypeSchemaTemplate(rawSchema: Buffer): string { + return wasm.displayTypeSchemaTemplate(rawSchema.toString('hex')); +} diff --git a/packages/nodejs/package.json b/packages/nodejs/package.json index af7a2d7f5..d41324979 100644 --- a/packages/nodejs/package.json +++ b/packages/nodejs/package.json @@ -60,7 +60,7 @@ "build-dev": "tsc" }, "dependencies": { - "@concordium/common-sdk": "8.0.0", + "@concordium/common-sdk": "8.1.0", "@grpc/grpc-js": "^1.3.4", "@protobuf-ts/grpc-transport": "^2.8.2", "buffer": "^6.0.3", diff --git a/packages/rust-bindings/CHANGELOG.md b/packages/rust-bindings/CHANGELOG.md index 991d0531f..0b818bedc 100644 --- a/packages/rust-bindings/CHANGELOG.md +++ b/packages/rust-bindings/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 1.1.0 + +### Added + +- `display_type_schema_template` function + ## 1.0.0 ### Breaking changes diff --git a/packages/rust-bindings/Cargo.lock b/packages/rust-bindings/Cargo.lock index 2159e7dac..05e02c40f 100644 --- a/packages/rust-bindings/Cargo.lock +++ b/packages/rust-bindings/Cargo.lock @@ -234,6 +234,7 @@ dependencies = [ name = "concordium-contracts-common" version = "7.0.0" dependencies = [ + "base64", "bs58", "chrono", "concordium-contracts-common-derive", diff --git a/packages/rust-bindings/package.json b/packages/rust-bindings/package.json index fb80af966..c80539fab 100644 --- a/packages/rust-bindings/package.json +++ b/packages/rust-bindings/package.json @@ -1,6 +1,6 @@ { "name": "@concordium/rust-bindings", - "version": "1.0.0", + "version": "1.1.0", "license": "Apache-2.0", "engines": { "node": ">=14.16.0" diff --git a/packages/rust-bindings/src/aux_functions.rs b/packages/rust-bindings/src/aux_functions.rs index 19cfbee33..646fa0118 100644 --- a/packages/rust-bindings/src/aux_functions.rs +++ b/packages/rust-bindings/src/aux_functions.rs @@ -774,6 +774,12 @@ fn deserialize_type_value( } } +pub fn display_type_schema_template_aux(schema: HexString) -> Result { + let value_type: Type = from_bytes(&hex::decode(schema)?)?; + let v = value_type.to_json_template(); + Ok(to_string(&v)?) +} + #[derive(SerdeSerialize, SerdeDeserialize)] #[serde(rename_all = "camelCase")] pub struct IdProofInput { diff --git a/packages/rust-bindings/src/external_functions.rs b/packages/rust-bindings/src/external_functions.rs index 91941c7f1..2be3b77ab 100644 --- a/packages/rust-bindings/src/external_functions.rs +++ b/packages/rust-bindings/src/external_functions.rs @@ -403,3 +403,9 @@ pub fn deserialize_type_value_ext( ) .map_err(|e| JsError::new(&format!("Unable to deserialize value due to: {}", e))) } + +#[wasm_bindgen(js_name = displayTypeSchemaTemplate)] +pub fn display_type_schema_template(schema: HexString) -> JsResult { + display_type_schema_template_aux(schema) + .map_err(|e| JsError::new(&format!("Unable to get template of schema: {}", e))) +} diff --git a/packages/web/CHANGELOG.md b/packages/web/CHANGELOG.md index 91e271dc9..6fedc5c92 100644 --- a/packages/web/CHANGELOG.md +++ b/packages/web/CHANGELOG.md @@ -1,5 +1,11 @@ # Changelog +## 5.1.0 + +### Added + +- `display_type_schema_template` function + ## 5.0.0 ### Breaking changes diff --git a/packages/web/package.json b/packages/web/package.json index 05d3fae94..70d1777d7 100644 --- a/packages/web/package.json +++ b/packages/web/package.json @@ -1,6 +1,6 @@ { "name": "@concordium/web-sdk", - "version": "5.0.0", + "version": "5.1.0", "license": "Apache-2.0", "browser": "lib/concordium.min.js", "types": "lib/index.d.ts", @@ -48,8 +48,8 @@ "webpack-cli": "^4.9.2" }, "dependencies": { - "@concordium/common-sdk": "8.0.0", - "@concordium/rust-bindings": "1.0.0", + "@concordium/common-sdk": "8.1.0", + "@concordium/rust-bindings": "1.1.0", "@grpc/grpc-js": "^1.3.4", "@protobuf-ts/grpcweb-transport": "^2.8.2", "buffer": "^6.0.3", diff --git a/yarn.lock b/yarn.lock index f2fbb9c0d..a59a0a871 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1312,11 +1312,11 @@ __metadata: languageName: node linkType: hard -"@concordium/common-sdk@8.0.0, @concordium/common-sdk@workspace:packages/common": +"@concordium/common-sdk@8.1.0, @concordium/common-sdk@workspace:packages/common": version: 0.0.0-use.local resolution: "@concordium/common-sdk@workspace:packages/common" dependencies: - "@concordium/rust-bindings": 1.0.0 + "@concordium/rust-bindings": 1.1.0 "@grpc/grpc-js": ^1.3.4 "@noble/ed25519": ^1.7.1 "@protobuf-ts/plugin": 2.8.1 @@ -1375,7 +1375,7 @@ __metadata: version: 0.0.0-use.local resolution: "@concordium/node-sdk@workspace:packages/nodejs" dependencies: - "@concordium/common-sdk": 8.0.0 + "@concordium/common-sdk": 8.1.0 "@grpc/grpc-js": ^1.3.4 "@noble/ed25519": ^1.7.1 "@protobuf-ts/grpc-transport": ^2.8.2 @@ -1404,7 +1404,7 @@ __metadata: languageName: unknown linkType: soft -"@concordium/rust-bindings@1.0.0, @concordium/rust-bindings@workspace:packages/rust-bindings": +"@concordium/rust-bindings@1.1.0, @concordium/rust-bindings@workspace:packages/rust-bindings": version: 0.0.0-use.local resolution: "@concordium/rust-bindings@workspace:packages/rust-bindings" languageName: unknown @@ -1414,8 +1414,8 @@ __metadata: version: 0.0.0-use.local resolution: "@concordium/web-sdk@workspace:packages/web" dependencies: - "@concordium/common-sdk": 8.0.0 - "@concordium/rust-bindings": 1.0.0 + "@concordium/common-sdk": 8.1.0 + "@concordium/rust-bindings": 1.1.0 "@grpc/grpc-js": ^1.3.4 "@protobuf-ts/grpcweb-transport": ^2.8.2 "@typescript-eslint/eslint-plugin": ^4.28.1