@trezor/connect 9.5.5 → 9.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +47 -4
- package/README.md +1 -1
- package/lib/api/cardano/api/cardanoSignTransaction.d.ts +2 -2
- package/lib/api/discoverAccounts.d.ts +33 -0
- package/lib/api/discoverAccounts.js +180 -0
- package/lib/api/eos/eosSignTx.d.ts +4 -4
- package/lib/api/ethereum/ethereumSignTx.js +8 -6
- package/lib/api/firmware/getBinary.d.ts +1 -1
- package/lib/api/getAccountInfo.d.ts +4 -0
- package/lib/api/getAccountInfo.js +2 -0
- package/lib/api/getFeatures.d.ts +1 -1
- package/lib/api/index.d.ts +1 -0
- package/lib/api/index.js +4 -1
- package/lib/api/nem/nemSignTx.d.ts +9 -9
- package/lib/api/resetDevice.d.ts +1 -0
- package/lib/api/resetDevice.js +4 -0
- package/lib/api/signTransaction.d.ts +12 -12
- package/lib/api/solana/api/solanaSignTransaction.d.ts +1 -0
- package/lib/api/solana/api/solanaSignTransaction.js +12 -0
- package/lib/api/solana/solanaDefinitions.d.ts +8 -0
- package/lib/api/solana/solanaDefinitions.js +39 -0
- package/lib/api/solana/solanaUtils.js +1 -1
- package/lib/api/stellar/stellarSignTx.d.ts +1 -1
- package/lib/api/tezos/tezosSignTx.d.ts +6 -6
- package/lib/backend/Blockchain.js +6 -1
- package/lib/constants/network.d.ts +1 -1
- package/lib/constants/network.js +0 -1
- package/lib/core/method.native.js +0 -1
- package/lib/data/defaultFeeLevels.js +9 -0
- package/lib/data/downloadReleasesMetadata.d.ts +1 -1
- package/lib/data/firmwareInfo.d.ts +2 -2
- package/lib/data/version.d.ts +1 -1
- package/lib/data/version.js +1 -1
- package/lib/device/Device.d.ts +5 -10
- package/lib/device/Device.js +3 -2
- package/lib/device/DeviceCommands.d.ts +9 -8
- package/lib/device/DeviceCommands.js +10 -5
- package/lib/device/DeviceCurrentSession.d.ts +142 -263
- package/lib/device/DeviceCurrentSession.js +9 -9
- package/lib/device/checkFirmwareRevision.d.ts +1 -1
- package/lib/device/checkFirmwareRevision.js +1 -1
- package/lib/factory.js +1 -7
- package/lib/impl/dynamic.d.ts +2 -0
- package/lib/impl/dynamic.js +27 -8
- package/lib/tsconfig.lib.tsbuildinfo +1 -1
- package/lib/types/api/discoverAccounts.d.ts +222 -0
- package/lib/types/api/discoverAccounts.js +57 -0
- package/lib/types/api/index.d.ts +2 -6
- package/lib/types/firmware.d.ts +1 -17
- package/lib/types/index.d.ts +0 -1
- package/lib/types/index.js +0 -1
- package/lib/types/settings.d.ts +1 -1
- package/lib/utils/deviceFeaturesUtils.js +3 -0
- package/lib/utils/firmwareUtils.d.ts +2 -2
- package/lib/workers/workers-browser.d.ts +2 -1
- package/lib/workers/workers-browser.js +3 -1
- package/lib/workers/workers.d.ts +2 -1
- package/lib/workers/workers.js +3 -1
- package/lib/workers/workers.native.d.ts +2 -1
- package/lib/workers/workers.native.js +3 -1
- package/package.json +16 -16
- package/lib/api/binance/api/binanceGetAddress.d.ts +0 -26
- package/lib/api/binance/api/binanceGetAddress.js +0 -109
- package/lib/api/binance/api/binanceGetPublicKey.d.ts +0 -21
- package/lib/api/binance/api/binanceGetPublicKey.js +0 -63
- package/lib/api/binance/api/binanceSignTransaction.d.ts +0 -17
- package/lib/api/binance/api/binanceSignTransaction.js +0 -34
- package/lib/api/binance/api/index.d.ts +0 -4
- package/lib/api/binance/api/index.js +0 -11
- package/lib/api/binance/binanceSignTx.d.ts +0 -87
- package/lib/api/binance/binanceSignTx.js +0 -69
- package/lib/types/api/binance/index.d.ts +0 -204
- package/lib/types/api/binance/index.js +0 -51
- package/lib/types/api/binanceGetAddress.d.ts +0 -4
- package/lib/types/api/binanceGetAddress.js +0 -3
- package/lib/types/api/binanceGetPublicKey.d.ts +0 -4
- package/lib/types/api/binanceGetPublicKey.js +0 -3
- package/lib/types/api/binanceSignTransaction.d.ts +0 -5
- package/lib/types/api/binanceSignTransaction.js +0 -3
package/CHANGELOG.md
CHANGED
|
@@ -1,16 +1,59 @@
|
|
|
1
1
|
| Package | Stable | Canary |
|
|
2
2
|
| :------------------------------: | :----: | :----------: |
|
|
3
|
-
| npm @trezor/connect | 9.
|
|
4
|
-
| npm @trezor/connect-web | 9.
|
|
5
|
-
| npm @trezor/connect-webextension | 9.
|
|
3
|
+
| npm @trezor/connect | 9.6.0 | - |
|
|
4
|
+
| npm @trezor/connect-web | 9.6.0 | - |
|
|
5
|
+
| npm @trezor/connect-webextension | 9.6.0 | - |
|
|
6
6
|
| npm @trezor/connect-mobile | - | 0.0.1-beta.1 |
|
|
7
7
|
|
|
8
8
|
| Deployment | Stable | Canary |
|
|
9
9
|
| :----------------: | :----: | :----: |
|
|
10
|
-
| connect.trezor.io/ | 9.
|
|
10
|
+
| connect.trezor.io/ | 9.6.0 | - |
|
|
11
11
|
|
|
12
12
|
Use the persistent link [connect.trezor.io/9](https://connect.trezor.io/9/) to access the latest stable version of Connect Explorer.
|
|
13
13
|
|
|
14
|
+
# 9.6.0
|
|
15
|
+
|
|
16
|
+
Starting with Connect version 9.6.0, we are introducing a new integration with Trezor Suite. The new flow is designed to provide a more seamless and user-friendly experience for users interacting with Trezor devices.
|
|
17
|
+
To learn more, please take a look at the full [New Connect flow in Trezor Suite](https://connect.trezor.io/9.6.0-beta.1/guides/new-connect-flow-in-trezor-suite/) article.
|
|
18
|
+
We encourage you to try out the new flow to make sure everything works as expected. If you encounter any issues, please let us know.
|
|
19
|
+
|
|
20
|
+
This requires one change in the manifest - there is an additional required field `appName` that is used in the permission prompt. Optionally, you can also provide an `appIcon` which will be shown in the future.
|
|
21
|
+
|
|
22
|
+
```javascript
|
|
23
|
+
TrezorConnect.init({
|
|
24
|
+
manifest: {
|
|
25
|
+
email: 'developer@xyz.com',
|
|
26
|
+
appName: 'Your Application',
|
|
27
|
+
appUrl: 'http://your.application.com',
|
|
28
|
+
appIcon: 'http://your.application.com/icon-64.png',
|
|
29
|
+
},
|
|
30
|
+
});
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Features
|
|
34
|
+
|
|
35
|
+
- Use suite-desktop by default (73d8a0a)
|
|
36
|
+
- `appName` in manifest now required (6103a68)
|
|
37
|
+
- New `discoverAccount` method (0b584aa, 3a07e81, 8389827, e2f66ef, f0f9197, 084089d, 978c2f5, dc1a77d)
|
|
38
|
+
|
|
39
|
+
## Chain Support
|
|
40
|
+
|
|
41
|
+
- Improved support for Stellar (180265b, 48b5ca0), including testnet (4231425)
|
|
42
|
+
- Removed support for old Binance beacon chain (97a2dfd)
|
|
43
|
+
- Use Solana token definitions (4be5bea)
|
|
44
|
+
|
|
45
|
+
## Fixes
|
|
46
|
+
|
|
47
|
+
- Do not throw entropy check failure during backup (81d582e)
|
|
48
|
+
- Keep session dispose error (f2dcd3a)
|
|
49
|
+
- `getAccountDescriptor` polished (e5b2cff)
|
|
50
|
+
|
|
51
|
+
## Chores
|
|
52
|
+
|
|
53
|
+
- Update Ethereum libs (ab5ad7b)
|
|
54
|
+
- Update Solana libs (f58d9b6)
|
|
55
|
+
- Update dependencies (47b7a34, 7bf17ef, 680cc6b, 2c97fed, 3c05b26)
|
|
56
|
+
|
|
14
57
|
# 9.5.5
|
|
15
58
|
|
|
16
59
|
This release is mostly about refactoring and preparatory work for the new way of using TrezorConnect together with Trezor Suite as its UI.
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @trezor/connect
|
|
2
2
|
|
|
3
|
-
API version 9.
|
|
3
|
+
API version 9.6.0
|
|
4
4
|
|
|
5
5
|
[](https://github.com/trezor/trezor-suite/actions/workflows/test-connect.yml)
|
|
6
6
|
[](https://www.npmjs.org/package/@trezor/connect)
|
|
@@ -56,8 +56,8 @@ export default class CardanoSignTransaction extends AbstractMethod<'cardanoSignT
|
|
|
56
56
|
witnesses: {
|
|
57
57
|
chainCode?: string | undefined;
|
|
58
58
|
type: PROTO.CardanoTxWitnessType;
|
|
59
|
-
signature: string;
|
|
60
59
|
pubKey: string;
|
|
60
|
+
signature: string;
|
|
61
61
|
}[];
|
|
62
62
|
} | {
|
|
63
63
|
serializedTx: string;
|
|
@@ -70,8 +70,8 @@ export default class CardanoSignTransaction extends AbstractMethod<'cardanoSignT
|
|
|
70
70
|
witnesses: {
|
|
71
71
|
chainCode?: string | undefined;
|
|
72
72
|
type: PROTO.CardanoTxWitnessType;
|
|
73
|
-
signature: string;
|
|
74
73
|
pubKey: string;
|
|
74
|
+
signature: string;
|
|
75
75
|
}[];
|
|
76
76
|
}>;
|
|
77
77
|
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { AbstractMethod } from '../core/AbstractMethod';
|
|
2
|
+
import type { CoinInfo, FirmwareRange } from '../types';
|
|
3
|
+
import { AccountTypeItem, AdditionalParams, CARDANO_DERIVATIONS } from '../types/api/discoverAccounts';
|
|
4
|
+
type CardanoDerivation = (typeof CARDANO_DERIVATIONS)[keyof typeof CARDANO_DERIVATIONS];
|
|
5
|
+
type Request = AdditionalParams & {
|
|
6
|
+
account: AccountTypeItem;
|
|
7
|
+
derivation?: CardanoDerivation;
|
|
8
|
+
firmwareRange: FirmwareRange;
|
|
9
|
+
coinInfo: CoinInfo;
|
|
10
|
+
offset: number;
|
|
11
|
+
skip: number;
|
|
12
|
+
};
|
|
13
|
+
export default class DiscoverAccounts extends AbstractMethod<'discoverAccounts', Request[]> {
|
|
14
|
+
disposed: boolean;
|
|
15
|
+
init(): void;
|
|
16
|
+
private progress;
|
|
17
|
+
private updateProgress;
|
|
18
|
+
private sendProgress;
|
|
19
|
+
run(): Promise<{
|
|
20
|
+
empty: number;
|
|
21
|
+
nonempty: number;
|
|
22
|
+
failed: number;
|
|
23
|
+
}>;
|
|
24
|
+
private filterUnsupportedAccounts;
|
|
25
|
+
private filterCardanoDerivations;
|
|
26
|
+
private readonly descriptorLock;
|
|
27
|
+
private readonly descriptorCache;
|
|
28
|
+
private getDescriptor;
|
|
29
|
+
private discoverAccount;
|
|
30
|
+
dispose(): void;
|
|
31
|
+
}
|
|
32
|
+
export {};
|
|
33
|
+
//# sourceMappingURL=discoverAccounts.d.ts.map
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const utils_1 = require("@trezor/utils");
|
|
4
|
+
const BlockchainLink_1 = require("../backend/BlockchainLink");
|
|
5
|
+
const constants_1 = require("../constants");
|
|
6
|
+
const AbstractMethod_1 = require("../core/AbstractMethod");
|
|
7
|
+
const coinInfo_1 = require("../data/coinInfo");
|
|
8
|
+
const events_1 = require("../events");
|
|
9
|
+
const paramsValidator_1 = require("./common/paramsValidator");
|
|
10
|
+
const discoverAccounts_1 = require("../types/api/discoverAccounts");
|
|
11
|
+
const accountUtils_1 = require("../utils/accountUtils");
|
|
12
|
+
const pathUtils_1 = require("../utils/pathUtils");
|
|
13
|
+
const ACCOUNT_LIMIT = 10;
|
|
14
|
+
const TXS_PER_PAGE = 25;
|
|
15
|
+
const DETAILS = 'txs';
|
|
16
|
+
const isCardano = (account) => account.symbol === 'ada' || account.symbol === 'tada';
|
|
17
|
+
const isCardanoRequest = (request) => isCardano(request.account);
|
|
18
|
+
const isEvmLedger = (account, coinInfo) => coinInfo.type === 'ethereum' && account.type === 'ledger';
|
|
19
|
+
const getAccountTypeKey = ({ symbol, type }) => `${symbol}-${type}`;
|
|
20
|
+
class DiscoverAccounts extends AbstractMethod_1.AbstractMethod {
|
|
21
|
+
disposed = false;
|
|
22
|
+
init() {
|
|
23
|
+
this.requiredPermissions = ['read'];
|
|
24
|
+
this.useDevice = true;
|
|
25
|
+
this.useDeviceState = true;
|
|
26
|
+
this.useUi = false;
|
|
27
|
+
const { payload } = this;
|
|
28
|
+
(0, paramsValidator_1.validateParams)(payload, [{ name: 'accounts', type: 'array' }]);
|
|
29
|
+
this.params = payload.accounts.flatMap(item => {
|
|
30
|
+
(0, paramsValidator_1.validateParams)(item, [
|
|
31
|
+
{ name: 'symbol', type: 'string', required: true },
|
|
32
|
+
{ name: 'type', type: 'string' },
|
|
33
|
+
{ name: 'identity', type: 'string' },
|
|
34
|
+
{ name: 'details', type: 'string' },
|
|
35
|
+
{ name: 'pageSize', type: 'number' },
|
|
36
|
+
{ name: 'skip', type: 'number' },
|
|
37
|
+
]);
|
|
38
|
+
const { symbol, type, ...rest } = item;
|
|
39
|
+
const coinInfo = (0, coinInfo_1.getCoinInfo)(item.symbol);
|
|
40
|
+
if (!coinInfo) {
|
|
41
|
+
throw constants_1.ERRORS.TypedError('Method_UnknownCoin');
|
|
42
|
+
}
|
|
43
|
+
(0, BlockchainLink_1.isBackendSupported)(coinInfo);
|
|
44
|
+
const firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, coinInfo, AbstractMethod_1.DEFAULT_FIRMWARE_RANGE);
|
|
45
|
+
return discoverAccounts_1.ACCOUNT_TYPES.filter(a => a.symbol === symbol && (!type || a.type === type)).map(account => ({
|
|
46
|
+
pageSize: TXS_PER_PAGE,
|
|
47
|
+
details: DETAILS,
|
|
48
|
+
coinInfo,
|
|
49
|
+
firmwareRange,
|
|
50
|
+
skip: 0,
|
|
51
|
+
account,
|
|
52
|
+
...rest,
|
|
53
|
+
offset: isEvmLedger(account, coinInfo) ? 1 : 0,
|
|
54
|
+
derivation: isCardano(account) ? discoverAccounts_1.CARDANO_DERIVATIONS[account.type] : undefined,
|
|
55
|
+
}));
|
|
56
|
+
});
|
|
57
|
+
}
|
|
58
|
+
progress = {};
|
|
59
|
+
updateProgress(account, done, last = false) {
|
|
60
|
+
const progress = last ? 1 : done / Math.max(ACCOUNT_LIMIT, done + 1);
|
|
61
|
+
const key = getAccountTypeKey(account);
|
|
62
|
+
this.progress[key] = progress;
|
|
63
|
+
}
|
|
64
|
+
sendProgress(account) {
|
|
65
|
+
const progress = Object.values(this.progress).reduce((sum, typeProgress) => sum + typeProgress, 0) /
|
|
66
|
+
(Object.keys(this.progress).length || 1);
|
|
67
|
+
this.postMessage((0, events_1.createUiMessage)(events_1.UI.BUNDLE_PROGRESS, {
|
|
68
|
+
total: 100,
|
|
69
|
+
progress: 100 * progress,
|
|
70
|
+
response: account,
|
|
71
|
+
}));
|
|
72
|
+
}
|
|
73
|
+
async run() {
|
|
74
|
+
const [unsupported, supported] = this.filterUnsupportedAccounts(this.params);
|
|
75
|
+
unsupported.forEach(({ account: { path, ...rest }, error }) => this.sendProgress({ ...rest, index: 0, error }));
|
|
76
|
+
const [cardanoAccounts, otherAccounts] = (0, utils_1.arrayPartition)(supported, isCardanoRequest);
|
|
77
|
+
const [_, filteredCardanoAccounts] = await this.filterCardanoDerivations(cardanoAccounts);
|
|
78
|
+
const accounts = [...otherAccounts, ...filteredCardanoAccounts];
|
|
79
|
+
accounts.forEach(({ account, skip }) => this.updateProgress(account, skip));
|
|
80
|
+
const counts = await Promise.all(accounts.map(account => this.discoverAccount(account)));
|
|
81
|
+
const nonempty = counts.reduce((sum, acc) => sum + acc.nonempty, 0);
|
|
82
|
+
const failed = counts.filter(acc => acc.error).length;
|
|
83
|
+
const empty = counts.length - failed;
|
|
84
|
+
return { empty, nonempty, failed };
|
|
85
|
+
}
|
|
86
|
+
filterUnsupportedAccounts(accounts) {
|
|
87
|
+
const version = this.device.getVersion();
|
|
88
|
+
const model = this.device.features?.internal_model;
|
|
89
|
+
if (!version || !model)
|
|
90
|
+
return [[], accounts];
|
|
91
|
+
return (0, utils_1.arrayPartition)(accounts.map(item => {
|
|
92
|
+
const { min, max } = item.firmwareRange[model];
|
|
93
|
+
let error;
|
|
94
|
+
if (min === '0') {
|
|
95
|
+
error = events_1.UI.FIRMWARE_NOT_SUPPORTED;
|
|
96
|
+
}
|
|
97
|
+
else if (!utils_1.versionUtils.isNewerOrEqual(version, min)) {
|
|
98
|
+
error = events_1.UI.FIRMWARE_OLD;
|
|
99
|
+
}
|
|
100
|
+
else if (max !== '0' && utils_1.versionUtils.isNewer(version, max)) {
|
|
101
|
+
error = events_1.UI.FIRMWARE_NOT_COMPATIBLE;
|
|
102
|
+
}
|
|
103
|
+
return error ? { ...item, error } : item;
|
|
104
|
+
}), item => 'error' in item);
|
|
105
|
+
}
|
|
106
|
+
async filterCardanoDerivations(accounts) {
|
|
107
|
+
const tryGetDescriptor = (coin) => coin && this.getDescriptor(coin.coinInfo, coin.account.path, coin.derivation, 0);
|
|
108
|
+
const normal = await tryGetDescriptor(accounts.find(a => a.account.type === 'normal'));
|
|
109
|
+
const ledger = await tryGetDescriptor(accounts.find(a => a.account.type === 'ledger'));
|
|
110
|
+
const legacy = await tryGetDescriptor(accounts.find(a => a.account.type === 'legacy'));
|
|
111
|
+
const omitLegacy = legacy && legacy.descriptor === (normal ?? ledger)?.descriptor;
|
|
112
|
+
const omitLedger = ledger && ledger.descriptor === normal?.descriptor;
|
|
113
|
+
return (0, utils_1.arrayPartition)(accounts.map(item => (item.account.type === 'legacy' && omitLegacy) ||
|
|
114
|
+
(item.account.type === 'ledger' && omitLedger)
|
|
115
|
+
? { ...item, error: 'ignored cardano derivation' }
|
|
116
|
+
: item), item => 'error' in item);
|
|
117
|
+
}
|
|
118
|
+
descriptorLock = (0, utils_1.getSynchronize)();
|
|
119
|
+
descriptorCache = {};
|
|
120
|
+
async getDescriptor(coinInfo, bip43PathTemplate, derivationType, index) {
|
|
121
|
+
const path = bip43PathTemplate.replace('i', String(index));
|
|
122
|
+
const { address_n: _, ...descriptorRest } = await this.descriptorLock(async () => {
|
|
123
|
+
const key = `${path}-${derivationType}`;
|
|
124
|
+
if (!this.descriptorCache[key]) {
|
|
125
|
+
const address_n = (0, pathUtils_1.validatePath)(path, 3);
|
|
126
|
+
this.descriptorCache[key] = await this.device
|
|
127
|
+
.getCommands()
|
|
128
|
+
.getAccountDescriptor(coinInfo, address_n, derivationType);
|
|
129
|
+
}
|
|
130
|
+
return this.descriptorCache[key];
|
|
131
|
+
});
|
|
132
|
+
return { path, ...descriptorRest };
|
|
133
|
+
}
|
|
134
|
+
async discoverAccount(request) {
|
|
135
|
+
const { details, identity, pageSize, coinInfo, derivation, offset, skip } = request;
|
|
136
|
+
const { path, ...accountKey } = request.account;
|
|
137
|
+
const utxoRequired = (0, accountUtils_1.isUtxoBased)(coinInfo) && details && details !== 'basic';
|
|
138
|
+
let index = skip;
|
|
139
|
+
let blockchain;
|
|
140
|
+
try {
|
|
141
|
+
blockchain = await (0, BlockchainLink_1.initBlockchain)(coinInfo, this.postMessage, identity);
|
|
142
|
+
}
|
|
143
|
+
catch (error) {
|
|
144
|
+
this.updateProgress(accountKey, index + 1, true);
|
|
145
|
+
this.sendProgress({ ...accountKey, index, error: error.message });
|
|
146
|
+
return { nonempty: 0, error: error.message };
|
|
147
|
+
}
|
|
148
|
+
let descPromise = this.getDescriptor(coinInfo, path, derivation, offset + index);
|
|
149
|
+
while (true) {
|
|
150
|
+
try {
|
|
151
|
+
const { descriptor, ...descRest } = await descPromise;
|
|
152
|
+
descPromise = this.getDescriptor(coinInfo, path, derivation, offset + index + 1);
|
|
153
|
+
const info = await blockchain.getAccountInfo({ descriptor, details, pageSize });
|
|
154
|
+
const utxo = !utxoRequired
|
|
155
|
+
? undefined
|
|
156
|
+
: info.empty
|
|
157
|
+
? []
|
|
158
|
+
: await blockchain.getAccountUtxo(descriptor);
|
|
159
|
+
this.updateProgress(accountKey, index + 1, info.empty);
|
|
160
|
+
this.sendProgress({ ...info, descriptor, ...descRest, utxo, ...accountKey, index });
|
|
161
|
+
if (info.empty) {
|
|
162
|
+
await descPromise.catch(() => { });
|
|
163
|
+
return { nonempty: index - skip };
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
catch (error) {
|
|
167
|
+
descPromise.catch(() => { });
|
|
168
|
+
this.updateProgress(accountKey, index + 1, true);
|
|
169
|
+
this.sendProgress({ ...accountKey, index, error: error.message });
|
|
170
|
+
return { nonempty: index - skip, error };
|
|
171
|
+
}
|
|
172
|
+
index++;
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
dispose() {
|
|
176
|
+
this.disposed = true;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
exports.default = DiscoverAccounts;
|
|
180
|
+
//# sourceMappingURL=discoverAccounts.js.map
|
|
@@ -17,21 +17,21 @@ export declare const validate: (tx: EosSDKTransaction) => {
|
|
|
17
17
|
data_chunk: string;
|
|
18
18
|
} | undefined;
|
|
19
19
|
transfer?: {
|
|
20
|
-
memo: string;
|
|
21
20
|
quantity: {
|
|
22
21
|
symbol: string;
|
|
23
22
|
amount: string | number;
|
|
24
23
|
};
|
|
25
|
-
|
|
24
|
+
memo: string;
|
|
26
25
|
receiver: string;
|
|
26
|
+
sender: string;
|
|
27
27
|
} | undefined;
|
|
28
28
|
refund?: {
|
|
29
29
|
owner: string;
|
|
30
30
|
} | undefined;
|
|
31
31
|
delegate?: {
|
|
32
32
|
transfer: boolean;
|
|
33
|
-
sender: string;
|
|
34
33
|
receiver: string;
|
|
34
|
+
sender: string;
|
|
35
35
|
net_quantity: {
|
|
36
36
|
symbol: string;
|
|
37
37
|
amount: string | number;
|
|
@@ -42,8 +42,8 @@ export declare const validate: (tx: EosSDKTransaction) => {
|
|
|
42
42
|
};
|
|
43
43
|
} | undefined;
|
|
44
44
|
undelegate?: {
|
|
45
|
-
sender: string;
|
|
46
45
|
receiver: string;
|
|
46
|
+
sender: string;
|
|
47
47
|
net_quantity: {
|
|
48
48
|
symbol: string;
|
|
49
49
|
amount: string | number;
|
|
@@ -36,11 +36,13 @@ const processTxRequest = async (typedCall, request, data, chain_id) => {
|
|
|
36
36
|
};
|
|
37
37
|
const deepHexPrefix = (0, formatUtils_1.deepTransform)(formatUtils_1.addHexPrefix);
|
|
38
38
|
const getCommonForChain = (chainId) => {
|
|
39
|
-
if (
|
|
40
|
-
return
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
39
|
+
if (chainId === 61) {
|
|
40
|
+
return (0, common_1.createCustomCommon)({
|
|
41
|
+
chainId: 61,
|
|
42
|
+
defaultHardfork: common_1.Hardfork.Petersburg,
|
|
43
|
+
}, common_1.Mainnet);
|
|
44
|
+
}
|
|
45
|
+
return (0, common_1.createCustomCommon)({ chainId }, common_1.Mainnet);
|
|
44
46
|
};
|
|
45
47
|
exports.getCommonForChain = getCommonForChain;
|
|
46
48
|
const serializeEthereumTx = (tx, signature, isLegacy) => {
|
|
@@ -64,7 +66,7 @@ const serializeEthereumTx = (tx, signature, isLegacy) => {
|
|
|
64
66
|
const txOptions = {
|
|
65
67
|
common: (0, exports.getCommonForChain)(tx.chainId),
|
|
66
68
|
};
|
|
67
|
-
const ethTx = tx_1.
|
|
69
|
+
const ethTx = (0, tx_1.createTx)(txData, txOptions);
|
|
68
70
|
return `0x${Buffer.from(ethTx.serialize()).toString('hex')}`;
|
|
69
71
|
};
|
|
70
72
|
exports.serializeEthereumTx = serializeEthereumTx;
|
|
@@ -49,6 +49,7 @@ export default class GetAccountInfo extends AbstractMethod<'getAccountInfo', Req
|
|
|
49
49
|
[key: string]: import("@trezor/blockchain-link-types/lib/blockbook-api").AddressAlias;
|
|
50
50
|
};
|
|
51
51
|
sequence?: number;
|
|
52
|
+
stellarSequence?: string;
|
|
52
53
|
reserve?: string;
|
|
53
54
|
rewards?: string;
|
|
54
55
|
staking?: {
|
|
@@ -79,6 +80,7 @@ export default class GetAccountInfo extends AbstractMethod<'getAccountInfo', Req
|
|
|
79
80
|
ledger: number;
|
|
80
81
|
seq: number;
|
|
81
82
|
};
|
|
83
|
+
stellarCursor?: string;
|
|
82
84
|
path: string;
|
|
83
85
|
}>;
|
|
84
86
|
discover(request: Request): Promise<{
|
|
@@ -105,6 +107,7 @@ export default class GetAccountInfo extends AbstractMethod<'getAccountInfo', Req
|
|
|
105
107
|
[key: string]: import("@trezor/blockchain-link-types/lib/blockbook-api").AddressAlias;
|
|
106
108
|
};
|
|
107
109
|
sequence?: number;
|
|
110
|
+
stellarSequence?: string;
|
|
108
111
|
reserve?: string;
|
|
109
112
|
rewards?: string;
|
|
110
113
|
staking?: {
|
|
@@ -135,6 +138,7 @@ export default class GetAccountInfo extends AbstractMethod<'getAccountInfo', Req
|
|
|
135
138
|
ledger: number;
|
|
136
139
|
seq: number;
|
|
137
140
|
};
|
|
141
|
+
stellarCursor?: string;
|
|
138
142
|
path: string;
|
|
139
143
|
}>;
|
|
140
144
|
dispose(): void;
|
|
@@ -198,6 +198,7 @@ class GetAccountInfo extends AbstractMethod_1.AbstractMethod {
|
|
|
198
198
|
tokens: request.tokens,
|
|
199
199
|
page: request.page,
|
|
200
200
|
pageSize: request.pageSize,
|
|
201
|
+
pageCursor: request.pageCursor,
|
|
201
202
|
from: request.from,
|
|
202
203
|
to: request.to,
|
|
203
204
|
contractFilter: request.contractFilter,
|
|
@@ -283,6 +284,7 @@ class GetAccountInfo extends AbstractMethod_1.AbstractMethod {
|
|
|
283
284
|
tokens: request.tokens,
|
|
284
285
|
page: request.page,
|
|
285
286
|
pageSize: request.pageSize,
|
|
287
|
+
pageCursor: request.pageCursor,
|
|
286
288
|
from: request.from,
|
|
287
289
|
to: request.to,
|
|
288
290
|
contractFilter: request.contractFilter,
|
package/lib/api/getFeatures.d.ts
CHANGED
|
@@ -42,7 +42,7 @@ export default class GetFeatures extends AbstractMethod<'getFeatures'> {
|
|
|
42
42
|
unfinished_backup: boolean | null;
|
|
43
43
|
no_backup: boolean | null;
|
|
44
44
|
recovery_status: "Nothing" | "Recovery" | "Backup" | null;
|
|
45
|
-
capabilities: ("Capability_Bitcoin" | "Capability_Bitcoin_like" | "Capability_Binance" | "Capability_Cardano" | "Capability_Crypto" | "Capability_EOS" | "Capability_Ethereum" | "Capability_Lisk" | "Capability_Monero" | "Capability_NEM" | "Capability_Ripple" | "Capability_Stellar" | "Capability_Tezos" | "Capability_U2F" | "Capability_Shamir" | "Capability_ShamirGroups" | "Capability_PassphraseEntry" | "Capability_Solana" | "Capability_Translations" | "Capability_Brightness" | "Capability_Haptic")[];
|
|
45
|
+
capabilities: ("Capability_Bitcoin" | "Capability_Bitcoin_like" | "Capability_Binance" | "Capability_Cardano" | "Capability_Crypto" | "Capability_EOS" | "Capability_Ethereum" | "Capability_Lisk" | "Capability_Monero" | "Capability_NEM" | "Capability_Ripple" | "Capability_Stellar" | "Capability_Tezos" | "Capability_U2F" | "Capability_Shamir" | "Capability_ShamirGroups" | "Capability_PassphraseEntry" | "Capability_Solana" | "Capability_Translations" | "Capability_Brightness" | "Capability_Haptic" | "Capability_BLE" | "Capability_NFC")[];
|
|
46
46
|
backup_type: "Bip39" | "Slip39_Basic" | "Slip39_Advanced" | "Slip39_Single_Extendable" | "Slip39_Basic_Extendable" | "Slip39_Advanced_Extendable" | null;
|
|
47
47
|
sd_card_present: boolean | null;
|
|
48
48
|
sd_protection: boolean | null;
|
package/lib/api/index.d.ts
CHANGED
|
@@ -24,6 +24,7 @@ export { default as changePin } from './changePin';
|
|
|
24
24
|
export { default as changeWipeCode } from './changeWipeCode';
|
|
25
25
|
export { default as cipherKeyValue } from './cipherKeyValue';
|
|
26
26
|
export { default as composeTransaction } from './composeTransaction';
|
|
27
|
+
export { default as discoverAccounts } from './discoverAccounts';
|
|
27
28
|
export { default as getAccountDescriptor } from './getAccountDescriptor';
|
|
28
29
|
export { default as getAccountInfo } from './getAccountInfo';
|
|
29
30
|
export { default as getAddress } from './getAddress';
|
package/lib/api/index.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.verifyMessage = exports.unlockPath = exports.signTransaction = exports.signMessage = exports.setProxy = exports.setBusy = exports.setBrightness = exports.loadDevice = exports.resetDevice = exports.requestLogin = exports.recoveryDevice = 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.discoverAccounts = exports.composeTransaction = exports.cipherKeyValue = exports.changeWipeCode = exports.changePin = exports.changeLanguage = exports.blockchainUnsubscribeFiatRates = exports.blockchainUnsubscribe = exports.blockchainSubscribeFiatRates = exports.blockchainSubscribe = exports.blockchainSetCustomBackend = exports.blockchainGetTransactions = exports.blockchainGetFiatRatesForTimestamps = exports.blockchainEvmRpcCall = exports.blockchainGetInfo = exports.blockchainGetCurrentFiatRates = exports.blockchainGetAccountBalanceHistory = exports.blockchainEstimateFee = exports.blockchainDisconnect = exports.bleUnpair = exports.backupDevice = exports.showDeviceTutorial = exports.cancelCoinjoinAuthorization = exports.authorizeCoinjoin = exports.authenticateDevice = exports.applySettings = exports.applyFlags = void 0;
|
|
4
|
+
exports.wipeDevice = void 0;
|
|
4
5
|
const tslib_1 = require("tslib");
|
|
5
6
|
var applyFlags_1 = require("./applyFlags");
|
|
6
7
|
Object.defineProperty(exports, "applyFlags", { enumerable: true, get: function () { return tslib_1.__importDefault(applyFlags_1).default; } });
|
|
@@ -54,6 +55,8 @@ var cipherKeyValue_1 = require("./cipherKeyValue");
|
|
|
54
55
|
Object.defineProperty(exports, "cipherKeyValue", { enumerable: true, get: function () { return tslib_1.__importDefault(cipherKeyValue_1).default; } });
|
|
55
56
|
var composeTransaction_1 = require("./composeTransaction");
|
|
56
57
|
Object.defineProperty(exports, "composeTransaction", { enumerable: true, get: function () { return tslib_1.__importDefault(composeTransaction_1).default; } });
|
|
58
|
+
var discoverAccounts_1 = require("./discoverAccounts");
|
|
59
|
+
Object.defineProperty(exports, "discoverAccounts", { enumerable: true, get: function () { return tslib_1.__importDefault(discoverAccounts_1).default; } });
|
|
57
60
|
var getAccountDescriptor_1 = require("./getAccountDescriptor");
|
|
58
61
|
Object.defineProperty(exports, "getAccountDescriptor", { enumerable: true, get: function () { return tslib_1.__importDefault(getAccountDescriptor_1).default; } });
|
|
59
62
|
var getAccountInfo_1 = require("./getAccountInfo");
|
|
@@ -2,9 +2,17 @@ import { PROTO } from '../../constants';
|
|
|
2
2
|
import * as $T from '../../types/api/nem';
|
|
3
3
|
export declare const createTx: (tx: $T.NEMTransaction, address_n: number[], chunkify?: boolean) => {
|
|
4
4
|
chunkify?: boolean | undefined;
|
|
5
|
+
multisig?: {
|
|
6
|
+
address_n?: number[] | undefined;
|
|
7
|
+
network?: number | undefined;
|
|
8
|
+
signer?: string | undefined;
|
|
9
|
+
timestamp: number;
|
|
10
|
+
fee: string | number;
|
|
11
|
+
deadline: number;
|
|
12
|
+
} | undefined;
|
|
5
13
|
transfer?: {
|
|
6
|
-
public_key?: string | undefined;
|
|
7
14
|
payload?: string | undefined;
|
|
15
|
+
public_key?: string | undefined;
|
|
8
16
|
mosaics?: {
|
|
9
17
|
quantity: number;
|
|
10
18
|
namespace: string;
|
|
@@ -13,14 +21,6 @@ export declare const createTx: (tx: $T.NEMTransaction, address_n: number[], chun
|
|
|
13
21
|
amount: string | number;
|
|
14
22
|
recipient: string;
|
|
15
23
|
} | undefined;
|
|
16
|
-
multisig?: {
|
|
17
|
-
address_n?: number[] | undefined;
|
|
18
|
-
network?: number | undefined;
|
|
19
|
-
signer?: string | undefined;
|
|
20
|
-
timestamp: number;
|
|
21
|
-
fee: string | number;
|
|
22
|
-
deadline: number;
|
|
23
|
-
} | undefined;
|
|
24
24
|
cosigning?: boolean | undefined;
|
|
25
25
|
provision_namespace?: {
|
|
26
26
|
parent?: string | undefined;
|
package/lib/api/resetDevice.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { PROTO } from '../constants';
|
|
2
2
|
import { AbstractMethod } from '../core/AbstractMethod';
|
|
3
3
|
export default class ResetDevice extends AbstractMethod<'resetDevice', PROTO.ResetDevice> {
|
|
4
|
+
private isEntropyCheckSuccessful;
|
|
4
5
|
init(): void;
|
|
5
6
|
get info(): string;
|
|
6
7
|
get confirmation(): {
|
package/lib/api/resetDevice.js
CHANGED
|
@@ -10,6 +10,7 @@ const events_1 = require("../events");
|
|
|
10
10
|
const paramsValidator_1 = require("./common/paramsValidator");
|
|
11
11
|
const pathUtils_1 = require("../utils/pathUtils");
|
|
12
12
|
class ResetDevice extends AbstractMethod_1.AbstractMethod {
|
|
13
|
+
isEntropyCheckSuccessful = false;
|
|
13
14
|
init() {
|
|
14
15
|
this.allowDeviceMode = [events_1.UI.INITIALIZE, events_1.UI.SEEDLESS];
|
|
15
16
|
this.useDeviceState = false;
|
|
@@ -86,6 +87,7 @@ class ResetDevice extends AbstractMethod_1.AbstractMethod {
|
|
|
86
87
|
for (let i = 0; i < tries; i++) {
|
|
87
88
|
entropyData = await this.entropyCheck(entropyData);
|
|
88
89
|
}
|
|
90
|
+
this.isEntropyCheckSuccessful = true;
|
|
89
91
|
await cmd.typedCall('EntropyCheckContinue', 'Success', { finish: true });
|
|
90
92
|
}
|
|
91
93
|
}
|
|
@@ -94,6 +96,8 @@ class ResetDevice extends AbstractMethod_1.AbstractMethod {
|
|
|
94
96
|
errors_groups_1.ERRORS_WITHOUT_DEVICE_INTERACTION.includes(error.message)) {
|
|
95
97
|
throw error;
|
|
96
98
|
}
|
|
99
|
+
if (this.isEntropyCheckSuccessful === true)
|
|
100
|
+
throw error;
|
|
97
101
|
throw constants_1.ERRORS.TypedError('Failure_EntropyCheck', error.message);
|
|
98
102
|
}
|
|
99
103
|
return { message: 'Success' };
|