@trezor/connect 9.1.5 → 9.1.7

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 (186) hide show
  1. package/CHANGELOG.md +66 -0
  2. package/README.md +1 -1
  3. package/lib/api/{binanceGetAddress.d.ts → binance/api/binanceGetAddress.d.ts} +4 -4
  4. package/lib/api/{binanceGetAddress.js → binance/api/binanceGetAddress.js} +10 -7
  5. package/lib/api/{binanceGetPublicKey.d.ts → binance/api/binanceGetPublicKey.d.ts} +3 -3
  6. package/lib/api/{binanceGetPublicKey.js → binance/api/binanceGetPublicKey.js} +5 -5
  7. package/lib/api/{binanceSignTransaction.d.ts → binance/api/binanceSignTransaction.d.ts} +3 -2
  8. package/lib/api/{binanceSignTransaction.js → binance/api/binanceSignTransaction.js} +8 -6
  9. package/lib/api/binance/api/index.d.ts +4 -0
  10. package/lib/api/binance/api/index.js +13 -0
  11. package/lib/api/binance/binanceSignTx.d.ts +1 -1
  12. package/lib/api/binance/binanceSignTx.js +2 -1
  13. package/lib/api/bitcoin/TransactionComposer.d.ts +4 -4
  14. package/lib/api/bitcoin/TransactionComposer.js +4 -18
  15. package/lib/api/bitcoin/inputs.d.ts +2 -2
  16. package/lib/api/bitcoin/inputs.js +4 -5
  17. package/lib/api/bitcoin/outputs.d.ts +4 -4
  18. package/lib/api/bitcoin/outputs.js +14 -23
  19. package/lib/api/blockchainEstimateFee.d.ts +2 -2
  20. package/lib/api/cardano/api/cardanoComposeTransaction.d.ts +8 -0
  21. package/lib/api/cardano/api/cardanoComposeTransaction.js +69 -0
  22. package/lib/api/{cardanoGetAddress.d.ts → cardano/api/cardanoGetAddress.d.ts} +4 -4
  23. package/lib/api/{cardanoGetAddress.js → cardano/api/cardanoGetAddress.js} +11 -8
  24. package/lib/api/{cardanoGetNativeScriptHash.d.ts → cardano/api/cardanoGetNativeScriptHash.d.ts} +3 -3
  25. package/lib/api/{cardanoGetNativeScriptHash.js → cardano/api/cardanoGetNativeScriptHash.js} +5 -5
  26. package/lib/api/{cardanoGetPublicKey.d.ts → cardano/api/cardanoGetPublicKey.d.ts} +3 -3
  27. package/lib/api/{cardanoGetPublicKey.js → cardano/api/cardanoGetPublicKey.js} +6 -6
  28. package/lib/api/{cardanoSignTransaction.d.ts → cardano/api/cardanoSignTransaction.d.ts} +19 -8
  29. package/lib/api/{cardanoSignTransaction.js → cardano/api/cardanoSignTransaction.js} +33 -13
  30. package/lib/api/cardano/api/index.d.ts +6 -0
  31. package/lib/api/cardano/api/index.js +17 -0
  32. package/lib/api/cardano/cardanoUtils.d.ts +6 -0
  33. package/lib/api/cardano/cardanoUtils.js +64 -1
  34. package/lib/api/common/paramsValidator.js +5 -3
  35. package/lib/api/composeTransaction.d.ts +5 -5
  36. package/lib/api/composeTransaction.js +14 -19
  37. package/lib/api/eos/api/eosGetPublicKey.d.ts +11 -0
  38. package/lib/api/{eosGetPublicKey.js → eos/api/eosGetPublicKey.js} +7 -5
  39. package/lib/api/{eosSignTransaction.d.ts → eos/api/eosSignTransaction.d.ts} +3 -2
  40. package/lib/api/{eosSignTransaction.js → eos/api/eosSignTransaction.js} +8 -6
  41. package/lib/api/eos/api/index.d.ts +3 -0
  42. package/lib/api/eos/api/index.js +11 -0
  43. package/lib/api/eos/eosSignTx.d.ts +1 -1
  44. package/lib/api/eos/eosSignTx.js +2 -1
  45. package/lib/api/{ethereumGetAddress.d.ts → ethereum/api/ethereumGetAddress.d.ts} +5 -5
  46. package/lib/api/{ethereumGetAddress.js → ethereum/api/ethereumGetAddress.js} +13 -10
  47. package/lib/api/ethereum/api/ethereumGetPublicKey.d.ts +16 -0
  48. package/lib/api/{ethereumGetPublicKey.js → ethereum/api/ethereumGetPublicKey.js} +6 -6
  49. package/lib/api/{ethereumSignMessage.d.ts → ethereum/api/ethereumSignMessage.d.ts} +3 -3
  50. package/lib/api/{ethereumSignMessage.js → ethereum/api/ethereumSignMessage.js} +7 -7
  51. package/lib/api/{ethereumSignTransaction.d.ts → ethereum/api/ethereumSignTransaction.d.ts} +12 -9
  52. package/lib/api/{ethereumSignTransaction.js → ethereum/api/ethereumSignTransaction.js} +38 -43
  53. package/lib/api/{ethereumSignTypedData.d.ts → ethereum/api/ethereumSignTypedData.d.ts} +3 -3
  54. package/lib/api/{ethereumSignTypedData.js → ethereum/api/ethereumSignTypedData.js} +10 -10
  55. package/lib/api/{ethereumVerifyMessage.d.ts → ethereum/api/ethereumVerifyMessage.d.ts} +2 -2
  56. package/lib/api/{ethereumVerifyMessage.js → ethereum/api/ethereumVerifyMessage.js} +3 -3
  57. package/lib/api/ethereum/api/index.d.ts +7 -0
  58. package/lib/api/ethereum/api/index.js +19 -0
  59. package/lib/api/ethereum/ethereumSignTx.d.ts +4 -2
  60. package/lib/api/ethereum/ethereumSignTx.js +19 -3
  61. package/lib/api/firmware/verifyAuthenticityProof.js +1 -1
  62. package/lib/api/firmware/x509certificate.d.ts +1 -0
  63. package/lib/api/firmware/x509certificate.js +34 -2
  64. package/lib/api/getAccountDescriptor.d.ts +20 -0
  65. package/lib/api/getAccountDescriptor.js +162 -0
  66. package/lib/api/getAccountInfo.d.ts +2 -0
  67. package/lib/api/getAddress.d.ts +1 -1
  68. package/lib/api/getAddress.js +4 -1
  69. package/lib/api/index.d.ts +1 -24
  70. package/lib/api/index.js +3 -50
  71. package/lib/api/nem/api/index.d.ts +3 -0
  72. package/lib/api/nem/api/index.js +11 -0
  73. package/lib/api/{nemGetAddress.d.ts → nem/api/nemGetAddress.d.ts} +4 -4
  74. package/lib/api/{nemGetAddress.js → nem/api/nemGetAddress.js} +10 -7
  75. package/lib/api/{nemSignTransaction.d.ts → nem/api/nemSignTransaction.d.ts} +2 -2
  76. package/lib/api/{nemSignTransaction.js → nem/api/nemSignTransaction.js} +7 -6
  77. package/lib/api/nem/nemSignTx.d.ts +1 -1
  78. package/lib/api/nem/nemSignTx.js +2 -1
  79. package/lib/api/ripple/api/index.d.ts +3 -0
  80. package/lib/api/ripple/api/index.js +11 -0
  81. package/lib/api/{rippleGetAddress.d.ts → ripple/api/rippleGetAddress.d.ts} +4 -4
  82. package/lib/api/{rippleGetAddress.js → ripple/api/rippleGetAddress.js} +10 -7
  83. package/lib/api/{rippleSignTransaction.d.ts → ripple/api/rippleSignTransaction.d.ts} +2 -2
  84. package/lib/api/{rippleSignTransaction.js → ripple/api/rippleSignTransaction.js} +7 -5
  85. package/lib/api/signTransaction.js +2 -0
  86. package/lib/api/solana/additionalInfo.d.ts +10 -0
  87. package/lib/api/solana/additionalInfo.js +33 -0
  88. package/lib/api/solana/api/index.d.ts +4 -0
  89. package/lib/api/solana/api/index.js +13 -0
  90. package/lib/api/solana/api/solanaGetAddress.d.ts +23 -0
  91. package/lib/api/solana/api/solanaGetAddress.js +133 -0
  92. package/lib/api/solana/api/solanaGetPublicKey.d.ts +12 -0
  93. package/lib/api/solana/api/solanaGetPublicKey.js +83 -0
  94. package/lib/api/solana/api/solanaSignTransaction.d.ts +10 -0
  95. package/lib/api/solana/api/solanaSignTransaction.js +34 -0
  96. package/lib/api/stellar/api/index.d.ts +3 -0
  97. package/lib/api/stellar/api/index.js +11 -0
  98. package/lib/api/{stellarGetAddress.d.ts → stellar/api/stellarGetAddress.d.ts} +4 -4
  99. package/lib/api/{stellarGetAddress.js → stellar/api/stellarGetAddress.js} +10 -7
  100. package/lib/api/{stellarSignTransaction.d.ts → stellar/api/stellarSignTransaction.d.ts} +2 -2
  101. package/lib/api/{stellarSignTransaction.js → stellar/api/stellarSignTransaction.js} +6 -6
  102. package/lib/api/tezos/api/index.d.ts +4 -0
  103. package/lib/api/tezos/api/index.js +13 -0
  104. package/lib/api/{tezosGetAddress.d.ts → tezos/api/tezosGetAddress.d.ts} +4 -4
  105. package/lib/api/{tezosGetAddress.js → tezos/api/tezosGetAddress.js} +10 -7
  106. package/lib/api/{tezosGetPublicKey.d.ts → tezos/api/tezosGetPublicKey.d.ts} +3 -3
  107. package/lib/api/{tezosGetPublicKey.js → tezos/api/tezosGetPublicKey.js} +7 -5
  108. package/lib/api/{tezosSignTransaction.d.ts → tezos/api/tezosSignTransaction.d.ts} +2 -2
  109. package/lib/api/{tezosSignTransaction.js → tezos/api/tezosSignTransaction.js} +5 -5
  110. package/lib/api/tezos/tezosSignTx.d.ts +1 -1
  111. package/lib/api/tezos/tezosSignTx.js +2 -1
  112. package/lib/backend/Blockchain.js +3 -0
  113. package/lib/constants/cardano.js +2 -2
  114. package/lib/constants/nem.js +3 -3
  115. package/lib/constants/network.d.ts +3 -0
  116. package/lib/constants/network.js +13 -1
  117. package/lib/core/AbstractMethod.js +3 -0
  118. package/lib/core/index.d.ts +3 -1
  119. package/lib/core/index.js +17 -4
  120. package/lib/core/method.d.ts +2 -2
  121. package/lib/core/method.js +8 -2
  122. package/lib/core/method.native.d.ts +5 -0
  123. package/lib/core/method.native.js +34 -0
  124. package/lib/data/DataManager.d.ts +22 -0
  125. package/lib/data/config.d.ts +22 -0
  126. package/lib/data/config.js +12 -1
  127. package/lib/data/connectSettings.js +4 -0
  128. package/lib/data/defaultFeeLevels.js +9 -0
  129. package/lib/data/deviceAuthenticityConfig.js +4 -1
  130. package/lib/data/firmwareInfo.d.ts +1 -1
  131. package/lib/data/firmwareInfo.js +4 -1
  132. package/lib/data/version.d.ts +1 -1
  133. package/lib/data/version.js +1 -1
  134. package/lib/device/Device.d.ts +3 -1
  135. package/lib/device/Device.js +23 -4
  136. package/lib/device/DeviceCommands.d.ts +2 -2
  137. package/lib/device/DeviceCommands.js +19 -3
  138. package/lib/device/DeviceList.js +4 -1
  139. package/lib/events/popup.d.ts +19 -3
  140. package/lib/events/popup.js +3 -0
  141. package/lib/events/ui-request.d.ts +1 -1
  142. package/lib/factory.js +5 -0
  143. package/lib/types/api/binance/index.d.ts +1 -0
  144. package/lib/types/api/bitcoin/index.d.ts +2 -0
  145. package/lib/types/api/cardano/index.d.ts +2 -0
  146. package/lib/types/api/cardanoComposeTransaction.d.ts +44 -0
  147. package/lib/types/api/cardanoComposeTransaction.js +3 -0
  148. package/lib/types/api/cardanoSignTransaction.d.ts +9 -0
  149. package/lib/types/api/composeTransaction.d.ts +28 -54
  150. package/lib/types/api/eos/index.d.ts +1 -0
  151. package/lib/types/api/ethereum/index.d.ts +2 -0
  152. package/lib/types/api/getAccountDescriptor.d.ts +16 -0
  153. package/lib/types/api/getAccountDescriptor.js +3 -0
  154. package/lib/types/api/index.d.ts +10 -0
  155. package/lib/types/api/nem/index.d.ts +1 -0
  156. package/lib/types/api/ripple/index.d.ts +1 -0
  157. package/lib/types/api/solana/index.d.ts +22 -0
  158. package/lib/types/api/solana/index.js +3 -0
  159. package/lib/types/api/solanaGetAddress.d.ts +4 -0
  160. package/lib/types/api/solanaGetAddress.js +3 -0
  161. package/lib/types/api/solanaGetPublicKey.d.ts +5 -0
  162. package/lib/types/api/solanaGetPublicKey.js +3 -0
  163. package/lib/types/api/solanaSignTransaction.d.ts +4 -0
  164. package/lib/types/api/solanaSignTransaction.js +3 -0
  165. package/lib/types/api/tezos/index.d.ts +1 -0
  166. package/lib/types/coinInfo.d.ts +5 -16
  167. package/lib/types/device.d.ts +1 -1
  168. package/lib/types/device.js +1 -1
  169. package/lib/types/index.d.ts +3 -1
  170. package/lib/types/index.js +1 -0
  171. package/lib/types/params.d.ts +3 -0
  172. package/lib/types/settings.d.ts +1 -0
  173. package/lib/utils/debug.d.ts +6 -3
  174. package/lib/utils/debug.js +13 -7
  175. package/lib/utils/deviceFeaturesUtils.js +8 -5
  176. package/lib/utils/formatUtils.d.ts +2 -0
  177. package/lib/utils/formatUtils.js +19 -1
  178. package/lib/workers/workers-browser.d.ts +2 -1
  179. package/lib/workers/workers-browser.js +3 -1
  180. package/lib/workers/workers-react-native.d.ts +2 -1
  181. package/lib/workers/workers-react-native.js +3 -1
  182. package/lib/workers/workers.d.ts +8 -5
  183. package/lib/workers/workers.js +34 -10
  184. package/package.json +22 -19
  185. package/lib/api/eosGetPublicKey.d.ts +0 -11
  186. package/lib/api/ethereumGetPublicKey.d.ts +0 -16
package/CHANGELOG.md CHANGED
@@ -1,3 +1,69 @@
1
+ # 9.1.7
2
+
3
+ - fix(connect): correct UiRequestConfirmation type in solanaGetPublicKey (a93ea1890)
4
+ - chore(connect): stricter UiRequestConfirmation types (f35bd28bf)
5
+ - feat(connect-common): add more backend urls for solana (29f042470)
6
+ - chore: Throttler throttling instead of debouncing in `@trezor/blockchain-link` (#10288) (f7ff0cf9f)
7
+ - feat(transport): accept encoding protocols as parameter of send, receive and call methods (b64af958e)
8
+ - fix(connect-explorer): fs, path, fallbacks in webpack (4f5a15e32)
9
+ - chore(connect-common): update fw binaries to 2.6.4 (398509788)
10
+ - docs(connect): update index page (8cb5262f6)
11
+ - feat(connect-explorer): update SVG in Header component (e8d9beace)
12
+ - feat(connect-explorer): update favicon image (a8d660dd2)
13
+ - feat(connect-explorer): add Solana (799bf63f5)
14
+ - chore(connect): update downgraded @ethereumjs libs (9ac430c42)
15
+ - chore(connect): add option for chunkify solana `getAddress` method (98d234f31)
16
+ - fix(connect-explorer-webextension): add commitHash to webpack (6b6b77d9d)
17
+ - feat(suite): add Solana support (f2a89b34f)
18
+ - chore: add Holesky (175707861,8776bb79c)
19
+ - feat(connect-explorer): version docs (6ea9ef1f2)
20
+ - fix(connect-popup): when connect-src not same as host popup display unknown origin (1bc6f2da1)
21
+ - feat(connect-explorer, connect): add `chunkify` paramater to getAddress and signTx methods (7e01923f0,2926b2bdb)
22
+ - fix(connect-popup): handle METHOD_INFO (e6d11072b)
23
+ - fix(connect): support unknown (custom) internal_models (0915d8893)
24
+ - fix(cardano): fee estimate for set-max output (c50a8f2c7)
25
+ - chore(connect): use `tslib` as dependency in all public libs (606ecc63b)
26
+ - chore: update `jest` and related dependency (b8a321c83)
27
+ - chore(connect-examples): cleanup unused lines in script (b509d24d5)
28
+ - chore(connect-webextension): postMessage useQueue param (4e626e758)
29
+ - chore(repo): update tsx (53de3e3a8)
30
+ - chore(connect): remove Solana beta console logs (3ea8343ee)
31
+ - chore(docs): add link to internal description of device authenticity config update (ee9ad470a)
32
+ - chore(connect): add new CA pubkeys and update timestamp (b64c3f411)
33
+
34
+ # 9.1.6
35
+
36
+ - chore(connect): remove web3-utils (2f683f6)
37
+ - feat(connect): serialize in ethereumSignTransaction (8f62896)
38
+ - feat(connect): add serializeEthereumTx util (a9b21a3)
39
+ - refactor(connect): improve ethereumSignTransaction (788910b)
40
+ - feat(connect-popup): shared worker logger load dynamically only when required (424383e, f5400f8)
41
+ - feat(connect): update solana backend urls, fee info, workers, account descriptor and fw integration (876f609, a3ae0ae, e1058ea, cadffc6, 3d9c703)
42
+ - feat(connect-popup): add new method that allow set to use core (d944e50)
43
+ - feat(core): new events for core in popup (242a169)
44
+ - chore(connect-iframe): suppress subtle crypto warning (1f0e722)
45
+ - feat(connect-iframe): standalone core build (c344c3d)
46
+ - feat(deps): update deps without breaking changes (7e0584c)
47
+ - fix(connect-web, connect-popup): remove trust-issues handle from query param (79036e8, b8640d8, 87b4b84)
48
+ - feat(connect-explorer): settings page to restart connect (33e41f6)
49
+ - feat(connect): update protobuf messages in custom Transports (if not set) (1eb5156)
50
+ - fix(connect): device.run race condition (7d0545c, 7978eab)
51
+ - feat(connect-common): add T2T1 & T2B1 firmware binaries 2.6.3 bootloader 2.1.4 (9cca8b1)
52
+ - fix(mobile): Fix modularized connect in React Native (57fcb9d, ba42388, 1ef62e7)
53
+ - chore(deps): bump @fivebinaries/coin-selection (5e16f60)
54
+ - chore(connect): ethereum api dynamic load (b22d228)
55
+ - chore(connect): cardano api dynamic load (3ef0e77)
56
+ - chore(connect): stellar api dynamic import (473ea94)
57
+ - chore(connect): nem api dynamic import (52e2f99)
58
+ - chore(connect): eos api dynamic import (cf5b3ad)
59
+ - chore(connect): binance api dynamic import (3ccf149)
60
+ - chore(connect): tezos api dynamic import (273a9fe)
61
+ - chore(connect): ripple api dynamic import (9b17e38)
62
+ - chore(connect): prepare for dynamic method import (d4868eb)
63
+ - chore(connect): blockchain link workers dynamic import (74fd083)
64
+ - chore(connect): implement @trezor/utxo-lib 2.0.0 (06a9f7a)
65
+ - feat(connect): add getAccountDescriptor method (0b005ec)
66
+
1
67
  # 9.1.5
2
68
 
3
69
  - feat(suite): T2B1 replace Model R name by official Trezor Safe 3 name (7460372ed1)
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @trezor/connect
2
2
 
3
- API version 9.1.5
3
+ API version 9.1.7
4
4
 
5
5
  [![Build Status](https://github.com/trezor/trezor-suite/actions/workflows/connect-test.yml/badge.svg)](https://github.com/trezor/trezor-suite/actions/workflows/connect-test.yml)
6
6
  [![NPM](https://img.shields.io/npm/v/@trezor/connect.svg)](https://www.npmjs.org/package/@trezor/connect)
@@ -1,5 +1,5 @@
1
- import { AbstractMethod } from '../core/AbstractMethod';
2
- import { PROTO } from '../constants';
1
+ import { AbstractMethod } from '../../../core/AbstractMethod';
2
+ import { PROTO } from '../../../constants';
3
3
  type Params = PROTO.BinanceGetAddress & {
4
4
  address?: string;
5
5
  };
@@ -16,8 +16,8 @@ export default class BinanceGetAddress extends AbstractMethod<'binanceGetAddress
16
16
  } | undefined;
17
17
  confirmation(): Promise<boolean>;
18
18
  noBackupConfirmation(): Promise<boolean>;
19
- _call({ address_n, show_display }: Params): Promise<PROTO.BinanceAddress>;
20
- run(): Promise<import("..").Address | import("..").Address[]>;
19
+ _call({ address_n, show_display, chunkify }: Params): Promise<PROTO.BinanceAddress>;
20
+ run(): Promise<import("../../..").Address | import("../../..").Address[]>;
21
21
  }
22
22
  export {};
23
23
  //# sourceMappingURL=binanceGetAddress.d.ts.map
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const AbstractMethod_1 = require("../core/AbstractMethod");
4
- const paramsValidator_1 = require("./common/paramsValidator");
5
- const coinInfo_1 = require("../data/coinInfo");
6
- const pathUtils_1 = require("../utils/pathUtils");
7
- const constants_1 = require("../constants");
8
- const events_1 = require("../events");
3
+ const AbstractMethod_1 = require("../../../core/AbstractMethod");
4
+ const paramsValidator_1 = require("../../common/paramsValidator");
5
+ const coinInfo_1 = require("../../../data/coinInfo");
6
+ const pathUtils_1 = require("../../../utils/pathUtils");
7
+ const constants_1 = require("../../../constants");
8
+ const events_1 = require("../../../events");
9
9
  class BinanceGetAddress extends AbstractMethod_1.AbstractMethod {
10
10
  constructor() {
11
11
  super(...arguments);
@@ -27,12 +27,14 @@ class BinanceGetAddress extends AbstractMethod_1.AbstractMethod {
27
27
  { name: 'path', required: true },
28
28
  { name: 'address', type: 'string' },
29
29
  { name: 'showOnTrezor', type: 'boolean' },
30
+ { name: 'chunkify', type: 'boolean' },
30
31
  ]);
31
32
  const path = (0, pathUtils_1.validatePath)(batch.path, 3);
32
33
  return {
33
34
  address_n: path,
34
35
  address: batch.address,
35
36
  show_display: typeof batch.showOnTrezor === 'boolean' ? batch.showOnTrezor : true,
37
+ chunkify: typeof batch.chunkify === 'boolean' ? batch.chunkify : false,
36
38
  };
37
39
  });
38
40
  const useEventListener = payload.useEventListener &&
@@ -79,11 +81,12 @@ class BinanceGetAddress extends AbstractMethod_1.AbstractMethod {
79
81
  const uiResp = await uiPromise.promise;
80
82
  return uiResp.payload;
81
83
  }
82
- async _call({ address_n, show_display }) {
84
+ async _call({ address_n, show_display, chunkify }) {
83
85
  const cmd = this.device.getCommands();
84
86
  const response = await cmd.typedCall('BinanceGetAddress', 'BinanceAddress', {
85
87
  address_n,
86
88
  show_display,
89
+ chunkify,
87
90
  });
88
91
  return response.message;
89
92
  }
@@ -1,11 +1,11 @@
1
- import { AbstractMethod } from '../core/AbstractMethod';
2
- import type { PROTO } from '../constants';
1
+ import { AbstractMethod } from '../../../core/AbstractMethod';
2
+ import type { PROTO } from '../../../constants';
3
3
  export default class BinanceGetPublicKey extends AbstractMethod<'binanceGetPublicKey', PROTO.BinanceGetPublicKey[]> {
4
4
  hasBundle?: boolean;
5
5
  confirmed?: boolean;
6
6
  init(): void;
7
7
  get info(): string;
8
8
  confirmation(): Promise<boolean>;
9
- run(): Promise<import("..").PublicKey | import("..").PublicKey[]>;
9
+ run(): Promise<import("../../..").PublicKey | import("../../..").PublicKey[]>;
10
10
  }
11
11
  //# sourceMappingURL=binanceGetPublicKey.d.ts.map
@@ -1,10 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const AbstractMethod_1 = require("../core/AbstractMethod");
4
- const paramsValidator_1 = require("./common/paramsValidator");
5
- const coinInfo_1 = require("../data/coinInfo");
6
- const pathUtils_1 = require("../utils/pathUtils");
7
- const events_1 = require("../events");
3
+ const AbstractMethod_1 = require("../../../core/AbstractMethod");
4
+ const paramsValidator_1 = require("../../common/paramsValidator");
5
+ const coinInfo_1 = require("../../../data/coinInfo");
6
+ const pathUtils_1 = require("../../../utils/pathUtils");
7
+ const events_1 = require("../../../events");
8
8
  class BinanceGetPublicKey extends AbstractMethod_1.AbstractMethod {
9
9
  init() {
10
10
  this.requiredPermissions = ['read'];
@@ -1,8 +1,9 @@
1
- import { AbstractMethod } from '../core/AbstractMethod';
2
- import type { BinancePreparedTransaction } from '../types/api/binance';
1
+ import { AbstractMethod } from '../../../core/AbstractMethod';
2
+ import type { BinancePreparedTransaction } from '../../../types/api/binance';
3
3
  type Params = {
4
4
  path: number[];
5
5
  transaction: BinancePreparedTransaction;
6
+ chunkify?: boolean;
6
7
  };
7
8
  export default class BinanceSignTransaction extends AbstractMethod<'binanceSignTransaction', Params> {
8
9
  init(): void;
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- const AbstractMethod_1 = require("../core/AbstractMethod");
5
- const paramsValidator_1 = require("./common/paramsValidator");
6
- const coinInfo_1 = require("../data/coinInfo");
7
- const pathUtils_1 = require("../utils/pathUtils");
8
- const helper = tslib_1.__importStar(require("./binance/binanceSignTx"));
4
+ const AbstractMethod_1 = require("../../../core/AbstractMethod");
5
+ const paramsValidator_1 = require("../../common/paramsValidator");
6
+ const coinInfo_1 = require("../../../data/coinInfo");
7
+ const pathUtils_1 = require("../../../utils/pathUtils");
8
+ const helper = tslib_1.__importStar(require("../binanceSignTx"));
9
9
  class BinanceSignTransaction extends AbstractMethod_1.AbstractMethod {
10
10
  init() {
11
11
  this.requiredPermissions = ['read', 'write'];
@@ -14,19 +14,21 @@ class BinanceSignTransaction extends AbstractMethod_1.AbstractMethod {
14
14
  (0, paramsValidator_1.validateParams)(payload, [
15
15
  { name: 'path', type: 'string', required: true },
16
16
  { name: 'transaction', required: true },
17
+ { name: 'chunkify', type: 'boolean' },
17
18
  ]);
18
19
  const path = (0, pathUtils_1.validatePath)(payload.path, 3);
19
20
  const transaction = helper.validate(payload.transaction);
20
21
  this.params = {
21
22
  path,
22
23
  transaction,
24
+ chunkify: typeof payload.chunkify === 'boolean' ? payload.chunkify : false,
23
25
  };
24
26
  }
25
27
  get info() {
26
28
  return 'Sign Binance transaction';
27
29
  }
28
30
  run() {
29
- return helper.signTx(this.device.getCommands().typedCall.bind(this.device.getCommands()), this.params.path, this.params.transaction);
31
+ return helper.signTx(this.device.getCommands().typedCall.bind(this.device.getCommands()), this.params.path, this.params.transaction, this.params.chunkify);
30
32
  }
31
33
  }
32
34
  exports.default = BinanceSignTransaction;
@@ -0,0 +1,4 @@
1
+ export { default as binanceGetAddress } from './binanceGetAddress';
2
+ export { default as binanceGetPublicKey } from './binanceGetPublicKey';
3
+ export { default as binanceSignTransaction } from './binanceSignTransaction';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.binanceSignTransaction = exports.binanceGetPublicKey = exports.binanceGetAddress = void 0;
7
+ var binanceGetAddress_1 = require("./binanceGetAddress");
8
+ Object.defineProperty(exports, "binanceGetAddress", { enumerable: true, get: function () { return __importDefault(binanceGetAddress_1).default; } });
9
+ var binanceGetPublicKey_1 = require("./binanceGetPublicKey");
10
+ Object.defineProperty(exports, "binanceGetPublicKey", { enumerable: true, get: function () { return __importDefault(binanceGetPublicKey_1).default; } });
11
+ var binanceSignTransaction_1 = require("./binanceSignTransaction");
12
+ Object.defineProperty(exports, "binanceSignTransaction", { enumerable: true, get: function () { return __importDefault(binanceSignTransaction_1).default; } });
13
+ //# sourceMappingURL=index.js.map
@@ -2,5 +2,5 @@ import { PROTO } from '../../constants';
2
2
  import type { BinanceSDKTransaction, BinancePreparedTransaction } from '../../types/api/binance';
3
3
  import type { TypedCall } from '../../device/DeviceCommands';
4
4
  export declare const validate: (tx: BinanceSDKTransaction) => BinancePreparedTransaction;
5
- export declare const signTx: (typedCall: TypedCall, address_n: number[], tx: BinancePreparedTransaction) => Promise<PROTO.BinanceSignedTx>;
5
+ export declare const signTx: (typedCall: TypedCall, address_n: number[], tx: BinancePreparedTransaction, chunkify?: boolean) => Promise<PROTO.BinanceSignedTx>;
6
6
  //# sourceMappingURL=binanceSignTx.d.ts.map
@@ -73,7 +73,7 @@ const validate = (tx) => {
73
73
  return preparedTx;
74
74
  };
75
75
  exports.validate = validate;
76
- const signTx = async (typedCall, address_n, tx) => {
76
+ const signTx = async (typedCall, address_n, tx, chunkify) => {
77
77
  const { account_number, chain_id, memo, sequence, source, messages } = tx;
78
78
  const msg_count = messages.length;
79
79
  await typedCall('BinanceSignTx', 'BinanceTxRequest', {
@@ -84,6 +84,7 @@ const signTx = async (typedCall, address_n, tx) => {
84
84
  memo,
85
85
  sequence,
86
86
  source,
87
+ chunkify,
87
88
  });
88
89
  return processTxRequest(typedCall, messages, 0);
89
90
  };
@@ -1,11 +1,11 @@
1
- import { ComposeInput, ComposeOutput, ComposeResult } from '@trezor/utxo-lib';
1
+ import { ComposeOutput } from '@trezor/utxo-lib';
2
2
  import { FeeLevels } from './Fees';
3
3
  import { Blockchain } from '../../backend/BlockchainLink';
4
4
  import type { BitcoinNetworkInfo, DiscoveryAccount, SelectFeeLevel } from '../../types';
5
- import type { PrecomposeParams } from '../../types/api/composeTransaction';
5
+ import type { ComposeUtxo, ComposedInputs, ComposeResult } from '../../types/api/composeTransaction';
6
6
  type Options = {
7
7
  account: DiscoveryAccount;
8
- utxo: PrecomposeParams['account']['utxo'];
8
+ utxos: ComposeUtxo[];
9
9
  outputs: ComposeOutput[];
10
10
  coinInfo: BitcoinNetworkInfo;
11
11
  baseFee?: number;
@@ -13,7 +13,7 @@ type Options = {
13
13
  };
14
14
  export declare class TransactionComposer {
15
15
  account: DiscoveryAccount;
16
- utxos: ComposeInput[];
16
+ utxos: ComposedInputs[];
17
17
  outputs: ComposeOutput[];
18
18
  coinInfo: BitcoinNetworkInfo;
19
19
  blockHeight: number;
@@ -5,7 +5,6 @@ const tslib_1 = require("tslib");
5
5
  const bignumber_js_1 = tslib_1.__importDefault(require("bignumber.js"));
6
6
  const utxo_lib_1 = require("@trezor/utxo-lib");
7
7
  const Fees_1 = require("./Fees");
8
- const pathUtils_1 = require("../../utils/pathUtils");
9
8
  class TransactionComposer {
10
9
  constructor(options) {
11
10
  this.blockHeight = 0;
@@ -24,22 +23,13 @@ class TransactionComposer {
24
23
  .concat(addresses.unused)
25
24
  .concat(addresses.change)
26
25
  .map(a => a.address);
27
- this.utxos = options.utxo.flatMap(u => {
28
- if (!u.required && new bignumber_js_1.default(u.amount).lt(this.coinInfo.dustLimit))
26
+ this.utxos = options.utxos.flatMap(u => {
27
+ if (!u.required && new bignumber_js_1.default(u.amount).lte(this.coinInfo.dustLimit))
29
28
  return [];
30
- const addressPath = (0, pathUtils_1.getHDPath)(u.path);
31
- const [chain, index] = addressPath.slice(addressPath.length - 2);
32
29
  return {
33
- index: u.vout,
34
- transactionHash: u.txid,
35
- value: u.amount,
36
- addressPath: [chain, index],
37
- height: u.blockHeight,
38
- tsize: 0,
39
- vsize: 0,
30
+ ...u,
40
31
  coinbase: typeof u.coinbase === 'boolean' ? u.coinbase : false,
41
32
  own: allAddresses.indexOf(u.address) >= 0,
42
- required: u.required,
43
33
  };
44
34
  });
45
35
  }
@@ -120,19 +110,15 @@ class TransactionComposer {
120
110
  return { type: 'error', error: 'ADDRESSES-NOT-SET' };
121
111
  const changeAddress = addresses.change.find(a => !a.transfers) ||
122
112
  addresses.change[addresses.change.length - 1];
123
- const changeId = (0, pathUtils_1.getHDPath)(changeAddress.path).slice(-1)[0];
124
113
  return (0, utxo_lib_1.composeTx)({
125
114
  txType: account.type,
126
115
  utxos: this.utxos,
127
116
  outputs: this.outputs,
128
- height: this.blockHeight,
129
117
  feeRate,
130
118
  longTermFeeRate: this.feeLevels.longTermFeeRate,
131
119
  skipPermutation: this.skipPermutation,
132
- basePath: account.address_n,
133
120
  network: coinInfo.network,
134
- changeId,
135
- changeAddress: changeAddress.address,
121
+ changeAddress,
136
122
  dustThreshold: coinInfo.dustLimit,
137
123
  baseFee,
138
124
  });
@@ -1,8 +1,8 @@
1
- import type { ComposedTxInput } from '@trezor/utxo-lib';
2
1
  import type { TypedRawTransaction } from '@trezor/blockchain-link';
3
2
  import type { BitcoinNetworkInfo, ProtoWithDerivationPath } from '../../types';
3
+ import type { ComposeUtxo } from '../../types/api/composeTransaction';
4
4
  import type { PROTO } from '../../constants';
5
5
  export declare const validateTrezorInputs: (inputs: ProtoWithDerivationPath<PROTO.TxInputType>[], coinInfo: BitcoinNetworkInfo) => PROTO.TxInputType[];
6
6
  export declare const enhanceTrezorInputs: (inputs: PROTO.TxInputType[], rawTxs: TypedRawTransaction[]) => void;
7
- export declare const inputToTrezor: (input: ComposedTxInput, sequence: number) => PROTO.TxInputType;
7
+ export declare const inputToTrezor: (input: ComposeUtxo, sequence?: number) => PROTO.TxInputType;
8
8
  //# sourceMappingURL=inputs.d.ts.map
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.inputToTrezor = exports.enhanceTrezorInputs = exports.validateTrezorInputs = void 0;
4
- const utils_1 = require("@trezor/utils");
5
4
  const pathUtils_1 = require("../../utils/pathUtils");
6
5
  const hdnodeUtils_1 = require("../../utils/hdnodeUtils");
7
6
  const paramsValidator_1 = require("../common/paramsValidator");
@@ -46,12 +45,12 @@ const enhanceTrezorInputs = (inputs, rawTxs) => {
46
45
  });
47
46
  };
48
47
  exports.enhanceTrezorInputs = enhanceTrezorInputs;
49
- const inputToTrezor = (input, sequence) => {
50
- const address_n = input.path;
48
+ const inputToTrezor = (input, sequence = 0xffffffff) => {
49
+ const address_n = (0, pathUtils_1.getHDPath)(input.path);
51
50
  return {
52
51
  address_n,
53
- prev_index: input.index,
54
- prev_hash: utils_1.bufferUtils.reverseBuffer(input.hash).toString('hex'),
52
+ prev_index: input.vout,
53
+ prev_hash: input.txid,
55
54
  script_type: (0, pathUtils_1.getScriptType)(address_n),
56
55
  amount: input.amount,
57
56
  sequence,
@@ -1,8 +1,8 @@
1
- import type { ComposeOutput as UtxoLibOutput, ComposedTxOutput } from '@trezor/utxo-lib';
1
+ import { ComposeOutput as ComposeOutputBase } from '@trezor/utxo-lib';
2
2
  import { PROTO } from '../../constants';
3
3
  import type { BitcoinNetworkInfo, ProtoWithDerivationPath } from '../../types';
4
- import type { ComposeOutput } from '../../types/api/composeTransaction';
4
+ import type { ComposeOutput, ComposeResultFinal } from '../../types/api/composeTransaction';
5
5
  export declare const validateTrezorOutputs: (outputs: ProtoWithDerivationPath<PROTO.TxOutputType>[], coinInfo: BitcoinNetworkInfo) => PROTO.TxOutputType[];
6
- export declare const validateHDOutput: (output: ComposeOutput, coinInfo: BitcoinNetworkInfo) => UtxoLibOutput;
7
- export declare const outputToTrezor: (output: ComposedTxOutput, _coinInfo: BitcoinNetworkInfo) => PROTO.TxOutputType;
6
+ export declare const validateHDOutput: (output: ComposeOutput, coinInfo: BitcoinNetworkInfo) => ComposeOutputBase;
7
+ export declare const outputToTrezor: (output: ComposeResultFinal['outputs'][number]) => PROTO.TxOutputType;
8
8
  //# sourceMappingURL=outputs.d.ts.map
@@ -45,7 +45,7 @@ const validateHDOutput = (output, coinInfo) => {
45
45
  (0, paramsValidator_1.validateParams)(output, [{ name: 'dataHex', type: 'string' }]);
46
46
  return {
47
47
  type: 'opreturn',
48
- dataHex: output.dataHex || '',
48
+ dataHex: output.dataHex,
49
49
  };
50
50
  case 'send-max':
51
51
  (0, paramsValidator_1.validateParams)(output, [{ name: 'address', type: 'string', required: true }]);
@@ -54,10 +54,10 @@ const validateHDOutput = (output, coinInfo) => {
54
54
  type: 'send-max',
55
55
  address: output.address,
56
56
  };
57
- case 'noaddress':
57
+ case 'payment-noaddress':
58
58
  (0, paramsValidator_1.validateParams)(output, [{ name: 'amount', type: 'uint', required: true }]);
59
59
  return {
60
- type: 'noaddress',
60
+ type: 'payment-noaddress',
61
61
  amount: output.amount,
62
62
  };
63
63
  case 'send-max-noaddress':
@@ -71,41 +71,32 @@ const validateHDOutput = (output, coinInfo) => {
71
71
  ]);
72
72
  validateAddress(output.address);
73
73
  return {
74
- type: 'complete',
74
+ type: 'payment',
75
75
  address: output.address,
76
76
  amount: output.amount,
77
77
  };
78
78
  }
79
79
  };
80
80
  exports.validateHDOutput = validateHDOutput;
81
- const outputToTrezor = (output, _coinInfo) => {
82
- if (output.opReturnData) {
83
- if (output.value) {
84
- throw constants_1.ERRORS.TypedError('Method_InvalidParameter', 'opReturn output should not contains value');
85
- }
81
+ const outputToTrezor = (output) => {
82
+ if (output.type === 'opreturn') {
86
83
  return {
87
84
  amount: '0',
88
- op_return_data: output.opReturnData.toString('hex'),
85
+ op_return_data: output.dataHex,
89
86
  script_type: 'PAYTOOPRETURN',
90
87
  };
91
88
  }
92
- if (!output.address && !output.path) {
93
- throw constants_1.ERRORS.TypedError('Method_InvalidParameter', 'Both address and path of an output cannot be null.');
94
- }
95
- if (output.path) {
89
+ if (output.type === 'change') {
90
+ const address_n = (0, pathUtils_1.getHDPath)(output.path);
96
91
  return {
97
- address_n: output.path,
98
- amount: output.value,
99
- script_type: (0, pathUtils_1.getOutputScriptType)(output.path),
92
+ address_n,
93
+ amount: output.amount,
94
+ script_type: (0, pathUtils_1.getOutputScriptType)(address_n),
100
95
  };
101
96
  }
102
- const { address, value } = output;
103
- if (typeof address !== 'string') {
104
- throw constants_1.ERRORS.TypedError('Method_InvalidParameter', 'Wrong output address type, should be string');
105
- }
106
97
  return {
107
- address,
108
- amount: value,
98
+ address: output.address,
99
+ amount: output.amount,
109
100
  script_type: 'PAYTOADDRESS',
110
101
  };
111
102
  };
@@ -1,4 +1,4 @@
1
- import { Payload, AbstractMethod } from '../core/AbstractMethod';
1
+ import { Payload, MethodReturnType, AbstractMethod } from '../core/AbstractMethod';
2
2
  import type { CoinInfo } from '../types';
3
3
  type Params = {
4
4
  coinInfo: CoinInfo;
@@ -6,7 +6,7 @@ type Params = {
6
6
  };
7
7
  export default class BlockchainEstimateFee extends AbstractMethod<'blockchainEstimateFee', Params> {
8
8
  init(): void;
9
- run(): Promise<import("../types/api/blockchainEstimateFee").BlockchainEstimatedFee | import("../types/api/blockchainEstimateFee").BlockchainEstimatedFeeLevel>;
9
+ run(): Promise<MethodReturnType<"blockchainEstimateFee">>;
10
10
  }
11
11
  export {};
12
12
  //# sourceMappingURL=blockchainEstimateFee.d.ts.map
@@ -0,0 +1,8 @@
1
+ import { AbstractMethod } from '../../../core/AbstractMethod';
2
+ import type { CardanoComposeTransactionParams, PrecomposedTransactionCardano } from '../../../types/api/cardanoComposeTransaction';
3
+ export default class CardanoComposeTransaction extends AbstractMethod<'cardanoComposeTransaction', CardanoComposeTransactionParams> {
4
+ init(): void;
5
+ get info(): string;
6
+ run(): Promise<PrecomposedTransactionCardano[]>;
7
+ }
8
+ //# sourceMappingURL=cardanoComposeTransaction.d.ts.map
@@ -0,0 +1,69 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const coin_selection_1 = require("@fivebinaries/coin-selection");
4
+ const AbstractMethod_1 = require("../../../core/AbstractMethod");
5
+ const paramsValidator_1 = require("../../common/paramsValidator");
6
+ const cardanoUtils_1 = require("../cardanoUtils");
7
+ class CardanoComposeTransaction extends AbstractMethod_1.AbstractMethod {
8
+ init() {
9
+ const { payload } = this;
10
+ (0, paramsValidator_1.validateParams)(payload, [
11
+ { name: 'account', type: 'object', required: true },
12
+ { name: 'feeLevels', type: 'array' },
13
+ { name: 'outputs', type: 'array' },
14
+ { name: 'certificates', type: 'array', allowEmpty: true },
15
+ { name: 'withdrawals', type: 'array', allowEmpty: true },
16
+ { name: 'changeAddress', type: 'object', required: true },
17
+ { name: 'addressParameters', type: 'object', required: true },
18
+ { name: 'testnet', type: 'boolean' },
19
+ ]);
20
+ this.useDevice = false;
21
+ this.useDeviceState = false;
22
+ this.useUi = false;
23
+ this.params = payload;
24
+ }
25
+ get info() {
26
+ return 'Compose Cardano transaction';
27
+ }
28
+ run() {
29
+ const { feeLevels = [{}], account, outputs = [], certificates = [], withdrawals = [], changeAddress, addressParameters, testnet, } = this.params;
30
+ const result = feeLevels.map(({ feePerUnit }) => {
31
+ try {
32
+ const txPlan = (0, cardanoUtils_1.composeTxPlan)(account.descriptor, account.utxo, outputs, certificates, withdrawals, changeAddress.address, !!testnet, { feeParams: feePerUnit ? { a: feePerUnit } : undefined });
33
+ return {
34
+ fee: txPlan.fee,
35
+ feePerByte: feePerUnit !== null && feePerUnit !== void 0 ? feePerUnit : '0',
36
+ deposit: txPlan.deposit,
37
+ totalSpent: txPlan.totalSpent,
38
+ max: txPlan.max,
39
+ ...(txPlan.type === 'nonfinal'
40
+ ? {
41
+ type: txPlan.type,
42
+ bytes: 0,
43
+ }
44
+ : {
45
+ type: txPlan.type,
46
+ bytes: txPlan.tx.size,
47
+ ttl: txPlan.ttl,
48
+ inputs: coin_selection_1.trezorUtils.transformToTrezorInputs(txPlan.inputs, account.utxo),
49
+ outputs: coin_selection_1.trezorUtils.transformToTrezorOutputs(txPlan.outputs, addressParameters),
50
+ unsignedTx: txPlan.tx,
51
+ }),
52
+ };
53
+ }
54
+ catch (error) {
55
+ if (error instanceof coin_selection_1.CoinSelectionError &&
56
+ error.code === 'UTXO_BALANCE_INSUFFICIENT') {
57
+ return { type: 'error', error: 'UTXO_BALANCE_INSUFFICIENT' };
58
+ }
59
+ if (error instanceof coin_selection_1.CoinSelectionError && error.code === 'UTXO_VALUE_TOO_SMALL') {
60
+ return { type: 'error', error: 'UTXO_VALUE_TOO_SMALL' };
61
+ }
62
+ return { type: 'error', error: error.message };
63
+ }
64
+ });
65
+ return Promise.resolve(result);
66
+ }
67
+ }
68
+ exports.default = CardanoComposeTransaction;
69
+ //# sourceMappingURL=cardanoComposeTransaction.js.map
@@ -1,5 +1,5 @@
1
- import { AbstractMethod } from '../core/AbstractMethod';
2
- import { PROTO } from '../constants';
1
+ import { AbstractMethod } from '../../../core/AbstractMethod';
2
+ import { PROTO } from '../../../constants';
3
3
  type Params = PROTO.CardanoGetAddress & {
4
4
  address?: string;
5
5
  };
@@ -16,9 +16,9 @@ export default class CardanoGetAddress extends AbstractMethod<'cardanoGetAddress
16
16
  } | undefined;
17
17
  confirmation(): Promise<boolean>;
18
18
  noBackupConfirmation(): Promise<boolean>;
19
- _call({ address_parameters, protocol_magic, network_id, derivation_type, show_display, }: Params): Promise<PROTO.CardanoAddress>;
19
+ _call({ address_parameters, protocol_magic, network_id, derivation_type, show_display, chunkify, }: Params): Promise<PROTO.CardanoAddress>;
20
20
  _ensureFirmwareSupportsBatch(batch: Params): void;
21
- run(): Promise<import("..").CardanoAddress | import("..").CardanoAddress[]>;
21
+ run(): Promise<import("../../..").CardanoAddress | import("../../..").CardanoAddress[]>;
22
22
  }
23
23
  export {};
24
24
  //# sourceMappingURL=cardanoGetAddress.d.ts.map