@huma-finance/widgets 0.0.62-beta.730 → 0.0.62-beta.732
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/cjs/index.cjs +27 -7
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/index.js +28 -8
- package/dist/index.js.map +1 -1
- package/package.json +5 -5
- package/src/components/SolanaTxSendModal.tsx +30 -7
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@huma-finance/widgets",
|
|
3
|
-
"version": "0.0.62-beta.
|
|
3
|
+
"version": "0.0.62-beta.732+1b59475",
|
|
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.
|
|
33
|
-
"@huma-finance/shared": "^0.0.62-beta.
|
|
34
|
-
"@huma-finance/web-shared": "^0.0.62-beta.
|
|
32
|
+
"@huma-finance/sdk": "^0.0.62-beta.732+1b59475",
|
|
33
|
+
"@huma-finance/shared": "^0.0.62-beta.732+1b59475",
|
|
34
|
+
"@huma-finance/web-shared": "^0.0.62-beta.732+1b59475",
|
|
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": "
|
|
204
|
+
"gitHead": "1b59475c9bb81696d415b30c686002b6793dd273"
|
|
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,26 +34,49 @@ export function SolanaTxSendModal({
|
|
|
34
34
|
return
|
|
35
35
|
}
|
|
36
36
|
|
|
37
|
+
let signatureResult = ''
|
|
37
38
|
try {
|
|
39
|
+
// Optimize transaction
|
|
38
40
|
const lockedWritableAccounts = extractWritableAccounts(tx)
|
|
39
41
|
const optimizedTx = await buildOptimalTransactionFromConnection(
|
|
40
42
|
tx,
|
|
41
43
|
lockedWritableAccounts,
|
|
42
44
|
connection,
|
|
43
45
|
)
|
|
44
|
-
|
|
45
|
-
maxRetries: 5,
|
|
46
|
+
signatureResult = await sendTransaction(optimizedTx, connection, {
|
|
46
47
|
preflightCommitment: 'confirmed',
|
|
48
|
+
skipPreflight: true,
|
|
47
49
|
})
|
|
48
|
-
setSignature(
|
|
49
|
-
dispatch(setSolanaSignature(
|
|
50
|
+
setSignature(signatureResult)
|
|
51
|
+
dispatch(setSolanaSignature(signatureResult))
|
|
50
52
|
await connection.confirmTransaction({
|
|
51
53
|
blockhash: optimizedTx.recentBlockhash!,
|
|
52
54
|
lastValidBlockHeight: optimizedTx.lastValidBlockHeight!,
|
|
53
|
-
signature,
|
|
55
|
+
signature: signatureResult,
|
|
54
56
|
})
|
|
55
|
-
handleSuccess({ signature })
|
|
57
|
+
handleSuccess({ signature: signatureResult })
|
|
56
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
|
+
|
|
57
80
|
const err = error as Error
|
|
58
81
|
dispatch(setError({ errorMessage: err?.message || '' }))
|
|
59
82
|
}
|