Skip to content

Commit

Permalink
Merge pull request #339 from dojoengine/feat/torii-tokens
Browse files Browse the repository at this point in the history
feat: add torii tokens functions to dojo sdk
  • Loading branch information
MartianGreed authored Nov 26, 2024
2 parents e7715f6 + be5c1a8 commit b08d849
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 0 deletions.
25 changes: 25 additions & 0 deletions packages/sdk/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,5 +156,30 @@ export async function init<T extends SchemaType>(
throw error;
}
},

/**
* @param {(string)[]} contract_addresses
* @returns {Promise<Tokens>}
*/
getTokens: async (
contract_addresses: string[]
): Promise<torii.Tokens> => {
return await client.getTokens(contract_addresses);
},

/**
* @param {(string)[]} account_addresses
* @param {(string)[]} contract_addresses
* @returns {Promise<TokenBalances>}
*/
getTokenBalances: async (
account_addresses: string[],
contract_addresses: string[]
): Promise<torii.TokenBalances> => {
return await client.getTokenBalances(
account_addresses,
contract_addresses
);
},
};
}
14 changes: 14 additions & 0 deletions packages/sdk/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,20 @@ export interface SDK<T extends SchemaType> {
domain?: StarknetDomain
) => TypedData;
sendMessage: (data: TypedData, account: Account) => Promise<void>;
/**
* @param {string[]} contract_addresses
* @returns {Promise<torii.Tokens>}
*/
getTokens(contract_addresses: string[]): Promise<torii.Tokens>;
/**
* @param {string[]} account_addresses
* @param {string[]} contract_addresses
* @returns {Promise<torii.TokenBalances>}
*/
getTokenBalances(
account_addresses: string[],
contract_addresses: string[]
): Promise<torii.TokenBalances>;
}

/**
Expand Down

0 comments on commit b08d849

Please sign in to comment.