@exodus/sui-api 1.2.2 → 1.2.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 +9 -0
- package/package.json +2 -2
- package/src/tx-create.js +11 -1
- package/src/tx-send.js +23 -1
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,15 @@
|
|
|
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.2.3](https://github.com/ExodusMovement/assets/compare/@exodus/sui-api@1.2.2...@exodus/sui-api@1.2.3) (2026-08-06)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **sui:** checking status of failed send sui token ([#8437](https://github.com/ExodusMovement/assets/issues/8437)) ([c519e37](https://github.com/ExodusMovement/assets/commit/c519e37869f6e1669223f989d0fe3abc833c3951))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
6
15
|
## [1.2.2](https://github.com/ExodusMovement/assets/compare/@exodus/sui-api@1.2.1...@exodus/sui-api@1.2.2) (2026-06-04)
|
|
7
16
|
|
|
8
17
|
**Note:** Version bump only for package @exodus/sui-api
|
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.2.
|
|
4
|
+
"version": "1.2.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": "52180d93ce2bcafeaf575f9761f9863cc1bf22aa"
|
|
54
54
|
}
|
package/src/tx-create.js
CHANGED
|
@@ -11,9 +11,19 @@ export const createTxFactory = ({
|
|
|
11
11
|
assert(getFeeAsync, 'getFeeAsync is required')
|
|
12
12
|
assert(createUnsignedTx, 'createUnsignedTx is required')
|
|
13
13
|
|
|
14
|
-
return async ({
|
|
14
|
+
return async ({
|
|
15
|
+
asset,
|
|
16
|
+
walletAccount,
|
|
17
|
+
fromAddress,
|
|
18
|
+
address,
|
|
19
|
+
toAddress, // alias for address
|
|
20
|
+
amount,
|
|
21
|
+
gasBudget,
|
|
22
|
+
}) => {
|
|
15
23
|
const { name: assetName } = asset
|
|
16
24
|
|
|
25
|
+
toAddress ??= address
|
|
26
|
+
|
|
17
27
|
if (!fromAddress) {
|
|
18
28
|
fromAddress = await aci.getReceiveAddress({ assetName, walletAccount })
|
|
19
29
|
}
|
package/src/tx-send.js
CHANGED
|
@@ -130,13 +130,35 @@ const getRecipientAddress = ({ balanceChanges, ownerAddress }) => {
|
|
|
130
130
|
return receiverItem?.owner?.AddressOwner
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
+
const stringifyFailureReason = (error) => {
|
|
134
|
+
if (typeof error === 'string') return error
|
|
135
|
+
|
|
136
|
+
try {
|
|
137
|
+
// JSON.stringify returns undefined for undefined/functions and throws on
|
|
138
|
+
// BigInt or circular structures.
|
|
139
|
+
return JSON.stringify(error) ?? 'unknown reason'
|
|
140
|
+
} catch {
|
|
141
|
+
return 'unknown reason'
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
133
145
|
// TODO: extract into separate file
|
|
134
146
|
const getStateChanges = async ({ aci, asset, walletAccount, result }) => {
|
|
135
147
|
const { feeAsset, currency: assetCurrency, name: assetName } = asset
|
|
136
148
|
const { objectChanges, balanceChanges, digest, effects } = result
|
|
137
|
-
const { gasUsed } = effects
|
|
149
|
+
const { gasUsed, status } = effects
|
|
138
150
|
const wasBaseAssetSent = assetName === asset.baseAssetName
|
|
139
151
|
|
|
152
|
+
// A failed on-chain tx mutates only the gas coin, so the state derivation below would
|
|
153
|
+
// throw the generic 'In-decidable state change' (which Hermes surfaces in Sentry with no
|
|
154
|
+
// message at all for async rejections). Surface the on-chain failure reason instead
|
|
155
|
+
// (EXODUS-MOBILE-1AS).
|
|
156
|
+
if (status?.status === 'failure') {
|
|
157
|
+
throw new Error(`Transaction reverted: ${stringifyFailureReason(status.error)}`, {
|
|
158
|
+
cause: status.error,
|
|
159
|
+
})
|
|
160
|
+
}
|
|
161
|
+
|
|
140
162
|
const fee = getFeeAmount({ gasUsed, feeAsset })
|
|
141
163
|
const ownerAddress = await aci.getReceiveAddress({ assetName, walletAccount })
|
|
142
164
|
|