@matchain/matchid-sdk-react 0.1.42-alpha.11 → 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.
@@ -4,7 +4,7 @@ import {
4
4
  useMatchEvents,
5
5
  useUserInfo,
6
6
  useWallet
7
- } from "../chunk-HJ337PTX.mjs";
7
+ } from "../chunk-P4CC5TVY.mjs";
8
8
  import "../chunk-SQIJR7RA.mjs";
9
9
  import "../chunk-DPXMCLYK.mjs";
10
10
  import "../chunk-J5LGTIGS.mjs";
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
- const sendPrepareTransactionRequest = async () => {
2218
- const { chain: chain2, account, ...prepareTransactionRequest } = await obj.prepareTransactionRequest(transaction);
2219
- window.matchProvider.sendWalletMessage({
2220
- method: "prepareTransactionRequest",
2221
- data: {
2222
- prepareTransactionRequest,
2223
- transactionId
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
- interval = setInterval(() => {
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();
@@ -2255,12 +2267,10 @@ function useWallet() {
2255
2267
  hash: txHash,
2256
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
  }