@huma-finance/widgets 0.0.62-beta.720 → 0.0.62-beta.722
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 +20 -9
- package/dist/cjs/index.cjs.map +1 -1
- package/dist/index.js +20 -9
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
- package/src/components/SolanaTxSendModal.tsx +21 -8
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.722+4b0a7f4",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"@ethersproject/units": "^5.6.0",
|
|
32
32
|
"@huma-finance/sdk": "^0.0.61",
|
|
33
33
|
"@huma-finance/shared": "^0.0.61",
|
|
34
|
-
"@huma-finance/web-shared": "^0.0.
|
|
34
|
+
"@huma-finance/web-shared": "^0.0.61",
|
|
35
35
|
"@mui/icons-material": "^5.3.0",
|
|
36
36
|
"@mui/material": "^5.0.6",
|
|
37
37
|
"@mui/styles": "^5.0.2",
|
|
@@ -203,5 +203,5 @@
|
|
|
203
203
|
"optionalDependencies": {
|
|
204
204
|
"encoding": "^0.1.13"
|
|
205
205
|
},
|
|
206
|
-
"gitHead": "
|
|
206
|
+
"gitHead": "4b0a7f4e2f447b4b105f2a9200226921b2b085cb"
|
|
207
207
|
}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
/* eslint-disable no-await-in-loop */
|
|
2
|
+
import { SolanaChainEnum, timeUtil } from '@huma-finance/shared'
|
|
2
3
|
import React, { useEffect, useState } from 'react'
|
|
3
4
|
|
|
4
5
|
import { useConnection, useWallet } from '@solana/wallet-adapter-react'
|
|
@@ -31,17 +32,29 @@ export function SolanaTxSendModal({
|
|
|
31
32
|
}
|
|
32
33
|
|
|
33
34
|
try {
|
|
34
|
-
const latestBlockHash = await connection.getLatestBlockhash()
|
|
35
35
|
const signature = await sendTransaction(tx, connection)
|
|
36
36
|
setSignature(signature)
|
|
37
37
|
dispatch(setSolanaSignature(signature))
|
|
38
38
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
signature
|
|
43
|
-
|
|
44
|
-
|
|
39
|
+
let transactionConfirmed = false
|
|
40
|
+
for (let i = 0; i < 30; i += 1) {
|
|
41
|
+
timeUtil.sleep(1000)
|
|
42
|
+
const result = await connection.getSignatureStatus(signature)
|
|
43
|
+
if (result?.value?.confirmations) {
|
|
44
|
+
transactionConfirmed = true
|
|
45
|
+
break
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
if (transactionConfirmed) {
|
|
50
|
+
handleSuccess({ signature })
|
|
51
|
+
} else {
|
|
52
|
+
dispatch(
|
|
53
|
+
setError({
|
|
54
|
+
errorMessage: 'Transaction failed to confirm in time',
|
|
55
|
+
}),
|
|
56
|
+
)
|
|
57
|
+
}
|
|
45
58
|
} catch (error: unknown) {
|
|
46
59
|
const err = error as Error
|
|
47
60
|
dispatch(setError({ errorMessage: err?.message || '' }))
|