diff --git a/examples/react/react-app/src/dojo/generated/setup.ts b/examples/react/react-app/src/dojo/generated/setup.ts index 98c64040..08392903 100644 --- a/examples/react/react-app/src/dojo/generated/setup.ts +++ b/examples/react/react-app/src/dojo/generated/setup.ts @@ -6,7 +6,11 @@ import { createSystemCalls } from "../createSystemCalls"; import { defineContractComponents } from "./contractComponents"; import { world } from "./world"; import { setupWorld } from "./generated"; -import { Account, WeierstrassSignatureType } from "starknet"; +import { + Account, + ArraySignatureType, + WeierstrassSignatureType, +} from "starknet"; import { BurnerManager } from "@dojoengine/create-burner"; export type SetupResult = Awaited>; @@ -62,11 +66,8 @@ export async function setup({ ...config }: DojoConfig) { clientComponents, contractComponents, systemCalls: createSystemCalls({ client }, clientComponents, world), - publish: (typedData: string, signature: WeierstrassSignatureType) => { - toriiClient.publishMessage(typedData, { - r: signature.r.toString(), - s: signature.s.toString(), - }); + publish: (typedData: string, signature: ArraySignatureType) => { + toriiClient.publishMessage(typedData, signature); }, config, dojoProvider, diff --git a/examples/react/react-phaser-example/src/dojo/generated/setup.ts b/examples/react/react-phaser-example/src/dojo/generated/setup.ts index 982088dc..00090229 100644 --- a/examples/react/react-phaser-example/src/dojo/generated/setup.ts +++ b/examples/react/react-phaser-example/src/dojo/generated/setup.ts @@ -10,7 +10,11 @@ import { DojoProvider, createModelTypedData, } from "@dojoengine/core"; -import { TypedData, WeierstrassSignatureType } from "starknet"; +import { + ArraySignatureType, + TypedData, + WeierstrassSignatureType, +} from "starknet"; export type SetupResult = Awaited>; @@ -49,11 +53,8 @@ export async function setup({ ...config }: DojoConfig) { contractComponents, clientComponents ), - publish: (typedData: string, signature: WeierstrassSignatureType) => { - toriiClient.publishMessage(typedData, { - r: signature.r.toString(), - s: signature.s.toString(), - }); + publish: (typedData: string, signature: ArraySignatureType) => { + toriiClient.publishMessage(typedData, signature); }, config, sync, diff --git a/examples/react/react-pwa-app/src/dojo/generated/setup.ts b/examples/react/react-pwa-app/src/dojo/generated/setup.ts index afc411f8..9cd7fada 100644 --- a/examples/react/react-pwa-app/src/dojo/generated/setup.ts +++ b/examples/react/react-pwa-app/src/dojo/generated/setup.ts @@ -10,7 +10,12 @@ import { createSystemCalls } from "../createSystemCalls"; import { defineContractComponents } from "./contractComponents"; import { world } from "./world"; import { setupWorld } from "./generated"; -import { Account, TypedData, WeierstrassSignatureType } from "starknet"; +import { + Account, + ArraySignatureType, + TypedData, + WeierstrassSignatureType, +} from "starknet"; import { BurnerManager } from "@dojoengine/create-burner"; export type SetupResult = Awaited>; @@ -75,11 +80,8 @@ export async function setup({ ...config }: DojoConfig) { contractComponents, clientComponents ), - publish: (typedData: string, signature: WeierstrassSignatureType) => { - toriiClient.publishMessage(typedData, { - r: signature.r.toString(), - s: signature.s.toString(), - }); + publish: (typedData: string, signature: ArraySignatureType) => { + toriiClient.publishMessage(typedData, signature); }, config, dojoProvider, diff --git a/examples/react/react-threejs/src/dojo/generated/setup.ts b/examples/react/react-threejs/src/dojo/generated/setup.ts index a46f8105..2111ab7a 100644 --- a/examples/react/react-threejs/src/dojo/generated/setup.ts +++ b/examples/react/react-threejs/src/dojo/generated/setup.ts @@ -12,6 +12,7 @@ import { world } from "./world"; import { setupWorld } from "./generated"; import { Account, + ArraySignatureType, RpcProvider, Signature, TypedData, @@ -81,11 +82,8 @@ export async function setup({ ...config }: DojoConfig) { contractComponents, clientComponents ), - publish: (typedData: string, signature: WeierstrassSignatureType) => { - toriiClient.publishMessage(typedData, { - r: signature.r.toString(), - s: signature.s.toString(), - }); + publish: (typedData: string, signature: ArraySignatureType) => { + toriiClient.publishMessage(typedData, signature); }, config, world, diff --git a/examples/vue/vue-app/dist/index.html b/examples/vue/vue-app/dist/index.html index 7cd38c57..d6838aee 100644 --- a/examples/vue/vue-app/dist/index.html +++ b/examples/vue/vue-app/dist/index.html @@ -5,7 +5,7 @@ Vite + Vue + TS - + diff --git a/examples/vue/vue-app/src/dojo/generated/setup.ts b/examples/vue/vue-app/src/dojo/generated/setup.ts index 0e6870f2..5edebeba 100644 --- a/examples/vue/vue-app/src/dojo/generated/setup.ts +++ b/examples/vue/vue-app/src/dojo/generated/setup.ts @@ -10,7 +10,11 @@ import { createSystemCalls } from "../createSystemCalls"; import { defineContractComponents } from "./contractComponents"; import { world } from "./world"; import { setupWorld } from "./generated"; -import { TypedData, WeierstrassSignatureType } from "starknet"; +import { + ArraySignatureType, + TypedData, + WeierstrassSignatureType, +} from "starknet"; export type SetupResult = Awaited>; @@ -51,11 +55,8 @@ export async function setup({ ...config }: DojoConfig) { contractComponents, clientComponents ), - publish: (typedData: string, signature: WeierstrassSignatureType) => { - toriiClient.publishMessage(typedData, { - r: signature.r.toString(), - s: signature.s.toString(), - }); + publish: (typedData: string, signature: ArraySignatureType) => { + toriiClient.publishMessage(typedData, signature); }, config, dojoProvider, diff --git a/packages/torii-wasm/.gitignore b/packages/torii-wasm/.gitignore index 81c6009f..071814fe 100644 --- a/packages/torii-wasm/.gitignore +++ b/packages/torii-wasm/.gitignore @@ -1,3 +1,4 @@ node_modules dist +pkg **/*/target diff --git a/packages/torii-wasm/build.sh b/packages/torii-wasm/build.sh index d5abf8db..0621fd95 100644 --- a/packages/torii-wasm/build.sh +++ b/packages/torii-wasm/build.sh @@ -8,10 +8,15 @@ git clone --depth 1 https://github.com/dojoengine/dojo.c dojo.c cd dojo.c # Build for web (browser) -npx wasm-pack build --out-dir ../pkg/web --release --target web +npx wasm-pack build --out-dir ../dist/pkg/web --release --target web # Build for Node.js -npx wasm-pack build --out-dir ../pkg/node --release --target nodejs +npx wasm-pack build --out-dir ../dist/pkg/node --release --target nodejs + +# Find and delete .gitignore files in the specified directories +find ../dist/pkg/node -name ".gitignore" -type f -delete +find ../dist/pkg/web -name ".gitignore" -type f -delete + # Go back to the parent directory and delete the repository cd .. diff --git a/packages/torii-wasm/package.json b/packages/torii-wasm/package.json index 637277aa..cefbf029 100644 --- a/packages/torii-wasm/package.json +++ b/packages/torii-wasm/package.json @@ -4,33 +4,26 @@ "description": "Torii wasm bindings for Dojo onchain game engine", "author": "", "license": "MIT", - "main": "./pkg/node/dojo_c.js", - "browser": "./pkg/web/dojo_c.js", + "main": "dist/pkg/node/dojo_c.js", + "browser": "dist/pkg/web/dojo_c.js", "type": "module", "scripts": { "build-wasm": "sh ./build.sh", "build": "npm run build-wasm && tsc" }, + "module": "dist/pkg/web/dojo_c.js", + "types": "dist/pkg/web/dojo_c.d.ts", "files": [ - "./pkg/web/dojo_c_bg.wasm", - "./pkg/web/dojo_c.js", - "./pkg/web/dojo_c_bg.js", - "./pkg/web/dojo_c.d.ts", - "./pkg/node/dojo_c_bg.wasm", - "./pkg/node/dojo_c.js", - "./pkg/node/dojo_c_bg.js", - "./pkg/node/dojo_c.d.ts" + "dist/pkg/**/*" ], - "module": "./pkg/web/dojo_c.js", - "types": "./pkg/web/dojo_c.d.ts", "sideEffects": [ - "./pkg/web/dojo_c.js", - "./pkg/node/dojo_c.js", - "./pkg/snippets/*" + "dist/pkg/web/dojo_c.js", + "dist/pkg/node/dojo_c.js", + "dist/pkg/snippets/*" ], "devDependencies": { "tsup": "^8.1.0", "typescript": "^5.0.3", - "wasm-pack": "^0.12.1" + "wasm-pack": "^0.13.0" } } diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 48d6c430..f81d922e 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -998,8 +998,8 @@ importers: specifier: ^5.0.3 version: 5.5.4 wasm-pack: - specifier: ^0.12.1 - version: 0.12.1 + specifier: ^0.13.0 + version: 0.13.0 packages/utils: dependencies: @@ -10802,6 +10802,10 @@ packages: resolution: {integrity: sha512-dIyKWUumPFsGohdndZjDXRFaokUT/kQS+SavbbiXVAvA/eN4riX5QNdB6AhXQx37zNxluxQkuixZUgJ8adKjOg==} hasBin: true + wasm-pack@0.13.0: + resolution: {integrity: sha512-AmboGZEnZoIcVCzSlkLEmNFEqJN+IwgshJ5S7pi30uNUTce4LvWkifQzsQRxnWj47G8gkqZxlyGlyQplsnIS7w==} + hasBin: true + watchpack@2.4.1: resolution: {integrity: sha512-8wrBCMtVhqcXP2Sup1ctSkga6uc2Bx0IIvKyT7yTFier5AXHooSI+QyQQAtTb7+E0IUCCKyTFmXqdqgum2XWGg==} engines: {node: '>=10.13.0'} @@ -23285,6 +23289,12 @@ snapshots: transitivePeerDependencies: - debug + wasm-pack@0.13.0: + dependencies: + binary-install: 1.1.0 + transitivePeerDependencies: + - debug + watchpack@2.4.1: dependencies: glob-to-regexp: 0.4.1