@matchain/matchid-sdk-react 0.1.42-alpha.10 → 0.1.42-alpha.12
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/{chunk-N53ZMW5C.mjs → chunk-3SFDSK7R.mjs} +2 -2
- package/dist/{chunk-YG4MNAUD.mjs → chunk-P4CC5TVY.mjs} +30 -20
- package/dist/{chunk-YG4MNAUD.mjs.map → chunk-P4CC5TVY.mjs.map} +1 -1
- package/dist/components/index.js +29 -19
- package/dist/components/index.js.map +1 -1
- package/dist/components/index.mjs +1 -1
- package/dist/hooks/api/index.js.map +1 -1
- package/dist/hooks/api/index.mjs +2 -2
- package/dist/hooks/index.d.mts +1 -1
- package/dist/hooks/index.d.ts +1 -1
- package/dist/hooks/index.js +29 -19
- package/dist/hooks/index.js.map +1 -1
- package/dist/hooks/index.mjs +1 -1
- package/dist/{index-sOVSnYF4.d.mts → index-B2B4VJ-u.d.mts} +4 -2
- package/dist/{index-DKMrpRJC.d.ts → index-Bhnio7tx.d.ts} +4 -2
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +29 -19
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/example/src/abi/erc20.json +222 -0
- package/example/src/pages/Wallet.tsx +135 -9
- package/example/src/store/useLocalStore.ts +7 -1
- package/example/tsconfig.json +1 -0
- package/package.json +1 -1
- /package/dist/{chunk-N53ZMW5C.mjs.map → chunk-3SFDSK7R.mjs.map} +0 -0
package/dist/hooks/index.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { j as ISocialLoginMethod, k as OverviewInfo, C as CEXType, l as LoginMethodType, I as IMatchEvents } from './types-CVwZEgQ0.mjs';
|
|
2
2
|
import * as viem from 'viem';
|
|
3
|
-
import { Account, WalletClientConfig, createWalletClient, SignableMessage, Hex, TransactionSerializable, DeployContractParameters, SendTransactionParameters, WriteContractParameters } from 'viem';
|
|
3
|
+
import { Account, WalletClientConfig, createWalletClient, SignableMessage, Hex, TransactionSerializable, DeployContractParameters, SendTransactionParameters, WriteContractParameters, Chain } from 'viem';
|
|
4
4
|
import { C as ChainType, R as RecoveryType } from './mpc-CTbBWHld.mjs';
|
|
5
5
|
import { Hash } from 'viem/types/misc';
|
|
6
6
|
import { Abi } from 'abitype';
|
|
@@ -94,7 +94,9 @@ type SendTransactionParametersType = Omit<SendTransactionParameters, 'account'>;
|
|
|
94
94
|
type SendTransactionType = (transaction: SendTransactionParametersType) => Promise<SendTransactionReturnType>;
|
|
95
95
|
type DeployContractReturnType = SendTransactionReturnType;
|
|
96
96
|
type DeployContractType = <const abi extends Abi | readonly unknown[]>(parameters: DeployContractParameters<abi>) => Promise<DeployContractReturnType>;
|
|
97
|
-
type WriteContractParametersType = Omit<WriteContractParameters, 'account'
|
|
97
|
+
type WriteContractParametersType = Omit<WriteContractParameters, 'account' | 'chain'> & {
|
|
98
|
+
chain?: Chain;
|
|
99
|
+
};
|
|
98
100
|
type WriteContractReturnType = SendTransactionReturnType;
|
|
99
101
|
type WriteContractType = (params: WriteContractParametersType) => Promise<WriteContractReturnType>;
|
|
100
102
|
interface UseWalletReturnType {
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { j as ISocialLoginMethod, k as OverviewInfo, C as CEXType, l as LoginMethodType, I as IMatchEvents } from './types-CVwZEgQ0.js';
|
|
2
2
|
import * as viem from 'viem';
|
|
3
|
-
import { Account, WalletClientConfig, createWalletClient, SignableMessage, Hex, TransactionSerializable, DeployContractParameters, SendTransactionParameters, WriteContractParameters } from 'viem';
|
|
3
|
+
import { Account, WalletClientConfig, createWalletClient, SignableMessage, Hex, TransactionSerializable, DeployContractParameters, SendTransactionParameters, WriteContractParameters, Chain } from 'viem';
|
|
4
4
|
import { C as ChainType, R as RecoveryType } from './mpc-CTbBWHld.js';
|
|
5
5
|
import { Hash } from 'viem/types/misc';
|
|
6
6
|
import { Abi } from 'abitype';
|
|
@@ -94,7 +94,9 @@ type SendTransactionParametersType = Omit<SendTransactionParameters, 'account'>;
|
|
|
94
94
|
type SendTransactionType = (transaction: SendTransactionParametersType) => Promise<SendTransactionReturnType>;
|
|
95
95
|
type DeployContractReturnType = SendTransactionReturnType;
|
|
96
96
|
type DeployContractType = <const abi extends Abi | readonly unknown[]>(parameters: DeployContractParameters<abi>) => Promise<DeployContractReturnType>;
|
|
97
|
-
type WriteContractParametersType = Omit<WriteContractParameters, 'account'
|
|
97
|
+
type WriteContractParametersType = Omit<WriteContractParameters, 'account' | 'chain'> & {
|
|
98
|
+
chain?: Chain;
|
|
99
|
+
};
|
|
98
100
|
type WriteContractReturnType = SendTransactionReturnType;
|
|
99
101
|
type WriteContractType = (params: WriteContractParametersType) => Promise<WriteContractReturnType>;
|
|
100
102
|
interface UseWalletReturnType {
|
package/dist/index.d.mts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
2
|
import { I as IMatchEvents, a as IEnvConfigType, L as LocaleType, W as WalletConfigType } from './types-CVwZEgQ0.mjs';
|
|
3
3
|
export { i as Components } from './index-CmH9iRLd.mjs';
|
|
4
|
-
export { i as Hooks } from './index-
|
|
4
|
+
export { i as Hooks } from './index-B2B4VJ-u.mjs';
|
|
5
5
|
export { i as Api } from './index-DFZpfAfc.mjs';
|
|
6
6
|
export { i as Chains } from './index-DXRGMAbv.mjs';
|
|
7
7
|
export { i as Types } from './index-q5XDobUF.mjs';
|
package/dist/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import React, { ReactNode } from 'react';
|
|
2
2
|
import { I as IMatchEvents, a as IEnvConfigType, L as LocaleType, W as WalletConfigType } from './types-CVwZEgQ0.js';
|
|
3
3
|
export { i as Components } from './index-DY_ReBra.js';
|
|
4
|
-
export { i as Hooks } from './index-
|
|
4
|
+
export { i as Hooks } from './index-Bhnio7tx.js';
|
|
5
5
|
export { i as Api } from './index-Ca9nh_8s.js';
|
|
6
6
|
export { i as Chains } from './index-DXRGMAbv.js';
|
|
7
7
|
export { i as Types } from './index-BxS06a5O.js';
|
package/dist/index.js
CHANGED
|
@@ -2214,24 +2214,35 @@ function useWallet() {
|
|
|
2214
2214
|
const chainId = chain ? chain.id : await obj.getChainId();
|
|
2215
2215
|
const _chain = chain || obj.chain;
|
|
2216
2216
|
const transactionId = Date.now().toString() + Math.random().toString().slice(6);
|
|
2217
|
-
|
|
2218
|
-
const
|
|
2219
|
-
|
|
2220
|
-
|
|
2221
|
-
|
|
2222
|
-
|
|
2223
|
-
|
|
2217
|
+
let interval = setInterval(() => {
|
|
2218
|
+
const sendPrepareTransactionRequest = async () => {
|
|
2219
|
+
try {
|
|
2220
|
+
const {
|
|
2221
|
+
chain: chain2,
|
|
2222
|
+
account,
|
|
2223
|
+
...prepareTransactionRequest
|
|
2224
|
+
// @ts-ignore
|
|
2225
|
+
} = await obj.prepareTransactionRequest(transaction);
|
|
2226
|
+
window.matchProvider.sendWalletMessage({
|
|
2227
|
+
method: "prepareTransactionRequest",
|
|
2228
|
+
data: {
|
|
2229
|
+
prepareTransactionRequest,
|
|
2230
|
+
transactionId
|
|
2231
|
+
}
|
|
2232
|
+
});
|
|
2233
|
+
} catch (error) {
|
|
2234
|
+
console.error(error);
|
|
2224
2235
|
}
|
|
2225
|
-
}
|
|
2226
|
-
};
|
|
2227
|
-
let interval = null;
|
|
2228
|
-
const timer = setTimeout(() => {
|
|
2236
|
+
};
|
|
2229
2237
|
sendPrepareTransactionRequest();
|
|
2230
|
-
|
|
2231
|
-
sendPrepareTransactionRequest();
|
|
2232
|
-
}, 1e4);
|
|
2233
|
-
}, 1500);
|
|
2238
|
+
}, 1e4);
|
|
2234
2239
|
try {
|
|
2240
|
+
const {
|
|
2241
|
+
chain: chain2,
|
|
2242
|
+
account,
|
|
2243
|
+
...prepareTransactionRequest
|
|
2244
|
+
// @ts-ignore
|
|
2245
|
+
} = await obj.prepareTransactionRequest(transaction);
|
|
2235
2246
|
const { serializedTransaction } = await window.matchProvider.waitUntilWalletMessage({
|
|
2236
2247
|
method: "sendTransaction",
|
|
2237
2248
|
data: {
|
|
@@ -2244,7 +2255,8 @@ function useWallet() {
|
|
|
2244
2255
|
id: chainId,
|
|
2245
2256
|
name: _chain?.name,
|
|
2246
2257
|
nativeCurrency: _chain?.nativeCurrency
|
|
2247
|
-
}
|
|
2258
|
+
},
|
|
2259
|
+
prepareTransactionRequest
|
|
2248
2260
|
}
|
|
2249
2261
|
});
|
|
2250
2262
|
openHashPanel();
|
|
@@ -2253,14 +2265,12 @@ function useWallet() {
|
|
|
2253
2265
|
});
|
|
2254
2266
|
openHashPanel({
|
|
2255
2267
|
hash: txHash,
|
|
2256
|
-
chain
|
|
2268
|
+
chain: _chain
|
|
2257
2269
|
});
|
|
2258
|
-
clearTimeout(timer);
|
|
2259
2270
|
clearInterval(interval);
|
|
2260
2271
|
resolve(txHash);
|
|
2261
2272
|
} catch (error) {
|
|
2262
2273
|
console.error("qwe-sign-error", error);
|
|
2263
|
-
clearTimeout(timer);
|
|
2264
2274
|
clearInterval(interval);
|
|
2265
2275
|
reject(error);
|
|
2266
2276
|
}
|