@ledgerhq/coin-xrp 0.2.0-windows-certificate.0 → 0.2.0
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/.turbo/turbo-build.log +1 -1
- package/CHANGELOG.md +44 -8
- package/lib/bridge/js.d.ts +1 -1
- package/lib/createTransaction.d.ts +2 -1
- package/lib/createTransaction.d.ts.map +1 -1
- package/lib/createTransaction.js.map +1 -1
- package/lib/estimateMaxSpendable.js +1 -1
- package/lib/estimateMaxSpendable.js.map +1 -1
- package/lib/getTransactionStatus.d.ts +3 -3
- package/lib/getTransactionStatus.d.ts.map +1 -1
- package/lib/getTransactionStatus.js +4 -4
- package/lib/getTransactionStatus.js.map +1 -1
- package/lib/hw-getAddress.d.ts.map +1 -1
- package/lib/hw-getAddress.js +1 -2
- package/lib/hw-getAddress.js.map +1 -1
- package/lib/prepareTransaction.d.ts +2 -2
- package/lib/prepareTransaction.d.ts.map +1 -1
- package/lib/prepareTransaction.js +6 -6
- package/lib/prepareTransaction.js.map +1 -1
- package/lib-es/bridge/js.d.ts +1 -1
- package/lib-es/createTransaction.d.ts +2 -1
- package/lib-es/createTransaction.d.ts.map +1 -1
- package/lib-es/createTransaction.js.map +1 -1
- package/lib-es/estimateMaxSpendable.js +1 -1
- package/lib-es/estimateMaxSpendable.js.map +1 -1
- package/lib-es/getTransactionStatus.d.ts +3 -3
- package/lib-es/getTransactionStatus.d.ts.map +1 -1
- package/lib-es/getTransactionStatus.js +4 -4
- package/lib-es/getTransactionStatus.js.map +1 -1
- package/lib-es/hw-getAddress.d.ts.map +1 -1
- package/lib-es/hw-getAddress.js +1 -2
- package/lib-es/hw-getAddress.js.map +1 -1
- package/lib-es/prepareTransaction.d.ts +2 -2
- package/lib-es/prepareTransaction.d.ts.map +1 -1
- package/lib-es/prepareTransaction.js +6 -6
- package/lib-es/prepareTransaction.js.map +1 -1
- package/package.json +8 -8
- package/src/createTransaction.ts +2 -1
- package/src/estimateMaxSpendable.ts +1 -1
- package/src/getTransactionStatus.ts +15 -18
- package/src/hw-getAddress.ts +1 -2
- package/src/prepareTransaction.ts +10 -7
- package/tsconfig.json +2 -1
package/.turbo/turbo-build.log
CHANGED
package/CHANGELOG.md
CHANGED
|
@@ -1,17 +1,53 @@
|
|
|
1
1
|
# @ledgerhq/coin-xrp
|
|
2
2
|
|
|
3
|
-
## 0.2.0
|
|
3
|
+
## 0.2.0
|
|
4
4
|
|
|
5
5
|
### Minor Changes
|
|
6
6
|
|
|
7
|
+
- [#6876](https://github.com/LedgerHQ/ledger-live/pull/6876) [`689e6e5`](https://github.com/LedgerHQ/ledger-live/commit/689e6e5a443170b8e6c2b404cc99af2e67d8e8e4) Thanks [@lambertkevin](https://github.com/lambertkevin)! - Update coin implementations to use new account bridge types & implement cleaner architecture
|
|
8
|
+
|
|
9
|
+
- [#6822](https://github.com/LedgerHQ/ledger-live/pull/6822) [`801265b`](https://github.com/LedgerHQ/ledger-live/commit/801265b7ff3ed7ebd0012eb50f70898557a2dd52) Thanks [@lambertkevin](https://github.com/lambertkevin)! - Creation of the `coin-xrp` module, with support for better spendable balance (monitoring base reserve & trustlines), better typing, signer injection & removal of unmaintained libs like `ripple-bs58check`
|
|
10
|
+
|
|
11
|
+
### Patch Changes
|
|
12
|
+
|
|
13
|
+
- Updated dependencies [[`77fa530`](https://github.com/LedgerHQ/ledger-live/commit/77fa530c8626df94fa7f9c0a8b3a99f2efa7cb11), [`6c35cc5`](https://github.com/LedgerHQ/ledger-live/commit/6c35cc564cb050614ee571907f628ecf15ec4584), [`b9f1f71`](https://github.com/LedgerHQ/ledger-live/commit/b9f1f715355752d8c57c24ecd6a6d166b80f689d), [`815ae3d`](https://github.com/LedgerHQ/ledger-live/commit/815ae3dae8027823854ada837df3dc983d09b10f), [`de5de2d`](https://github.com/LedgerHQ/ledger-live/commit/de5de2d273ed6966c82bde2c3a95b98ba594204f), [`83e5690`](https://github.com/LedgerHQ/ledger-live/commit/83e5690429e41ecd1c508b3398904ae747085cf7), [`6eec3f9`](https://github.com/LedgerHQ/ledger-live/commit/6eec3f973ecea36bafc7ebc8b88526399048cdc4), [`4c01029`](https://github.com/LedgerHQ/ledger-live/commit/4c01029b4d4feb32dab2f9e77da1126050d8c1bc), [`326cae0`](https://github.com/LedgerHQ/ledger-live/commit/326cae088cc33795536deb1d868c86e8dbeb6a13), [`6c35cc5`](https://github.com/LedgerHQ/ledger-live/commit/6c35cc564cb050614ee571907f628ecf15ec4584), [`4499990`](https://github.com/LedgerHQ/ledger-live/commit/449999066c58ae5df371dfb92a7230f9b5e90a60), [`a18c28e`](https://github.com/LedgerHQ/ledger-live/commit/a18c28e3f6a6132bd5e53d5b61721084b3aa19e8), [`cec1599`](https://github.com/LedgerHQ/ledger-live/commit/cec1599a41aa1a18a249e34312164bc93b63972f), [`801265b`](https://github.com/LedgerHQ/ledger-live/commit/801265b7ff3ed7ebd0012eb50f70898557a2dd52), [`d5a1300`](https://github.com/LedgerHQ/ledger-live/commit/d5a130034c18c7ac8b1fd3d4c5271423b4f7639d), [`6d44f25`](https://github.com/LedgerHQ/ledger-live/commit/6d44f255c5b2f453c61d0b754807db1f76d7174e), [`f19960f`](https://github.com/LedgerHQ/ledger-live/commit/f19960f2e7104e5bdf332269fa92fda47455e17d), [`3b9c93c`](https://github.com/LedgerHQ/ledger-live/commit/3b9c93c0de8ceff2af96a6ee8e42b8d9c2ab7af0), [`f7e7881`](https://github.com/LedgerHQ/ledger-live/commit/f7e7881a820880143c2b011d6a92b5a36156b2c1), [`2f2b754`](https://github.com/LedgerHQ/ledger-live/commit/2f2b754b1350360ca0d9f761ca6e4a8cbaff141b), [`689e6e5`](https://github.com/LedgerHQ/ledger-live/commit/689e6e5a443170b8e6c2b404cc99af2e67d8e8e4), [`6552679`](https://github.com/LedgerHQ/ledger-live/commit/65526794bb4d1fbc7e286c0e1c0b6d021413fc8c), [`fda6a81`](https://github.com/LedgerHQ/ledger-live/commit/fda6a814544b3a1debceab22f69485911e76cadc), [`689e6e5`](https://github.com/LedgerHQ/ledger-live/commit/689e6e5a443170b8e6c2b404cc99af2e67d8e8e4), [`1a5b277`](https://github.com/LedgerHQ/ledger-live/commit/1a5b2777b7b71aa4c4e353010eeb9e3dab432bca), [`a115d6c`](https://github.com/LedgerHQ/ledger-live/commit/a115d6cd5dcbcc753d02dedb80f5eb1693d1a249), [`a2505de`](https://github.com/LedgerHQ/ledger-live/commit/a2505deb93dd0722981a90e12082ff1dbefc29b1), [`f17a3cb`](https://github.com/LedgerHQ/ledger-live/commit/f17a3cbc16abf7fadf686025a5ca56ec1a1e7bb6), [`60cd799`](https://github.com/LedgerHQ/ledger-live/commit/60cd799e693e3ae0712a5a9e88206b5304bbc214), [`84274a6`](https://github.com/LedgerHQ/ledger-live/commit/84274a6e764a385f707bc811ead7a7e92a02ed6a)]:
|
|
14
|
+
- @ledgerhq/cryptoassets@13.1.0
|
|
15
|
+
- @ledgerhq/types-live@6.48.0
|
|
16
|
+
- @ledgerhq/devices@8.4.0
|
|
17
|
+
- @ledgerhq/errors@6.17.0
|
|
18
|
+
- @ledgerhq/coin-framework@0.14.0
|
|
19
|
+
- @ledgerhq/live-network@1.3.0
|
|
20
|
+
|
|
21
|
+
## 0.2.0-next.2
|
|
22
|
+
|
|
23
|
+
### Patch Changes
|
|
24
|
+
|
|
25
|
+
- Updated dependencies [[`d5a1300`](https://github.com/LedgerHQ/ledger-live/commit/d5a130034c18c7ac8b1fd3d4c5271423b4f7639d)]:
|
|
26
|
+
- @ledgerhq/cryptoassets@13.1.0-next.2
|
|
27
|
+
- @ledgerhq/coin-framework@0.14.0-next.2
|
|
28
|
+
|
|
29
|
+
## 0.2.0-next.1
|
|
30
|
+
|
|
31
|
+
### Patch Changes
|
|
32
|
+
|
|
33
|
+
- Updated dependencies [[`f7e7881`](https://github.com/LedgerHQ/ledger-live/commit/f7e7881a820880143c2b011d6a92b5a36156b2c1)]:
|
|
34
|
+
- @ledgerhq/cryptoassets@13.1.0-next.1
|
|
35
|
+
- @ledgerhq/coin-framework@0.14.0-next.1
|
|
36
|
+
|
|
37
|
+
## 0.2.0-next.0
|
|
38
|
+
|
|
39
|
+
### Minor Changes
|
|
40
|
+
|
|
41
|
+
- [#6876](https://github.com/LedgerHQ/ledger-live/pull/6876) [`689e6e5`](https://github.com/LedgerHQ/ledger-live/commit/689e6e5a443170b8e6c2b404cc99af2e67d8e8e4) Thanks [@lambertkevin](https://github.com/lambertkevin)! - Update coin implementations to use new account bridge types & implement cleaner architecture
|
|
42
|
+
|
|
7
43
|
- [#6822](https://github.com/LedgerHQ/ledger-live/pull/6822) [`801265b`](https://github.com/LedgerHQ/ledger-live/commit/801265b7ff3ed7ebd0012eb50f70898557a2dd52) Thanks [@lambertkevin](https://github.com/lambertkevin)! - Creation of the `coin-xrp` module, with support for better spendable balance (monitoring base reserve & trustlines), better typing, signer injection & removal of unmaintained libs like `ripple-bs58check`
|
|
8
44
|
|
|
9
45
|
### Patch Changes
|
|
10
46
|
|
|
11
|
-
- Updated dependencies [[`77fa530`](https://github.com/LedgerHQ/ledger-live/commit/77fa530c8626df94fa7f9c0a8b3a99f2efa7cb11), [`6c35cc5`](https://github.com/LedgerHQ/ledger-live/commit/6c35cc564cb050614ee571907f628ecf15ec4584), [`b9f1f71`](https://github.com/LedgerHQ/ledger-live/commit/b9f1f715355752d8c57c24ecd6a6d166b80f689d), [`de5de2d`](https://github.com/LedgerHQ/ledger-live/commit/de5de2d273ed6966c82bde2c3a95b98ba594204f), [`83e5690`](https://github.com/LedgerHQ/ledger-live/commit/83e5690429e41ecd1c508b3398904ae747085cf7), [`4c01029`](https://github.com/LedgerHQ/ledger-live/commit/4c01029b4d4feb32dab2f9e77da1126050d8c1bc), [`326cae0`](https://github.com/LedgerHQ/ledger-live/commit/326cae088cc33795536deb1d868c86e8dbeb6a13), [`6c35cc5`](https://github.com/LedgerHQ/ledger-live/commit/6c35cc564cb050614ee571907f628ecf15ec4584), [`4499990`](https://github.com/LedgerHQ/ledger-live/commit/449999066c58ae5df371dfb92a7230f9b5e90a60), [`a18c28e`](https://github.com/LedgerHQ/ledger-live/commit/a18c28e3f6a6132bd5e53d5b61721084b3aa19e8), [`cec1599`](https://github.com/LedgerHQ/ledger-live/commit/cec1599a41aa1a18a249e34312164bc93b63972f), [`801265b`](https://github.com/LedgerHQ/ledger-live/commit/801265b7ff3ed7ebd0012eb50f70898557a2dd52), [`6d44f25`](https://github.com/LedgerHQ/ledger-live/commit/6d44f255c5b2f453c61d0b754807db1f76d7174e), [`f19960f`](https://github.com/LedgerHQ/ledger-live/commit/f19960f2e7104e5bdf332269fa92fda47455e17d), [`6552679`](https://github.com/LedgerHQ/ledger-live/commit/65526794bb4d1fbc7e286c0e1c0b6d021413fc8c), [`fda6a81`](https://github.com/LedgerHQ/ledger-live/commit/fda6a814544b3a1debceab22f69485911e76cadc), [`a115d6c`](https://github.com/LedgerHQ/ledger-live/commit/a115d6cd5dcbcc753d02dedb80f5eb1693d1a249), [`f17a3cb`](https://github.com/LedgerHQ/ledger-live/commit/f17a3cbc16abf7fadf686025a5ca56ec1a1e7bb6), [`60cd799`](https://github.com/LedgerHQ/ledger-live/commit/60cd799e693e3ae0712a5a9e88206b5304bbc214), [`84274a6`](https://github.com/LedgerHQ/ledger-live/commit/84274a6e764a385f707bc811ead7a7e92a02ed6a)]:
|
|
12
|
-
- @ledgerhq/cryptoassets@13.1.0-
|
|
13
|
-
- @ledgerhq/types-live@6.48.0-
|
|
14
|
-
- @ledgerhq/devices@8.4.0-
|
|
15
|
-
- @ledgerhq/errors@6.17.0-
|
|
16
|
-
- @ledgerhq/coin-framework@0.14.0-
|
|
17
|
-
- @ledgerhq/live-network@1.3.0-
|
|
47
|
+
- Updated dependencies [[`77fa530`](https://github.com/LedgerHQ/ledger-live/commit/77fa530c8626df94fa7f9c0a8b3a99f2efa7cb11), [`6c35cc5`](https://github.com/LedgerHQ/ledger-live/commit/6c35cc564cb050614ee571907f628ecf15ec4584), [`b9f1f71`](https://github.com/LedgerHQ/ledger-live/commit/b9f1f715355752d8c57c24ecd6a6d166b80f689d), [`815ae3d`](https://github.com/LedgerHQ/ledger-live/commit/815ae3dae8027823854ada837df3dc983d09b10f), [`de5de2d`](https://github.com/LedgerHQ/ledger-live/commit/de5de2d273ed6966c82bde2c3a95b98ba594204f), [`83e5690`](https://github.com/LedgerHQ/ledger-live/commit/83e5690429e41ecd1c508b3398904ae747085cf7), [`6eec3f9`](https://github.com/LedgerHQ/ledger-live/commit/6eec3f973ecea36bafc7ebc8b88526399048cdc4), [`4c01029`](https://github.com/LedgerHQ/ledger-live/commit/4c01029b4d4feb32dab2f9e77da1126050d8c1bc), [`326cae0`](https://github.com/LedgerHQ/ledger-live/commit/326cae088cc33795536deb1d868c86e8dbeb6a13), [`6c35cc5`](https://github.com/LedgerHQ/ledger-live/commit/6c35cc564cb050614ee571907f628ecf15ec4584), [`4499990`](https://github.com/LedgerHQ/ledger-live/commit/449999066c58ae5df371dfb92a7230f9b5e90a60), [`a18c28e`](https://github.com/LedgerHQ/ledger-live/commit/a18c28e3f6a6132bd5e53d5b61721084b3aa19e8), [`cec1599`](https://github.com/LedgerHQ/ledger-live/commit/cec1599a41aa1a18a249e34312164bc93b63972f), [`801265b`](https://github.com/LedgerHQ/ledger-live/commit/801265b7ff3ed7ebd0012eb50f70898557a2dd52), [`6d44f25`](https://github.com/LedgerHQ/ledger-live/commit/6d44f255c5b2f453c61d0b754807db1f76d7174e), [`f19960f`](https://github.com/LedgerHQ/ledger-live/commit/f19960f2e7104e5bdf332269fa92fda47455e17d), [`3b9c93c`](https://github.com/LedgerHQ/ledger-live/commit/3b9c93c0de8ceff2af96a6ee8e42b8d9c2ab7af0), [`2f2b754`](https://github.com/LedgerHQ/ledger-live/commit/2f2b754b1350360ca0d9f761ca6e4a8cbaff141b), [`689e6e5`](https://github.com/LedgerHQ/ledger-live/commit/689e6e5a443170b8e6c2b404cc99af2e67d8e8e4), [`6552679`](https://github.com/LedgerHQ/ledger-live/commit/65526794bb4d1fbc7e286c0e1c0b6d021413fc8c), [`fda6a81`](https://github.com/LedgerHQ/ledger-live/commit/fda6a814544b3a1debceab22f69485911e76cadc), [`689e6e5`](https://github.com/LedgerHQ/ledger-live/commit/689e6e5a443170b8e6c2b404cc99af2e67d8e8e4), [`1a5b277`](https://github.com/LedgerHQ/ledger-live/commit/1a5b2777b7b71aa4c4e353010eeb9e3dab432bca), [`a115d6c`](https://github.com/LedgerHQ/ledger-live/commit/a115d6cd5dcbcc753d02dedb80f5eb1693d1a249), [`a2505de`](https://github.com/LedgerHQ/ledger-live/commit/a2505deb93dd0722981a90e12082ff1dbefc29b1), [`f17a3cb`](https://github.com/LedgerHQ/ledger-live/commit/f17a3cbc16abf7fadf686025a5ca56ec1a1e7bb6), [`60cd799`](https://github.com/LedgerHQ/ledger-live/commit/60cd799e693e3ae0712a5a9e88206b5304bbc214), [`84274a6`](https://github.com/LedgerHQ/ledger-live/commit/84274a6e764a385f707bc811ead7a7e92a02ed6a)]:
|
|
48
|
+
- @ledgerhq/cryptoassets@13.1.0-next.0
|
|
49
|
+
- @ledgerhq/types-live@6.48.0-next.0
|
|
50
|
+
- @ledgerhq/devices@8.4.0-next.0
|
|
51
|
+
- @ledgerhq/errors@6.17.0-next.0
|
|
52
|
+
- @ledgerhq/coin-framework@0.14.0-next.0
|
|
53
|
+
- @ledgerhq/live-network@1.3.0-next.0
|
package/lib/bridge/js.d.ts
CHANGED
|
@@ -5,6 +5,6 @@ import type { Transaction } from "../types";
|
|
|
5
5
|
import { XrpSigner } from "../signer";
|
|
6
6
|
export declare function createBridges(signerContext: SignerContext<XrpSigner>, coinConfig: () => XrpConfig): {
|
|
7
7
|
currencyBridge: CurrencyBridge;
|
|
8
|
-
accountBridge: AccountBridge<Transaction>;
|
|
8
|
+
accountBridge: AccountBridge<Transaction, import("@ledgerhq/types-live").Account, import("@ledgerhq/types-live").TransactionStatusCommon, import("@ledgerhq/types-live").AccountRaw>;
|
|
9
9
|
};
|
|
10
10
|
//# sourceMappingURL=js.d.ts.map
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { Transaction } from "./types";
|
|
2
|
-
|
|
2
|
+
import { AccountBridge } from "@ledgerhq/types-live";
|
|
3
|
+
export declare const createTransaction: AccountBridge<Transaction>["createTransaction"];
|
|
3
4
|
//# sourceMappingURL=createTransaction.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createTransaction.d.ts","sourceRoot":"","sources":["../src/createTransaction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"createTransaction.d.ts","sourceRoot":"","sources":["../src/createTransaction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,eAAO,MAAM,iBAAiB,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC,mBAAmB,CAQ5E,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createTransaction.js","sourceRoot":"","sources":["../src/createTransaction.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAqC;
|
|
1
|
+
{"version":3,"file":"createTransaction.js","sourceRoot":"","sources":["../src/createTransaction.ts"],"names":[],"mappings":";;;;;;AAAA,gEAAqC;AAI9B,MAAM,iBAAiB,GAAoD,GAAG,EAAE,CAAC,CAAC;IACvF,MAAM,EAAE,KAAK;IACb,MAAM,EAAE,IAAI,sBAAS,CAAC,CAAC,CAAC;IACxB,SAAS,EAAE,EAAE;IACb,GAAG,EAAE,IAAI;IACT,GAAG,EAAE,SAAS;IACd,WAAW,EAAE,IAAI;IACjB,aAAa,EAAE,IAAI;CACpB,CAAC,CAAC;AARU,QAAA,iBAAiB,qBAQ3B"}
|
|
@@ -21,7 +21,7 @@ const prepareTransaction_1 = require("./prepareTransaction");
|
|
|
21
21
|
const createTransaction_1 = require("./createTransaction");
|
|
22
22
|
const estimateMaxSpendable = (_a) => __awaiter(void 0, [_a], void 0, function* ({ account, parentAccount, transaction, }) {
|
|
23
23
|
const mainAccount = (0, index_1.getMainAccount)(account, parentAccount);
|
|
24
|
-
const newTransaction = yield (0, prepareTransaction_1.prepareTransaction)(mainAccount, Object.assign(Object.assign(Object.assign({}, (0, createTransaction_1.createTransaction)()), transaction), { recipient: (transaction === null || transaction === void 0 ? void 0 : transaction.recipient) || (0, abandonseed_1.getAbandonSeedAddress)("ripple"),
|
|
24
|
+
const newTransaction = yield (0, prepareTransaction_1.prepareTransaction)(mainAccount, Object.assign(Object.assign(Object.assign({}, (0, createTransaction_1.createTransaction)(account)), transaction), { recipient: (transaction === null || transaction === void 0 ? void 0 : transaction.recipient) || (0, abandonseed_1.getAbandonSeedAddress)("ripple"),
|
|
25
25
|
// public testing seed abandonx11,about
|
|
26
26
|
amount: new bignumber_js_1.default(0) }));
|
|
27
27
|
const status = yield (0, getTransactionStatus_1.getTransactionStatus)(mainAccount, newTransaction);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"estimateMaxSpendable.js","sourceRoot":"","sources":["../src/estimateMaxSpendable.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gEAAqC;AAErC,kEAAwE;AACxE,oEAA2E;AAC3E,iEAA8D;AAC9D,6DAA0D;AAC1D,2DAAwD;AAGjD,MAAM,oBAAoB,GAAuD,KAIrF,EAAE,4CAJ0F,EAC7F,OAAO,EACP,aAAa,EACb,WAAW,GACZ;IACC,MAAM,WAAW,GAAG,IAAA,sBAAc,EAAC,OAAO,EAAE,aAAa,CAAC,CAAC;IAC3D,MAAM,cAAc,GAAG,MAAM,IAAA,uCAAkB,EAAC,WAAW,gDACtD,IAAA,qCAAiB,
|
|
1
|
+
{"version":3,"file":"estimateMaxSpendable.js","sourceRoot":"","sources":["../src/estimateMaxSpendable.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gEAAqC;AAErC,kEAAwE;AACxE,oEAA2E;AAC3E,iEAA8D;AAC9D,6DAA0D;AAC1D,2DAAwD;AAGjD,MAAM,oBAAoB,GAAuD,KAIrF,EAAE,4CAJ0F,EAC7F,OAAO,EACP,aAAa,EACb,WAAW,GACZ;IACC,MAAM,WAAW,GAAG,IAAA,sBAAc,EAAC,OAAO,EAAE,aAAa,CAAC,CAAC;IAC3D,MAAM,cAAc,GAAG,MAAM,IAAA,uCAAkB,EAAC,WAAW,gDACtD,IAAA,qCAAiB,EAAC,OAAO,CAAC,GAC1B,WAAW,KACd,SAAS,EAAE,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,SAAS,KAAI,IAAA,mCAAqB,EAAC,QAAQ,CAAC;QACpE,uCAAuC;QACvC,MAAM,EAAE,IAAI,sBAAS,CAAC,CAAC,CAAC,IACxB,CAAC;IACH,MAAM,MAAM,GAAG,MAAM,IAAA,2CAAoB,EAAC,WAAW,EAAE,cAAc,CAAC,CAAC;IACvE,OAAO,sBAAS,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC;AAChF,CAAC,CAAA,CAAC;AAfW,QAAA,oBAAoB,wBAe/B"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AccountBridge } from "@ledgerhq/types-live";
|
|
2
|
-
import { Transaction } from "./types";
|
|
3
|
-
export declare const getTransactionStatus: AccountBridge<Transaction>["getTransactionStatus"];
|
|
1
|
+
import { Account, AccountBridge } from "@ledgerhq/types-live";
|
|
2
|
+
import { Transaction, TransactionStatus } from "./types";
|
|
3
|
+
export declare const getTransactionStatus: AccountBridge<Transaction, Account, TransactionStatus>["getTransactionStatus"];
|
|
4
4
|
//# sourceMappingURL=getTransactionStatus.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getTransactionStatus.d.ts","sourceRoot":"","sources":["../src/getTransactionStatus.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getTransactionStatus.d.ts","sourceRoot":"","sources":["../src/getTransactionStatus.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE9D,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAIzD,eAAO,MAAM,oBAAoB,EAAE,aAAa,CAC9C,WAAW,EACX,OAAO,EACP,iBAAiB,CAClB,CAAC,sBAAsB,CA8DvB,CAAC"}
|
|
@@ -22,8 +22,8 @@ const logic_1 = require("./logic");
|
|
|
22
22
|
const getTransactionStatus = (account, transaction) => __awaiter(void 0, void 0, void 0, function* () {
|
|
23
23
|
const errors = {};
|
|
24
24
|
const warnings = {};
|
|
25
|
-
const
|
|
26
|
-
const reserveBaseXRP = (0, api_1.parseAPIValue)(
|
|
25
|
+
const serverInfos = yield (0, api_1.getServerInfos)();
|
|
26
|
+
const reserveBaseXRP = (0, api_1.parseAPIValue)(serverInfos.info.validated_ledger.reserve_base_xrp.toString());
|
|
27
27
|
const estimatedFees = new bignumber_js_1.default(transaction.fee || 0);
|
|
28
28
|
const totalSpent = new bignumber_js_1.default(transaction.amount).plus(estimatedFees);
|
|
29
29
|
const amount = new bignumber_js_1.default(transaction.amount);
|
|
@@ -70,13 +70,13 @@ const getTransactionStatus = (account, transaction) => __awaiter(void 0, void 0,
|
|
|
70
70
|
if (!errors.amount && amount.eq(0)) {
|
|
71
71
|
errors.amount = new errors_1.AmountRequired();
|
|
72
72
|
}
|
|
73
|
-
return
|
|
73
|
+
return {
|
|
74
74
|
errors,
|
|
75
75
|
warnings,
|
|
76
76
|
estimatedFees,
|
|
77
77
|
amount,
|
|
78
78
|
totalSpent,
|
|
79
|
-
}
|
|
79
|
+
};
|
|
80
80
|
});
|
|
81
81
|
exports.getTransactionStatus = getTransactionStatus;
|
|
82
82
|
//# sourceMappingURL=getTransactionStatus.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getTransactionStatus.js","sourceRoot":"","sources":["../src/getTransactionStatus.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6CAU0B;AAC1B,gEAAqC;
|
|
1
|
+
{"version":3,"file":"getTransactionStatus.js","sourceRoot":"","sources":["../src/getTransactionStatus.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,6CAU0B;AAC1B,gEAAqC;AACrC,+DAA6D;AAE7D,qEAA+E;AAE/E,+BAAsD;AACtD,mCAA+C;AAExC,MAAM,oBAAoB,GAIL,CAAO,OAAO,EAAE,WAAW,EAAE,EAAE;IACzD,MAAM,MAAM,GAA0B,EAAE,CAAC;IACzC,MAAM,QAAQ,GAA0B,EAAE,CAAC;IAC3C,MAAM,WAAW,GAAG,MAAM,IAAA,oBAAc,GAAE,CAAC;IAC3C,MAAM,cAAc,GAAG,IAAA,mBAAa,EAClC,WAAW,CAAC,IAAI,CAAC,gBAAgB,CAAC,gBAAgB,CAAC,QAAQ,EAAE,CAC9D,CAAC;IACF,MAAM,aAAa,GAAG,IAAI,sBAAS,CAAC,WAAW,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC;IAC1D,MAAM,UAAU,GAAG,IAAI,sBAAS,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC;IACzE,MAAM,MAAM,GAAG,IAAI,sBAAS,CAAC,WAAW,CAAC,MAAM,CAAC,CAAC;IAEjD,IAAI,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,MAAM,CAAC,EAAE,CAAC;QACvD,QAAQ,CAAC,UAAU,GAAG,IAAI,mBAAU,EAAE,CAAC;IACzC,CAAC;IAED,IAAI,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC;QACrB,MAAM,CAAC,GAAG,GAAG,IAAI,qBAAY,EAAE,CAAC;IAClC,CAAC;SAAM,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C;SAAM,IAAI,CAAC,IAAA,4CAAqB,EAAC,WAAW,CAAC,SAAS,CAAC,EAAE,CAAC;QACzD,MAAM,CAAC,SAAS,GAAG,IAAI,uBAAc,CAAC,EAAE,EAAE;YACxC,YAAY,EAAE,OAAO,CAAC,QAAQ,CAAC,IAAI;SACpC,CAAC,CAAC;IACL,CAAC;IAED,IAAI,CAAC,MAAM,CAAC,MAAM,IAAI,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACnC,MAAM,CAAC,MAAM,GAAG,IAAI,uBAAc,EAAE,CAAC;IACvC,CAAC;IAED,OAAO;QACL,MAAM;QACN,QAAQ;QACR,aAAa;QACb,MAAM;QACN,UAAU;KACX,CAAC;AACJ,CAAC,CAAA,CAAC;AAlEW,QAAA,oBAAoB,wBAkE/B"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hw-getAddress.d.ts","sourceRoot":"","sources":["../src/hw-getAddress.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,mDAAmD,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAc,SAAS,EAAE,MAAM,UAAU,CAAC;AAEjD,QAAA,MAAM,QAAQ,kBAAmB,cAAc,SAAS,CAAC,KAAG,
|
|
1
|
+
{"version":3,"file":"hw-getAddress.d.ts","sourceRoot":"","sources":["../src/hw-getAddress.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,mDAAmD,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAc,SAAS,EAAE,MAAM,UAAU,CAAC;AAEjD,QAAA,MAAM,QAAQ,kBAAmB,cAAc,SAAS,CAAC,KAAG,YAY3D,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
package/lib/hw-getAddress.js
CHANGED
|
@@ -11,12 +11,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
const resolver = (signerContext) => {
|
|
13
13
|
return (deviceId_1, _a) => __awaiter(void 0, [deviceId_1, _a], void 0, function* (deviceId, { path, verify }) {
|
|
14
|
-
const { address, publicKey
|
|
14
|
+
const { address, publicKey } = (yield signerContext(deviceId, signer => signer.getAddress(path, verify, false)));
|
|
15
15
|
return {
|
|
16
16
|
path,
|
|
17
17
|
address,
|
|
18
18
|
publicKey,
|
|
19
|
-
chainCode,
|
|
20
19
|
};
|
|
21
20
|
});
|
|
22
21
|
};
|
package/lib/hw-getAddress.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hw-getAddress.js","sourceRoot":"","sources":["../src/hw-getAddress.ts"],"names":[],"mappings":";;;;;;;;;;;AAKA,MAAM,QAAQ,GAAG,CAAC,aAAuC,EAAgB,EAAE;IACzE,OAAO,iBAA8D,EAAE,wDAAzD,QAAgB,EAAE,EAAE,IAAI,EAAE,MAAM,EAAqB;QACjE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"hw-getAddress.js","sourceRoot":"","sources":["../src/hw-getAddress.ts"],"names":[],"mappings":";;;;;;;;;;;AAKA,MAAM,QAAQ,GAAG,CAAC,aAAuC,EAAgB,EAAE;IACzE,OAAO,iBAA8D,EAAE,wDAAzD,QAAgB,EAAE,EAAE,IAAI,EAAE,MAAM,EAAqB;QACjE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,CAAC,MAAM,aAAa,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,CACrE,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,CACvC,CAAe,CAAC;QAEjB,OAAO;YACL,IAAI;YACJ,OAAO;YACP,SAAS;SACV,CAAC;IACJ,CAAC,CAAA,CAAC;AACJ,CAAC,CAAC;AAEF,kBAAe,QAAQ,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AccountBridge } from "@ledgerhq/types-live";
|
|
2
2
|
import { Transaction } from "./types";
|
|
3
|
-
export declare const prepareTransaction:
|
|
3
|
+
export declare const prepareTransaction: AccountBridge<Transaction>["prepareTransaction"];
|
|
4
4
|
//# sourceMappingURL=prepareTransaction.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepareTransaction.d.ts","sourceRoot":"","sources":["../src/prepareTransaction.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"prepareTransaction.d.ts","sourceRoot":"","sources":["../src/prepareTransaction.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,EAAe,WAAW,EAAE,MAAM,SAAS,CAAC;AAanD,eAAO,MAAM,kBAAkB,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC,oBAAoB,CA8B/E,CAAC"}
|
|
@@ -24,8 +24,8 @@ const remapError = (error) => {
|
|
|
24
24
|
}
|
|
25
25
|
return error;
|
|
26
26
|
};
|
|
27
|
-
const prepareTransaction = (
|
|
28
|
-
let networkInfo =
|
|
27
|
+
const prepareTransaction = (account, transaction) => __awaiter(void 0, void 0, void 0, function* () {
|
|
28
|
+
let networkInfo = transaction.networkInfo;
|
|
29
29
|
if (!networkInfo) {
|
|
30
30
|
try {
|
|
31
31
|
const info = yield (0, api_1.getServerInfos)();
|
|
@@ -43,11 +43,11 @@ const prepareTransaction = (a, t) => __awaiter(void 0, void 0, void 0, function*
|
|
|
43
43
|
throw e;
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
|
-
const fee =
|
|
47
|
-
if (
|
|
48
|
-
return Object.assign(Object.assign({},
|
|
46
|
+
const fee = transaction.fee || networkInfo.serverFee;
|
|
47
|
+
if (transaction.networkInfo !== networkInfo || transaction.fee !== fee) {
|
|
48
|
+
return Object.assign(Object.assign({}, transaction), { networkInfo, fee });
|
|
49
49
|
}
|
|
50
|
-
return
|
|
50
|
+
return transaction;
|
|
51
51
|
});
|
|
52
52
|
exports.prepareTransaction = prepareTransaction;
|
|
53
53
|
//# sourceMappingURL=prepareTransaction.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepareTransaction.js","sourceRoot":"","sources":["../src/prepareTransaction.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gEAAqC;AACrC,6CAA+C;AAE/C,+BAAsD;AAGtD,8BAA8B;AAC9B,MAAM,UAAU,GAAG,CAAC,KAAY,EAAE,EAAE;IAClC,MAAM,GAAG,GAAG,KAAK,CAAC,OAAO,CAAC;IAE1B,IAAI,GAAG,CAAC,QAAQ,CAAC,wBAAwB,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,iBAAiB,CAAC,EAAE,CAAC;QAC9E,OAAO,IAAI,oBAAW,EAAE,CAAC;IAC3B,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEK,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"prepareTransaction.js","sourceRoot":"","sources":["../src/prepareTransaction.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,gEAAqC;AACrC,6CAA+C;AAE/C,+BAAsD;AAGtD,8BAA8B;AAC9B,MAAM,UAAU,GAAG,CAAC,KAAY,EAAE,EAAE;IAClC,MAAM,GAAG,GAAG,KAAK,CAAC,OAAO,CAAC;IAE1B,IAAI,GAAG,CAAC,QAAQ,CAAC,wBAAwB,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,iBAAiB,CAAC,EAAE,CAAC;QAC9E,OAAO,IAAI,oBAAW,EAAE,CAAC;IAC3B,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEK,MAAM,kBAAkB,GAAqD,CAClF,OAAO,EACP,WAAW,EACX,EAAE;IACF,IAAI,WAAW,GAAmC,WAAW,CAAC,WAAW,CAAC;IAE1E,IAAI,CAAC,WAAW,EAAE,CAAC;QACjB,IAAI,CAAC;YACH,MAAM,IAAI,GAAG,MAAM,IAAA,oBAAc,GAAE,CAAC;YACpC,MAAM,SAAS,GAAG,IAAA,mBAAa,EAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC,CAAC;YACpF,WAAW,GAAG;gBACZ,MAAM,EAAE,KAAK;gBACb,SAAS;gBACT,WAAW,EAAE,IAAI,sBAAS,CAAC,CAAC,CAAC,EAAE,iCAAiC;aACjE,CAAC;QACJ,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,IAAI,CAAC,YAAY,KAAK,EAAE,CAAC;gBACvB,MAAM,UAAU,CAAC,CAAC,CAAC,CAAC;YACtB,CAAC;YACD,MAAM,CAAC,CAAC;QACV,CAAC;IACH,CAAC;IAED,MAAM,GAAG,GAAG,WAAW,CAAC,GAAG,IAAI,WAAW,CAAC,SAAS,CAAC;IAErD,IAAI,WAAW,CAAC,WAAW,KAAK,WAAW,IAAI,WAAW,CAAC,GAAG,KAAK,GAAG,EAAE,CAAC;QACvE,uCAAY,WAAW,KAAE,WAAW,EAAE,GAAG,IAAG;IAC9C,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC,CAAA,CAAC;AA9BW,QAAA,kBAAkB,sBA8B7B"}
|
package/lib-es/bridge/js.d.ts
CHANGED
|
@@ -5,6 +5,6 @@ import type { Transaction } from "../types";
|
|
|
5
5
|
import { XrpSigner } from "../signer";
|
|
6
6
|
export declare function createBridges(signerContext: SignerContext<XrpSigner>, coinConfig: () => XrpConfig): {
|
|
7
7
|
currencyBridge: CurrencyBridge;
|
|
8
|
-
accountBridge: AccountBridge<Transaction>;
|
|
8
|
+
accountBridge: AccountBridge<Transaction, import("@ledgerhq/types-live").Account, import("@ledgerhq/types-live").TransactionStatusCommon, import("@ledgerhq/types-live").AccountRaw>;
|
|
9
9
|
};
|
|
10
10
|
//# sourceMappingURL=js.d.ts.map
|
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
import { Transaction } from "./types";
|
|
2
|
-
|
|
2
|
+
import { AccountBridge } from "@ledgerhq/types-live";
|
|
3
|
+
export declare const createTransaction: AccountBridge<Transaction>["createTransaction"];
|
|
3
4
|
//# sourceMappingURL=createTransaction.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createTransaction.d.ts","sourceRoot":"","sources":["../src/createTransaction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;
|
|
1
|
+
{"version":3,"file":"createTransaction.d.ts","sourceRoot":"","sources":["../src/createTransaction.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AACtC,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,eAAO,MAAM,iBAAiB,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC,mBAAmB,CAQ5E,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createTransaction.js","sourceRoot":"","sources":["../src/createTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"createTransaction.js","sourceRoot":"","sources":["../src/createTransaction.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,cAAc,CAAC;AAIrC,MAAM,CAAC,MAAM,iBAAiB,GAAoD,GAAG,EAAE,CAAC,CAAC;IACvF,MAAM,EAAE,KAAK;IACb,MAAM,EAAE,IAAI,SAAS,CAAC,CAAC,CAAC;IACxB,SAAS,EAAE,EAAE;IACb,GAAG,EAAE,IAAI;IACT,GAAG,EAAE,SAAS;IACd,WAAW,EAAE,IAAI;IACjB,aAAa,EAAE,IAAI;CACpB,CAAC,CAAC"}
|
|
@@ -15,7 +15,7 @@ import { prepareTransaction } from "./prepareTransaction";
|
|
|
15
15
|
import { createTransaction } from "./createTransaction";
|
|
16
16
|
export const estimateMaxSpendable = (_a) => __awaiter(void 0, [_a], void 0, function* ({ account, parentAccount, transaction, }) {
|
|
17
17
|
const mainAccount = getMainAccount(account, parentAccount);
|
|
18
|
-
const newTransaction = yield prepareTransaction(mainAccount, Object.assign(Object.assign(Object.assign({}, createTransaction()), transaction), { recipient: (transaction === null || transaction === void 0 ? void 0 : transaction.recipient) || getAbandonSeedAddress("ripple"),
|
|
18
|
+
const newTransaction = yield prepareTransaction(mainAccount, Object.assign(Object.assign(Object.assign({}, createTransaction(account)), transaction), { recipient: (transaction === null || transaction === void 0 ? void 0 : transaction.recipient) || getAbandonSeedAddress("ripple"),
|
|
19
19
|
// public testing seed abandonx11,about
|
|
20
20
|
amount: new BigNumber(0) }));
|
|
21
21
|
const status = yield getTransactionStatus(mainAccount, newTransaction);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"estimateMaxSpendable.js","sourceRoot":"","sources":["../src/estimateMaxSpendable.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,SAAS,MAAM,cAAc,CAAC;AAErC,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AACxE,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAGxD,MAAM,CAAC,MAAM,oBAAoB,GAAuD,KAIrF,EAAE,4CAJ0F,EAC7F,OAAO,EACP,aAAa,EACb,WAAW,GACZ;IACC,MAAM,WAAW,GAAG,cAAc,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;IAC3D,MAAM,cAAc,GAAG,MAAM,kBAAkB,CAAC,WAAW,gDACtD,iBAAiB,
|
|
1
|
+
{"version":3,"file":"estimateMaxSpendable.js","sourceRoot":"","sources":["../src/estimateMaxSpendable.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,SAAS,MAAM,cAAc,CAAC;AAErC,OAAO,EAAE,cAAc,EAAE,MAAM,wCAAwC,CAAC;AACxE,OAAO,EAAE,qBAAqB,EAAE,MAAM,oCAAoC,CAAC;AAC3E,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC9D,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAGxD,MAAM,CAAC,MAAM,oBAAoB,GAAuD,KAIrF,EAAE,4CAJ0F,EAC7F,OAAO,EACP,aAAa,EACb,WAAW,GACZ;IACC,MAAM,WAAW,GAAG,cAAc,CAAC,OAAO,EAAE,aAAa,CAAC,CAAC;IAC3D,MAAM,cAAc,GAAG,MAAM,kBAAkB,CAAC,WAAW,gDACtD,iBAAiB,CAAC,OAAO,CAAC,GAC1B,WAAW,KACd,SAAS,EAAE,CAAA,WAAW,aAAX,WAAW,uBAAX,WAAW,CAAE,SAAS,KAAI,qBAAqB,CAAC,QAAQ,CAAC;QACpE,uCAAuC;QACvC,MAAM,EAAE,IAAI,SAAS,CAAC,CAAC,CAAC,IACxB,CAAC;IACH,MAAM,MAAM,GAAG,MAAM,oBAAoB,CAAC,WAAW,EAAE,cAAc,CAAC,CAAC;IACvE,OAAO,SAAS,CAAC,GAAG,CAAC,CAAC,EAAE,OAAO,CAAC,gBAAgB,CAAC,KAAK,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC,CAAC;AAChF,CAAC,CAAA,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AccountBridge } from "@ledgerhq/types-live";
|
|
2
|
-
import { Transaction } from "./types";
|
|
3
|
-
export declare const getTransactionStatus: AccountBridge<Transaction>["getTransactionStatus"];
|
|
1
|
+
import { Account, AccountBridge } from "@ledgerhq/types-live";
|
|
2
|
+
import { Transaction, TransactionStatus } from "./types";
|
|
3
|
+
export declare const getTransactionStatus: AccountBridge<Transaction, Account, TransactionStatus>["getTransactionStatus"];
|
|
4
4
|
//# sourceMappingURL=getTransactionStatus.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getTransactionStatus.d.ts","sourceRoot":"","sources":["../src/getTransactionStatus.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"getTransactionStatus.d.ts","sourceRoot":"","sources":["../src/getTransactionStatus.ts"],"names":[],"mappings":"AAaA,OAAO,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAE9D,OAAO,EAAE,WAAW,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAC;AAIzD,eAAO,MAAM,oBAAoB,EAAE,aAAa,CAC9C,WAAW,EACX,OAAO,EACP,iBAAiB,CAClB,CAAC,sBAAsB,CA8DvB,CAAC"}
|
|
@@ -16,8 +16,8 @@ import { cachedRecipientIsNew } from "./logic";
|
|
|
16
16
|
export const getTransactionStatus = (account, transaction) => __awaiter(void 0, void 0, void 0, function* () {
|
|
17
17
|
const errors = {};
|
|
18
18
|
const warnings = {};
|
|
19
|
-
const
|
|
20
|
-
const reserveBaseXRP = parseAPIValue(
|
|
19
|
+
const serverInfos = yield getServerInfos();
|
|
20
|
+
const reserveBaseXRP = parseAPIValue(serverInfos.info.validated_ledger.reserve_base_xrp.toString());
|
|
21
21
|
const estimatedFees = new BigNumber(transaction.fee || 0);
|
|
22
22
|
const totalSpent = new BigNumber(transaction.amount).plus(estimatedFees);
|
|
23
23
|
const amount = new BigNumber(transaction.amount);
|
|
@@ -64,12 +64,12 @@ export const getTransactionStatus = (account, transaction) => __awaiter(void 0,
|
|
|
64
64
|
if (!errors.amount && amount.eq(0)) {
|
|
65
65
|
errors.amount = new AmountRequired();
|
|
66
66
|
}
|
|
67
|
-
return
|
|
67
|
+
return {
|
|
68
68
|
errors,
|
|
69
69
|
warnings,
|
|
70
70
|
estimatedFees,
|
|
71
71
|
amount,
|
|
72
72
|
totalSpent,
|
|
73
|
-
}
|
|
73
|
+
};
|
|
74
74
|
});
|
|
75
75
|
//# sourceMappingURL=getTransactionStatus.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getTransactionStatus.js","sourceRoot":"","sources":["../src/getTransactionStatus.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EACL,cAAc,EACd,YAAY,EACZ,WAAW,EACX,UAAU,EACV,cAAc,EACd,4CAA4C,EAC5C,4CAA4C,EAC5C,yBAAyB,EACzB,iBAAiB,GAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,SAAS,MAAM,cAAc,CAAC;
|
|
1
|
+
{"version":3,"file":"getTransactionStatus.js","sourceRoot":"","sources":["../src/getTransactionStatus.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,EACL,cAAc,EACd,YAAY,EACZ,WAAW,EACX,UAAU,EACV,cAAc,EACd,4CAA4C,EAC5C,4CAA4C,EAC5C,yBAAyB,EACzB,iBAAiB,GAClB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAE7D,OAAO,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AAE/E,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AACtD,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAE/C,MAAM,CAAC,MAAM,oBAAoB,GAIL,CAAO,OAAO,EAAE,WAAW,EAAE,EAAE;IACzD,MAAM,MAAM,GAA0B,EAAE,CAAC;IACzC,MAAM,QAAQ,GAA0B,EAAE,CAAC;IAC3C,MAAM,WAAW,GAAG,MAAM,cAAc,EAAE,CAAC;IAC3C,MAAM,cAAc,GAAG,aAAa,CAClC,WAAW,CAAC,IAAI,CAAC,gBAA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AC;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAc,SAAS,EAAE,MAAM,UAAU,CAAC;AAEjD,QAAA,MAAM,QAAQ,kBAAmB,cAAc,SAAS,CAAC,KAAG,
|
|
1
|
+
{"version":3,"file":"hw-getAddress.d.ts","sourceRoot":"","sources":["../src/hw-getAddress.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,MAAM,mDAAmD,CAAC;AACjF,OAAO,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AAChE,OAAO,EAAc,SAAS,EAAE,MAAM,UAAU,CAAC;AAEjD,QAAA,MAAM,QAAQ,kBAAmB,cAAc,SAAS,CAAC,KAAG,YAY3D,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
package/lib-es/hw-getAddress.js
CHANGED
|
@@ -9,12 +9,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
|
|
9
9
|
};
|
|
10
10
|
const resolver = (signerContext) => {
|
|
11
11
|
return (deviceId_1, _a) => __awaiter(void 0, [deviceId_1, _a], void 0, function* (deviceId, { path, verify }) {
|
|
12
|
-
const { address, publicKey
|
|
12
|
+
const { address, publicKey } = (yield signerContext(deviceId, signer => signer.getAddress(path, verify, false)));
|
|
13
13
|
return {
|
|
14
14
|
path,
|
|
15
15
|
address,
|
|
16
16
|
publicKey,
|
|
17
|
-
chainCode,
|
|
18
17
|
};
|
|
19
18
|
});
|
|
20
19
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hw-getAddress.js","sourceRoot":"","sources":["../src/hw-getAddress.ts"],"names":[],"mappings":";;;;;;;;;AAKA,MAAM,QAAQ,GAAG,CAAC,aAAuC,EAAgB,EAAE;IACzE,OAAO,iBAA8D,EAAE,wDAAzD,QAAgB,EAAE,EAAE,IAAI,EAAE,MAAM,EAAqB;QACjE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"hw-getAddress.js","sourceRoot":"","sources":["../src/hw-getAddress.ts"],"names":[],"mappings":";;;;;;;;;AAKA,MAAM,QAAQ,GAAG,CAAC,aAAuC,EAAgB,EAAE;IACzE,OAAO,iBAA8D,EAAE,wDAAzD,QAAgB,EAAE,EAAE,IAAI,EAAE,MAAM,EAAqB;QACjE,MAAM,EAAE,OAAO,EAAE,SAAS,EAAE,GAAG,CAAC,MAAM,aAAa,CAAC,QAAQ,EAAE,MAAM,CAAC,EAAE,CACrE,MAAM,CAAC,UAAU,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,CACvC,CAAe,CAAC;QAEjB,OAAO;YACL,IAAI;YACJ,OAAO;YACP,SAAS;SACV,CAAC;IACJ,CAAC,CAAA,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,QAAQ,CAAC"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { AccountBridge } from "@ledgerhq/types-live";
|
|
2
2
|
import { Transaction } from "./types";
|
|
3
|
-
export declare const prepareTransaction:
|
|
3
|
+
export declare const prepareTransaction: AccountBridge<Transaction>["prepareTransaction"];
|
|
4
4
|
//# sourceMappingURL=prepareTransaction.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepareTransaction.d.ts","sourceRoot":"","sources":["../src/prepareTransaction.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,
|
|
1
|
+
{"version":3,"file":"prepareTransaction.d.ts","sourceRoot":"","sources":["../src/prepareTransaction.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AAErD,OAAO,EAAe,WAAW,EAAE,MAAM,SAAS,CAAC;AAanD,eAAO,MAAM,kBAAkB,EAAE,aAAa,CAAC,WAAW,CAAC,CAAC,oBAAoB,CA8B/E,CAAC"}
|
|
@@ -18,8 +18,8 @@ const remapError = (error) => {
|
|
|
18
18
|
}
|
|
19
19
|
return error;
|
|
20
20
|
};
|
|
21
|
-
export const prepareTransaction = (
|
|
22
|
-
let networkInfo =
|
|
21
|
+
export const prepareTransaction = (account, transaction) => __awaiter(void 0, void 0, void 0, function* () {
|
|
22
|
+
let networkInfo = transaction.networkInfo;
|
|
23
23
|
if (!networkInfo) {
|
|
24
24
|
try {
|
|
25
25
|
const info = yield getServerInfos();
|
|
@@ -37,10 +37,10 @@ export const prepareTransaction = (a, t) => __awaiter(void 0, void 0, void 0, fu
|
|
|
37
37
|
throw e;
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
|
-
const fee =
|
|
41
|
-
if (
|
|
42
|
-
return Object.assign(Object.assign({},
|
|
40
|
+
const fee = transaction.fee || networkInfo.serverFee;
|
|
41
|
+
if (transaction.networkInfo !== networkInfo || transaction.fee !== fee) {
|
|
42
|
+
return Object.assign(Object.assign({}, transaction), { networkInfo, fee });
|
|
43
43
|
}
|
|
44
|
-
return
|
|
44
|
+
return transaction;
|
|
45
45
|
});
|
|
46
46
|
//# sourceMappingURL=prepareTransaction.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"prepareTransaction.js","sourceRoot":"","sources":["../src/prepareTransaction.ts"],"names":[],"mappings":";;;;;;;;;AAAA,OAAO,SAAS,MAAM,cAAc,CAAC;AACrC,OAAO,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAE/C,OAAO,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,OAAO,CAAC;AAGtD,8BAA8B;AAC9B,MAAM,UAAU,GAAG,CAAC,KAAY,EAAE,EAAE;IAClC,MAAM,GAAG,GAAG,KAAK,CAAC,OAAO,CAAC;IAE1B,IAAI,GAAG,CAAC,QAAQ,CAAC,wBAAwB,CAAC,IAAI,GAAG,CAAC,QAAQ,CAAC,iBAAiB,CAAC,EAAE,CAAC;QAC9E,OAAO,IAAI,WAAW,EAAE,CAAC;IAC3B,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC,CAAC;AAEF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IAED,MAAM,GAAG,GAAG,WAAW,CAAC,GAAG,IAAI,WAAW,CAAC,SAAS,CAAC;IAErD,IAAI,WAAW,CAAC,WAAW,KAAK,WAAW,IAAI,WAAW,CAAC,GAAG,KAAK,GAAG,EAAE,CAAC;QACvE,uCAAY,WAAW,KAAE,WAAW,EAAE,GAAG,IAAG;IAC9C,CAAC;IAED,OAAO,WAAW,CAAC;AACrB,CAAC,CAAA,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ledgerhq/coin-xrp",
|
|
3
|
-
"version": "0.2.0
|
|
3
|
+
"version": "0.2.0",
|
|
4
4
|
"description": "Ledger XRP Coin integration",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Ledger",
|
|
@@ -49,12 +49,12 @@
|
|
|
49
49
|
"ripple-address-codec": "^5.0.0",
|
|
50
50
|
"ripple-binary-codec": "^1.3.0",
|
|
51
51
|
"rxjs": "^7.8.1",
|
|
52
|
-
"@ledgerhq/coin-framework": "^0.14.0
|
|
53
|
-
"@ledgerhq/cryptoassets": "^13.1.0
|
|
54
|
-
"@ledgerhq/devices": "^8.4.0
|
|
55
|
-
"@ledgerhq/errors": "^6.17.0
|
|
56
|
-
"@ledgerhq/live-network": "^1.3.0
|
|
57
|
-
"@ledgerhq/types-live": "^6.48.0
|
|
52
|
+
"@ledgerhq/coin-framework": "^0.14.0",
|
|
53
|
+
"@ledgerhq/cryptoassets": "^13.1.0",
|
|
54
|
+
"@ledgerhq/devices": "^8.4.0",
|
|
55
|
+
"@ledgerhq/errors": "^6.17.0",
|
|
56
|
+
"@ledgerhq/live-network": "^1.3.0",
|
|
57
|
+
"@ledgerhq/types-live": "^6.48.0"
|
|
58
58
|
},
|
|
59
59
|
"devDependencies": {
|
|
60
60
|
"@types/invariant": "^2.2.37",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"jest": "^29.7.0",
|
|
64
64
|
"ts-jest": "^29.1.1",
|
|
65
65
|
"typescript": "^5.4.5",
|
|
66
|
-
"@ledgerhq/types-cryptoassets": "^7.13.0
|
|
66
|
+
"@ledgerhq/types-cryptoassets": "^7.13.0"
|
|
67
67
|
},
|
|
68
68
|
"scripts": {
|
|
69
69
|
"clean": "rimraf lib lib-es",
|
package/src/createTransaction.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import BigNumber from "bignumber.js";
|
|
2
2
|
import { Transaction } from "./types";
|
|
3
|
+
import { AccountBridge } from "@ledgerhq/types-live";
|
|
3
4
|
|
|
4
|
-
export const createTransaction = ()
|
|
5
|
+
export const createTransaction: AccountBridge<Transaction>["createTransaction"] = () => ({
|
|
5
6
|
family: "xrp",
|
|
6
7
|
amount: new BigNumber(0),
|
|
7
8
|
recipient: "",
|
|
@@ -14,7 +14,7 @@ export const estimateMaxSpendable: AccountBridge<Transaction>["estimateMaxSpenda
|
|
|
14
14
|
}) => {
|
|
15
15
|
const mainAccount = getMainAccount(account, parentAccount);
|
|
16
16
|
const newTransaction = await prepareTransaction(mainAccount, {
|
|
17
|
-
...createTransaction(),
|
|
17
|
+
...createTransaction(account),
|
|
18
18
|
...transaction,
|
|
19
19
|
recipient: transaction?.recipient || getAbandonSeedAddress("ripple"),
|
|
20
20
|
// public testing seed abandonx11,about
|
|
@@ -10,27 +10,24 @@ import {
|
|
|
10
10
|
RecipientRequired,
|
|
11
11
|
} from "@ledgerhq/errors";
|
|
12
12
|
import BigNumber from "bignumber.js";
|
|
13
|
-
import { AccountBridge } from "@ledgerhq/types-live";
|
|
14
13
|
import { isValidClassicAddress } from "ripple-address-codec";
|
|
14
|
+
import { Account, AccountBridge } from "@ledgerhq/types-live";
|
|
15
15
|
import { formatCurrencyUnit } from "@ledgerhq/coin-framework/currencies/index";
|
|
16
|
+
import { Transaction, TransactionStatus } from "./types";
|
|
16
17
|
import { getServerInfos, parseAPIValue } from "./api";
|
|
17
18
|
import { cachedRecipientIsNew } from "./logic";
|
|
18
|
-
import { Transaction } from "./types";
|
|
19
19
|
|
|
20
|
-
export const getTransactionStatus: AccountBridge<
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
} = {};
|
|
32
|
-
const r = await getServerInfos();
|
|
33
|
-
const reserveBaseXRP = parseAPIValue(r.info.validated_ledger.reserve_base_xrp.toString());
|
|
20
|
+
export const getTransactionStatus: AccountBridge<
|
|
21
|
+
Transaction,
|
|
22
|
+
Account,
|
|
23
|
+
TransactionStatus
|
|
24
|
+
>["getTransactionStatus"] = async (account, transaction) => {
|
|
25
|
+
const errors: Record<string, Error> = {};
|
|
26
|
+
const warnings: Record<string, Error> = {};
|
|
27
|
+
const serverInfos = await getServerInfos();
|
|
28
|
+
const reserveBaseXRP = parseAPIValue(
|
|
29
|
+
serverInfos.info.validated_ledger.reserve_base_xrp.toString(),
|
|
30
|
+
);
|
|
34
31
|
const estimatedFees = new BigNumber(transaction.fee || 0);
|
|
35
32
|
const totalSpent = new BigNumber(transaction.amount).plus(estimatedFees);
|
|
36
33
|
const amount = new BigNumber(transaction.amount);
|
|
@@ -79,11 +76,11 @@ export const getTransactionStatus: AccountBridge<Transaction>["getTransactionSta
|
|
|
79
76
|
errors.amount = new AmountRequired();
|
|
80
77
|
}
|
|
81
78
|
|
|
82
|
-
return
|
|
79
|
+
return {
|
|
83
80
|
errors,
|
|
84
81
|
warnings,
|
|
85
82
|
estimatedFees,
|
|
86
83
|
amount,
|
|
87
84
|
totalSpent,
|
|
88
|
-
}
|
|
85
|
+
};
|
|
89
86
|
};
|
package/src/hw-getAddress.ts
CHANGED
|
@@ -5,7 +5,7 @@ import { XrpAddress, XrpSigner } from "./signer";
|
|
|
5
5
|
|
|
6
6
|
const resolver = (signerContext: SignerContext<XrpSigner>): GetAddressFn => {
|
|
7
7
|
return async (deviceId: string, { path, verify }: GetAddressOptions) => {
|
|
8
|
-
const { address, publicKey
|
|
8
|
+
const { address, publicKey } = (await signerContext(deviceId, signer =>
|
|
9
9
|
signer.getAddress(path, verify, false),
|
|
10
10
|
)) as XrpAddress;
|
|
11
11
|
|
|
@@ -13,7 +13,6 @@ const resolver = (signerContext: SignerContext<XrpSigner>): GetAddressFn => {
|
|
|
13
13
|
path,
|
|
14
14
|
address,
|
|
15
15
|
publicKey,
|
|
16
|
-
chainCode,
|
|
17
16
|
};
|
|
18
17
|
};
|
|
19
18
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import BigNumber from "bignumber.js";
|
|
2
2
|
import { NetworkDown } from "@ledgerhq/errors";
|
|
3
|
-
import {
|
|
3
|
+
import { AccountBridge } from "@ledgerhq/types-live";
|
|
4
4
|
import { getServerInfos, parseAPIValue } from "./api";
|
|
5
5
|
import { NetworkInfo, Transaction } from "./types";
|
|
6
6
|
|
|
@@ -15,8 +15,11 @@ const remapError = (error: Error) => {
|
|
|
15
15
|
return error;
|
|
16
16
|
};
|
|
17
17
|
|
|
18
|
-
export const prepareTransaction
|
|
19
|
-
|
|
18
|
+
export const prepareTransaction: AccountBridge<Transaction>["prepareTransaction"] = async (
|
|
19
|
+
account,
|
|
20
|
+
transaction,
|
|
21
|
+
) => {
|
|
22
|
+
let networkInfo: NetworkInfo | null | undefined = transaction.networkInfo;
|
|
20
23
|
|
|
21
24
|
if (!networkInfo) {
|
|
22
25
|
try {
|
|
@@ -35,11 +38,11 @@ export const prepareTransaction = async (a: Account, t: Transaction): Promise<Tr
|
|
|
35
38
|
}
|
|
36
39
|
}
|
|
37
40
|
|
|
38
|
-
const fee =
|
|
41
|
+
const fee = transaction.fee || networkInfo.serverFee;
|
|
39
42
|
|
|
40
|
-
if (
|
|
41
|
-
return { ...
|
|
43
|
+
if (transaction.networkInfo !== networkInfo || transaction.fee !== fee) {
|
|
44
|
+
return { ...transaction, networkInfo, fee };
|
|
42
45
|
}
|
|
43
46
|
|
|
44
|
-
return
|
|
47
|
+
return transaction;
|
|
45
48
|
};
|