Skip to content

Releases: dojoengine/dojo.js

v1.0.0-alpha.24

24 Oct 06:42
Compare
Choose a tag to compare

What's Changed

Full Changelog: v1.0.0-alpha.17...v1.0.0-alpha.24

v1.0.0-alpha.17

04 Oct 04:26
Compare
Choose a tag to compare

What's Changed

Full Changelog: v1.0.0-alpha.15...v1.0.0-alpha.17

v1.0.0-alpha.15

25 Sep 23:18
Compare
Choose a tag to compare
v1.0.0-alpha.15 Pre-release
Pre-release

What's Changed

New Contributors

Full Changelog: v1.0.0-alpha.6...v1.0.0-alpha.15

v1.0.0-alpha.12

02 Sep 17:41
Compare
Choose a tag to compare

What's Changed

New Contributors

Full Changelog: v1.0.0-alpha.6...v1.0.0-alpha.12

v1.0.0-alpha.6

21 Aug 18:46
Compare
Choose a tag to compare

What's Changed

Full Changelog: v1.0.0-alpha.5...v1.0.0-alpha.6

v1.0.0-alpha.5

19 Aug 14:50
Compare
Choose a tag to compare

What's Changed

Full Changelog: v1.0.0-alpha.1...v1.0.0-alpha.5

v1.0.0-alpha.1

13 Aug 16:33
Compare
Choose a tag to compare
v1.0.0-alpha.1 Pre-release
Pre-release

v1.0.0-alpha.0

22 Jul 01:05
Compare
Choose a tag to compare
v1.0.0-alpha.0 Pre-release
Pre-release

Breaking Changes

Pre-release Features

This pre-release introduces some long-awaited features for testing. More features will be added in the lead-up to v1 release. We suggest you try these and provide feedback to be added into the main release.

TLDR:

  • getSyncEntities now allows passing an array of clauses for specific state and fetching sync
  • New React hook useQuerySync allows easy fetching and syncing in React apps
  • Breaking change in the execute functions
  • Upgrade Starknet.js to latest version (previous versions were broken with latest Katana and Torii)

Torii Client Breaking Changes

Torii client must be created as follows. You no longer pass entities as the first parameter:

const toriiClient = await torii.createClient({
    rpcUrl: config.rpcUrl,
    toriiUrl: config.toriiUrl,
    relayUrl: "",
    worldAddress: config.manifest.world.address || "",
});

Getting and syncing entities introduces a Key Clause as the final parameter. Pass an empty array if you wish to fetch everything:

const sync = await getSyncEntities(
    toriiClient,
    contractComponents as any,
    []
);

If you pass in a query, it must match an array of EntityKeysClause:

export type EntityKeysClause = { HashedKeys: string[] } | { Keys: KeysClause };
export interface KeysClause {
    keys: (string | null)[];
    models: string[];
    pattern_matching: PatternMatching;
}
{
    Keys: {
        keys: [BigInt(account?.account.address).toString()],
        models: ["Position", "Moves", "DirectionsAvailable"],
        pattern_matching: "FixedLen",
    },
}

React Updates

There is a new React hook called useQuerySync which you can use to subscribe and sync specific parts of your app. This is very useful for large apps that wish to subscribe to only specific parts:

useQuerySync(toriiClient, contractComponents as any, [
    {
        Keys: {
            keys: [BigInt(account?.account.address).toString()],
            models: ["Position", "Moves", "DirectionsAvailable"],
            pattern_matching: "FixedLen",
        },
    },
]);

Core Updates

Dojo v1 introduces the concept of namespaces. Read full release notes here.

With the introduction of namespaces, a new field has been added to the execute functions - this allows you to specify which namespace to call:

return await provider.execute(
    account,
    {
        contractName: "actions",
        entrypoint: "spawn",
        calldata: [],
    },
    NAMESPACE
);

What's Changed

Full Changelog: v0.7.10-alpha.0...v1.0.0-alpha.0

v0.7.10-alpha-0

07 Jul 06:45
Compare
Choose a tag to compare

Breaking changes

This pre-release introduces some long-awaited features for testing. It allows you to sync specific parts of your world defined by Keys.

Torii Client breaking changes

Torii client must be created like the following. You now longer pass in entities as a first parameter.

    const toriiClient = await torii.createClient({
        rpcUrl: config.rpcUrl,
        toriiUrl: config.toriiUrl,
        relayUrl: "",
        worldAddress: config.manifest.world.address || "",
    });

Getting and syncing entities introduces a Key Clause as the final parameter. Pass an undefined if you wish to fetch everything.

    const sync = await getSyncEntities(
        toriiClient,
        contractComponents as any,
        undefined // syncs all entities
    );

If you do pass in a query it has to match a EntitiesKeyClause.

export type EntityKeysClause = { HashedKeys: string[] } | { Keys: KeysClause };

export interface KeysClause {
    keys: (string | null)[];
    pattern_matching: PatternMatching;
    models: string[];
}

React updates

There is a new react hook called useQuerySync which you can use to subscribe and sync specific parts of your app. This is very useful for large apps that wish to subscribe to only specific parts.

What's Changed

Full Changelog: v0.7.9...v0.7.10-alpha.0

v0.7.9

28 Jun 04:13
Compare
Choose a tag to compare

What's Changed

Full Changelog: v0.7.8...v0.7.9