@exodus/sui-api 1.1.1 → 1.1.3
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/CHANGELOG.md +18 -0
- package/package.json +2 -2
- package/src/get-fee-async.js +21 -2
- package/src/tx-send.js +9 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,24 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [1.1.3](https://github.com/ExodusMovement/assets/compare/@exodus/sui-api@1.1.2...@exodus/sui-api@1.1.3) (2025-11-03)
|
|
7
|
+
|
|
8
|
+
**Note:** Version bump only for package @exodus/sui-api
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
## [1.1.2](https://github.com/ExodusMovement/assets/compare/@exodus/sui-api@1.1.1...@exodus/sui-api@1.1.2) (2025-11-02)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
### Bug Fixes
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
* fix: swap sui - gasBudget is wrapped into feeOpts object (#6828)
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
|
|
6
24
|
## [1.1.1](https://github.com/ExodusMovement/assets/compare/@exodus/sui-api@1.1.0...@exodus/sui-api@1.1.1) (2025-10-17)
|
|
7
25
|
|
|
8
26
|
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@exodus/sui-api",
|
|
3
3
|
"packageManager": "yarn@4.3.1",
|
|
4
|
-
"version": "1.1.
|
|
4
|
+
"version": "1.1.3",
|
|
5
5
|
"description": "Transaction monitors, RPC with the blockchain node, and other networking code for Sui",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"main": "src/index.js",
|
|
@@ -50,5 +50,5 @@
|
|
|
50
50
|
"type": "git",
|
|
51
51
|
"url": "git+https://github.com/ExodusMovement/assets.git"
|
|
52
52
|
},
|
|
53
|
-
"gitHead": "
|
|
53
|
+
"gitHead": "1792bda2b5f11b36e67d2e36669341b51002197f"
|
|
54
54
|
}
|
package/src/get-fee-async.js
CHANGED
|
@@ -40,17 +40,36 @@ export const getFeeAsyncFactory = ({ assetClientInterface, serverApi, createUnsi
|
|
|
40
40
|
'Invalid simulation result'
|
|
41
41
|
)
|
|
42
42
|
|
|
43
|
-
|
|
43
|
+
const fee = getFeeAmount({
|
|
44
44
|
feeAsset,
|
|
45
45
|
gasUsed,
|
|
46
46
|
})
|
|
47
47
|
|
|
48
|
+
const baseAssetAccountState = await assetClientInterface.getAccountState({
|
|
49
|
+
assetName: asset.baseAsset.name,
|
|
50
|
+
walletAccount,
|
|
51
|
+
})
|
|
52
|
+
|
|
48
53
|
const gasBudget = getGasBudget({ gasUsed, feeAsset })
|
|
49
54
|
|
|
55
|
+
const balance = baseAssetAccountState.utxos.value
|
|
56
|
+
|
|
50
57
|
if (fee.lt(asset.feeAsset.currency.baseUnit(MIN_GAS_BUDGET))) {
|
|
51
58
|
// sometimes we can receive a negative fee because of storage rebate
|
|
52
59
|
// so we use the gas budget instead
|
|
53
|
-
|
|
60
|
+
|
|
61
|
+
return {
|
|
62
|
+
fee: gasBudget,
|
|
63
|
+
gasBudget: gasBudget.toNumber(),
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if (gasBudget.gt(balance)) {
|
|
68
|
+
// if the gas budget is greater than balance, allow to try to send with fee
|
|
69
|
+
return {
|
|
70
|
+
fee,
|
|
71
|
+
gasBudget: fee.toNumber(),
|
|
72
|
+
}
|
|
54
73
|
}
|
|
55
74
|
|
|
56
75
|
return {
|
package/src/tx-send.js
CHANGED
|
@@ -216,7 +216,14 @@ const updateAccountStateAfterSend = async ({
|
|
|
216
216
|
export const txSendFactory = ({ assetClientInterface: aci, serverApi, createUnsignedTx }) => {
|
|
217
217
|
assert(aci, 'assetClientInterface is required')
|
|
218
218
|
|
|
219
|
-
return async ({
|
|
219
|
+
return async ({
|
|
220
|
+
asset,
|
|
221
|
+
walletAccount,
|
|
222
|
+
address: recipientAddress,
|
|
223
|
+
amount,
|
|
224
|
+
gasBudget,
|
|
225
|
+
feeOpts,
|
|
226
|
+
}) => {
|
|
220
227
|
const { name: assetName } = asset
|
|
221
228
|
|
|
222
229
|
const senderAddress = await aci.getReceiveAddress({ assetName, walletAccount })
|
|
@@ -227,7 +234,7 @@ export const txSendFactory = ({ assetClientInterface: aci, serverApi, createUnsi
|
|
|
227
234
|
recipientAddress,
|
|
228
235
|
amount: amount.toBaseString(),
|
|
229
236
|
serverApi,
|
|
230
|
-
gasBudget,
|
|
237
|
+
gasBudget: gasBudget || feeOpts.gasBudget,
|
|
231
238
|
walletAccount,
|
|
232
239
|
})
|
|
233
240
|
|