@ledgerhq/coin-tezos 6.6.0 → 6.7.0-nightly.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 (335) hide show
  1. package/.unimportedrc.json +4 -30
  2. package/CHANGELOG.md +15 -0
  3. package/jest.integ.config.js +1 -0
  4. package/lib/api/index.d.ts.map +1 -1
  5. package/lib/api/index.integ.test.js +6 -0
  6. package/lib/api/index.integ.test.js.map +1 -1
  7. package/lib/api/index.js +221 -40
  8. package/lib/api/index.js.map +1 -1
  9. package/lib/api/index.test.js +84 -10
  10. package/lib/api/index.test.js.map +1 -1
  11. package/lib/api/types.d.ts +7 -6
  12. package/lib/api/types.d.ts.map +1 -1
  13. package/lib/config.d.ts +4 -3
  14. package/lib/config.d.ts.map +1 -1
  15. package/lib/config.js.map +1 -1
  16. package/lib/index.d.ts +1 -1
  17. package/lib/index.d.ts.map +1 -1
  18. package/lib/index.js +1 -3
  19. package/lib/index.js.map +1 -1
  20. package/lib/logic/craftTransaction.d.ts.map +1 -1
  21. package/lib/logic/craftTransaction.js +7 -0
  22. package/lib/logic/craftTransaction.js.map +1 -1
  23. package/lib/logic/craftTransaction.test.js +1 -0
  24. package/lib/logic/craftTransaction.test.js.map +1 -1
  25. package/lib/logic/estimateFees.d.ts.map +1 -1
  26. package/lib/logic/estimateFees.integ.test.js +8 -2
  27. package/lib/logic/estimateFees.integ.test.js.map +1 -1
  28. package/lib/logic/estimateFees.js +119 -45
  29. package/lib/logic/estimateFees.js.map +1 -1
  30. package/lib/logic/getBalance.js +1 -1
  31. package/lib/logic/getBalance.js.map +1 -1
  32. package/lib/logic/getStakes.d.ts +3 -0
  33. package/lib/logic/getStakes.d.ts.map +1 -0
  34. package/lib/logic/getStakes.js +26 -0
  35. package/lib/logic/getStakes.js.map +1 -0
  36. package/lib/logic/getStakes.test.d.ts +2 -0
  37. package/lib/logic/getStakes.test.d.ts.map +1 -0
  38. package/lib/logic/getStakes.test.js +133 -0
  39. package/lib/logic/getStakes.test.js.map +1 -0
  40. package/lib/logic/index.d.ts +2 -0
  41. package/lib/logic/index.d.ts.map +1 -1
  42. package/lib/logic/index.js +5 -1
  43. package/lib/logic/index.js.map +1 -1
  44. package/lib/logic/listOperations.d.ts.map +1 -1
  45. package/lib/logic/listOperations.js +69 -11
  46. package/lib/logic/listOperations.js.map +1 -1
  47. package/lib/logic/listOperations.test.js +14 -10
  48. package/lib/logic/listOperations.test.js.map +1 -1
  49. package/lib/logic/validateIntent.d.ts +3 -0
  50. package/lib/logic/validateIntent.d.ts.map +1 -0
  51. package/lib/logic/validateIntent.js +179 -0
  52. package/lib/logic/validateIntent.js.map +1 -0
  53. package/lib/logic/validateIntent.test.d.ts +2 -0
  54. package/lib/logic/validateIntent.test.d.ts.map +1 -0
  55. package/lib/logic/validateIntent.test.js +261 -0
  56. package/lib/logic/validateIntent.test.js.map +1 -0
  57. package/{lib-es/bridge → lib}/transaction.d.ts +1 -1
  58. package/lib/transaction.d.ts.map +1 -0
  59. package/lib/{bridge/transaction.js → transaction.js} +3 -3
  60. package/lib/transaction.js.map +1 -0
  61. package/lib/types/bridge.d.ts +3 -0
  62. package/lib/types/bridge.d.ts.map +1 -1
  63. package/lib/types/bridge.fixture.d.ts.map +1 -1
  64. package/lib/types/bridge.fixture.js +1 -0
  65. package/lib/types/bridge.fixture.js.map +1 -1
  66. package/lib/types/bridge.js.map +1 -1
  67. package/lib/utils.d.ts +50 -0
  68. package/lib/utils.d.ts.map +1 -0
  69. package/lib/utils.js +111 -0
  70. package/lib/utils.js.map +1 -0
  71. package/lib-es/api/index.d.ts.map +1 -1
  72. package/lib-es/api/index.integ.test.js +6 -0
  73. package/lib-es/api/index.integ.test.js.map +1 -1
  74. package/lib-es/api/index.js +222 -41
  75. package/lib-es/api/index.js.map +1 -1
  76. package/lib-es/api/index.test.js +84 -10
  77. package/lib-es/api/index.test.js.map +1 -1
  78. package/lib-es/api/types.d.ts +7 -6
  79. package/lib-es/api/types.d.ts.map +1 -1
  80. package/lib-es/config.d.ts +4 -3
  81. package/lib-es/config.d.ts.map +1 -1
  82. package/lib-es/config.js.map +1 -1
  83. package/lib-es/index.d.ts +1 -1
  84. package/lib-es/index.d.ts.map +1 -1
  85. package/lib-es/index.js +1 -1
  86. package/lib-es/index.js.map +1 -1
  87. package/lib-es/logic/craftTransaction.d.ts.map +1 -1
  88. package/lib-es/logic/craftTransaction.js +7 -0
  89. package/lib-es/logic/craftTransaction.js.map +1 -1
  90. package/lib-es/logic/craftTransaction.test.js +1 -0
  91. package/lib-es/logic/craftTransaction.test.js.map +1 -1
  92. package/lib-es/logic/estimateFees.d.ts.map +1 -1
  93. package/lib-es/logic/estimateFees.integ.test.js +8 -2
  94. package/lib-es/logic/estimateFees.integ.test.js.map +1 -1
  95. package/lib-es/logic/estimateFees.js +119 -45
  96. package/lib-es/logic/estimateFees.js.map +1 -1
  97. package/lib-es/logic/getBalance.js +1 -1
  98. package/lib-es/logic/getBalance.js.map +1 -1
  99. package/lib-es/logic/getStakes.d.ts +3 -0
  100. package/lib-es/logic/getStakes.d.ts.map +1 -0
  101. package/lib-es/logic/getStakes.js +20 -0
  102. package/lib-es/logic/getStakes.js.map +1 -0
  103. package/lib-es/logic/getStakes.test.d.ts +2 -0
  104. package/lib-es/logic/getStakes.test.d.ts.map +1 -0
  105. package/lib-es/logic/getStakes.test.js +128 -0
  106. package/lib-es/logic/getStakes.test.js.map +1 -0
  107. package/lib-es/logic/index.d.ts +2 -0
  108. package/lib-es/logic/index.d.ts.map +1 -1
  109. package/lib-es/logic/index.js +2 -0
  110. package/lib-es/logic/index.js.map +1 -1
  111. package/lib-es/logic/listOperations.d.ts.map +1 -1
  112. package/lib-es/logic/listOperations.js +69 -11
  113. package/lib-es/logic/listOperations.js.map +1 -1
  114. package/lib-es/logic/listOperations.test.js +14 -10
  115. package/lib-es/logic/listOperations.test.js.map +1 -1
  116. package/lib-es/logic/validateIntent.d.ts +3 -0
  117. package/lib-es/logic/validateIntent.d.ts.map +1 -0
  118. package/lib-es/logic/validateIntent.js +173 -0
  119. package/lib-es/logic/validateIntent.js.map +1 -0
  120. package/lib-es/logic/validateIntent.test.d.ts +2 -0
  121. package/lib-es/logic/validateIntent.test.d.ts.map +1 -0
  122. package/lib-es/logic/validateIntent.test.js +233 -0
  123. package/lib-es/logic/validateIntent.test.js.map +1 -0
  124. package/{lib/bridge → lib-es}/transaction.d.ts +1 -1
  125. package/lib-es/transaction.d.ts.map +1 -0
  126. package/lib-es/{bridge/transaction.js → transaction.js} +3 -3
  127. package/lib-es/transaction.js.map +1 -0
  128. package/lib-es/types/bridge.d.ts +3 -0
  129. package/lib-es/types/bridge.d.ts.map +1 -1
  130. package/lib-es/types/bridge.fixture.d.ts.map +1 -1
  131. package/lib-es/types/bridge.fixture.js +1 -0
  132. package/lib-es/types/bridge.fixture.js.map +1 -1
  133. package/lib-es/types/bridge.js.map +1 -1
  134. package/lib-es/utils.d.ts +50 -0
  135. package/lib-es/utils.d.ts.map +1 -0
  136. package/lib-es/utils.js +100 -0
  137. package/lib-es/utils.js.map +1 -0
  138. package/package.json +8 -11
  139. package/src/api/index.integ.test.ts +8 -1
  140. package/src/api/index.test.ts +93 -16
  141. package/src/api/index.ts +248 -55
  142. package/src/api/types.ts +11 -7
  143. package/src/config.ts +9 -2
  144. package/src/index.ts +1 -2
  145. package/src/logic/craftTransaction.test.ts +1 -0
  146. package/src/logic/craftTransaction.ts +8 -0
  147. package/src/logic/estimateFees.integ.test.ts +8 -2
  148. package/src/logic/estimateFees.ts +140 -49
  149. package/src/logic/getBalance.ts +1 -1
  150. package/src/logic/getStakes.test.ts +145 -0
  151. package/src/logic/getStakes.ts +20 -0
  152. package/src/logic/index.ts +2 -0
  153. package/src/logic/listOperations.test.ts +64 -54
  154. package/src/logic/listOperations.ts +70 -10
  155. package/src/logic/validateIntent.test.ts +274 -0
  156. package/src/logic/validateIntent.ts +207 -0
  157. package/src/{bridge/transaction.ts → transaction.ts} +4 -4
  158. package/src/types/bridge.fixture.ts +1 -0
  159. package/src/types/bridge.ts +6 -1
  160. package/src/utils.ts +111 -0
  161. package/lib/bridge/broadcast.d.ts +0 -4
  162. package/lib/bridge/broadcast.d.ts.map +0 -1
  163. package/lib/bridge/broadcast.js +0 -11
  164. package/lib/bridge/broadcast.js.map +0 -1
  165. package/lib/bridge/broadcast.test.d.ts +0 -2
  166. package/lib/bridge/broadcast.test.d.ts.map +0 -1
  167. package/lib/bridge/broadcast.test.js +0 -36
  168. package/lib/bridge/broadcast.test.js.map +0 -1
  169. package/lib/bridge/buildOptimisticOperation.d.ts +0 -4
  170. package/lib/bridge/buildOptimisticOperation.d.ts.map +0 -1
  171. package/lib/bridge/buildOptimisticOperation.js +0 -28
  172. package/lib/bridge/buildOptimisticOperation.js.map +0 -1
  173. package/lib/bridge/createTransaction.d.ts +0 -4
  174. package/lib/bridge/createTransaction.d.ts.map +0 -1
  175. package/lib/bridge/createTransaction.js +0 -24
  176. package/lib/bridge/createTransaction.js.map +0 -1
  177. package/lib/bridge/estimateMaxSpendable.d.ts +0 -5
  178. package/lib/bridge/estimateMaxSpendable.d.ts.map +0 -1
  179. package/lib/bridge/estimateMaxSpendable.js +0 -30
  180. package/lib/bridge/estimateMaxSpendable.js.map +0 -1
  181. package/lib/bridge/getFeesForTransaction.d.ts +0 -21
  182. package/lib/bridge/getFeesForTransaction.d.ts.map +0 -1
  183. package/lib/bridge/getFeesForTransaction.js +0 -39
  184. package/lib/bridge/getFeesForTransaction.js.map +0 -1
  185. package/lib/bridge/getTransactionStatus.d.ts +0 -4
  186. package/lib/bridge/getTransactionStatus.d.ts.map +0 -1
  187. package/lib/bridge/getTransactionStatus.js +0 -108
  188. package/lib/bridge/getTransactionStatus.js.map +0 -1
  189. package/lib/bridge/getTransactionStatus.test.d.ts +0 -2
  190. package/lib/bridge/getTransactionStatus.test.d.ts.map +0 -1
  191. package/lib/bridge/getTransactionStatus.test.js +0 -107
  192. package/lib/bridge/getTransactionStatus.test.js.map +0 -1
  193. package/lib/bridge/index.d.ts +0 -10
  194. package/lib/bridge/index.d.ts.map +0 -1
  195. package/lib/bridge/index.js +0 -59
  196. package/lib/bridge/index.js.map +0 -1
  197. package/lib/bridge/logic.d.ts +0 -10
  198. package/lib/bridge/logic.d.ts.map +0 -1
  199. package/lib/bridge/logic.js +0 -155
  200. package/lib/bridge/logic.js.map +0 -1
  201. package/lib/bridge/preload.d.ts +0 -9
  202. package/lib/bridge/preload.d.ts.map +0 -1
  203. package/lib/bridge/preload.js +0 -23
  204. package/lib/bridge/preload.js.map +0 -1
  205. package/lib/bridge/prepareTransaction.d.ts +0 -5
  206. package/lib/bridge/prepareTransaction.d.ts.map +0 -1
  207. package/lib/bridge/prepareTransaction.integ.test.d.ts +0 -2
  208. package/lib/bridge/prepareTransaction.integ.test.d.ts.map +0 -1
  209. package/lib/bridge/prepareTransaction.integ.test.js +0 -34
  210. package/lib/bridge/prepareTransaction.integ.test.js.map +0 -1
  211. package/lib/bridge/prepareTransaction.js +0 -57
  212. package/lib/bridge/prepareTransaction.js.map +0 -1
  213. package/lib/bridge/prepareTransaction.test.d.ts +0 -2
  214. package/lib/bridge/prepareTransaction.test.d.ts.map +0 -1
  215. package/lib/bridge/prepareTransaction.test.js +0 -178
  216. package/lib/bridge/prepareTransaction.test.js.map +0 -1
  217. package/lib/bridge/serialization.d.ts +0 -7
  218. package/lib/bridge/serialization.d.ts.map +0 -1
  219. package/lib/bridge/serialization.js +0 -26
  220. package/lib/bridge/serialization.js.map +0 -1
  221. package/lib/bridge/signOperation.d.ts +0 -16
  222. package/lib/bridge/signOperation.d.ts.map +0 -1
  223. package/lib/bridge/signOperation.js +0 -88
  224. package/lib/bridge/signOperation.js.map +0 -1
  225. package/lib/bridge/signOperation.test.d.ts +0 -2
  226. package/lib/bridge/signOperation.test.d.ts.map +0 -1
  227. package/lib/bridge/signOperation.test.js +0 -283
  228. package/lib/bridge/signOperation.test.js.map +0 -1
  229. package/lib/bridge/synchronization.d.ts +0 -5
  230. package/lib/bridge/synchronization.d.ts.map +0 -1
  231. package/lib/bridge/synchronization.integ.test.d.ts +0 -2
  232. package/lib/bridge/synchronization.integ.test.d.ts.map +0 -1
  233. package/lib/bridge/synchronization.integ.test.js +0 -32
  234. package/lib/bridge/synchronization.integ.test.js.map +0 -1
  235. package/lib/bridge/synchronization.js +0 -100
  236. package/lib/bridge/synchronization.js.map +0 -1
  237. package/lib/bridge/transaction.d.ts.map +0 -1
  238. package/lib/bridge/transaction.js.map +0 -1
  239. package/lib-es/bridge/broadcast.d.ts +0 -4
  240. package/lib-es/bridge/broadcast.d.ts.map +0 -1
  241. package/lib-es/bridge/broadcast.js +0 -7
  242. package/lib-es/bridge/broadcast.js.map +0 -1
  243. package/lib-es/bridge/broadcast.test.d.ts +0 -2
  244. package/lib-es/bridge/broadcast.test.d.ts.map +0 -1
  245. package/lib-es/bridge/broadcast.test.js +0 -31
  246. package/lib-es/bridge/broadcast.test.js.map +0 -1
  247. package/lib-es/bridge/buildOptimisticOperation.d.ts +0 -4
  248. package/lib-es/bridge/buildOptimisticOperation.d.ts.map +0 -1
  249. package/lib-es/bridge/buildOptimisticOperation.js +0 -21
  250. package/lib-es/bridge/buildOptimisticOperation.js.map +0 -1
  251. package/lib-es/bridge/createTransaction.d.ts +0 -4
  252. package/lib-es/bridge/createTransaction.d.ts.map +0 -1
  253. package/lib-es/bridge/createTransaction.js +0 -17
  254. package/lib-es/bridge/createTransaction.js.map +0 -1
  255. package/lib-es/bridge/estimateMaxSpendable.d.ts +0 -5
  256. package/lib-es/bridge/estimateMaxSpendable.d.ts.map +0 -1
  257. package/lib-es/bridge/estimateMaxSpendable.js +0 -23
  258. package/lib-es/bridge/estimateMaxSpendable.js.map +0 -1
  259. package/lib-es/bridge/getFeesForTransaction.d.ts +0 -21
  260. package/lib-es/bridge/getFeesForTransaction.d.ts.map +0 -1
  261. package/lib-es/bridge/getFeesForTransaction.js +0 -33
  262. package/lib-es/bridge/getFeesForTransaction.js.map +0 -1
  263. package/lib-es/bridge/getTransactionStatus.d.ts +0 -4
  264. package/lib-es/bridge/getTransactionStatus.d.ts.map +0 -1
  265. package/lib-es/bridge/getTransactionStatus.js +0 -101
  266. package/lib-es/bridge/getTransactionStatus.js.map +0 -1
  267. package/lib-es/bridge/getTransactionStatus.test.d.ts +0 -2
  268. package/lib-es/bridge/getTransactionStatus.test.d.ts.map +0 -1
  269. package/lib-es/bridge/getTransactionStatus.test.js +0 -102
  270. package/lib-es/bridge/getTransactionStatus.test.js.map +0 -1
  271. package/lib-es/bridge/index.d.ts +0 -10
  272. package/lib-es/bridge/index.d.ts.map +0 -1
  273. package/lib-es/bridge/index.js +0 -53
  274. package/lib-es/bridge/index.js.map +0 -1
  275. package/lib-es/bridge/logic.d.ts +0 -10
  276. package/lib-es/bridge/logic.d.ts.map +0 -1
  277. package/lib-es/bridge/logic.js +0 -145
  278. package/lib-es/bridge/logic.js.map +0 -1
  279. package/lib-es/bridge/preload.d.ts +0 -9
  280. package/lib-es/bridge/preload.d.ts.map +0 -1
  281. package/lib-es/bridge/preload.js +0 -17
  282. package/lib-es/bridge/preload.js.map +0 -1
  283. package/lib-es/bridge/prepareTransaction.d.ts +0 -5
  284. package/lib-es/bridge/prepareTransaction.d.ts.map +0 -1
  285. package/lib-es/bridge/prepareTransaction.integ.test.d.ts +0 -2
  286. package/lib-es/bridge/prepareTransaction.integ.test.d.ts.map +0 -1
  287. package/lib-es/bridge/prepareTransaction.integ.test.js +0 -29
  288. package/lib-es/bridge/prepareTransaction.integ.test.js.map +0 -1
  289. package/lib-es/bridge/prepareTransaction.js +0 -50
  290. package/lib-es/bridge/prepareTransaction.js.map +0 -1
  291. package/lib-es/bridge/prepareTransaction.test.d.ts +0 -2
  292. package/lib-es/bridge/prepareTransaction.test.d.ts.map +0 -1
  293. package/lib-es/bridge/prepareTransaction.test.js +0 -173
  294. package/lib-es/bridge/prepareTransaction.test.js.map +0 -1
  295. package/lib-es/bridge/serialization.d.ts +0 -7
  296. package/lib-es/bridge/serialization.d.ts.map +0 -1
  297. package/lib-es/bridge/serialization.js +0 -20
  298. package/lib-es/bridge/serialization.js.map +0 -1
  299. package/lib-es/bridge/signOperation.d.ts +0 -16
  300. package/lib-es/bridge/signOperation.d.ts.map +0 -1
  301. package/lib-es/bridge/signOperation.js +0 -83
  302. package/lib-es/bridge/signOperation.js.map +0 -1
  303. package/lib-es/bridge/signOperation.test.d.ts +0 -2
  304. package/lib-es/bridge/signOperation.test.d.ts.map +0 -1
  305. package/lib-es/bridge/signOperation.test.js +0 -255
  306. package/lib-es/bridge/signOperation.test.js.map +0 -1
  307. package/lib-es/bridge/synchronization.d.ts +0 -5
  308. package/lib-es/bridge/synchronization.d.ts.map +0 -1
  309. package/lib-es/bridge/synchronization.integ.test.d.ts +0 -2
  310. package/lib-es/bridge/synchronization.integ.test.d.ts.map +0 -1
  311. package/lib-es/bridge/synchronization.integ.test.js +0 -27
  312. package/lib-es/bridge/synchronization.integ.test.js.map +0 -1
  313. package/lib-es/bridge/synchronization.js +0 -70
  314. package/lib-es/bridge/synchronization.js.map +0 -1
  315. package/lib-es/bridge/transaction.d.ts.map +0 -1
  316. package/lib-es/bridge/transaction.js.map +0 -1
  317. package/src/bridge/broadcast.test.ts +0 -36
  318. package/src/bridge/broadcast.ts +0 -13
  319. package/src/bridge/buildOptimisticOperation.ts +0 -28
  320. package/src/bridge/createTransaction.ts +0 -19
  321. package/src/bridge/estimateMaxSpendable.ts +0 -37
  322. package/src/bridge/getFeesForTransaction.ts +0 -49
  323. package/src/bridge/getTransactionStatus.test.ts +0 -124
  324. package/src/bridge/getTransactionStatus.ts +0 -123
  325. package/src/bridge/index.ts +0 -74
  326. package/src/bridge/logic.ts +0 -171
  327. package/src/bridge/preload.ts +0 -18
  328. package/src/bridge/prepareTransaction.integ.test.ts +0 -35
  329. package/src/bridge/prepareTransaction.test.ts +0 -205
  330. package/src/bridge/prepareTransaction.ts +0 -69
  331. package/src/bridge/serialization.ts +0 -27
  332. package/src/bridge/signOperation.test.ts +0 -284
  333. package/src/bridge/signOperation.ts +0 -130
  334. package/src/bridge/synchronization.integ.test.ts +0 -33
  335. package/src/bridge/synchronization.ts +0 -100
@@ -2,7 +2,7 @@ import type { Operation } from "@ledgerhq/coin-framework/api/types";
2
2
  import type { APIAccount } from "../network/types";
3
3
  import networkApi from "../network/tzkt";
4
4
  import { createApi } from "./index";
5
- import type { TezosTransactionIntent } from "./types";
5
+ import { TransactionIntent } from "@ledgerhq/coin-framework/api/types";
6
6
 
7
7
  const DEFAULT_ESTIMATED_FEES = 300n;
8
8
  const DEFAULT_GAS_LIMIT = 30n;
@@ -24,11 +24,18 @@ jest.mock("../logic", () => ({
24
24
  rawEncode: () => Promise.resolve("tz1heMGVHQnx7ALDcDKqez8fan64Eyicw4DJ"),
25
25
  }));
26
26
 
27
- jest
28
- .spyOn(networkApi, "getAccountByAddress")
29
- .mockImplementation((_adress: string) =>
30
- Promise.resolve({ type: "user", balance: 1000 } as APIAccount),
31
- );
27
+ jest.spyOn(networkApi, "getAccountByAddress").mockResolvedValue({
28
+ type: "user",
29
+ balance: 1000,
30
+ revealed: true,
31
+ address: "tz1test",
32
+ publicKey: "edpktest",
33
+ counter: 0,
34
+ delegationLevel: 0,
35
+ delegationTime: "2021-01-01T00:00:00Z",
36
+ numTransactions: 0,
37
+ firstActivityTime: "2021-01-01T00:00:00Z",
38
+ } as APIAccount);
32
39
 
33
40
  const api = createApi({
34
41
  baker: {
@@ -94,12 +101,28 @@ describe("Testing craftTransaction function", () => {
94
101
  beforeEach(() => jest.clearAllMocks());
95
102
 
96
103
  it("should use estimated fees when user does not provide them for crafting a transaction ", async () => {
97
- logicEstimateFees.mockResolvedValue({ estimatedFees: DEFAULT_ESTIMATED_FEES });
98
- await api.craftTransaction({ type: "send", sender: {} } as TezosTransactionIntent);
104
+ logicEstimateFees.mockResolvedValue({
105
+ estimatedFees: DEFAULT_ESTIMATED_FEES,
106
+ gasLimit: DEFAULT_GAS_LIMIT,
107
+ storageLimit: DEFAULT_STORAGE_LIMIT,
108
+ });
109
+ await api.craftTransaction({
110
+ intentType: "transaction",
111
+ type: "send",
112
+ sender: "tz1test",
113
+ recipient: "tz1recipient",
114
+ amount: 1000n,
115
+ } as TransactionIntent);
99
116
  expect(logicEstimateFees).toHaveBeenCalledTimes(1);
100
117
  expect(logicCraftTransactionMock).toHaveBeenCalledWith(
101
- expect.any(Object),
102
- expect.objectContaining({ fee: { fees: DEFAULT_ESTIMATED_FEES.toString() } }),
118
+ expect.objectContaining({ address: "tz1test" }),
119
+ expect.objectContaining({
120
+ fee: expect.objectContaining({
121
+ fees: DEFAULT_ESTIMATED_FEES.toString(),
122
+ gasLimit: DEFAULT_GAS_LIMIT.toString(),
123
+ storageLimit: DEFAULT_STORAGE_LIMIT.toString(),
124
+ }),
125
+ }),
103
126
  );
104
127
  });
105
128
 
@@ -110,10 +133,23 @@ describe("Testing craftTransaction function", () => {
110
133
  estimatedFees: DEFAULT_ESTIMATED_FEES,
111
134
  gasLimit: DEFAULT_GAS_LIMIT,
112
135
  storageLimit: DEFAULT_STORAGE_LIMIT,
136
+ parameters: {
137
+ gasLimit: DEFAULT_GAS_LIMIT,
138
+ storageLimit: DEFAULT_STORAGE_LIMIT,
139
+ },
113
140
  });
114
- await api.craftTransaction({ type: "send", sender: {} } as TezosTransactionIntent, {
115
- value: customFees,
116
- });
141
+ await api.craftTransaction(
142
+ {
143
+ intentType: "transaction",
144
+ type: "send",
145
+ sender: "tz1test",
146
+ recipient: "tz1recipient",
147
+ amount: 1000n,
148
+ } as TransactionIntent,
149
+ {
150
+ value: customFees,
151
+ },
152
+ );
117
153
  expect(logicEstimateFees).toHaveBeenCalledTimes(1);
118
154
  expect(logicCraftTransactionMock).toHaveBeenCalledWith(
119
155
  expect.any(Object),
@@ -138,7 +174,13 @@ describe("Testing estimateFees function", () => {
138
174
  gasLimit: DEFAULT_GAS_LIMIT,
139
175
  storageLimit: DEFAULT_STORAGE_LIMIT,
140
176
  });
141
- const result = await api.estimateFees({ type: "send", sender: {} } as TezosTransactionIntent);
177
+ const result = await api.estimateFees({
178
+ intentType: "transaction",
179
+ type: "send",
180
+ sender: "tz1test",
181
+ recipient: "tz1recipient",
182
+ amount: 1000n,
183
+ } as TransactionIntent);
142
184
  expect(result).toEqual({
143
185
  value: DEFAULT_ESTIMATED_FEES,
144
186
  parameters: {
@@ -149,9 +191,44 @@ describe("Testing estimateFees function", () => {
149
191
  });
150
192
 
151
193
  it("should throw taquito errors", async () => {
152
- logicEstimateFees.mockResolvedValue({ taquitoError: "test" });
194
+ logicEstimateFees.mockResolvedValue({
195
+ estimatedFees: DEFAULT_ESTIMATED_FEES,
196
+ gasLimit: DEFAULT_GAS_LIMIT,
197
+ storageLimit: DEFAULT_STORAGE_LIMIT,
198
+ taquitoError: "test",
199
+ });
153
200
  await expect(
154
- api.estimateFees({ type: "send", sender: {} } as TezosTransactionIntent),
201
+ api.estimateFees({
202
+ intentType: "transaction",
203
+ type: "send",
204
+ sender: "tz1test",
205
+ recipient: "tz1recipient",
206
+ amount: 1000n,
207
+ } as TransactionIntent),
155
208
  ).rejects.toThrow("Fees estimation failed: test");
156
209
  });
210
+
211
+ it("should not throw for delegate.unchanged errors", async () => {
212
+ logicEstimateFees.mockResolvedValue({
213
+ estimatedFees: DEFAULT_ESTIMATED_FEES,
214
+ gasLimit: DEFAULT_GAS_LIMIT,
215
+ storageLimit: DEFAULT_STORAGE_LIMIT,
216
+ taquitoError: "proto.022-PsRiotum.delegate.unchanged",
217
+ });
218
+ const result = await api.estimateFees({
219
+ intentType: "staking",
220
+ type: "delegate",
221
+ sender: "tz1test",
222
+ recipient: "tz1validator",
223
+ amount: 0n,
224
+ } as TransactionIntent);
225
+
226
+ expect(result).toEqual({
227
+ value: DEFAULT_ESTIMATED_FEES,
228
+ parameters: {
229
+ gasLimit: DEFAULT_GAS_LIMIT,
230
+ storageLimit: DEFAULT_STORAGE_LIMIT,
231
+ },
232
+ });
233
+ });
157
234
  });
package/src/api/index.ts CHANGED
@@ -21,11 +21,22 @@ import {
21
21
  lastBlock,
22
22
  listOperations,
23
23
  rawEncode,
24
+ validateIntent,
25
+ getStakes,
24
26
  } from "../logic";
27
+ import { getTezosToolkit } from "../logic/tezosToolkit";
25
28
  import api from "../network/tzkt";
26
29
  import type { TezosApi, TezosFeeEstimation } from "./types";
27
- import { FeeEstimation, TransactionIntent } from "@ledgerhq/coin-framework/api/types";
28
- import { TezosOperationMode } from "../types";
30
+ import type { FeeEstimation, TransactionIntent } from "@ledgerhq/coin-framework/api/types";
31
+ import { RecommendUndelegation } from "@ledgerhq/errors";
32
+ import { validatePublicKey, ValidationResult, getPkhfromPk } from "@taquito/utils";
33
+ import { getRevealFee } from "@taquito/taquito";
34
+ import {
35
+ DUST_MARGIN_MUTEZ,
36
+ hasEmptyBalance,
37
+ mapIntentTypeToTezosMode,
38
+ normalizePublicKeyForAddress,
39
+ } from "../utils";
29
40
 
30
41
  export function createApi(config: TezosConfig): TezosApi {
31
42
  coinConfig.setCoinConfig(() => ({ ...config, status: { type: "active" } }));
@@ -34,35 +45,66 @@ export function createApi(config: TezosConfig): TezosApi {
34
45
  broadcast,
35
46
  combine,
36
47
  craftTransaction: craft,
48
+ craftRawTransaction: (
49
+ _transaction: string,
50
+ _sender: string,
51
+ _publicKey: string,
52
+ _sequence: number,
53
+ ): Promise<CraftedTransaction> => {
54
+ throw new Error("craftRawTransaction is not supported");
55
+ },
37
56
  estimateFees: estimate,
38
57
  getBalance: balance,
39
58
  lastBlock,
40
59
  listOperations: operations,
60
+ getStakes,
61
+ validateIntent,
62
+ // required by signer to compute next valid sequence/counter
63
+ getSequence: async (address: string) => {
64
+ const accountInfo = await api.getAccountByAddress(address);
65
+ return accountInfo.type === "user" ? accountInfo.counter + 1 : 0;
66
+ },
41
67
  getBlock(_height): Promise<Block> {
42
68
  throw new Error("getBlock is not supported");
43
69
  },
44
70
  getBlockInfo(_height: number): Promise<BlockInfo> {
45
71
  throw new Error("getBlockInfo is not supported");
46
72
  },
47
- getStakes(_address: string, _cursor?: Cursor): Promise<Page<Stake>> {
48
- throw new Error("getStakes is not supported");
49
- },
50
73
  getRewards(_address: string, _cursor?: Cursor): Promise<Page<Reward>> {
51
74
  throw new Error("getRewards is not supported");
52
75
  },
53
76
  };
54
77
  }
55
78
 
56
- function isTezosTransactionType(type: string): type is "send" | "delegate" | "undelegate" {
57
- return ["send", "delegate", "undelegate"].includes(type);
79
+ function isTezosTransactionType(
80
+ type: string,
81
+ ): type is "send" | "delegate" | "undelegate" | "stake" | "unstake" {
82
+ return ["send", "delegate", "undelegate", "stake", "unstake"].includes(type);
58
83
  }
59
84
 
60
85
  async function balance(address: string): Promise<Balance[]> {
61
86
  const value = await getBalance(address);
87
+ const accountInfo = await api.getAccountByAddress(address);
88
+ // tzkt returns `type: "empty"` for untouched accounts; legacy logic returns -1 in that case
89
+ // the generic bridge expects non-negative balances
90
+ const normalized = value < 0n ? 0n : value;
91
+ // include stake information so ui can reflect delegation on account page
92
+ const stake: Stake | undefined =
93
+ accountInfo.type === "user" && accountInfo.delegate?.address
94
+ ? {
95
+ uid: address,
96
+ address,
97
+ delegate: accountInfo.delegate.address,
98
+ state: "active",
99
+ asset: { type: "native" },
100
+ amount: BigInt(accountInfo.balance ?? 0),
101
+ }
102
+ : undefined;
62
103
  return [
63
104
  {
64
- value,
105
+ value: normalized,
65
106
  asset: { type: "native" },
107
+ stake,
66
108
  },
67
109
  ];
68
110
  }
@@ -75,64 +117,214 @@ async function craft(
75
117
  throw new IncorrectTypeError(transactionIntent.type);
76
118
  }
77
119
 
78
- // note that an estimation is always necessary to get gasLimit and storageLimit, if even using custom fees
79
- const fee = await estimate(transactionIntent).then(fees => ({
80
- fees: (customFees?.value ?? fees.value).toString(),
81
- gasLimit: fees.parameters?.gasLimit?.toString(),
82
- storageLimit: fees.parameters?.storageLimit?.toString(),
83
- }));
120
+ // Always estimate to get gasLimit/storageLimit
121
+ const estimation = await estimate(transactionIntent);
122
+ const fee = {
123
+ fees: (customFees?.value ?? estimation.value).toString(),
124
+ gasLimit: estimation.parameters?.gasLimit?.toString(),
125
+ storageLimit: estimation.parameters?.storageLimit?.toString(),
126
+ };
84
127
 
85
- const { contents } = await craftTransaction(
86
- { address: transactionIntent.sender },
87
- {
88
- type: transactionIntent.type,
89
- recipient: transactionIntent.recipient,
90
- amount: transactionIntent.amount,
91
- fee,
92
- },
93
- );
128
+ // Map generic staking intents to tezos modes
129
+ const mappedType = mapIntentTypeToTezosMode(transactionIntent.type);
94
130
 
95
- const tx = await rawEncode(contents);
131
+ // Guard: send max is incompatible with delegated accounts
132
+ let amountToUse = transactionIntent.amount;
133
+ if (mappedType === "send" && transactionIntent.useAllAmount) {
134
+ const senderInfo = await api.getAccountByAddress(transactionIntent.sender);
135
+ if (senderInfo.type === "user" && senderInfo.delegate?.address) {
136
+ throw new RecommendUndelegation();
137
+ }
138
+ if (senderInfo.type === "user") {
139
+ // Use the amount calculated by the estimation which includes proper buffers and adjustments
140
+ if (estimation.parameters?.amount !== undefined) {
141
+ amountToUse = estimation.parameters.amount;
142
+ } else {
143
+ // Fallback to the original calculation if estimation doesn't provide amount
144
+ const bal = BigInt(senderInfo.balance);
145
+ const feeBI = BigInt(fee.fees || "0");
146
+ const dustMargin = BigInt(DUST_MARGIN_MUTEZ);
147
+ const totalToDeduct = feeBI + dustMargin;
148
+ amountToUse = bal > totalToDeduct ? bal - totalToDeduct : 0n;
149
+ }
150
+ } else {
151
+ amountToUse = 0n;
152
+ }
153
+ }
154
+
155
+ const accountForCraft = {
156
+ address: transactionIntent.sender,
157
+ };
158
+ const senderApiAcc = await api.getAccountByAddress(transactionIntent.sender);
159
+ const needsReveal = senderApiAcc.type === "user" && !senderApiAcc.revealed;
160
+ const totalFee = Number(fee.fees || "0");
161
+
162
+ let txFee: number;
163
+ if (customFees) {
164
+ txFee = needsReveal ? Math.max(totalFee - getRevealFee(transactionIntent.sender), 0) : totalFee;
165
+ } else if (estimation.parameters?.txFee !== undefined) {
166
+ txFee = Number(estimation.parameters.txFee);
167
+ } else {
168
+ const calculatedTxFee = needsReveal
169
+ ? Math.max(totalFee - getRevealFee(transactionIntent.sender), 0)
170
+ : totalFee;
171
+ txFee = calculatedTxFee;
172
+ }
173
+
174
+ const txForCraft = {
175
+ type: mappedType,
176
+ recipient: transactionIntent.recipient,
177
+ amount: amountToUse,
178
+ fee: { ...fee, fees: txFee.toString() },
179
+ };
180
+ const publicKeyForCraft =
181
+ needsReveal && transactionIntent.senderPublicKey
182
+ ? (() => {
183
+ // Accept either base58 or hex from device, and map curve using sender address
184
+ let pk = transactionIntent.senderPublicKey;
185
+ if (validatePublicKey(pk) !== ValidationResult.VALID) {
186
+ pk = normalizePublicKeyForAddress(pk, transactionIntent.sender) || pk;
187
+ }
188
+ // Verify the public key matches the sender address to avoid inconsistent_hash
189
+ let isPublicKeyValid = false;
190
+ try {
191
+ const derived = getPkhfromPk(pk);
192
+ isPublicKeyValid = derived === transactionIntent.sender;
193
+ } catch {
194
+ // getPkhfromPk failed = will fallback to basic validation below
195
+ isPublicKeyValid = false;
196
+ }
96
197
 
198
+ if (!isPublicKeyValid) {
199
+ // If derivation failed/doesn't match, check if the key is atleast valid format
200
+ if (validatePublicKey(pk) !== ValidationResult.VALID) {
201
+ throw new Error("Unable to normalize sender public key");
202
+ }
203
+ }
204
+ return { publicKey: pk, publicKeyHash: transactionIntent.sender };
205
+ })()
206
+ : undefined;
207
+ const { contents } = await craftTransaction(accountForCraft, txForCraft, publicKeyForCraft);
208
+ const tx = await rawEncode(contents);
97
209
  return { transaction: tx };
98
210
  }
99
211
 
100
212
  async function estimate(transactionIntent: TransactionIntent): Promise<TezosFeeEstimation> {
213
+ // avoid taquito error when estimating a 0-amount transfer during input
214
+ const config = coinConfig.getCoinConfig();
215
+ if (
216
+ transactionIntent.type === "send" &&
217
+ transactionIntent.amount === 0n &&
218
+ !transactionIntent.useAllAmount
219
+ ) {
220
+ return {
221
+ value: BigInt(DUST_MARGIN_MUTEZ),
222
+ parameters: {
223
+ gasLimit: 10000n,
224
+ storageLimit: 300n,
225
+ amount: 0n,
226
+ txFee: BigInt(DUST_MARGIN_MUTEZ),
227
+ },
228
+ };
229
+ }
101
230
  const senderAccountInfo = await api.getAccountByAddress(transactionIntent.sender);
231
+ // If the sender is not a user account, return default estimation values
232
+ if (senderAccountInfo.type !== "user") {
233
+ return {
234
+ value: BigInt(DUST_MARGIN_MUTEZ),
235
+ parameters: {
236
+ gasLimit: 10000n,
237
+ storageLimit: 300n,
238
+ amount: 0n,
239
+ txFee: BigInt(DUST_MARGIN_MUTEZ),
240
+ },
241
+ };
242
+ }
102
243
 
103
- const {
104
- estimatedFees: value,
105
- gasLimit,
106
- storageLimit,
107
- taquitoError,
108
- } = await estimateFees({
109
- account: {
110
- address: transactionIntent.sender,
111
- revealed: senderAccountInfo.type === "user" && senderAccountInfo.revealed,
112
- balance: BigInt(senderAccountInfo.type === "user" ? senderAccountInfo.balance : 0),
113
- // NOTE: previously we checked for .sender.xpub
114
- xpub:
115
- transactionIntent.senderPublicKey ??
116
- (senderAccountInfo.type === "user" ? senderAccountInfo.publicKey : undefined),
117
- },
118
- transaction: {
119
- mode: transactionIntent.type as TezosOperationMode,
120
- recipient: transactionIntent.recipient,
121
- amount: transactionIntent.amount,
122
- },
123
- });
244
+ try {
245
+ const estimation = await estimateFees({
246
+ account: {
247
+ address: transactionIntent.sender,
248
+ revealed: senderAccountInfo.revealed,
249
+ balance: BigInt(senderAccountInfo.balance),
250
+ // try intent public key first and fallback to tzkt public key
251
+ xpub: transactionIntent.senderPublicKey ?? senderAccountInfo.publicKey,
252
+ },
253
+ transaction: {
254
+ // reuse the same mapping as craft
255
+ mode: mapIntentTypeToTezosMode(transactionIntent.type),
256
+ recipient: transactionIntent.recipient,
257
+ amount: transactionIntent.amount,
258
+ // legacy estimator needs this flag to pre-estimate fees
259
+ useAllAmount: !!transactionIntent.useAllAmount,
260
+ },
261
+ });
124
262
 
125
- if (taquitoError !== undefined) {
126
- throw new Error(`Fees estimation failed: ${taquitoError}`);
127
- }
263
+ if (
264
+ estimation.taquitoError &&
265
+ !estimation.taquitoError.includes("delegate.unchanged") &&
266
+ !estimation.taquitoError.includes("subtraction_underflow") &&
267
+ !estimation.taquitoError.includes("balance_too_low")
268
+ ) {
269
+ throw new Error(`Fees estimation failed: ${estimation.taquitoError}`);
270
+ }
128
271
 
129
- return {
130
- value,
131
- parameters: {
132
- gasLimit,
133
- storageLimit,
134
- },
135
- };
272
+ return {
273
+ value: estimation.estimatedFees,
274
+ parameters: {
275
+ gasLimit: estimation.gasLimit,
276
+ storageLimit: estimation.storageLimit,
277
+ amount: estimation.amount,
278
+ txFee: estimation.fees,
279
+ },
280
+ };
281
+ } catch (error: any) {
282
+ // Handle PublicKeyNotFoundError
283
+ if (error?.message?.includes("Public key not found")) {
284
+ const apiAccount = await api.getAccountByAddress(transactionIntent.recipient);
285
+ const storageLimit =
286
+ !hasEmptyBalance(apiAccount) || transactionIntent.type === "stake" ? 0n : 277n;
287
+
288
+ // Check if account needs reveal for proper fee calculation
289
+ const senderApiAcc = await api.getAccountByAddress(transactionIntent.sender);
290
+ const needsReveal = senderApiAcc.type === "user" && !senderApiAcc.revealed;
291
+
292
+ // Production-calibrated fallback fee when Taquito estimation fails (~388 mutez observed)
293
+ const DEFAULT_TX_FEE_FALLBACK = 388;
294
+ let baseTxFee: bigint;
295
+
296
+ try {
297
+ const toolkit = getTezosToolkit();
298
+ const simpleEstimate = await toolkit.estimate.transfer({
299
+ to: transactionIntent.recipient,
300
+ amount: Number(transactionIntent.amount),
301
+ mutez: true,
302
+ source: transactionIntent.sender,
303
+ });
304
+ // Use Taquito estimation, respecting minFees from config
305
+ baseTxFee = BigInt(Math.max(config.fees.minFees, simpleEstimate.suggestedFeeMutez));
306
+ } catch {
307
+ // Fallback to production-calibrated default if estimation fails
308
+ baseTxFee = BigInt(Math.max(DEFAULT_TX_FEE_FALLBACK, config.fees.minFees));
309
+ }
310
+
311
+ const revealFee = needsReveal ? BigInt(getRevealFee(transactionIntent.sender)) : 0n;
312
+ const totalFee = baseTxFee + revealFee;
313
+
314
+ return {
315
+ value: totalFee,
316
+ parameters: {
317
+ gasLimit: 10000n,
318
+ storageLimit,
319
+ amount: 0n,
320
+ txFee: baseTxFee,
321
+ },
322
+ };
323
+ } else {
324
+ // Re-throw other errors
325
+ throw error;
326
+ }
327
+ }
136
328
  }
137
329
 
138
330
  async function operations(
@@ -145,5 +337,6 @@ async function operations(
145
337
  sort: pagination.order === "asc" ? "Ascending" : "Descending",
146
338
  minHeight: pagination.minHeight,
147
339
  });
340
+
148
341
  return [operations, newNextCursor || ""];
149
342
  }
package/src/api/types.ts CHANGED
@@ -1,11 +1,15 @@
1
- import { AlpacaApi, FeeEstimation, TransactionIntent } from "@ledgerhq/coin-framework/api/types";
1
+ import type { Api, FeeEstimation } from "@ledgerhq/coin-framework/api/types";
2
2
 
3
- export type TezosFeeParameters = { gasLimit: bigint; storageLimit: bigint };
4
- export type TezosFeeEstimation = FeeEstimation;
3
+ export type TezosFeeParameters = {
4
+ gasLimit: bigint;
5
+ storageLimit: bigint;
6
+ amount?: bigint;
7
+ txFee?: bigint;
8
+ };
9
+ export type TezosFeeEstimation = FeeEstimation & {
10
+ parameters?: TezosFeeParameters & Record<string, unknown>;
11
+ };
5
12
 
6
13
  export type TezosSender = { address: string; xpub?: string };
7
- export type TezosTransactionIntent = TransactionIntent;
8
14
 
9
- export type TezosApi = AlpacaApi & {
10
- estimateFees: (transactionIntent: TezosTransactionIntent) => Promise<TezosFeeEstimation>;
11
- };
15
+ export type TezosApi = Api;
package/src/config.ts CHANGED
@@ -1,4 +1,8 @@
1
- import buildCoinConfig, { type CurrencyConfig } from "@ledgerhq/coin-framework/config";
1
+ import buildCoinConfig, {
2
+ type CoinConfig,
3
+ type CurrencyConfig,
4
+ } from "@ledgerhq/coin-framework/config";
5
+ import type { CryptoCurrency } from "@ledgerhq/types-cryptoassets";
2
6
 
3
7
  export type TezosConfig = {
4
8
  baker: {
@@ -22,6 +26,9 @@ export type TezosConfig = {
22
26
 
23
27
  export type TezosCoinConfig = CurrencyConfig & TezosConfig;
24
28
 
25
- const coinConfig = buildCoinConfig<TezosCoinConfig>();
29
+ const coinConfig: {
30
+ setCoinConfig: (config: CoinConfig<TezosCoinConfig>) => void;
31
+ getCoinConfig: (currency?: CryptoCurrency) => TezosCoinConfig;
32
+ } = buildCoinConfig<TezosCoinConfig>();
26
33
 
27
34
  export default coinConfig;
package/src/index.ts CHANGED
@@ -1,3 +1,2 @@
1
1
  export * from "./types";
2
-
3
- export { createBridges } from "./bridge/index";
2
+ export * from "./transaction";
@@ -21,6 +21,7 @@ describe("craftTransaction", () => {
21
21
  estimate: {
22
22
  reveal: jest.fn(),
23
23
  },
24
+ setProvider: jest.fn(),
24
25
  };
25
26
 
26
27
  beforeEach(() => {
@@ -3,6 +3,7 @@ import { getRevealFee } from "@taquito/taquito";
3
3
  import coinConfig from "../config";
4
4
  import { UnsupportedTransactionMode } from "../types/errors";
5
5
  import { getTezosToolkit } from "./tezosToolkit";
6
+ import { createMockSigner } from "../utils";
6
7
 
7
8
  export type TransactionFee = {
8
9
  fees?: string;
@@ -37,6 +38,13 @@ export async function craftTransaction(
37
38
 
38
39
  const tezosToolkit = getTezosToolkit();
39
40
 
41
+ // Configure signer for Taquito operations (same as in estimateFees)
42
+ if (publicKey) {
43
+ tezosToolkit.setProvider({
44
+ signer: createMockSigner(publicKey.publicKeyHash, publicKey.publicKey),
45
+ });
46
+ }
47
+
40
48
  const sourceData = await tezosToolkit.rpc.getContract(address);
41
49
  const counter = account.counter ?? Number(sourceData.counter);
42
50
 
@@ -22,7 +22,10 @@ describe("estimateFees", () => {
22
22
  },
23
23
  ];
24
24
 
25
- it.each(accounts)("returns correct value", async account => {
25
+ it.each([
26
+ [accounts[0], "with xpub"],
27
+ [accounts[1], "without xpub"],
28
+ ])("returns correct value %s", async (account, _description) => {
26
29
  // Given
27
30
  const transaction = {
28
31
  mode: "send",
@@ -42,7 +45,10 @@ describe("estimateFees", () => {
42
45
  });
43
46
  });
44
47
 
45
- it.each(accounts)("returns correct value when useAllAmount", async account => {
48
+ it.each([
49
+ [accounts[0], "with xpub"],
50
+ [accounts[1], "without xpub"],
51
+ ])("returns correct value when useAllAmount %s", async (account, _description) => {
46
52
  // Given
47
53
  const transaction = {
48
54
  mode: "send",