@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.
@@ -1895,24 +1895,35 @@ function useWallet() {
1895
1895
  const chainId = chain ? chain.id : await obj.getChainId();
1896
1896
  const _chain = chain || obj.chain;
1897
1897
  const transactionId = Date.now().toString() + Math.random().toString().slice(6);
1898
- const sendPrepareTransactionRequest = async () => {
1899
- const { chain: chain2, account, ...prepareTransactionRequest } = await obj.prepareTransactionRequest(transaction);
1900
- window.matchProvider.sendWalletMessage({
1901
- method: "prepareTransactionRequest",
1902
- data: {
1903
- prepareTransactionRequest,
1904
- transactionId
1898
+ let interval = setInterval(() => {
1899
+ const sendPrepareTransactionRequest = async () => {
1900
+ try {
1901
+ const {
1902
+ chain: chain2,
1903
+ account,
1904
+ ...prepareTransactionRequest
1905
+ // @ts-ignore
1906
+ } = await obj.prepareTransactionRequest(transaction);
1907
+ window.matchProvider.sendWalletMessage({
1908
+ method: "prepareTransactionRequest",
1909
+ data: {
1910
+ prepareTransactionRequest,
1911
+ transactionId
1912
+ }
1913
+ });
1914
+ } catch (error) {
1915
+ console.error(error);
1905
1916
  }
1906
- });
1907
- };
1908
- let interval = null;
1909
- const timer = setTimeout(() => {
1917
+ };
1910
1918
  sendPrepareTransactionRequest();
1911
- interval = setInterval(() => {
1912
- sendPrepareTransactionRequest();
1913
- }, 1e4);
1914
- }, 1500);
1919
+ }, 1e4);
1915
1920
  try {
1921
+ const {
1922
+ chain: chain2,
1923
+ account,
1924
+ ...prepareTransactionRequest
1925
+ // @ts-ignore
1926
+ } = await obj.prepareTransactionRequest(transaction);
1916
1927
  const { serializedTransaction } = await window.matchProvider.waitUntilWalletMessage({
1917
1928
  method: "sendTransaction",
1918
1929
  data: {
@@ -1925,7 +1936,8 @@ function useWallet() {
1925
1936
  id: chainId,
1926
1937
  name: _chain?.name,
1927
1938
  nativeCurrency: _chain?.nativeCurrency
1928
- }
1939
+ },
1940
+ prepareTransactionRequest
1929
1941
  }
1930
1942
  });
1931
1943
  openHashPanel();
@@ -1936,12 +1948,10 @@ function useWallet() {
1936
1948
  hash: txHash,
1937
1949
  chain: _chain
1938
1950
  });
1939
- clearTimeout(timer);
1940
1951
  clearInterval(interval);
1941
1952
  resolve(txHash);
1942
1953
  } catch (error) {
1943
1954
  console.error("qwe-sign-error", error);
1944
- clearTimeout(timer);
1945
1955
  clearInterval(interval);
1946
1956
  reject(error);
1947
1957
  }