@ledgerhq/live-common 21.22.0 → 21.24.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 (262) hide show
  1. package/lib/account/formatters.d.ts.map +1 -1
  2. package/lib/account/formatters.js +1 -0
  3. package/lib/account/formatters.js.map +1 -1
  4. package/lib/account/support.d.ts.map +1 -1
  5. package/lib/account/support.js +1 -0
  6. package/lib/account/support.js.map +1 -1
  7. package/lib/data/icons/react/index.d.ts +1 -0
  8. package/lib/data/icons/react/index.d.ts.map +1 -1
  9. package/lib/data/icons/react/index.js +4 -2
  10. package/lib/data/icons/react/index.js.map +1 -1
  11. package/lib/data/icons/react/sol.js +4 -2
  12. package/lib/data/icons/react/sol.js.map +1 -1
  13. package/lib/data/icons/react/ssv.d.ts +8 -0
  14. package/lib/data/icons/react/ssv.d.ts.map +1 -0
  15. package/lib/data/icons/react/ssv.js +31 -0
  16. package/lib/data/icons/react/ssv.js.map +1 -0
  17. package/lib/data/icons/reactNative/index.d.ts +1 -0
  18. package/lib/data/icons/reactNative/index.d.ts.map +1 -1
  19. package/lib/data/icons/reactNative/index.js +4 -2
  20. package/lib/data/icons/reactNative/index.js.map +1 -1
  21. package/lib/data/icons/reactNative/sol.js +4 -2
  22. package/lib/data/icons/reactNative/sol.js.map +1 -1
  23. package/lib/data/icons/reactNative/ssv.d.ts +8 -0
  24. package/lib/data/icons/reactNative/ssv.d.ts.map +1 -0
  25. package/lib/data/icons/reactNative/ssv.js +32 -0
  26. package/lib/data/icons/reactNative/ssv.js.map +1 -0
  27. package/lib/derivation.d.ts.map +1 -1
  28. package/lib/derivation.js +0 -3
  29. package/lib/derivation.js.map +1 -1
  30. package/lib/env.d.ts +10 -10
  31. package/lib/env.d.ts.map +1 -1
  32. package/lib/env.js +5 -5
  33. package/lib/env.js.map +1 -1
  34. package/lib/env.react.d.ts +1 -1
  35. package/lib/env.react.d.ts.map +1 -1
  36. package/lib/families/algorand/account.d.ts.map +1 -1
  37. package/lib/families/algorand/account.js +0 -4
  38. package/lib/families/algorand/account.js.map +1 -1
  39. package/lib/families/algorand/api/algodv2.d.ts +5 -0
  40. package/lib/families/algorand/api/algodv2.d.ts.map +1 -0
  41. package/lib/families/algorand/api/algodv2.js +118 -0
  42. package/lib/families/algorand/api/algodv2.js.map +1 -0
  43. package/lib/families/algorand/api/algodv2.types.d.ts +24 -0
  44. package/lib/families/algorand/api/algodv2.types.d.ts.map +1 -0
  45. package/lib/families/algorand/api/algodv2.types.js +3 -0
  46. package/lib/families/algorand/api/algodv2.types.js.map +1 -0
  47. package/lib/families/algorand/api/index.d.ts +5 -0
  48. package/lib/families/algorand/api/index.d.ts.map +1 -0
  49. package/lib/families/algorand/api/index.js +17 -0
  50. package/lib/families/algorand/api/index.js.map +1 -0
  51. package/lib/families/algorand/api/indexer.d.ts +3 -0
  52. package/lib/families/algorand/api/indexer.d.ts.map +1 -0
  53. package/lib/families/algorand/api/indexer.js +134 -0
  54. package/lib/families/algorand/api/indexer.js.map +1 -0
  55. package/lib/families/algorand/api/indexer.types.d.ts +35 -0
  56. package/lib/families/algorand/api/indexer.types.d.ts.map +1 -0
  57. package/lib/families/algorand/api/indexer.types.js +10 -0
  58. package/lib/families/algorand/api/indexer.types.js.map +1 -0
  59. package/lib/families/algorand/bridge/js.d.ts +8 -0
  60. package/lib/families/algorand/bridge/js.d.ts.map +1 -0
  61. package/lib/families/algorand/bridge/js.js +85 -0
  62. package/lib/families/algorand/bridge/js.js.map +1 -0
  63. package/lib/families/algorand/bridge/libcore.d.ts +3 -3
  64. package/lib/families/algorand/bridge/libcore.d.ts.map +1 -1
  65. package/lib/families/algorand/bridge/libcore.js.map +1 -1
  66. package/lib/families/algorand/bridge/mock.d.ts +2 -2
  67. package/lib/families/algorand/bridge/mock.d.ts.map +1 -1
  68. package/lib/families/algorand/bridge/mock.js.map +1 -1
  69. package/lib/families/algorand/buildTransaction.d.ts +8 -0
  70. package/lib/families/algorand/buildTransaction.d.ts.map +1 -0
  71. package/lib/families/algorand/buildTransaction.js +101 -0
  72. package/lib/families/algorand/buildTransaction.js.map +1 -0
  73. package/lib/families/algorand/cli-transaction.js +1 -1
  74. package/lib/families/algorand/cli-transaction.js.map +1 -1
  75. package/lib/families/algorand/deviceTransactionConfig.d.ts +2 -2
  76. package/lib/families/algorand/deviceTransactionConfig.d.ts.map +1 -1
  77. package/lib/families/algorand/deviceTransactionConfig.js +0 -13
  78. package/lib/families/algorand/deviceTransactionConfig.js.map +1 -1
  79. package/lib/families/algorand/hw-getAddress.d.ts.map +1 -1
  80. package/lib/families/algorand/hw-getAddress.js +2 -24
  81. package/lib/families/algorand/hw-getAddress.js.map +1 -1
  82. package/lib/families/algorand/js-broadcast.d.ts +9 -0
  83. package/lib/families/algorand/js-broadcast.d.ts.map +1 -0
  84. package/lib/families/algorand/js-broadcast.js +63 -0
  85. package/lib/families/algorand/js-broadcast.js.map +1 -0
  86. package/lib/families/algorand/js-estimateMaxSpendable.d.ts +9 -0
  87. package/lib/families/algorand/js-estimateMaxSpendable.d.ts.map +1 -0
  88. package/lib/families/algorand/js-estimateMaxSpendable.js +89 -0
  89. package/lib/families/algorand/js-estimateMaxSpendable.js.map +1 -0
  90. package/lib/families/algorand/js-getFeesForTransaction.d.ts +5 -0
  91. package/lib/families/algorand/js-getFeesForTransaction.d.ts.map +1 -0
  92. package/lib/families/algorand/js-getFeesForTransaction.js +69 -0
  93. package/lib/families/algorand/js-getFeesForTransaction.js.map +1 -0
  94. package/lib/families/algorand/js-getTransactionStatus.d.ts +11 -0
  95. package/lib/families/algorand/js-getTransactionStatus.d.ts.map +1 -0
  96. package/lib/families/algorand/js-getTransactionStatus.js +201 -0
  97. package/lib/families/algorand/js-getTransactionStatus.js.map +1 -0
  98. package/lib/families/algorand/js-prepareTransaction.d.ts +5 -0
  99. package/lib/families/algorand/js-prepareTransaction.d.ts.map +1 -0
  100. package/lib/families/algorand/js-prepareTransaction.js +101 -0
  101. package/lib/families/algorand/js-prepareTransaction.js.map +1 -0
  102. package/lib/families/algorand/js-signOperation.d.ts +10 -0
  103. package/lib/families/algorand/js-signOperation.d.ts.map +1 -0
  104. package/lib/families/algorand/js-signOperation.js +164 -0
  105. package/lib/families/algorand/js-signOperation.js.map +1 -0
  106. package/lib/families/algorand/js-synchronization.d.ts +10 -0
  107. package/lib/families/algorand/js-synchronization.d.ts.map +1 -0
  108. package/lib/families/algorand/js-synchronization.js +411 -0
  109. package/lib/families/algorand/js-synchronization.js.map +1 -0
  110. package/lib/families/algorand/libcore-buildTransaction.d.ts +2 -2
  111. package/lib/families/algorand/libcore-buildTransaction.d.ts.map +1 -1
  112. package/lib/families/algorand/libcore-getFeesForTransaction.d.ts +4 -4
  113. package/lib/families/algorand/libcore-getFeesForTransaction.d.ts.map +1 -1
  114. package/lib/families/algorand/libcore-getFeesForTransaction.js +2 -2
  115. package/lib/families/algorand/libcore-getFeesForTransaction.js.map +1 -1
  116. package/lib/families/algorand/libcore-postBuildAccount.d.ts.map +1 -1
  117. package/lib/families/algorand/libcore-postBuildAccount.js +5 -11
  118. package/lib/families/algorand/libcore-postBuildAccount.js.map +1 -1
  119. package/lib/families/algorand/libcore-signOperation.d.ts +2 -2
  120. package/lib/families/algorand/libcore-signOperation.d.ts.map +1 -1
  121. package/lib/families/algorand/libcore-signOperation.js.map +1 -1
  122. package/lib/families/algorand/logic.d.ts +10 -0
  123. package/lib/families/algorand/logic.d.ts.map +1 -1
  124. package/lib/families/algorand/logic.js +79 -1
  125. package/lib/families/algorand/logic.js.map +1 -1
  126. package/lib/families/algorand/mock.d.ts.map +1 -1
  127. package/lib/families/algorand/mock.js +4 -11
  128. package/lib/families/algorand/mock.js.map +1 -1
  129. package/lib/families/algorand/serialization.js +4 -4
  130. package/lib/families/algorand/serialization.js.map +1 -1
  131. package/lib/families/algorand/specs.d.ts +2 -2
  132. package/lib/families/algorand/specs.d.ts.map +1 -1
  133. package/lib/families/algorand/specs.js +8 -16
  134. package/lib/families/algorand/specs.js.map +1 -1
  135. package/lib/families/algorand/speculos-deviceActions.d.ts +2 -2
  136. package/lib/families/algorand/speculos-deviceActions.d.ts.map +1 -1
  137. package/lib/families/algorand/speculos-deviceActions.js +4 -0
  138. package/lib/families/algorand/speculos-deviceActions.js.map +1 -1
  139. package/lib/families/algorand/test-dataset.d.ts +2 -2
  140. package/lib/families/algorand/test-dataset.d.ts.map +1 -1
  141. package/lib/families/algorand/test-dataset.js +1 -2
  142. package/lib/families/algorand/test-dataset.js.map +1 -1
  143. package/lib/families/algorand/tokens.d.ts.map +1 -1
  144. package/lib/families/algorand/tokens.js.map +1 -1
  145. package/lib/families/algorand/transaction.d.ts +5 -5
  146. package/lib/families/algorand/transaction.d.ts.map +1 -1
  147. package/lib/families/algorand/transaction.js.map +1 -1
  148. package/lib/families/algorand/types.d.ts +7 -5
  149. package/lib/families/algorand/types.d.ts.map +1 -1
  150. package/lib/families/algorand/types.js.map +1 -1
  151. package/lib/families/bitcoin/js-prepareTransaction.d.ts.map +1 -1
  152. package/lib/families/bitcoin/js-prepareTransaction.js +3 -2
  153. package/lib/families/bitcoin/js-prepareTransaction.js.map +1 -1
  154. package/lib/families/bitcoin/js-synchronisation.d.ts.map +1 -1
  155. package/lib/families/bitcoin/js-synchronisation.js +13 -14
  156. package/lib/families/bitcoin/js-synchronisation.js.map +1 -1
  157. package/lib/families/bitcoin/wallet-btc/crypto/base.d.ts.map +1 -1
  158. package/lib/families/bitcoin/wallet-btc/crypto/base.js +30 -22
  159. package/lib/families/bitcoin/wallet-btc/crypto/base.js.map +1 -1
  160. package/lib/families/bitcoin/wallet-btc/crypto/bip32.d.ts +11 -0
  161. package/lib/families/bitcoin/wallet-btc/crypto/bip32.d.ts.map +1 -0
  162. package/lib/families/bitcoin/wallet-btc/crypto/bip32.js +32 -0
  163. package/lib/families/bitcoin/wallet-btc/crypto/bip32.js.map +1 -0
  164. package/lib/families/bitcoin/wallet-btc/crypto/decred.d.ts.map +1 -1
  165. package/lib/families/bitcoin/wallet-btc/crypto/decred.js +3 -115
  166. package/lib/families/bitcoin/wallet-btc/crypto/decred.js.map +1 -1
  167. package/lib/families/bitcoin/wallet-btc/storage/index.d.ts +24 -8
  168. package/lib/families/bitcoin/wallet-btc/storage/index.d.ts.map +1 -1
  169. package/lib/families/bitcoin/wallet-btc/storage/index.js +114 -128
  170. package/lib/families/bitcoin/wallet-btc/storage/index.js.map +1 -1
  171. package/lib/families/bitcoin/wallet-btc/storage/types.d.ts +8 -7
  172. package/lib/families/bitcoin/wallet-btc/storage/types.d.ts.map +1 -1
  173. package/lib/families/bitcoin/wallet-btc/xpub.d.ts.map +1 -1
  174. package/lib/families/bitcoin/wallet-btc/xpub.js +42 -63
  175. package/lib/families/bitcoin/wallet-btc/xpub.js.map +1 -1
  176. package/lib/families/tezos/bridge/js.d.ts.map +1 -1
  177. package/lib/families/tezos/bridge/js.js +38 -17
  178. package/lib/families/tezos/bridge/js.js.map +1 -1
  179. package/lib/families/tezos/signOperation.d.ts.map +1 -1
  180. package/lib/families/tezos/signOperation.js +9 -0
  181. package/lib/families/tezos/signOperation.js.map +1 -1
  182. package/lib/families/tezos/synchronisation.js +1 -1
  183. package/lib/families/tezos/synchronisation.js.map +1 -1
  184. package/lib/generated/bridge/js.d.ts +4 -0
  185. package/lib/generated/bridge/js.d.ts.map +1 -1
  186. package/lib/generated/bridge/js.js +26 -24
  187. package/lib/generated/bridge/js.js.map +1 -1
  188. package/lib/generated/bridge/libcore.d.ts +1 -1
  189. package/lib/generated/bridge/mock.d.ts +1 -1
  190. package/lib/generated/specs.d.ts +1 -1
  191. package/lib/generated/speculos-deviceActions.d.ts +1 -1
  192. package/lib/generated/test-dataset.d.ts +1 -1
  193. package/lib/generated/transaction.d.ts +3 -3
  194. package/lib/libcore/buildAccount/index.d.ts.map +1 -1
  195. package/lib/libcore/buildAccount/index.js +0 -1
  196. package/lib/libcore/buildAccount/index.js.map +1 -1
  197. package/lib/mock/account.js +21 -21
  198. package/lib/mock/account.js.map +1 -1
  199. package/lib/types/operation.d.ts +1 -1
  200. package/lib/types/operation.d.ts.map +1 -1
  201. package/package.json +4 -3
  202. package/src/__tests__/__snapshots__/all.libcore.ts.snap +7 -114
  203. package/src/account/formatters.ts +1 -0
  204. package/src/account/support.ts +1 -0
  205. package/src/data/icons/react/index.tsx +1 -0
  206. package/src/data/icons/react/sol.tsx +1 -1
  207. package/src/data/icons/react/ssv.tsx +12 -0
  208. package/src/data/icons/reactNative/index.tsx +1 -0
  209. package/src/data/icons/reactNative/sol.tsx +1 -1
  210. package/src/data/icons/reactNative/ssv.tsx +13 -0
  211. package/src/data/icons/svg/SOL.svg +1 -3
  212. package/src/data/icons/svg/SSV.svg +4 -0
  213. package/src/derivation.ts +0 -2
  214. package/src/env.ts +5 -5
  215. package/src/families/algorand/account.ts +0 -9
  216. package/src/families/algorand/api/algodv2.ts +68 -0
  217. package/src/families/algorand/api/algodv2.types.ts +27 -0
  218. package/src/families/algorand/api/index.ts +4 -0
  219. package/src/families/algorand/api/indexer.ts +99 -0
  220. package/src/families/algorand/api/indexer.types.ts +41 -0
  221. package/src/families/algorand/bridge/js.ts +46 -0
  222. package/src/families/algorand/bridge/libcore.ts +4 -4
  223. package/src/families/algorand/bridge/mock.ts +3 -3
  224. package/src/families/algorand/buildTransaction.ts +100 -0
  225. package/src/families/algorand/cli-transaction.ts +1 -1
  226. package/src/families/algorand/deviceTransactionConfig.ts +2 -16
  227. package/src/families/algorand/hw-getAddress.ts +1 -10
  228. package/src/families/algorand/js-broadcast.ts +17 -0
  229. package/src/families/algorand/js-estimateMaxSpendable.ts +51 -0
  230. package/src/families/algorand/js-getFeesForTransaction.ts +25 -0
  231. package/src/families/algorand/js-getTransactionStatus.ts +178 -0
  232. package/src/families/algorand/js-prepareTransaction.ts +42 -0
  233. package/src/families/algorand/js-signOperation.ts +145 -0
  234. package/src/families/algorand/js-synchronization.ts +433 -0
  235. package/src/families/algorand/libcore-buildTransaction.ts +2 -2
  236. package/src/families/algorand/libcore-getFeesForTransaction.ts +4 -4
  237. package/src/families/algorand/libcore-postBuildAccount.ts +2 -7
  238. package/src/families/algorand/libcore-signOperation.ts +2 -2
  239. package/src/families/algorand/logic.ts +47 -0
  240. package/src/families/algorand/mock.ts +2 -12
  241. package/src/families/algorand/serialization.ts +4 -4
  242. package/src/families/algorand/specs.ts +16 -22
  243. package/src/families/algorand/speculos-deviceActions.ts +87 -82
  244. package/src/families/algorand/test-dataset.ts +5 -6
  245. package/src/families/algorand/tokens.ts +1 -0
  246. package/src/families/algorand/transaction.ts +13 -4
  247. package/src/families/algorand/types.ts +10 -5
  248. package/src/families/bitcoin/js-prepareTransaction.ts +3 -2
  249. package/src/families/bitcoin/js-synchronisation.ts +17 -15
  250. package/src/families/bitcoin/wallet-btc/crypto/base.ts +33 -21
  251. package/src/families/bitcoin/wallet-btc/crypto/bip32.ts +36 -0
  252. package/src/families/bitcoin/wallet-btc/crypto/decred.ts +3 -155
  253. package/src/families/bitcoin/wallet-btc/storage/index.ts +23 -11
  254. package/src/families/bitcoin/wallet-btc/storage/types.ts +8 -10
  255. package/src/families/bitcoin/wallet-btc/xpub.ts +14 -10
  256. package/src/families/tezos/bridge/js.ts +43 -18
  257. package/src/families/tezos/signOperation.ts +12 -0
  258. package/src/families/tezos/synchronisation.ts +1 -1
  259. package/src/generated/bridge/js.ts +3 -0
  260. package/src/libcore/buildAccount/index.ts +1 -2
  261. package/src/mock/account.ts +27 -27
  262. package/src/types/operation.ts +9 -4
@@ -0,0 +1,5 @@
1
+ import type { Account } from "../../types";
2
+ import type { Transaction } from "./types";
3
+ export declare const createTransaction: () => Transaction;
4
+ export declare const prepareTransaction: (account: Account, transaction: Transaction) => Promise<Transaction>;
5
+ //# sourceMappingURL=js-prepareTransaction.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"js-prepareTransaction.d.ts","sourceRoot":"","sources":["../../../src/families/algorand/js-prepareTransaction.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAI3C,eAAO,MAAM,iBAAiB,QAAO,WASnC,CAAC;AAEH,eAAO,MAAM,kBAAkB,YACpB,OAAO,eACH,WAAW,KACvB,QAAQ,WAAW,CAqBrB,CAAC"}
@@ -0,0 +1,101 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
14
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
15
+ return new (P || (P = Promise))(function (resolve, reject) {
16
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
17
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
18
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
19
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
20
+ });
21
+ };
22
+ var __generator = (this && this.__generator) || function (thisArg, body) {
23
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
24
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
25
+ function verb(n) { return function (v) { return step([n, v]); }; }
26
+ function step(op) {
27
+ if (f) throw new TypeError("Generator is already executing.");
28
+ while (_) try {
29
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
30
+ if (y = 0, t) op = [op[0] & 2, t.value];
31
+ switch (op[0]) {
32
+ case 0: case 1: t = op; break;
33
+ case 4: _.label++; return { value: op[1], done: false };
34
+ case 5: _.label++; y = op[1]; op = [0]; continue;
35
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
36
+ default:
37
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
38
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
39
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
40
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
41
+ if (t[2]) _.ops.pop();
42
+ _.trys.pop(); continue;
43
+ }
44
+ op = body.call(thisArg, _);
45
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
46
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
47
+ }
48
+ };
49
+ exports.__esModule = true;
50
+ exports.prepareTransaction = exports.createTransaction = void 0;
51
+ var bignumber_js_1 = require("bignumber.js");
52
+ var js_getFeesForTransaction_1 = require("./js-getFeesForTransaction");
53
+ var js_estimateMaxSpendable_1 = require("./js-estimateMaxSpendable");
54
+ var createTransaction = function () { return ({
55
+ family: "algorand",
56
+ amount: new bignumber_js_1.BigNumber(0),
57
+ fees: null,
58
+ recipient: "",
59
+ useAllAmount: false,
60
+ memo: null,
61
+ mode: "send",
62
+ assetId: null
63
+ }); };
64
+ exports.createTransaction = createTransaction;
65
+ var prepareTransaction = function (account, transaction) { return __awaiter(void 0, void 0, void 0, function () {
66
+ var recipient, amount, _a, fees;
67
+ return __generator(this, function (_b) {
68
+ switch (_b.label) {
69
+ case 0:
70
+ if (!(transaction.mode === "send")) return [3 /*break*/, 4];
71
+ recipient = transaction.recipient;
72
+ if (!transaction.useAllAmount) return [3 /*break*/, 2];
73
+ return [4 /*yield*/, (0, js_estimateMaxSpendable_1.estimateMaxSpendable)({ account: account, transaction: transaction })];
74
+ case 1:
75
+ _a = _b.sent();
76
+ return [3 /*break*/, 3];
77
+ case 2:
78
+ _a = transaction.amount;
79
+ _b.label = 3;
80
+ case 3:
81
+ amount = _a;
82
+ return [3 /*break*/, 5];
83
+ case 4:
84
+ if (transaction.mode === "optIn" ||
85
+ transaction.mode === "claimReward") {
86
+ recipient = account.freshAddress;
87
+ amount = new bignumber_js_1.BigNumber(0);
88
+ }
89
+ else {
90
+ throw new Error("Unsupported transaction mode '".concat(transaction.mode, "'"));
91
+ }
92
+ _b.label = 5;
93
+ case 5: return [4 /*yield*/, (0, js_getFeesForTransaction_1.getEstimatedFees)(account, transaction)];
94
+ case 6:
95
+ fees = _b.sent();
96
+ return [2 /*return*/, __assign(__assign({}, transaction), { fees: fees, amount: amount, recipient: recipient })];
97
+ }
98
+ });
99
+ }); };
100
+ exports.prepareTransaction = prepareTransaction;
101
+ //# sourceMappingURL=js-prepareTransaction.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"js-prepareTransaction.js","sourceRoot":"","sources":["../../../src/families/algorand/js-prepareTransaction.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAyC;AAGzC,uEAA8D;AAC9D,qEAAiE;AAE1D,IAAM,iBAAiB,GAAG,cAAmB,OAAA,CAAC;IACnD,MAAM,EAAE,UAAU;IAClB,MAAM,EAAE,IAAI,wBAAS,CAAC,CAAC,CAAC;IACxB,IAAI,EAAE,IAAI;IACV,SAAS,EAAE,EAAE;IACb,YAAY,EAAE,KAAK;IACnB,IAAI,EAAE,IAAI;IACV,IAAI,EAAE,MAAM;IACZ,OAAO,EAAE,IAAI;CACd,CAAC,EATkD,CASlD,CAAC;AATU,QAAA,iBAAiB,qBAS3B;AAEI,IAAM,kBAAkB,GAAG,UAChC,OAAgB,EAChB,WAAwB;;;;;qBAIpB,CAAA,WAAW,CAAC,IAAI,KAAK,MAAM,CAAA,EAA3B,wBAA2B;gBAC7B,SAAS,GAAG,WAAW,CAAC,SAAS,CAAC;qBACzB,WAAW,CAAC,YAAY,EAAxB,wBAAwB;gBAC7B,qBAAM,IAAA,8CAAoB,EAAC,EAAE,OAAO,SAAA,EAAE,WAAW,aAAA,EAAE,CAAC,EAAA;;gBAApD,KAAA,SAAoD,CAAA;;;gBACpD,KAAA,WAAW,CAAC,MAAM,CAAA;;;gBAFtB,MAAM,KAEgB,CAAC;;;gBAClB,IACL,WAAW,CAAC,IAAI,KAAK,OAAO;oBAC5B,WAAW,CAAC,IAAI,KAAK,aAAa,EAClC;oBACA,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC;oBACjC,MAAM,GAAG,IAAI,wBAAS,CAAC,CAAC,CAAC,CAAC;iBAC3B;qBAAM;oBACL,MAAM,IAAI,KAAK,CAAC,wCAAiC,WAAW,CAAC,IAAI,MAAG,CAAC,CAAC;iBACvE;;oBAEY,qBAAM,IAAA,2CAAgB,EAAC,OAAO,EAAE,WAAW,CAAC,EAAA;;gBAAnD,IAAI,GAAG,SAA4C;gBAEzD,4CAAY,WAAW,KAAE,IAAI,MAAA,EAAE,MAAM,QAAA,EAAE,SAAS,WAAA,KAAG;;;KACpD,CAAC;AAxBW,QAAA,kBAAkB,sBAwB7B"}
@@ -0,0 +1,10 @@
1
+ import { Observable } from "rxjs";
2
+ import type { Account, SignOperationEvent } from "../../types";
3
+ import type { Transaction } from "./types";
4
+ export declare const signOperation: ({ account, transaction, deviceId, }: {
5
+ account: Account;
6
+ transaction: Transaction;
7
+ deviceId: any;
8
+ }) => Observable<SignOperationEvent>;
9
+ export default signOperation;
10
+ //# sourceMappingURL=js-signOperation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"js-signOperation.d.ts","sourceRoot":"","sources":["../../../src/families/algorand/js-signOperation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAGlC,OAAO,KAAK,EAAE,OAAO,EAAa,kBAAkB,EAAE,MAAM,aAAa,CAAC;AAE1E,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,SAAS,CAAC;AAO3C,eAAO,MAAM,aAAa;aAKf,OAAO;iBACH,WAAW;cACd,GAAG;MACX,WAAW,kBAAkB,CAoD9B,CAAC;AAuEJ,eAAe,aAAa,CAAC"}
@@ -0,0 +1,164 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (_) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ var __importDefault = (this && this.__importDefault) || function (mod) {
39
+ return (mod && mod.__esModule) ? mod : { "default": mod };
40
+ };
41
+ exports.__esModule = true;
42
+ exports.signOperation = void 0;
43
+ var bignumber_js_1 = require("bignumber.js");
44
+ var rxjs_1 = require("rxjs");
45
+ var errors_1 = require("@ledgerhq/errors");
46
+ var hw_app_algorand_1 = __importDefault(require("@ledgerhq/hw-app-algorand"));
47
+ var deviceAccess_1 = require("../../hw/deviceAccess");
48
+ var buildTransaction_1 = require("./buildTransaction");
49
+ var signOperation = function (_a) {
50
+ var account = _a.account, transaction = _a.transaction, deviceId = _a.deviceId;
51
+ return (0, deviceAccess_1.withDevice)(deviceId)(function (transport) {
52
+ return rxjs_1.Observable.create(function (o) {
53
+ var cancelled;
54
+ function main() {
55
+ return __awaiter(this, void 0, void 0, function () {
56
+ var algoTx, toSign, hwApp, freshAddressPath, signature, toBroadcast, operation;
57
+ return __generator(this, function (_a) {
58
+ switch (_a.label) {
59
+ case 0:
60
+ if (!transaction.fees) {
61
+ throw new errors_1.FeeNotLoaded();
62
+ }
63
+ return [4 /*yield*/, (0, buildTransaction_1.buildTransactionPayload)(account, transaction)];
64
+ case 1:
65
+ algoTx = _a.sent();
66
+ return [4 /*yield*/, (0, buildTransaction_1.encodeToSign)(algoTx)];
67
+ case 2:
68
+ toSign = _a.sent();
69
+ hwApp = new hw_app_algorand_1["default"](transport);
70
+ freshAddressPath = account.freshAddressPath;
71
+ o.next({ type: "device-signature-requested" });
72
+ return [4 /*yield*/, hwApp.sign(freshAddressPath, toSign)];
73
+ case 3:
74
+ signature = (_a.sent()).signature;
75
+ if (cancelled)
76
+ return [2 /*return*/];
77
+ o.next({ type: "device-signature-granted" });
78
+ if (!signature) {
79
+ throw new Error("No signature");
80
+ }
81
+ return [4 /*yield*/, (0, buildTransaction_1.encodeToBroadcast)(algoTx, signature)];
82
+ case 4:
83
+ toBroadcast = _a.sent();
84
+ operation = buildOptimisticOperation(account, transaction);
85
+ o.next({
86
+ type: "signed",
87
+ signedOperation: {
88
+ operation: operation,
89
+ signature: toBroadcast,
90
+ expirationDate: null
91
+ }
92
+ });
93
+ return [2 /*return*/];
94
+ }
95
+ });
96
+ });
97
+ }
98
+ main().then(function () { return o.complete(); }, function (e) { return o.error(e); });
99
+ return function () {
100
+ cancelled = true;
101
+ };
102
+ });
103
+ });
104
+ };
105
+ exports.signOperation = signOperation;
106
+ var buildOptimisticOperation = function (account, transaction) {
107
+ var spendableBalance = account.spendableBalance, id = account.id, freshAddress = account.freshAddress, subAccounts = account.subAccounts;
108
+ var senders = [freshAddress];
109
+ var recipients = [transaction.recipient];
110
+ var subAccountId = transaction.subAccountId, fees = transaction.fees;
111
+ if (!fees) {
112
+ throw new errors_1.FeeNotLoaded();
113
+ }
114
+ var value = subAccountId
115
+ ? fees
116
+ : transaction.useAllAmount
117
+ ? spendableBalance
118
+ : transaction.amount.plus(fees);
119
+ var type = subAccountId
120
+ ? "FEES"
121
+ : transaction.mode === "optIn"
122
+ ? "OPT_IN"
123
+ : "OUT";
124
+ var op = {
125
+ id: "".concat(id, "--").concat(type),
126
+ hash: "",
127
+ type: type,
128
+ value: value,
129
+ fee: fees,
130
+ blockHash: null,
131
+ blockHeight: null,
132
+ senders: senders,
133
+ recipients: recipients,
134
+ accountId: id,
135
+ date: new Date(),
136
+ extra: {}
137
+ };
138
+ var tokenAccount = !subAccountId
139
+ ? null
140
+ : subAccounts && subAccounts.find(function (ta) { return ta.id === subAccountId; });
141
+ if (tokenAccount && subAccountId) {
142
+ op.subOperations = [
143
+ {
144
+ id: "".concat(subAccountId, "--OUT"),
145
+ hash: "",
146
+ type: "OUT",
147
+ value: transaction.useAllAmount
148
+ ? tokenAccount.balance
149
+ : transaction.amount,
150
+ fee: new bignumber_js_1.BigNumber(0),
151
+ blockHash: null,
152
+ blockHeight: null,
153
+ senders: senders,
154
+ recipients: recipients,
155
+ accountId: subAccountId,
156
+ date: new Date(),
157
+ extra: {}
158
+ },
159
+ ];
160
+ }
161
+ return op;
162
+ };
163
+ exports["default"] = exports.signOperation;
164
+ //# sourceMappingURL=js-signOperation.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"js-signOperation.js","sourceRoot":"","sources":["../../../src/families/algorand/js-signOperation.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6CAAyC;AACzC,6BAAkC;AAClC,2CAAgD;AAChD,8EAAiD;AAEjD,sDAAmD;AAEnD,uDAI4B;AAErB,IAAM,aAAa,GAAG,UAAC,EAQ7B;QAPC,OAAO,aAAA,EACP,WAAW,iBAAA,EACX,QAAQ,cAAA;IAMR,OAAA,IAAA,yBAAU,EAAC,QAAQ,CAAC,CAAC,UAAC,SAAS;QAC7B,OAAA,iBAAU,CAAC,MAAM,CAAC,UAAC,CAAC;YAClB,IAAI,SAAS,CAAC;YAEd,SAAe,IAAI;;;;;;gCACjB,IAAI,CAAC,WAAW,CAAC,IAAI,EAAE;oCACrB,MAAM,IAAI,qBAAY,EAAE,CAAC;iCAC1B;gCAEc,qBAAM,IAAA,0CAAuB,EAAC,OAAO,EAAE,WAAW,CAAC,EAAA;;gCAA5D,MAAM,GAAG,SAAmD;gCAEnD,qBAAM,IAAA,+BAAY,EAAC,MAAM,CAAC,EAAA;;gCAAnC,MAAM,GAAG,SAA0B;gCAEnC,KAAK,GAAG,IAAI,4BAAQ,CAAC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IAAI,YAAY,EAAE;QAChC,EAAE,CAAC,aAAa,GAAG;YACjB;gBACE,EAAE,EAAE,UAAG,YAAY,UAAO;gBAC1B,IAAI,EAAE,EAAE;gBACR,IAAI,EAAE,KAAK;gBACX,KAAK,EAAE,WAAW,CAAC,YAAY;oBAC7B,CAAC,CAAC,YAAY,CAAC,OAAO;oBACtB,CAAC,CAAC,WAAW,CAAC,MAAM;gBACtB,GAAG,EAAE,IAAI,wBAAS,CAAC,CAAC,CAAC;gBACrB,SAAS,EAAE,IAAI;gBACf,WAAW,EAAE,IAAI;gBACjB,OAAO,SAAA;gBACP,UAAU,YAAA;gBACV,SAAS,EAAE,YAAY;gBACvB,IAAI,EAAE,IAAI,IAAI,EAAE;gBAChB,KAAK,EAAE,EAAE;aACV;SACF,CAAC;KACH;IAED,OAAO,EAAE,CAAC;AACZ,CAAC,CAAC;AAEF,qBAAe,qBAAa,CAAC"}
@@ -0,0 +1,10 @@
1
+ import type { CryptoCurrency, Account, SyncConfig } from "../../types";
2
+ export declare const scanAccounts: (arg0: {
3
+ currency: CryptoCurrency;
4
+ deviceId: string;
5
+ scheme?: "" | "ethM" | "ethMM" | "bch_on_bitcoin_segwit" | "legacy_on_bch" | "vertcoin_128" | "vertcoin_128_segwit" | "etcM" | "aeternity" | "tezbox" | "tezosbip44h" | "galleonL" | "tezboxL" | "taproot" | "native_segwit" | "segwit" | "segwit_on_legacy" | "legacy_on_segwit" | "legacy_on_native_segwit" | "segwit_unsplit" | "sep5" | "unsplit" | "polkadotbip44" | "filecoin" | "solanaMain" | "solanaSub" | null | undefined;
6
+ syncConfig: SyncConfig;
7
+ preferredNewAccountScheme?: "" | "ethM" | "ethMM" | "bch_on_bitcoin_segwit" | "legacy_on_bch" | "vertcoin_128" | "vertcoin_128_segwit" | "etcM" | "aeternity" | "tezbox" | "tezosbip44h" | "galleonL" | "tezboxL" | "taproot" | "native_segwit" | "segwit" | "segwit_on_legacy" | "legacy_on_segwit" | "legacy_on_native_segwit" | "segwit_unsplit" | "sep5" | "unsplit" | "polkadotbip44" | "filecoin" | "solanaMain" | "solanaSub" | undefined;
8
+ }) => import("rxjs").Observable<import("../../types").ScanAccountEvent>;
9
+ export declare const sync: (initialAccount: Account, syncConfig: SyncConfig) => import("rxjs").Observable<(arg0: Account) => Account>;
10
+ //# sourceMappingURL=js-synchronization.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"js-synchronization.d.ts","sourceRoot":"","sources":["../../../src/families/algorand/js-synchronization.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,cAAc,EAEd,OAAO,EAIP,UAAU,EACX,MAAM,aAAa,CAAC;AAsarB,eAAO,MAAM,YAAY;;;;;;uEAAoC,CAAC;AAC9D,eAAO,MAAM,IAAI,4GAAsC,CAAC"}