@trezor/connect 9.6.2 → 9.6.3-beta.2
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 +23 -9
- package/README.md +1 -1
- package/lib/api/applySettings.js +16 -1
- package/lib/api/bitcoin/signtx.d.ts +2 -2
- package/lib/api/bitcoin/signtx.js +1 -1
- package/lib/api/bleUnpair.js +0 -1
- package/lib/api/cardano/api/cardanoGetAddress.d.ts +1 -0
- package/lib/api/cardano/api/cardanoSignMessage.d.ts +25 -0
- package/lib/api/cardano/api/cardanoSignMessage.js +97 -0
- package/lib/api/cardano/api/index.d.ts +1 -0
- package/lib/api/cardano/api/index.js +3 -1
- package/lib/api/cardano/cardanoUtils.d.ts +1 -1
- package/lib/api/cardano/cardanoUtils.js +2 -2
- package/lib/api/discoverAccounts.js +61 -33
- package/lib/api/ethereum/api/ethereumGetAddress.js +1 -0
- package/lib/api/ethereum/api/ethereumSignTransaction.js +22 -4
- package/lib/api/ethereum/ethereumSignTx.d.ts +3 -2
- package/lib/api/ethereum/ethereumSignTx.js +4 -2
- package/lib/api/evoluGetNode.d.ts +11 -0
- package/lib/api/evoluGetNode.js +26 -0
- package/lib/api/firmware/calculateFirmwareHash.d.ts +2 -1
- package/lib/api/firmware/calculateFirmwareHash.js +17 -4
- package/lib/api/firmware/getBinary.d.ts +7 -6
- package/lib/api/firmware/getBinary.js +18 -6
- package/lib/api/firmware/index.d.ts +0 -2
- package/lib/api/firmware/index.js +1 -5
- package/lib/api/firmware/uploadFirmware.d.ts +10 -1
- package/lib/api/firmware/uploadFirmware.js +8 -7
- package/lib/api/getFeatures.d.ts +2 -1
- package/lib/api/index.d.ts +3 -0
- package/lib/api/index.js +8 -2
- package/lib/api/nem/nemSignTx.d.ts +1 -1
- package/lib/api/pushTransaction.d.ts +2 -1
- package/lib/api/pushTransaction.js +2 -1
- package/lib/api/resetDevice.js +2 -1
- package/lib/api/ripple/api/rippleGetAddress.d.ts +1 -0
- package/lib/api/signMessage.js +1 -1
- package/lib/api/signTransaction.d.ts +1 -1
- package/lib/api/solana/api/solanaGetAddress.d.ts +1 -0
- package/lib/api/solana/api/solanaGetPublicKey.d.ts +2 -0
- package/lib/api/solana/api/solanaGetPublicKey.js +3 -0
- package/lib/api/stellar/api/stellarGetAddress.d.ts +1 -0
- package/lib/api/tezos/api/tezosGetAddress.d.ts +1 -0
- package/lib/api/thpGetCredentials.d.ts +10 -0
- package/lib/api/thpGetCredentials.js +31 -0
- package/lib/api/thpRemoveCredentials.d.ts +8 -0
- package/lib/api/thpRemoveCredentials.js +32 -0
- package/lib/api/wipeDevice.js +6 -2
- package/lib/backend/Blockchain.d.ts +4 -4
- package/lib/backend/Blockchain.js +12 -11
- package/lib/constants/cardano.d.ts +3 -0
- package/lib/constants/cardano.js +5 -1
- package/lib/constants/errors.d.ts +12 -9
- package/lib/constants/errors.js +18 -24
- package/lib/core/AbstractMethod.d.ts +5 -24
- package/lib/core/AbstractMethod.js +2 -2
- package/lib/core/index.js +5 -1
- package/lib/core/onCallFirmwareUpdate.d.ts +13 -1
- package/lib/core/onCallFirmwareUpdate.js +158 -94
- package/lib/data/DataManager.d.ts +13 -1
- package/lib/data/DataManager.js +44 -14
- package/lib/data/coinInfo.d.ts +8 -84
- package/lib/data/coinInfo.js +6 -9
- package/lib/data/config.d.ts +26 -192
- package/lib/data/config.js +37 -1
- package/lib/data/connectSettings.js +7 -0
- package/lib/data/defaultFeeLevels.js +2 -1
- package/lib/data/deviceAuthenticityConfig.js +10 -1
- package/lib/data/firmwareInfo.d.ts +44 -11
- package/lib/data/firmwareInfo.js +360 -122
- package/lib/data/thpSettings.js +5 -2
- package/lib/data/version.d.ts +2 -1
- package/lib/data/version.js +4 -3
- package/lib/device/Device.d.ts +17 -7
- package/lib/device/Device.js +72 -115
- package/lib/device/DeviceCommands.d.ts +1 -0
- package/lib/device/DeviceCurrentSession.d.ts +41 -20
- package/lib/device/DeviceCurrentSession.js +18 -22
- package/lib/device/TransportList.js +10 -5
- package/lib/device/checkFirmwareRevision.d.ts +3 -2
- package/lib/device/checkFirmwareRevision.js +6 -11
- package/lib/device/thp/handshake.d.ts +4 -0
- package/lib/device/thp/handshake.js +88 -0
- package/lib/device/thp/index.d.ts +4 -1
- package/lib/device/thp/index.js +24 -6
- package/lib/device/thp/pairing.d.ts +16 -0
- package/lib/device/thp/pairing.js +230 -0
- package/lib/device/thp/session.d.ts +3 -0
- package/lib/device/thp/session.js +27 -0
- package/lib/device/thp/thpCall.d.ts +41 -0
- package/lib/device/thp/thpCall.js +54 -0
- package/lib/device/workflow/checkFirmwareHash.d.ts +10 -0
- package/lib/device/workflow/checkFirmwareHash.js +79 -0
- package/lib/device/workflow/checkFirmwareHashWithRetries.d.ts +9 -0
- package/lib/device/workflow/checkFirmwareHashWithRetries.js +41 -0
- package/lib/device/workflow/handshake.js +7 -6
- package/lib/device/workflow/validateState.js +53 -10
- package/lib/events/ui-request.d.ts +1 -1
- package/lib/factory.js +4 -0
- package/lib/impl/core-in-module.js +3 -0
- package/lib/tsconfig.lib.tsbuildinfo +1 -1
- package/lib/types/api/bitcoin/index.d.ts +1 -1
- package/lib/types/api/cardano/index.d.ts +62 -1
- package/lib/types/api/cardano/index.js +30 -1
- package/lib/types/api/cardanoSignMessage.d.ts +4 -0
- package/lib/types/api/cardanoSignMessage.js +3 -0
- package/lib/types/api/discoverAccounts.d.ts +17 -12
- package/lib/types/api/ethereum/index.d.ts +108 -0
- package/lib/types/api/ethereum/index.js +3 -0
- package/lib/types/api/evoluGetNode.d.ts +4 -0
- package/lib/types/api/evoluGetNode.js +3 -0
- package/lib/types/api/index.d.ts +8 -0
- package/lib/types/api/pushTransaction.d.ts +4 -1
- package/lib/types/api/pushTransaction.js +7 -1
- package/lib/types/api/solana/index.d.ts +3 -0
- package/lib/types/api/solana/index.js +2 -0
- package/lib/types/api/thpGetCredentials.d.ts +4 -0
- package/lib/types/api/thpGetCredentials.js +3 -0
- package/lib/types/api/thpRemoveCredentials.d.ts +7 -0
- package/lib/types/api/thpRemoveCredentials.js +3 -0
- package/lib/types/device.d.ts +10 -10
- package/lib/types/firmware.d.ts +15 -12
- package/lib/types/firmware.js +0 -3
- package/lib/types/params.d.ts +1 -0
- package/lib/types/settings.d.ts +7 -0
- package/lib/utils/assetUtils.d.ts +5 -2
- package/lib/utils/assetUtils.js +14 -18
- package/lib/utils/assets.native.js +0 -2
- package/lib/utils/firmwareReleaseConfigUtils.d.ts +8 -5
- package/lib/utils/firmwareReleaseConfigUtils.js +53 -57
- package/lib/utils/firmwareUtils.d.ts +8 -4
- package/lib/utils/firmwareUtils.js +62 -20
- package/lib/utils/formatUtils.d.ts +1 -0
- package/lib/utils/formatUtils.js +3 -2
- package/package.json +16 -15
- package/lib/api/firmware/getBinaryForFirmwareUpgrade.d.ts +0 -12
- package/lib/api/firmware/getBinaryForFirmwareUpgrade.js +0 -32
- package/lib/data/getLanguage.d.ts +0 -6
- package/lib/data/getLanguage.js +0 -10
package/CHANGELOG.md
CHANGED
|
@@ -1,16 +1,30 @@
|
|
|
1
|
-
| Package | Stable |
|
|
2
|
-
| :------------------------------: | :----: |
|
|
3
|
-
| npm @trezor/connect | 9.6.2 |
|
|
4
|
-
| npm @trezor/connect-web | 9.6.2 |
|
|
5
|
-
| npm @trezor/connect-webextension | 9.6.2 |
|
|
6
|
-
| npm @trezor/connect-mobile | 9.6.2 |
|
|
1
|
+
| Package | Stable | Canary |
|
|
2
|
+
| :------------------------------: | :----: | :----------: |
|
|
3
|
+
| npm @trezor/connect | 9.6.2 | 9.6.3-beta.2 |
|
|
4
|
+
| npm @trezor/connect-web | 9.6.2 | 9.6.3-beta.2 |
|
|
5
|
+
| npm @trezor/connect-webextension | 9.6.2 | 9.6.3-beta.2 |
|
|
6
|
+
| npm @trezor/connect-mobile | 9.6.2 | 9.6.3-beta.2 |
|
|
7
7
|
|
|
8
|
-
| Deployment | Stable |
|
|
9
|
-
| :----------------: | :----: |
|
|
10
|
-
| connect.trezor.io/ | 9.6.2 |
|
|
8
|
+
| Deployment | Stable | Canary |
|
|
9
|
+
| :----------------: | :----: | :----------: |
|
|
10
|
+
| connect.trezor.io/ | 9.6.2 | 9.6.3-beta.2 |
|
|
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.3-beta.2
|
|
15
|
+
|
|
16
|
+
- feat(connect): trezor bridge pinging now runs in a worker to prevent spamming developer console
|
|
17
|
+
- chore(connect): stellar code is now wrapped in a worker in the same way other coins are wrapped
|
|
18
|
+
|
|
19
|
+
# 9.6.3-beta.1
|
|
20
|
+
|
|
21
|
+
We’ve added support for Cardano message signing based on the CIP-8 standard, available through the new cardanoSignMessage method.
|
|
22
|
+
|
|
23
|
+
- feat(connect-explorer): Add cardanoSignMessage (bc88818)
|
|
24
|
+
- feat(connect): Cardano message signing (01c4a0f)
|
|
25
|
+
|
|
26
|
+
Other than that only bug fixing, refactorings and chores are present.
|
|
27
|
+
|
|
14
28
|
# 9.6.2
|
|
15
29
|
|
|
16
30
|
This release is important for smooth support of 2.9.0 trezor firmware, namely commits:
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @trezor/connect
|
|
2
2
|
|
|
3
|
-
API version 9.6.2
|
|
3
|
+
API version 9.6.3-beta.2
|
|
4
4
|
|
|
5
5
|
[](https://github.com/trezor/trezor-suite/actions/workflows/test-connect.yml)
|
|
6
6
|
[](https://www.npmjs.org/package/@trezor/connect)
|
package/lib/api/applySettings.js
CHANGED
|
@@ -27,7 +27,22 @@ class ApplySettings extends AbstractMethod_1.AbstractMethod {
|
|
|
27
27
|
}
|
|
28
28
|
async run() {
|
|
29
29
|
const cmd = this.device.getCommands();
|
|
30
|
-
const
|
|
30
|
+
const homescreenBytes = this.params.homescreen
|
|
31
|
+
? Buffer.from(this.params.homescreen, 'hex')
|
|
32
|
+
: undefined;
|
|
33
|
+
if (this.device.atLeast('2.9.0') && homescreenBytes) {
|
|
34
|
+
this.params.homescreen = undefined;
|
|
35
|
+
this.params.homescreen_length = homescreenBytes.length;
|
|
36
|
+
}
|
|
37
|
+
let response = await cmd.typedCall('ApplySettings', ['DataChunkRequest', 'Success'], this.params);
|
|
38
|
+
while (response.type !== 'Success') {
|
|
39
|
+
const start = response.message.data_offset;
|
|
40
|
+
const end = start + response.message.data_length;
|
|
41
|
+
const data_chunk = homescreenBytes?.subarray(start, end).toString('hex') || '';
|
|
42
|
+
response = await cmd.typedCall('DataChunkAck', ['DataChunkRequest', 'Success'], {
|
|
43
|
+
data_chunk,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
31
46
|
return response.message;
|
|
32
47
|
}
|
|
33
48
|
}
|
|
@@ -8,7 +8,7 @@ export interface SignTxHelperProps {
|
|
|
8
8
|
refTxs: Record<string, RefTransaction>;
|
|
9
9
|
inputs: PROTO.TxInputType[];
|
|
10
10
|
outputs: PROTO.TxOutputType[];
|
|
11
|
-
paymentRequests: PROTO.
|
|
11
|
+
paymentRequests: PROTO.PaymentRequest[];
|
|
12
12
|
serializedTx: string[];
|
|
13
13
|
signatures: string[];
|
|
14
14
|
}
|
|
@@ -16,7 +16,7 @@ export interface SignTxHelperParams {
|
|
|
16
16
|
typedCall: TypedCall;
|
|
17
17
|
inputs: PROTO.TxInputType[];
|
|
18
18
|
outputs: PROTO.TxOutputType[];
|
|
19
|
-
paymentRequests?: PROTO.
|
|
19
|
+
paymentRequests?: PROTO.PaymentRequest[];
|
|
20
20
|
refTxs: RefTransaction[];
|
|
21
21
|
options: TransactionOptions;
|
|
22
22
|
coinInfo: BitcoinNetworkInfo;
|
|
@@ -88,7 +88,7 @@ const requestSignedTxInfo = ({ typedCall, txRequest: { request_type, details },
|
|
|
88
88
|
if (!req) {
|
|
89
89
|
throw constants_1.ERRORS.TypedError('Runtime', `requestPrevTxInfo: Requested unknown payment request at ${details.request_index}`);
|
|
90
90
|
}
|
|
91
|
-
return typedCall('
|
|
91
|
+
return typedCall('PaymentRequest', 'TxRequest', {
|
|
92
92
|
nonce: req.nonce,
|
|
93
93
|
recipient_name: req.recipient_name,
|
|
94
94
|
memos: req.memos,
|
package/lib/api/bleUnpair.js
CHANGED
|
@@ -9,7 +9,6 @@ class BleUnpair extends AbstractMethod_1.AbstractMethod {
|
|
|
9
9
|
init() {
|
|
10
10
|
this.allowDeviceMode = [events_1.UI.INITIALIZE, events_1.UI.SEEDLESS];
|
|
11
11
|
this.requiredPermissions = ['management'];
|
|
12
|
-
this.skipFinalReload = false;
|
|
13
12
|
this.useDeviceState = false;
|
|
14
13
|
this.skipFinalReload = true;
|
|
15
14
|
const { payload } = this;
|
|
@@ -18,6 +18,7 @@ export default class CardanoGetAddress extends AbstractMethod<'cardanoGetAddress
|
|
|
18
18
|
label: string;
|
|
19
19
|
} | undefined;
|
|
20
20
|
_call({ address_parameters, protocol_magic, network_id, derivation_type, show_display, chunkify, }: Params): Promise<{
|
|
21
|
+
mac?: string | undefined;
|
|
21
22
|
address: string;
|
|
22
23
|
}>;
|
|
23
24
|
run(): Promise<import("../../../types").CardanoAddress | import("../../../types").CardanoAddress[]>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { PROTO } from '../../../constants';
|
|
2
|
+
import { AbstractMethod } from '../../../core/AbstractMethod';
|
|
3
|
+
import { CardanoMessageHeaders, CardanoSignedMessage } from '../../../types/api/cardano';
|
|
4
|
+
import { Path } from '../cardanoInputs';
|
|
5
|
+
export type CardanoSignMessageParams = {
|
|
6
|
+
path: Path;
|
|
7
|
+
payload: string;
|
|
8
|
+
preferHexDisplay: boolean;
|
|
9
|
+
networkId?: number;
|
|
10
|
+
protocolMagic?: number;
|
|
11
|
+
addressParameters?: PROTO.CardanoAddressParametersType;
|
|
12
|
+
derivationType: PROTO.CardanoDerivationType;
|
|
13
|
+
};
|
|
14
|
+
export default class CardanoSignMessage extends AbstractMethod<'cardanoSignMessage', CardanoSignMessageParams> {
|
|
15
|
+
static readonly VERSION = 1;
|
|
16
|
+
init(): void;
|
|
17
|
+
run(): Promise<CardanoSignedMessage>;
|
|
18
|
+
_createHeaders(address: string): CardanoMessageHeaders;
|
|
19
|
+
_createCose(payload: string, signature: string, address: string, pubKey: string): {
|
|
20
|
+
coseSignature: string;
|
|
21
|
+
coseKey: string;
|
|
22
|
+
};
|
|
23
|
+
get info(): string;
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=cardanoSignMessage.d.ts.map
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const cbor = tslib_1.__importStar(require("cbor"));
|
|
5
|
+
const schema_utils_1 = require("@trezor/schema-utils");
|
|
6
|
+
const constants_1 = require("../../../constants");
|
|
7
|
+
const AbstractMethod_1 = require("../../../core/AbstractMethod");
|
|
8
|
+
const coinInfo_1 = require("../../../data/coinInfo");
|
|
9
|
+
const cardano_1 = require("../../../types/api/cardano");
|
|
10
|
+
const formatUtils_1 = require("../../../utils/formatUtils");
|
|
11
|
+
const pathUtils_1 = require("../../../utils/pathUtils");
|
|
12
|
+
const paramsValidator_1 = require("../../common/paramsValidator");
|
|
13
|
+
const cardanoAddressParameters_1 = require("../cardanoAddressParameters");
|
|
14
|
+
const cardanoUtils_1 = require("../cardanoUtils");
|
|
15
|
+
class CardanoSignMessage extends AbstractMethod_1.AbstractMethod {
|
|
16
|
+
static VERSION = 1;
|
|
17
|
+
init() {
|
|
18
|
+
this.requiredPermissions = ['read', 'write'];
|
|
19
|
+
this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, (0, coinInfo_1.getMiscNetwork)('Cardano'), this.firmwareRange);
|
|
20
|
+
const { payload } = this;
|
|
21
|
+
(0, schema_utils_1.Assert)(cardano_1.CardanoSignMessage, payload);
|
|
22
|
+
if (!(0, formatUtils_1.isHexString)(payload.payload) || (0, formatUtils_1.hasHexPrefix)(payload.payload)) {
|
|
23
|
+
throw constants_1.ERRORS.TypedError('Method_InvalidParameter', 'Message payload must be a hexadecimal string without a "0x" prefix.');
|
|
24
|
+
}
|
|
25
|
+
this.params = {
|
|
26
|
+
path: (0, pathUtils_1.validatePath)(payload.path, 5),
|
|
27
|
+
payload: payload.payload,
|
|
28
|
+
preferHexDisplay: payload.preferHexDisplay ?? false,
|
|
29
|
+
networkId: payload.networkId,
|
|
30
|
+
protocolMagic: payload.protocolMagic,
|
|
31
|
+
addressParameters: payload.addressParameters && (0, cardanoAddressParameters_1.addressParametersToProto)(payload.addressParameters),
|
|
32
|
+
derivationType: payload.derivationType ?? constants_1.PROTO.CardanoDerivationType.ICARUS_TREZOR,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
async run() {
|
|
36
|
+
const typedCall = this.device.getCommands().typedCall.bind(this.device.getCommands());
|
|
37
|
+
const payloadSize = (0, cardanoUtils_1.hexStringByteLength)(this.params.payload);
|
|
38
|
+
let response = await typedCall('CardanoSignMessageInit', ['CardanoMessageSignature', 'CardanoMessageDataRequest'], {
|
|
39
|
+
signing_path: this.params.path,
|
|
40
|
+
payload_size: payloadSize,
|
|
41
|
+
network_id: this.params.networkId,
|
|
42
|
+
protocol_magic: this.params.protocolMagic,
|
|
43
|
+
address_parameters: this.params.addressParameters,
|
|
44
|
+
prefer_hex_display: this.params.preferHexDisplay,
|
|
45
|
+
derivation_type: this.params.derivationType,
|
|
46
|
+
});
|
|
47
|
+
while (response.type !== 'CardanoMessageSignature') {
|
|
48
|
+
const { length, offset } = response.message;
|
|
49
|
+
const data = this.params.payload.slice(offset * 2, (offset + length) * 2);
|
|
50
|
+
response = await typedCall('CardanoMessageDataResponse', ['CardanoMessageSignature', 'CardanoMessageDataRequest'], { data });
|
|
51
|
+
}
|
|
52
|
+
const { signature, address, pub_key } = response.message;
|
|
53
|
+
return {
|
|
54
|
+
signature,
|
|
55
|
+
payload: this.params.payload,
|
|
56
|
+
headers: this._createHeaders(address),
|
|
57
|
+
pubKey: pub_key,
|
|
58
|
+
...this._createCose(this.params.payload, signature, address, pub_key),
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
_createHeaders(address) {
|
|
62
|
+
return {
|
|
63
|
+
protected: {
|
|
64
|
+
1: constants_1.CARDANO.ALGORITHM_IDS.EdDSA,
|
|
65
|
+
address,
|
|
66
|
+
},
|
|
67
|
+
unprotected: {
|
|
68
|
+
hashed: false,
|
|
69
|
+
version: CardanoSignMessage.VERSION,
|
|
70
|
+
},
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
_createCose(payload, signature, address, pubKey) {
|
|
74
|
+
const coseSignature = cbor.encode([
|
|
75
|
+
Buffer.from(cbor.encode(new Map()
|
|
76
|
+
.set(1, -8)
|
|
77
|
+
.set('address', Buffer.from(address, 'hex')))),
|
|
78
|
+
new Map().set('hashed', false),
|
|
79
|
+
Buffer.from(payload, 'hex'),
|
|
80
|
+
Buffer.from(signature, 'hex'),
|
|
81
|
+
]);
|
|
82
|
+
const coseKey = cbor.encode(new Map()
|
|
83
|
+
.set(1, 1)
|
|
84
|
+
.set(3, -8)
|
|
85
|
+
.set(-1, 6)
|
|
86
|
+
.set(-2, Buffer.from(pubKey, 'hex')));
|
|
87
|
+
return {
|
|
88
|
+
coseSignature: Buffer.from(coseSignature).toString('hex'),
|
|
89
|
+
coseKey: Buffer.from(coseKey).toString('hex'),
|
|
90
|
+
};
|
|
91
|
+
}
|
|
92
|
+
get info() {
|
|
93
|
+
return 'Sign Cardano message';
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
exports.default = CardanoSignMessage;
|
|
97
|
+
//# sourceMappingURL=cardanoSignMessage.js.map
|
|
@@ -3,4 +3,5 @@ export { default as cardanoGetNativeScriptHash } from './cardanoGetNativeScriptH
|
|
|
3
3
|
export { default as cardanoGetPublicKey } from './cardanoGetPublicKey';
|
|
4
4
|
export { default as cardanoSignTransaction } from './cardanoSignTransaction';
|
|
5
5
|
export { default as cardanoComposeTransaction } from './cardanoComposeTransaction';
|
|
6
|
+
export { default as cardanoSignMessage } from './cardanoSignMessage';
|
|
6
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.cardanoComposeTransaction = exports.cardanoSignTransaction = exports.cardanoGetPublicKey = exports.cardanoGetNativeScriptHash = exports.cardanoGetAddress = void 0;
|
|
3
|
+
exports.cardanoSignMessage = exports.cardanoComposeTransaction = exports.cardanoSignTransaction = exports.cardanoGetPublicKey = exports.cardanoGetNativeScriptHash = exports.cardanoGetAddress = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
var cardanoGetAddress_1 = require("./cardanoGetAddress");
|
|
6
6
|
Object.defineProperty(exports, "cardanoGetAddress", { enumerable: true, get: function () { return tslib_1.__importDefault(cardanoGetAddress_1).default; } });
|
|
@@ -12,4 +12,6 @@ var cardanoSignTransaction_1 = require("./cardanoSignTransaction");
|
|
|
12
12
|
Object.defineProperty(exports, "cardanoSignTransaction", { enumerable: true, get: function () { return tslib_1.__importDefault(cardanoSignTransaction_1).default; } });
|
|
13
13
|
var cardanoComposeTransaction_1 = require("./cardanoComposeTransaction");
|
|
14
14
|
Object.defineProperty(exports, "cardanoComposeTransaction", { enumerable: true, get: function () { return tslib_1.__importDefault(cardanoComposeTransaction_1).default; } });
|
|
15
|
+
var cardanoSignMessage_1 = require("./cardanoSignMessage");
|
|
16
|
+
Object.defineProperty(exports, "cardanoSignMessage", { enumerable: true, get: function () { return tslib_1.__importDefault(cardanoSignMessage_1).default; } });
|
|
15
17
|
//# sourceMappingURL=index.js.map
|
|
@@ -5,5 +5,5 @@ export declare const prepareCertificates: (certs: CardanoCertificate[]) => types
|
|
|
5
5
|
export declare const getTtl: (testnet: boolean) => number;
|
|
6
6
|
export declare const composeTxPlan: (descriptor: string, utxo: AccountUtxo[], outputs: types.UserOutput[], certificates: CardanoCertificate[], withdrawals: types.Withdrawal[], changeAddress: string, isTestnet: boolean, options?: types.Options) => types.PrecomposedTransaction;
|
|
7
7
|
export declare const hexStringByteLength: (s: string) => number;
|
|
8
|
-
export declare const sendChunkedHexString: (typedCall: any, data: string, chunkSize: number, messageType: string) => Promise<void>;
|
|
8
|
+
export declare const sendChunkedHexString: (typedCall: any, data: string, chunkSize: number, messageType: string, responseType?: string) => Promise<void>;
|
|
9
9
|
//# sourceMappingURL=cardanoUtils.d.ts.map
|
|
@@ -95,11 +95,11 @@ const composeTxPlan = (descriptor, utxo, outputs, certificates, withdrawals, cha
|
|
|
95
95
|
exports.composeTxPlan = composeTxPlan;
|
|
96
96
|
const hexStringByteLength = (s) => s.length / 2;
|
|
97
97
|
exports.hexStringByteLength = hexStringByteLength;
|
|
98
|
-
const sendChunkedHexString = async (typedCall, data, chunkSize, messageType) => {
|
|
98
|
+
const sendChunkedHexString = async (typedCall, data, chunkSize, messageType, responseType = 'CardanoTxItemAck') => {
|
|
99
99
|
let processedSize = 0;
|
|
100
100
|
while (processedSize < data.length) {
|
|
101
101
|
const chunk = data.slice(processedSize, processedSize + chunkSize);
|
|
102
|
-
await typedCall(messageType,
|
|
102
|
+
await typedCall(messageType, responseType, {
|
|
103
103
|
data: chunk,
|
|
104
104
|
});
|
|
105
105
|
processedSize += chunkSize;
|
|
@@ -17,6 +17,7 @@ const isCardano = (account) => account.symbol === 'ada' || account.symbol === 't
|
|
|
17
17
|
const isCardanoRequest = (request) => isCardano(request.account);
|
|
18
18
|
const isEvmLedger = (account, coinInfo) => coinInfo.type === 'ethereum' && account.type === 'ledger';
|
|
19
19
|
const getAccountTypeKey = ({ symbol, type }) => `${symbol}-${type}`;
|
|
20
|
+
const substituteBip43Path = (path, index) => path.replace('i', String(index));
|
|
20
21
|
class DiscoverAccounts extends AbstractMethod_1.AbstractMethod {
|
|
21
22
|
disposed = false;
|
|
22
23
|
init() {
|
|
@@ -25,29 +26,44 @@ class DiscoverAccounts extends AbstractMethod_1.AbstractMethod {
|
|
|
25
26
|
this.useDeviceState = true;
|
|
26
27
|
this.useUi = false;
|
|
27
28
|
const { payload } = this;
|
|
28
|
-
(0, paramsValidator_1.validateParams)(payload, [
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
(0, paramsValidator_1.validateParams)(payload, [
|
|
30
|
+
{ name: 'coins', type: 'array', required: true, allowEmpty: true },
|
|
31
|
+
]);
|
|
32
|
+
this.params = payload.coins.flatMap(coin => {
|
|
33
|
+
(0, paramsValidator_1.validateParams)(coin, [
|
|
31
34
|
{ name: 'symbol', type: 'string', required: true },
|
|
32
|
-
{ name: '
|
|
35
|
+
{ name: 'known', type: 'array', allowEmpty: true },
|
|
36
|
+
{ name: 'knownOnly', type: 'boolean' },
|
|
33
37
|
{ name: 'identity', type: 'string' },
|
|
34
38
|
{ name: 'details', type: 'string' },
|
|
35
39
|
{ name: 'pageSize', type: 'number' },
|
|
36
|
-
{ name: 'skip', type: 'number' },
|
|
37
40
|
]);
|
|
38
|
-
const { symbol,
|
|
39
|
-
const coinInfo = (0, coinInfo_1.getCoinInfo)(
|
|
41
|
+
const { symbol, known: knownAccs, knownOnly, ...rest } = coin;
|
|
42
|
+
const coinInfo = (0, coinInfo_1.getCoinInfo)(symbol);
|
|
40
43
|
if (!coinInfo) {
|
|
41
44
|
throw constants_1.ERRORS.TypedError('Method_UnknownCoin');
|
|
42
45
|
}
|
|
43
46
|
(0, BlockchainLink_1.isBackendSupported)(coinInfo);
|
|
44
47
|
const firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, coinInfo, AbstractMethod_1.DEFAULT_FIRMWARE_RANGE);
|
|
45
|
-
|
|
48
|
+
const symbolAccounts = discoverAccounts_1.ACCOUNT_TYPES.filter(a => a.symbol === symbol);
|
|
49
|
+
knownAccs?.forEach(account => {
|
|
50
|
+
(0, paramsValidator_1.validateParams)(account, [
|
|
51
|
+
{ name: 'type', type: 'string', required: true },
|
|
52
|
+
{ name: 'skip', type: 'number' },
|
|
53
|
+
]);
|
|
54
|
+
if (!symbolAccounts.some(a => a.type === account.type)) {
|
|
55
|
+
throw new Error(`Unknown account type: ${symbol}/${account.type}`);
|
|
56
|
+
}
|
|
57
|
+
});
|
|
58
|
+
return symbolAccounts
|
|
59
|
+
.map(account => [account, knownAccs?.find(t => t.type === account.type)])
|
|
60
|
+
.filter(([_, known]) => (known ? typeof known.skip === 'number' : !knownOnly))
|
|
61
|
+
.map(([account, known]) => ({
|
|
46
62
|
pageSize: TXS_PER_PAGE,
|
|
47
63
|
details: DETAILS,
|
|
48
64
|
coinInfo,
|
|
49
65
|
firmwareRange,
|
|
50
|
-
skip: 0,
|
|
66
|
+
skip: known?.skip ?? 0,
|
|
51
67
|
account,
|
|
52
68
|
...rest,
|
|
53
69
|
offset: isEvmLedger(account, coinInfo) ? 1 : 0,
|
|
@@ -61,18 +77,18 @@ class DiscoverAccounts extends AbstractMethod_1.AbstractMethod {
|
|
|
61
77
|
const key = getAccountTypeKey(account);
|
|
62
78
|
this.progress[key] = progress;
|
|
63
79
|
}
|
|
64
|
-
sendProgress(
|
|
80
|
+
sendProgress(response) {
|
|
65
81
|
const progress = Object.values(this.progress).reduce((sum, typeProgress) => sum + typeProgress, 0) /
|
|
66
82
|
(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
|
-
}));
|
|
83
|
+
this.postMessage((0, events_1.createUiMessage)(events_1.UI.BUNDLE_PROGRESS, { total: 100, progress: 100 * progress, response }));
|
|
72
84
|
}
|
|
73
85
|
async run() {
|
|
74
86
|
const [unsupported, supported] = this.filterUnsupportedAccounts(this.params);
|
|
75
|
-
unsupported.forEach(({ account: { path, ...rest }, error
|
|
87
|
+
unsupported.forEach(({ account: { path: bip43, ...rest }, error, coinInfo, skip, offset }) => {
|
|
88
|
+
const path = substituteBip43Path(bip43, skip + offset);
|
|
89
|
+
const backendType = coinInfo.blockchainLink?.type;
|
|
90
|
+
this.sendProgress({ ...rest, index: skip, failed: true, error, path, backendType });
|
|
91
|
+
});
|
|
76
92
|
const [cardanoAccounts, otherAccounts] = (0, utils_1.arrayPartition)(supported, isCardanoRequest);
|
|
77
93
|
const [_, filteredCardanoAccounts] = await this.filterCardanoDerivations(cardanoAccounts);
|
|
78
94
|
const accounts = [...otherAccounts, ...filteredCardanoAccounts];
|
|
@@ -104,12 +120,16 @@ class DiscoverAccounts extends AbstractMethod_1.AbstractMethod {
|
|
|
104
120
|
}), item => 'error' in item);
|
|
105
121
|
}
|
|
106
122
|
async filterCardanoDerivations(accounts) {
|
|
107
|
-
const
|
|
108
|
-
const
|
|
109
|
-
const
|
|
110
|
-
const
|
|
111
|
-
|
|
112
|
-
const
|
|
123
|
+
const legacyRequest = accounts.find(a => a.account.type === 'legacy');
|
|
124
|
+
const ledgerRequest = accounts.find(a => a.account.type === 'ledger');
|
|
125
|
+
const filterableRequest = legacyRequest ?? ledgerRequest;
|
|
126
|
+
const getDescriptor = (derivation) => filterableRequest &&
|
|
127
|
+
this.getDescriptor(filterableRequest.coinInfo, filterableRequest.account.path, discoverAccounts_1.CARDANO_DERIVATIONS[derivation], 0).then(({ descriptor }) => descriptor);
|
|
128
|
+
const normalDescriptor = await getDescriptor('normal');
|
|
129
|
+
const omitLegacy = legacyRequest && (await getDescriptor('legacy')) === normalDescriptor;
|
|
130
|
+
const omitLedger = ledgerRequest &&
|
|
131
|
+
(!legacyRequest || omitLegacy) &&
|
|
132
|
+
(await getDescriptor('ledger')) === normalDescriptor;
|
|
113
133
|
return (0, utils_1.arrayPartition)(accounts.map(item => (item.account.type === 'legacy' && omitLegacy) ||
|
|
114
134
|
(item.account.type === 'ledger' && omitLedger)
|
|
115
135
|
? { ...item, error: 'ignored cardano derivation' }
|
|
@@ -118,7 +138,7 @@ class DiscoverAccounts extends AbstractMethod_1.AbstractMethod {
|
|
|
118
138
|
descriptorLock = (0, utils_1.getSynchronize)();
|
|
119
139
|
descriptorCache = {};
|
|
120
140
|
async getDescriptor(coinInfo, bip43PathTemplate, derivationType, index) {
|
|
121
|
-
const path = bip43PathTemplate
|
|
141
|
+
const path = substituteBip43Path(bip43PathTemplate, index);
|
|
122
142
|
const { address_n: _, ...descriptorRest } = await this.descriptorLock(async () => {
|
|
123
143
|
const key = `${path}-${derivationType}`;
|
|
124
144
|
if (!this.descriptorCache[key]) {
|
|
@@ -133,23 +153,28 @@ class DiscoverAccounts extends AbstractMethod_1.AbstractMethod {
|
|
|
133
153
|
}
|
|
134
154
|
async discoverAccount(request) {
|
|
135
155
|
const { details, identity, pageSize, coinInfo, derivation, offset, skip } = request;
|
|
136
|
-
const { path, ...accountKey } = request.account;
|
|
156
|
+
const { path: bip43, ...accountKey } = request.account;
|
|
157
|
+
const backendType = coinInfo.blockchainLink?.type;
|
|
137
158
|
const utxoRequired = (0, accountUtils_1.isUtxoBased)(coinInfo) && details && details !== 'basic';
|
|
138
159
|
let index = skip;
|
|
139
160
|
let blockchain;
|
|
140
161
|
try {
|
|
141
162
|
blockchain = await (0, BlockchainLink_1.initBlockchain)(coinInfo, this.postMessage, identity);
|
|
142
163
|
}
|
|
143
|
-
catch (
|
|
164
|
+
catch (err) {
|
|
165
|
+
const path = substituteBip43Path(bip43, offset + index);
|
|
144
166
|
this.updateProgress(accountKey, index + 1, true);
|
|
145
|
-
|
|
146
|
-
|
|
167
|
+
const error = err.message;
|
|
168
|
+
this.sendProgress({ ...accountKey, index, failed: true, error, path, backendType });
|
|
169
|
+
return { nonempty: 0, error };
|
|
147
170
|
}
|
|
148
|
-
let descPromise = this.getDescriptor(coinInfo,
|
|
171
|
+
let descPromise = this.getDescriptor(coinInfo, bip43, derivation, offset + index);
|
|
172
|
+
descPromise.catch(() => { });
|
|
149
173
|
while (true) {
|
|
150
174
|
try {
|
|
151
175
|
const { descriptor, ...descRest } = await descPromise;
|
|
152
|
-
descPromise = this.getDescriptor(coinInfo,
|
|
176
|
+
descPromise = this.getDescriptor(coinInfo, bip43, derivation, offset + index + 1);
|
|
177
|
+
descPromise.catch(() => { });
|
|
153
178
|
const info = await blockchain.getAccountInfo({ descriptor, details, pageSize });
|
|
154
179
|
const utxo = !utxoRequired
|
|
155
180
|
? undefined
|
|
@@ -164,17 +189,20 @@ class DiscoverAccounts extends AbstractMethod_1.AbstractMethod {
|
|
|
164
189
|
utxo,
|
|
165
190
|
...accountKey,
|
|
166
191
|
index,
|
|
167
|
-
backendType
|
|
192
|
+
backendType,
|
|
193
|
+
failed: false,
|
|
168
194
|
});
|
|
169
195
|
if (info.empty) {
|
|
170
196
|
await descPromise.catch(() => { });
|
|
171
197
|
return { nonempty: index - skip };
|
|
172
198
|
}
|
|
173
199
|
}
|
|
174
|
-
catch (
|
|
175
|
-
|
|
200
|
+
catch (err) {
|
|
201
|
+
const path = substituteBip43Path(bip43, offset + index);
|
|
202
|
+
const { message: error, code } = err;
|
|
203
|
+
const failed = true;
|
|
176
204
|
this.updateProgress(accountKey, index + 1, true);
|
|
177
|
-
this.sendProgress({ ...accountKey, index,
|
|
205
|
+
this.sendProgress({ ...accountKey, index, failed, error, code, path, backendType });
|
|
178
206
|
return { nonempty: index - skip, error };
|
|
179
207
|
}
|
|
180
208
|
index++;
|
|
@@ -32,10 +32,28 @@ class EthereumSignTransaction extends AbstractMethod_1.AbstractMethod {
|
|
|
32
32
|
const isEIP1559 = typeof tx.maxFeePerGas === 'string' && typeof tx.maxPriorityFeePerGas === 'string';
|
|
33
33
|
this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(isEIP1559 ? 'eip1559' : this.name, network, this.firmwareRange);
|
|
34
34
|
if (isEIP1559) {
|
|
35
|
-
this.params = {
|
|
35
|
+
this.params = {
|
|
36
|
+
path,
|
|
37
|
+
network,
|
|
38
|
+
type: 'eip1559',
|
|
39
|
+
tx: {
|
|
40
|
+
...strip(tx),
|
|
41
|
+
payment_req: tx.payment_req,
|
|
42
|
+
},
|
|
43
|
+
chunkify,
|
|
44
|
+
};
|
|
36
45
|
}
|
|
37
46
|
else {
|
|
38
|
-
this.params = {
|
|
47
|
+
this.params = {
|
|
48
|
+
path,
|
|
49
|
+
network,
|
|
50
|
+
type: 'legacy',
|
|
51
|
+
tx: {
|
|
52
|
+
...strip(tx),
|
|
53
|
+
payment_req: tx.payment_req,
|
|
54
|
+
},
|
|
55
|
+
chunkify,
|
|
56
|
+
};
|
|
39
57
|
}
|
|
40
58
|
if (typeof tx.chainId !== 'number') {
|
|
41
59
|
console.warn('TrezorConnect.ethereumSignTransaction: Missing chainId parameter!');
|
|
@@ -129,8 +147,8 @@ class EthereumSignTransaction extends AbstractMethod_1.AbstractMethod {
|
|
|
129
147
|
const { type, tx, definitions, chunkify } = this.params;
|
|
130
148
|
const isLegacy = type === 'legacy';
|
|
131
149
|
const signature = isLegacy
|
|
132
|
-
? await helper.ethereumSignTx(this.device.getCommands().typedCall, this.params.path, tx.to, tx.value, tx.gasLimit, tx.gasPrice, tx.nonce, tx.chainId, chunkify, tx.data, tx.txType, definitions)
|
|
133
|
-
: await helper.ethereumSignTxEIP1559(this.device.getCommands().typedCall, this.params.path, tx.to, tx.value, tx.gasLimit, tx.maxFeePerGas, tx.maxPriorityFeePerGas, tx.nonce, tx.chainId, chunkify, tx.data, tx.accessList, definitions);
|
|
150
|
+
? await helper.ethereumSignTx(this.device.getCommands().typedCall, this.params.path, tx.to, tx.value, tx.gasLimit, tx.gasPrice, tx.nonce, tx.chainId, chunkify, tx.data, tx.txType, definitions, tx.payment_req)
|
|
151
|
+
: await helper.ethereumSignTxEIP1559(this.device.getCommands().typedCall, this.params.path, tx.to, tx.value, tx.gasLimit, tx.maxFeePerGas, tx.maxPriorityFeePerGas, tx.nonce, tx.chainId, chunkify, tx.data, tx.accessList, definitions, tx.payment_req);
|
|
134
152
|
const serializedTx = helper.serializeEthereumTx(tx, signature, isLegacy);
|
|
135
153
|
return { ...signature, serializedTx };
|
|
136
154
|
}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { Common } from '@ethereumjs/common';
|
|
2
2
|
import { MessagesSchema } from '@trezor/protobuf';
|
|
3
|
+
import { PROTO } from '../../constants';
|
|
3
4
|
import type { TypedCall } from '../../device/DeviceCommands';
|
|
4
5
|
import type { EthereumAccessList, EthereumTransaction, EthereumTransactionEIP1559 } from '../../types/api/ethereum';
|
|
5
6
|
export declare const getCommonForChain: (chainId: number) => Common;
|
|
@@ -8,12 +9,12 @@ export declare const serializeEthereumTx: (tx: EthereumTransactionEIP1559 | Ethe
|
|
|
8
9
|
r: `0x${string}`;
|
|
9
10
|
s: `0x${string}`;
|
|
10
11
|
}, isLegacy: boolean) => string;
|
|
11
|
-
export declare const ethereumSignTx: (typedCall: TypedCall, address_n: number[], to: string | null, value: string, gas_limit: string, gas_price: string, nonce: string, chain_id: number, chunkify: boolean, data?: string, tx_type?: number, definitions?: MessagesSchema.EthereumDefinitions) => Promise<{
|
|
12
|
+
export declare const ethereumSignTx: (typedCall: TypedCall, address_n: number[], to: string | null, value: string, gas_limit: string, gas_price: string, nonce: string, chain_id: number, chunkify: boolean, data?: string, tx_type?: number, definitions?: MessagesSchema.EthereumDefinitions, payment_req?: PROTO.PaymentRequest) => Promise<{
|
|
12
13
|
v: `0x${string}`;
|
|
13
14
|
r: `0x${string}`;
|
|
14
15
|
s: `0x${string}`;
|
|
15
16
|
}>;
|
|
16
|
-
export declare const ethereumSignTxEIP1559: (typedCall: TypedCall, address_n: number[], to: string | null, value: string, gas_limit: string, max_gas_fee: string, max_priority_fee: string, nonce: string, chain_id: number, chunkify: boolean, data?: string, access_list?: EthereumAccessList[], definitions?: MessagesSchema.EthereumDefinitions) => Promise<{
|
|
17
|
+
export declare const ethereumSignTxEIP1559: (typedCall: TypedCall, address_n: number[], to: string | null, value: string, gas_limit: string, max_gas_fee: string, max_priority_fee: string, nonce: string, chain_id: number, chunkify: boolean, data?: string, access_list?: EthereumAccessList[], definitions?: MessagesSchema.EthereumDefinitions, payment_req?: PROTO.PaymentRequest) => Promise<{
|
|
17
18
|
v: `0x${string}`;
|
|
18
19
|
r: `0x${string}`;
|
|
19
20
|
s: `0x${string}`;
|
|
@@ -76,7 +76,7 @@ const stripLeadingZeroes = (str) => {
|
|
|
76
76
|
}
|
|
77
77
|
return str;
|
|
78
78
|
};
|
|
79
|
-
const ethereumSignTx = async (typedCall, address_n, to, value, gas_limit, gas_price, nonce, chain_id, chunkify, data, tx_type, definitions) => {
|
|
79
|
+
const ethereumSignTx = async (typedCall, address_n, to, value, gas_limit, gas_price, nonce, chain_id, chunkify, data, tx_type, definitions, payment_req) => {
|
|
80
80
|
const length = data == null ? 0 : data.length / 2;
|
|
81
81
|
const [first, rest] = splitString(data, 1024 * 2);
|
|
82
82
|
let message = {
|
|
@@ -89,6 +89,7 @@ const ethereumSignTx = async (typedCall, address_n, to, value, gas_limit, gas_pr
|
|
|
89
89
|
value: stripLeadingZeroes(value),
|
|
90
90
|
definitions,
|
|
91
91
|
chunkify,
|
|
92
|
+
payment_req,
|
|
92
93
|
};
|
|
93
94
|
if (length !== 0) {
|
|
94
95
|
message = {
|
|
@@ -107,7 +108,7 @@ const ethereumSignTx = async (typedCall, address_n, to, value, gas_limit, gas_pr
|
|
|
107
108
|
return processTxRequest(typedCall, response.message, rest, chain_id);
|
|
108
109
|
};
|
|
109
110
|
exports.ethereumSignTx = ethereumSignTx;
|
|
110
|
-
const ethereumSignTxEIP1559 = async (typedCall, address_n, to, value, gas_limit, max_gas_fee, max_priority_fee, nonce, chain_id, chunkify, data, access_list, definitions) => {
|
|
111
|
+
const ethereumSignTxEIP1559 = async (typedCall, address_n, to, value, gas_limit, max_gas_fee, max_priority_fee, nonce, chain_id, chunkify, data, access_list, definitions, payment_req) => {
|
|
111
112
|
const length = data == null ? 0 : data.length / 2;
|
|
112
113
|
const [first, rest] = splitString(data, 1024 * 2);
|
|
113
114
|
const message = {
|
|
@@ -127,6 +128,7 @@ const ethereumSignTxEIP1559 = async (typedCall, address_n, to, value, gas_limit,
|
|
|
127
128
|
})),
|
|
128
129
|
definitions,
|
|
129
130
|
chunkify,
|
|
131
|
+
payment_req,
|
|
130
132
|
};
|
|
131
133
|
const response = await typedCall('EthereumSignTxEIP1559', 'EthereumTxRequest', message);
|
|
132
134
|
return processTxRequest(typedCall, response.message, rest);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { PROTO } from '../constants';
|
|
2
|
+
import { AbstractMethod } from '../core/AbstractMethod';
|
|
3
|
+
export default class EvoluGetNode extends AbstractMethod<'evoluGetNode', PROTO.EvoluGetNode> {
|
|
4
|
+
hasBundle?: boolean;
|
|
5
|
+
init(): void;
|
|
6
|
+
get info(): string;
|
|
7
|
+
run(): Promise<{
|
|
8
|
+
data: string;
|
|
9
|
+
}>;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=evoluGetNode.d.ts.map
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const schema_utils_1 = require("@trezor/schema-utils");
|
|
4
|
+
const constants_1 = require("../constants");
|
|
5
|
+
const AbstractMethod_1 = require("../core/AbstractMethod");
|
|
6
|
+
const paramsValidator_1 = require("./common/paramsValidator");
|
|
7
|
+
class EvoluGetNode extends AbstractMethod_1.AbstractMethod {
|
|
8
|
+
hasBundle;
|
|
9
|
+
init() {
|
|
10
|
+
this.requiredPermissions = ['read'];
|
|
11
|
+
this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, null, this.firmwareRange);
|
|
12
|
+
const { payload } = this;
|
|
13
|
+
(0, schema_utils_1.Assert)(constants_1.PROTO.EvoluGetNode, payload);
|
|
14
|
+
this.params = {};
|
|
15
|
+
}
|
|
16
|
+
get info() {
|
|
17
|
+
return 'Evolu get node';
|
|
18
|
+
}
|
|
19
|
+
async run() {
|
|
20
|
+
const cmd = this.device.getCommands();
|
|
21
|
+
const response = await cmd.typedCall('EvoluGetNode', 'EvoluNode', this.params);
|
|
22
|
+
return response.message;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
exports.default = EvoluGetNode;
|
|
26
|
+
//# sourceMappingURL=evoluGetNode.js.map
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
|
|
1
|
+
import { DeviceModelInternal } from '@trezor/device-utils';
|
|
2
|
+
export declare const calculateFirmwareHash: (internal_model: DeviceModelInternal, fw: ArrayBuffer, key?: Buffer) => {
|
|
2
3
|
hash: string;
|
|
3
4
|
challenge: string;
|
|
4
5
|
};
|