@trezor/connect 9.2.1 → 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.
- package/CHANGELOG.md +90 -0
- package/README.md +1 -1
- package/lib/api/binance/api/binanceSignTransaction.d.ts +1 -1
- package/lib/api/binance/binanceSignTx.d.ts +1 -1
- package/lib/api/bitcoin/Fees.d.ts +2 -2
- package/lib/api/bitcoin/TransactionComposer.d.ts +2 -2
- package/lib/api/blockchainDisconnect.d.ts +1 -0
- package/lib/api/blockchainDisconnect.js +3 -4
- package/lib/api/blockchainEstimateFee.d.ts +1 -0
- package/lib/api/blockchainEstimateFee.js +7 -4
- package/lib/api/blockchainGetAccountBalanceHistory.d.ts +1 -0
- package/lib/api/blockchainGetAccountBalanceHistory.js +3 -1
- package/lib/api/blockchainGetCurrentFiatRates.d.ts +1 -0
- package/lib/api/blockchainGetCurrentFiatRates.js +3 -1
- package/lib/api/blockchainGetFiatRatesForTimestamps.d.ts +1 -0
- package/lib/api/blockchainGetFiatRatesForTimestamps.js +3 -1
- package/lib/api/blockchainGetTransactions.d.ts +1 -0
- package/lib/api/blockchainGetTransactions.js +3 -1
- package/lib/api/blockchainSetCustomBackend.js +1 -5
- package/lib/api/blockchainSubscribe.d.ts +2 -0
- package/lib/api/blockchainSubscribe.js +13 -2
- package/lib/api/blockchainSubscribeFiatRates.d.ts +1 -0
- package/lib/api/blockchainSubscribeFiatRates.js +3 -1
- package/lib/api/blockchainUnsubscribe.d.ts +1 -0
- package/lib/api/blockchainUnsubscribe.js +5 -2
- package/lib/api/blockchainUnsubscribeFiatRates.d.ts +1 -0
- package/lib/api/blockchainUnsubscribeFiatRates.js +6 -2
- package/lib/api/changeLanguage.d.ts +0 -1
- package/lib/api/changeLanguage.js +8 -39
- package/lib/api/composeTransaction.d.ts +2 -0
- package/lib/api/composeTransaction.js +10 -5
- package/lib/api/eos/eosSignTx.d.ts +58 -58
- package/lib/api/ethereum/api/ethereumGetPublicKey.d.ts +6 -6
- package/lib/api/ethereum/api/ethereumSignTypedData.d.ts +2 -1
- package/lib/api/ethereum/ethereumDefinitions.js +1 -0
- package/lib/api/getAccountInfo.js +4 -3
- package/lib/api/getCoinInfo.d.ts +25 -22
- package/lib/api/getFeatures.d.ts +10 -10
- package/lib/api/getPublicKey.d.ts +6 -6
- package/lib/api/nem/nemSignTx.d.ts +13 -13
- package/lib/api/pushTransaction.d.ts +1 -0
- package/lib/api/pushTransaction.js +2 -1
- package/lib/api/resetDevice.d.ts +1 -1
- package/lib/api/resetDevice.js +2 -2
- package/lib/api/signTransaction.d.ts +1 -0
- package/lib/api/signTransaction.js +5 -3
- package/lib/api/stellar/stellarSignTx.d.ts +1 -1
- package/lib/api/tezos/tezosSignTx.d.ts +18 -18
- package/lib/backend/BackendManager.d.ts +6 -4
- package/lib/backend/BackendManager.js +36 -28
- package/lib/backend/Blockchain.d.ts +15 -4
- package/lib/backend/Blockchain.js +27 -17
- package/lib/backend/BlockchainLink.d.ts +3 -3
- package/lib/backend/BlockchainLink.js +3 -3
- package/lib/core/AbstractMethod.js +1 -0
- package/lib/core/index.js +34 -5
- package/lib/data/DataManager.d.ts +22 -0
- package/lib/data/DataManager.js +7 -3
- package/lib/data/coinInfo.d.ts +131 -117
- package/lib/data/config.d.ts +22 -0
- package/lib/data/config.js +19 -1
- package/lib/data/connectSettings.js +3 -0
- package/lib/data/defaultFeeLevels.js +9 -1
- package/lib/data/deviceAuthenticityConfig.d.ts +9 -0
- package/lib/data/deviceAuthenticityConfig.js +26 -3
- package/lib/data/firmwareInfo.d.ts +1 -1
- package/lib/data/firmwareInfo.js +1 -5
- package/lib/data/getLanguage.d.ts +6 -0
- package/lib/data/getLanguage.js +10 -0
- package/lib/data/models.d.ts +9 -0
- package/lib/data/models.js +9 -0
- package/lib/data/version.d.ts +1 -1
- package/lib/data/version.js +1 -1
- package/lib/device/Device.d.ts +15 -3
- package/lib/device/Device.js +55 -6
- package/lib/device/DeviceCommands.d.ts +8 -8
- package/lib/device/DeviceList.js +4 -6
- package/lib/device/resolveDescriptorForTaproot.js +21 -16
- package/lib/events/blockchain.d.ts +3 -0
- package/lib/events/device.d.ts +1 -0
- package/lib/events/device.js +1 -0
- package/lib/types/api/applySettings.d.ts +6 -6
- package/lib/types/api/authenticateDevice.d.ts +9 -0
- package/lib/types/api/bitcoin/index.d.ts +1 -0
- package/lib/types/api/blockchainSetCustomBackend.d.ts +3 -2
- package/lib/types/api/blockchainSubscribe.d.ts +1 -0
- package/lib/types/api/composeTransaction.d.ts +2 -0
- package/lib/types/api/getAccountInfo.d.ts +1 -0
- package/lib/types/api/getAddress.d.ts +5 -5
- package/lib/types/api/getCoinInfo.d.ts +4 -2
- package/lib/types/api/getPublicKey.js +4 -1
- package/lib/types/api/nemGetAddress.d.ts +11 -4
- package/lib/types/api/nemGetAddress.js +9 -0
- package/lib/types/api/pushTransaction.d.ts +1 -0
- package/lib/types/api/pushTransaction.js +1 -0
- package/lib/types/api/recoveryDevice.d.ts +1 -1
- package/lib/types/api/resetDevice.d.ts +1 -15
- package/lib/types/api/resetDevice.js +0 -9
- package/lib/types/api/setBusy.d.ts +2 -2
- package/lib/types/coinInfo.d.ts +15 -7
- package/lib/types/coinInfo.js +8 -6
- package/lib/types/firmware.d.ts +5 -15
- package/lib/types/params.d.ts +1 -0
- package/lib/types/params.js +5 -2
- package/lib/types/settings.d.ts +1 -0
- package/lib/utils/assetUtils.js +18 -8
- package/lib/utils/{assets-native.d.ts → assets.native.d.ts} +1 -1
- package/lib/utils/{assets-native.js → assets.native.js} +1 -1
- package/lib/utils/debug.d.ts +5 -31
- package/lib/utils/debug.js +8 -110
- package/lib/utils/hdnodeUtils.d.ts +3 -3
- package/lib/utils/pathUtils.d.ts +3 -3
- package/lib/workers/{workers-react-native.d.ts → workers.native.d.ts} +1 -1
- package/lib/workers/{workers-react-native.js → workers.native.js} +1 -1
- package/package.json +40 -20
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,93 @@
|
|
|
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
|
+
|
|
65
|
+
# 9.2.2
|
|
66
|
+
|
|
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.
|
|
68
|
+
|
|
69
|
+
- fix(connect): webextension save sessions (efed18e4ea)
|
|
70
|
+
- feat(connect): set default Solana fees (d8cfa5123d)
|
|
71
|
+
- fix(connect): add missing isCreatingAccount param validation in blockchainEstimateFee (698ebf625d)
|
|
72
|
+
- chore(components): replace Tippy for FloatingUI (a6e3c86759)
|
|
73
|
+
- fix(connect): enable changeLanguage in initialize mode (0af5c35f3f)
|
|
74
|
+
- chore(suite): remove goerli (8eb6b271a5)
|
|
75
|
+
- chore(connect): Add Rainbow Browser Extension to knownHosts (6213f06a58, e648074ec8)
|
|
76
|
+
- chore: crowdin translation update (aa9a0d5bfe)
|
|
77
|
+
- chore(connect): move logs to @trezor/utils (28c2b9fe57)
|
|
78
|
+
- chore(connect): add new CA pubkeys and update timestamp (9b8f4eeb81)
|
|
79
|
+
- fix(connect): be more defensive in descriptor parsing (7cf1f02dc4)
|
|
80
|
+
- fix(connect): More robust conversion of e.g. 44h to 44' (1ea29b5d6c)
|
|
81
|
+
- docs(connect-examples): udpate README with webextensions (8ed2db3ecc)
|
|
82
|
+
- chore: upgrade styled-components to v6 (c4bd333501)
|
|
83
|
+
- chore(connect-web): add dev URL used for tests (487742a930)
|
|
84
|
+
- chore: TS project references for build:libs + buildless utxo-lib (#11526) (4d857722fe)
|
|
85
|
+
- fix(connect): no request device in suite (ad6d28e315)
|
|
86
|
+
- feat(connect): add translations for Trezor Firmware (a3ebb33571)
|
|
87
|
+
- chore(connect-common): add firmware binaries 2.7.0 (4c14b45bd6)
|
|
88
|
+
- fix(connect): fix connect for RN (#11489) (14814fd54b)
|
|
89
|
+
- chore(repo): mostly buildless monorepo (#11464) (637ad88dcf)
|
|
90
|
+
|
|
1
91
|
# 9.2.1
|
|
2
92
|
|
|
3
93
|
Main motivation for this release was [issue](https://github.com/trezor/trezor-suite/issues/11442) introduced in 9.2.0 release in @trezor/connect-web npm package.
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @trezor/connect
|
|
2
2
|
|
|
3
|
-
API version 9.2.
|
|
3
|
+
API version 9.2.3
|
|
4
4
|
|
|
5
5
|
[](https://github.com/trezor/trezor-suite/actions/workflows/connect-test.yml)
|
|
6
6
|
[](https://www.npmjs.org/package/@trezor/connect)
|
|
@@ -81,7 +81,7 @@ export declare const validate: (tx: BinanceSDKTransaction) => {
|
|
|
81
81
|
}))[];
|
|
82
82
|
};
|
|
83
83
|
export declare const signTx: (typedCall: TypedCall, address_n: number[], tx: BinancePreparedTransaction, chunkify?: boolean) => Promise<{
|
|
84
|
-
public_key: string;
|
|
85
84
|
signature: string;
|
|
85
|
+
public_key: string;
|
|
86
86
|
}>;
|
|
87
87
|
//# sourceMappingURL=binanceSignTx.d.ts.map
|
|
@@ -10,14 +10,14 @@ export declare class FeeLevels {
|
|
|
10
10
|
loadMisc(blockchain: Blockchain): Promise<{
|
|
11
11
|
feeLimit?: string | undefined;
|
|
12
12
|
feePerTx?: string | undefined;
|
|
13
|
-
label: "
|
|
13
|
+
label: "high" | "normal" | "economy" | "low" | "custom";
|
|
14
14
|
feePerUnit: string;
|
|
15
15
|
blocks: number;
|
|
16
16
|
}[]>;
|
|
17
17
|
load(blockchain: Blockchain): Promise<{
|
|
18
18
|
feeLimit?: string | undefined;
|
|
19
19
|
feePerTx?: string | undefined;
|
|
20
|
-
label: "
|
|
20
|
+
label: "high" | "normal" | "economy" | "low" | "custom";
|
|
21
21
|
feePerUnit: string;
|
|
22
22
|
blocks: number;
|
|
23
23
|
}[]>;
|
|
@@ -29,12 +29,12 @@ export declare class TransactionComposer {
|
|
|
29
29
|
composeCustomFee(fee: string): void;
|
|
30
30
|
getFeeLevelList(): ({
|
|
31
31
|
feePerByte?: undefined;
|
|
32
|
-
fee: "0";
|
|
33
32
|
name: string;
|
|
33
|
+
fee: "0";
|
|
34
34
|
disabled: true;
|
|
35
35
|
} | {
|
|
36
|
-
fee: string;
|
|
37
36
|
name: string;
|
|
37
|
+
fee: string;
|
|
38
38
|
feePerByte: string;
|
|
39
39
|
minutes: number;
|
|
40
40
|
total: string;
|
|
@@ -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
|
-
|
|
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' },
|
|
@@ -29,6 +30,7 @@ class BlockchainEstimateFee extends AbstractMethod_1.AbstractMethod {
|
|
|
29
30
|
{ name: 'from', type: 'string' },
|
|
30
31
|
{ name: 'to', type: 'string' },
|
|
31
32
|
{ name: 'txsize', type: 'number' },
|
|
33
|
+
{ name: 'isCreatingAccount', type: 'boolean' },
|
|
32
34
|
]);
|
|
33
35
|
}
|
|
34
36
|
}
|
|
@@ -39,11 +41,12 @@ class BlockchainEstimateFee extends AbstractMethod_1.AbstractMethod {
|
|
|
39
41
|
(0, BlockchainLink_1.isBackendSupported)(coinInfo);
|
|
40
42
|
this.params = {
|
|
41
43
|
coinInfo,
|
|
44
|
+
identity,
|
|
42
45
|
request,
|
|
43
46
|
};
|
|
44
47
|
}
|
|
45
48
|
async run() {
|
|
46
|
-
const { coinInfo, request } = this.params;
|
|
49
|
+
const { coinInfo, identity, request } = this.params;
|
|
47
50
|
const feeInfo = {
|
|
48
51
|
blockTime: coinInfo.blockTime,
|
|
49
52
|
minFee: coinInfo.minFee,
|
|
@@ -54,13 +57,13 @@ class BlockchainEstimateFee extends AbstractMethod_1.AbstractMethod {
|
|
|
54
57
|
if (request && request.feeLevels) {
|
|
55
58
|
const fees = new Fees_1.FeeLevels(coinInfo);
|
|
56
59
|
if (request.feeLevels === 'smart' && coinInfo.shortcut !== 'DOGE') {
|
|
57
|
-
const backend = await (0, BlockchainLink_1.initBlockchain)(coinInfo, this.postMessage);
|
|
60
|
+
const backend = await (0, BlockchainLink_1.initBlockchain)(coinInfo, this.postMessage, identity);
|
|
58
61
|
await fees.load(backend);
|
|
59
62
|
}
|
|
60
63
|
feeInfo.levels = fees.levels;
|
|
61
64
|
}
|
|
62
65
|
else {
|
|
63
|
-
const backend = await (0, BlockchainLink_1.initBlockchain)(coinInfo, this.postMessage);
|
|
66
|
+
const backend = await (0, BlockchainLink_1.initBlockchain)(coinInfo, this.postMessage, identity);
|
|
64
67
|
feeInfo.levels = await backend.estimateFee(request || {});
|
|
65
68
|
}
|
|
66
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,
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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, [
|
|
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,29 +1,18 @@
|
|
|
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() {
|
|
9
|
+
this.allowDeviceMode = [events_1.UI.INITIALIZE, events_1.UI.SEEDLESS];
|
|
11
10
|
this.useEmptyPassphrase = true;
|
|
12
11
|
this.requiredPermissions = ['management'];
|
|
13
12
|
this.useDeviceState = false;
|
|
14
13
|
const { payload } = this;
|
|
15
14
|
(0, schema_utils_1.Assert)(changeLanguage_1.ChangeLanguage, payload);
|
|
16
|
-
|
|
17
|
-
this.params = {
|
|
18
|
-
binary: payload.binary,
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
else {
|
|
22
|
-
this.params = {
|
|
23
|
-
language: payload.language,
|
|
24
|
-
baseUrl: payload.baseUrl || 'https://data.trezor.io',
|
|
25
|
-
};
|
|
26
|
-
}
|
|
15
|
+
this.params = payload;
|
|
27
16
|
}
|
|
28
17
|
async confirmation() {
|
|
29
18
|
await this.getPopupPromise().promise;
|
|
@@ -39,34 +28,14 @@ class ChangeLanguage extends AbstractMethod_1.AbstractMethod {
|
|
|
39
28
|
const uiResp = await uiPromise.promise;
|
|
40
29
|
return uiResp.payload;
|
|
41
30
|
}
|
|
42
|
-
|
|
43
|
-
const
|
|
44
|
-
if (!this.device.commands) {
|
|
45
|
-
throw constants_1.ERRORS.TypedError('Runtime', 'uploadTranslationData: device.commands is not set');
|
|
46
|
-
}
|
|
47
|
-
let response = await this.device.commands.typedCall('ChangeLanguage', ['TranslationDataRequest', 'Success'], {
|
|
48
|
-
data_length: length,
|
|
49
|
-
});
|
|
50
|
-
while (response.type !== 'Success') {
|
|
51
|
-
const start = response.message.data_offset;
|
|
52
|
-
const end = response.message.data_offset + response.message.data_length;
|
|
53
|
-
const chunk = payload.slice(start, end);
|
|
54
|
-
response = await this.device.commands.typedCall('TranslationDataAck', ['TranslationDataRequest', 'Success'], {
|
|
55
|
-
data_chunk: Buffer.from(chunk).toString('hex'),
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
return response.message;
|
|
59
|
-
}
|
|
60
|
-
async run() {
|
|
61
|
-
const { language, binary, baseUrl } = this.params;
|
|
31
|
+
run() {
|
|
32
|
+
const { language, binary } = this.params;
|
|
62
33
|
if (binary) {
|
|
63
|
-
return this.
|
|
34
|
+
return this.device.changeLanguage({ binary });
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
return this.device.changeLanguage({ language });
|
|
64
38
|
}
|
|
65
|
-
const version = this.device.getVersion().join('.');
|
|
66
|
-
const model = this.device.features.internal_model;
|
|
67
|
-
const url = `${baseUrl}/data/translations/translation-${model}-${language}-${version}-unsigned.bin`;
|
|
68
|
-
const downloadedBinary = await (0, assets_1.httpRequest)(url, 'binary');
|
|
69
|
-
return this.uploadTranslationData(downloadedBinary);
|
|
70
39
|
}
|
|
71
40
|
}
|
|
72
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<{
|