@trezor/connect 9.2.2 → 9.2.3

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 (88) hide show
  1. package/CHANGELOG.md +64 -0
  2. package/README.md +1 -1
  3. package/lib/api/blockchainDisconnect.d.ts +1 -0
  4. package/lib/api/blockchainDisconnect.js +3 -4
  5. package/lib/api/blockchainEstimateFee.d.ts +1 -0
  6. package/lib/api/blockchainEstimateFee.js +6 -4
  7. package/lib/api/blockchainGetAccountBalanceHistory.d.ts +1 -0
  8. package/lib/api/blockchainGetAccountBalanceHistory.js +3 -1
  9. package/lib/api/blockchainGetCurrentFiatRates.d.ts +1 -0
  10. package/lib/api/blockchainGetCurrentFiatRates.js +3 -1
  11. package/lib/api/blockchainGetFiatRatesForTimestamps.d.ts +1 -0
  12. package/lib/api/blockchainGetFiatRatesForTimestamps.js +3 -1
  13. package/lib/api/blockchainGetTransactions.d.ts +1 -0
  14. package/lib/api/blockchainGetTransactions.js +3 -1
  15. package/lib/api/blockchainSetCustomBackend.js +1 -5
  16. package/lib/api/blockchainSubscribe.d.ts +2 -0
  17. package/lib/api/blockchainSubscribe.js +13 -2
  18. package/lib/api/blockchainSubscribeFiatRates.d.ts +1 -0
  19. package/lib/api/blockchainSubscribeFiatRates.js +3 -1
  20. package/lib/api/blockchainUnsubscribe.d.ts +1 -0
  21. package/lib/api/blockchainUnsubscribe.js +5 -2
  22. package/lib/api/blockchainUnsubscribeFiatRates.d.ts +1 -0
  23. package/lib/api/blockchainUnsubscribeFiatRates.js +6 -2
  24. package/lib/api/changeLanguage.d.ts +0 -1
  25. package/lib/api/changeLanguage.js +7 -44
  26. package/lib/api/composeTransaction.d.ts +2 -0
  27. package/lib/api/composeTransaction.js +10 -5
  28. package/lib/api/eos/eosSignTx.d.ts +3 -3
  29. package/lib/api/ethereum/api/ethereumSignTypedData.d.ts +2 -1
  30. package/lib/api/ethereum/ethereumDefinitions.js +1 -0
  31. package/lib/api/getAccountInfo.js +4 -3
  32. package/lib/api/getCoinInfo.d.ts +3 -0
  33. package/lib/api/pushTransaction.d.ts +1 -0
  34. package/lib/api/pushTransaction.js +2 -1
  35. package/lib/api/resetDevice.d.ts +1 -1
  36. package/lib/api/resetDevice.js +2 -2
  37. package/lib/api/signTransaction.d.ts +1 -0
  38. package/lib/api/signTransaction.js +5 -3
  39. package/lib/backend/BackendManager.d.ts +6 -4
  40. package/lib/backend/BackendManager.js +36 -28
  41. package/lib/backend/Blockchain.d.ts +15 -4
  42. package/lib/backend/Blockchain.js +27 -17
  43. package/lib/backend/BlockchainLink.d.ts +3 -3
  44. package/lib/backend/BlockchainLink.js +3 -3
  45. package/lib/core/AbstractMethod.js +1 -0
  46. package/lib/core/index.js +6 -6
  47. package/lib/data/DataManager.d.ts +22 -0
  48. package/lib/data/DataManager.js +7 -3
  49. package/lib/data/coinInfo.d.ts +14 -0
  50. package/lib/data/config.d.ts +22 -0
  51. package/lib/data/config.js +5 -1
  52. package/lib/data/connectSettings.js +3 -0
  53. package/lib/data/deviceAuthenticityConfig.d.ts +9 -0
  54. package/lib/data/deviceAuthenticityConfig.js +23 -3
  55. package/lib/data/firmwareInfo.js +1 -5
  56. package/lib/data/getLanguage.d.ts +6 -0
  57. package/lib/data/getLanguage.js +10 -0
  58. package/lib/data/models.d.ts +9 -0
  59. package/lib/data/models.js +9 -0
  60. package/lib/data/version.d.ts +1 -1
  61. package/lib/data/version.js +1 -1
  62. package/lib/device/Device.d.ts +12 -1
  63. package/lib/device/Device.js +53 -5
  64. package/lib/device/DeviceCommands.d.ts +1 -1
  65. package/lib/device/DeviceList.js +4 -6
  66. package/lib/events/blockchain.d.ts +3 -0
  67. package/lib/types/api/authenticateDevice.d.ts +9 -0
  68. package/lib/types/api/bitcoin/index.d.ts +1 -0
  69. package/lib/types/api/blockchainSetCustomBackend.d.ts +3 -2
  70. package/lib/types/api/blockchainSubscribe.d.ts +1 -0
  71. package/lib/types/api/composeTransaction.d.ts +2 -0
  72. package/lib/types/api/getAccountInfo.d.ts +1 -0
  73. package/lib/types/api/getCoinInfo.d.ts +4 -2
  74. package/lib/types/api/nemGetAddress.d.ts +11 -4
  75. package/lib/types/api/nemGetAddress.js +9 -0
  76. package/lib/types/api/pushTransaction.d.ts +1 -0
  77. package/lib/types/api/pushTransaction.js +1 -0
  78. package/lib/types/api/resetDevice.d.ts +1 -15
  79. package/lib/types/api/resetDevice.js +0 -9
  80. package/lib/types/api/setBusy.d.ts +2 -2
  81. package/lib/types/coinInfo.d.ts +15 -7
  82. package/lib/types/coinInfo.js +8 -6
  83. package/lib/types/firmware.d.ts +5 -15
  84. package/lib/types/params.d.ts +1 -0
  85. package/lib/types/params.js +1 -2
  86. package/lib/types/settings.d.ts +1 -0
  87. package/lib/utils/assetUtils.js +18 -8
  88. package/package.json +9 -9
package/CHANGELOG.md CHANGED
@@ -1,3 +1,67 @@
1
+ | Package | latest stable | latest canary |
2
+ | ---------------------------- | :-----------: | :-----------: |
3
+ | @trezor/connect | 9.2.2 | 9.2.3 |
4
+ | @trezor/connect-web | 9.2.2 | 9.2.3 |
5
+ | @trezor/connect-webextension | 9.2.2 | 9.2.3 |
6
+
7
+ # 9.2.3
8
+
9
+ - fix(connect): worker-loader for solana and hanged calls over webusb (46c0e96, 172fa22)
10
+ - chore(connect): improve type for releases and pick model and coin support type (996e96d, 273591e)
11
+ - feat(connect): add T3T1 pubkeys and T3T1 releases.json (edca868, a984008, 1bc4569)
12
+ - feat(connect): add `_extendWebextensionLifetime` option (720b61b)
13
+ - feat(connect): allow separate accounts/blocks subscription (98e3b28)
14
+ - feat(connect): support identity in blockchain methods (2fbb57f)
15
+ - test(connect): fix BackendManager tests (0318aea)
16
+ - feat(connect): support identities in BackendManager (76767be)
17
+ - feat(connect): automatically update language blob when outdated and move changeLanguage logic to Device (425b52b, 04d4fb8)
18
+ - fix(connect): always show device selection when bridge and using core in popup (5f1191e)
19
+
20
+ ## connect-example
21
+
22
+ - Use `_extendWebextensionLifetime` for extending life time of service worker in example mv3-sw (fe537c0)
23
+
24
+ ## connect-webextension
25
+
26
+ - Reconnection when service worker goes inactive and option to extend life of service worker (39dcde0, 0377b28)
27
+
28
+ ## connect-explorer-nextra and connect-explorer-theme
29
+
30
+ - Improve schemas documentation and styling (367f458, a23fa02, ee7c4f6, 667c802, 05b68fa, 6c2e298, 9150147, 81591dc, bb84950, 8ca02e6, c8f144a, 003854c, 8951663, b284b25, d14c026, d69dee1, 1c82b8f)
31
+
32
+ ## mobile
33
+
34
+ - fix Connect firmware assets import #12090) (4abe34e)
35
+
36
+ ## trezor-user-env-link
37
+
38
+ - Type updates (68be4d2)
39
+
40
+ ## connect-popup
41
+
42
+ - test new webextension select device behavior and check remember device by default for mv3 webextension (1aab629, eb6cf5d)
43
+
44
+ ## protobuf
45
+
46
+ - clean up type of backup_type in schema (19b7bb2)
47
+
48
+ ## connect-common
49
+
50
+ - Add Czech to available FW translations (4a1aa82)
51
+
52
+ ## Dependencies update
53
+
54
+ - npm-release: @trezor/blockchain-link 2.1.29
55
+ - npm-release: @trezor/blockchain-link-utils 1.0.17
56
+ - npm-release: @trezor/blockchain-link-types 1.0.16
57
+ - npm-release: @trezor/connect-common 0.0.32
58
+ - npm-release: @trezor/env-utils 1.0.16
59
+ - npm-release: @trezor/transport 1.1.28
60
+ - npm-release: @trezor/protobuf 1.0.12
61
+ - npm-release: @trezor/protocol 1.0.8
62
+ - npm-release: @trezor/utxo-lib 2.0.9
63
+ - npm-release: @trezor/connect 9.2.3
64
+
1
65
  # 9.2.2
2
66
 
3
67
  Main focus of this release is to allow saving device sessions in webextension, so user's don't have to enter the passphrase repeatedly.
package/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # @trezor/connect
2
2
 
3
- API version 9.2.2
3
+ API version 9.2.3
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)
@@ -2,6 +2,7 @@ import { AbstractMethod } from '../core/AbstractMethod';
2
2
  import { CoinInfo } from '../types';
3
3
  type Params = {
4
4
  coinInfo: CoinInfo;
5
+ identity?: string;
5
6
  };
6
7
  export default class BlockchainDisconnect extends AbstractMethod<'blockchainDisconnect', Params> {
7
8
  init(): void;
@@ -20,16 +20,15 @@ class BlockchainDisconnect extends AbstractMethod_1.AbstractMethod {
20
20
  (0, BlockchainLink_1.isBackendSupported)(coinInfo);
21
21
  this.params = {
22
22
  coinInfo,
23
+ identity: payload.identity,
23
24
  };
24
25
  }
25
26
  get info() {
26
27
  return '';
27
28
  }
28
29
  run() {
29
- const backend = (0, BlockchainLink_1.findBackend)(this.params.coinInfo.shortcut);
30
- if (backend) {
31
- backend.disconnect();
32
- }
30
+ const backend = (0, BlockchainLink_1.findBackend)(this.params.coinInfo.shortcut, this.params.identity);
31
+ backend === null || backend === void 0 ? void 0 : backend.disconnect();
33
32
  return Promise.resolve({ disconnected: true });
34
33
  }
35
34
  }
@@ -2,6 +2,7 @@ import { Payload, MethodReturnType, AbstractMethod } from '../core/AbstractMetho
2
2
  import type { CoinInfo } from '../types';
3
3
  type Params = {
4
4
  coinInfo: CoinInfo;
5
+ identity?: string;
5
6
  request: Payload<'blockchainEstimateFee'>['request'];
6
7
  };
7
8
  export default class BlockchainEstimateFee extends AbstractMethod<'blockchainEstimateFee', Params> {
@@ -13,9 +13,10 @@ class BlockchainEstimateFee extends AbstractMethod_1.AbstractMethod {
13
13
  const { payload } = this;
14
14
  (0, paramsValidator_1.validateParams)(payload, [
15
15
  { name: 'coin', type: 'string', required: true },
16
+ { name: 'identity', type: 'string' },
16
17
  { name: 'request', type: 'object' },
17
18
  ]);
18
- const { request } = payload;
19
+ const { request, identity } = payload;
19
20
  if (request) {
20
21
  (0, paramsValidator_1.validateParams)(request, [
21
22
  { name: 'blocks', type: 'array' },
@@ -40,11 +41,12 @@ class BlockchainEstimateFee extends AbstractMethod_1.AbstractMethod {
40
41
  (0, BlockchainLink_1.isBackendSupported)(coinInfo);
41
42
  this.params = {
42
43
  coinInfo,
44
+ identity,
43
45
  request,
44
46
  };
45
47
  }
46
48
  async run() {
47
- const { coinInfo, request } = this.params;
49
+ const { coinInfo, identity, request } = this.params;
48
50
  const feeInfo = {
49
51
  blockTime: coinInfo.blockTime,
50
52
  minFee: coinInfo.minFee,
@@ -55,13 +57,13 @@ class BlockchainEstimateFee extends AbstractMethod_1.AbstractMethod {
55
57
  if (request && request.feeLevels) {
56
58
  const fees = new Fees_1.FeeLevels(coinInfo);
57
59
  if (request.feeLevels === 'smart' && coinInfo.shortcut !== 'DOGE') {
58
- const backend = await (0, BlockchainLink_1.initBlockchain)(coinInfo, this.postMessage);
60
+ const backend = await (0, BlockchainLink_1.initBlockchain)(coinInfo, this.postMessage, identity);
59
61
  await fees.load(backend);
60
62
  }
61
63
  feeInfo.levels = fees.levels;
62
64
  }
63
65
  else {
64
- const backend = await (0, BlockchainLink_1.initBlockchain)(coinInfo, this.postMessage);
66
+ const backend = await (0, BlockchainLink_1.initBlockchain)(coinInfo, this.postMessage, identity);
65
67
  feeInfo.levels = await backend.estimateFee(request || {});
66
68
  }
67
69
  return feeInfo;
@@ -2,6 +2,7 @@ import { Payload, AbstractMethod } from '../core/AbstractMethod';
2
2
  import type { CoinInfo } from '../types';
3
3
  type Params = {
4
4
  coinInfo: CoinInfo;
5
+ identity?: string;
5
6
  request: Omit<Payload<'blockchainGetAccountBalanceHistory'>, 'method' | 'coin'>;
6
7
  };
7
8
  export default class BlockchainGetAccountBalanceHistory extends AbstractMethod<'blockchainGetAccountBalanceHistory', Params> {
@@ -12,6 +12,7 @@ class BlockchainGetAccountBalanceHistory extends AbstractMethod_1.AbstractMethod
12
12
  const { payload } = this;
13
13
  (0, paramsValidator_1.validateParams)(payload, [
14
14
  { name: 'coin', type: 'string', required: true },
15
+ { name: 'identity', type: 'string' },
15
16
  { name: 'descriptor', type: 'string', required: true },
16
17
  { name: 'from', type: 'number' },
17
18
  { name: 'to', type: 'number' },
@@ -24,6 +25,7 @@ class BlockchainGetAccountBalanceHistory extends AbstractMethod_1.AbstractMethod
24
25
  (0, BlockchainLink_1.isBackendSupported)(coinInfo);
25
26
  this.params = {
26
27
  coinInfo,
28
+ identity: payload.identity,
27
29
  request: {
28
30
  descriptor: payload.descriptor,
29
31
  from: payload.from,
@@ -33,7 +35,7 @@ class BlockchainGetAccountBalanceHistory extends AbstractMethod_1.AbstractMethod
33
35
  };
34
36
  }
35
37
  async run() {
36
- const backend = await (0, BlockchainLink_1.initBlockchain)(this.params.coinInfo, this.postMessage);
38
+ const backend = await (0, BlockchainLink_1.initBlockchain)(this.params.coinInfo, this.postMessage, this.params.identity);
37
39
  return backend.getAccountBalanceHistory(this.params.request);
38
40
  }
39
41
  }
@@ -2,6 +2,7 @@ import { Payload, AbstractMethod } from '../core/AbstractMethod';
2
2
  import type { CoinInfo } from '../types';
3
3
  type Params = {
4
4
  coinInfo: CoinInfo;
5
+ identity?: string;
5
6
  currencies: Payload<'blockchainGetCurrentFiatRates'>['currencies'];
6
7
  token: Payload<'blockchainGetCurrentFiatRates'>['token'];
7
8
  };
@@ -14,6 +14,7 @@ class BlockchainGetCurrentFiatRates extends AbstractMethod_1.AbstractMethod {
14
14
  { name: 'currencies', type: 'array', required: false },
15
15
  { name: 'token', type: 'string' },
16
16
  { name: 'coin', type: 'string', required: true },
17
+ { name: 'identity', type: 'string' },
17
18
  ]);
18
19
  const coinInfo = (0, coinInfo_1.getCoinInfo)(payload.coin);
19
20
  if (!coinInfo) {
@@ -24,10 +25,11 @@ class BlockchainGetCurrentFiatRates extends AbstractMethod_1.AbstractMethod {
24
25
  currencies: payload.currencies,
25
26
  token: payload.token,
26
27
  coinInfo,
28
+ identity: payload.identity,
27
29
  };
28
30
  }
29
31
  async run() {
30
- const backend = await (0, BlockchainLink_1.initBlockchain)(this.params.coinInfo, this.postMessage);
32
+ const backend = await (0, BlockchainLink_1.initBlockchain)(this.params.coinInfo, this.postMessage, this.params.identity);
31
33
  return backend.getCurrentFiatRates({
32
34
  currencies: this.params.currencies,
33
35
  token: this.params.token,
@@ -2,6 +2,7 @@ import { Payload, AbstractMethod } from '../core/AbstractMethod';
2
2
  import type { CoinInfo } from '../types';
3
3
  type Params = {
4
4
  coinInfo: CoinInfo;
5
+ identity?: string;
5
6
  currencies: Payload<'blockchainGetFiatRatesForTimestamps'>['currencies'];
6
7
  timestamps: Payload<'blockchainGetFiatRatesForTimestamps'>['timestamps'];
7
8
  token: Payload<'blockchainGetFiatRatesForTimestamps'>['token'];
@@ -15,6 +15,7 @@ class BlockchainGetFiatRatesForTimestamps extends AbstractMethod_1.AbstractMetho
15
15
  { name: 'timestamps', type: 'array', required: true },
16
16
  { name: 'token', type: 'string' },
17
17
  { name: 'coin', type: 'string', required: true },
18
+ { name: 'identity', type: 'string' },
18
19
  ]);
19
20
  const coinInfo = (0, coinInfo_1.getCoinInfo)(payload.coin);
20
21
  if (!coinInfo) {
@@ -26,10 +27,11 @@ class BlockchainGetFiatRatesForTimestamps extends AbstractMethod_1.AbstractMetho
26
27
  timestamps: payload.timestamps,
27
28
  token: payload.token,
28
29
  coinInfo,
30
+ identity: payload.identity,
29
31
  };
30
32
  }
31
33
  async run() {
32
- const backend = await (0, BlockchainLink_1.initBlockchain)(this.params.coinInfo, this.postMessage);
34
+ const backend = await (0, BlockchainLink_1.initBlockchain)(this.params.coinInfo, this.postMessage, this.params.identity);
33
35
  return backend.getFiatRatesForTimestamps({
34
36
  currencies: this.params.currencies,
35
37
  timestamps: this.params.timestamps,
@@ -3,6 +3,7 @@ import type { CoinInfo } from '../types';
3
3
  type Params = {
4
4
  txs: string[];
5
5
  coinInfo: CoinInfo;
6
+ identity?: string;
6
7
  };
7
8
  export default class BlockchainGetTransactions extends AbstractMethod<'blockchainGetTransactions', Params> {
8
9
  init(): void;
@@ -13,6 +13,7 @@ class BlockchainGetTransactions extends AbstractMethod_1.AbstractMethod {
13
13
  (0, paramsValidator_1.validateParams)(payload, [
14
14
  { name: 'txs', type: 'array', required: true },
15
15
  { name: 'coin', type: 'string', required: true },
16
+ { name: 'identity', type: 'string' },
16
17
  ]);
17
18
  const coinInfo = (0, coinInfo_1.getCoinInfo)(payload.coin);
18
19
  if (!coinInfo) {
@@ -22,10 +23,11 @@ class BlockchainGetTransactions extends AbstractMethod_1.AbstractMethod {
22
23
  this.params = {
23
24
  txs: payload.txs,
24
25
  coinInfo,
26
+ identity: payload.identity,
25
27
  };
26
28
  }
27
29
  async run() {
28
- const backend = await (0, BlockchainLink_1.initBlockchain)(this.params.coinInfo, this.postMessage);
30
+ const backend = await (0, BlockchainLink_1.initBlockchain)(this.params.coinInfo, this.postMessage, this.params.identity);
29
31
  return backend.getTransactions(this.params.txs);
30
32
  }
31
33
  }
@@ -28,11 +28,7 @@ class BlockchainSetCustomBackend extends AbstractMethod_1.AbstractMethod {
28
28
  return '';
29
29
  }
30
30
  async run() {
31
- const current = (0, BlockchainLink_1.findBackend)(this.params.coinInfo.shortcut);
32
- if (current) {
33
- current.disconnect();
34
- await (0, BlockchainLink_1.initBlockchain)(this.params.coinInfo, this.postMessage);
35
- }
31
+ await (0, BlockchainLink_1.reconnectAllBackends)(this.params.coinInfo);
36
32
  return true;
37
33
  }
38
34
  }
@@ -2,7 +2,9 @@ import { Payload, AbstractMethod } from '../core/AbstractMethod';
2
2
  import type { CoinInfo } from '../types';
3
3
  type Params = {
4
4
  accounts: Payload<'blockchainSubscribe'>['accounts'];
5
+ blocks: boolean;
5
6
  coinInfo: CoinInfo;
7
+ identity?: string;
6
8
  };
7
9
  export default class BlockchainSubscribe extends AbstractMethod<'blockchainSubscribe', Params> {
8
10
  init(): void;
@@ -7,12 +7,15 @@ const BlockchainLink_1 = require("../backend/BlockchainLink");
7
7
  const coinInfo_1 = require("../data/coinInfo");
8
8
  class BlockchainSubscribe extends AbstractMethod_1.AbstractMethod {
9
9
  init() {
10
+ var _a;
10
11
  this.useDevice = false;
11
12
  this.useUi = false;
12
13
  const { payload } = this;
13
14
  (0, paramsValidator_1.validateParams)(payload, [
14
15
  { name: 'accounts', type: 'array', allowEmpty: true },
16
+ { name: 'blocks', type: 'boolean' },
15
17
  { name: 'coin', type: 'string', required: true },
18
+ { name: 'identity', type: 'string' },
16
19
  ]);
17
20
  if (payload.accounts) {
18
21
  payload.accounts.forEach(account => {
@@ -26,12 +29,20 @@ class BlockchainSubscribe extends AbstractMethod_1.AbstractMethod {
26
29
  (0, BlockchainLink_1.isBackendSupported)(coinInfo);
27
30
  this.params = {
28
31
  accounts: payload.accounts,
32
+ blocks: (_a = payload.blocks) !== null && _a !== void 0 ? _a : true,
29
33
  coinInfo,
34
+ identity: payload.identity,
30
35
  };
31
36
  }
32
37
  async run() {
33
- const backend = await (0, BlockchainLink_1.initBlockchain)(this.params.coinInfo, this.postMessage);
34
- return backend.subscribe(this.params.accounts);
38
+ const backend = await (0, BlockchainLink_1.initBlockchain)(this.params.coinInfo, this.postMessage, this.params.identity);
39
+ const { blocks, accounts } = this.params;
40
+ let result = { subscribed: false };
41
+ if (blocks)
42
+ result = await backend.subscribeBlocks();
43
+ if (accounts)
44
+ result = await backend.subscribeAccounts(accounts);
45
+ return result;
35
46
  }
36
47
  }
37
48
  exports.default = BlockchainSubscribe;
@@ -3,6 +3,7 @@ import type { CoinInfo } from '../types';
3
3
  type Params = {
4
4
  currency: Payload<'blockchainSubscribeFiatRates'>['currency'];
5
5
  coinInfo: CoinInfo;
6
+ identity?: string;
6
7
  };
7
8
  export default class BlockchainSubscribeFiatRates extends AbstractMethod<'blockchainSubscribeFiatRates', Params> {
8
9
  init(): void;
@@ -13,6 +13,7 @@ class BlockchainSubscribeFiatRates extends AbstractMethod_1.AbstractMethod {
13
13
  (0, paramsValidator_1.validateParams)(payload, [
14
14
  { name: 'currency', type: 'string', required: false },
15
15
  { name: 'coin', type: 'string', required: true },
16
+ { name: 'identity', type: 'string' },
16
17
  ]);
17
18
  const coinInfo = (0, coinInfo_1.getCoinInfo)(payload.coin);
18
19
  if (!coinInfo) {
@@ -22,10 +23,11 @@ class BlockchainSubscribeFiatRates extends AbstractMethod_1.AbstractMethod {
22
23
  this.params = {
23
24
  currency: payload.currency,
24
25
  coinInfo,
26
+ identity: payload.identity,
25
27
  };
26
28
  }
27
29
  async run() {
28
- const backend = await (0, BlockchainLink_1.initBlockchain)(this.params.coinInfo, this.postMessage);
30
+ const backend = await (0, BlockchainLink_1.initBlockchain)(this.params.coinInfo, this.postMessage, this.params.identity);
29
31
  return backend.subscribeFiatRates(this.params.currency);
30
32
  }
31
33
  }
@@ -3,6 +3,7 @@ import type { CoinInfo } from '../types';
3
3
  type Params = {
4
4
  accounts: Payload<'blockchainUnsubscribe'>['accounts'];
5
5
  coinInfo: CoinInfo;
6
+ identity?: string;
6
7
  };
7
8
  export default class BlockchainUnsubscribe extends AbstractMethod<'blockchainUnsubscribe', Params> {
8
9
  init(): void;
@@ -13,6 +13,7 @@ class BlockchainUnsubscribe extends AbstractMethod_1.AbstractMethod {
13
13
  (0, paramsValidator_1.validateParams)(payload, [
14
14
  { name: 'accounts', type: 'array', allowEmpty: true },
15
15
  { name: 'coin', type: 'string', required: true },
16
+ { name: 'identity', type: 'string' },
16
17
  ]);
17
18
  if (payload.accounts) {
18
19
  payload.accounts.forEach(account => {
@@ -27,11 +28,13 @@ class BlockchainUnsubscribe extends AbstractMethod_1.AbstractMethod {
27
28
  this.params = {
28
29
  accounts: payload.accounts,
29
30
  coinInfo,
31
+ identity: payload.identity,
30
32
  };
31
33
  }
32
34
  async run() {
33
- const backend = await (0, BlockchainLink_1.initBlockchain)(this.params.coinInfo, this.postMessage);
34
- return backend.unsubscribe(this.params.accounts);
35
+ const backend = await (0, BlockchainLink_1.initBlockchain)(this.params.coinInfo, this.postMessage, this.params.identity);
36
+ const { accounts } = this.params;
37
+ return accounts ? backend.unsubscribeAccounts(accounts) : backend.unsubscribeAll();
35
38
  }
36
39
  }
37
40
  exports.default = BlockchainUnsubscribe;
@@ -2,6 +2,7 @@ import { AbstractMethod } from '../core/AbstractMethod';
2
2
  import type { CoinInfo } from '../types';
3
3
  type Params = {
4
4
  coinInfo: CoinInfo;
5
+ identity?: string;
5
6
  };
6
7
  export default class BlockchainUnsubscribeFiatRates extends AbstractMethod<'blockchainUnsubscribeFiatRates', Params> {
7
8
  init(): void;
@@ -10,7 +10,10 @@ class BlockchainUnsubscribeFiatRates extends AbstractMethod_1.AbstractMethod {
10
10
  this.useDevice = false;
11
11
  this.useUi = false;
12
12
  const { payload } = this;
13
- (0, paramsValidator_1.validateParams)(payload, [{ name: 'coin', type: 'string', required: true }]);
13
+ (0, paramsValidator_1.validateParams)(payload, [
14
+ { name: 'coin', type: 'string', required: true },
15
+ { name: 'identity', type: 'string' },
16
+ ]);
14
17
  const coinInfo = (0, coinInfo_1.getCoinInfo)(payload.coin);
15
18
  if (!coinInfo) {
16
19
  throw constants_1.ERRORS.TypedError('Method_UnknownCoin');
@@ -18,10 +21,11 @@ class BlockchainUnsubscribeFiatRates extends AbstractMethod_1.AbstractMethod {
18
21
  (0, BlockchainLink_1.isBackendSupported)(coinInfo);
19
22
  this.params = {
20
23
  coinInfo,
24
+ identity: payload.identity,
21
25
  };
22
26
  }
23
27
  async run() {
24
- const backend = await (0, BlockchainLink_1.initBlockchain)(this.params.coinInfo, this.postMessage);
28
+ const backend = await (0, BlockchainLink_1.initBlockchain)(this.params.coinInfo, this.postMessage, this.params.identity);
25
29
  return backend.unsubscribeFiatRates();
26
30
  }
27
31
  }
@@ -3,7 +3,6 @@ import { ChangeLanguage as ChangeLanguageSchema } from '../types/api/changeLangu
3
3
  export default class ChangeLanguage extends AbstractMethod<'changeLanguage', ChangeLanguageSchema> {
4
4
  init(): void;
5
5
  confirmation(): Promise<boolean>;
6
- private uploadTranslationData;
7
6
  run(): Promise<{
8
7
  message: string;
9
8
  }>;
@@ -1,11 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const AbstractMethod_1 = require("../core/AbstractMethod");
4
- const constants_1 = require("../constants");
5
4
  const events_1 = require("../events");
6
5
  const schema_utils_1 = require("@trezor/schema-utils");
7
6
  const changeLanguage_1 = require("../types/api/changeLanguage");
8
- const assets_1 = require("../utils/assets");
9
7
  class ChangeLanguage extends AbstractMethod_1.AbstractMethod {
10
8
  init() {
11
9
  this.allowDeviceMode = [events_1.UI.INITIALIZE, events_1.UI.SEEDLESS];
@@ -14,17 +12,7 @@ class ChangeLanguage extends AbstractMethod_1.AbstractMethod {
14
12
  this.useDeviceState = false;
15
13
  const { payload } = this;
16
14
  (0, schema_utils_1.Assert)(changeLanguage_1.ChangeLanguage, payload);
17
- if (payload.binary) {
18
- this.params = {
19
- binary: payload.binary,
20
- };
21
- }
22
- else {
23
- this.params = {
24
- language: payload.language,
25
- baseUrl: payload.baseUrl || 'https://data.trezor.io',
26
- };
27
- }
15
+ this.params = payload;
28
16
  }
29
17
  async confirmation() {
30
18
  await this.getPopupPromise().promise;
@@ -40,39 +28,14 @@ class ChangeLanguage extends AbstractMethod_1.AbstractMethod {
40
28
  const uiResp = await uiPromise.promise;
41
29
  return uiResp.payload;
42
30
  }
43
- async uploadTranslationData(payload) {
44
- if (!this.device.commands) {
45
- throw constants_1.ERRORS.TypedError('Runtime', 'uploadTranslationData: device.commands is not set');
46
- }
47
- if (payload === null) {
48
- const response = await this.device.commands.typedCall('ChangeLanguage', ['Success'], { data_length: 0 });
49
- return response.message;
50
- }
51
- const length = payload.byteLength;
52
- let response = await this.device.commands.typedCall('ChangeLanguage', ['TranslationDataRequest', 'Success'], { data_length: length });
53
- while (response.type !== 'Success') {
54
- const start = response.message.data_offset;
55
- const end = response.message.data_offset + response.message.data_length;
56
- const chunk = payload.slice(start, end);
57
- response = await this.device.commands.typedCall('TranslationDataAck', ['TranslationDataRequest', 'Success'], {
58
- data_chunk: Buffer.from(chunk).toString('hex'),
59
- });
60
- }
61
- return response.message;
62
- }
63
- async run() {
64
- const { language, binary, baseUrl } = this.params;
65
- if (language === 'en-US') {
66
- return this.uploadTranslationData(null);
67
- }
31
+ run() {
32
+ const { language, binary } = this.params;
68
33
  if (binary) {
69
- return this.uploadTranslationData(binary);
34
+ return this.device.changeLanguage({ binary });
35
+ }
36
+ else {
37
+ return this.device.changeLanguage({ language });
70
38
  }
71
- const version = this.device.getVersion().join('.');
72
- const model = this.device.features.internal_model;
73
- const url = `${baseUrl}/firmware/translations/${model.toLowerCase()}/translation-${model.toUpperCase()}-${language}-${version}.bin`;
74
- const downloadedBinary = await (0, assets_1.httpRequest)(url, 'binary');
75
- return this.uploadTranslationData(downloadedBinary);
76
39
  }
77
40
  }
78
41
  exports.default = ChangeLanguage;
@@ -8,6 +8,7 @@ import type { SignedTransaction, PrecomposeParams, ComposeResult, PrecomposedRes
8
8
  type Params = {
9
9
  outputs: ComposeOutput[];
10
10
  coinInfo: BitcoinNetworkInfo;
11
+ identity?: string;
11
12
  push: boolean;
12
13
  account?: PrecomposeParams['account'];
13
14
  feeLevels?: PrecomposeParams['feeLevels'];
@@ -21,6 +22,7 @@ export default class ComposeTransaction extends AbstractMethod<'composeTransacti
21
22
  discovery?: Discovery;
22
23
  init(): void;
23
24
  get info(): string;
25
+ private getBlockchain;
24
26
  precompose(account: PrecomposeParams['account'], feeLevels: PrecomposeParams['feeLevels']): Promise<PrecomposedResult[]>;
25
27
  run(): Promise<SignedTransaction | PrecomposedResult[]>;
26
28
  selectAccount(): Promise<{
@@ -20,6 +20,7 @@ class ComposeTransaction extends AbstractMethod_1.AbstractMethod {
20
20
  (0, paramsValidator_1.validateParams)(payload, [
21
21
  { name: 'outputs', type: 'array', required: true },
22
22
  { name: 'coin', type: 'string', required: true },
23
+ { name: 'identity', type: 'string' },
23
24
  { name: 'push', type: 'boolean' },
24
25
  { name: 'account', type: 'object' },
25
26
  { name: 'feeLevels', type: 'array' },
@@ -48,6 +49,7 @@ class ComposeTransaction extends AbstractMethod_1.AbstractMethod {
48
49
  this.params = {
49
50
  outputs,
50
51
  coinInfo,
52
+ identity: payload.identity,
51
53
  account: payload.account,
52
54
  feeLevels: payload.feeLevels,
53
55
  baseFee: payload.baseFee,
@@ -66,6 +68,9 @@ class ComposeTransaction extends AbstractMethod_1.AbstractMethod {
66
68
  }
67
69
  return `Send ${(0, formatUtils_1.formatAmount)(this.params.total.toString(), this.params.coinInfo)}`;
68
70
  }
71
+ getBlockchain() {
72
+ return (0, BlockchainLink_1.initBlockchain)(this.params.coinInfo, this.postMessage, this.params.identity);
73
+ }
69
74
  async precompose(account, feeLevels) {
70
75
  const { coinInfo, outputs, baseFee, skipPermutation } = this.params;
71
76
  const address_n = pathUtils.validatePath(account.path);
@@ -83,7 +88,7 @@ class ComposeTransaction extends AbstractMethod_1.AbstractMethod {
83
88
  baseFee,
84
89
  skipPermutation,
85
90
  });
86
- const blockchain = await (0, BlockchainLink_1.initBlockchain)(this.params.coinInfo, this.postMessage);
91
+ const blockchain = await this.getBlockchain();
87
92
  await composer.init(blockchain);
88
93
  return feeLevels.map(level => {
89
94
  composer.composeCustomFee(level.feePerUnit);
@@ -120,7 +125,7 @@ class ComposeTransaction extends AbstractMethod_1.AbstractMethod {
120
125
  }
121
126
  async selectAccount() {
122
127
  const { coinInfo } = this.params;
123
- const blockchain = await (0, BlockchainLink_1.initBlockchain)(coinInfo, this.postMessage);
128
+ const blockchain = await this.getBlockchain();
124
129
  const dfd = this.createUiPromise(events_1.UI.RECEIVE_ACCOUNT);
125
130
  if (this.discovery && this.discovery.completed) {
126
131
  const { discovery } = this;
@@ -181,7 +186,7 @@ class ComposeTransaction extends AbstractMethod_1.AbstractMethod {
181
186
  }
182
187
  async selectFee(account, utxos) {
183
188
  const { coinInfo, outputs } = this.params;
184
- const blockchain = await (0, BlockchainLink_1.initBlockchain)(coinInfo, this.postMessage);
189
+ const blockchain = await this.getBlockchain();
185
190
  const composer = new bitcoin_1.TransactionComposer({
186
191
  account,
187
192
  utxos,
@@ -228,7 +233,7 @@ class ComposeTransaction extends AbstractMethod_1.AbstractMethod {
228
233
  const requiredRefTxs = (0, bitcoin_1.requireReferencedTransactions)(inputs, options, coinInfo);
229
234
  const refTxsIds = (0, bitcoin_1.getReferencedTransactions)(inputs);
230
235
  if (requiredRefTxs && refTxsIds.length > 0) {
231
- refTxs = await (0, BlockchainLink_1.initBlockchain)(coinInfo, this.postMessage)
236
+ refTxs = await this.getBlockchain()
232
237
  .then(blockchain => blockchain.getTransactionHexes(refTxsIds))
233
238
  .then((0, bitcoin_1.parseTransactionHexes)(coinInfo.network))
234
239
  .then(bitcoin_1.transformReferencedTransactions);
@@ -246,7 +251,7 @@ class ComposeTransaction extends AbstractMethod_1.AbstractMethod {
246
251
  });
247
252
  await (0, bitcoin_1.verifyTx)(this.device.getCommands().getHDNode.bind(this.device.getCommands()), inputs, outputs, response.serializedTx, coinInfo);
248
253
  if (this.params.push) {
249
- const blockchain = await (0, BlockchainLink_1.initBlockchain)(coinInfo, this.postMessage);
254
+ const blockchain = await this.getBlockchain();
250
255
  const txid = await blockchain.pushTransaction(response.serializedTx);
251
256
  return {
252
257
  ...response,
@@ -21,13 +21,13 @@ export declare const validate: (tx: EosSDKTransaction) => {
21
21
  sender: string;
22
22
  receiver: string;
23
23
  } | undefined;
24
- refund?: {
25
- owner: string;
26
- } | undefined;
27
24
  unknown?: {
28
25
  data_size: number;
29
26
  data_chunk: string;
30
27
  } | undefined;
28
+ refund?: {
29
+ owner: string;
30
+ } | undefined;
31
31
  new_account?: {
32
32
  name: string;
33
33
  owner: {