Skip to content

Commit 52dcff8

Browse files
committed
chore(ts-sdk-sui): added new function
Signed-off-by: kaancaglan <[email protected]>
1 parent e7ea531 commit 52dcff8

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

ts-sdk-sui/src/Sui.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,25 @@ export const readCoinBalances = (contractAddress: string, address: string) =>
368368
return totalBalance
369369
})
370370

371+
export const getAllCoins = (address: string) =>
372+
Effect.gen(function*() {
373+
const client = (yield* PublicClient).client
374+
let params = {
375+
owner: address,
376+
}
377+
378+
const coins = yield* Effect.tryPromise({
379+
try: async () => {
380+
const result = await client.getAllCoins(params)
381+
return result.data
382+
},
383+
catch: err =>
384+
new ReadCoinError({
385+
cause: extractErrorDetails(err as ReadCoinError),
386+
}),
387+
})
388+
return coins
389+
})
371390

372391
// /**
373392
// * Read the balance of an ERC20 token for a specific address

0 commit comments

Comments
 (0)