Skip to content

Commit

Permalink
move utils
Browse files Browse the repository at this point in the history
  • Loading branch information
ponderingdemocritus committed Oct 17, 2023
1 parent 47669f7 commit bdd1bf5
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 15 deletions.
2 changes: 1 addition & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dojoengine/core",
"version": "0.1.24",
"version": "0.1.25",
"description": "Dojo engine core providers and types",
"type": "module",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/provider/RPCProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ import {
Call,
num,
} from "starknet";
import { getContractByName } from "@dojoengine/utils";
import { Provider } from "./provider";
import { Query, WorldEntryPoints } from "../types";
import { LOCAL_KATANA } from "../constants";
import abi from "../constants/abi.json";
import { getContractByName } from "../utils";

/**
* RPCProvider class: Extends the generic Provider to handle RPC interactions.
Expand Down
12 changes: 12 additions & 0 deletions packages/core/src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,16 @@ export function getAllSystemNames(manifest: any): any {
*/
export function getAllSystemNamesAsFelt(manifest: any): any {
return manifest.systems.map((system: any) => shortString.encodeShortString(system.name));
}

/**
* Gets a contract from a manifest by name.
*
* @param {any} manifest - The manifest object.
* @param {string} name - The name of the contract.
* @returns {any} The contract object.
*
*/
export const getContractByName = (manifest: any, name: string) => {
return manifest.contracts.find((contract: any) => contract.name === name)?.address || "";
}
2 changes: 1 addition & 1 deletion packages/create-burner/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dojoengine/create-burner",
"version": "0.1.24",
"version": "0.1.25",
"description": "Useful hooks and functions to create a Starknet burner wallet",
"source": "src/index.ts",
"main": "dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/utils/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@dojoengine/utils",
"version": "0.1.24",
"version": "0.1.25",
"description": "Helpful Dojo Utils",
"type": "module",
"scripts": {
Expand Down
11 changes: 0 additions & 11 deletions packages/utils/src/utils/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,3 @@ export function getEntityIdFromKeys(keys: bigint[]): Entity {
return "0x" + poseidon.toString(16) as Entity;
}

/**
* Gets a contract from a manifest by name.
*
* @param {any} manifest - The manifest object.
* @param {string} name - The name of the contract.
* @returns {any} The contract object.
*
*/
export const getContractByName = (manifest: any, name: string) => {
return manifest.contracts.find((contract: any) => contract.name === name)?.address || "";
}

0 comments on commit bdd1bf5

Please sign in to comment.