Skip to content

Commit

Permalink
Merge pull request #219 from Concordium/add-display-type-schema-template
Browse files Browse the repository at this point in the history
Add function to display a type schema template
  • Loading branch information
DOBEN authored Jul 5, 2023
2 parents aa05be9 + 0ac238d commit b1f33b5
Show file tree
Hide file tree
Showing 14 changed files with 54 additions and 15 deletions.
2 changes: 1 addition & 1 deletion deps/concordium-base
Submodule concordium-base updated 62 files
+5 −1 .diff-wat-wasm.sh
+0 −42 CHANGELOG.md
+1 −1 concordium-contracts-common
+21 −0 haskell-src/Concordium/Cost.hs
+11 −0 haskell-src/Concordium/Genesis/Data.hs
+69 −1 haskell-src/Concordium/Genesis/Data/P6.hs
+5 −0 haskell-src/Concordium/ID/Types.hs
+1 −0 haskell-src/Concordium/Types/InvokeContract.hs
+34 −0 haskell-src/Concordium/Types/Migration.hs
+43 −0 haskell-src/Concordium/Types/ProtocolVersion.hs
+17 −4 haskell-src/Concordium/Types/SeedState.hs
+21 −9 haskell-src/Concordium/Types/Transactions.hs
+1 −0 identity-provider-service/Cargo.lock
+1 −0 idiss/Cargo.lock
+1 −0 mobile_wallet/Cargo.lock
+1 −0 rust-bins/Cargo.lock
+1 −0 rust-src/Cargo.lock
+ smart-contracts/testdata/contracts/global-data-section-test.wasm
+23 −0 smart-contracts/testdata/contracts/global-data-section-test.wat
+ smart-contracts/testdata/contracts/global-element-section-test.wasm
+24 −0 smart-contracts/testdata/contracts/global-element-section-test.wat
+ smart-contracts/testdata/contracts/v1/account-signature-checks.wasm
+52 −0 smart-contracts/testdata/contracts/v1/account-signature-checks.wat
+ smart-contracts/testdata/contracts/v1/checkpointing-2.wasm
+265 −0 smart-contracts/testdata/contracts/v1/checkpointing-2.wat
+ smart-contracts/testdata/contracts/v1/i32.extend16_s.wasm
+8 −0 smart-contracts/testdata/contracts/v1/i32.extend16_s.wat
+ smart-contracts/testdata/contracts/v1/i32.extend8_s.wasm
+8 −0 smart-contracts/testdata/contracts/v1/i32.extend8_s.wat
+ smart-contracts/testdata/contracts/v1/i64.extend16_s.wasm
+8 −0 smart-contracts/testdata/contracts/v1/i64.extend16_s.wat
+ smart-contracts/testdata/contracts/v1/i64.extend32_s.wasm
+8 −0 smart-contracts/testdata/contracts/v1/i64.extend32_s.wat
+ smart-contracts/testdata/contracts/v1/i64.extend8_s.wasm
+8 −0 smart-contracts/testdata/contracts/v1/i64.extend8_s.wat
+ smart-contracts/testdata/contracts/v1/upgrading_1_with_custom_section.wasm
+12 −0 smart-contracts/wasm-chain-integration/CHANGELOG.md
+494 −338 smart-contracts/wasm-chain-integration/Cargo.lock
+ smart-contracts/wasm-chain-integration/benches/code/loop-energy.wasm
+34 −0 smart-contracts/wasm-chain-integration/benches/code/loop-energy.wat
+5 −1 smart-contracts/wasm-chain-integration/benches/v1-host-functions.rs
+74 −20 smart-contracts/wasm-chain-integration/benches/wasm.rs
+17 −6 smart-contracts/wasm-chain-integration/src/utils.rs
+11 −2 smart-contracts/wasm-chain-integration/src/v0/ffi.rs
+17 −4 smart-contracts/wasm-chain-integration/src/v0/mod.rs
+3 −1 smart-contracts/wasm-chain-integration/src/v1/crypto_primitives_tests.rs
+34 −7 smart-contracts/wasm-chain-integration/src/v1/ffi.rs
+125 −14 smart-contracts/wasm-chain-integration/src/v1/mod.rs
+64 −11 smart-contracts/wasm-chain-integration/src/validation_tests.rs
+7 −3 smart-contracts/wasm-test/src/main.rs
+9 −0 smart-contracts/wasm-transform/CHANGELOG.md
+22 −0 smart-contracts/wasm-transform/src/artifact.rs
+2 −0 smart-contracts/wasm-transform/src/lib.rs
+5 −0 smart-contracts/wasm-transform/src/machine.rs
+5 −0 smart-contracts/wasm-transform/src/metering_transformation.rs
+94 −24 smart-contracts/wasm-transform/src/parse.rs
+65 −0 smart-contracts/wasm-transform/src/tests.rs
+8 −0 smart-contracts/wasm-transform/src/types.rs
+31 −6 smart-contracts/wasm-transform/src/utils.rs
+58 −7 smart-contracts/wasm-transform/src/validate.rs
+ smart-contracts/wasm-transform/testdata/sign-ext-instructions.wasm
+62 −0 smart-contracts/wasm-transform/testdata/sign-ext-instructions.wat
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
6 changes: 6 additions & 0 deletions packages/common/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 8.1.0

### Added

- `display_type_schema_template` function

## 8.0.0

### Breaking changes
Expand Down
4 changes: 2 additions & 2 deletions packages/common/package.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down Expand Up @@ -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",
Expand Down
8 changes: 8 additions & 0 deletions packages/common/src/schemaHelpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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'));
}
2 changes: 1 addition & 1 deletion packages/nodejs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 6 additions & 0 deletions packages/rust-bindings/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 1.1.0

### Added

- `display_type_schema_template` function

## 1.0.0

### Breaking changes
Expand Down
1 change: 1 addition & 0 deletions packages/rust-bindings/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion packages/rust-bindings/package.json
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
6 changes: 6 additions & 0 deletions packages/rust-bindings/src/aux_functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -774,6 +774,12 @@ fn deserialize_type_value(
}
}

pub fn display_type_schema_template_aux(schema: HexString) -> Result<JsonString> {
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 {
Expand Down
6 changes: 6 additions & 0 deletions packages/rust-bindings/src/external_functions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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)))
}
6 changes: 6 additions & 0 deletions packages/web/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog

## 5.1.0

### Added

- `display_type_schema_template` function

## 5.0.0

### Breaking changes
Expand Down
6 changes: 3 additions & 3 deletions packages/web/package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down Expand Up @@ -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",
Expand Down
12 changes: 6 additions & 6 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit b1f33b5

Please sign in to comment.