From ac8fea153e74ea81e1b17a9305c8fb8e1406e234 Mon Sep 17 00:00:00 2001 From: Shivansh Vij Date: Wed, 6 Sep 2023 01:30:12 -0700 Subject: [PATCH] Adding builder libs Signed-off-by: Shivansh Vij --- .github/workflows/typescript_compiler.yml | 84 +++++++++++++++++++ compile/typescript/builder/Cross.toml | 8 -- compile/typescript/builder/Makefile | 12 ++- compile/typescript/builder/generate.go | 19 ----- config.ts | 15 ++-- integration/golang_tests/signature/go.mod | 12 +-- integration/golang_tests/signature/go.sum | 1 + integration/golang_tests/signature/guest.go | 2 +- integration/rust_tests/signature/Cargo.toml | 2 +- .../host_signature/package.json | 2 +- .../typescript_tests/signature/index.js | 2 +- .../typescript_tests/signature/index.js.map | 4 +- .../typescript_tests/signature/package.json | 2 +- .../generator/rust/templates/guest.rs.templ | 2 +- 14 files changed, 111 insertions(+), 56 deletions(-) create mode 100644 .github/workflows/typescript_compiler.yml delete mode 100644 compile/typescript/builder/Cross.toml delete mode 100644 compile/typescript/builder/generate.go diff --git a/.github/workflows/typescript_compiler.yml b/.github/workflows/typescript_compiler.yml new file mode 100644 index 00000000..0b512933 --- /dev/null +++ b/.github/workflows/typescript_compiler.yml @@ -0,0 +1,84 @@ +name: Typescript Builder + +on: + pull_request: + paths: + - "compile/typescript/builder/**" + +jobs: + interpreter: + runs-on: macos-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Set up Rust + run: | + rustup toolchain install stable --profile minimal --no-self-update + rustup default stable + rustup target add wasm32-wasi + shell: bash + + - name: Make interpreter + working-directory: compile/typescript/builder + run: make interpreter + + - name: Upload core binary to artifacts + uses: actions/upload-artifact@v3 + with: + name: interpreter + path: compile/typescript/builder/interpreter/target/wasm32-wasi/release/js_interpreter.wasm + + builder: + name: builder-${{ matrix.name }} + needs: interpreter + runs-on: ${{ matrix.os }} + strategy: + matrix: + include: + - name: x86_64-unknown-linux-gnu + os: ubuntu-20.04 + + - name: aarch64-unknown-linux-gnu + os: ubuntu-20.04 + + - name: x86_64-apple-darwin + os: macos-latest + + - name: aarch64-apple-darwin + os: macos-latest + + - name: x86_64-pc-windows-msvc + os: windows-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Set up Rust + run: | + rustup toolchain install stable --profile minimal --no-self-update + rustup default stable + rustup target add ${{ matrix.name }} + shell: bash + + - name: Install ARM GCC toolchain + run: sudo apt-get --assume-yes install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu + if: matrix.name == 'aarch64-unknown-linux-gnu' + + - uses: actions/download-artifact@v3 + with: + name: interpreter + path: compile/typescript/builder/interpreter/target/wasm32-wasi/release/ + + - name: Build CLI ${{ matrix.name }} + working-directory: compile/typescript/builder + run: make builder-${{ matrix.name }} + env: + CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER: aarch64-linux-gnu-gcc + + - name: Commit CLI ${{ matrix.name }} Binary + uses: EndBug/add-and-commit@v9 + with: + default_author: github_actions + commit: "--signoff" + message: "Add: js_builder-${{ matrix.name }}" + add: js_builder-${{ matrix.name }} \ No newline at end of file diff --git a/compile/typescript/builder/Cross.toml b/compile/typescript/builder/Cross.toml deleted file mode 100644 index 80abf91c..00000000 --- a/compile/typescript/builder/Cross.toml +++ /dev/null @@ -1,8 +0,0 @@ -[target.x86_64-unknown-linux-gnu] -pre-build = ["apt-get install python3 -y"] - -[target.aarch64-unknown-linux-gnu] -pre-build = ["apt-get install python3 -y"] - -[target.x86_64-pc-windows-msvc] -image = "ghcr.io/loopholelabs/x86_64-pc-windows-msvc-cross:latest" \ No newline at end of file diff --git a/compile/typescript/builder/Makefile b/compile/typescript/builder/Makefile index 54edb6f2..b81bd6f5 100644 --- a/compile/typescript/builder/Makefile +++ b/compile/typescript/builder/Makefile @@ -8,22 +8,20 @@ install: builder: interpreter cargo build --release -builder-all-targets: interpreter builder-x86_64-unknown-linux-gnu builder-aarch64-unknown-linux-gnu builder-x86_64-apple-darwin builder-aarch64-apple-darwin builder-x86_64-pc-windows-msvc - builder-x86_64-unknown-linux-gnu: - cargo build --release --target=x86_64-unknown-linux-gnu + cargo build --release --target=x86_64-unknown-linux-gnu && cp target/x86_64-unknown-linux-gnu/release/js_builder js_builder-x86_64-unknown-linux-gnu builder-aarch64-unknown-linux-gnu: - cargo build --release --target=aarch64-unknown-linux-gnu + cargo build --release --target=aarch64-unknown-linux-gnu && cp target/aarch64-unknown-linux-gnu/release/js_builder js_builder-aarch64-unknown-linux-gnu builder-x86_64-apple-darwin: - cargo build --release --target=x86_64-apple-darwin + cargo build --release --target=x86_64-apple-darwin && cp target/x86_64-apple-darwin/release/js_builder js_builder-x86_64-apple-darwin builder-aarch64-apple-darwin: - cargo build --release --target=aarch64-apple-darwin + cargo build --release --target=aarch64-apple-darwin && cp target/aarch64-apple-darwin/release/js_builder js_builder-aarch64-apple-darwin builder-x86_64-pc-windows-msvc: - cargo build --release --target=x86_64-pc-windows-msvc + cargo build --release --target=x86_64-pc-windows-msvc && cp target/x86_64-pc-windows-msvc/release/js_builder.exe js_builder-x86_64-pc-windows-msvc.exe interpreter: cd interpreter && cargo build --release --target=wasm32-wasi && cd - diff --git a/compile/typescript/builder/generate.go b/compile/typescript/builder/generate.go deleted file mode 100644 index ef7f982b..00000000 --- a/compile/typescript/builder/generate.go +++ /dev/null @@ -1,19 +0,0 @@ -/* - Copyright 2022 Loophole Labs - - Licensed under the Apache License, Version 2.0 (the "License"); - you may not use this file except in compliance with the License. - You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - - Unless required by applicable law or agreed to in writing, software - distributed under the License is distributed on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - See the License for the specific language governing permissions and - limitations under the License. -*/ - -package typescript - -//go:generate make builder-all-targets diff --git a/config.ts b/config.ts index e9fc8783..e80f708a 100644 --- a/config.ts +++ b/config.ts @@ -30,14 +30,14 @@ class ConfigFunction { } export class Config { - newSignature: New; - functions: ConfigFunction[] = []; + private newSignature: New; + private functions: ConfigFunction[] = []; constructor(newSignature: New) { this.newSignature = newSignature; } - validate(): Error | null { + public validate(): Error | null { if (!this) { return new Error("no config provided"); } @@ -59,7 +59,12 @@ export class Config { return null; } - withFunction(func: ScaleFunc, env?: { [key: string]: string }): Config { + public withSignature(newSignature: New): Config { + this.newSignature = newSignature; + return this; + } + + public withFunction(func: ScaleFunc, env?: { [key: string]: string }): Config { const f = new ConfigFunction(func, env); f.function = func; @@ -71,7 +76,7 @@ export class Config { return this; } - withFunctions(functions: ScaleFunc[], env?: { [key: string]: string }): Config { + public withFunctions(functions: ScaleFunc[], env?: { [key: string]: string }): Config { for (const func of functions) { this.withFunction(func, env); } diff --git a/integration/golang_tests/signature/go.mod b/integration/golang_tests/signature/go.mod index 10dbf668..06addd8f 100644 --- a/integration/golang_tests/signature/go.mod +++ b/integration/golang_tests/signature/go.mod @@ -3,12 +3,6 @@ module signature go 1.20 require ( - github.com/loopholelabs/polyglot v1.1.3 - github.com/stretchr/testify v1.8.4 -) - -require ( - github.com/davecgh/go-spew v1.1.1 // indirect - github.com/pmezard/go-difflib v1.0.0 // indirect - gopkg.in/yaml.v3 v3.0.1 // indirect -) + github.com/loopholelabs/polyglot v1.1.3 + github.com/loopholelabs/scale-signature-interfaces v0.1.7 +) \ No newline at end of file diff --git a/integration/golang_tests/signature/go.sum b/integration/golang_tests/signature/go.sum index 0754633d..e2ed0736 100644 --- a/integration/golang_tests/signature/go.sum +++ b/integration/golang_tests/signature/go.sum @@ -2,6 +2,7 @@ github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/loopholelabs/polyglot v1.1.3 h1:WUTcSZ2TQ1lv7CZ4I9nHFBUjf0hKJN+Yfz1rZZJuTP0= github.com/loopholelabs/polyglot v1.1.3/go.mod h1:EA88BEkIluKHAWxhyOV88xXz68YkRdo9IzZ+1dj+7Ao= +github.com/loopholelabs/scale-signature-interfaces v0.1.7/go.mod h1:3XLMjJjBf5lYxMtNKk+2XAWye4UyrkvUBJ9L6x2QCAk= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk= diff --git a/integration/golang_tests/signature/guest.go b/integration/golang_tests/signature/guest.go index df450467..828f85f7 100644 --- a/integration/golang_tests/signature/guest.go +++ b/integration/golang_tests/signature/guest.go @@ -75,6 +75,6 @@ func Next(ctx *ModelWithAllFieldTypes) (*ModelWithAllFieldTypes, error) { return Read(ctx) } -//export next +//go:export next //go:linkname next func next(offset uint32, length uint32) diff --git a/integration/rust_tests/signature/Cargo.toml b/integration/rust_tests/signature/Cargo.toml index f0b89bbb..5464c252 100644 --- a/integration/rust_tests/signature/Cargo.toml +++ b/integration/rust_tests/signature/Cargo.toml @@ -18,7 +18,7 @@ version = "0.7.0" version = "1.9.4" [dependencies.scale_signature_interfaces] -version = "0.1.6" +version = "0.1.7" [dependencies.polyglot_rs] version = "1.1.3" diff --git a/integration/typescript_tests/host_signature/package.json b/integration/typescript_tests/host_signature/package.json index af044b82..61ce6cd0 100644 --- a/integration/typescript_tests/host_signature/package.json +++ b/integration/typescript_tests/host_signature/package.json @@ -15,6 +15,6 @@ }, "dependencies": { "@loopholelabs/polyglot": "^1.1.3", - "@loopholelabs/scale-signature-interfaces": "^0.1.6" + "@loopholelabs/scale-signature-interfaces": "^0.1.7" } } diff --git a/integration/typescript_tests/signature/index.js b/integration/typescript_tests/signature/index.js index b37a1e21..8bc3e544 100644 --- a/integration/typescript_tests/signature/index.js +++ b/integration/typescript_tests/signature/index.js @@ -69,7 +69,7 @@ function Hash() { } function Next(ctx) { const [ptr, len] = Write(ctx); - const next = global[interfaces.TYPESCRIPT_NEXT_FUNCTION]; + const next = global[interfaces.TYPESCRIPT_NEXT]; next([ptr, len]); return Read(); } diff --git a/integration/typescript_tests/signature/index.js.map b/integration/typescript_tests/signature/index.js.map index eb885439..6fa9437c 100644 --- a/integration/typescript_tests/signature/index.js.map +++ b/integration/typescript_tests/signature/index.js.map @@ -2,7 +2,7 @@ "version": 3, "sources": [""], "sourceRoot": "index.js", - "sourcesContent": ["// Code generated by scale-signature 0.3.20, DO NOT EDIT.\n// output: local-example-latest-guest\n\n/* eslint no-bitwise: off */\n\nimport { Signature as SignatureInterface } from \"@loopholelabs/scale-signature-interfaces\";\nimport { Decoder, Encoder, Kind } from \"@loopholelabs/polyglot\";\n\nlet WRITE_BUFFER: ArrayBuffer = new Uint8Array().buffer;\nlet READ_BUFFER: ArrayBuffer = new Uint8Array().buffer;\n\nexport * from \"./types\";\n\nconst hash = \"3a592aa345d412faa2e6285ee048ca2ab5aa64b0caa2f9ca67b2c1e0792101e5\"\n\n// Write serializes the signature into the global WRITE_BUFFER and returns the pointer to the buffer and its size\n//\n// Users should not use this method.\nexport function Write(ctx: ModelWithAllFieldTypes): number[] {\n WRITE_BUFFER = ctx.encode(new Uint8Array()).buffer;\n const addrof = (global as any)[SignatureInterface.TYPESCRIPT_ADDRESS_OF];\n const ptr = addrof(WRITE_BUFFER);\n const len = WRITE_BUFFER.byteLength;\n return [ptr, len];\n}\n\n// Read deserializes signature from the global READ_BUFFER\n//\n// Users should not use this method.\nexport function Read(): ModelWithAllFieldTypes | undefined {\n const dec = new Decoder(new Uint8Array(READ_BUFFER));\n return ModelWithAllFieldTypes.decode(dec).value;\n}\n\n// Error serializes an error into the global writeBuffer and returns a pointer to the buffer and its size\n//\n// Users should not use this method.\nexport function Error(err: Error): number[] {\n const enc = new Encoder();\n enc.error(err);\n WRITE_BUFFER = enc.buffer;\n const addrof = (global as any)[interfaces.TYPESCRIPT_ADDRESS_OF];\n const ptr = addrof(WRITE_BUFFER);\n const len = WRITE_BUFFER.byteLength;\n return [ptr, len];\n}\n\n// Resize resizes the global READ_BUFFER to the given size and returns the pointer to the buffer\n//\n// Users should not use this method.\nexport function Resize(size: number): number {\n READ_BUFFER = new Uint8Array(size).buffer;\n const addrof = (global as any)[interfaces.TYPESCRIPT_ADDRESS_OF];\n return addrof(READ_BUFFER);\n}\n\n// Hash returns the hash of the Scale Signature\n//\n// Users should not use this method.\nexport function Hash(): number[] {\n const enc = new Encoder();\n enc.string(hash);\n WRITE_BUFFER = enc.buffer;\n const addrof = (global as any)[interfaces.TYPESCRIPT_ADDRESS_OF];\n const ptr = addrof(WRITE_BUFFER);\n const len = WRITE_BUFFER.byteLength;\n return [ptr, len];\n}\n\n// Next calls the next function in the Scale Function Chain\nexport function Next(ctx: ModelWithAllFieldTypes): ModelWithAllFieldTypes | undefined {\n const [ptr, len] = Write(ctx);\n const next = (global as any)[interfaces.TYPESCRIPT_NEXT_FUNCTION];\n next([ptr, len]);\n return Read();\n}\n"], - "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,eAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,wCAAgD;AAChD,sBAAuC;AAKvC,0BAAc,oBAXd;AAQA,IAAI,eAA4B,IAAI,WAAW,EAAE;AACjD,IAAI,cAA2B,IAAI,WAAW,EAAE;AAIhD,MAAM,OAAO;AAKN,SAAS,MAAM,KAAuC;AAC3D,iBAAe,IAAI,OAAO,IAAI,WAAW,CAAC,EAAE;AAC5C,QAAM,SAAU,OAAe,kCAAAC,UAAmB,qBAAqB;AACvE,QAAM,MAAM,OAAO,YAAY;AAC/B,QAAM,MAAM,aAAa;AACzB,SAAO,CAAC,KAAK,GAAG;AAClB;AAKO,SAAS,OAA2C;AACzD,QAAM,MAAM,IAAI,wBAAQ,IAAI,WAAW,WAAW,CAAC;AACnD,SAAO,uBAAuB,OAAO,GAAG,EAAE;AAC5C;AAKO,SAASD,OAAM,KAAsB;AAC1C,QAAM,MAAM,IAAI,wBAAQ;AACxB,MAAI,MAAM,GAAG;AACb,iBAAe,IAAI;AACnB,QAAM,SAAU,OAAe,WAAW,qBAAqB;AAC/D,QAAM,MAAM,OAAO,YAAY;AAC/B,QAAM,MAAM,aAAa;AACzB,SAAO,CAAC,KAAK,GAAG;AAClB;AAKO,SAAS,OAAO,MAAsB;AAC3C,gBAAc,IAAI,WAAW,IAAI,EAAE;AACnC,QAAM,SAAU,OAAe,WAAW,qBAAqB;AAC/D,SAAO,OAAO,WAAW;AAC3B;AAKO,SAAS,OAAiB;AAC/B,QAAM,MAAM,IAAI,wBAAQ;AACxB,MAAI,OAAO,IAAI;AACf,iBAAe,IAAI;AACnB,QAAM,SAAU,OAAe,WAAW,qBAAqB;AAC/D,QAAM,MAAM,OAAO,YAAY;AAC/B,QAAM,MAAM,aAAa;AACzB,SAAO,CAAC,KAAK,GAAG;AAClB;AAGO,SAAS,KAAK,KAAiE;AACpF,QAAM,CAAC,KAAK,GAAG,IAAI,MAAM,GAAG;AAC5B,QAAM,OAAQ,OAAe,WAAW,wBAAwB;AAChE,OAAK,CAAC,KAAK,GAAG,CAAC;AACf,SAAO,KAAK;AACd;", + "sourcesContent": ["// Code generated by scale-signature 0.3.20, DO NOT EDIT.\n// output: local-example-latest-guest\n\n/* eslint no-bitwise: off */\n\nimport { Signature as SignatureInterface } from \"@loopholelabs/scale-signature-interfaces\";\nimport { Decoder, Encoder, Kind } from \"@loopholelabs/polyglot\";\n\nlet WRITE_BUFFER: ArrayBuffer = new Uint8Array().buffer;\nlet READ_BUFFER: ArrayBuffer = new Uint8Array().buffer;\n\nexport * from \"./types\";\n\nconst hash = \"3a592aa345d412faa2e6285ee048ca2ab5aa64b0caa2f9ca67b2c1e0792101e5\"\n\n// Write serializes the signature into the global WRITE_BUFFER and returns the pointer to the buffer and its size\n//\n// Users should not use this method.\nexport function Write(ctx: ModelWithAllFieldTypes): number[] {\n WRITE_BUFFER = ctx.encode(new Uint8Array()).buffer;\n const addrof = (global as any)[SignatureInterface.TYPESCRIPT_ADDRESS_OF];\n const ptr = addrof(WRITE_BUFFER);\n const len = WRITE_BUFFER.byteLength;\n return [ptr, len];\n}\n\n// Read deserializes signature from the global READ_BUFFER\n//\n// Users should not use this method.\nexport function Read(): ModelWithAllFieldTypes | undefined {\n const dec = new Decoder(new Uint8Array(READ_BUFFER));\n return ModelWithAllFieldTypes.decode(dec).value;\n}\n\n// Error serializes an error into the global writeBuffer and returns a pointer to the buffer and its size\n//\n// Users should not use this method.\nexport function Error(err: Error): number[] {\n const enc = new Encoder();\n enc.error(err);\n WRITE_BUFFER = enc.buffer;\n const addrof = (global as any)[interfaces.TYPESCRIPT_ADDRESS_OF];\n const ptr = addrof(WRITE_BUFFER);\n const len = WRITE_BUFFER.byteLength;\n return [ptr, len];\n}\n\n// Resize resizes the global READ_BUFFER to the given size and returns the pointer to the buffer\n//\n// Users should not use this method.\nexport function Resize(size: number): number {\n READ_BUFFER = new Uint8Array(size).buffer;\n const addrof = (global as any)[interfaces.TYPESCRIPT_ADDRESS_OF];\n return addrof(READ_BUFFER);\n}\n\n// Hash returns the hash of the Scale Signature\n//\n// Users should not use this method.\nexport function Hash(): number[] {\n const enc = new Encoder();\n enc.string(hash);\n WRITE_BUFFER = enc.buffer;\n const addrof = (global as any)[interfaces.TYPESCRIPT_ADDRESS_OF];\n const ptr = addrof(WRITE_BUFFER);\n const len = WRITE_BUFFER.byteLength;\n return [ptr, len];\n}\n\n// Next calls the next function in the Scale Function Chain\nexport function Next(ctx: ModelWithAllFieldTypes): ModelWithAllFieldTypes | undefined {\n const [ptr, len] = Write(ctx);\n const next = (global as any)[interfaces.TYPESCRIPT_NEXT];\n next([ptr, len]);\n return Read();\n}\n"], + "mappings": ";;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA,eAAAA;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAKA,wCAAgD;AAChD,sBAAuC;AAKvC,0BAAc,oBAXd;AAQA,IAAI,eAA4B,IAAI,WAAW,EAAE;AACjD,IAAI,cAA2B,IAAI,WAAW,EAAE;AAIhD,MAAM,OAAO;AAKN,SAAS,MAAM,KAAuC;AAC3D,iBAAe,IAAI,OAAO,IAAI,WAAW,CAAC,EAAE;AAC5C,QAAM,SAAU,OAAe,kCAAAC,UAAmB,qBAAqB;AACvE,QAAM,MAAM,OAAO,YAAY;AAC/B,QAAM,MAAM,aAAa;AACzB,SAAO,CAAC,KAAK,GAAG;AAClB;AAKO,SAAS,OAA2C;AACzD,QAAM,MAAM,IAAI,wBAAQ,IAAI,WAAW,WAAW,CAAC;AACnD,SAAO,uBAAuB,OAAO,GAAG,EAAE;AAC5C;AAKO,SAASD,OAAM,KAAsB;AAC1C,QAAM,MAAM,IAAI,wBAAQ;AACxB,MAAI,MAAM,GAAG;AACb,iBAAe,IAAI;AACnB,QAAM,SAAU,OAAe,WAAW,qBAAqB;AAC/D,QAAM,MAAM,OAAO,YAAY;AAC/B,QAAM,MAAM,aAAa;AACzB,SAAO,CAAC,KAAK,GAAG;AAClB;AAKO,SAAS,OAAO,MAAsB;AAC3C,gBAAc,IAAI,WAAW,IAAI,EAAE;AACnC,QAAM,SAAU,OAAe,WAAW,qBAAqB;AAC/D,SAAO,OAAO,WAAW;AAC3B;AAKO,SAAS,OAAiB;AAC/B,QAAM,MAAM,IAAI,wBAAQ;AACxB,MAAI,OAAO,IAAI;AACf,iBAAe,IAAI;AACnB,QAAM,SAAU,OAAe,WAAW,qBAAqB;AAC/D,QAAM,MAAM,OAAO,YAAY;AAC/B,QAAM,MAAM,aAAa;AACzB,SAAO,CAAC,KAAK,GAAG;AAClB;AAGO,SAAS,KAAK,KAAiE;AACpF,QAAM,CAAC,KAAK,GAAG,IAAI,MAAM,GAAG;AAC5B,QAAM,OAAQ,OAAe,WAAW,eAAe;AACvD,OAAK,CAAC,KAAK,GAAG,CAAC;AACf,SAAO,KAAK;AACd;", "names": ["Error", "SignatureInterface"] } diff --git a/integration/typescript_tests/signature/package.json b/integration/typescript_tests/signature/package.json index c8a6efb9..192523d5 100644 --- a/integration/typescript_tests/signature/package.json +++ b/integration/typescript_tests/signature/package.json @@ -15,6 +15,6 @@ }, "dependencies": { "@loopholelabs/polyglot": "^1.1.3", - "@loopholelabs/scale-signature-interfaces": "^0.1.6" + "@loopholelabs/scale-signature-interfaces": "^0.1.7" } } diff --git a/signature/generator/rust/templates/guest.rs.templ b/signature/generator/rust/templates/guest.rs.templ index f2ebb22e..ed2fdea9 100644 --- a/signature/generator/rust/templates/guest.rs.templ +++ b/signature/generator/rust/templates/guest.rs.templ @@ -101,7 +101,7 @@ pub fn next(ctx: Option<&mut types::{{ .signature_schema.Context }}>) -> Result< } } -#[link(wasm_import_module = "scale")] +#[link(wasm_import_module = "env")] extern "C" { #[link_name = "next"] fn _next(ptr: u32, size: u32);