@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.
- package/dist/assets/icon/index.d.mts +1 -1
- package/dist/assets/icon/index.d.ts +1 -1
- package/dist/{chunk-7PMDBILL.mjs → chunk-3HJGQPXY.mjs} +2 -2
- package/dist/{chunk-YYO4X2NB.mjs → chunk-KOA6YG3K.mjs} +34 -16
- package/dist/chunk-KOA6YG3K.mjs.map +1 -0
- package/dist/components/index.d.mts +2 -2
- package/dist/components/index.d.ts +2 -2
- package/dist/components/index.js +22 -15
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +2 -2
- package/dist/hooks/api/index.d.mts +2 -2
- package/dist/hooks/api/index.d.ts +2 -2
- package/dist/hooks/api/index.js +5 -5
- package/dist/hooks/api/index.js.map +1 -1
- package/dist/hooks/api/index.mjs +3 -3
- package/dist/hooks/index.d.mts +2 -2
- package/dist/hooks/index.d.ts +2 -2
- package/dist/hooks/index.js +22 -15
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +2 -2
- package/dist/{index-BQDL8XkC.d.ts → index-BIQSRprZ.d.ts} +1 -1
- package/dist/{index-DAj3aVo6.d.mts → index-BKSFphOk.d.mts} +1 -1
- package/dist/{index-ivTptZeo.d.ts → index-BdUFRwfe.d.ts} +4 -1
- package/dist/{index-C1NfMaCm.d.mts → index-ClL_1acF.d.mts} +1 -1
- package/dist/{index-DnK10Gz7.d.mts → index-Cq_k0drT.d.mts} +4 -1
- package/dist/{index-Rb-jdkzE.d.mts → index-CvsdzdHl.d.mts} +1 -1
- package/dist/{index-DzVjb4K-.d.ts → index-D8yek3rk.d.ts} +1 -1
- package/dist/{index-x432SkFJ.d.ts → index-Dz7yUGcs.d.ts} +1 -1
- package/dist/index.css +4 -4
- package/dist/index.d.mts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +33 -15
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -6
- package/dist/types/index.d.mts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/{types-E2MeOwmE.d.mts → types-BOCbo3U7.d.mts} +1 -1
- package/dist/{types-E2MeOwmE.d.ts → types-BOCbo3U7.d.ts} +1 -1
- package/example/src/config/chains/matchMain.ts +1 -1
- package/example/src/config/chains/matchTest.ts +1 -1
- package/example/src/pages/Wallet.tsx +122 -49
- package/package.json +1 -1
- package/dist/chunk-YYO4X2NB.mjs.map +0 -1
- /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-
|
|
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-
|
|
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,
|
package/dist/types/index.d.mts
CHANGED
|
@@ -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,
|
|
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';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -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,
|
|
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,
|
|
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,
|
|
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://
|
|
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://
|
|
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.
|
|
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
|
-
|
|
224
|
-
const [amount, setAmount] = useState('1')
|
|
225
|
-
const [to, setTo] = useState('')
|
|
223
|
+
|
|
226
224
|
const {address, evmAccount, createWalletClient, walletReady} = useWallet()
|
|
227
|
-
|
|
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
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
const
|
|
298
|
-
|
|
299
|
-
|
|
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
|
-
|
|
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
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
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
|
-
|
|
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
|
-
<
|
|
329
|
-
|
|
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
|
}
|