@@ -330,6 +330,47 @@ export const readCoinMetadata = (tokenAddress: Address) =>
330
330
return metadata
331
331
} )
332
332
333
+ /**
334
+ * Read Sui coin metadata (name, symbol, decimals) for a given `coinType`.
335
+ *
336
+ * Example:
337
+ * ```ts
338
+ * const meta = yield* readCoinMeta("0x2::sui::SUI")
339
+ * // -> { name: "Sui", symbol: "SUI", decimals: 9 }
340
+ * ```
341
+ *
342
+ * @param coinType Canonical coin type string (e.g., "0x2::sui::SUI")
343
+ * @returns Effect resolving to `{ name, symbol, decimals }`
344
+ * @throws ReadCoinError on RPC failure
345
+ *
346
+ * @category utils
347
+ * @since 0.0.0
348
+ */
349
+ export const readCoinMeta = ( coinType : string ) =>
350
+ Effect . gen ( function * ( ) {
351
+ const client = ( yield * PublicClient ) . client
352
+
353
+ const out = yield * Effect . tryPromise ( {
354
+ try : async ( ) => {
355
+ const meta = await client . getCoinMetadata ( { coinType } )
356
+ // meta can be null if the type has no metadata published
357
+ if ( ! meta ) {
358
+ // normalize to a typed error consistent with your pattern
359
+ throw new ReadCoinError ( { cause : `No CoinMetadata found for ${ coinType } ` } )
360
+ }
361
+ const { name, symbol, decimals } = meta
362
+ return { name, symbol, decimals }
363
+ } ,
364
+ catch : err =>
365
+ new ReadCoinError ( {
366
+ cause : extractErrorDetails ( err as Error ) ,
367
+ } ) ,
368
+ } )
369
+
370
+ return out
371
+ } )
372
+
373
+
333
374
/**
334
375
* Read all coin objects for a given `coinType` and owner address.
335
376
*
@@ -604,7 +645,6 @@ export const sendInstruction = (params: {
604
645
// typeArg?: string
605
646
// }>
606
647
607
- /** the instruction used purely for encoding operand just like EVM */
608
648
instruction : Ucs03 . Instruction
609
649
610
650
} ) =>
@@ -631,7 +671,7 @@ export const sendInstruction = (params: {
631
671
632
672
const tx = new Transaction ( )
633
673
// if (params.gasBudget !== undefined) tx.setGasBudget(BigInt(params.gasBudget as any))
634
-
674
+ // adress: 0x1234
635
675
let sendCtx = tx . moveCall ( {
636
676
target : `${ params . packageId } ::${ module } ::begin_send` ,
637
677
typeArguments : [ ] ,
0 commit comments