@ledgerhq/live-common 34.54.0-nightly.20251204023901 → 34.54.0-nightly.20251205023918
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/lib/bridge/generic-alpaca/broadcast.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/broadcast.js +3 -3
- package/lib/bridge/generic-alpaca/broadcast.js.map +1 -1
- package/lib/bridge/generic-alpaca/currencyBridge.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/currencyBridge.js +1 -3
- package/lib/bridge/generic-alpaca/currencyBridge.js.map +1 -1
- package/lib/bridge/generic-alpaca/estimateMaxSpendable.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/estimateMaxSpendable.js +2 -1
- package/lib/bridge/generic-alpaca/estimateMaxSpendable.js.map +1 -1
- package/lib/bridge/generic-alpaca/getAccountShape.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/getAccountShape.js +16 -7
- package/lib/bridge/generic-alpaca/getAccountShape.js.map +1 -1
- package/lib/bridge/generic-alpaca/getTransactionStatus.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/getTransactionStatus.js +16 -1
- package/lib/bridge/generic-alpaca/getTransactionStatus.js.map +1 -1
- package/lib/bridge/generic-alpaca/prepareTransaction.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/prepareTransaction.js +38 -4
- package/lib/bridge/generic-alpaca/prepareTransaction.js.map +1 -1
- package/lib/bridge/generic-alpaca/signOperation.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/signOperation.js +18 -2
- package/lib/bridge/generic-alpaca/signOperation.js.map +1 -1
- package/lib/bridge/generic-alpaca/signer/Eth.d.ts +2 -0
- package/lib/bridge/generic-alpaca/signer/Eth.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/signer/Eth.js +8 -1
- package/lib/bridge/generic-alpaca/signer/Eth.js.map +1 -1
- package/lib/bridge/generic-alpaca/signer/index.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/signer/index.js +7 -0
- package/lib/bridge/generic-alpaca/signer/index.js.map +1 -1
- package/lib/bridge/generic-alpaca/types.d.ts +4 -0
- package/lib/bridge/generic-alpaca/types.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/utils.d.ts.map +1 -1
- package/lib/bridge/generic-alpaca/utils.js +11 -3
- package/lib/bridge/generic-alpaca/utils.js.map +1 -1
- package/lib/bridge/impl.d.ts.map +1 -1
- package/lib/bridge/impl.js +14 -3
- package/lib/bridge/impl.js.map +1 -1
- package/lib/e2e/index.d.ts +7 -0
- package/lib/e2e/index.d.ts.map +1 -1
- package/lib/env.react.d.ts +1 -1
- package/lib/env.react.d.ts.map +1 -1
- package/lib/families/canton/config.d.ts.map +1 -1
- package/lib/families/canton/config.js +4 -4
- package/lib/families/canton/config.js.map +1 -1
- package/lib/families/celo/setup.d.ts.map +1 -1
- package/lib/families/celo/setup.js +11 -0
- package/lib/families/celo/setup.js.map +1 -1
- package/lib/families/evm/bridge/mock.d.ts +1 -0
- package/lib/families/evm/bridge/mock.d.ts.map +1 -1
- package/lib/families/evm/bridge/mock.js +12 -0
- package/lib/families/evm/bridge/mock.js.map +1 -1
- package/lib/families/evm/setup.d.ts +1 -4
- package/lib/families/evm/setup.d.ts.map +1 -1
- package/lib/families/evm/setup.js +1 -8
- package/lib/families/evm/setup.js.map +1 -1
- package/lib/families/evm/walletApiAdapter.d.ts +7 -0
- package/lib/families/evm/walletApiAdapter.d.ts.map +1 -1
- package/lib/families/evm/walletApiAdapter.js +36 -2
- package/lib/families/evm/walletApiAdapter.js.map +1 -1
- package/lib/families/hedera/react.d.ts +6 -0
- package/lib/families/hedera/react.d.ts.map +1 -0
- package/lib/families/hedera/react.js +50 -0
- package/lib/families/hedera/react.js.map +1 -0
- package/lib/families/stacks/constants.d.ts +1 -1
- package/lib/families/stacks/constants.d.ts.map +1 -1
- package/lib/families/stacks/constants.js +1 -1
- package/lib/families/stacks/constants.js.map +1 -1
- package/lib/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib/featureFlags/defaultFeatures.js +1 -0
- package/lib/featureFlags/defaultFeatures.js.map +1 -1
- package/lib/featureFlags/useFeature.d.ts +1 -1
- package/lib/featureFlags/useFeature.d.ts.map +1 -1
- package/lib/generated/bridge/js.d.ts +0 -1
- package/lib/generated/bridge/js.d.ts.map +1 -1
- package/lib/generated/bridge/js.js +30 -32
- package/lib/generated/bridge/js.js.map +1 -1
- package/lib/generated/bridge/mock.d.ts +1 -0
- package/lib/generated/bridge/mock.d.ts.map +1 -1
- package/lib/operation.d.ts.map +1 -1
- package/lib/operation.js +7 -2
- package/lib/operation.js.map +1 -1
- package/lib/wallet-api/constants.d.ts +1 -1
- package/lib-es/bridge/generic-alpaca/broadcast.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/broadcast.js +3 -3
- package/lib-es/bridge/generic-alpaca/broadcast.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/currencyBridge.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/currencyBridge.js +1 -3
- package/lib-es/bridge/generic-alpaca/currencyBridge.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/estimateMaxSpendable.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/estimateMaxSpendable.js +2 -1
- package/lib-es/bridge/generic-alpaca/estimateMaxSpendable.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/getAccountShape.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/getAccountShape.js +16 -7
- package/lib-es/bridge/generic-alpaca/getAccountShape.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/getTransactionStatus.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/getTransactionStatus.js +16 -1
- package/lib-es/bridge/generic-alpaca/getTransactionStatus.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/prepareTransaction.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/prepareTransaction.js +38 -4
- package/lib-es/bridge/generic-alpaca/prepareTransaction.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/signOperation.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/signOperation.js +18 -2
- package/lib-es/bridge/generic-alpaca/signOperation.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/signer/Eth.d.ts +2 -0
- package/lib-es/bridge/generic-alpaca/signer/Eth.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/signer/Eth.js +4 -0
- package/lib-es/bridge/generic-alpaca/signer/Eth.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/signer/index.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/signer/index.js +7 -0
- package/lib-es/bridge/generic-alpaca/signer/index.js.map +1 -1
- package/lib-es/bridge/generic-alpaca/types.d.ts +4 -0
- package/lib-es/bridge/generic-alpaca/types.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/utils.d.ts.map +1 -1
- package/lib-es/bridge/generic-alpaca/utils.js +11 -3
- package/lib-es/bridge/generic-alpaca/utils.js.map +1 -1
- package/lib-es/bridge/impl.d.ts.map +1 -1
- package/lib-es/bridge/impl.js +14 -3
- package/lib-es/bridge/impl.js.map +1 -1
- package/lib-es/e2e/index.d.ts +7 -0
- package/lib-es/e2e/index.d.ts.map +1 -1
- package/lib-es/env.react.d.ts +1 -1
- package/lib-es/env.react.d.ts.map +1 -1
- package/lib-es/families/canton/config.d.ts.map +1 -1
- package/lib-es/families/canton/config.js +4 -4
- package/lib-es/families/canton/config.js.map +1 -1
- package/lib-es/families/celo/setup.d.ts.map +1 -1
- package/lib-es/families/celo/setup.js +11 -0
- package/lib-es/families/celo/setup.js.map +1 -1
- package/lib-es/families/evm/bridge/mock.d.ts +1 -0
- package/lib-es/families/evm/bridge/mock.d.ts.map +1 -1
- package/lib-es/families/evm/bridge/mock.js +12 -0
- package/lib-es/families/evm/bridge/mock.js.map +1 -1
- package/lib-es/families/evm/setup.d.ts +1 -4
- package/lib-es/families/evm/setup.d.ts.map +1 -1
- package/lib-es/families/evm/setup.js +2 -8
- package/lib-es/families/evm/setup.js.map +1 -1
- package/lib-es/families/evm/walletApiAdapter.d.ts +7 -0
- package/lib-es/families/evm/walletApiAdapter.d.ts.map +1 -1
- package/lib-es/families/evm/walletApiAdapter.js +30 -1
- package/lib-es/families/evm/walletApiAdapter.js.map +1 -1
- package/lib-es/families/hedera/react.d.ts +6 -0
- package/lib-es/families/hedera/react.d.ts.map +1 -0
- package/lib-es/families/hedera/react.js +41 -0
- package/lib-es/families/hedera/react.js.map +1 -0
- package/lib-es/families/stacks/constants.d.ts +1 -1
- package/lib-es/families/stacks/constants.d.ts.map +1 -1
- package/lib-es/families/stacks/constants.js +1 -1
- package/lib-es/families/stacks/constants.js.map +1 -1
- package/lib-es/featureFlags/defaultFeatures.d.ts.map +1 -1
- package/lib-es/featureFlags/defaultFeatures.js +1 -0
- package/lib-es/featureFlags/defaultFeatures.js.map +1 -1
- package/lib-es/featureFlags/useFeature.d.ts +1 -1
- package/lib-es/featureFlags/useFeature.d.ts.map +1 -1
- package/lib-es/generated/bridge/js.d.ts +0 -1
- package/lib-es/generated/bridge/js.d.ts.map +1 -1
- package/lib-es/generated/bridge/js.js +0 -2
- package/lib-es/generated/bridge/js.js.map +1 -1
- package/lib-es/generated/bridge/mock.d.ts +1 -0
- package/lib-es/generated/bridge/mock.d.ts.map +1 -1
- package/lib-es/operation.d.ts.map +1 -1
- package/lib-es/operation.js +7 -2
- package/lib-es/operation.js.map +1 -1
- package/lib-es/wallet-api/constants.d.ts +1 -1
- package/package.json +55 -55
- package/src/bridge/generic-alpaca/broadcast.ts +6 -3
- package/src/bridge/generic-alpaca/currencyBridge.ts +1 -3
- package/src/bridge/generic-alpaca/estimateMaxSpendable.ts +2 -1
- package/src/bridge/generic-alpaca/getAccountShape.ts +24 -12
- package/src/bridge/generic-alpaca/getTransactionStatus.ts +16 -1
- package/src/bridge/generic-alpaca/prepareTransaction.ts +44 -10
- package/src/bridge/generic-alpaca/signOperation.ts +18 -2
- package/src/bridge/generic-alpaca/signer/Eth.ts +5 -1
- package/src/bridge/generic-alpaca/signer/index.ts +7 -0
- package/src/bridge/generic-alpaca/tests/getAccountShape.test.ts +2 -2
- package/src/bridge/generic-alpaca/tests/prepareTransaction.test.ts +32 -0
- package/src/bridge/generic-alpaca/types.ts +4 -0
- package/src/bridge/generic-alpaca/utils.test.ts +1 -0
- package/src/bridge/generic-alpaca/utils.ts +14 -3
- package/src/bridge/impl.ts +16 -3
- package/src/families/canton/config.ts +5 -4
- package/src/families/celo/setup.ts +12 -0
- package/src/families/evm/bridge/mock.ts +14 -0
- package/src/families/evm/setup.ts +3 -22
- package/src/families/evm/walletApiAdapter.ts +33 -1
- package/src/families/hedera/__snapshots__/bridge.integration.test.ts.snap +229 -14
- package/src/families/hedera/react.test.ts +272 -0
- package/src/families/hedera/react.ts +63 -0
- package/src/families/stacks/__snapshots__/bridge.integration.test.ts.snap +1537 -18
- package/src/families/stacks/__tests__/sync.integration.test.ts +2 -2
- package/src/families/stacks/constants.ts +1 -1
- package/src/families/stellar/__snapshots__/bridge.integration.test.ts.snap +9 -9
- package/src/featureFlags/defaultFeatures.ts +1 -0
- package/src/generated/bridge/js.ts +0 -2
- package/src/operation.ts +10 -2
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ledgerhq/live-common",
|
|
3
3
|
"description": "Common ground for the Ledger Live apps",
|
|
4
|
-
"version": "34.54.0-nightly.
|
|
4
|
+
"version": "34.54.0-nightly.20251205023918",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/LedgerHQ/ledger-live.git"
|
|
@@ -176,78 +176,78 @@
|
|
|
176
176
|
"xstate": "^5.19.2",
|
|
177
177
|
"yargs": "^17.0.0",
|
|
178
178
|
"zod": "^3.22.4",
|
|
179
|
-
"@ledgerhq/coin-algorand": "^0.14.0-nightly.
|
|
180
|
-
"@ledgerhq/coin-aptos": "^3.6.1-nightly.
|
|
181
|
-
"@ledgerhq/coin-
|
|
182
|
-
"@ledgerhq/coin-cardano": "^0.15.1-nightly.
|
|
183
|
-
"@ledgerhq/coin-
|
|
184
|
-
"@ledgerhq/coin-
|
|
185
|
-
"@ledgerhq/coin-celo": "^1.7.2-nightly.
|
|
186
|
-
"@ledgerhq/coin-cosmos": "^0.21.0-nightly.
|
|
187
|
-
"@ledgerhq/coin-evm": "^2.36.0-nightly.
|
|
188
|
-
"@ledgerhq/coin-filecoin": "^1.15.0-nightly.
|
|
189
|
-
"@ledgerhq/coin-framework": "^6.10.0-nightly.
|
|
190
|
-
"@ledgerhq/coin-hedera": "^1.15.0-nightly.
|
|
191
|
-
"@ledgerhq/coin-icon": "^0.15.1-nightly.
|
|
192
|
-
"@ledgerhq/coin-internet_computer": "^1.11.1-nightly.
|
|
193
|
-
"@ledgerhq/coin-kaspa": "^1.4.2-nightly.
|
|
194
|
-
"@ledgerhq/coin-mina": "^1.4.2-nightly.
|
|
195
|
-
"@ledgerhq/coin-multiversx": "^0.8.1-nightly.
|
|
196
|
-
"@ledgerhq/coin-near": "^0.16.1-nightly.
|
|
197
|
-
"@ledgerhq/coin-polkadot": "^6.14.0-nightly.
|
|
198
|
-
"@ledgerhq/coin-solana": "^0.38.0-nightly.
|
|
199
|
-
"@ledgerhq/coin-stacks": "^0.
|
|
200
|
-
"@ledgerhq/coin-stellar": "^6.8.0-nightly.
|
|
201
|
-
"@ledgerhq/coin-sui": "^0.18.1-nightly.
|
|
202
|
-
"@ledgerhq/coin-tezos": "^6.10.0-nightly.
|
|
203
|
-
"@ledgerhq/coin-ton": "^0.17.1-nightly.
|
|
204
|
-
"@ledgerhq/coin-
|
|
205
|
-
"@ledgerhq/coin-xrp": "^7.9.0-nightly.
|
|
206
|
-
"@ledgerhq/cryptoassets": "^13.34.0-nightly.
|
|
207
|
-
"@ledgerhq/
|
|
179
|
+
"@ledgerhq/coin-algorand": "^0.14.0-nightly.20251205023918",
|
|
180
|
+
"@ledgerhq/coin-aptos": "^3.6.1-nightly.20251205023918",
|
|
181
|
+
"@ledgerhq/coin-canton": "^0.11.0-nightly.20251205023918",
|
|
182
|
+
"@ledgerhq/coin-cardano": "^0.15.1-nightly.20251205023918",
|
|
183
|
+
"@ledgerhq/coin-casper": "^2.4.1-nightly.20251205023918",
|
|
184
|
+
"@ledgerhq/coin-bitcoin": "^0.26.0-nightly.20251205023918",
|
|
185
|
+
"@ledgerhq/coin-celo": "^1.7.2-nightly.20251205023918",
|
|
186
|
+
"@ledgerhq/coin-cosmos": "^0.21.0-nightly.20251205023918",
|
|
187
|
+
"@ledgerhq/coin-evm": "^2.36.0-nightly.20251205023918",
|
|
188
|
+
"@ledgerhq/coin-filecoin": "^1.15.0-nightly.20251205023918",
|
|
189
|
+
"@ledgerhq/coin-framework": "^6.10.0-nightly.20251205023918",
|
|
190
|
+
"@ledgerhq/coin-hedera": "^1.15.0-nightly.20251205023918",
|
|
191
|
+
"@ledgerhq/coin-icon": "^0.15.1-nightly.20251205023918",
|
|
192
|
+
"@ledgerhq/coin-internet_computer": "^1.11.1-nightly.20251205023918",
|
|
193
|
+
"@ledgerhq/coin-kaspa": "^1.4.2-nightly.20251205023918",
|
|
194
|
+
"@ledgerhq/coin-mina": "^1.4.2-nightly.20251205023918",
|
|
195
|
+
"@ledgerhq/coin-multiversx": "^0.8.1-nightly.20251205023918",
|
|
196
|
+
"@ledgerhq/coin-near": "^0.16.1-nightly.20251205023918",
|
|
197
|
+
"@ledgerhq/coin-polkadot": "^6.14.0-nightly.20251205023918",
|
|
198
|
+
"@ledgerhq/coin-solana": "^0.38.0-nightly.20251205023918",
|
|
199
|
+
"@ledgerhq/coin-stacks": "^0.13.0-nightly.20251205023918",
|
|
200
|
+
"@ledgerhq/coin-stellar": "^6.8.0-nightly.20251205023918",
|
|
201
|
+
"@ledgerhq/coin-sui": "^0.18.1-nightly.20251205023918",
|
|
202
|
+
"@ledgerhq/coin-tezos": "^6.10.0-nightly.20251205023918",
|
|
203
|
+
"@ledgerhq/coin-ton": "^0.17.1-nightly.20251205023918",
|
|
204
|
+
"@ledgerhq/coin-tron": "^5.7.1-nightly.20251205023918",
|
|
205
|
+
"@ledgerhq/coin-xrp": "^7.9.0-nightly.20251205023918",
|
|
206
|
+
"@ledgerhq/cryptoassets": "^13.34.0-nightly.20251205023918",
|
|
207
|
+
"@ledgerhq/coin-vechain": "^2.12.2-nightly.20251205023918",
|
|
208
|
+
"@ledgerhq/device-core": "^0.6.9-nightly.20251205023918",
|
|
208
209
|
"@ledgerhq/devices": "8.7.0",
|
|
209
|
-
"@ledgerhq/coin-tron": "^5.7.1-nightly.20251204023901",
|
|
210
210
|
"@ledgerhq/errors": "^6.27.0",
|
|
211
|
+
"@ledgerhq/hw-app-algorand": "^6.31.9",
|
|
211
212
|
"@ledgerhq/hw-app-aptos": "^6.34.9",
|
|
212
|
-
"@ledgerhq/hw-app-
|
|
213
|
-
"@ledgerhq/hw-app-
|
|
213
|
+
"@ledgerhq/hw-app-celo": "^6.35.4-nightly.20251205023918",
|
|
214
|
+
"@ledgerhq/hw-app-btc": "^10.12.1-nightly.20251205023918",
|
|
214
215
|
"@ledgerhq/hw-app-cosmos": "^6.32.9",
|
|
215
|
-
"@ledgerhq/hw-app-eth": "^7.0.0-nightly.
|
|
216
|
-
"@ledgerhq/hw-app-exchange": "^0.18.0-nightly.20251204023901",
|
|
216
|
+
"@ledgerhq/hw-app-eth": "^7.0.0-nightly.20251205023918",
|
|
217
217
|
"@ledgerhq/hw-app-hedera": "^1.2.9",
|
|
218
|
-
"@ledgerhq/hw-app-
|
|
218
|
+
"@ledgerhq/hw-app-exchange": "^0.18.0-nightly.20251205023918",
|
|
219
|
+
"@ledgerhq/hw-app-icon": "^1.3.9",
|
|
219
220
|
"@ledgerhq/hw-app-kaspa": "^1.3.2",
|
|
220
221
|
"@ledgerhq/hw-app-multiversx": "^6.26.0",
|
|
221
222
|
"@ledgerhq/hw-app-near": "^6.31.9",
|
|
222
223
|
"@ledgerhq/hw-app-polkadot": "^6.34.9",
|
|
223
224
|
"@ledgerhq/hw-app-str": "^7.2.9",
|
|
224
|
-
"@ledgerhq/hw-app-icon": "^1.3.9",
|
|
225
225
|
"@ledgerhq/hw-app-sui": "^1.4.0",
|
|
226
|
-
"@ledgerhq/hw-app-tezos": "^6.31.9",
|
|
227
226
|
"@ledgerhq/hw-app-trx": "^6.31.9",
|
|
228
|
-
"@ledgerhq/hw-app-
|
|
227
|
+
"@ledgerhq/hw-app-tezos": "^6.31.9",
|
|
228
|
+
"@ledgerhq/hw-app-vet": "^0.8.0-nightly.20251205023918",
|
|
229
229
|
"@ledgerhq/hw-app-xrp": "^6.32.7",
|
|
230
230
|
"@ledgerhq/hw-bolos": "^6.32.9",
|
|
231
231
|
"@ledgerhq/hw-transport": "6.31.13",
|
|
232
232
|
"@ledgerhq/hw-transport-mocker": "^6.29.13",
|
|
233
|
-
"@ledgerhq/ledger-cal-service": "^1.9.1-nightly.
|
|
234
|
-
"@ledgerhq/ledger-trust-service": "^0.4.3-nightly.
|
|
233
|
+
"@ledgerhq/ledger-cal-service": "^1.9.1-nightly.20251205023918",
|
|
234
|
+
"@ledgerhq/ledger-trust-service": "^0.4.3-nightly.20251205023918",
|
|
235
235
|
"@ledgerhq/live-config": "^3.2.0",
|
|
236
|
-
"@ledgerhq/live-countervalues": "^0.
|
|
237
|
-
"@ledgerhq/live-countervalues-react": "^0.7.3-nightly.20251204023901",
|
|
236
|
+
"@ledgerhq/live-countervalues-react": "^0.7.3-nightly.20251205023918",
|
|
238
237
|
"@ledgerhq/live-dmk-shared": "^0.15.0",
|
|
239
|
-
"@ledgerhq/live-
|
|
240
|
-
"@ledgerhq/live-
|
|
238
|
+
"@ledgerhq/live-countervalues": "^0.10.1-nightly.20251205023918",
|
|
239
|
+
"@ledgerhq/live-env": "^2.22.0-nightly.20251205023918",
|
|
240
|
+
"@ledgerhq/live-hooks": "0.2.0",
|
|
241
241
|
"@ledgerhq/live-promise": "^0.1.1",
|
|
242
|
-
"@ledgerhq/live-
|
|
243
|
-
"@ledgerhq/live-signer-evm": "^0.10.2-nightly.
|
|
244
|
-
"@ledgerhq/live-signer-
|
|
245
|
-
"@ledgerhq/live-
|
|
242
|
+
"@ledgerhq/live-network": "^2.1.2-nightly.20251205023918",
|
|
243
|
+
"@ledgerhq/live-signer-evm": "^0.10.2-nightly.20251205023918",
|
|
244
|
+
"@ledgerhq/live-signer-canton": "^0.5.2-nightly.20251205023918",
|
|
245
|
+
"@ledgerhq/live-signer-solana": "^0.6.2-nightly.20251205023918",
|
|
246
|
+
"@ledgerhq/live-wallet": "^0.16.1-nightly.20251205023918",
|
|
246
247
|
"@ledgerhq/logs": "^6.13.0",
|
|
247
|
-
"@ledgerhq/
|
|
248
|
-
"@ledgerhq/
|
|
249
|
-
"@ledgerhq/wallet-api-exchange-module": "^0.19.0-nightly.
|
|
250
|
-
"@ledgerhq/speculos-transport": "^0.3.0-nightly.20251204023901"
|
|
248
|
+
"@ledgerhq/wallet-api-acre-module": "^0.10.0-nightly.20251205023918",
|
|
249
|
+
"@ledgerhq/speculos-transport": "^0.3.0-nightly.20251205023918",
|
|
250
|
+
"@ledgerhq/wallet-api-exchange-module": "^0.19.0-nightly.20251205023918"
|
|
251
251
|
},
|
|
252
252
|
"devDependencies": {
|
|
253
253
|
"@solana/web3.js": "1.95.4",
|
|
@@ -294,10 +294,10 @@
|
|
|
294
294
|
"undici": "6.19.2",
|
|
295
295
|
"uuid": "^8.3.2",
|
|
296
296
|
"ws": "7",
|
|
297
|
-
"@ledgerhq/device-react": "^0.3.3-nightly.
|
|
297
|
+
"@ledgerhq/device-react": "^0.3.3-nightly.20251205023918",
|
|
298
298
|
"@ledgerhq/types-cryptoassets": "^7.30.0",
|
|
299
299
|
"@ledgerhq/types-devices": "^6.27.0",
|
|
300
|
-
"@ledgerhq/types-live": "^6.90.0-nightly.
|
|
300
|
+
"@ledgerhq/types-live": "^6.90.0-nightly.20251205023918"
|
|
301
301
|
},
|
|
302
302
|
"scripts": {
|
|
303
303
|
"build": "zx ./scripts/build-ts.mjs",
|
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { AccountBridge, TransactionCommon } from "@ledgerhq/types-live";
|
|
2
|
-
import { patchOperationWithHash } from "
|
|
2
|
+
import { patchOperationWithHash } from "@ledgerhq/coin-framework/operation";
|
|
3
3
|
import { getAlpacaApi } from "./alpaca";
|
|
4
4
|
|
|
5
5
|
export const genericBroadcast: (network, kind) => AccountBridge<TransactionCommon>["broadcast"] =
|
|
6
6
|
(network, kind) =>
|
|
7
|
-
async ({ signedOperation: { signature, operation }, account }) => {
|
|
8
|
-
const hash = await getAlpacaApi(account.currency.id, kind).broadcast(
|
|
7
|
+
async ({ signedOperation: { signature, operation }, account, broadcastConfig }) => {
|
|
8
|
+
const hash = await getAlpacaApi(account.currency.id, kind).broadcast(
|
|
9
|
+
signature,
|
|
10
|
+
broadcastConfig,
|
|
11
|
+
);
|
|
9
12
|
|
|
10
13
|
return patchOperationWithHash(operation, hash);
|
|
11
14
|
};
|
|
@@ -13,9 +13,7 @@ export function getAlpacaCurrencyBridge(
|
|
|
13
13
|
const signer = customSigner ?? getSigner(network);
|
|
14
14
|
return {
|
|
15
15
|
preload: () => Promise.resolve({}),
|
|
16
|
-
hydrate: () =>
|
|
17
|
-
return;
|
|
18
|
-
},
|
|
16
|
+
hydrate: () => undefined,
|
|
19
17
|
scanAccounts: makeScanAccounts({
|
|
20
18
|
getAccountShape: genericGetAccountShape(network, kind),
|
|
21
19
|
getAddressFn: signer.getAddress.bind(signer),
|
|
@@ -30,11 +30,12 @@ export function genericEstimateMaxSpendable(
|
|
|
30
30
|
)
|
|
31
31
|
).value;
|
|
32
32
|
}
|
|
33
|
+
// TODO Remove the call to `validateIntent` https://ledgerhq.atlassian.net/browse/LIVE-22229
|
|
33
34
|
const { amount } = await alpacaApi.validateIntent(
|
|
34
35
|
transactionToIntent(account, { ...draftTransaction }, alpacaApi.computeIntentType),
|
|
35
36
|
{ value: transaction?.fees ? BigInt(transaction.fees.toString()) : 0n },
|
|
36
37
|
);
|
|
37
|
-
if (["stellar", "tezos"].includes(network)) {
|
|
38
|
+
if (["stellar", "tezos", "evm"].includes(network)) {
|
|
38
39
|
return amount > 0 ? new BigNumber(amount.toString()) : new BigNumber(0);
|
|
39
40
|
}
|
|
40
41
|
const bnFee = BigNumber(fees.toString());
|
|
@@ -17,6 +17,10 @@ function isNftCoreOp(operation: Operation): boolean {
|
|
|
17
17
|
);
|
|
18
18
|
}
|
|
19
19
|
|
|
20
|
+
function isInternalLiveOp(operation: OperationCommon): boolean {
|
|
21
|
+
return !!operation.extra?.internal;
|
|
22
|
+
}
|
|
23
|
+
|
|
20
24
|
export function genericGetAccountShape(network: string, kind: string): GetAccountShape {
|
|
21
25
|
return async (info, syncConfig) => {
|
|
22
26
|
const { address, initialAccount, currency, derivationMode } = info;
|
|
@@ -58,7 +62,7 @@ export function genericGetAccountShape(network: string, kind: string): GetAccoun
|
|
|
58
62
|
|
|
59
63
|
// Calculate minHeight for pagination
|
|
60
64
|
const minHeight = syncFromScratch ? 0 : (oldOps[0]?.blockHeight ?? 0) + 1;
|
|
61
|
-
const paginationParams: Pagination = { minHeight, order: "
|
|
65
|
+
const paginationParams: Pagination = { minHeight, order: "desc" };
|
|
62
66
|
if (lastPagingToken && !syncFromScratch) {
|
|
63
67
|
paginationParams.lastPagingToken = lastPagingToken;
|
|
64
68
|
}
|
|
@@ -74,6 +78,7 @@ export function genericGetAccountShape(network: string, kind: string): GetAccoun
|
|
|
74
78
|
operation?.extra?.assetOwner &&
|
|
75
79
|
!["OPT_IN", "OPT_OUT"].includes(operation.type),
|
|
76
80
|
);
|
|
81
|
+
const newInternalOperations = newOps.filter(isInternalLiveOp);
|
|
77
82
|
const newSubAccounts = await buildSubAccounts({
|
|
78
83
|
accountId,
|
|
79
84
|
allTokenAssetsBalances,
|
|
@@ -85,22 +90,29 @@ export function genericGetAccountShape(network: string, kind: string): GetAccoun
|
|
|
85
90
|
? newSubAccounts
|
|
86
91
|
: mergeSubAccounts(initialAccount?.subAccounts ?? [], newSubAccounts);
|
|
87
92
|
|
|
88
|
-
const newOpsWithSubs = newOps
|
|
89
|
-
|
|
93
|
+
const newOpsWithSubs = newOps
|
|
94
|
+
.filter(operation => !isInternalLiveOp(operation))
|
|
95
|
+
.map(op => {
|
|
96
|
+
const subOperations = inferSubOperations(op.hash, newSubAccounts);
|
|
97
|
+
const internalOperations = newInternalOperations.filter(it => it.hash === op.hash);
|
|
90
98
|
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
99
|
+
return cleanedOperation({
|
|
100
|
+
...op,
|
|
101
|
+
subOperations,
|
|
102
|
+
internalOperations,
|
|
103
|
+
});
|
|
94
104
|
});
|
|
95
|
-
|
|
105
|
+
// Try to refresh known pending operations (if not already updated)
|
|
106
|
+
// Useful for integrations without explorers
|
|
107
|
+
const operationsToRefresh = initialAccount?.pendingOperations.filter(
|
|
108
|
+
pendingOp => !newOpsWithSubs.some(newOp => pendingOp.hash === newOp.hash),
|
|
109
|
+
);
|
|
96
110
|
const confirmedOperations =
|
|
97
|
-
alpacaApi.refreshOperations &&
|
|
98
|
-
? await alpacaApi.refreshOperations(
|
|
111
|
+
alpacaApi.refreshOperations && operationsToRefresh?.length
|
|
112
|
+
? await alpacaApi.refreshOperations(operationsToRefresh)
|
|
99
113
|
: [];
|
|
100
114
|
const newOperations = [...confirmedOperations, ...newOpsWithSubs];
|
|
101
|
-
const operations = syncFromScratch
|
|
102
|
-
? newOperations
|
|
103
|
-
: (mergeOps(oldOps, newOperations) as OperationCommon[]);
|
|
115
|
+
const operations = mergeOps(syncFromScratch ? [] : oldOps, newOperations) as OperationCommon[];
|
|
104
116
|
|
|
105
117
|
const res: Partial<Account> = {
|
|
106
118
|
id: accountId,
|
|
@@ -26,6 +26,7 @@ export function genericGetTransactionStatus(
|
|
|
26
26
|
feesStrategy: transaction.feesStrategy,
|
|
27
27
|
data: transaction.data,
|
|
28
28
|
type: transaction.type,
|
|
29
|
+
sponsored: transaction.sponsored,
|
|
29
30
|
};
|
|
30
31
|
|
|
31
32
|
if (alpacaApi.getChainSpecificRules) {
|
|
@@ -37,10 +38,24 @@ export function genericGetTransactionStatus(
|
|
|
37
38
|
}
|
|
38
39
|
}
|
|
39
40
|
|
|
41
|
+
const fees = BigInt(transaction.fees?.toString() || "0");
|
|
42
|
+
const feesParameters = {
|
|
43
|
+
...(transaction.gasLimit ? { gasLimit: BigInt(transaction.gasLimit.toFixed()) } : {}),
|
|
44
|
+
...(transaction.gasPrice ? { gasPrice: BigInt(transaction.gasPrice.toFixed()) } : {}),
|
|
45
|
+
...(transaction.maxFeePerGas
|
|
46
|
+
? { maxFeePerGas: BigInt(transaction.maxFeePerGas.toFixed()) }
|
|
47
|
+
: {}),
|
|
48
|
+
...(transaction.maxPriorityFeePerGas
|
|
49
|
+
? { maxPriorityFeePerGas: BigInt(transaction.maxPriorityFeePerGas.toFixed()) }
|
|
50
|
+
: {}),
|
|
51
|
+
...(transaction.additionalFees
|
|
52
|
+
? { additionalFees: BigInt(transaction.additionalFees.toFixed()) }
|
|
53
|
+
: {}),
|
|
54
|
+
};
|
|
40
55
|
const { errors, warnings, estimatedFees, amount, totalSpent, totalFees } =
|
|
41
56
|
await alpacaApi.validateIntent(
|
|
42
57
|
transactionToIntent(account, draftTransaction, alpacaApi.computeIntentType),
|
|
43
|
-
{ value:
|
|
58
|
+
{ value: fees, parameters: feesParameters },
|
|
44
59
|
);
|
|
45
60
|
|
|
46
61
|
return {
|
|
@@ -31,6 +31,11 @@ function propagateField(estimation: FeeEstimation, field: string, dest: GenericT
|
|
|
31
31
|
dest[field] = Number(value.toString());
|
|
32
32
|
return;
|
|
33
33
|
case "storageLimit":
|
|
34
|
+
case "gasLimit":
|
|
35
|
+
case "gasPrice":
|
|
36
|
+
case "maxFeePerGas":
|
|
37
|
+
case "maxPriorityFeePerGas":
|
|
38
|
+
case "additionalFees":
|
|
34
39
|
dest[field] = new BigNumber(value.toString());
|
|
35
40
|
return;
|
|
36
41
|
default:
|
|
@@ -51,17 +56,37 @@ export function genericPrepareTransaction(
|
|
|
51
56
|
? await getAssetInfos(transaction, account.freshAddress, getAssetFromToken)
|
|
52
57
|
: assetInfosFallback(transaction);
|
|
53
58
|
const customParametersFees = transaction.customFees?.parameters?.fees;
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Ticking `useAllAmount` constantly resets the amount to 0. This is problematic
|
|
62
|
+
* because some Blockchain need the actual transaction amount to compute the fees
|
|
63
|
+
* (Example with EVM and ERC20 transactions)
|
|
64
|
+
* In case of `useAllAmount` and token transaction, we read the token account spendable
|
|
65
|
+
* balance instead.
|
|
66
|
+
*/
|
|
67
|
+
let amount = transaction.amount;
|
|
68
|
+
if (transaction.useAllAmount && transaction.subAccountId) {
|
|
69
|
+
const subAccount = account.subAccounts?.find(acc => acc.id === transaction.subAccountId);
|
|
70
|
+
amount = subAccount?.spendableBalance ?? amount;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Pass any parameters that help estimating fees
|
|
74
|
+
const intent = transactionToIntent(
|
|
75
|
+
account,
|
|
76
|
+
{
|
|
77
|
+
...transaction,
|
|
78
|
+
amount,
|
|
79
|
+
},
|
|
80
|
+
computeIntentType,
|
|
81
|
+
);
|
|
54
82
|
const estimation: FeeEstimation = customParametersFees
|
|
55
83
|
? { value: BigInt(customParametersFees.toFixed()) }
|
|
56
|
-
: await estimateFees(
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
computeIntentType,
|
|
63
|
-
),
|
|
64
|
-
);
|
|
84
|
+
: await estimateFees(intent, {
|
|
85
|
+
gasPrice: transaction.gasPrice,
|
|
86
|
+
maxFeePerGas: transaction.maxFeePerGas,
|
|
87
|
+
maxPriorityFeePerGas: transaction.maxPriorityFeePerGas,
|
|
88
|
+
gasOptions: transaction.gasOptions,
|
|
89
|
+
});
|
|
65
90
|
const fees = new BigNumber(estimation.value.toString());
|
|
66
91
|
|
|
67
92
|
if (!bnEq(transaction.fees, fees)) {
|
|
@@ -78,7 +103,15 @@ export function genericPrepareTransaction(
|
|
|
78
103
|
};
|
|
79
104
|
|
|
80
105
|
// Propagate needed fields
|
|
81
|
-
const fieldsToPropagate = [
|
|
106
|
+
const fieldsToPropagate = [
|
|
107
|
+
"type",
|
|
108
|
+
"storageLimit",
|
|
109
|
+
"gasLimit",
|
|
110
|
+
"gasPrice",
|
|
111
|
+
"maxFeePerGas",
|
|
112
|
+
"maxPriorityFeePerGas",
|
|
113
|
+
"additionalFees",
|
|
114
|
+
];
|
|
82
115
|
|
|
83
116
|
for (const field of fieldsToPropagate) {
|
|
84
117
|
propagateField(estimation, field, next);
|
|
@@ -86,6 +119,7 @@ export function genericPrepareTransaction(
|
|
|
86
119
|
|
|
87
120
|
// align with stellar/xrp: when send max (or staking intents), reflect validated amount in UI
|
|
88
121
|
if (transaction.useAllAmount || ["stake", "unstake"].includes(transaction.mode ?? "")) {
|
|
122
|
+
// TODO Remove the call to `validateIntent` https://ledgerhq.atlassian.net/browse/LIVE-22228
|
|
89
123
|
const { amount } = await validateIntent(
|
|
90
124
|
transactionToIntent(
|
|
91
125
|
account,
|
|
@@ -86,6 +86,19 @@ export const genericSignOperation =
|
|
|
86
86
|
const alpacaApi = getAlpacaApi(account.currency.id, kind);
|
|
87
87
|
if (!transaction.fees) throw new FeeNotLoaded();
|
|
88
88
|
const fees = BigInt(transaction.fees?.toString() || "0");
|
|
89
|
+
const feesParameters = {
|
|
90
|
+
...(transaction.gasLimit ? { gasLimit: BigInt(transaction.gasLimit.toFixed()) } : {}),
|
|
91
|
+
...(transaction.gasPrice ? { gasPrice: BigInt(transaction.gasPrice.toFixed()) } : {}),
|
|
92
|
+
...(transaction.maxFeePerGas
|
|
93
|
+
? { maxFeePerGas: BigInt(transaction.maxFeePerGas.toFixed()) }
|
|
94
|
+
: {}),
|
|
95
|
+
...(transaction.maxPriorityFeePerGas
|
|
96
|
+
? { maxPriorityFeePerGas: BigInt(transaction.maxPriorityFeePerGas.toFixed()) }
|
|
97
|
+
: {}),
|
|
98
|
+
...(transaction.additionalFees
|
|
99
|
+
? { additionalFees: BigInt(transaction.additionalFees.toFixed()) }
|
|
100
|
+
: {}),
|
|
101
|
+
};
|
|
89
102
|
if (transaction.useAllAmount) {
|
|
90
103
|
const draftTransaction = {
|
|
91
104
|
mode: transaction.mode,
|
|
@@ -98,10 +111,12 @@ export const genericSignOperation =
|
|
|
98
111
|
family: transaction.family,
|
|
99
112
|
feesStrategy: transaction.feesStrategy,
|
|
100
113
|
data: transaction.data,
|
|
114
|
+
type: transaction.type,
|
|
101
115
|
};
|
|
116
|
+
// TODO Remove the call to `validateIntent` https://ledgerhq.atlassian.net/browse/LIVE-22227
|
|
102
117
|
const { amount } = await alpacaApi.validateIntent(
|
|
103
118
|
transactionToIntent(account, draftTransaction, alpacaApi.computeIntentType),
|
|
104
|
-
{ value: fees },
|
|
119
|
+
{ value: fees, parameters: feesParameters },
|
|
105
120
|
);
|
|
106
121
|
transaction.amount = new BigNumber(amount.toString());
|
|
107
122
|
}
|
|
@@ -119,7 +134,7 @@ export const genericSignOperation =
|
|
|
119
134
|
// Enrich with memo and asset information
|
|
120
135
|
transactionIntent = enrichTransactionIntent(transactionIntent, transaction, publicKey);
|
|
121
136
|
|
|
122
|
-
if (typeof transactionIntent.sequence !== "bigint") {
|
|
137
|
+
if (typeof transactionIntent.sequence !== "bigint" || transactionIntent.sequence < 0n) {
|
|
123
138
|
// TODO: should compute it and pass it down to craftTransaction (duplicate call right now)
|
|
124
139
|
const sequenceNumber = await alpacaApi.getSequence(transactionIntent.sender);
|
|
125
140
|
transactionIntent.sequence = sequenceNumber;
|
|
@@ -128,6 +143,7 @@ export const genericSignOperation =
|
|
|
128
143
|
/* Craft unsigned blob via Alpaca */
|
|
129
144
|
const { transaction: unsigned } = await alpacaApi.craftTransaction(transactionIntent, {
|
|
130
145
|
value: fees,
|
|
146
|
+
parameters: feesParameters,
|
|
131
147
|
});
|
|
132
148
|
|
|
133
149
|
/* Notify UI that the device is now showing the tx */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { filter, firstValueFrom } from "rxjs";
|
|
2
2
|
import { EvmAddress, EvmSignature, EvmSigner } from "@ledgerhq/coin-evm/types/signer";
|
|
3
|
-
import { CreateSigner } from "../../setup";
|
|
3
|
+
import { CreateSigner, executeWithSigner } from "../../setup";
|
|
4
4
|
import { DeviceManagementKit } from "@ledgerhq/device-management-kit";
|
|
5
5
|
import { DmkSignerEth, LegacySignerEth } from "@ledgerhq/live-signer-evm";
|
|
6
6
|
import Transport from "@ledgerhq/hw-transport";
|
|
@@ -8,6 +8,7 @@ import { getEnv } from "@ledgerhq/live-env";
|
|
|
8
8
|
import { ResolutionConfig, LoadConfig } from "@ledgerhq/hw-app-eth/lib/services/types";
|
|
9
9
|
import { Signature } from "ethers";
|
|
10
10
|
import type { DomainServiceResolution } from "@ledgerhq/types-live";
|
|
11
|
+
import resolver from "@ledgerhq/coin-evm/hw-getAddress";
|
|
11
12
|
|
|
12
13
|
export type Signer = {
|
|
13
14
|
getAddress: (path: string) => Promise<EvmAddress>;
|
|
@@ -70,3 +71,6 @@ export const createSigner: CreateSigner<Signer> = (transport: Transport) => {
|
|
|
70
71
|
},
|
|
71
72
|
};
|
|
72
73
|
};
|
|
74
|
+
|
|
75
|
+
export const context = executeWithSigner(createSigner);
|
|
76
|
+
export const getAddress = resolver(context);
|
|
@@ -10,6 +10,7 @@ import { AlpacaSigner } from "./types";
|
|
|
10
10
|
import { DerivationType, LedgerSigner as TaquitoLedgerSigner } from "@taquito/ledger-signer";
|
|
11
11
|
import tezosGetAddress from "@ledgerhq/coin-tezos/signer/getAddress";
|
|
12
12
|
import Tezos from "@ledgerhq/hw-app-tezos";
|
|
13
|
+
import { context as evmContext, getAddress as evmGetAddress } from "./Eth";
|
|
13
14
|
|
|
14
15
|
const createSignerXrp: CreateSigner<Xrp> = (transport: Transport) => {
|
|
15
16
|
return new Xrp(transport);
|
|
@@ -97,6 +98,12 @@ export function getSigner(network: string): AlpacaSigner {
|
|
|
97
98
|
context: signerContextTezos,
|
|
98
99
|
};
|
|
99
100
|
}
|
|
101
|
+
case "evm": {
|
|
102
|
+
return {
|
|
103
|
+
getAddress: evmGetAddress,
|
|
104
|
+
context: evmContext,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
100
107
|
}
|
|
101
108
|
throw new Error(`signer for ${network} not implemented`);
|
|
102
109
|
}
|
|
@@ -71,7 +71,7 @@ describe("genericGetAccountShape", () => {
|
|
|
71
71
|
"sync-hash",
|
|
72
72
|
{
|
|
73
73
|
minHeight: 11,
|
|
74
|
-
order: "
|
|
74
|
+
order: "desc",
|
|
75
75
|
lastPagingToken: "pt1",
|
|
76
76
|
},
|
|
77
77
|
[
|
|
@@ -100,7 +100,7 @@ describe("genericGetAccountShape", () => {
|
|
|
100
100
|
"outdated-sync-hash",
|
|
101
101
|
{
|
|
102
102
|
minHeight: 0,
|
|
103
|
-
order: "
|
|
103
|
+
order: "desc",
|
|
104
104
|
},
|
|
105
105
|
[
|
|
106
106
|
{
|
|
@@ -2,6 +2,7 @@ import { genericPrepareTransaction } from "../prepareTransaction";
|
|
|
2
2
|
import { getAlpacaApi } from "../alpaca";
|
|
3
3
|
import { transactionToIntent } from "../utils";
|
|
4
4
|
import BigNumber from "bignumber.js";
|
|
5
|
+
import { GenericTransaction } from "../types";
|
|
5
6
|
|
|
6
7
|
jest.mock("../alpaca", () => ({
|
|
7
8
|
getAlpacaApi: jest.fn(),
|
|
@@ -95,6 +96,11 @@ describe("genericPrepareTransaction", () => {
|
|
|
95
96
|
it.each([
|
|
96
97
|
["type", 2, 2],
|
|
97
98
|
["storageLimit", 300n, new BigNumber(300)],
|
|
99
|
+
["gasLimit", 300n, new BigNumber(300)],
|
|
100
|
+
["gasPrice", 300n, new BigNumber(300)],
|
|
101
|
+
["maxFeePerGas", 300n, new BigNumber(300)],
|
|
102
|
+
["maxPriorityFeePerGas", 300n, new BigNumber(300)],
|
|
103
|
+
["additionalFees", 300n, new BigNumber(300)],
|
|
98
104
|
])(
|
|
99
105
|
"propagates %s from estimation parameters",
|
|
100
106
|
async (parameterName, parameterValue, expectedValue) => {
|
|
@@ -122,4 +128,30 @@ describe("genericPrepareTransaction", () => {
|
|
|
122
128
|
);
|
|
123
129
|
},
|
|
124
130
|
);
|
|
131
|
+
|
|
132
|
+
it("estimates using the token account spendable balance when sending all amount", async () => {
|
|
133
|
+
const estimateFees = jest.fn().mockResolvedValue({ value: new BigNumber(50) });
|
|
134
|
+
(transactionToIntent as jest.Mock).mockImplementation((_, transaction) => ({
|
|
135
|
+
amount: BigInt(transaction.amount.toFixed()),
|
|
136
|
+
}));
|
|
137
|
+
(getAlpacaApi as jest.Mock).mockReturnValue({
|
|
138
|
+
estimateFees,
|
|
139
|
+
validateIntent: intent => Promise.resolve({ amount: intent.amount }),
|
|
140
|
+
});
|
|
141
|
+
const prepareTransaction = genericPrepareTransaction(network, kind);
|
|
142
|
+
|
|
143
|
+
await prepareTransaction(
|
|
144
|
+
{
|
|
145
|
+
...account,
|
|
146
|
+
subAccounts: [{ id: "test-sub-account", spendableBalance: new BigNumber(100) }],
|
|
147
|
+
},
|
|
148
|
+
{
|
|
149
|
+
subAccountId: "test-sub-account",
|
|
150
|
+
useAllAmount: true,
|
|
151
|
+
amount: new BigNumber(0),
|
|
152
|
+
} as GenericTransaction,
|
|
153
|
+
);
|
|
154
|
+
|
|
155
|
+
expect(estimateFees).toHaveBeenCalledWith(expect.objectContaining({ amount: 100n }), {});
|
|
156
|
+
});
|
|
125
157
|
});
|
|
@@ -70,7 +70,9 @@ export type GenericTransaction = TransactionCommon & {
|
|
|
70
70
|
gasPrice?: BigNumber | null;
|
|
71
71
|
maxFeePerGas?: BigNumber | null;
|
|
72
72
|
maxPriorityFeePerGas?: BigNumber | null;
|
|
73
|
+
additionalFees?: BigNumber | null;
|
|
73
74
|
gasOptions?: GasOptions;
|
|
75
|
+
sponsored?: boolean;
|
|
74
76
|
};
|
|
75
77
|
|
|
76
78
|
export type GenericTransactionRaw = TransactionCommonRaw & {
|
|
@@ -104,7 +106,9 @@ export type GenericTransactionRaw = TransactionCommonRaw & {
|
|
|
104
106
|
gasPrice?: string | null;
|
|
105
107
|
maxFeePerGas?: string | null;
|
|
106
108
|
maxPriorityFeePerGas?: string | null;
|
|
109
|
+
additionalFees?: string | null;
|
|
107
110
|
gasOptions?: GasOptionsRaw;
|
|
111
|
+
sponsored?: boolean;
|
|
108
112
|
};
|
|
109
113
|
|
|
110
114
|
export interface OperationCommon extends Operation {
|
|
@@ -72,6 +72,7 @@ export function adaptCoreOperationToLiveOperation(accountId: string, op: CoreOpe
|
|
|
72
72
|
parentRecipients?: string[];
|
|
73
73
|
ledgerOpType?: string | undefined;
|
|
74
74
|
memo?: string | undefined;
|
|
75
|
+
internal?: boolean;
|
|
75
76
|
} = {};
|
|
76
77
|
|
|
77
78
|
if (op.details?.ledgerOpType !== undefined) {
|
|
@@ -106,6 +107,11 @@ export function adaptCoreOperationToLiveOperation(accountId: string, op: CoreOpe
|
|
|
106
107
|
if (op.details?.memo) {
|
|
107
108
|
extra.memo = op.details.memo as string;
|
|
108
109
|
}
|
|
110
|
+
|
|
111
|
+
if (op.details?.internal === true) {
|
|
112
|
+
extra.internal = op.details?.internal;
|
|
113
|
+
}
|
|
114
|
+
|
|
109
115
|
const bnFees = new BigNumber(op.tx.fees.toString());
|
|
110
116
|
const hasFailed = op.tx.failed;
|
|
111
117
|
|
|
@@ -214,6 +220,7 @@ export function transactionToIntent(
|
|
|
214
220
|
transaction.nonce !== null && transaction.nonce !== undefined
|
|
215
221
|
? BigInt(transaction.nonce.toString())
|
|
216
222
|
: undefined,
|
|
223
|
+
sponsored: transaction.sponsored,
|
|
217
224
|
};
|
|
218
225
|
if (transaction.assetReference && transaction.assetOwner) {
|
|
219
226
|
const { subAccountId } = transaction;
|
|
@@ -265,8 +272,11 @@ function toGenericTransactionRaw(transaction: GenericTransaction): GenericTransa
|
|
|
265
272
|
family: transaction.family,
|
|
266
273
|
};
|
|
267
274
|
|
|
268
|
-
|
|
269
|
-
|
|
275
|
+
const booleanFieldsToPropagate = ["useAllAmount", "sponsored"] as const;
|
|
276
|
+
for (const field of booleanFieldsToPropagate) {
|
|
277
|
+
if (field in transaction) {
|
|
278
|
+
raw[field] = transaction[field];
|
|
279
|
+
}
|
|
270
280
|
}
|
|
271
281
|
|
|
272
282
|
const stringFieldsToPropagate = [
|
|
@@ -296,6 +306,7 @@ function toGenericTransactionRaw(transaction: GenericTransaction): GenericTransa
|
|
|
296
306
|
"gasPrice",
|
|
297
307
|
"maxFeePerGas",
|
|
298
308
|
"maxPriorityFeePerGas",
|
|
309
|
+
"additionalFees",
|
|
299
310
|
] as const;
|
|
300
311
|
for (const field of bigNumberFieldsToPropagate) {
|
|
301
312
|
if (field in transaction) {
|
|
@@ -407,7 +418,7 @@ export const buildOptimisticOperation = (
|
|
|
407
418
|
hash: "",
|
|
408
419
|
type,
|
|
409
420
|
value: transaction.useAllAmount ? tokenAccount.balance : transaction.amount,
|
|
410
|
-
fee: new BigNumber(
|
|
421
|
+
fee: new BigNumber(fees.toString()),
|
|
411
422
|
blockHash: null,
|
|
412
423
|
blockHeight: null,
|
|
413
424
|
senders: [account.freshAddress],
|