Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 18 additions & 10 deletions playground/entities.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

<body>
<script type="module">
import init, { createClient, ClientConfig } from "../pkg/dojo_c.js";
import init, { ToriiClient } from "../pkg/dojo_c.js";
import { ThemeManager, UpdateManager } from "./setup.js";

const themeManager = new ThemeManager();
Expand All @@ -26,16 +26,24 @@
"0x064613f376f05242dfcc9fe360fa2ce1fdd6b00b1ce73dae2ea649ea118fd9be",
};

const client = await createClient(config);
const client = await new ToriiClient(config);

let entities = await client.getEntities({
limit: 10,
offset: 0,
dont_include_hashed_keys: true,
order_by: [],
entity_models: [],
entity_updated_after: 0,
});
// Construct the Query object for getEntities
const query = {
pagination: {
limit: 10,
cursor: undefined, // Offset likely maps to cursor, using undefined for start
direction: "Forward", // Default direction
order_by: [] // Assuming order_by maps here
},
clause: undefined, // No specific clause was used before
no_hashed_keys: true, // Map from dont_include_hashed_keys
models: [], // Assuming entity_models maps here
historical: false // Default value
// entity_updated_after: 0, // No direct mapping found
};

let entities = await client.getEntities(query);

updateManager.displayUpdate("fetch", entities);

Expand Down
28 changes: 16 additions & 12 deletions playground/events.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<body>
<script type="module">
import init, { createClient, ClientConfig } from '../pkg/dojo_c.js';
import init, { ToriiClient } from '../pkg/dojo_c.js';
import { ThemeManager, UpdateManager } from './setup.js';

const themeManager = new ThemeManager();
Expand All @@ -26,25 +26,30 @@
worldAddress: '0x064613f376f05242dfcc9fe360fa2ce1fdd6b00b1ce73dae2ea649ea118fd9be'
}

const client = await createClient(config);
const client = await new ToriiClient(config);

const is_historical = false;

let events = await client.getEventMessages({
limit: 10,
offset: 0,
dont_include_hashed_keys: true,
order_by: [],
entity_models: [],
entity_updated_after: 0,
const query = {
pagination: {
limit: 10,
cursor: undefined,
direction: "Forward",
order_by: []
},
clause: {
Keys: {
keys: [undefined],
pattern_matching: "VariableLen",
models: []
}
}
}, is_historical);
},
no_hashed_keys: true,
models: [],
historical: is_historical
};

let events = await client.getEventMessages(query);

updateManager.displayUpdate('fetch', events);

Expand All @@ -58,7 +63,6 @@
}
}
],
is_historical,
(entity_id, models) => {
updateManager.displayUpdate('update', {
entity_id: entity_id,
Expand Down
8 changes: 4 additions & 4 deletions playground/tokens.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

<body>
<script type="module">
import init, { createClient, ClientConfig } from '../pkg/dojo_c.js';
import init, { ToriiClient } from '../pkg/dojo_c.js';
import { ThemeManager, UpdateManager } from './setup.js';

const themeManager = new ThemeManager();
Expand All @@ -26,10 +26,10 @@
worldAddress: '0x064613f376f05242dfcc9fe360fa2ce1fdd6b00b1ce73dae2ea649ea118fd9be'
}

const client = await createClient(config);
const client = await new ToriiClient(config);

let tokens = await client.getTokens([], []);
let balances = await client.getTokenBalances([], [], []);
let tokens = await client.getTokens([], [], undefined, undefined);
let balances = await client.getTokenBalances([], [], [], undefined, undefined);

updateManager.displayUpdate("fetch tokens", tokens);
updateManager.displayUpdate("fetch balances", balances);
Expand Down
1 change: 1 addition & 0 deletions scripts/build_wasm_playground.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
npx wasm-pack build --out-dir playground/pkg --release --target web