@trezor/connect 9.1.6 → 9.1.8

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 (96) hide show
  1. package/CHANGELOG.md +43 -0
  2. package/README.md +1 -1
  3. package/lib/api/binance/api/binanceGetAddress.d.ts +1 -1
  4. package/lib/api/binance/api/binanceGetAddress.js +4 -1
  5. package/lib/api/binance/api/binanceSignTransaction.d.ts +1 -0
  6. package/lib/api/binance/api/binanceSignTransaction.js +3 -1
  7. package/lib/api/binance/binanceSignTx.d.ts +1 -1
  8. package/lib/api/binance/binanceSignTx.js +2 -1
  9. package/lib/api/bitcoin/inputs.d.ts +2 -2
  10. package/lib/api/bitcoin/inputs.js +3 -3
  11. package/lib/api/bitcoin/refTx.d.ts +7 -7
  12. package/lib/api/bitcoin/refTx.js +69 -73
  13. package/lib/api/blockchainGetTransactions.d.ts +1 -1
  14. package/lib/api/cardano/api/cardanoGetAddress.d.ts +1 -1
  15. package/lib/api/cardano/api/cardanoGetAddress.js +4 -1
  16. package/lib/api/cardano/api/cardanoSignTransaction.d.ts +1 -0
  17. package/lib/api/cardano/api/cardanoSignTransaction.js +3 -0
  18. package/lib/api/changeWipeCode.d.ts +7 -0
  19. package/lib/api/changeWipeCode.js +22 -0
  20. package/lib/api/common/paramsValidator.js +5 -3
  21. package/lib/api/composeTransaction.js +4 -3
  22. package/lib/api/eos/api/eosGetPublicKey.js +2 -0
  23. package/lib/api/eos/api/eosSignTransaction.d.ts +1 -0
  24. package/lib/api/eos/api/eosSignTransaction.js +3 -1
  25. package/lib/api/eos/eosSignTx.d.ts +1 -1
  26. package/lib/api/eos/eosSignTx.js +2 -1
  27. package/lib/api/ethereum/api/ethereumGetAddress.d.ts +1 -1
  28. package/lib/api/ethereum/api/ethereumGetAddress.js +4 -1
  29. package/lib/api/ethereum/api/ethereumSignTransaction.d.ts +1 -0
  30. package/lib/api/ethereum/api/ethereumSignTransaction.js +7 -5
  31. package/lib/api/ethereum/ethereumSignTx.d.ts +4 -4
  32. package/lib/api/ethereum/ethereumSignTx.js +4 -2
  33. package/lib/api/getAddress.d.ts +1 -1
  34. package/lib/api/getAddress.js +4 -1
  35. package/lib/api/index.d.ts +1 -0
  36. package/lib/api/index.js +3 -1
  37. package/lib/api/nem/api/nemGetAddress.d.ts +1 -1
  38. package/lib/api/nem/api/nemGetAddress.js +4 -1
  39. package/lib/api/nem/api/nemSignTransaction.js +2 -1
  40. package/lib/api/nem/nemSignTx.d.ts +1 -1
  41. package/lib/api/nem/nemSignTx.js +2 -1
  42. package/lib/api/ripple/api/rippleGetAddress.d.ts +1 -1
  43. package/lib/api/ripple/api/rippleGetAddress.js +4 -1
  44. package/lib/api/ripple/api/rippleSignTransaction.js +3 -1
  45. package/lib/api/signTransaction.js +14 -4
  46. package/lib/api/solana/additionalInfo.d.ts +10 -0
  47. package/lib/api/solana/additionalInfo.js +33 -0
  48. package/lib/api/solana/api/solanaGetAddress.d.ts +1 -1
  49. package/lib/api/solana/api/solanaGetAddress.js +4 -2
  50. package/lib/api/solana/api/solanaGetPublicKey.js +1 -2
  51. package/lib/api/solana/api/solanaSignTransaction.js +2 -1
  52. package/lib/api/stellar/api/stellarGetAddress.d.ts +1 -1
  53. package/lib/api/stellar/api/stellarGetAddress.js +4 -1
  54. package/lib/api/tezos/api/tezosGetAddress.d.ts +1 -1
  55. package/lib/api/tezos/api/tezosGetAddress.js +4 -1
  56. package/lib/api/tezos/api/tezosGetPublicKey.js +2 -0
  57. package/lib/api/tezos/tezosSignTx.d.ts +1 -1
  58. package/lib/api/tezos/tezosSignTx.js +2 -1
  59. package/lib/backend/Blockchain.d.ts +2 -1
  60. package/lib/backend/Blockchain.js +4 -0
  61. package/lib/core/AbstractMethod.js +4 -1
  62. package/lib/data/DataManager.d.ts +11 -0
  63. package/lib/data/config.d.ts +11 -0
  64. package/lib/data/config.js +9 -2
  65. package/lib/data/defaultFeeLevels.js +1 -0
  66. package/lib/data/deviceAuthenticityConfig.js +4 -1
  67. package/lib/data/firmwareInfo.d.ts +1 -1
  68. package/lib/data/firmwareInfo.js +4 -1
  69. package/lib/data/version.d.ts +1 -1
  70. package/lib/data/version.js +1 -1
  71. package/lib/device/Device.d.ts +2 -0
  72. package/lib/device/Device.js +12 -2
  73. package/lib/device/DeviceCommands.d.ts +2 -2
  74. package/lib/device/DeviceCommands.js +10 -3
  75. package/lib/events/ui-request.d.ts +1 -1
  76. package/lib/factory.js +1 -0
  77. package/lib/types/api/binance/index.d.ts +1 -0
  78. package/lib/types/api/bitcoin/index.d.ts +2 -0
  79. package/lib/types/api/blockchainGetTransactions.d.ts +2 -2
  80. package/lib/types/api/cardano/index.d.ts +2 -0
  81. package/lib/types/api/changeWipeCode.d.ts +4 -0
  82. package/lib/types/api/changeWipeCode.js +3 -0
  83. package/lib/types/api/eos/index.d.ts +1 -0
  84. package/lib/types/api/ethereum/index.d.ts +1 -0
  85. package/lib/types/api/index.d.ts +2 -0
  86. package/lib/types/api/nem/index.d.ts +1 -0
  87. package/lib/types/api/ripple/index.d.ts +1 -0
  88. package/lib/types/api/solana/index.d.ts +10 -0
  89. package/lib/types/api/tezos/index.d.ts +1 -0
  90. package/lib/types/coinInfo.d.ts +3 -3
  91. package/lib/types/device.d.ts +1 -1
  92. package/lib/types/params.d.ts +3 -0
  93. package/lib/utils/debug.d.ts +5 -1
  94. package/lib/utils/debug.js +7 -6
  95. package/lib/utils/deviceFeaturesUtils.js +6 -5
  96. package/package.json +14 -15
@@ -334,12 +334,13 @@ const processTxRequest = async (typedCall, message, actions, index) => {
334
334
  }
335
335
  return processTxRequest(typedCall, ack.message, actions, index);
336
336
  };
337
- const signTx = async (typedCall, address_n, chain_id, header, actions) => {
337
+ const signTx = async (typedCall, address_n, chain_id, header, actions, chunkify) => {
338
338
  const response = await typedCall('EosSignTx', 'EosTxActionRequest', {
339
339
  address_n,
340
340
  chain_id,
341
341
  header,
342
342
  num_actions: actions.length,
343
+ chunkify,
343
344
  });
344
345
  return processTxRequest(typedCall, response.message, actions, 0);
345
346
  };
@@ -20,7 +20,7 @@ export default class EthereumGetAddress extends AbstractMethod<'ethereumGetAddre
20
20
  } | undefined;
21
21
  confirmation(): Promise<boolean>;
22
22
  noBackupConfirmation(): Promise<boolean>;
23
- _call({ address_n, show_display, encoded_network }: Params): Promise<{
23
+ _call({ address_n, show_display, encoded_network, chunkify }: Params): Promise<{
24
24
  path: number[];
25
25
  serializedPath: string;
26
26
  address: string;
@@ -29,6 +29,7 @@ class EthereumGetAddress extends AbstractMethod_1.AbstractMethod {
29
29
  { name: 'path', required: true },
30
30
  { name: 'address', type: 'string' },
31
31
  { name: 'showOnTrezor', type: 'boolean' },
32
+ { name: 'chunkify', type: 'boolean' },
32
33
  ]);
33
34
  const path = (0, pathUtils_1.validatePath)(batch.path, 3);
34
35
  const network = (0, coinInfo_1.getEthereumNetwork)(path);
@@ -38,6 +39,7 @@ class EthereumGetAddress extends AbstractMethod_1.AbstractMethod {
38
39
  show_display: typeof batch.showOnTrezor === 'boolean' ? batch.showOnTrezor : true,
39
40
  address: batch.address,
40
41
  network,
42
+ chunkify: typeof batch.chunkify === 'boolean' ? batch.chunkify : false,
41
43
  };
42
44
  });
43
45
  const useEventListener = payload.useEventListener &&
@@ -106,12 +108,13 @@ class EthereumGetAddress extends AbstractMethod_1.AbstractMethod {
106
108
  const uiResp = await uiPromise.promise;
107
109
  return uiResp.payload;
108
110
  }
109
- _call({ address_n, show_display, encoded_network }) {
111
+ _call({ address_n, show_display, encoded_network, chunkify }) {
110
112
  const cmd = this.device.getCommands();
111
113
  return cmd.ethereumGetAddress({
112
114
  address_n,
113
115
  show_display,
114
116
  encoded_network,
117
+ chunkify,
115
118
  });
116
119
  }
117
120
  async run() {
@@ -6,6 +6,7 @@ type Params = {
6
6
  path: number[];
7
7
  network?: EthereumNetworkInfo;
8
8
  definitions?: EthereumDefinitions;
9
+ chunkify: boolean;
9
10
  } & ({
10
11
  type: 'legacy';
11
12
  tx: EthereumTransaction;
@@ -23,9 +23,11 @@ class EthereumSignTransaction extends AbstractMethod_1.AbstractMethod {
23
23
  (0, paramsValidator_1.validateParams)(payload, [
24
24
  { name: 'path', required: true },
25
25
  { name: 'transaction', required: true },
26
+ { name: 'chunkify', type: 'boolean' },
26
27
  ]);
27
28
  const path = (0, pathUtils_1.validatePath)(payload.path, 3);
28
29
  const network = (0, coinInfo_1.getEthereumNetwork)(path);
30
+ const chunkify = typeof payload.chunkify === 'boolean' ? payload.chunkify : false;
29
31
  const tx = payload.transaction;
30
32
  const isEIP1559 = typeof tx.maxFeePerGas === 'string' && typeof tx.maxPriorityFeePerGas === 'string';
31
33
  this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(isEIP1559 ? 'eip1559' : this.name, network, this.firmwareRange);
@@ -40,7 +42,7 @@ class EthereumSignTransaction extends AbstractMethod_1.AbstractMethod {
40
42
  { name: 'data', type: 'string' },
41
43
  { name: 'chainId', type: 'number', required: true },
42
44
  ]);
43
- this.params = { path, network, type: 'eip1559', tx: strip(tx) };
45
+ this.params = { path, network, type: 'eip1559', tx: strip(tx), chunkify };
44
46
  }
45
47
  else {
46
48
  (0, paramsValidator_1.validateParams)(tx, [
@@ -53,7 +55,7 @@ class EthereumSignTransaction extends AbstractMethod_1.AbstractMethod {
53
55
  { name: 'chainId', type: 'number' },
54
56
  { name: 'txType', type: 'number' },
55
57
  ]);
56
- this.params = { path, network, type: 'legacy', tx: strip(tx) };
58
+ this.params = { path, network, type: 'legacy', tx: strip(tx), chunkify };
57
59
  }
58
60
  if (typeof tx.chainId !== 'number') {
59
61
  console.warn('TrezorConnect.ethereumSignTransaction: Missing chainId parameter!');
@@ -79,10 +81,10 @@ class EthereumSignTransaction extends AbstractMethod_1.AbstractMethod {
79
81
  return (0, ethereumUtils_1.getNetworkLabel)('Sign #NETWORK transaction', this.params.network);
80
82
  }
81
83
  async run() {
82
- const { type, tx, definitions } = this.params;
84
+ const { type, tx, definitions, chunkify } = this.params;
83
85
  const signature = type === 'eip1559'
84
- ? await helper.ethereumSignTxEIP1559(this.device.getCommands().typedCall.bind(this.device.getCommands()), this.params.path, tx.to, tx.value, tx.gasLimit, tx.maxFeePerGas, tx.maxPriorityFeePerGas, tx.nonce, tx.chainId, tx.data, tx.accessList, definitions)
85
- : await helper.ethereumSignTx(this.device.getCommands().typedCall.bind(this.device.getCommands()), this.params.path, tx.to, tx.value, tx.gasLimit, tx.gasPrice, tx.nonce, tx.chainId, tx.data, tx.txType, definitions);
86
+ ? await helper.ethereumSignTxEIP1559(this.device.getCommands().typedCall.bind(this.device.getCommands()), this.params.path, tx.to, tx.value, tx.gasLimit, tx.maxFeePerGas, tx.maxPriorityFeePerGas, tx.nonce, tx.chainId, chunkify, tx.data, tx.accessList, definitions)
87
+ : await helper.ethereumSignTx(this.device.getCommands().typedCall.bind(this.device.getCommands()), this.params.path, tx.to, tx.value, tx.gasLimit, tx.gasPrice, tx.nonce, tx.chainId, chunkify, tx.data, tx.txType, definitions);
86
88
  const serializedTx = helper.serializeEthereumTx({
87
89
  ...tx,
88
90
  ...signature,
@@ -1,14 +1,14 @@
1
- import { TxData, FeeMarketEIP1559TxData } from '@ethereumjs/tx';
1
+ import { FeeMarketEIP1559TxData, LegacyTxData } from '@ethereumjs/tx';
2
2
  import { EthereumDefinitions } from '@trezor/protobuf/lib/messages';
3
3
  import type { TypedCall } from '../../device/DeviceCommands';
4
4
  import type { EthereumAccessList } from '../../types/api/ethereum';
5
- export declare const serializeEthereumTx: (txData: TxData | FeeMarketEIP1559TxData, chainId: number) => string;
6
- export declare const ethereumSignTx: (typedCall: TypedCall, address_n: number[], to: string, value: string, gas_limit: string, gas_price: string, nonce: string, chain_id: number, data?: string, tx_type?: number, definitions?: EthereumDefinitions) => Promise<{
5
+ export declare const serializeEthereumTx: (txData: LegacyTxData | FeeMarketEIP1559TxData, chainId: number) => string;
6
+ export declare const ethereumSignTx: (typedCall: TypedCall, address_n: number[], to: string, value: string, gas_limit: string, gas_price: string, nonce: string, chain_id: number, chunkify: boolean, data?: string, tx_type?: number, definitions?: EthereumDefinitions) => Promise<{
7
7
  v: string;
8
8
  r: string;
9
9
  s: string;
10
10
  }>;
11
- export declare const ethereumSignTxEIP1559: (typedCall: TypedCall, address_n: number[], to: string, value: string, gas_limit: string, max_gas_fee: string, max_priority_fee: string, nonce: string, chain_id: number, data?: string, access_list?: EthereumAccessList[], definitions?: EthereumDefinitions) => Promise<{
11
+ export declare const ethereumSignTxEIP1559: (typedCall: TypedCall, address_n: number[], to: string, value: string, gas_limit: string, max_gas_fee: string, max_priority_fee: string, nonce: string, chain_id: number, chunkify: boolean, data?: string, access_list?: EthereumAccessList[], definitions?: EthereumDefinitions) => Promise<{
12
12
  v: string;
13
13
  r: string;
14
14
  s: string;
@@ -51,7 +51,7 @@ const stripLeadingZeroes = (str) => {
51
51
  }
52
52
  return str;
53
53
  };
54
- const ethereumSignTx = async (typedCall, address_n, to, value, gas_limit, gas_price, nonce, chain_id, data, tx_type, definitions) => {
54
+ const ethereumSignTx = async (typedCall, address_n, to, value, gas_limit, gas_price, nonce, chain_id, chunkify, data, tx_type, definitions) => {
55
55
  const length = data == null ? 0 : data.length / 2;
56
56
  const [first, rest] = splitString(data, 1024 * 2);
57
57
  let message = {
@@ -63,6 +63,7 @@ const ethereumSignTx = async (typedCall, address_n, to, value, gas_limit, gas_pr
63
63
  to,
64
64
  value: stripLeadingZeroes(value),
65
65
  definitions,
66
+ chunkify,
66
67
  };
67
68
  if (length !== 0) {
68
69
  message = {
@@ -81,7 +82,7 @@ const ethereumSignTx = async (typedCall, address_n, to, value, gas_limit, gas_pr
81
82
  return processTxRequest(typedCall, response.message, rest, chain_id);
82
83
  };
83
84
  exports.ethereumSignTx = ethereumSignTx;
84
- const ethereumSignTxEIP1559 = async (typedCall, address_n, to, value, gas_limit, max_gas_fee, max_priority_fee, nonce, chain_id, data, access_list, definitions) => {
85
+ const ethereumSignTxEIP1559 = async (typedCall, address_n, to, value, gas_limit, max_gas_fee, max_priority_fee, nonce, chain_id, chunkify, data, access_list, definitions) => {
85
86
  const length = data == null ? 0 : data.length / 2;
86
87
  const [first, rest] = splitString(data, 1024 * 2);
87
88
  const message = {
@@ -100,6 +101,7 @@ const ethereumSignTxEIP1559 = async (typedCall, address_n, to, value, gas_limit,
100
101
  storage_keys: a.storageKeys,
101
102
  })),
102
103
  definitions,
104
+ chunkify,
103
105
  };
104
106
  const response = await typedCall('EthereumSignTxEIP1559', 'EthereumTxRequest', message);
105
107
  return processTxRequest(typedCall, response.message, rest);
@@ -19,7 +19,7 @@ export default class GetAddress extends AbstractMethod<'getAddress', Params[]> {
19
19
  } | undefined;
20
20
  confirmation(): Promise<boolean>;
21
21
  noBackupConfirmation(): Promise<boolean>;
22
- _call({ address_n, show_display, multisig, script_type, coinInfo, unlockPath }: Params): Promise<{
22
+ _call({ address_n, show_display, multisig, script_type, coinInfo, unlockPath, chunkify, }: Params): Promise<{
23
23
  path: number[];
24
24
  serializedPath: string;
25
25
  address: string;
@@ -30,6 +30,7 @@ class GetAddress extends AbstractMethod_1.AbstractMethod {
30
30
  { name: 'multisig', type: 'object' },
31
31
  { name: 'scriptType', type: 'string' },
32
32
  { name: 'unlockPath', type: 'object' },
33
+ { name: 'chunkify', type: 'boolean' },
33
34
  ]);
34
35
  if (batch.unlockPath) {
35
36
  (0, paramsValidator_1.validateParams)(batch.unlockPath, [
@@ -63,6 +64,7 @@ class GetAddress extends AbstractMethod_1.AbstractMethod {
63
64
  script_type: batch.scriptType,
64
65
  coinInfo,
65
66
  unlockPath: batch.unlockPath,
67
+ chunkify: typeof batch.chunkify === 'boolean' ? batch.chunkify : false,
66
68
  };
67
69
  });
68
70
  const useEventListener = payload.useEventListener &&
@@ -114,7 +116,7 @@ class GetAddress extends AbstractMethod_1.AbstractMethod {
114
116
  const uiResp = await uiPromise.promise;
115
117
  return uiResp.payload;
116
118
  }
117
- async _call({ address_n, show_display, multisig, script_type, coinInfo, unlockPath }) {
119
+ async _call({ address_n, show_display, multisig, script_type, coinInfo, unlockPath, chunkify, }) {
118
120
  const cmd = this.device.getCommands();
119
121
  if (unlockPath) {
120
122
  await cmd.unlockPath(unlockPath);
@@ -124,6 +126,7 @@ class GetAddress extends AbstractMethod_1.AbstractMethod {
124
126
  show_display,
125
127
  multisig,
126
128
  script_type,
129
+ chunkify,
127
130
  }, coinInfo);
128
131
  }
129
132
  async run() {
@@ -17,6 +17,7 @@ export { default as blockchainSubscribeFiatRates } from './blockchainSubscribeFi
17
17
  export { default as blockchainUnsubscribe } from './blockchainUnsubscribe';
18
18
  export { default as blockchainUnsubscribeFiatRates } from './blockchainUnsubscribeFiatRates';
19
19
  export { default as changePin } from './changePin';
20
+ export { default as changeWipeCode } from './changeWipeCode';
20
21
  export { default as cipherKeyValue } from './cipherKeyValue';
21
22
  export { default as composeTransaction } from './composeTransaction';
22
23
  export { default as firmwareUpdate } from './firmwareUpdate';
package/lib/api/index.js CHANGED
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.checkFirmwareAuthenticity = exports.wipeDevice = exports.verifyMessage = exports.unlockPath = exports.signTransaction = exports.signMessage = exports.setProxy = exports.setBusy = exports.resetDevice = exports.requestLogin = exports.recoveryDevice = exports.rebootToBootloader = exports.pushTransaction = exports.getSettings = exports.getPublicKey = exports.getOwnershipProof = exports.getOwnershipId = exports.getFirmwareHash = exports.getFeatures = exports.getDeviceState = exports.getCoinInfo = exports.getAddress = exports.getAccountInfo = exports.getAccountDescriptor = exports.firmwareUpdate = exports.composeTransaction = exports.cipherKeyValue = exports.changePin = exports.blockchainUnsubscribeFiatRates = exports.blockchainUnsubscribe = exports.blockchainSubscribeFiatRates = exports.blockchainSubscribe = exports.blockchainSetCustomBackend = exports.blockchainGetTransactions = exports.blockchainGetFiatRatesForTimestamps = exports.blockchainGetCurrentFiatRates = exports.blockchainGetAccountBalanceHistory = exports.blockchainEstimateFee = exports.blockchainDisconnect = exports.backupDevice = exports.showDeviceTutorial = exports.cancelCoinjoinAuthorization = exports.authorizeCoinjoin = exports.authenticateDevice = exports.applySettings = exports.applyFlags = void 0;
6
+ exports.checkFirmwareAuthenticity = exports.wipeDevice = exports.verifyMessage = exports.unlockPath = exports.signTransaction = exports.signMessage = exports.setProxy = exports.setBusy = exports.resetDevice = exports.requestLogin = exports.recoveryDevice = exports.rebootToBootloader = exports.pushTransaction = exports.getSettings = exports.getPublicKey = exports.getOwnershipProof = exports.getOwnershipId = exports.getFirmwareHash = exports.getFeatures = exports.getDeviceState = exports.getCoinInfo = exports.getAddress = exports.getAccountInfo = exports.getAccountDescriptor = exports.firmwareUpdate = exports.composeTransaction = exports.cipherKeyValue = exports.changeWipeCode = exports.changePin = exports.blockchainUnsubscribeFiatRates = exports.blockchainUnsubscribe = exports.blockchainSubscribeFiatRates = exports.blockchainSubscribe = exports.blockchainSetCustomBackend = exports.blockchainGetTransactions = exports.blockchainGetFiatRatesForTimestamps = exports.blockchainGetCurrentFiatRates = exports.blockchainGetAccountBalanceHistory = exports.blockchainEstimateFee = exports.blockchainDisconnect = exports.backupDevice = exports.showDeviceTutorial = exports.cancelCoinjoinAuthorization = exports.authorizeCoinjoin = exports.authenticateDevice = exports.applySettings = exports.applyFlags = void 0;
7
7
  var applyFlags_1 = require("./applyFlags");
8
8
  Object.defineProperty(exports, "applyFlags", { enumerable: true, get: function () { return __importDefault(applyFlags_1).default; } });
9
9
  var applySettings_1 = require("./applySettings");
@@ -42,6 +42,8 @@ var blockchainUnsubscribeFiatRates_1 = require("./blockchainUnsubscribeFiatRates
42
42
  Object.defineProperty(exports, "blockchainUnsubscribeFiatRates", { enumerable: true, get: function () { return __importDefault(blockchainUnsubscribeFiatRates_1).default; } });
43
43
  var changePin_1 = require("./changePin");
44
44
  Object.defineProperty(exports, "changePin", { enumerable: true, get: function () { return __importDefault(changePin_1).default; } });
45
+ var changeWipeCode_1 = require("./changeWipeCode");
46
+ Object.defineProperty(exports, "changeWipeCode", { enumerable: true, get: function () { return __importDefault(changeWipeCode_1).default; } });
45
47
  var cipherKeyValue_1 = require("./cipherKeyValue");
46
48
  Object.defineProperty(exports, "cipherKeyValue", { enumerable: true, get: function () { return __importDefault(cipherKeyValue_1).default; } });
47
49
  var composeTransaction_1 = require("./composeTransaction");
@@ -16,7 +16,7 @@ export default class NEMGetAddress extends AbstractMethod<'nemGetAddress', Param
16
16
  } | undefined;
17
17
  confirmation(): Promise<boolean>;
18
18
  noBackupConfirmation(): Promise<boolean>;
19
- _call({ address_n, network, show_display }: Params): Promise<PROTO.NEMAddress>;
19
+ _call({ address_n, network, show_display, chunkify }: Params): Promise<PROTO.NEMAddress>;
20
20
  run(): Promise<import("../../..").Address | import("../../..").Address[]>;
21
21
  }
22
22
  export {};
@@ -31,6 +31,7 @@ class NEMGetAddress extends AbstractMethod_1.AbstractMethod {
31
31
  { name: 'address', type: 'string' },
32
32
  { name: 'network', type: 'number' },
33
33
  { name: 'showOnTrezor', type: 'boolean' },
34
+ { name: 'chunkify', type: 'boolean' },
34
35
  ]);
35
36
  const path = (0, pathUtils_1.validatePath)(batch.path, 3);
36
37
  return {
@@ -38,6 +39,7 @@ class NEMGetAddress extends AbstractMethod_1.AbstractMethod {
38
39
  network: batch.network || MAINNET,
39
40
  show_display: typeof batch.showOnTrezor === 'boolean' ? batch.showOnTrezor : true,
40
41
  address: batch.address,
42
+ chunkify: typeof batch.chunkify === 'boolean' ? batch.chunkify : false,
41
43
  };
42
44
  });
43
45
  const useEventListener = payload.useEventListener &&
@@ -96,12 +98,13 @@ class NEMGetAddress extends AbstractMethod_1.AbstractMethod {
96
98
  const uiResp = await uiPromise.promise;
97
99
  return uiResp.payload;
98
100
  }
99
- async _call({ address_n, network, show_display }) {
101
+ async _call({ address_n, network, show_display, chunkify }) {
100
102
  const cmd = this.device.getCommands();
101
103
  const response = await cmd.typedCall('NEMGetAddress', 'NEMAddress', {
102
104
  address_n,
103
105
  network,
104
106
  show_display,
107
+ chunkify,
105
108
  });
106
109
  return response.message;
107
110
  }
@@ -14,9 +14,10 @@ class NEMSignTransaction extends AbstractMethod_1.AbstractMethod {
14
14
  (0, paramsValidator_1.validateParams)(payload, [
15
15
  { name: 'path', 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
- this.params = helper.createTx(payload.transaction, path);
20
+ this.params = helper.createTx(payload.transaction, path, payload.chunkify);
20
21
  }
21
22
  get info() {
22
23
  return 'Sign NEM transaction';
@@ -1,4 +1,4 @@
1
1
  import { PROTO } from '../../constants';
2
2
  import * as $T from '../../types/api/nem';
3
- export declare const createTx: (tx: $T.NEMTransaction, address_n: number[]) => PROTO.NEMSignTx;
3
+ export declare const createTx: (tx: $T.NEMTransaction, address_n: number[], chunkify?: boolean) => PROTO.NEMSignTx;
4
4
  //# sourceMappingURL=nemSignTx.d.ts.map
@@ -92,9 +92,10 @@ const supplyChangeMessage = (tx) => ({
92
92
  type: tx.supplyType,
93
93
  delta: tx.delta,
94
94
  });
95
- const createTx = (tx, address_n) => {
95
+ const createTx = (tx, address_n, chunkify) => {
96
96
  let transaction = tx;
97
97
  const message = {
98
+ chunkify: typeof chunkify === 'boolean' ? chunkify : false,
98
99
  transaction: getCommon(tx, address_n),
99
100
  transfer: undefined,
100
101
  importance_transfer: undefined,
@@ -16,7 +16,7 @@ export default class RippleGetAddress extends AbstractMethod<'rippleGetAddress',
16
16
  } | undefined;
17
17
  confirmation(): Promise<boolean>;
18
18
  noBackupConfirmation(): Promise<boolean>;
19
- _call({ address_n, show_display }: Params): Promise<PROTO.RippleAddress>;
19
+ _call({ address_n, show_display, chunkify }: Params): Promise<PROTO.RippleAddress>;
20
20
  run(): Promise<import("../../..").Address | import("../../..").Address[]>;
21
21
  }
22
22
  export {};
@@ -27,12 +27,14 @@ class RippleGetAddress 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 RippleGetAddress 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('RippleGetAddress', 'RippleAddress', {
85
87
  address_n,
86
88
  show_display,
89
+ chunkify,
87
90
  });
88
91
  return response.message;
89
92
  }
@@ -12,9 +12,10 @@ class RippleSignTransaction extends AbstractMethod_1.AbstractMethod {
12
12
  (0, paramsValidator_1.validateParams)(payload, [
13
13
  { name: 'path', required: true },
14
14
  { name: 'transaction', required: true },
15
+ { name: 'chunkify', type: 'boolean' },
15
16
  ]);
16
17
  const path = (0, pathUtils_1.validatePath)(payload.path, 5);
17
- const { transaction } = payload;
18
+ const { transaction, chunkify } = payload;
18
19
  (0, paramsValidator_1.validateParams)(transaction, [
19
20
  { name: 'fee', type: 'uint' },
20
21
  { name: 'flags', type: 'number' },
@@ -38,6 +39,7 @@ class RippleSignTransaction extends AbstractMethod_1.AbstractMethod {
38
39
  destination: transaction.payment.destination,
39
40
  destination_tag: transaction.payment.destinationTag,
40
41
  },
42
+ chunkify: typeof chunkify === 'boolean' ? chunkify : false,
41
43
  };
42
44
  }
43
45
  get info() {
@@ -35,6 +35,7 @@ class SignTransaction extends AbstractMethod_1.AbstractMethod {
35
35
  { name: 'amountUnit', type: ['number', 'string'] },
36
36
  { name: 'unlockPath', type: 'object' },
37
37
  { name: 'serialize', type: 'boolean' },
38
+ { name: 'chunkify', type: 'boolean' },
38
39
  ]);
39
40
  if (payload.unlockPath) {
40
41
  (0, paramsValidator_1.validateParams)(payload.unlockPath, [
@@ -86,6 +87,7 @@ class SignTransaction extends AbstractMethod_1.AbstractMethod {
86
87
  amount_unit: payload.amountUnit,
87
88
  serialize: payload.serialize,
88
89
  coinjoin_request: payload.coinjoinRequest,
90
+ chunkify: typeof payload.chunkify === 'boolean' ? payload.chunkify : false,
89
91
  },
90
92
  coinInfo,
91
93
  push: typeof payload.push === 'boolean' ? payload.push : false,
@@ -123,15 +125,23 @@ class SignTransaction extends AbstractMethod_1.AbstractMethod {
123
125
  const blockchain = await (0, BlockchainLink_1.initBlockchain)(coinInfo, this.postMessage);
124
126
  const refTxs = !refTxsIds.length
125
127
  ? []
126
- : await blockchain.getTransactions(refTxsIds).then(rawTxs => {
128
+ : await blockchain
129
+ .getTransactionHexes(refTxsIds)
130
+ .then((0, bitcoin_1.parseTransactionHexes)(coinInfo.network))
131
+ .then(rawTxs => {
127
132
  (0, bitcoin_1.enhanceTrezorInputs)(this.params.inputs, rawTxs);
128
- return (0, bitcoin_1.transformReferencedTransactions)(rawTxs, coinInfo);
133
+ return (0, bitcoin_1.transformReferencedTransactions)(rawTxs);
129
134
  });
130
135
  const origTxs = !origTxsIds.length
131
136
  ? []
132
- : await blockchain.getTransactions(origTxsIds).then(async (rawOrigTxs) => {
137
+ : await blockchain
138
+ .getTransactionHexes(origTxsIds)
139
+ .then((0, bitcoin_1.parseTransactionHexes)(coinInfo.network))
140
+ .then(async (rawOrigTxs) => {
133
141
  const accountAddresses = addresses !== null && addresses !== void 0 ? addresses : (await this.fetchAddresses(blockchain));
134
- return (0, bitcoin_1.transformOrigTransactions)(rawOrigTxs, coinInfo, accountAddresses);
142
+ if (!accountAddresses)
143
+ return [];
144
+ return (0, bitcoin_1.transformOrigTransactions)(rawOrigTxs, coinInfo, inputs, accountAddresses);
135
145
  });
136
146
  return refTxs.concat(origTxs);
137
147
  }
@@ -0,0 +1,10 @@
1
+ import { SolanaTxAdditionalInfo } from '../../types/api/solana';
2
+ export declare const transformAdditionalInfo: (additionalInfo?: SolanaTxAdditionalInfo) => {
3
+ token_accounts_infos: {
4
+ base_address: string;
5
+ token_program: string;
6
+ token_mint: string;
7
+ token_account: string;
8
+ }[];
9
+ } | undefined;
10
+ //# sourceMappingURL=additionalInfo.d.ts.map
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.transformAdditionalInfo = void 0;
4
+ const paramsValidator_1 = require("../common/paramsValidator");
5
+ const validateAdditionalInfo = (additionalInfo) => {
6
+ var _a;
7
+ (0, paramsValidator_1.validateParams)(additionalInfo, [{ name: 'tokenAccountsInfos', type: 'array' }]);
8
+ (_a = additionalInfo.tokenAccountsInfos) === null || _a === void 0 ? void 0 : _a.forEach(tokenAccountInfo => {
9
+ (0, paramsValidator_1.validateParams)(tokenAccountInfo, [
10
+ { name: 'baseAddress', type: 'string', required: true },
11
+ { name: 'tokenProgram', type: 'string', required: true },
12
+ { name: 'tokenMint', type: 'string', required: true },
13
+ { name: 'tokenAccount', type: 'string', required: true },
14
+ ]);
15
+ });
16
+ };
17
+ const transformAdditionalInfo = (additionalInfo) => {
18
+ var _a;
19
+ if (!additionalInfo) {
20
+ return undefined;
21
+ }
22
+ validateAdditionalInfo(additionalInfo);
23
+ return {
24
+ token_accounts_infos: ((_a = additionalInfo.tokenAccountsInfos) === null || _a === void 0 ? void 0 : _a.map(tokenAccountInfo => ({
25
+ base_address: tokenAccountInfo.baseAddress,
26
+ token_program: tokenAccountInfo.tokenProgram,
27
+ token_mint: tokenAccountInfo.tokenMint,
28
+ token_account: tokenAccountInfo.tokenAccount,
29
+ }))) || [],
30
+ };
31
+ };
32
+ exports.transformAdditionalInfo = transformAdditionalInfo;
33
+ //# sourceMappingURL=additionalInfo.js.map
@@ -16,7 +16,7 @@ export default class SolanaGetAddress extends AbstractMethod<'solanaGetAddress',
16
16
  } | undefined;
17
17
  confirmation(): Promise<boolean>;
18
18
  noBackupConfirmation(): Promise<boolean>;
19
- _call({ address_n, show_display }: Params): Promise<PROTO.SolanaAddress>;
19
+ _call({ address_n, show_display, chunkify }: Params): Promise<PROTO.SolanaAddress>;
20
20
  run(): Promise<import("../../..").Address | import("../../..").Address[]>;
21
21
  }
22
22
  export {};
@@ -12,7 +12,6 @@ class SolanaGetAddress extends AbstractMethod_1.AbstractMethod {
12
12
  this.progress = 0;
13
13
  }
14
14
  init() {
15
- console.warn('⚠️ BETA: This api is unstable and may change!');
16
15
  this.requiredPermissions = ['read'];
17
16
  this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, (0, coinInfo_1.getMiscNetwork)('Solana'), this.firmwareRange);
18
17
  this.hasBundle = !!this.payload.bundle;
@@ -25,12 +24,14 @@ class SolanaGetAddress extends AbstractMethod_1.AbstractMethod {
25
24
  { name: 'path', required: true },
26
25
  { name: 'address', type: 'string' },
27
26
  { name: 'showOnTrezor', type: 'boolean' },
27
+ { name: 'chunkify', type: 'boolean' },
28
28
  ]);
29
29
  const path = (0, pathUtils_1.validatePath)(batch.path, 2);
30
30
  return {
31
31
  address_n: path,
32
32
  address: batch.address,
33
33
  show_display: typeof batch.showOnTrezor === 'boolean' ? batch.showOnTrezor : true,
34
+ chunkify: typeof batch.chunkify === 'boolean' ? batch.chunkify : false,
34
35
  };
35
36
  });
36
37
  const useEventListener = payload.useEventListener &&
@@ -84,11 +85,12 @@ class SolanaGetAddress extends AbstractMethod_1.AbstractMethod {
84
85
  const uiResp = await uiPromise.promise;
85
86
  return uiResp.payload;
86
87
  }
87
- async _call({ address_n, show_display }) {
88
+ async _call({ address_n, show_display, chunkify }) {
88
89
  const cmd = this.device.getCommands();
89
90
  const response = await cmd.typedCall('SolanaGetAddress', 'SolanaAddress', {
90
91
  address_n,
91
92
  show_display,
93
+ chunkify,
92
94
  });
93
95
  return response.message;
94
96
  }
@@ -7,7 +7,6 @@ const pathUtils_1 = require("../../../utils/pathUtils");
7
7
  const events_1 = require("../../../events");
8
8
  class SolanaGetPublicKey extends AbstractMethod_1.AbstractMethod {
9
9
  init() {
10
- console.warn('⚠️ BETA: This api is unstable and may change!');
11
10
  this.requiredPermissions = ['read'];
12
11
  this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, (0, coinInfo_1.getMiscNetwork)('Solana'), this.firmwareRange);
13
12
  this.hasBundle = !!this.payload.bundle;
@@ -54,7 +53,7 @@ class SolanaGetPublicKey extends AbstractMethod_1.AbstractMethod {
54
53
  await this.getPopupPromise().promise;
55
54
  const uiPromise = this.createUiPromise(events_1.UI.RECEIVE_CONFIRMATION);
56
55
  this.postMessage((0, events_1.createUiMessage)(events_1.UI.REQUEST_CONFIRMATION, {
57
- view: 'get-public-key-no-backup',
56
+ view: 'no-backup',
58
57
  }));
59
58
  const uiResp = await uiPromise.promise;
60
59
  return uiResp.payload;
@@ -4,9 +4,9 @@ const AbstractMethod_1 = require("../../../core/AbstractMethod");
4
4
  const paramsValidator_1 = require("../../common/paramsValidator");
5
5
  const coinInfo_1 = require("../../../data/coinInfo");
6
6
  const pathUtils_1 = require("../../../utils/pathUtils");
7
+ const additionalInfo_1 = require("../additionalInfo");
7
8
  class SolanaSignTransaction extends AbstractMethod_1.AbstractMethod {
8
9
  init() {
9
- console.warn('⚠️ BETA: This api is unstable and may change!');
10
10
  this.requiredPermissions = ['read', 'write'];
11
11
  this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, (0, coinInfo_1.getMiscNetwork)('Solana'), this.firmwareRange);
12
12
  const { payload } = this;
@@ -18,6 +18,7 @@ class SolanaSignTransaction extends AbstractMethod_1.AbstractMethod {
18
18
  this.params = {
19
19
  address_n: path,
20
20
  serialized_tx: payload.serializedTx,
21
+ additional_info: (0, additionalInfo_1.transformAdditionalInfo)(payload.additionalInfo),
21
22
  };
22
23
  }
23
24
  get info() {
@@ -16,7 +16,7 @@ export default class StellarGetAddress extends AbstractMethod<'stellarGetAddress
16
16
  } | undefined;
17
17
  confirmation(): Promise<boolean>;
18
18
  noBackupConfirmation(): Promise<boolean>;
19
- _call({ address_n, show_display }: Params): Promise<PROTO.StellarAddress>;
19
+ _call({ address_n, show_display, chunkify }: Params): Promise<PROTO.StellarAddress>;
20
20
  run(): Promise<import("../../..").Address | import("../../..").Address[]>;
21
21
  }
22
22
  export {};
@@ -27,12 +27,14 @@ class StellarGetAddress 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 StellarGetAddress 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('StellarGetAddress', 'StellarAddress', {
85
87
  address_n,
86
88
  show_display,
89
+ chunkify,
87
90
  });
88
91
  return response.message;
89
92
  }
@@ -16,7 +16,7 @@ export default class TezosGetAddress extends AbstractMethod<'tezosGetAddress', P
16
16
  } | undefined;
17
17
  confirmation(): Promise<boolean>;
18
18
  noBackupConfirmation(): Promise<boolean>;
19
- _call({ address_n, show_display }: Params): Promise<PROTO.TezosAddress>;
19
+ _call({ address_n, show_display, chunkify }: Params): Promise<PROTO.TezosAddress>;
20
20
  run(): Promise<import("../../..").Address | import("../../..").Address[]>;
21
21
  }
22
22
  export {};
@@ -27,12 +27,14 @@ class TezosGetAddress 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 TezosGetAddress 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('TezosGetAddress', 'TezosAddress', {
85
87
  address_n,
86
88
  show_display,
89
+ chunkify,
87
90
  });
88
91
  return response.message;
89
92
  }