From 24af632537caa4c285fcbed0422483ce78ed5cb0 Mon Sep 17 00:00:00 2001 From: ponderingdemocritus Date: Fri, 16 Aug 2024 12:19:25 -0400 Subject: [PATCH 1/4] fix: fix --- packages/torii-wasm/.gitignore | 1 + packages/torii-wasm/package.json | 23 ++++++++--------------- 2 files changed, 9 insertions(+), 15 deletions(-) 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/package.json b/packages/torii-wasm/package.json index 637277aa..421e3a5d 100644 --- a/packages/torii-wasm/package.json +++ b/packages/torii-wasm/package.json @@ -4,29 +4,22 @@ "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": "pkg/node/dojo_c.js", + "browser": "pkg/web/dojo_c.js", "type": "module", "scripts": { "build-wasm": "sh ./build.sh", "build": "npm run build-wasm && tsc" }, "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" + "pkg/**/*" ], - "module": "./pkg/web/dojo_c.js", - "types": "./pkg/web/dojo_c.d.ts", + "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/*" + "pkg/web/dojo_c.js", + "pkg/node/dojo_c.js", + "pkg/snippets/*" ], "devDependencies": { "tsup": "^8.1.0", From 3f03062f2e49d921411bd3b00264b52e78b15972 Mon Sep 17 00:00:00 2001 From: ponderingdemocritus Date: Fri, 16 Aug 2024 14:44:05 -0400 Subject: [PATCH 2/4] fix: fix wasm exclusion by forcing delete of gitignore --- packages/torii-wasm/build.sh | 9 +++++++-- packages/torii-wasm/package.json | 18 +++++++++--------- pnpm-lock.yaml | 14 ++++++++++++-- 3 files changed, 28 insertions(+), 13 deletions(-) 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 421e3a5d..cefbf029 100644 --- a/packages/torii-wasm/package.json +++ b/packages/torii-wasm/package.json @@ -4,26 +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/**/*" + "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 From b91160f9ed7f1971896f92bef587bf6ef5f82cd1 Mon Sep 17 00:00:00 2001 From: ponderingdemocritus Date: Fri, 16 Aug 2024 15:13:36 -0400 Subject: [PATCH 3/4] fix: build --- examples/vue/vue-app/dist/index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/examples/vue/vue-app/dist/index.html b/examples/vue/vue-app/dist/index.html index 7cd38c57..eb6e4ada 100644 --- a/examples/vue/vue-app/dist/index.html +++ b/examples/vue/vue-app/dist/index.html @@ -5,7 +5,7 @@ Vite + Vue + TS - + From faae45d6ca3d32d0c71381502987e19ac2f1952d Mon Sep 17 00:00:00 2001 From: ponderingdemocritus Date: Fri, 16 Aug 2024 16:54:00 -0400 Subject: [PATCH 4/4] fix: dojo c upgrade --- .../react/react-app/src/dojo/generated/setup.ts | 13 +++++++------ .../src/dojo/generated/setup.ts | 13 +++++++------ .../react-pwa-app/src/dojo/generated/setup.ts | 14 ++++++++------ .../react-threejs/src/dojo/generated/setup.ts | 8 +++----- examples/vue/vue-app/dist/index.html | 2 +- examples/vue/vue-app/src/dojo/generated/setup.ts | 13 +++++++------ 6 files changed, 33 insertions(+), 30 deletions(-) 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 eb6e4ada..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,