@matchain/matchid-sdk-react 0.1.44-alpha.3 → 0.1.44-alpha.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/assets/icon/index.d.mts +1 -1
  2. package/dist/assets/icon/index.d.ts +1 -1
  3. package/dist/{chunk-7PMDBILL.mjs → chunk-3HJGQPXY.mjs} +2 -2
  4. package/dist/{chunk-YYO4X2NB.mjs → chunk-KOA6YG3K.mjs} +34 -16
  5. package/dist/chunk-KOA6YG3K.mjs.map +1 -0
  6. package/dist/components/index.d.mts +2 -2
  7. package/dist/components/index.d.ts +2 -2
  8. package/dist/components/index.js +22 -15
  9. package/dist/components/index.js.map +1 -1
  10. package/dist/components/index.mjs +2 -2
  11. package/dist/hooks/api/index.d.mts +2 -2
  12. package/dist/hooks/api/index.d.ts +2 -2
  13. package/dist/hooks/api/index.js +5 -5
  14. package/dist/hooks/api/index.js.map +1 -1
  15. package/dist/hooks/api/index.mjs +3 -3
  16. package/dist/hooks/index.d.mts +2 -2
  17. package/dist/hooks/index.d.ts +2 -2
  18. package/dist/hooks/index.js +22 -15
  19. package/dist/hooks/index.js.map +1 -1
  20. package/dist/hooks/index.mjs +2 -2
  21. package/dist/{index-BQDL8XkC.d.ts → index-BIQSRprZ.d.ts} +1 -1
  22. package/dist/{index-DAj3aVo6.d.mts → index-BKSFphOk.d.mts} +1 -1
  23. package/dist/{index-ivTptZeo.d.ts → index-BdUFRwfe.d.ts} +4 -1
  24. package/dist/{index-C1NfMaCm.d.mts → index-ClL_1acF.d.mts} +1 -1
  25. package/dist/{index-DnK10Gz7.d.mts → index-Cq_k0drT.d.mts} +4 -1
  26. package/dist/{index-Rb-jdkzE.d.mts → index-CvsdzdHl.d.mts} +1 -1
  27. package/dist/{index-DzVjb4K-.d.ts → index-D8yek3rk.d.ts} +1 -1
  28. package/dist/{index-x432SkFJ.d.ts → index-Dz7yUGcs.d.ts} +1 -1
  29. package/dist/index.css +4 -4
  30. package/dist/index.d.mts +5 -5
  31. package/dist/index.d.ts +5 -5
  32. package/dist/index.js +33 -15
  33. package/dist/index.js.map +1 -1
  34. package/dist/index.mjs +6 -6
  35. package/dist/types/index.d.mts +1 -1
  36. package/dist/types/index.d.ts +1 -1
  37. package/dist/{types-E2MeOwmE.d.mts → types-BOCbo3U7.d.mts} +1 -1
  38. package/dist/{types-E2MeOwmE.d.ts → types-BOCbo3U7.d.ts} +1 -1
  39. package/example/src/config/chains/matchMain.ts +1 -1
  40. package/example/src/config/chains/matchTest.ts +1 -1
  41. package/example/src/pages/Wallet.tsx +122 -49
  42. package/package.json +1 -1
  43. package/dist/chunk-YYO4X2NB.mjs.map +0 -1
  44. /package/dist/{chunk-7PMDBILL.mjs.map → chunk-3HJGQPXY.mjs.map} +0 -0
package/dist/index.mjs CHANGED
@@ -1,19 +1,19 @@
1
+ import {
2
+ chains_exports
3
+ } from "./chunk-HYQ3T6WW.mjs";
1
4
  import {
2
5
  api_exports
3
- } from "./chunk-7PMDBILL.mjs";
6
+ } from "./chunk-3HJGQPXY.mjs";
4
7
  import {
5
8
  MatchProvider,
6
9
  components_exports,
7
10
  hooks_exports,
8
11
  useMatch
9
- } from "./chunk-YYO4X2NB.mjs";
12
+ } from "./chunk-KOA6YG3K.mjs";
13
+ import "./chunk-DPXMCLYK.mjs";
10
14
  import {
11
15
  types_exports
12
16
  } from "./chunk-SQIJR7RA.mjs";
13
- import "./chunk-DPXMCLYK.mjs";
14
- import {
15
- chains_exports
16
- } from "./chunk-HYQ3T6WW.mjs";
17
17
  import "./chunk-J5LGTIGS.mjs";
18
18
  export {
19
19
  api_exports as Api,
@@ -1,3 +1,3 @@
1
1
  export { A as AuthParams, C as ChainType, E as EmbeddedWalletsParams, R as RecoveryType } from '../mpc-CTbBWHld.mjs';
2
- export { A as AnyObject, m as BindInfoType, n as BindItemType, o as BindWalletParam, B as ButtonProps, C as CEXType, D as DeepPartial, p as DrawerProps, E as EmailModalProps, a as IEnvConfigType, q as IEnvName, r as ILoginWalletReq, I as IMatchEvents, b as ISocialLoginMethod, s as IconProps, d as InputProps, L as LocaleType, f as LoginBoxProps, c as LoginMethodType, l as LoginModalProps, k as LoginPanelProps, t as MessageType, M as ModalProps, e as ModalWithHeaderProps, g as OtherLoginMethodType, O as OverviewInfo, u as PohItemType, v as PohZkpassParams, i as PopoverPositionType, P as PopoverProps, j as PopoverTypeType, R as RecommendLoginMethodType, T as ThemeType, U as UserPopoverProps, W as WalletConfigType, w as WalletPanelProps, x as WalletReceiveMessageType, h as WalletType } from '../types-E2MeOwmE.mjs';
2
+ export { A as AnyObject, n as BindInfoType, o as BindItemType, p as BindWalletParam, B as ButtonProps, C as CEXType, D as DeepPartial, q as DrawerProps, E as EmailModalProps, a as IEnvConfigType, r as IEnvName, s as ILoginWalletReq, I as IMatchEvents, j as ISocialLoginMethod, m as IconProps, b as InputProps, L as LocaleType, d as LoginBoxProps, l as LoginMethodType, i as LoginModalProps, h as LoginPanelProps, t as MessageType, M as ModalProps, c as ModalWithHeaderProps, O as OtherLoginMethodType, k as OverviewInfo, u as PohItemType, v as PohZkpassParams, f as PopoverPositionType, P as PopoverProps, g as PopoverTypeType, R as RecommendLoginMethodType, T as ThemeType, U as UserPopoverProps, W as WalletConfigType, w as WalletPanelProps, x as WalletReceiveMessageType, e as WalletType } from '../types-BOCbo3U7.mjs';
3
3
  import 'react';
@@ -1,3 +1,3 @@
1
1
  export { A as AuthParams, C as ChainType, E as EmbeddedWalletsParams, R as RecoveryType } from '../mpc-CTbBWHld.js';
2
- export { A as AnyObject, m as BindInfoType, n as BindItemType, o as BindWalletParam, B as ButtonProps, C as CEXType, D as DeepPartial, p as DrawerProps, E as EmailModalProps, a as IEnvConfigType, q as IEnvName, r as ILoginWalletReq, I as IMatchEvents, b as ISocialLoginMethod, s as IconProps, d as InputProps, L as LocaleType, f as LoginBoxProps, c as LoginMethodType, l as LoginModalProps, k as LoginPanelProps, t as MessageType, M as ModalProps, e as ModalWithHeaderProps, g as OtherLoginMethodType, O as OverviewInfo, u as PohItemType, v as PohZkpassParams, i as PopoverPositionType, P as PopoverProps, j as PopoverTypeType, R as RecommendLoginMethodType, T as ThemeType, U as UserPopoverProps, W as WalletConfigType, w as WalletPanelProps, x as WalletReceiveMessageType, h as WalletType } from '../types-E2MeOwmE.js';
2
+ export { A as AnyObject, n as BindInfoType, o as BindItemType, p as BindWalletParam, B as ButtonProps, C as CEXType, D as DeepPartial, q as DrawerProps, E as EmailModalProps, a as IEnvConfigType, r as IEnvName, s as ILoginWalletReq, I as IMatchEvents, j as ISocialLoginMethod, m as IconProps, b as InputProps, L as LocaleType, d as LoginBoxProps, l as LoginMethodType, i as LoginModalProps, h as LoginPanelProps, t as MessageType, M as ModalProps, c as ModalWithHeaderProps, O as OtherLoginMethodType, k as OverviewInfo, u as PohItemType, v as PohZkpassParams, f as PopoverPositionType, P as PopoverProps, g as PopoverTypeType, R as RecommendLoginMethodType, T as ThemeType, U as UserPopoverProps, W as WalletConfigType, w as WalletPanelProps, x as WalletReceiveMessageType, e as WalletType } from '../types-BOCbo3U7.js';
3
3
  import 'react';
@@ -241,4 +241,4 @@ type WalletPanelProps = DrawerProps & {
241
241
  title?: React.ReactNode;
242
242
  };
243
243
 
244
- export type { AnyObject as A, ButtonProps as B, CEXType as C, DeepPartial as D, EmailModalProps as E, IMatchEvents as I, LocaleType as L, ModalProps as M, OverviewInfo as O, PopoverProps as P, RecommendLoginMethodType as R, ThemeType as T, UserPopoverProps as U, WalletConfigType as W, IEnvConfigType as a, ISocialLoginMethod as b, LoginMethodType as c, InputProps as d, ModalWithHeaderProps as e, LoginBoxProps as f, OtherLoginMethodType as g, WalletType as h, PopoverPositionType as i, PopoverTypeType as j, LoginPanelProps as k, LoginModalProps as l, BindInfoType as m, BindItemType as n, BindWalletParam as o, DrawerProps as p, IEnvName as q, ILoginWalletReq as r, IconProps as s, MessageType as t, PohItemType as u, PohZkpassParams as v, WalletPanelProps as w, WalletReceiveMessageType as x };
244
+ export type { AnyObject as A, ButtonProps as B, CEXType as C, DeepPartial as D, EmailModalProps as E, IMatchEvents as I, LocaleType as L, ModalProps as M, OtherLoginMethodType as O, PopoverProps as P, RecommendLoginMethodType as R, ThemeType as T, UserPopoverProps as U, WalletConfigType as W, IEnvConfigType as a, InputProps as b, ModalWithHeaderProps as c, LoginBoxProps as d, WalletType as e, PopoverPositionType as f, PopoverTypeType as g, LoginPanelProps as h, LoginModalProps as i, ISocialLoginMethod as j, OverviewInfo as k, LoginMethodType as l, IconProps as m, BindInfoType as n, BindItemType as o, BindWalletParam as p, DrawerProps as q, IEnvName as r, ILoginWalletReq as s, MessageType as t, PohItemType as u, PohZkpassParams as v, WalletPanelProps as w, WalletReceiveMessageType as x };
@@ -241,4 +241,4 @@ type WalletPanelProps = DrawerProps & {
241
241
  title?: React.ReactNode;
242
242
  };
243
243
 
244
- export type { AnyObject as A, ButtonProps as B, CEXType as C, DeepPartial as D, EmailModalProps as E, IMatchEvents as I, LocaleType as L, ModalProps as M, OverviewInfo as O, PopoverProps as P, RecommendLoginMethodType as R, ThemeType as T, UserPopoverProps as U, WalletConfigType as W, IEnvConfigType as a, ISocialLoginMethod as b, LoginMethodType as c, InputProps as d, ModalWithHeaderProps as e, LoginBoxProps as f, OtherLoginMethodType as g, WalletType as h, PopoverPositionType as i, PopoverTypeType as j, LoginPanelProps as k, LoginModalProps as l, BindInfoType as m, BindItemType as n, BindWalletParam as o, DrawerProps as p, IEnvName as q, ILoginWalletReq as r, IconProps as s, MessageType as t, PohItemType as u, PohZkpassParams as v, WalletPanelProps as w, WalletReceiveMessageType as x };
244
+ export type { AnyObject as A, ButtonProps as B, CEXType as C, DeepPartial as D, EmailModalProps as E, IMatchEvents as I, LocaleType as L, ModalProps as M, OtherLoginMethodType as O, PopoverProps as P, RecommendLoginMethodType as R, ThemeType as T, UserPopoverProps as U, WalletConfigType as W, IEnvConfigType as a, InputProps as b, ModalWithHeaderProps as c, LoginBoxProps as d, WalletType as e, PopoverPositionType as f, PopoverTypeType as g, LoginPanelProps as h, LoginModalProps as i, ISocialLoginMethod as j, OverviewInfo as k, LoginMethodType as l, IconProps as m, BindInfoType as n, BindItemType as o, BindWalletParam as p, DrawerProps as q, IEnvName as r, ILoginWalletReq as s, MessageType as t, PohItemType as u, PohZkpassParams as v, WalletPanelProps as w, WalletReceiveMessageType as x };
@@ -16,7 +16,7 @@ export const matchMain = /*#__PURE__*/ defineChain({
16
16
  apiUrl: "https://matchscan.io/api",
17
17
  },
18
18
  },
19
- iconUrl: "https://matchscan.io/static/identicon_logos/blockies.png",
19
+ iconUrl: "https://match-website-cdn.s3.ap-northeast-1.amazonaws.com/tgapp/logo_black.png",
20
20
  contracts: {
21
21
  multicall3: {
22
22
  address: "0xca11bde05977b3631167028862be2a173976ca11",
@@ -17,7 +17,7 @@ export const matchTest = /*#__PURE__*/ defineChain({
17
17
  apiUrl: "https://testnet.matchscan.io/api",
18
18
  },
19
19
  },
20
- iconUrl: "https://testnet.matchscan.io/static/identicon_logos/blockies.png",
20
+ iconUrl: "https://match-website-cdn.s3.ap-northeast-1.amazonaws.com/tgapp/logo_black.png",
21
21
  contracts: {
22
22
  multicall3: {
23
23
  address: "0xca11bde05977b3631167028862be2a173976ca11",
@@ -70,7 +70,7 @@ export default function Wallet() {
70
70
 
71
71
  const [message, setMessage] = useState('hello')
72
72
  const [toAddress, setToAddress] = useState('')
73
- const [toAmount, setToAmount] = useState('0.0001')
73
+ const [toAmount, setToAmount] = useState('0.000001')
74
74
  const [data, setToData] = useState('0x')
75
75
  const {address, evmAccount, createWalletClient, walletReady} = useWallet()
76
76
  const chain = chainList.find((chain) => chain.id === initChainId)
@@ -118,7 +118,7 @@ export default function Wallet() {
118
118
  useEffect(() => {
119
119
  gasPriceQuery.refetch()
120
120
  balanceQuery.refetch()
121
- }, [chain]);
121
+ }, [chain,address]);
122
122
 
123
123
  const onSign = async () => {
124
124
  if (!walletClient) return;
@@ -220,11 +220,9 @@ export default function Wallet() {
220
220
 
221
221
  function ERC20() {
222
222
  const {initChainId, erc20Address, setErc20Address} = useLocalStore()
223
- const [hash, setHash] = useState('')
224
- const [amount, setAmount] = useState('1')
225
- const [to, setTo] = useState('')
223
+
226
224
  const {address, evmAccount, createWalletClient, walletReady} = useWallet()
227
- const [loading,setLoading] = useState(false)
225
+
228
226
  const chain = chainList.find((chain) => chain.id === initChainId)
229
227
  const publicClient = createPublicClient({
230
228
  chain: chain,
@@ -279,39 +277,128 @@ function ERC20() {
279
277
  },[balanceQuery.data,decimalsQuery.data])
280
278
 
281
279
  console.log(balanceQuery,symbolQuery,decimalsQuery)
282
- const onSend = async()=>{
283
- try{
284
- setLoading(true)
285
- if(!walletReady) throw new Error('wallet not ready')
286
- if(!evmAccount) throw new Error('account not ready')
287
- if(!erc20Address) throw new Error('erc20Address not ready')
288
- if(!to) throw new Error('to not ready')
289
- if(!amount) throw new Error('amount not ready')
290
-
291
- const walletClient = createWalletClient({
292
- chain:chain,
293
- transport:http(),
294
- })
295
- if(walletClient){
296
-
297
- const hash = await walletClient?.writeContract({
298
- address:erc20Address as `0x${string}`,
299
- abi:Erc20Abi as any,
300
- functionName:'transfer',
301
- args:[to,parseUnits(amount,decimalsQuery.data||18)],
280
+
281
+ function Transfer(){
282
+ const [to, setTo] = useState(address)
283
+ const [hash, setHash] = useState('')
284
+ const [amount, setAmount] = useState('0.0001')
285
+ const [loading,setLoading] = useState(false)
286
+ const onSend = async()=>{
287
+ try{
288
+ setLoading(true)
289
+ if(!walletReady) throw new Error('wallet not ready')
290
+ if(!evmAccount) throw new Error('account not ready')
291
+ if(!erc20Address) throw new Error('erc20Address not ready')
292
+ if(!to) throw new Error('to not ready')
293
+ if(!amount) throw new Error('amount not ready')
294
+
295
+ const walletClient = createWalletClient({
296
+ chain:chain,
297
+ transport:http(),
302
298
  })
303
- setHash(hash)
299
+ if(walletClient){
300
+
301
+ const hash = await walletClient?.writeContract({
302
+ address:erc20Address as `0x${string}`,
303
+ abi:Erc20Abi as any,
304
+ functionName:'transfer',
305
+ args:[to,parseUnits(amount,decimalsQuery.data||18)],
306
+ })
307
+ setHash(hash)
308
+ }
309
+
310
+
311
+ }catch(error:any){
312
+ console.error(error)
313
+ alert(error.message)
314
+ }finally {
315
+ setLoading(false)
304
316
  }
317
+ }
318
+
319
+ return <>
320
+ <ButtonGroup title={"Transfer"}>
321
+ <div className={`flex-1 flex-wrap break-all`}>
322
+ To Address:
323
+ <input className="border px-[8px]" type={'text'} placeholder={'address'} value={to}
324
+ onChange={(e) => setTo(e.target.value)}/>
325
+ </div>
326
+ <div className={`flex-1 flex-wrap break-all`}>
327
+ Amount:
328
+ <input className="border px-[8px]" type={'text'} placeholder={'amount'} value={amount}
329
+ onChange={(e) => setAmount(e.target.value)}/>
330
+ </div>
331
+
332
+ </ButtonGroup>
333
+
334
+ <ButtonGroup title={"Transaction"}>
335
+ <Button size={"sm"} loading={loading} onClick={onSend} disabled={!to||!amount||!walletReady}>Send</Button>
336
+ <div className={`flex-1 flex-wrap break-all`}>{hash}</div>
337
+ </ButtonGroup>
338
+ </>
339
+ }
305
340
 
341
+ function Approve(){
342
+ const [to, setTo] = useState(address)
343
+ const [hash, setHash] = useState('')
344
+ const [amount, setAmount] = useState('0.0001')
345
+ const [loading,setLoading] = useState(false)
346
+ const onSend = async()=>{
347
+ try{
348
+ setLoading(true)
349
+ if(!walletReady) throw new Error('wallet not ready')
350
+ if(!evmAccount) throw new Error('account not ready')
351
+ if(!erc20Address) throw new Error('erc20Address not ready')
352
+ if(!to) throw new Error('to not ready')
353
+ if(!amount) throw new Error('amount not ready')
306
354
 
307
- }catch(error:any){
308
- console.error(error)
309
- alert(error.message)
310
- }finally {
311
- setLoading(false)
355
+ const walletClient = createWalletClient({
356
+ chain:chain,
357
+ transport:http(),
358
+ })
359
+ if(walletClient){
360
+
361
+ const hash = await walletClient?.writeContract({
362
+ address:erc20Address as `0x${string}`,
363
+ abi:Erc20Abi as any,
364
+ functionName:'approve',
365
+ args:[to,parseUnits(amount,decimalsQuery.data||18)],
366
+ })
367
+ setHash(hash)
368
+ }
369
+
370
+
371
+ }catch(error:any){
372
+ console.error(error)
373
+ alert(error.message)
374
+ }finally {
375
+ setLoading(false)
376
+ }
312
377
  }
378
+
379
+ return <>
380
+ <ButtonGroup title={"Approve"}>
381
+ <div className={`flex-1 flex-wrap break-all`}>
382
+ To Address:
383
+ <input className="border px-[8px]" type={'text'} placeholder={'address'} value={to}
384
+ onChange={(e) => setTo(e.target.value)}/>
385
+ </div>
386
+ <div className={`flex-1 flex-wrap break-all`}>
387
+ Amount:
388
+ <input className="border px-[8px]" type={'text'} placeholder={'amount'} value={amount}
389
+ onChange={(e) => setAmount(e.target.value)}/>
390
+ </div>
391
+
392
+ </ButtonGroup>
393
+
394
+ <ButtonGroup title={"Transaction"}>
395
+ <Button size={"sm"} loading={loading} onClick={onSend} disabled={!to||!amount||!walletReady}>Send</Button>
396
+ <div className={`flex-1 flex-wrap break-all`}>{hash}</div>
397
+ </ButtonGroup>
398
+ </>
313
399
  }
314
- return <div>
400
+
401
+ return <div className="mt-[20px]">
315
402
  <ButtonGroup title={"ERC20"}></ButtonGroup>
316
403
  <ButtonGroup title={"Contract Address"}>
317
404
  <input className="border px-[8px]" type={'text'} placeholder={'contact'} value={erc20Address}
@@ -325,21 +412,7 @@ function ERC20() {
325
412
  <div className={`flex-1 flex-wrap break-all`}>{balanceQuery.data?.toString()}</div>
326
413
  <div className={`flex-1 flex-wrap break-all`}>{balanceUnit} {symbolQuery.data}</div>
327
414
  </ButtonGroup>
328
- <ButtonGroup title={"Send"}>
329
- <div className={`flex-1 flex-wrap break-all`}>
330
- To Address:
331
- <input className="border px-[8px]" type={'text'} placeholder={'address'} value={to}
332
- onChange={(e) => setTo(e.target.value)}/>
333
- </div>
334
- <div className={`flex-1 flex-wrap break-all`}>
335
- Amount:
336
- <input className="border px-[8px]" type={'text'} placeholder={'amount'} value={amount}
337
- onChange={(e) => setAmount(e.target.value)}/>
338
- </div>
339
- <Button size={"sm"} loading={loading} onClick={onSend} disabled={!to||!amount}>Send</Button>
340
- </ButtonGroup>
341
- <ButtonGroup title={"Hash"}>
342
- <div className={`flex-1 flex-wrap break-all`}>{hash}</div>
343
- </ButtonGroup>
415
+ <Transfer/>
416
+ <Approve/>
344
417
  </div>
345
418
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@matchain/matchid-sdk-react",
3
- "version": "0.1.44-alpha.3",
3
+ "version": "0.1.44-alpha.5",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "exports": {