@ledgerhq/coin-xrp 7.1.0 → 7.1.1-nightly.1

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.
Files changed (93) hide show
  1. package/.eslintrc.js +1 -0
  2. package/.turbo/turbo-build.log +1 -1
  3. package/.unimportedrc.json +3 -1
  4. package/CHANGELOG.md +24 -0
  5. package/lib/api/index.d.ts.map +1 -1
  6. package/lib/api/index.js +19 -6
  7. package/lib/api/index.js.map +1 -1
  8. package/lib/api/index.test.js +1 -1
  9. package/lib/api/index.test.js.map +1 -1
  10. package/lib/logic/craftTransaction.d.ts +1 -1
  11. package/lib/logic/craftTransaction.d.ts.map +1 -1
  12. package/lib/logic/craftTransaction.js +1 -1
  13. package/lib/logic/craftTransaction.js.map +1 -1
  14. package/lib/logic/craftTransaction.test.js +2 -2
  15. package/lib/logic/craftTransaction.test.js.map +1 -1
  16. package/lib/logic/estimateFees.d.ts +1 -1
  17. package/lib/logic/estimateFees.d.ts.map +1 -1
  18. package/lib/logic/estimateFees.js +1 -1
  19. package/lib/logic/estimateFees.js.map +1 -1
  20. package/lib/logic/estimateFees.test.js +2 -2
  21. package/lib/logic/estimateFees.test.js.map +1 -1
  22. package/lib/logic/getTransactionStatus.d.ts +3 -2
  23. package/lib/logic/getTransactionStatus.d.ts.map +1 -1
  24. package/lib/logic/getTransactionStatus.js +35 -25
  25. package/lib/logic/getTransactionStatus.js.map +1 -1
  26. package/lib/logic/getTransactionStatus.test.js +108 -27
  27. package/lib/logic/getTransactionStatus.test.js.map +1 -1
  28. package/lib/logic/listOperations.js +5 -5
  29. package/lib/logic/listOperations.js.map +1 -1
  30. package/lib/logic/listOperations.test.js +5 -5
  31. package/lib/logic/listOperations.test.js.map +1 -1
  32. package/lib/test/bridgeDatasetTest.js +4 -4
  33. package/lib/test/bridgeDatasetTest.js.map +1 -1
  34. package/lib/test/cli.js +1 -1
  35. package/lib/test/cli.js.map +1 -1
  36. package/lib/transaction.d.ts +2 -2
  37. package/lib/transaction.d.ts.map +1 -1
  38. package/lib/transaction.js +5 -5
  39. package/lib/transaction.js.map +1 -1
  40. package/lib/types/bridge.d.ts +2 -2
  41. package/lib/types/bridge.d.ts.map +1 -1
  42. package/lib-es/api/index.d.ts.map +1 -1
  43. package/lib-es/api/index.js +19 -6
  44. package/lib-es/api/index.js.map +1 -1
  45. package/lib-es/api/index.test.js +1 -1
  46. package/lib-es/api/index.test.js.map +1 -1
  47. package/lib-es/logic/craftTransaction.d.ts +1 -1
  48. package/lib-es/logic/craftTransaction.d.ts.map +1 -1
  49. package/lib-es/logic/craftTransaction.js +1 -1
  50. package/lib-es/logic/craftTransaction.js.map +1 -1
  51. package/lib-es/logic/craftTransaction.test.js +2 -2
  52. package/lib-es/logic/craftTransaction.test.js.map +1 -1
  53. package/lib-es/logic/estimateFees.d.ts +1 -1
  54. package/lib-es/logic/estimateFees.d.ts.map +1 -1
  55. package/lib-es/logic/estimateFees.js +1 -1
  56. package/lib-es/logic/estimateFees.js.map +1 -1
  57. package/lib-es/logic/estimateFees.test.js +2 -2
  58. package/lib-es/logic/estimateFees.test.js.map +1 -1
  59. package/lib-es/logic/getTransactionStatus.d.ts +3 -2
  60. package/lib-es/logic/getTransactionStatus.d.ts.map +1 -1
  61. package/lib-es/logic/getTransactionStatus.js +35 -25
  62. package/lib-es/logic/getTransactionStatus.js.map +1 -1
  63. package/lib-es/logic/getTransactionStatus.test.js +108 -27
  64. package/lib-es/logic/getTransactionStatus.test.js.map +1 -1
  65. package/lib-es/logic/listOperations.js +5 -5
  66. package/lib-es/logic/listOperations.js.map +1 -1
  67. package/lib-es/logic/listOperations.test.js +5 -5
  68. package/lib-es/logic/listOperations.test.js.map +1 -1
  69. package/lib-es/test/bridgeDatasetTest.js +4 -4
  70. package/lib-es/test/bridgeDatasetTest.js.map +1 -1
  71. package/lib-es/test/cli.js +1 -1
  72. package/lib-es/test/cli.js.map +1 -1
  73. package/lib-es/transaction.d.ts +2 -2
  74. package/lib-es/transaction.d.ts.map +1 -1
  75. package/lib-es/transaction.js +5 -5
  76. package/lib-es/transaction.js.map +1 -1
  77. package/lib-es/types/bridge.d.ts +2 -2
  78. package/lib-es/types/bridge.d.ts.map +1 -1
  79. package/package.json +8 -8
  80. package/src/api/index.test.ts +1 -1
  81. package/src/api/index.ts +20 -9
  82. package/src/logic/craftTransaction.test.ts +2 -2
  83. package/src/logic/craftTransaction.ts +2 -2
  84. package/src/logic/estimateFees.test.ts +2 -2
  85. package/src/logic/estimateFees.ts +2 -2
  86. package/src/logic/getTransactionStatus.test.ts +94 -28
  87. package/src/logic/getTransactionStatus.ts +38 -27
  88. package/src/logic/listOperations.test.ts +5 -5
  89. package/src/logic/listOperations.ts +5 -5
  90. package/src/test/bridgeDatasetTest.ts +4 -4
  91. package/src/test/cli.ts +1 -1
  92. package/src/transaction.ts +5 -5
  93. package/src/types/bridge.ts +2 -2
@@ -1,8 +1,14 @@
1
1
  import { getTransactionStatus } from "./getTransactionStatus";
2
2
  import * as utils from "./utils";
3
3
 
4
+ const mockGetBalance = jest.fn();
5
+
4
6
  const mockGetServerInfos = jest.fn();
5
7
 
8
+ jest.mock("./getBalance", () => ({
9
+ getBalance: () => mockGetBalance(),
10
+ }));
11
+
6
12
  jest.mock("../network", () => ({
7
13
  getServerInfos: () => mockGetServerInfos(),
8
14
  }));
@@ -20,21 +26,9 @@ const SENDER = "rPSCfmnX3t9jQJG5RNcZtSaP5UhExZDue4";
20
26
  const RECIPIENT = "rPT1Sjq2YGrBMTttX4GZHjKu9dyfzbpAYe";
21
27
  const RECIPIENT_NEW = "rDKsbvy9uaNpPtvVFraJyNGfjvTw8xivgK";
22
28
 
23
- const account = {
24
- address: SENDER,
25
- balance: 50_000_000n,
26
- currencyUnit: {
27
- code: "XRP",
28
- magnitude: 6,
29
- name: "XRP",
30
- symbol: "XRP",
31
- },
32
- currencyName: "XRP",
33
- };
34
-
35
29
  describe("getTransactionStatus", () => {
36
30
  afterEach(() => {
37
- mockGetServerInfos.mockReset();
31
+ jest.clearAllMocks();
38
32
  });
39
33
 
40
34
  it("returns no errors on valid transaction", async () => {
@@ -45,13 +39,22 @@ describe("getTransactionStatus", () => {
45
39
  },
46
40
  },
47
41
  });
42
+ mockGetBalance.mockResolvedValue([
43
+ {
44
+ value: 50_000_000n,
45
+ asset: { type: "native" },
46
+ locked: 0n,
47
+ },
48
+ ]);
48
49
 
49
50
  const result = await getTransactionStatus(
50
- account as any,
51
+ // account as any,
51
52
  {
53
+ sender: SENDER,
52
54
  amount: 20_000_000n,
53
- fee: 10_000n,
55
+ fees: 10_000n,
54
56
  recipient: RECIPIENT,
57
+ asset: { unit: { code: "XRP", magnitude: 6 } },
55
58
  } as any,
56
59
  );
57
60
 
@@ -68,13 +71,22 @@ describe("getTransactionStatus", () => {
68
71
  },
69
72
  },
70
73
  });
74
+ mockGetBalance.mockResolvedValue([
75
+ {
76
+ value: 50_000_000n,
77
+ asset: { type: "native" },
78
+ locked: 0n,
79
+ },
80
+ ]);
71
81
 
72
82
  const result = await getTransactionStatus(
73
- account as any,
83
+ // account as any,
74
84
  {
85
+ sender: SENDER,
75
86
  amount: 1_000_000n,
76
- fee: 200_000n, // 20%
87
+ fees: 200_000n, // 20%
77
88
  recipient: RECIPIENT,
89
+ asset: { unit: { code: "XRP", magnitude: 6 } },
78
90
  } as any,
79
91
  );
80
92
 
@@ -90,12 +102,21 @@ describe("getTransactionStatus", () => {
90
102
  },
91
103
  },
92
104
  });
105
+ mockGetBalance.mockResolvedValue([
106
+ {
107
+ value: 30_000_000n,
108
+ asset: { type: "native" },
109
+ locked: 0n,
110
+ },
111
+ ]);
93
112
 
94
113
  const result = await getTransactionStatus(
95
- account as any,
114
+ // account as any,
96
115
  {
116
+ sender: SENDER,
97
117
  amount: 10_000_000n,
98
118
  recipient: RECIPIENT,
119
+ asset: { unit: { code: "XRP", magnitude: 6 } },
99
120
  } as any,
100
121
  );
101
122
 
@@ -110,13 +131,22 @@ describe("getTransactionStatus", () => {
110
131
  },
111
132
  },
112
133
  });
134
+ mockGetBalance.mockResolvedValue([
135
+ {
136
+ value: 50_000_000n,
137
+ asset: { type: "native" },
138
+ locked: 0n,
139
+ },
140
+ ]);
113
141
 
114
142
  const result = await getTransactionStatus(
115
- account as any,
143
+ // account as any,
116
144
  {
145
+ sender: SENDER,
117
146
  amount: 10_000_000n,
118
- fee: 10_000n,
147
+ fees: 10_000n,
119
148
  recipient: SENDER,
149
+ asset: { unit: { code: "XRP", magnitude: 6 } },
120
150
  } as any,
121
151
  );
122
152
 
@@ -131,13 +161,22 @@ describe("getTransactionStatus", () => {
131
161
  },
132
162
  },
133
163
  });
164
+ mockGetBalance.mockResolvedValue([
165
+ {
166
+ value: 50_000_000n,
167
+ asset: { type: "native" },
168
+ locked: 0n,
169
+ },
170
+ ]);
134
171
 
135
172
  const result = await getTransactionStatus(
136
- account as any,
173
+ // account as any,
137
174
  {
175
+ sender: SENDER,
138
176
  amount: 5_000_000n,
139
- fee: 10_000n,
177
+ fees: 10_000n,
140
178
  recipient: RECIPIENT_NEW,
179
+ asset: { unit: { code: "XRP", magnitude: 6 } },
141
180
  } as any,
142
181
  );
143
182
 
@@ -152,13 +191,22 @@ describe("getTransactionStatus", () => {
152
191
  },
153
192
  },
154
193
  });
194
+ mockGetBalance.mockResolvedValue([
195
+ {
196
+ value: 50_000_000n,
197
+ asset: { type: "native" },
198
+ locked: 0n,
199
+ },
200
+ ]);
155
201
 
156
202
  const result = await getTransactionStatus(
157
- account as any,
203
+ // account as any,
158
204
  {
205
+ sender: SENDER,
159
206
  amount: 0n,
160
- fee: 10_000n,
207
+ fees: 10_000n,
161
208
  recipient: RECIPIENT,
209
+ asset: { unit: { code: "XRP", magnitude: 6 } },
162
210
  } as any,
163
211
  );
164
212
 
@@ -173,12 +221,21 @@ describe("getTransactionStatus", () => {
173
221
  },
174
222
  },
175
223
  });
224
+ mockGetBalance.mockResolvedValue([
225
+ {
226
+ value: 50_000_000n,
227
+ asset: { type: "native" },
228
+ locked: 0n,
229
+ },
230
+ ]);
176
231
 
177
232
  const result = await getTransactionStatus(
178
- account as any,
233
+ // account as any,
179
234
  {
235
+ sender: SENDER,
236
+ asset: { unit: { code: "XRP", magnitude: 6 } },
180
237
  amount: 1_000_000n,
181
- fee: 10_000n,
238
+ fees: 10_000n,
182
239
  recipient: "not-an-address",
183
240
  } as any,
184
241
  );
@@ -194,12 +251,21 @@ describe("getTransactionStatus", () => {
194
251
  },
195
252
  },
196
253
  });
254
+ mockGetBalance.mockResolvedValue([
255
+ {
256
+ value: 50_000_000n,
257
+ asset: { type: "native" },
258
+ locked: 0n,
259
+ },
260
+ ]);
197
261
 
198
262
  const result = await getTransactionStatus(
199
- account as any,
263
+ // account as any,
200
264
  {
265
+ sender: SENDER,
266
+ asset: { unit: { code: "XRP", magnitude: 6 } },
201
267
  amount: 1_000_000n,
202
- fee: 10_000n,
268
+ fees: 10_000n,
203
269
  recipient: "",
204
270
  } as any,
205
271
  );
@@ -14,11 +14,12 @@ import { formatCurrencyUnit } from "@ledgerhq/coin-framework/currencies/index";
14
14
  import { getServerInfos } from "../network";
15
15
  import { cachedRecipientIsNew } from "./utils";
16
16
  import { parseAPIValue } from "./common";
17
- import { Transaction, TransactionValidation, Account } from "@ledgerhq/coin-framework/api/types";
17
+ import { TransactionValidation, TransactionIntent } from "@ledgerhq/coin-framework/api/types";
18
+ import { XrpMapMemo } from "../types";
19
+ import { getBalance } from "./getBalance";
18
20
 
19
21
  export const getTransactionStatus = async (
20
- account: Account,
21
- transaction: Transaction,
22
+ transactionIntent: TransactionIntent<XrpMapMemo>,
22
23
  ): Promise<TransactionValidation> => {
23
24
  const errors: Record<string, Error> = {};
24
25
  const warnings: Record<string, Error> = {};
@@ -26,51 +27,61 @@ export const getTransactionStatus = async (
26
27
  const reserveBaseXRP = parseAPIValue(
27
28
  serverInfos.info.validated_ledger.reserve_base_xrp.toString(),
28
29
  );
29
- const estimatedFees = transaction.fee || 0n;
30
- const totalSpent = transaction.amount + estimatedFees;
31
- const amount = transaction.amount;
30
+ const estimatedFees = transactionIntent.fees || 0n;
31
+ const totalSpent = transactionIntent.amount + estimatedFees;
32
+ const amount = transactionIntent.amount;
32
33
 
33
34
  if (amount > 0 && estimatedFees * 10n > amount) {
34
35
  warnings.feeTooHigh = new FeeTooHigh();
35
36
  }
36
37
 
37
- if (!transaction.fee) {
38
+ const balances = await getBalance(transactionIntent.sender);
39
+ const nativeBalance = balances.find(b => b.asset.type === "native");
40
+ if (nativeBalance === undefined) {
41
+ throw Error("Shouldn't happen");
42
+ }
43
+
44
+ if (!transactionIntent.fees) {
38
45
  errors.fee = new FeeNotLoaded();
39
- } else if (transaction.fee == 0n) {
46
+ } else if (transactionIntent.fees === 0n) {
40
47
  errors.fee = new FeeRequired();
41
- } else if (totalSpent > account.balance - BigInt(reserveBaseXRP.toString())) {
48
+ } else if (totalSpent > nativeBalance.value - BigInt(reserveBaseXRP.toString())) {
42
49
  errors.amount = new NotEnoughSpendableBalance("", {
43
- minimumAmount: formatCurrencyUnit(account.currencyUnit, reserveBaseXRP, {
44
- disableRounding: true,
45
- useGrouping: false,
46
- showCode: true,
47
- }),
50
+ minimumAmount: transactionIntent.asset.unit
51
+ ? formatCurrencyUnit(transactionIntent.asset.unit, reserveBaseXRP, {
52
+ disableRounding: true,
53
+ useGrouping: false,
54
+ showCode: true,
55
+ })
56
+ : "Unknown unit",
48
57
  });
49
58
  } else if (
50
- transaction.recipient &&
51
- (await cachedRecipientIsNew(transaction.recipient)) &&
52
- transaction.amount < BigInt(reserveBaseXRP.toString())
59
+ transactionIntent.recipient &&
60
+ (await cachedRecipientIsNew(transactionIntent.recipient)) &&
61
+ transactionIntent.amount < BigInt(reserveBaseXRP.toString())
53
62
  ) {
54
63
  errors.amount = new NotEnoughBalanceBecauseDestinationNotCreated("", {
55
- minimalAmount: formatCurrencyUnit(account.currencyUnit, reserveBaseXRP, {
56
- disableRounding: true,
57
- useGrouping: false,
58
- showCode: true,
59
- }),
64
+ minimalAmount: transactionIntent.asset.unit
65
+ ? formatCurrencyUnit(transactionIntent.asset.unit, reserveBaseXRP, {
66
+ disableRounding: true,
67
+ useGrouping: false,
68
+ showCode: true,
69
+ })
70
+ : "Unknown unit",
60
71
  });
61
72
  }
62
73
 
63
- if (!transaction.recipient) {
74
+ if (!transactionIntent.recipient) {
64
75
  errors.recipient = new RecipientRequired("");
65
- } else if (account.address === transaction.recipient) {
76
+ } else if (transactionIntent.sender === transactionIntent.recipient) {
66
77
  errors.recipient = new InvalidAddressBecauseDestinationIsAlsoSource();
67
- } else if (!isValidClassicAddress(transaction.recipient)) {
78
+ } else if (!isValidClassicAddress(transactionIntent.recipient)) {
68
79
  errors.recipient = new InvalidAddress("", {
69
- currencyName: account.currencyName,
80
+ currencyName: transactionIntent.asset.name ?? "",
70
81
  });
71
82
  }
72
83
 
73
- if (!errors.amount && amount == 0n) {
84
+ if (!errors.amount && amount === 0n) {
74
85
  errors.amount = new AmountRequired();
75
86
  }
76
87
 
@@ -146,7 +146,7 @@ describe("listOperations", () => {
146
146
  async ({ address, opSender, opDestination, expectedType }) => {
147
147
  // Given
148
148
  const deliveredAmount = 100;
149
- const fee = 10;
149
+ const fees = 10;
150
150
  mockNetworkGetTransactions.mockResolvedValue(
151
151
  mockNetworkTxs([
152
152
  {
@@ -156,7 +156,7 @@ describe("listOperations", () => {
156
156
  meta: { delivered_amount: deliveredAmount.toString() },
157
157
  tx_json: {
158
158
  TransactionType: "Payment",
159
- Fee: fee.toString(),
159
+ Fee: fees.toString(),
160
160
  ledger_index: 1,
161
161
  date: 1000,
162
162
  Account: opSender,
@@ -172,7 +172,7 @@ describe("listOperations", () => {
172
172
  meta: { delivered_amount: deliveredAmount.toString() },
173
173
  tx_json: {
174
174
  TransactionType: "Payment",
175
- Fee: fee.toString(),
175
+ Fee: fees.toString(),
176
176
  ledger_index: 1,
177
177
  date: 1000,
178
178
  Account: opSender,
@@ -189,7 +189,7 @@ describe("listOperations", () => {
189
189
  meta: { delivered_amount: deliveredAmount.toString() },
190
190
  tx_json: {
191
191
  TransactionType: "Payment",
192
- Fee: fee.toString(),
192
+ Fee: fees.toString(),
193
193
  ledger_index: 1,
194
194
  date: 1000,
195
195
  Account: opSender,
@@ -217,7 +217,7 @@ describe("listOperations", () => {
217
217
  expect(mockNetworkGetTransactions).toHaveBeenCalledTimes(1);
218
218
  // if expectedType is "OUT", compute value with fees (i.e. delivered_amount + Fee)
219
219
  const expectedValue =
220
- expectedType === "IN" ? BigInt(deliveredAmount) : BigInt(deliveredAmount + fee);
220
+ expectedType === "IN" ? BigInt(deliveredAmount) : BigInt(deliveredAmount + fees);
221
221
  expect(results).toEqual([
222
222
  {
223
223
  id: "HASH_VALUE",
@@ -125,10 +125,10 @@ const convertToCoreOperation =
125
125
  ? BigInt(delivered_amount)
126
126
  : BigInt(0);
127
127
 
128
- const fee = BigInt(Fee);
128
+ const fees = BigInt(Fee);
129
129
  if (type === "OUT") {
130
- if (!Number.isNaN(fee)) {
131
- value = value + fee;
130
+ if (!Number.isNaN(fees)) {
131
+ value = value + fees;
132
132
  }
133
133
  }
134
134
 
@@ -170,7 +170,7 @@ const convertToCoreOperation =
170
170
  asset: { type: "native" },
171
171
  tx: {
172
172
  hash: hash,
173
- fees: fee,
173
+ fees: fees,
174
174
  date: new Date(toEpochDate),
175
175
  block: {
176
176
  time: new Date(close_time_iso),
@@ -184,7 +184,7 @@ const convertToCoreOperation =
184
184
  recipients: [Destination],
185
185
  };
186
186
 
187
- if (Object.keys(details).length != 0) {
187
+ if (Object.keys(details).length !== 0) {
188
188
  op = {
189
189
  ...op,
190
190
  details,
@@ -40,7 +40,7 @@ export const dataset: DatasetTest<Transaction> = {
40
40
  recipient: "rB6pwovsyrFWhPYUsjj9V3CHck985QjiXi",
41
41
  amount: "15000000",
42
42
  tag: null,
43
- fee: "1",
43
+ fees: "1",
44
44
  feeCustomUnit: null,
45
45
  networkInfo: null,
46
46
  }),
@@ -75,7 +75,7 @@ export const dataset: DatasetTest<Transaction> = {
75
75
  recipient: newAddress1,
76
76
  amount: "10000000",
77
77
  tag: null,
78
- fee: "1",
78
+ fees: "1",
79
79
  feeCustomUnit: null,
80
80
  networkInfo: null
81
81
  }),
@@ -97,7 +97,7 @@ export const dataset: DatasetTest<Transaction> = {
97
97
  recipient: "rageXHB6Q4VbvvWdTzKANwjeCT4HXFCKX7",
98
98
  amount: "10000000",
99
99
  tag: null,
100
- fee: "10", // NOTE: fee is not customizable, this field is ignored
100
+ fees: "10", // NOTE: fee is not customizable, this field is ignored
101
101
  feeCustomUnit: null,
102
102
  networkInfo: null,
103
103
  }),
@@ -118,7 +118,7 @@ export const dataset: DatasetTest<Transaction> = {
118
118
  recipient: "rB6pwovsyrFWhPYUsjj9V3CHck985QjiXi",
119
119
  amount: "10000000",
120
120
  tag: 12345,
121
- fee: "10", // NOTE: fee is not customizable, this field is ignored
121
+ fees: "10", // NOTE: fee is not customizable, this field is ignored
122
122
  feeCustomUnit: null,
123
123
  networkInfo: null,
124
124
  }),
package/src/test/cli.ts CHANGED
@@ -30,7 +30,7 @@ function inferTransactions(
30
30
  invariant(transaction.family === "xrp", "XRP family");
31
31
  return {
32
32
  ...transaction,
33
- fee: inferAmount(account, opts.fee || "0.001xrp"),
33
+ fees: inferAmount(account, opts.fee || "0.001xrp"),
34
34
  tag: opts.tag,
35
35
  };
36
36
  });
@@ -12,7 +12,7 @@ import { getAccountCurrency } from "@ledgerhq/coin-framework/account/index";
12
12
  import { formatCurrencyUnit } from "@ledgerhq/coin-framework/currencies/index";
13
13
 
14
14
  export const formatTransaction = (
15
- { amount, recipient, fee, tag, useAllAmount }: Transaction,
15
+ { amount, recipient, fees, tag, useAllAmount }: Transaction,
16
16
  account: Account,
17
17
  ): string => `
18
18
  SEND ${
@@ -25,9 +25,9 @@ SEND ${
25
25
  }
26
26
  TO ${recipient}
27
27
  with fee=${
28
- !fee
28
+ !fees
29
29
  ? "?"
30
- : formatCurrencyUnit(getAccountCurrency(account).units[0], fee, {
30
+ : formatCurrencyUnit(getAccountCurrency(account).units[0], fees, {
31
31
  showCode: true,
32
32
  disableRounding: true,
33
33
  })
@@ -40,7 +40,7 @@ export const fromTransactionRaw = (tr: TransactionRaw): Transaction => {
40
40
  ...common,
41
41
  family: tr.family,
42
42
  tag: tr.tag,
43
- fee: tr.fee ? new BigNumber(tr.fee) : null,
43
+ fees: tr.fees ? new BigNumber(tr.fees) : null,
44
44
  feeCustomUnit: tr.feeCustomUnit,
45
45
  // FIXME remove this field. this is not good.. we're dereferencing here. we should instead store an index (to lookup in currency.units on UI)
46
46
  networkInfo: networkInfo && {
@@ -58,7 +58,7 @@ export const toTransactionRaw = (t: Transaction): TransactionRaw => {
58
58
  ...common,
59
59
  family: t.family,
60
60
  tag: t.tag,
61
- fee: t.fee ? t.fee.toString() : null,
61
+ fees: t.fees ? t.fees.toString() : null,
62
62
  feeCustomUnit: t.feeCustomUnit,
63
63
  // FIXME remove this field. this is not good.. we're dereferencing here. we should instead store an index (to lookup in currency.units on UI)
64
64
  networkInfo: networkInfo && {
@@ -21,7 +21,7 @@ export type NetworkInfoRaw = {
21
21
 
22
22
  export type Transaction = TransactionCommon & {
23
23
  family: "xrp";
24
- fee: BigNumber | null | undefined;
24
+ fees: BigNumber | null | undefined;
25
25
  networkInfo: NetworkInfo | null | undefined;
26
26
  tag: number | null | undefined;
27
27
  feeCustomUnit: Unit | null | undefined;
@@ -29,7 +29,7 @@ export type Transaction = TransactionCommon & {
29
29
 
30
30
  export type TransactionRaw = TransactionCommonRaw & {
31
31
  family: "xrp";
32
- fee: string | null | undefined;
32
+ fees: string | null | undefined;
33
33
  networkInfo: NetworkInfoRaw | null | undefined;
34
34
  tag: number | null | undefined;
35
35
  feeCustomUnit: Unit | null | undefined;