Skip to content

Commit

Permalink
Merge pull request #255 from dojoengine/wasm-build
Browse files Browse the repository at this point in the history
fix: fix
  • Loading branch information
ponderingdemocritus authored Aug 16, 2024
2 parents af61abf + faae45d commit 51513d6
Show file tree
Hide file tree
Showing 10 changed files with 62 additions and 50 deletions.
13 changes: 7 additions & 6 deletions examples/react/react-app/src/dojo/generated/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<ReturnType<typeof setup>>;
Expand Down Expand Up @@ -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,
Expand Down
13 changes: 7 additions & 6 deletions examples/react/react-phaser-example/src/dojo/generated/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<ReturnType<typeof setup>>;

Expand Down Expand Up @@ -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,
Expand Down
14 changes: 8 additions & 6 deletions examples/react/react-pwa-app/src/dojo/generated/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<ReturnType<typeof setup>>;
Expand Down Expand Up @@ -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,
Expand Down
8 changes: 3 additions & 5 deletions examples/react/react-threejs/src/dojo/generated/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ import { world } from "./world";
import { setupWorld } from "./generated";
import {
Account,
ArraySignatureType,
RpcProvider,
Signature,
TypedData,
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion examples/vue/vue-app/dist/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<link rel="icon" type="image/svg+xml" href="/vite.svg" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Vite + Vue + TS</title>
<script type="module" crossorigin src="/assets/index-N_KtCwhr.js"></script>
<script type="module" crossorigin src="/assets/index-V9erp4In.js"></script>
<link rel="stylesheet" crossorigin href="/assets/index-CbQMbAXL.css">
</head>
<body>
Expand Down
13 changes: 7 additions & 6 deletions examples/vue/vue-app/src/dojo/generated/setup.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<ReturnType<typeof setup>>;

Expand Down Expand Up @@ -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,
Expand Down
1 change: 1 addition & 0 deletions packages/torii-wasm/.gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
node_modules
dist
pkg
**/*/target
9 changes: 7 additions & 2 deletions packages/torii-wasm/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 ..
Expand Down
25 changes: 9 additions & 16 deletions packages/torii-wasm/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
14 changes: 12 additions & 2 deletions pnpm-lock.yaml

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

0 comments on commit 51513d6

Please sign in to comment.