@ledgerhq/coin-tezos 0.4.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 (325) hide show
  1. package/.eslintrc.js +20 -0
  2. package/.turbo/turbo-build.log +4 -0
  3. package/.unimportedrc.json +39 -0
  4. package/CHANGELOG.md +12 -0
  5. package/LICENSE.txt +21 -0
  6. package/jest.config.js +6 -0
  7. package/lib/api/bakers.d.ts +14 -0
  8. package/lib/api/bakers.d.ts.map +1 -0
  9. package/lib/api/bakers.integration.test.d.ts +2 -0
  10. package/lib/api/bakers.integration.test.d.ts.map +1 -0
  11. package/lib/api/bakers.integration.test.js +61 -0
  12. package/lib/api/bakers.integration.test.js.map +1 -0
  13. package/lib/api/bakers.js +141 -0
  14. package/lib/api/bakers.js.map +1 -0
  15. package/lib/api/bakers.test.d.ts +2 -0
  16. package/lib/api/bakers.test.d.ts.map +1 -0
  17. package/lib/api/bakers.test.js +146 -0
  18. package/lib/api/bakers.test.js.map +1 -0
  19. package/lib/api/bakers.whitelist-default.d.ts +4 -0
  20. package/lib/api/bakers.whitelist-default.d.ts.map +1 -0
  21. package/lib/api/bakers.whitelist-default.js +34 -0
  22. package/lib/api/bakers.whitelist-default.js.map +1 -0
  23. package/lib/api/index.d.ts +3 -0
  24. package/lib/api/index.d.ts.map +1 -0
  25. package/lib/api/index.js +19 -0
  26. package/lib/api/index.js.map +1 -0
  27. package/lib/api/tzkt.d.ts +81 -0
  28. package/lib/api/tzkt.d.ts.map +1 -0
  29. package/lib/api/tzkt.js +52 -0
  30. package/lib/api/tzkt.js.map +1 -0
  31. package/lib/bridge/broadcast.d.ts +6 -0
  32. package/lib/bridge/broadcast.d.ts.map +1 -0
  33. package/lib/bridge/broadcast.js +22 -0
  34. package/lib/bridge/broadcast.js.map +1 -0
  35. package/lib/bridge/broadcast.test.d.ts +2 -0
  36. package/lib/bridge/broadcast.test.d.ts.map +1 -0
  37. package/lib/bridge/broadcast.test.js +40 -0
  38. package/lib/bridge/broadcast.test.js.map +1 -0
  39. package/lib/bridge/createTransaction.d.ts +3 -0
  40. package/lib/bridge/createTransaction.d.ts.map +1 -0
  41. package/lib/bridge/createTransaction.js +23 -0
  42. package/lib/bridge/createTransaction.js.map +1 -0
  43. package/lib/bridge/deviceTransactionConfig.d.ts +19 -0
  44. package/lib/bridge/deviceTransactionConfig.d.ts.map +1 -0
  45. package/lib/bridge/deviceTransactionConfig.js +44 -0
  46. package/lib/bridge/deviceTransactionConfig.js.map +1 -0
  47. package/lib/bridge/estimateMaxSpendable.d.ts +10 -0
  48. package/lib/bridge/estimateMaxSpendable.d.ts.map +1 -0
  49. package/lib/bridge/estimateMaxSpendable.js +29 -0
  50. package/lib/bridge/estimateMaxSpendable.js.map +1 -0
  51. package/lib/bridge/getAccountShape.d.ts +5 -0
  52. package/lib/bridge/getAccountShape.d.ts.map +1 -0
  53. package/lib/bridge/getAccountShape.js +253 -0
  54. package/lib/bridge/getAccountShape.js.map +1 -0
  55. package/lib/bridge/getAccountShape.test.d.ts +2 -0
  56. package/lib/bridge/getAccountShape.test.d.ts.map +1 -0
  57. package/lib/bridge/getAccountShape.test.js +33 -0
  58. package/lib/bridge/getAccountShape.test.js.map +1 -0
  59. package/lib/bridge/index.d.ts +8 -0
  60. package/lib/bridge/index.d.ts.map +1 -0
  61. package/lib/bridge/index.js +58 -0
  62. package/lib/bridge/index.js.map +1 -0
  63. package/lib/bridge/preload.d.ts +9 -0
  64. package/lib/bridge/preload.d.ts.map +1 -0
  65. package/lib/bridge/preload.js +32 -0
  66. package/lib/bridge/preload.js.map +1 -0
  67. package/lib/bridge/prepareTransaction.d.ts +9 -0
  68. package/lib/bridge/prepareTransaction.d.ts.map +1 -0
  69. package/lib/bridge/prepareTransaction.js +157 -0
  70. package/lib/bridge/prepareTransaction.js.map +1 -0
  71. package/lib/bridge/serialization.d.ts +7 -0
  72. package/lib/bridge/serialization.d.ts.map +1 -0
  73. package/lib/bridge/serialization.js +27 -0
  74. package/lib/bridge/serialization.js.map +1 -0
  75. package/lib/bridge/signOperation.d.ts +19 -0
  76. package/lib/bridge/signOperation.d.ts.map +1 -0
  77. package/lib/bridge/signOperation.js +147 -0
  78. package/lib/bridge/signOperation.js.map +1 -0
  79. package/lib/bridge/signOperation.test.d.ts +2 -0
  80. package/lib/bridge/signOperation.test.d.ts.map +1 -0
  81. package/lib/bridge/signOperation.test.js +223 -0
  82. package/lib/bridge/signOperation.test.js.map +1 -0
  83. package/lib/bridge/transaction.d.ts +15 -0
  84. package/lib/bridge/transaction.d.ts.map +1 -0
  85. package/lib/bridge/transaction.js +52 -0
  86. package/lib/bridge/transaction.js.map +1 -0
  87. package/lib/bridge/transactionStatus.d.ts +3 -0
  88. package/lib/bridge/transactionStatus.d.ts.map +1 -0
  89. package/lib/bridge/transactionStatus.js +114 -0
  90. package/lib/bridge/transactionStatus.js.map +1 -0
  91. package/lib/datasets/tezos.scanAccounts.1.d.ts +7 -0
  92. package/lib/datasets/tezos.scanAccounts.1.d.ts.map +1 -0
  93. package/lib/datasets/tezos.scanAccounts.1.js +38 -0
  94. package/lib/datasets/tezos.scanAccounts.1.js.map +1 -0
  95. package/lib/index.d.ts +3 -0
  96. package/lib/index.d.ts.map +1 -0
  97. package/lib/index.js +21 -0
  98. package/lib/index.js.map +1 -0
  99. package/lib/signer/getAddress.d.ts +6 -0
  100. package/lib/signer/getAddress.d.ts.map +1 -0
  101. package/lib/signer/getAddress.js +19 -0
  102. package/lib/signer/getAddress.js.map +1 -0
  103. package/lib/signer/index.d.ts +6 -0
  104. package/lib/signer/index.d.ts.map +1 -0
  105. package/lib/signer/index.js +11 -0
  106. package/lib/signer/index.js.map +1 -0
  107. package/lib/test/bot-deviceActions.d.ts +4 -0
  108. package/lib/test/bot-deviceActions.d.ts.map +1 -0
  109. package/lib/test/bot-deviceActions.js +74 -0
  110. package/lib/test/bot-deviceActions.js.map +1 -0
  111. package/lib/test/bot-specs.d.ts +7 -0
  112. package/lib/test/bot-specs.d.ts.map +1 -0
  113. package/lib/test/bot-specs.js +154 -0
  114. package/lib/test/bot-specs.js.map +1 -0
  115. package/lib/test/bridgeDatasetTest.d.ts +5 -0
  116. package/lib/test/bridgeDatasetTest.d.ts.map +1 -0
  117. package/lib/test/bridgeDatasetTest.js +99 -0
  118. package/lib/test/bridgeDatasetTest.js.map +1 -0
  119. package/lib/test/cli.d.ts +78 -0
  120. package/lib/test/cli.d.ts.map +1 -0
  121. package/lib/test/cli.js +97 -0
  122. package/lib/test/cli.js.map +1 -0
  123. package/lib/test/index.d.ts +2 -0
  124. package/lib/test/index.d.ts.map +1 -0
  125. package/lib/test/index.js +18 -0
  126. package/lib/test/index.js.map +1 -0
  127. package/lib/types/errors.d.ts +4 -0
  128. package/lib/types/errors.d.ts.map +1 -0
  129. package/lib/types/errors.js +6 -0
  130. package/lib/types/errors.js.map +1 -0
  131. package/lib/types/index.d.ts +4 -0
  132. package/lib/types/index.d.ts.map +1 -0
  133. package/lib/types/index.js +20 -0
  134. package/lib/types/index.js.map +1 -0
  135. package/lib/types/model.d.ts +92 -0
  136. package/lib/types/model.d.ts.map +1 -0
  137. package/lib/types/model.fixture.d.ts +5 -0
  138. package/lib/types/model.fixture.d.ts.map +1 -0
  139. package/lib/types/model.fixture.js +85 -0
  140. package/lib/types/model.fixture.js.map +1 -0
  141. package/lib/types/model.js +8 -0
  142. package/lib/types/model.js.map +1 -0
  143. package/lib/types/signer.d.ts +37 -0
  144. package/lib/types/signer.d.ts.map +1 -0
  145. package/lib/types/signer.js +3 -0
  146. package/lib/types/signer.js.map +1 -0
  147. package/lib-es/api/bakers.d.ts +14 -0
  148. package/lib-es/api/bakers.d.ts.map +1 -0
  149. package/lib-es/api/bakers.integration.test.d.ts +2 -0
  150. package/lib-es/api/bakers.integration.test.d.ts.map +1 -0
  151. package/lib-es/api/bakers.integration.test.js +56 -0
  152. package/lib-es/api/bakers.integration.test.js.map +1 -0
  153. package/lib-es/api/bakers.js +125 -0
  154. package/lib-es/api/bakers.js.map +1 -0
  155. package/lib-es/api/bakers.test.d.ts +2 -0
  156. package/lib-es/api/bakers.test.d.ts.map +1 -0
  157. package/lib-es/api/bakers.test.js +141 -0
  158. package/lib-es/api/bakers.test.js.map +1 -0
  159. package/lib-es/api/bakers.whitelist-default.d.ts +4 -0
  160. package/lib-es/api/bakers.whitelist-default.d.ts.map +1 -0
  161. package/lib-es/api/bakers.whitelist-default.js +31 -0
  162. package/lib-es/api/bakers.whitelist-default.js.map +1 -0
  163. package/lib-es/api/index.d.ts +3 -0
  164. package/lib-es/api/index.d.ts.map +1 -0
  165. package/lib-es/api/index.js +3 -0
  166. package/lib-es/api/index.js.map +1 -0
  167. package/lib-es/api/tzkt.d.ts +81 -0
  168. package/lib-es/api/tzkt.d.ts.map +1 -0
  169. package/lib-es/api/tzkt.js +47 -0
  170. package/lib-es/api/tzkt.js.map +1 -0
  171. package/lib-es/bridge/broadcast.d.ts +6 -0
  172. package/lib-es/bridge/broadcast.d.ts.map +1 -0
  173. package/lib-es/bridge/broadcast.js +20 -0
  174. package/lib-es/bridge/broadcast.js.map +1 -0
  175. package/lib-es/bridge/broadcast.test.d.ts +2 -0
  176. package/lib-es/bridge/broadcast.test.d.ts.map +1 -0
  177. package/lib-es/bridge/broadcast.test.js +35 -0
  178. package/lib-es/bridge/broadcast.test.js.map +1 -0
  179. package/lib-es/bridge/createTransaction.d.ts +3 -0
  180. package/lib-es/bridge/createTransaction.d.ts.map +1 -0
  181. package/lib-es/bridge/createTransaction.js +17 -0
  182. package/lib-es/bridge/createTransaction.js.map +1 -0
  183. package/lib-es/bridge/deviceTransactionConfig.d.ts +19 -0
  184. package/lib-es/bridge/deviceTransactionConfig.d.ts.map +1 -0
  185. package/lib-es/bridge/deviceTransactionConfig.js +42 -0
  186. package/lib-es/bridge/deviceTransactionConfig.js.map +1 -0
  187. package/lib-es/bridge/estimateMaxSpendable.d.ts +10 -0
  188. package/lib-es/bridge/estimateMaxSpendable.d.ts.map +1 -0
  189. package/lib-es/bridge/estimateMaxSpendable.js +24 -0
  190. package/lib-es/bridge/estimateMaxSpendable.js.map +1 -0
  191. package/lib-es/bridge/getAccountShape.d.ts +5 -0
  192. package/lib-es/bridge/getAccountShape.d.ts.map +1 -0
  193. package/lib-es/bridge/getAccountShape.js +245 -0
  194. package/lib-es/bridge/getAccountShape.js.map +1 -0
  195. package/lib-es/bridge/getAccountShape.test.d.ts +2 -0
  196. package/lib-es/bridge/getAccountShape.test.d.ts.map +1 -0
  197. package/lib-es/bridge/getAccountShape.test.js +31 -0
  198. package/lib-es/bridge/getAccountShape.test.js.map +1 -0
  199. package/lib-es/bridge/index.d.ts +8 -0
  200. package/lib-es/bridge/index.d.ts.map +1 -0
  201. package/lib-es/bridge/index.js +51 -0
  202. package/lib-es/bridge/index.js.map +1 -0
  203. package/lib-es/bridge/preload.d.ts +9 -0
  204. package/lib-es/bridge/preload.d.ts.map +1 -0
  205. package/lib-es/bridge/preload.js +26 -0
  206. package/lib-es/bridge/preload.js.map +1 -0
  207. package/lib-es/bridge/prepareTransaction.d.ts +9 -0
  208. package/lib-es/bridge/prepareTransaction.d.ts.map +1 -0
  209. package/lib-es/bridge/prepareTransaction.js +150 -0
  210. package/lib-es/bridge/prepareTransaction.js.map +1 -0
  211. package/lib-es/bridge/serialization.d.ts +7 -0
  212. package/lib-es/bridge/serialization.d.ts.map +1 -0
  213. package/lib-es/bridge/serialization.js +20 -0
  214. package/lib-es/bridge/serialization.js.map +1 -0
  215. package/lib-es/bridge/signOperation.d.ts +19 -0
  216. package/lib-es/bridge/signOperation.d.ts.map +1 -0
  217. package/lib-es/bridge/signOperation.js +143 -0
  218. package/lib-es/bridge/signOperation.js.map +1 -0
  219. package/lib-es/bridge/signOperation.test.d.ts +2 -0
  220. package/lib-es/bridge/signOperation.test.d.ts.map +1 -0
  221. package/lib-es/bridge/signOperation.test.js +195 -0
  222. package/lib-es/bridge/signOperation.test.js.map +1 -0
  223. package/lib-es/bridge/transaction.d.ts +15 -0
  224. package/lib-es/bridge/transaction.d.ts.map +1 -0
  225. package/lib-es/bridge/transaction.js +46 -0
  226. package/lib-es/bridge/transaction.js.map +1 -0
  227. package/lib-es/bridge/transactionStatus.d.ts +3 -0
  228. package/lib-es/bridge/transactionStatus.d.ts.map +1 -0
  229. package/lib-es/bridge/transactionStatus.js +107 -0
  230. package/lib-es/bridge/transactionStatus.js.map +1 -0
  231. package/lib-es/datasets/tezos.scanAccounts.1.d.ts +7 -0
  232. package/lib-es/datasets/tezos.scanAccounts.1.d.ts.map +1 -0
  233. package/lib-es/datasets/tezos.scanAccounts.1.js +36 -0
  234. package/lib-es/datasets/tezos.scanAccounts.1.js.map +1 -0
  235. package/lib-es/index.d.ts +3 -0
  236. package/lib-es/index.d.ts.map +1 -0
  237. package/lib-es/index.js +3 -0
  238. package/lib-es/index.js.map +1 -0
  239. package/lib-es/signer/getAddress.d.ts +6 -0
  240. package/lib-es/signer/getAddress.d.ts.map +1 -0
  241. package/lib-es/signer/getAddress.js +17 -0
  242. package/lib-es/signer/getAddress.js.map +1 -0
  243. package/lib-es/signer/index.d.ts +6 -0
  244. package/lib-es/signer/index.d.ts.map +1 -0
  245. package/lib-es/signer/index.js +6 -0
  246. package/lib-es/signer/index.js.map +1 -0
  247. package/lib-es/test/bot-deviceActions.d.ts +4 -0
  248. package/lib-es/test/bot-deviceActions.d.ts.map +1 -0
  249. package/lib-es/test/bot-deviceActions.js +71 -0
  250. package/lib-es/test/bot-deviceActions.js.map +1 -0
  251. package/lib-es/test/bot-specs.d.ts +7 -0
  252. package/lib-es/test/bot-specs.d.ts.map +1 -0
  253. package/lib-es/test/bot-specs.js +149 -0
  254. package/lib-es/test/bot-specs.js.map +1 -0
  255. package/lib-es/test/bridgeDatasetTest.d.ts +5 -0
  256. package/lib-es/test/bridgeDatasetTest.d.ts.map +1 -0
  257. package/lib-es/test/bridgeDatasetTest.js +93 -0
  258. package/lib-es/test/bridgeDatasetTest.js.map +1 -0
  259. package/lib-es/test/cli.d.ts +78 -0
  260. package/lib-es/test/cli.d.ts.map +1 -0
  261. package/lib-es/test/cli.js +91 -0
  262. package/lib-es/test/cli.js.map +1 -0
  263. package/lib-es/test/index.d.ts +2 -0
  264. package/lib-es/test/index.d.ts.map +1 -0
  265. package/lib-es/test/index.js +2 -0
  266. package/lib-es/test/index.js.map +1 -0
  267. package/lib-es/types/errors.d.ts +4 -0
  268. package/lib-es/types/errors.d.ts.map +1 -0
  269. package/lib-es/types/errors.js +3 -0
  270. package/lib-es/types/errors.js.map +1 -0
  271. package/lib-es/types/index.d.ts +4 -0
  272. package/lib-es/types/index.d.ts.map +1 -0
  273. package/lib-es/types/index.js +4 -0
  274. package/lib-es/types/index.js.map +1 -0
  275. package/lib-es/types/model.d.ts +92 -0
  276. package/lib-es/types/model.d.ts.map +1 -0
  277. package/lib-es/types/model.fixture.d.ts +5 -0
  278. package/lib-es/types/model.fixture.d.ts.map +1 -0
  279. package/lib-es/types/model.fixture.js +76 -0
  280. package/lib-es/types/model.fixture.js.map +1 -0
  281. package/lib-es/types/model.js +4 -0
  282. package/lib-es/types/model.js.map +1 -0
  283. package/lib-es/types/signer.d.ts +37 -0
  284. package/lib-es/types/signer.d.ts.map +1 -0
  285. package/lib-es/types/signer.js +2 -0
  286. package/lib-es/types/signer.js.map +1 -0
  287. package/package.json +116 -0
  288. package/src/README.md +29 -0
  289. package/src/api/bakers.integration.test.ts +61 -0
  290. package/src/api/bakers.test.ts +140 -0
  291. package/src/api/bakers.ts +139 -0
  292. package/src/api/bakers.whitelist-default.ts +33 -0
  293. package/src/api/index.ts +2 -0
  294. package/src/api/tzkt.ts +112 -0
  295. package/src/bridge/broadcast.test.ts +30 -0
  296. package/src/bridge/broadcast.ts +18 -0
  297. package/src/bridge/createTransaction.ts +18 -0
  298. package/src/bridge/deviceTransactionConfig.ts +74 -0
  299. package/src/bridge/estimateMaxSpendable.ts +32 -0
  300. package/src/bridge/getAccountShape.test.ts +22 -0
  301. package/src/bridge/getAccountShape.ts +289 -0
  302. package/src/bridge/index.ts +65 -0
  303. package/src/bridge/preload.ts +18 -0
  304. package/src/bridge/prepareTransaction.ts +160 -0
  305. package/src/bridge/serialization.ts +27 -0
  306. package/src/bridge/signOperation.test.ts +211 -0
  307. package/src/bridge/signOperation.ts +213 -0
  308. package/src/bridge/transaction.ts +94 -0
  309. package/src/bridge/transactionStatus.ts +130 -0
  310. package/src/datasets/tezos.scanAccounts.1.ts +35 -0
  311. package/src/index.ts +3 -0
  312. package/src/signer/getAddress.ts +13 -0
  313. package/src/signer/index.ts +7 -0
  314. package/src/test/bot-deviceActions.ts +79 -0
  315. package/src/test/bot-specs.ts +152 -0
  316. package/src/test/bridgeDatasetTest.ts +132 -0
  317. package/src/test/cli.ts +137 -0
  318. package/src/test/index.ts +1 -0
  319. package/src/types/errors.ts +5 -0
  320. package/src/types/index.ts +3 -0
  321. package/src/types/model.fixture.ts +89 -0
  322. package/src/types/model.ts +123 -0
  323. package/src/types/signer.ts +48 -0
  324. package/tsconfig.json +13 -0
  325. package/types/@taquito/ledger-signer/index.d.ts +3 -0
package/package.json ADDED
@@ -0,0 +1,116 @@
1
+ {
2
+ "name": "@ledgerhq/coin-tezos",
3
+ "version": "0.4.0-nightly.0",
4
+ "description": "Tezos Coin integration",
5
+ "keywords": [
6
+ "Ledger",
7
+ "LedgerWallet",
8
+ "tezos",
9
+ "Tezos",
10
+ "Hardware Wallet"
11
+ ],
12
+ "repository": {
13
+ "type": "git",
14
+ "url": "https://github.com/LedgerHQ/ledger-live.git"
15
+ },
16
+ "bugs": {
17
+ "url": "https://github.com/LedgerHQ/ledger-live/issues"
18
+ },
19
+ "homepage": "https://github.com/LedgerHQ/ledger-live/tree/develop/libs/coin-modules/coin-tezos",
20
+ "publishConfig": {
21
+ "access": "public"
22
+ },
23
+ "typesVersions": {
24
+ "*": {
25
+ "lib/*": [
26
+ "lib/*"
27
+ ],
28
+ "lib-es/*": [
29
+ "lib-es/*"
30
+ ],
31
+ "specs": [
32
+ "lib/test/bot-specs"
33
+ ],
34
+ "*": [
35
+ "lib/*",
36
+ "lib/bridge/*",
37
+ "lib/signer/*",
38
+ "lib/test/*",
39
+ "lib/types/*"
40
+ ]
41
+ }
42
+ },
43
+ "exports": {
44
+ "./lib/*": "./lib/*.js",
45
+ "./lib-es/*": "./lib-es/*.js",
46
+ "./deviceTransactionConfig": {
47
+ "require": "./lib/bridge/deviceTransactionConfig.js",
48
+ "default": "./lib-es/bridge/deviceTransactionConfig.js"
49
+ },
50
+ "./errors": {
51
+ "require": "./lib/types/errors.js",
52
+ "default": "./lib-es/types/errors.js"
53
+ },
54
+ "./specs": {
55
+ "require": "./lib/test/bot-specs.js",
56
+ "default": "./lib-es/test/bot-specs.js"
57
+ },
58
+ "./transaction": {
59
+ "require": "./lib/bridge/transaction.js",
60
+ "default": "./lib-es/bridge/transaction.js"
61
+ },
62
+ "./*": {
63
+ "require": "./lib/*.js",
64
+ "default": "./lib-es/*.js"
65
+ },
66
+ "./package.json": "./package.json"
67
+ },
68
+ "license": "Apache-2.0",
69
+ "dependencies": {
70
+ "@taquito/ledger-signer": "^13.0.1",
71
+ "@taquito/rpc": "^13.0.1",
72
+ "@taquito/taquito": "^13.0.1",
73
+ "@taquito/utils": "^13.0.1",
74
+ "bignumber.js": "^9.1.2",
75
+ "blake2b": "^2.1.4",
76
+ "bs58check": "^2.1.2",
77
+ "invariant": "^2.2.2",
78
+ "lodash": "^4.17.21",
79
+ "rxjs": "^7.8.1",
80
+ "@ledgerhq/coin-framework": "^0.13.1-nightly.1",
81
+ "@ledgerhq/cryptoassets": "^13.1.0-nightly.0",
82
+ "@ledgerhq/devices": "^8.3.0",
83
+ "@ledgerhq/errors": "^6.16.4",
84
+ "@ledgerhq/live-env": "^2.0.2",
85
+ "@ledgerhq/live-network": "^1.2.2",
86
+ "@ledgerhq/logs": "^6.12.0",
87
+ "@ledgerhq/types-cryptoassets": "^7.12.0",
88
+ "@ledgerhq/types-live": "^6.47.0"
89
+ },
90
+ "devDependencies": {
91
+ "@faker-js/faker": "^8.4.1",
92
+ "@types/invariant": "^2.2.2",
93
+ "@types/jest": "^29.5.10",
94
+ "@types/lodash": "^4.14.191",
95
+ "@types/blake2b": "^2.1.3",
96
+ "@types/bs58check": "^2.1.0",
97
+ "jest": "^29.7.0",
98
+ "ts-jest": "^29.1.1"
99
+ },
100
+ "overrides": {
101
+ "@taquito/ledger-signer": {
102
+ "@ledgerhq/hw-transport": "../_EXCLUDED_"
103
+ }
104
+ },
105
+ "scripts": {
106
+ "clean": "rimraf lib lib-es",
107
+ "build": "tsc && tsc -m ES6 --outDir lib-es",
108
+ "prewatch": "pnpm build",
109
+ "watch": "tsc --watch",
110
+ "doc": "documentation readme src/** --section=API --pe ts --re ts --re d.ts",
111
+ "lint": "eslint ./src --no-error-on-unmatched-pattern --ext .ts,.tsx --cache",
112
+ "lint:fix": "pnpm lint --fix",
113
+ "test": "jest",
114
+ "unimported": "unimported"
115
+ }
116
+ }
package/src/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # Tezos integration
2
+
3
+ ## Status
4
+
5
+ This coin integration is being reworked from a C++ in-house implementation into a JavaScript integration.
6
+
7
+ ## Environment
8
+
9
+ Here is a quick summary of how this integration is made:
10
+
11
+ - Taquito library
12
+ - Ledger's self hosted tzkt.io API
13
+ - Ledger's own node
14
+
15
+ ## Account ID, public key and addresses
16
+
17
+ The account id have the shape `{impl}:{version}:{currency}:{pubkey}:{derivation}`
18
+
19
+ For instance: `js:2:tezos:02e9d3749ffd715be88b9bc9f1afd0470e66b867042d2862c61f335a76e4d37af0:tezbox`
20
+
21
+ The public key is the account main identifier, expressed as uncompress hex: `02e9d3749ffd715be88b9bc9f1afd0470e66b867042d2862c61f335a76e4d37af0`.
22
+
23
+ This public key is needed for making transaction and also is used to hash the account address. (`tz1PTxfn1fge2tJwGGpW9zNuYf6BseM3GJXt` in this case)
24
+
25
+ The Account type as defined in https://github.com/LedgerHQ/ledger-live/wiki/LLC:account will be used with:
26
+
27
+ - `.id` to be the id explained as above
28
+ - `.xpub` to be the public key
29
+ - `.freshAddress` to be the tezos account address
@@ -0,0 +1,61 @@
1
+ import { DerivationMode } from "@ledgerhq/types-live";
2
+ import { fromAccountRaw } from "@ledgerhq/coin-framework/serialization";
3
+ import { TezosAccountRaw } from "../types";
4
+ import { loadAccountDelegation, listBakers } from "../api/bakers";
5
+ import whitelist from "../api/bakers.whitelist-default";
6
+
7
+ function makeAccountRaw(
8
+ name: string,
9
+ pubkey: string,
10
+ address: string,
11
+ derivationMode: DerivationMode,
12
+ ): TezosAccountRaw {
13
+ return {
14
+ id: `js:2:tezos:${pubkey}:${derivationMode}`,
15
+ seedIdentifier: address,
16
+ name: "Tezos " + name,
17
+ derivationMode,
18
+ index: 0,
19
+ freshAddress: address,
20
+ freshAddressPath: "",
21
+ blockHeight: 0,
22
+ operations: [],
23
+ pendingOperations: [],
24
+ currencyId: "tezos",
25
+ lastSyncDate: "",
26
+ balance: "0",
27
+ xpub: pubkey,
28
+ subAccounts: [],
29
+ tezosResources: { revealed: true, counter: 0 },
30
+ };
31
+ }
32
+
33
+ const accountTZrevealedDelegating = makeAccountRaw(
34
+ "TZrevealedDelegating",
35
+ "02389ffd73423626894cb151416e51c72ec285376673daf83545eb5edb45b261ce",
36
+ "tz1boBHAVpwcvKkNFAQHYr7mjxAz1PpVgKq7",
37
+ "tezbox",
38
+ );
39
+
40
+ describe("tezos bakers", () => {
41
+ test("atleast 10 whitelisted bakers are online", async () => {
42
+ const bakers = await listBakers(whitelist);
43
+ const retrievedAddresses = bakers.map(o => o.address);
44
+ let available = 0;
45
+ for (const whitelisted of whitelist) {
46
+ if (retrievedAddresses.includes(whitelisted)) {
47
+ available++;
48
+ } else {
49
+ console.warn(`Baker ${whitelisted} no longer online !`);
50
+ }
51
+ }
52
+ expect(available).toBeGreaterThan(10);
53
+ });
54
+
55
+ // TODO we'll need two accounts to test diff cases
56
+ test("load account baker info", async () => {
57
+ const account = fromAccountRaw(accountTZrevealedDelegating);
58
+ const delegation = await loadAccountDelegation(account);
59
+ expect(delegation).toBe(null);
60
+ });
61
+ });
@@ -0,0 +1,140 @@
1
+ import network from "@ledgerhq/live-network/network";
2
+ import { API_BAKER } from "../types";
3
+ import { asBaker, cache } from "./bakers";
4
+
5
+ jest.mock("@ledgerhq/live-network/network");
6
+ const mockedNetwork = jest.mocked(network);
7
+
8
+ const data: API_BAKER[] = [
9
+ {
10
+ address: "tz1Kf25fX1VdmYGSEzwFy1wNmkbSEZ2V83sY",
11
+ name: "Tezos Seoul",
12
+ logo: "https://services.tzkt.io/v1/avatars/tz1Kf25fX1VdmYGSEzwFy1wNmkbSEZ2V83sY",
13
+ balance: 155309.245322,
14
+ stakingBalance: 1478612.577008,
15
+ stakingCapacity: 1500000,
16
+ maxStakingBalance: 1425000,
17
+ freeSpace: -53612.57700800011,
18
+ fee: 0.07,
19
+ minDelegation: 100,
20
+ payoutDelay: 6,
21
+ payoutPeriod: 1,
22
+ openForDelegation: true,
23
+ estimatedRoi: 0.056842,
24
+ serviceType: "tezos_only",
25
+ serviceHealth: "active",
26
+ payoutTiming: "stable",
27
+ payoutAccuracy: "precise",
28
+ audit: "5fa0308f48ca160f9901116a",
29
+ insuranceCoverage: 0,
30
+ },
31
+ {
32
+ address: "tz1gg5bjopPcr9agjamyu9BbXKLibNc2rbAq",
33
+ name: "hodl.farm",
34
+ logo: "https://services.tzkt.io/v1/avatars/tz1gg5bjopPcr9agjamyu9BbXKLibNc2rbAq",
35
+ balance: 33273.028666,
36
+ stakingBalance: 335991.478219,
37
+ stakingCapacity: 326500,
38
+ maxStakingBalance: 326500,
39
+ freeSpace: -9491.478218999982,
40
+ fee: 0.05,
41
+ minDelegation: 0,
42
+ payoutDelay: -5,
43
+ payoutPeriod: 1,
44
+ openForDelegation: true,
45
+ estimatedRoi: 0.056424,
46
+ serviceType: "tezos_only",
47
+ serviceHealth: "active",
48
+ payoutTiming: "stable",
49
+ payoutAccuracy: "inaccurate",
50
+ audit: "64bd3910d0970a602a90d497",
51
+ insuranceCoverage: 0,
52
+ },
53
+ {
54
+ address: "tz3LV9aGKHDnAZHCtC9SjNtTrKRu678FqSki",
55
+ name: "Ledger Live by Kiln",
56
+ logo: "https://services.tzkt.io/v1/avatars/tz3LV9aGKHDnAZHCtC9SjNtTrKRu678FqSki",
57
+ balance: 708166.216593,
58
+ stakingBalance: 708166.216593,
59
+ stakingCapacity: 7081662.16593,
60
+ maxStakingBalance: 7081662.16593,
61
+ freeSpace: 6373495.949337,
62
+ fee: 0.12,
63
+ minDelegation: 1,
64
+ payoutDelay: 1,
65
+ payoutPeriod: 1,
66
+ openForDelegation: true,
67
+ estimatedRoi: 0.053786,
68
+ serviceType: "tezos_only",
69
+ serviceHealth: "active",
70
+ payoutTiming: "no_data",
71
+ payoutAccuracy: "no_data",
72
+ insuranceCoverage: 0,
73
+ },
74
+ {
75
+ address: "tz1KwafrdmM8RwxUMxdbbtWyZuKLWSPVxe9u",
76
+ name: "Tezberry Pie",
77
+ logo: "https://services.tzkt.io/v1/avatars/tz1KwafrdmM8RwxUMxdbbtWyZuKLWSPVxe9u",
78
+ balance: 9048.905456,
79
+ stakingBalance: 66542.819025,
80
+ stakingCapacity: 72000,
81
+ maxStakingBalance: 72000,
82
+ freeSpace: 5457.180974999996,
83
+ fee: 0.12,
84
+ minDelegation: 10,
85
+ payoutDelay: 1,
86
+ payoutPeriod: 1,
87
+ openForDelegation: true,
88
+ estimatedRoi: 0.053786,
89
+ serviceType: "tezos_only",
90
+ serviceHealth: "active",
91
+ payoutTiming: "stable",
92
+ payoutAccuracy: "inaccurate",
93
+ audit: "63692a2ca6632298f27ed744",
94
+ insuranceCoverage: 0,
95
+ },
96
+ ];
97
+
98
+ describe("Tezos Baker", () => {
99
+ afterEach(() => {
100
+ jest.clearAllMocks();
101
+ cache.reset();
102
+ });
103
+
104
+ describe("Get bakers from cache", () => {
105
+ beforeEach(() => {
106
+ const response = {
107
+ data,
108
+ status: 200,
109
+ headers: {},
110
+ statusText: "",
111
+ config: {},
112
+ };
113
+
114
+ mockedNetwork.mockReturnValue(Promise.resolve(response));
115
+ });
116
+
117
+ it("Ledger Baker should be first in the list", async () => {
118
+ const bakers = await cache();
119
+ expect(bakers[0].name).toBe("Ledger Live by Kiln");
120
+ });
121
+ });
122
+
123
+ describe("asBaker", () => {
124
+ it("Should convert api baker to LL baker (capacity status full)", () => {
125
+ const testBaker = data.find(baker => baker.freeSpace < 0)!;
126
+ const baker = asBaker(testBaker);
127
+ expect(baker?.name).toBe(testBaker.name);
128
+ expect(baker?.nominalYield).toBe(`${Math.floor(10000 * testBaker.estimatedRoi) / 100} %`);
129
+ expect(baker?.capacityStatus).toBe("full");
130
+ });
131
+
132
+ it("Should convert api baker to LL baker (capacity status normal)", () => {
133
+ const testBaker = data.find(baker => baker.freeSpace > 0)!;
134
+ const baker = asBaker(testBaker);
135
+ expect(baker?.name).toBe(testBaker.name);
136
+ expect(baker?.nominalYield).toBe(`${Math.floor(10000 * testBaker.estimatedRoi) / 100} %`);
137
+ expect(baker?.capacityStatus).toBe("normal");
138
+ });
139
+ });
140
+ });
@@ -0,0 +1,139 @@
1
+ import { makeLRUCache } from "@ledgerhq/live-network/cache";
2
+ import network from "@ledgerhq/live-network/network";
3
+ import { log } from "@ledgerhq/logs";
4
+ import type { AccountLike } from "@ledgerhq/types-live";
5
+ import { getEnv } from "@ledgerhq/live-env";
6
+ import { ledgerValidatorAddress } from "./bakers.whitelist-default";
7
+ import { API_BAKER, Baker, Delegation } from "../types";
8
+
9
+ export const cache = makeLRUCache(
10
+ async (): Promise<Baker[]> => {
11
+ const bakers: Baker[] = [];
12
+ const TEZOS_API_BASE_URL = getEnv("API_TEZOS_BAKER");
13
+ const { data } = await network<API_BAKER[]>({
14
+ url: `${TEZOS_API_BASE_URL}/v2/bakers`,
15
+ });
16
+
17
+ if (data && Array.isArray(data)) {
18
+ log("tezos/bakers", "found " + data.length + " bakers");
19
+ data
20
+ .filter(raw => raw.serviceHealth === "active")
21
+ .forEach(raw => {
22
+ const baker = asBaker(raw);
23
+
24
+ if (baker) {
25
+ bakers.push(baker);
26
+ }
27
+ });
28
+ }
29
+
30
+ const ledgerBakerIndex = bakers.findIndex(baker => baker.address === ledgerValidatorAddress);
31
+ const [ledgerBaker] = bakers.splice(ledgerBakerIndex, 1);
32
+
33
+ log("tezos/bakers", "loaded " + bakers.length + " bakers");
34
+ return [ledgerBaker, ...bakers];
35
+ },
36
+ () => "",
37
+ );
38
+
39
+ let _lastBakers: Baker[] = [];
40
+
41
+ export const fetchAllBakers = async (): Promise<Baker[]> => {
42
+ const allBakers = await cache.force();
43
+ _lastBakers = allBakers;
44
+ return allBakers;
45
+ };
46
+
47
+ function whitelist(all: Baker[], addresses: string[]) {
48
+ return all.filter(baker => addresses.includes(baker.address));
49
+ }
50
+ export const listBakersWithDefault = (whitelistAddresses: string[]): Baker[] => {
51
+ return whitelist(_lastBakers, whitelistAddresses);
52
+ };
53
+
54
+ export const listBakers = async (whitelistAddresses: string[]): Promise<Baker[]> => {
55
+ _lastBakers = await cache();
56
+ return whitelist(_lastBakers, whitelistAddresses);
57
+ };
58
+
59
+ export function getBakerSync(addr: string): Baker | undefined {
60
+ return _lastBakers.find(baker => baker.address === addr);
61
+ }
62
+
63
+ export function getAccountDelegationSync(account: AccountLike): Delegation | null | undefined {
64
+ const op = account.operations.find(
65
+ op => !op.hasFailed && (op.type === "DELEGATE" || op.type === "UNDELEGATE"),
66
+ );
67
+ const pendingOp = account.pendingOperations
68
+ .filter(op => !account.operations.some(o => op.hash === o.hash))
69
+ .find(op => op.type === "DELEGATE" || op.type === "UNDELEGATE");
70
+ const isPending = !!pendingOp;
71
+ const operation = pendingOp && pendingOp.type === "DELEGATE" ? pendingOp : op;
72
+
73
+ if (!operation || operation.type === "UNDELEGATE") {
74
+ return null;
75
+ }
76
+
77
+ const recentOps = account.operations
78
+ .filter(op => op.date > operation.date)
79
+ .concat(account.pendingOperations);
80
+ const sendShouldWarnDelegation = !recentOps.some(op => op.type === "OUT");
81
+ const receiveShouldWarnDelegation = !recentOps.some(op => op.type === "IN");
82
+ return {
83
+ isPending,
84
+ operation,
85
+ address: operation.recipients[0],
86
+ baker: null,
87
+ sendShouldWarnDelegation,
88
+ receiveShouldWarnDelegation,
89
+ };
90
+ }
91
+
92
+ export function isAccountDelegating(account: AccountLike): boolean {
93
+ return !!getAccountDelegationSync(account);
94
+ }
95
+
96
+ export async function loadBaker(addr: string): Promise<Baker | undefined> {
97
+ const cacheBaker = getBakerSync(addr);
98
+ if (cacheBaker) return cacheBaker;
99
+ const bakers = await cache();
100
+ const baker = bakers.find(baker => baker.address === addr);
101
+ return baker;
102
+ }
103
+
104
+ export async function loadAccountDelegation(
105
+ account: AccountLike,
106
+ ): Promise<Delegation | null | undefined> {
107
+ const delegation = getAccountDelegationSync(account);
108
+ if (!delegation) return null;
109
+ const baker = await loadBaker(delegation.address);
110
+ return { ...delegation, baker };
111
+ }
112
+
113
+ export const asBaker = (data: API_BAKER): Baker | undefined => {
114
+ const { address, name, logo, freeSpace, estimatedRoi } = data;
115
+
116
+ if (
117
+ typeof name === "string" &&
118
+ typeof address === "string" &&
119
+ typeof logo === "string" &&
120
+ typeof freeSpace === "number" &&
121
+ typeof estimatedRoi === "number" &&
122
+ (logo.startsWith("https://") || logo.startsWith("http://")) &&
123
+ estimatedRoi >= 0 &&
124
+ estimatedRoi <= 1
125
+ ) {
126
+ return {
127
+ name,
128
+ address,
129
+ logoURL: logo,
130
+ nominalYield: `${Math.floor(10000 * estimatedRoi) / 100} %`,
131
+ capacityStatus: freeSpace <= 0 ? "full" : "normal",
132
+ };
133
+ }
134
+ };
135
+
136
+ export const hydrateBakers = (bakers: Baker[]): void => {
137
+ log("tezos/bakers", "hydrate " + bakers.length + " bakers");
138
+ cache.hydrate("", bakers);
139
+ };
@@ -0,0 +1,33 @@
1
+ export const ledgerValidatorAddress = "tz3LV9aGKHDnAZHCtC9SjNtTrKRu678FqSki";
2
+ const whitelist = [
3
+ "tz1WCd2jm4uSt4vntk4vSuUWoZQGhLcDuR9q",
4
+ "tz1Scdr2HsZiQjc7bHMeBbmDRXYVvdhjJbBh",
5
+ "tz1g8vkmcde6sWKaG2NN9WKzCkDM6Rziq194",
6
+ "tz1PWCDnz783NNGGQjEFFsHtrcK5yBW4E2rm",
7
+ "tz1RV1MBbZMR68tacosb7Mwj6LkbPSUS1er1",
8
+ "tz1KfEsrtDaA1sX7vdM4qmEPWuSytuqCDp5j",
9
+ "tz1V4qCyvPKZ5UeqdH14HN42rxvNPQfc9UZg",
10
+ "tz1Lhf4J9Qxoe3DZ2nfe8FGDnvVj7oKjnMY6",
11
+ "tz1Ldzz6k1BHdhuKvAtMRX7h5kJSMHESMHLC",
12
+ "tz1Kf25fX1VdmYGSEzwFy1wNmkbSEZ2V83sY",
13
+ "tz1RCFbB9GpALpsZtu6J58sb74dm8qe6XBzv",
14
+ "tz1dbfppLAAxXZNtf2SDps7rch3qfUznKSoK",
15
+ "tz2FCNBrERXtaTtNX6iimR1UJ5JSDxvdHM93",
16
+ "tz1SohptP53wDPZhzTWzDUFAUcWF6DMBpaJV",
17
+ "tz1P2Po7YM526ughEsRbY4oR9zaUPDZjxFrb",
18
+ "tz1KzSC1J9aBxKp7u8TUnpN8L7S65PBRkgdF",
19
+ "tz1fJHFn6sWEd3NnBPngACuw2dggTv6nQZ7g",
20
+ "tz1NEKxGEHsFufk87CVZcrqWu8o22qh46GK6",
21
+ "tz1V3yg82mcrPJbegqVCPn6bC8w1CSTRp3f8",
22
+ "tz1aRoaRhSpRYvFdyvgWLL6TGyRoGF51wDjM",
23
+ "tz1MQJPGNMijnXnVoBENFz9rUhaPt3S7rWoz",
24
+ "tz1dRKU4FQ9QRRQPdaH4zCR6gmCmXfcvcgtB",
25
+ "tz1aDiEJf9ztRrAJEXZfcG3CKimoKsGhwVAi",
26
+ ];
27
+
28
+ // we give no ordering preference. it's settled at module load time
29
+ whitelist.sort(() => Math.random() - 0.5);
30
+
31
+ const whiteListAddresses = [ledgerValidatorAddress, ...whitelist];
32
+
33
+ export default whiteListAddresses;
@@ -0,0 +1,2 @@
1
+ export * from "./tzkt";
2
+ export * from "./bakers";
@@ -0,0 +1,112 @@
1
+ // @flow
2
+ import network from "@ledgerhq/live-network/network";
3
+ import URL from "url";
4
+ import { getEnv } from "@ledgerhq/live-env";
5
+
6
+ type APIAccount =
7
+ | {
8
+ type: "empty";
9
+ address: string;
10
+ counter: number;
11
+ }
12
+ | {
13
+ type: "user";
14
+ address: string;
15
+ publicKey: string;
16
+ revealed: boolean;
17
+ balance: number;
18
+ counter: number;
19
+ delegate?: {
20
+ alias: string;
21
+ address: string;
22
+ active: boolean;
23
+ };
24
+ delegationLevel: number;
25
+ delegationTime: string;
26
+ numTransactions: number;
27
+ firstActivityTime: string;
28
+ };
29
+
30
+ type CommonOperationType = {
31
+ id: number;
32
+ hash?: string;
33
+ storageFee?: number;
34
+ allocationFee?: number;
35
+ bakerFee?: number;
36
+ timestamp: string;
37
+ level: number;
38
+ block: string;
39
+ gasLimit?: number;
40
+ storageLimit?: number;
41
+ status?: "applied" | "failed" | "backtracked" | "skipped";
42
+ };
43
+
44
+ export type APIOperation =
45
+ | (CommonOperationType & {
46
+ type: "transaction";
47
+ amount: number;
48
+ initiator: { address: string } | undefined | null;
49
+ sender: { address: string } | undefined | null;
50
+ target: { address: string } | undefined | null;
51
+ })
52
+ | (CommonOperationType & {
53
+ type: "reveal";
54
+ })
55
+ | (CommonOperationType & {
56
+ type: "delegation";
57
+ prevDelegate: { address: string } | undefined | null;
58
+ newDelegate: { address: string } | undefined | null;
59
+ })
60
+ | (CommonOperationType & {
61
+ type: "activation";
62
+ balance: number;
63
+ })
64
+ | (CommonOperationType & {
65
+ type: "origination";
66
+ contractBalance: number;
67
+ originatedContract: {
68
+ address: string;
69
+ };
70
+ })
71
+ | (CommonOperationType & {
72
+ type: "migration";
73
+ balanceChange: number;
74
+ })
75
+ | (CommonOperationType & {
76
+ type: ""; // this is to express fact we have others and we need to always filter out others
77
+ });
78
+
79
+ const api = {
80
+ async getBlockCount(): Promise<number> {
81
+ const { data } = await network({
82
+ method: "GET",
83
+ url: `${getEnv("API_TEZOS_TZKT_API")}/v1/blocks/count`,
84
+ });
85
+ return data;
86
+ },
87
+ async getAccountByAddress(address: string): Promise<APIAccount> {
88
+ const { data } = await network({
89
+ method: "GET",
90
+ url: `${getEnv("API_TEZOS_TZKT_API")}/v1/accounts/${address}`,
91
+ });
92
+ return data;
93
+ },
94
+ async getAccountOperations(
95
+ address: string,
96
+ query: {
97
+ lastId?: number;
98
+ sort?: number;
99
+ },
100
+ ): Promise<APIOperation[]> {
101
+ const { data } = await network({
102
+ method: "GET",
103
+ url: URL.format({
104
+ pathname: `${getEnv("API_TEZOS_TZKT_API")}/v1/accounts/${address}/operations`,
105
+ query,
106
+ }),
107
+ });
108
+ return data;
109
+ },
110
+ };
111
+
112
+ export default api;
@@ -0,0 +1,30 @@
1
+ import { SignedOperation } from "@ledgerhq/types-live";
2
+ import { createFixtureOperation } from "../types/model.fixture";
3
+ import broadcast from "./broadcast";
4
+
5
+ const mockInjectOperation = jest.fn();
6
+ jest.mock("@taquito/taquito", () => ({
7
+ TezosToolkit: jest.fn().mockReturnValue({
8
+ rpc: {
9
+ injectOperation: () => mockInjectOperation(),
10
+ },
11
+ }),
12
+ }));
13
+
14
+ describe("broadcast", () => {
15
+ it("calls 'injectOperation' from TezosToolkit and returns its hash computation", async () => {
16
+ // GIVEN
17
+ const signedOperation: SignedOperation = {
18
+ operation: createFixtureOperation(),
19
+ signature: "SIGNATURE",
20
+ };
21
+ mockInjectOperation.mockResolvedValue("SIGN_HASH");
22
+
23
+ // WHEN
24
+ const op = await broadcast({ signedOperation });
25
+
26
+ // THEN
27
+ expect(mockInjectOperation).toHaveBeenCalledTimes(1);
28
+ expect(op.hash).toEqual("SIGN_HASH");
29
+ });
30
+ });
@@ -0,0 +1,18 @@
1
+ import { TezosToolkit } from "@taquito/taquito";
2
+ import { getEnv } from "@ledgerhq/live-env";
3
+ import { patchOperationWithHash } from "@ledgerhq/coin-framework/operation";
4
+ import { SignedOperation } from "@ledgerhq/types-live";
5
+
6
+ const broadcast = async ({
7
+ signedOperation: { operation, signature },
8
+ }: {
9
+ signedOperation: SignedOperation;
10
+ }) => {
11
+ const tezos = new TezosToolkit(getEnv("API_TEZOS_NODE"));
12
+ const { rpc } = tezos;
13
+ const hash = await rpc.injectOperation(signature);
14
+
15
+ return patchOperationWithHash(operation, hash);
16
+ };
17
+
18
+ export default broadcast;