File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- import React , { useState } from "react" ;
1+ import React , { useEffect , useState } from "react" ;
22import "./style.css" ;
33import { useSuiClient , useSuiClientContext } from "@mysten/dapp-kit" ;
44import { DEFAULT_ED25519_DERIVATION_PATH , Ed25519Keypair } from "@mysten/sui.js/keypairs/ed25519" ;
@@ -7,6 +7,7 @@ import { Input } from "./components/Input";
77import { Button } from "./components/Button" ;
88import { Aliases } from './components/Aliases' ;
99import { sendMessage } from "./utils/wv_communicate_ext" ;
10+ import { getDetailPackage } from "./utils/suiPackage" ;
1011
1112export interface IAppProps { }
1213
@@ -111,6 +112,19 @@ export const App: React.FunctionComponent<IAppProps> = ({ }: React.PropsWithChil
111112 }
112113 } ;
113114
115+ useEffect ( ( ) => {
116+ getDetailPackage ( suiClient , "0xcab68c8cd7e80f3dd06466da6b2c083d1fd50ab3e9be8e32395c19b53021c064" ) . then ( ( data ) => {
117+ const modules = Object . keys ( data as { } ) ;
118+
119+ if ( data ) {
120+ for ( const module of modules ) {
121+ const { exposedFunctions } = data [ module ] ;
122+ console . log ( exposedFunctions ) ;
123+ }
124+ }
125+ } ) . catch ( err => console . log ( err ) ) ;
126+ } , [ ] ) ;
127+
114128 return (
115129 < >
116130 < h1 > Sui Simulator</ h1 >
Original file line number Diff line number Diff line change 1+ import { SuiClient } from "@mysten/sui.js/client" ;
2+
3+ export const getDetailPackage = async (
4+ suiClient : SuiClient ,
5+ packageId : string
6+ ) => {
7+ try {
8+ const data = await suiClient . getNormalizedMoveModulesByPackage ( {
9+ package : packageId ,
10+ } ) ;
11+ return data ;
12+ } catch ( err ) { }
13+ } ;
You can’t perform that action at this time.
0 commit comments