@huma-finance/widgets 0.0.62-beta.733 → 0.0.62

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@huma-finance/widgets",
3
- "version": "0.0.62-beta.733+de8de46",
3
+ "version": "0.0.62",
4
4
  "publishConfig": {
5
5
  "access": "public"
6
6
  },
@@ -29,9 +29,9 @@
29
29
  "@ethersproject/experimental": "^5.7.0",
30
30
  "@ethersproject/providers": "^5.6.0",
31
31
  "@ethersproject/units": "^5.6.0",
32
- "@huma-finance/sdk": "^0.0.62-beta.733+de8de46",
33
- "@huma-finance/shared": "^0.0.62-beta.733+de8de46",
34
- "@huma-finance/web-shared": "^0.0.62-beta.733+de8de46",
32
+ "@huma-finance/sdk": "^0.0.62",
33
+ "@huma-finance/shared": "^0.0.62",
34
+ "@huma-finance/web-shared": "^0.0.62",
35
35
  "@mui/x-date-pickers": "^5.0.7",
36
36
  "@notifi-network/notifi-frontend-client": "^1.1.2",
37
37
  "@notifi-network/notifi-react": "^1.1.2",
@@ -201,5 +201,5 @@
201
201
  "optionalDependencies": {
202
202
  "encoding": "^0.1.13"
203
203
  },
204
- "gitHead": "de8de4661888610c93fd7030540536e826e4722e"
204
+ "gitHead": "9934f2b49a61bbc3502079514175513a34936581"
205
205
  }
@@ -1,4 +1,4 @@
1
- import { SolanaChainEnum } from '@huma-finance/shared'
1
+ import { sleep, SolanaChainEnum } from '@huma-finance/shared'
2
2
  import React, { useEffect, useState } from 'react'
3
3
  import {
4
4
  buildOptimalTransactionFromConnection,
@@ -34,6 +34,7 @@ export function SolanaTxSendModal({
34
34
  return
35
35
  }
36
36
 
37
+ let signatureResult = ''
37
38
  try {
38
39
  // Optimize transaction
39
40
  const lockedWritableAccounts = extractWritableAccounts(tx)
@@ -42,20 +43,40 @@ export function SolanaTxSendModal({
42
43
  lockedWritableAccounts,
43
44
  connection,
44
45
  )
45
- const signature = await sendTransaction(optimizedTx, connection, {
46
- maxRetries: 5,
46
+ signatureResult = await sendTransaction(optimizedTx, connection, {
47
47
  preflightCommitment: 'confirmed',
48
48
  skipPreflight: true,
49
49
  })
50
- setSignature(signature)
51
- dispatch(setSolanaSignature(signature))
50
+ setSignature(signatureResult)
51
+ dispatch(setSolanaSignature(signatureResult))
52
52
  await connection.confirmTransaction({
53
53
  blockhash: optimizedTx.recentBlockhash!,
54
54
  lastValidBlockHeight: optimizedTx.lastValidBlockHeight!,
55
- signature,
55
+ signature: signatureResult,
56
56
  })
57
- handleSuccess({ signature })
57
+ handleSuccess({ signature: signatureResult })
58
58
  } catch (error: unknown) {
59
+ let signatureStatusRetries = 0
60
+
61
+ while (signatureStatusRetries < 5) {
62
+ // Attempt to load the signature status using transaction history
63
+ // eslint-disable-next-line no-await-in-loop
64
+ await sleep(1000)
65
+ // eslint-disable-next-line no-await-in-loop
66
+ const result = await connection.getSignatureStatus(signatureResult, {
67
+ searchTransactionHistory: true,
68
+ })
69
+ if (
70
+ result?.value?.confirmationStatus === 'finalized' ||
71
+ result?.value?.confirmationStatus === 'confirmed'
72
+ ) {
73
+ handleSuccess({ signature: signatureResult })
74
+ return
75
+ }
76
+
77
+ signatureStatusRetries += 1
78
+ }
79
+
59
80
  const err = error as Error
60
81
  dispatch(setError({ errorMessage: err?.message || '' }))
61
82
  }