Skip to content

Commit

Permalink
Merge pull request #298 from dojoengine/fix/create
Browse files Browse the repository at this point in the history
fix: prettier
  • Loading branch information
ponderingdemocritus authored Oct 7, 2024
2 parents e8fb00b + 956aa15 commit b879aef
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 16 deletions.
10 changes: 5 additions & 5 deletions examples/example-vite-react-sdk/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import { useSystemCalls } from "./useSystemCalls.ts";

export const useDojoStore = createDojoStore<Schema>();

function App({ db }: { db: SDK<Schema> }) {
function App({ sdk }: { sdk: SDK<Schema> }) {
const {
account,
setup: { client },
Expand All @@ -29,7 +29,7 @@ function App({ db }: { db: SDK<Schema> }) {
let unsubscribe: (() => void) | undefined;

const subscribe = async () => {
const subscription = await db.subscribeEntityQuery(
const subscription = await sdk.subscribeEntityQuery(
{
dojo_starter: {
Moves: {
Expand Down Expand Up @@ -71,12 +71,12 @@ function App({ db }: { db: SDK<Schema> }) {
unsubscribe();
}
};
}, [db, account?.account.address]);
}, [sdk, account?.account.address]);

useEffect(() => {
const fetchEntities = async () => {
try {
await db.getEntities(
await sdk.getEntities(
{
dojo_starter: {
Moves: {
Expand Down Expand Up @@ -111,7 +111,7 @@ function App({ db }: { db: SDK<Schema> }) {
};

fetchEntities();
}, [db, account?.account.address]);
}, [sdk, account?.account.address]);

const moves = useModel(entityId, Models.Moves);
const position = useModel(entityId, Models.Position);
Expand Down
4 changes: 2 additions & 2 deletions examples/example-vite-react-sdk/src/main.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import { DojoContextProvider } from "./DojoContext.tsx";
import { setupBurnerManager } from "@dojoengine/create-burner";

async function main() {
const db = await init<Schema>(
const sdk = await init<Schema>(
{
client: {
rpcUrl: dojoConfig.rpcUrl,
Expand All @@ -34,7 +34,7 @@ async function main() {
<DojoContextProvider
burnerManager={await setupBurnerManager(dojoConfig)}
>
<App db={db} />
<App sdk={sdk} />
</DojoContextProvider>
</StrictMode>
);
Expand Down
3 changes: 3 additions & 0 deletions packages/create-dojo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
"publishConfig": {
"access": "public"
},
"files": [
"dist"
],
"exports": "./dist/index.js",
"bin": "./dist/index.js",
"scripts": {
Expand Down
2 changes: 0 additions & 2 deletions packages/create-dojo/src/commands/start.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#!/usr/bin/env node

import { Command } from "commander";
import path from "path";
import { promises as fs } from "fs";
Expand Down
8 changes: 1 addition & 7 deletions packages/sdk/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,6 @@ const subscription = await sdk.subscribeEntityQuery(
}
}
);

// Later, to unsubscribe
subscription.unsubscribe();
```

# Usage
Expand Down Expand Up @@ -259,9 +256,6 @@ const subscription = await sdk.subscribeEntityQuery(
}
}
);
// Later, to unsubscribe
subscription.unsubscribe();
```
## Sending Signed Messages
Expand All @@ -274,7 +268,7 @@ you'll have to properly set `relayUrl` in the `init` function.
// onchain_dash-Message is a composition of the ${namespace}-${Model} type you want to sign.
// Here we take example of a chat because we don't want to load up those messages onchain
// But keep in mind this could be any models defined in your cairo code
const msg = db.generateTypedData("onchain_dash-Message", {
const msg = sdk.generateTypedData("onchain_dash-Message", {
identity: account?.address,
content: toValidAscii(data.message),
timestamp: Date.now(),
Expand Down

0 comments on commit b879aef

Please sign in to comment.