@ledgerhq/coin-celo 1.3.0-nightly.4 → 1.3.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.
Files changed (188) hide show
  1. package/.turbo/turbo-build.log +1 -1
  2. package/.unimportedrc.json +6 -3
  3. package/CHANGELOG.md +27 -35
  4. package/lib/bridge/buildOptimisticOperation.d.ts.map +1 -1
  5. package/lib/bridge/buildOptimisticOperation.js +2 -5
  6. package/lib/bridge/buildOptimisticOperation.js.map +1 -1
  7. package/lib/bridge/buildTransaction.d.ts.map +1 -1
  8. package/lib/bridge/buildTransaction.js +6 -29
  9. package/lib/bridge/buildTransaction.js.map +1 -1
  10. package/lib/bridge/estimateMaxSpendable.d.ts.map +1 -1
  11. package/lib/bridge/estimateMaxSpendable.js +1 -9
  12. package/lib/bridge/estimateMaxSpendable.js.map +1 -1
  13. package/lib/bridge/getFeesForTransaction.d.ts.map +1 -1
  14. package/lib/bridge/getFeesForTransaction.js +5 -32
  15. package/lib/bridge/getFeesForTransaction.js.map +1 -1
  16. package/lib/bridge/getTransactionStatus.d.ts.map +1 -1
  17. package/lib/bridge/getTransactionStatus.js +4 -18
  18. package/lib/bridge/getTransactionStatus.js.map +1 -1
  19. package/lib/bridge/index.d.ts.map +1 -1
  20. package/lib/bridge/index.js.map +1 -1
  21. package/lib/bridge/prepareTransaction.d.ts.map +1 -1
  22. package/lib/bridge/prepareTransaction.js +4 -33
  23. package/lib/bridge/prepareTransaction.js.map +1 -1
  24. package/lib/bridge/signOperation.d.ts.map +1 -1
  25. package/lib/bridge/signOperation.js +3 -11
  26. package/lib/bridge/signOperation.js.map +1 -1
  27. package/lib/bridge/synchronisation.d.ts.map +1 -1
  28. package/lib/bridge/synchronisation.js +3 -7
  29. package/lib/bridge/synchronisation.js.map +1 -1
  30. package/lib/config.d.ts.map +1 -1
  31. package/lib/config.js +0 -8
  32. package/lib/config.js.map +1 -1
  33. package/lib/test/please-add-coverage.test.d.ts +2 -0
  34. package/lib/test/please-add-coverage.test.d.ts.map +1 -0
  35. package/lib/test/please-add-coverage.test.js +6 -0
  36. package/lib/test/please-add-coverage.test.js.map +1 -0
  37. package/lib/types/types.d.ts +0 -1
  38. package/lib/types/types.d.ts.map +1 -1
  39. package/lib/types/types.js.map +1 -1
  40. package/lib-es/bridge/buildOptimisticOperation.d.ts.map +1 -1
  41. package/lib-es/bridge/buildOptimisticOperation.js +2 -5
  42. package/lib-es/bridge/buildOptimisticOperation.js.map +1 -1
  43. package/lib-es/bridge/buildTransaction.d.ts.map +1 -1
  44. package/lib-es/bridge/buildTransaction.js +6 -29
  45. package/lib-es/bridge/buildTransaction.js.map +1 -1
  46. package/lib-es/bridge/estimateMaxSpendable.d.ts.map +1 -1
  47. package/lib-es/bridge/estimateMaxSpendable.js +2 -10
  48. package/lib-es/bridge/estimateMaxSpendable.js.map +1 -1
  49. package/lib-es/bridge/getFeesForTransaction.d.ts.map +1 -1
  50. package/lib-es/bridge/getFeesForTransaction.js +5 -29
  51. package/lib-es/bridge/getFeesForTransaction.js.map +1 -1
  52. package/lib-es/bridge/getTransactionStatus.d.ts.map +1 -1
  53. package/lib-es/bridge/getTransactionStatus.js +4 -18
  54. package/lib-es/bridge/getTransactionStatus.js.map +1 -1
  55. package/lib-es/bridge/index.d.ts.map +1 -1
  56. package/lib-es/bridge/index.js.map +1 -1
  57. package/lib-es/bridge/prepareTransaction.d.ts.map +1 -1
  58. package/lib-es/bridge/prepareTransaction.js +4 -33
  59. package/lib-es/bridge/prepareTransaction.js.map +1 -1
  60. package/lib-es/bridge/signOperation.d.ts.map +1 -1
  61. package/lib-es/bridge/signOperation.js +3 -11
  62. package/lib-es/bridge/signOperation.js.map +1 -1
  63. package/lib-es/bridge/synchronisation.d.ts.map +1 -1
  64. package/lib-es/bridge/synchronisation.js +3 -7
  65. package/lib-es/bridge/synchronisation.js.map +1 -1
  66. package/lib-es/config.d.ts.map +1 -1
  67. package/lib-es/config.js +0 -8
  68. package/lib-es/config.js.map +1 -1
  69. package/lib-es/test/please-add-coverage.test.d.ts +1 -0
  70. package/lib-es/test/please-add-coverage.test.d.ts.map +1 -0
  71. package/lib-es/test/please-add-coverage.test.js +5 -0
  72. package/lib-es/test/please-add-coverage.test.js.map +1 -0
  73. package/lib-es/types/types.d.ts +0 -1
  74. package/lib-es/types/types.d.ts.map +1 -1
  75. package/lib-es/types/types.js.map +1 -1
  76. package/package.json +17 -18
  77. package/src/bridge/buildOptimisticOperation.ts +2 -6
  78. package/src/bridge/buildTransaction.ts +7 -38
  79. package/src/bridge/estimateMaxSpendable.ts +2 -18
  80. package/src/bridge/getFeesForTransaction.ts +5 -39
  81. package/src/bridge/getTransactionStatus.ts +4 -21
  82. package/src/bridge/index.ts +1 -0
  83. package/src/bridge/prepareTransaction.ts +6 -39
  84. package/src/bridge/signOperation.ts +4 -19
  85. package/src/bridge/synchronisation.ts +4 -10
  86. package/src/config.ts +0 -8
  87. package/src/logic.ts +1 -1
  88. package/src/test/please-add-coverage.test.ts +3 -0
  89. package/src/types/types.ts +0 -1
  90. package/lib/__tests__/bridge/buildOptimisticOperation.test.d.ts +0 -2
  91. package/lib/__tests__/bridge/buildOptimisticOperation.test.d.ts.map +0 -1
  92. package/lib/__tests__/bridge/buildOptimisticOperation.test.js +0 -23
  93. package/lib/__tests__/bridge/buildOptimisticOperation.test.js.map +0 -1
  94. package/lib/__tests__/bridge/buildTransaction.test.d.ts +0 -2
  95. package/lib/__tests__/bridge/buildTransaction.test.d.ts.map +0 -1
  96. package/lib/__tests__/bridge/buildTransaction.test.js +0 -412
  97. package/lib/__tests__/bridge/buildTransaction.test.js.map +0 -1
  98. package/lib/__tests__/bridge/createTransaction.test.d.ts +0 -2
  99. package/lib/__tests__/bridge/createTransaction.test.d.ts.map +0 -1
  100. package/lib/__tests__/bridge/createTransaction.test.js +0 -22
  101. package/lib/__tests__/bridge/createTransaction.test.js.map +0 -1
  102. package/lib/__tests__/bridge/deviceTransactionConfig.test.d.ts +0 -2
  103. package/lib/__tests__/bridge/deviceTransactionConfig.test.d.ts.map +0 -1
  104. package/lib/__tests__/bridge/deviceTransactionConfig.test.js +0 -21
  105. package/lib/__tests__/bridge/deviceTransactionConfig.test.js.map +0 -1
  106. package/lib/__tests__/bridge/estimateMaxSpendable.test.d.ts +0 -2
  107. package/lib/__tests__/bridge/estimateMaxSpendable.test.d.ts.map +0 -1
  108. package/lib/__tests__/bridge/estimateMaxSpendable.test.js +0 -108
  109. package/lib/__tests__/bridge/estimateMaxSpendable.test.js.map +0 -1
  110. package/lib/__tests__/bridge/getFeesForTransaction.test.d.ts +0 -2
  111. package/lib/__tests__/bridge/getFeesForTransaction.test.d.ts.map +0 -1
  112. package/lib/__tests__/bridge/getFeesForTransaction.test.js +0 -211
  113. package/lib/__tests__/bridge/getFeesForTransaction.test.js.map +0 -1
  114. package/lib/__tests__/bridge/getTransactionStatus.test.d.ts +0 -2
  115. package/lib/__tests__/bridge/getTransactionStatus.test.d.ts.map +0 -1
  116. package/lib/__tests__/bridge/getTransactionStatus.test.js +0 -214
  117. package/lib/__tests__/bridge/getTransactionStatus.test.js.map +0 -1
  118. package/lib/__tests__/bridge/logic.test.d.ts +0 -2
  119. package/lib/__tests__/bridge/logic.test.d.ts.map +0 -1
  120. package/lib/__tests__/bridge/logic.test.js +0 -490
  121. package/lib/__tests__/bridge/logic.test.js.map +0 -1
  122. package/lib/__tests__/bridge/prepareTransaction.test.d.ts +0 -2
  123. package/lib/__tests__/bridge/prepareTransaction.test.d.ts.map +0 -1
  124. package/lib/__tests__/bridge/prepareTransaction.test.js +0 -239
  125. package/lib/__tests__/bridge/prepareTransaction.test.js.map +0 -1
  126. package/lib/bridge/fixtures.d.ts +0 -36
  127. package/lib/bridge/fixtures.d.ts.map +0 -1
  128. package/lib/bridge/fixtures.js +0 -98
  129. package/lib/bridge/fixtures.js.map +0 -1
  130. package/lib/constants.d.ts +0 -6
  131. package/lib/constants.d.ts.map +0 -1
  132. package/lib/constants.js +0 -15
  133. package/lib/constants.js.map +0 -1
  134. package/lib-es/__tests__/bridge/buildOptimisticOperation.test.d.ts +0 -2
  135. package/lib-es/__tests__/bridge/buildOptimisticOperation.test.d.ts.map +0 -1
  136. package/lib-es/__tests__/bridge/buildOptimisticOperation.test.js +0 -18
  137. package/lib-es/__tests__/bridge/buildOptimisticOperation.test.js.map +0 -1
  138. package/lib-es/__tests__/bridge/buildTransaction.test.d.ts +0 -2
  139. package/lib-es/__tests__/bridge/buildTransaction.test.d.ts.map +0 -1
  140. package/lib-es/__tests__/bridge/buildTransaction.test.js +0 -407
  141. package/lib-es/__tests__/bridge/buildTransaction.test.js.map +0 -1
  142. package/lib-es/__tests__/bridge/createTransaction.test.d.ts +0 -2
  143. package/lib-es/__tests__/bridge/createTransaction.test.d.ts.map +0 -1
  144. package/lib-es/__tests__/bridge/createTransaction.test.js +0 -17
  145. package/lib-es/__tests__/bridge/createTransaction.test.js.map +0 -1
  146. package/lib-es/__tests__/bridge/deviceTransactionConfig.test.d.ts +0 -2
  147. package/lib-es/__tests__/bridge/deviceTransactionConfig.test.d.ts.map +0 -1
  148. package/lib-es/__tests__/bridge/deviceTransactionConfig.test.js +0 -16
  149. package/lib-es/__tests__/bridge/deviceTransactionConfig.test.js.map +0 -1
  150. package/lib-es/__tests__/bridge/estimateMaxSpendable.test.d.ts +0 -2
  151. package/lib-es/__tests__/bridge/estimateMaxSpendable.test.d.ts.map +0 -1
  152. package/lib-es/__tests__/bridge/estimateMaxSpendable.test.js +0 -103
  153. package/lib-es/__tests__/bridge/estimateMaxSpendable.test.js.map +0 -1
  154. package/lib-es/__tests__/bridge/getFeesForTransaction.test.d.ts +0 -2
  155. package/lib-es/__tests__/bridge/getFeesForTransaction.test.d.ts.map +0 -1
  156. package/lib-es/__tests__/bridge/getFeesForTransaction.test.js +0 -206
  157. package/lib-es/__tests__/bridge/getFeesForTransaction.test.js.map +0 -1
  158. package/lib-es/__tests__/bridge/getTransactionStatus.test.d.ts +0 -2
  159. package/lib-es/__tests__/bridge/getTransactionStatus.test.d.ts.map +0 -1
  160. package/lib-es/__tests__/bridge/getTransactionStatus.test.js +0 -209
  161. package/lib-es/__tests__/bridge/getTransactionStatus.test.js.map +0 -1
  162. package/lib-es/__tests__/bridge/logic.test.d.ts +0 -2
  163. package/lib-es/__tests__/bridge/logic.test.d.ts.map +0 -1
  164. package/lib-es/__tests__/bridge/logic.test.js +0 -485
  165. package/lib-es/__tests__/bridge/logic.test.js.map +0 -1
  166. package/lib-es/__tests__/bridge/prepareTransaction.test.d.ts +0 -2
  167. package/lib-es/__tests__/bridge/prepareTransaction.test.d.ts.map +0 -1
  168. package/lib-es/__tests__/bridge/prepareTransaction.test.js +0 -234
  169. package/lib-es/__tests__/bridge/prepareTransaction.test.js.map +0 -1
  170. package/lib-es/bridge/fixtures.d.ts +0 -36
  171. package/lib-es/bridge/fixtures.d.ts.map +0 -1
  172. package/lib-es/bridge/fixtures.js +0 -89
  173. package/lib-es/bridge/fixtures.js.map +0 -1
  174. package/lib-es/constants.d.ts +0 -6
  175. package/lib-es/constants.d.ts.map +0 -1
  176. package/lib-es/constants.js +0 -11
  177. package/lib-es/constants.js.map +0 -1
  178. package/src/__tests__/bridge/buildOptimisticOperation.test.ts +0 -29
  179. package/src/__tests__/bridge/buildTransaction.test.ts +0 -502
  180. package/src/__tests__/bridge/createTransaction.test.ts +0 -17
  181. package/src/__tests__/bridge/deviceTransactionConfig.test.ts +0 -16
  182. package/src/__tests__/bridge/estimateMaxSpendable.test.ts +0 -112
  183. package/src/__tests__/bridge/getFeesForTransaction.test.ts +0 -233
  184. package/src/__tests__/bridge/getTransactionStatus.test.ts +0 -261
  185. package/src/__tests__/bridge/logic.test.ts +0 -538
  186. package/src/__tests__/bridge/prepareTransaction.test.ts +0 -261
  187. package/src/bridge/fixtures.ts +0 -103
  188. package/src/constants.ts +0 -15
@@ -1,261 +0,0 @@
1
- import BigNumber from "bignumber.js";
2
- import {
3
- accountFixture,
4
- accountWithTokenAccountFixture,
5
- tokenTransactionFixture,
6
- transactionFixture,
7
- } from "../../bridge/fixtures";
8
- import prepareTransaction from "../../bridge/prepareTransaction";
9
-
10
- const chainIdMock = jest.fn();
11
- const nonceMock = jest.fn();
12
-
13
- jest.mock("../../network/sdk", () => {
14
- return {
15
- celoKit: jest.fn(() => ({
16
- contracts: {
17
- getLockedGold: jest.fn(async () => ({
18
- address: "address",
19
- lock: jest.fn(() => ({
20
- txo: {
21
- encodeABI: jest.fn(() => "0x6C6F636B5F64617461"), // lock_data
22
- estimateGas: jest.fn(async () => 2),
23
- },
24
- })),
25
- unlock: jest.fn(() => ({
26
- txo: {
27
- encodeABI: jest.fn(() => "0x756E6C6F636B5F64617461"), // unlock_data
28
- estimateGas: jest.fn(async () => 3),
29
- },
30
- })),
31
- withdraw: jest.fn(() => ({
32
- txo: {
33
- encodeABI: jest.fn(() => "0x77697468647261775F64617461"), // withdraw_data
34
- estimateGas: jest.fn(async () => 3),
35
- },
36
- })),
37
- vote: jest.fn(() => ({
38
- txo: {
39
- encodeABI: jest.fn(() => "0x766F74655F64617461"), // vote_data
40
- estimateGas: jest.fn(async () => 3),
41
- },
42
- })),
43
- getAccountNonvotingLockedGold: jest.fn(() => BigNumber(0)),
44
- })),
45
- getGoldToken: jest.fn(async () => ({
46
- address: "gold_token_address",
47
- transfer: jest.fn(() => ({
48
- txo: {
49
- encodeABI: jest.fn(() => "0x73656E645F64617461"), // send_data
50
- },
51
- })),
52
- })),
53
- getStableToken: jest.fn(async () => ({
54
- address: "stable_token_address",
55
- transfer: jest.fn(() => ({
56
- txo: {
57
- encodeABI: jest.fn(() => "0x73656E645F746F6B656E5F64617461"), // stable_token_data
58
- },
59
- })),
60
- })),
61
- getErc20: jest.fn(async () => ({
62
- address: "erc20_token_address",
63
- transfer: jest.fn(() => ({
64
- txo: {
65
- encodeABI: jest.fn(() => "0x73656E645F65726332305F746F6B656E5F64617461"), // send_erc20_token_data
66
- },
67
- })),
68
- })),
69
- },
70
- connection: {
71
- chainId: chainIdMock,
72
- nonce: nonceMock,
73
- estimateGasWithInflationFactor: jest.fn().mockReturnValue(3),
74
- gasPrice: jest.fn(async () => BigNumber(2)),
75
- web3: { eth: { getBlock: jest.fn().mockResolvedValue({ baseFeePerGas: 10 }) } },
76
- getMaxPriorityFeePerGas: jest.fn().mockResolvedValue(1),
77
- },
78
- })),
79
- };
80
- });
81
-
82
- describe("prepareTransaction", () => {
83
- it("should return the transaction if the address is invalid", async () => {
84
- const transaction = await prepareTransaction(accountFixture, transactionFixture);
85
- expect(transaction).toMatchObject({
86
- amount: BigNumber(10),
87
- recipient: "recipient",
88
- useAllAmount: false,
89
- family: "celo",
90
- mode: "send",
91
- index: 0,
92
- fees: null,
93
- });
94
- });
95
-
96
- it("should return the transaction if it doesn't have a recipient", async () => {
97
- const transaction = await prepareTransaction(accountFixture, {
98
- ...transactionFixture,
99
- recipient: "",
100
- });
101
- expect(transaction).toMatchObject({
102
- amount: BigNumber(10),
103
- recipient: "",
104
- useAllAmount: false,
105
- family: "celo",
106
- mode: "send",
107
- index: 0,
108
- fees: null,
109
- });
110
- });
111
-
112
- it("should return the vote transaction if it doesn't have a recipient", async () => {
113
- const transaction = await prepareTransaction(accountFixture, {
114
- ...transactionFixture,
115
- recipient: "",
116
- mode: "vote",
117
- });
118
- expect(transaction).toMatchObject({
119
- amount: BigNumber(10),
120
- recipient: "",
121
- useAllAmount: false,
122
- family: "celo",
123
- mode: "vote",
124
- index: 0,
125
- fees: null,
126
- });
127
- });
128
-
129
- it("should return the vote transaction if the amount is less than or equal to zero", async () => {
130
- const transaction = await prepareTransaction(accountFixture, {
131
- ...transactionFixture,
132
- recipient: "0x79D5A290D7ba4b99322d91b577589e8d0BF87072",
133
- mode: "vote",
134
- amount: BigNumber(0),
135
- });
136
- expect(transaction).toMatchObject({
137
- amount: BigNumber(0),
138
- recipient: "0x79D5A290D7ba4b99322d91b577589e8d0BF87072",
139
- useAllAmount: false,
140
- family: "celo",
141
- mode: "vote",
142
- index: 0,
143
- fees: null,
144
- });
145
- });
146
-
147
- it("should return the prepared transaction", async () => {
148
- const transaction = await prepareTransaction(
149
- { ...accountFixture, balance: BigNumber(222222), spendableBalance: BigNumber(222222) },
150
- {
151
- ...transactionFixture,
152
- recipient: "0x79D5A290D7ba4b99322d91b577589e8d0BF87072",
153
- amount: BigNumber(22),
154
- },
155
- );
156
- expect(transaction).toMatchObject({
157
- amount: BigNumber(22),
158
- recipient: "0x79D5A290D7ba4b99322d91b577589e8d0BF87072",
159
- useAllAmount: false,
160
- family: "celo",
161
- mode: "send",
162
- index: 0,
163
- fees: BigNumber(24),
164
- });
165
- });
166
-
167
- it("should return the prepared stable token transaction", async () => {
168
- const transaction = await prepareTransaction(
169
- {
170
- ...accountWithTokenAccountFixture,
171
- balance: BigNumber(222222),
172
- spendableBalance: BigNumber(222222),
173
- subAccounts: [
174
- {
175
- ...accountWithTokenAccountFixture.subAccounts[0],
176
- token: {
177
- ...accountWithTokenAccountFixture.subAccounts[0].token,
178
- id: "cEUR",
179
- },
180
- },
181
- ],
182
- },
183
- {
184
- ...tokenTransactionFixture,
185
- recipient: "0x79D5A290D7ba4b99322d91b577589e8d0BF87072",
186
- amount: BigNumber(22),
187
- },
188
- );
189
- expect(transaction).toMatchObject({
190
- amount: BigNumber(22),
191
- recipient: "0x79D5A290D7ba4b99322d91b577589e8d0BF87072",
192
- useAllAmount: false,
193
- family: "celo",
194
- mode: "send",
195
- index: 0,
196
- fees: BigNumber(24),
197
- subAccountId: "subAccountId",
198
- maxFeePerGas: "1000000010",
199
- maxPriorityFeePerGas: 1,
200
- data: Buffer.from("0x73656E645F746F6B656E5F64617461"),
201
- });
202
- });
203
-
204
- it("should return the prepared token transaction", async () => {
205
- const transaction = await prepareTransaction(
206
- {
207
- ...accountWithTokenAccountFixture,
208
- balance: BigNumber(222222),
209
- spendableBalance: BigNumber(222222),
210
- },
211
- {
212
- ...tokenTransactionFixture,
213
- recipient: "0x79D5A290D7ba4b99322d91b577589e8d0BF87072",
214
- amount: BigNumber(22),
215
- },
216
- );
217
- expect(transaction).toMatchObject({
218
- amount: BigNumber(22),
219
- recipient: "0x79D5A290D7ba4b99322d91b577589e8d0BF87072",
220
- useAllAmount: false,
221
- family: "celo",
222
- mode: "send",
223
- index: 0,
224
- fees: BigNumber(24),
225
- subAccountId: "subAccountId",
226
- maxFeePerGas: "1000000010",
227
- maxPriorityFeePerGas: 1,
228
- data: Buffer.from("0x73656E645F65726332305F746F6B656E5F64617461"),
229
- });
230
- });
231
-
232
- it("should return the prepared token transaction with useAllAmount", async () => {
233
- const transaction = await prepareTransaction(
234
- {
235
- ...accountWithTokenAccountFixture,
236
- balance: BigNumber(222222),
237
- spendableBalance: BigNumber(222222),
238
- },
239
- {
240
- ...tokenTransactionFixture,
241
- recipient: "0x79D5A290D7ba4b99322d91b577589e8d0BF87072",
242
- amount: BigNumber(22),
243
- useAllAmount: true,
244
- },
245
- );
246
-
247
- expect(transaction).toMatchObject({
248
- amount: BigNumber(212),
249
- recipient: "0x79D5A290D7ba4b99322d91b577589e8d0BF87072",
250
- useAllAmount: true,
251
- family: "celo",
252
- mode: "send",
253
- index: 0,
254
- fees: BigNumber(24),
255
- subAccountId: "subAccountId",
256
- maxFeePerGas: "1000000010",
257
- maxPriorityFeePerGas: 1,
258
- data: Buffer.from("0x73656E645F65726332305F746F6B656E5F64617461"),
259
- });
260
- });
261
- });
@@ -1,103 +0,0 @@
1
- import { CeloAccount, Transaction } from "../types";
2
- import { emptyHistoryCache } from "@ledgerhq/coin-framework/account/index";
3
- import { getCryptoCurrencyById } from "@ledgerhq/cryptoassets/lib/currencies";
4
- import BigNumber from "bignumber.js";
5
- import { faker } from "@faker-js/faker";
6
- import { TokenCurrency } from "@ledgerhq/types-cryptoassets";
7
- import { TokenAccount } from "@ledgerhq/types-live";
8
-
9
- const currency = getCryptoCurrencyById("celo");
10
-
11
- const accountFixture: CeloAccount = {
12
- type: "Account",
13
- id: faker.string.uuid(),
14
- seedIdentifier: faker.string.uuid(),
15
- derivationMode: "",
16
- index: faker.number.int(),
17
- freshAddress: "address",
18
- freshAddressPath: "derivationPath",
19
- used: true,
20
- balance: new BigNumber(0),
21
- spendableBalance: new BigNumber(0),
22
- creationDate: faker.date.past(),
23
- blockHeight: faker.number.int({ min: 100_000, max: 200_000 }),
24
- currency,
25
- operationsCount: 0,
26
- operations: [],
27
- pendingOperations: [],
28
- lastSyncDate: new Date(),
29
- balanceHistoryCache: emptyHistoryCache,
30
- swapHistory: [],
31
- celoResources: {
32
- registrationStatus: false,
33
- lockedBalance: BigNumber(0),
34
- nonvotingLockedBalance: BigNumber(0),
35
- pendingWithdrawals: null,
36
- votes: null,
37
- electionAddress: null,
38
- lockedGoldAddress: null,
39
- maxNumGroupsVotedFor: BigNumber(0),
40
- },
41
- };
42
-
43
- const subAccounts = [
44
- {
45
- id: "subAccountId",
46
- type: "TokenAccount",
47
- parentId: accountFixture.id,
48
- token: {
49
- type: "TokenCurrency",
50
- id: "celoToken",
51
- contractAddress: "contract_address",
52
- parentCurrency: currency,
53
- } as TokenCurrency,
54
- balance: BigNumber(212),
55
- spendableBalance: BigNumber(212),
56
- creationDate: faker.date.past(),
57
- operationsCount: 0,
58
- operations: [],
59
- pendingOperations: [],
60
- balanceHistoryCache: {
61
- HOUR: {
62
- latestDate: null,
63
- balances: [],
64
- },
65
- DAY: {
66
- latestDate: null,
67
- balances: [],
68
- },
69
- WEEK: {
70
- latestDate: null,
71
- balances: [],
72
- },
73
- },
74
- swapHistory: [],
75
- },
76
- ] as TokenAccount[];
77
-
78
- const accountWithTokenAccountFixture = {
79
- ...accountFixture,
80
- subAccounts,
81
- };
82
-
83
- const transactionFixture: Transaction = {
84
- amount: new BigNumber(10),
85
- recipient: "recipient",
86
- useAllAmount: false,
87
- family: "celo",
88
- mode: "send",
89
- index: 0,
90
- fees: null,
91
- };
92
-
93
- const tokenTransactionFixture: Transaction = {
94
- ...transactionFixture,
95
- subAccountId: "subAccountId",
96
- };
97
-
98
- export {
99
- accountFixture,
100
- accountWithTokenAccountFixture,
101
- transactionFixture,
102
- tokenTransactionFixture,
103
- };
package/src/constants.ts DELETED
@@ -1,15 +0,0 @@
1
- import { StableToken } from "@celo/contractkit";
2
-
3
- const CELO_STAKE_TOKENS_PAIR: Record<string, StableToken> = {
4
- cEUR: StableToken.cEUR,
5
- cREAL: StableToken.cREAL,
6
- cUSD: StableToken.cUSD,
7
- };
8
-
9
- export const CELO_STABLE_TOKENS = Object.keys(CELO_STAKE_TOKENS_PAIR);
10
-
11
- export const getStableTokenEnum = (tokenTicker: string): StableToken =>
12
- CELO_STAKE_TOKENS_PAIR[tokenTicker];
13
-
14
- export const MAX_PRIORITY_FEE_PER_GAS = 1_000_000_000n;
15
- export const MAX_FEES_THRESHOLD_MULTIPLIER = 4;