@trezor/connect 9.0.0-beta.3 → 9.0.0-beta.6
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/README.md +11 -1
- package/lib/api/binance/binanceSignTx.d.ts +1 -1
- package/lib/api/binanceSignTransaction.d.ts +1 -1
- package/lib/api/bitcoin/enhanceSignTx.d.ts +1 -1
- package/lib/api/bitcoin/refTx.d.ts +1 -1
- package/lib/api/bitcoin/signtx.d.ts +1 -1
- package/lib/api/bitcoin/signtxLegacy.d.ts +1 -1
- package/lib/api/cardano/cardanoAddressParameters.d.ts +1 -1
- package/lib/api/cardano/cardanoAuxiliaryData.d.ts +1 -1
- package/lib/api/cardano/cardanoCertificate.d.ts +1 -1
- package/lib/api/cardano/cardanoInputs.d.ts +1 -0
- package/lib/api/cardano/cardanoInputs.js +12 -1
- package/lib/api/cardano/cardanoOutputs.d.ts +6 -3
- package/lib/api/cardano/cardanoOutputs.js +37 -1
- package/lib/api/cardano/cardanoTokenBundle.d.ts +1 -1
- package/lib/api/cardano/cardanoUtils.d.ts +3 -0
- package/lib/api/cardano/cardanoUtils.js +17 -0
- package/lib/api/cardano/cardanoWitnesses.js +4 -4
- package/lib/api/cardanoGetAddress.d.ts +1 -1
- package/lib/api/cardanoGetNativeScriptHash.d.ts +1 -1
- package/lib/api/cardanoGetPublicKey.d.ts +1 -1
- package/lib/api/cardanoSignTransaction.d.ts +8 -4
- package/lib/api/cardanoSignTransaction.js +40 -17
- package/lib/api/composeTransaction.d.ts +1 -1
- package/lib/api/eos/eosSignTx.d.ts +1 -1
- package/lib/api/eosGetPublicKey.d.ts +1 -1
- package/lib/api/ethereum/ethereumSignTx.d.ts +1 -1
- package/lib/api/ethereum/ethereumSignTypedData.d.ts +1 -1
- package/lib/api/ethereumSignTransaction.d.ts +1 -1
- package/lib/api/ethereumSignTypedData.d.ts +1 -1
- package/lib/api/firmware/calculateFirmwareHash.d.ts +6 -0
- package/lib/api/firmware/calculateFirmwareHash.js +26 -0
- package/lib/api/firmware/getBinary.d.ts +2 -2
- package/lib/api/firmware/getBinary.js +2 -3
- package/lib/api/firmware/index.d.ts +5 -0
- package/lib/api/firmware/index.js +13 -0
- package/lib/api/firmware/modifyFirmware.d.ts +3 -5
- package/lib/api/firmware/modifyFirmware.js +12 -10
- package/lib/api/{management → firmware}/uploadFirmware.d.ts +0 -0
- package/lib/api/{management → firmware}/uploadFirmware.js +0 -0
- package/lib/api/firmwareUpdate.d.ts +4 -1
- package/lib/api/firmwareUpdate.js +8 -13
- package/lib/api/getFirmwareHash.d.ts +7 -0
- package/lib/api/getFirmwareHash.js +29 -0
- package/lib/api/index.d.ts +1 -0
- package/lib/api/index.js +4 -2
- package/lib/api/nem/nemSignTx.d.ts +1 -1
- package/lib/api/signTransaction.d.ts +2 -2
- package/lib/api/stellar/stellarSignTx.d.ts +1 -1
- package/lib/api/stellarSignTransaction.d.ts +1 -1
- package/lib/api/tezos/tezosSignTx.d.ts +1 -1
- package/lib/constants/errors.js +1 -1
- package/lib/core/index.d.ts +1 -1
- package/lib/core/method.d.ts +1 -1
- package/lib/data/firmwareInfo.js +0 -9
- package/lib/data/version.d.ts +1 -1
- package/lib/data/version.js +1 -1
- package/lib/device/DeviceList.js +3 -1
- package/lib/factory.js +1 -0
- package/lib/types/api/binance/index.d.ts +29 -0
- package/lib/types/api/binance/index.js +3 -0
- package/lib/types/api/binanceSignTransaction.d.ts +1 -27
- package/lib/types/api/bitcoin/index.d.ts +82 -0
- package/lib/types/api/bitcoin/index.js +3 -0
- package/lib/types/api/cardano/index.d.ts +193 -0
- package/lib/types/api/cardano/index.js +3 -0
- package/lib/types/api/cardanoGetAddress.d.ts +1 -31
- package/lib/types/api/cardanoGetNativeScriptHash.d.ts +1 -18
- package/lib/types/api/cardanoGetPublicKey.d.ts +1 -12
- package/lib/types/api/cardanoSignTransaction.d.ts +1 -127
- package/lib/types/api/eos/index.d.ts +119 -0
- package/lib/types/api/eos/index.js +3 -0
- package/lib/types/api/eosGetPublicKey.d.ts +1 -10
- package/lib/types/api/eosSignTransaction.d.ts +1 -107
- package/lib/types/api/ethereum/index.d.ts +86 -0
- package/lib/types/api/ethereum/index.js +3 -0
- package/lib/types/api/ethereumSignMessage.d.ts +1 -5
- package/lib/types/api/ethereumSignTransaction.d.ts +1 -37
- package/lib/types/api/ethereumSignTypedData.d.ts +1 -37
- package/lib/types/api/ethereumVerifyMessage.d.ts +1 -6
- package/lib/types/api/firmwareUpdate.d.ts +6 -3
- package/lib/types/api/getFirmwareHash.d.ts +4 -0
- package/lib/types/api/getFirmwareHash.js +3 -0
- package/lib/types/api/index.d.ts +2 -0
- package/lib/types/api/nem/index.d.ts +90 -0
- package/lib/types/api/nem/index.js +3 -0
- package/lib/types/api/nemSignTransaction.d.ts +2 -89
- package/lib/types/api/ripple/index.d.ts +21 -0
- package/lib/types/api/ripple/index.js +3 -0
- package/lib/types/api/rippleSignTransaction.d.ts +1 -20
- package/lib/types/api/signMessage.d.ts +1 -7
- package/lib/types/api/signTransaction.d.ts +1 -67
- package/lib/types/api/stellar/index.d.ts +180 -0
- package/lib/types/api/stellar/index.js +3 -0
- package/lib/types/api/stellarSignTransaction.d.ts +1 -179
- package/lib/types/api/tezos/index.d.ts +58 -0
- package/lib/types/api/tezos/index.js +3 -0
- package/lib/types/api/tezosSignTransaction.d.ts +1 -57
- package/lib/types/api/verifyMessage.d.ts +1 -7
- package/lib/types/index.d.ts +8 -4
- package/lib/types/index.js +8 -0
- package/lib/utils/assetUtils.d.ts +2 -0
- package/lib/utils/assetUtils.js +22 -0
- package/lib/utils/assets-native.d.ts +2 -0
- package/lib/utils/assets-native.js +7 -0
- package/lib/utils/assets.js +5 -13
- package/lib/utils/deviceFeaturesUtils.js +1 -1
- package/package.json +7 -4
- package/CHANGELOG.md +0 -26
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
export declare const
|
|
3
|
-
|
|
4
|
-
features: StrictFeatures;
|
|
5
|
-
}) => ArrayBuffer;
|
|
1
|
+
import type { Features } from '../../types';
|
|
2
|
+
export declare const shouldStripFwHeaders: (features: Features) => boolean;
|
|
3
|
+
export declare const stripFwHeaders: (fw: ArrayBuffer) => ArrayBuffer;
|
|
6
4
|
//# sourceMappingURL=modifyFirmware.d.ts.map
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.stripFwHeaders = exports.shouldStripFwHeaders = void 0;
|
|
4
4
|
const utils_1 = require("@trezor/utils");
|
|
5
|
-
const
|
|
5
|
+
const shouldStripFwHeaders = (features) => {
|
|
6
6
|
if (features.major_version === 2)
|
|
7
|
-
return
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
7
|
+
return false;
|
|
8
|
+
return utils_1.versionUtils.isNewerOrEqual([features.major_version, features.minor_version, features.patch_version], [1, 8, 0]);
|
|
9
|
+
};
|
|
10
|
+
exports.shouldStripFwHeaders = shouldStripFwHeaders;
|
|
11
|
+
const stripFwHeaders = (fw) => {
|
|
12
|
+
const fwView = new Uint8Array(fw);
|
|
13
|
+
if (String.fromCharCode(...Array.from(fwView.slice(0, 4))) === 'TRZR' &&
|
|
14
|
+
String.fromCharCode(...Array.from(fwView.slice(256, 260))) === 'TRZF') {
|
|
15
|
+
return fw.slice(256);
|
|
14
16
|
}
|
|
15
17
|
return fw;
|
|
16
18
|
};
|
|
17
|
-
exports.
|
|
19
|
+
exports.stripFwHeaders = stripFwHeaders;
|
|
18
20
|
//# sourceMappingURL=modifyFirmware.js.map
|
|
File without changes
|
|
File without changes
|
|
@@ -9,7 +9,10 @@ declare type Params = {
|
|
|
9
9
|
export default class FirmwareUpdate extends AbstractMethod<'firmwareUpdate', Params> {
|
|
10
10
|
init(): void;
|
|
11
11
|
confirmation(): Promise<boolean>;
|
|
12
|
-
run(): Promise<
|
|
12
|
+
run(): Promise<{
|
|
13
|
+
hash: string;
|
|
14
|
+
challenge: string;
|
|
15
|
+
}>;
|
|
13
16
|
}
|
|
14
17
|
export {};
|
|
15
18
|
//# sourceMappingURL=firmwareUpdate.d.ts.map
|
|
@@ -1,14 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
4
|
-
const
|
|
3
|
+
const tslib_1 = require("tslib");
|
|
4
|
+
const randombytes_1 = (0, tslib_1.__importDefault)(require("randombytes"));
|
|
5
5
|
const AbstractMethod_1 = require("../core/AbstractMethod");
|
|
6
6
|
const constants_1 = require("../constants");
|
|
7
7
|
const events_1 = require("../events");
|
|
8
|
-
const
|
|
8
|
+
const firmware_1 = require("./firmware");
|
|
9
9
|
const paramsValidator_1 = require("./common/paramsValidator");
|
|
10
10
|
const firmwareInfo_1 = require("../data/firmwareInfo");
|
|
11
|
-
const firmwareUtils_1 = require("../utils/firmwareUtils");
|
|
12
11
|
class FirmwareUpdate extends AbstractMethod_1.AbstractMethod {
|
|
13
12
|
init() {
|
|
14
13
|
this.useEmptyPassphrase = true;
|
|
@@ -59,16 +58,10 @@ class FirmwareUpdate extends AbstractMethod_1.AbstractMethod {
|
|
|
59
58
|
let binary;
|
|
60
59
|
try {
|
|
61
60
|
if (params.binary) {
|
|
62
|
-
|
|
63
|
-
throw new Error('Features of unexpected shape provided');
|
|
64
|
-
}
|
|
65
|
-
binary = (0, modifyFirmware_1.modifyFirmware)({
|
|
66
|
-
fw: params.binary,
|
|
67
|
-
features: device.features,
|
|
68
|
-
});
|
|
61
|
+
binary = params.binary;
|
|
69
62
|
}
|
|
70
63
|
else {
|
|
71
|
-
const firmware = await (0,
|
|
64
|
+
const firmware = await (0, firmware_1.getBinary)({
|
|
72
65
|
features: device.features,
|
|
73
66
|
releases: (0, firmwareInfo_1.getReleases)(device.features.major_version),
|
|
74
67
|
version: params.version,
|
|
@@ -82,7 +75,9 @@ class FirmwareUpdate extends AbstractMethod_1.AbstractMethod {
|
|
|
82
75
|
catch (err) {
|
|
83
76
|
throw constants_1.ERRORS.TypedError('Method_FirmwareUpdate_DownloadFailed', 'Failed to download firmware binary');
|
|
84
77
|
}
|
|
85
|
-
|
|
78
|
+
const stripped = (0, firmware_1.stripFwHeaders)(binary);
|
|
79
|
+
await (0, firmware_1.uploadFirmware)(this.device.getCommands().typedCall.bind(this.device.getCommands()), this.postMessage, device, { payload: (0, firmware_1.shouldStripFwHeaders)(device.features) ? stripped : binary });
|
|
80
|
+
return (0, firmware_1.calculateFirmwareHash)(device.features.major_version, stripped, (0, randombytes_1.default)(32));
|
|
86
81
|
}
|
|
87
82
|
}
|
|
88
83
|
exports.default = FirmwareUpdate;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { AbstractMethod } from '../core/AbstractMethod';
|
|
2
|
+
import { PROTO } from '../constants';
|
|
3
|
+
export default class GetFirmwareHash extends AbstractMethod<'getFirmwareHash', PROTO.GetFirmwareHash> {
|
|
4
|
+
init(): void;
|
|
5
|
+
run(): Promise<PROTO.FirmwareHash>;
|
|
6
|
+
}
|
|
7
|
+
//# sourceMappingURL=getFirmwareHash.d.ts.map
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const AbstractMethod_1 = require("../core/AbstractMethod");
|
|
4
|
+
const events_1 = require("../events");
|
|
5
|
+
const paramsValidator_1 = require("./common/paramsValidator");
|
|
6
|
+
class GetFirmwareHash extends AbstractMethod_1.AbstractMethod {
|
|
7
|
+
init() {
|
|
8
|
+
this.requiredPermissions = ['management'];
|
|
9
|
+
this.useEmptyPassphrase = true;
|
|
10
|
+
this.useDeviceState = false;
|
|
11
|
+
this.allowDeviceMode = [events_1.UI.INITIALIZE];
|
|
12
|
+
const { payload } = this;
|
|
13
|
+
(0, paramsValidator_1.validateParams)(payload, [{ name: 'challenge', type: 'string' }]);
|
|
14
|
+
this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, null, {
|
|
15
|
+
1: { min: '1.11.1', max: '0' },
|
|
16
|
+
2: { min: '2.5.1', max: '0' },
|
|
17
|
+
});
|
|
18
|
+
this.params = {
|
|
19
|
+
challenge: payload.challenge,
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
async run() {
|
|
23
|
+
const cmd = this.device.getCommands();
|
|
24
|
+
const response = await cmd.typedCall('GetFirmwareHash', 'FirmwareHash', this.params);
|
|
25
|
+
return response.message;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
exports.default = GetFirmwareHash;
|
|
29
|
+
//# sourceMappingURL=getFirmwareHash.js.map
|
package/lib/api/index.d.ts
CHANGED
|
@@ -38,6 +38,7 @@ export { default as getAddress } from './getAddress';
|
|
|
38
38
|
export { default as getCoinInfo } from './getCoinInfo';
|
|
39
39
|
export { default as getDeviceState } from './getDeviceState';
|
|
40
40
|
export { default as getFeatures } from './getFeatures';
|
|
41
|
+
export { default as getFirmwareHash } from './getFirmwareHash';
|
|
41
42
|
export { default as getOwnershipId } from './getOwnershipId';
|
|
42
43
|
export { default as getOwnershipProof } from './getOwnershipProof';
|
|
43
44
|
export { default as getPublicKey } from './getPublicKey';
|
package/lib/api/index.js
CHANGED
|
@@ -3,8 +3,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
7
|
-
exports.wipeDevice = exports.verifyMessage = exports.tezosSignTransaction = exports.tezosGetPublicKey = exports.tezosGetAddress = exports.stellarSignTransaction = exports.stellarGetAddress = exports.signTransaction = exports.signMessage = exports.setProxy = exports.rippleSignTransaction = exports.rippleGetAddress = exports.resetDevice = void 0;
|
|
6
|
+
exports.recoveryDevice = exports.rebootToBootloader = exports.pushTransaction = exports.nemSignTransaction = exports.nemGetAddress = exports.getSettings = exports.getPublicKey = exports.getOwnershipProof = exports.getOwnershipId = exports.getFirmwareHash = exports.getFeatures = exports.getDeviceState = exports.getCoinInfo = exports.getAddress = exports.getAccountInfo = exports.firmwareUpdate = exports.ethereumVerifyMessage = exports.ethereumSignTypedData = exports.ethereumSignTransaction = exports.ethereumSignMessage = exports.ethereumGetPublicKey = exports.ethereumGetAddress = exports.eosSignTransaction = exports.eosGetPublicKey = exports.customMessage = exports.composeTransaction = exports.cipherKeyValue = exports.changePin = exports.cardanoSignTransaction = exports.cardanoGetPublicKey = exports.cardanoGetNativeScriptHash = exports.cardanoGetAddress = exports.blockchainUnsubscribeFiatRates = exports.blockchainUnsubscribe = exports.blockchainSubscribeFiatRates = exports.blockchainSubscribe = exports.blockchainSetCustomBackend = exports.blockchainGetTransactions = exports.blockchainGetFiatRatesForTimestamps = exports.blockchainGetCurrentFiatRates = exports.blockchainGetAccountBalanceHistory = exports.blockchainEstimateFee = exports.blockchainDisconnect = exports.binanceSignTransaction = exports.binanceGetPublicKey = exports.binanceGetAddress = exports.backupDevice = exports.authorizeCoinJoin = exports.applySettings = exports.applyFlags = void 0;
|
|
7
|
+
exports.wipeDevice = exports.verifyMessage = exports.tezosSignTransaction = exports.tezosGetPublicKey = exports.tezosGetAddress = exports.stellarSignTransaction = exports.stellarGetAddress = exports.signTransaction = exports.signMessage = exports.setProxy = exports.rippleSignTransaction = exports.rippleGetAddress = exports.resetDevice = exports.requestLogin = void 0;
|
|
8
8
|
var applyFlags_1 = require("./applyFlags");
|
|
9
9
|
Object.defineProperty(exports, "applyFlags", { enumerable: true, get: function () { return __importDefault(applyFlags_1).default; } });
|
|
10
10
|
var applySettings_1 = require("./applySettings");
|
|
@@ -85,6 +85,8 @@ var getDeviceState_1 = require("./getDeviceState");
|
|
|
85
85
|
Object.defineProperty(exports, "getDeviceState", { enumerable: true, get: function () { return __importDefault(getDeviceState_1).default; } });
|
|
86
86
|
var getFeatures_1 = require("./getFeatures");
|
|
87
87
|
Object.defineProperty(exports, "getFeatures", { enumerable: true, get: function () { return __importDefault(getFeatures_1).default; } });
|
|
88
|
+
var getFirmwareHash_1 = require("./getFirmwareHash");
|
|
89
|
+
Object.defineProperty(exports, "getFirmwareHash", { enumerable: true, get: function () { return __importDefault(getFirmwareHash_1).default; } });
|
|
88
90
|
var getOwnershipId_1 = require("./getOwnershipId");
|
|
89
91
|
Object.defineProperty(exports, "getOwnershipId", { enumerable: true, get: function () { return __importDefault(getOwnershipId_1).default; } });
|
|
90
92
|
var getOwnershipProof_1 = require("./getOwnershipProof");
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { PROTO } from '../../constants';
|
|
2
|
-
import * as $T from '../../types/api/
|
|
2
|
+
import * as $T from '../../types/api/nem';
|
|
3
3
|
export declare const createTx: (tx: $T.NEMTransaction, address_n: number[]) => PROTO.NEMSignTx;
|
|
4
4
|
//# sourceMappingURL=nemSignTx.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AbstractMethod } from '../core/AbstractMethod';
|
|
2
2
|
import { PROTO } from '../constants';
|
|
3
3
|
import type { BitcoinNetworkInfo, AccountAddresses } from '../types';
|
|
4
|
-
import type { RefTransaction, TransactionOptions } from '../types/api/
|
|
4
|
+
import type { RefTransaction, TransactionOptions } from '../types/api/bitcoin';
|
|
5
5
|
declare type Params = {
|
|
6
6
|
inputs: PROTO.TxInputType[];
|
|
7
7
|
outputs: PROTO.TxOutputType[];
|
|
@@ -15,7 +15,7 @@ declare type Params = {
|
|
|
15
15
|
};
|
|
16
16
|
export default class SignTransaction extends AbstractMethod<'signTransaction', Params> {
|
|
17
17
|
init(): void;
|
|
18
|
-
run(): Promise<import("../types
|
|
18
|
+
run(): Promise<import("../types").SignedTransaction>;
|
|
19
19
|
}
|
|
20
20
|
export {};
|
|
21
21
|
//# sourceMappingURL=signTransaction.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { PROTO } from '../../constants';
|
|
2
2
|
import type { TypedCall } from '../../device/DeviceCommands';
|
|
3
|
-
import type { StellarTransaction } from '../../types/api/
|
|
3
|
+
import type { StellarTransaction } from '../../types/api/stellar';
|
|
4
4
|
export declare const stellarSignTx: (typedCall: TypedCall, address_n: number[], networkPassphrase: string, tx: StellarTransaction) => Promise<PROTO.StellarSignedTx>;
|
|
5
5
|
//# sourceMappingURL=stellarSignTx.d.ts.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { PROTO } from '../../constants';
|
|
2
|
-
import type { TezosOperation } from '../../types/api/
|
|
2
|
+
import type { TezosOperation } from '../../types/api/tezos';
|
|
3
3
|
export declare const createTx: (address_n: number[], branch: string, operation: TezosOperation) => PROTO.TezosSignTx;
|
|
4
4
|
//# sourceMappingURL=tezosSignTx.d.ts.map
|
package/lib/constants/errors.js
CHANGED
|
@@ -6,7 +6,7 @@ exports.ERROR_CODES = {
|
|
|
6
6
|
Init_AlreadyInitialized: 'TrezorConnect has been already initialized',
|
|
7
7
|
Init_IframeBlocked: 'Iframe blocked',
|
|
8
8
|
Init_IframeTimeout: 'Iframe timeout',
|
|
9
|
-
Init_ManifestMissing: 'Manifest not set. Read more at https://github.com/trezor/
|
|
9
|
+
Init_ManifestMissing: 'Manifest not set. Read more at https://github.com/trezor/trezor-suite/blob/develop/docs/packages/connect/index.md',
|
|
10
10
|
Popup_ConnectionMissing: 'Unable to establish connection with iframe',
|
|
11
11
|
Transport_Missing: 'Transport is missing',
|
|
12
12
|
Transport_InvalidProtobuf: '',
|
package/lib/core/index.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export declare const onCall: (message: CoreMessage) => Promise<void>;
|
|
|
7
7
|
export declare class Core extends EventEmitter {
|
|
8
8
|
handleMessage(message: any, isTrustedOrigin: boolean): void;
|
|
9
9
|
dispose(): void;
|
|
10
|
-
getCurrentMethod(): (import("../api").applyFlags | import("../api").applySettings | import("../api").authorizeCoinJoin | import("../api").backupDevice | import("../api").binanceGetAddress | import("../api").binanceGetPublicKey | import("../api").binanceSignTransaction | import("../api").blockchainDisconnect | import("../api").blockchainEstimateFee | import("../api").blockchainGetAccountBalanceHistory | import("../api").blockchainGetCurrentFiatRates | import("../api").blockchainGetFiatRatesForTimestamps | import("../api").blockchainGetTransactions | import("../api").blockchainSetCustomBackend | import("../api").blockchainSubscribe | import("../api").blockchainSubscribeFiatRates | import("../api").blockchainUnsubscribe | import("../api").blockchainUnsubscribeFiatRates | import("../api").cardanoGetAddress | import("../api").cardanoGetNativeScriptHash | import("../api").cardanoGetPublicKey | import("../api").cardanoSignTransaction | import("../api").changePin | import("../api").cipherKeyValue | import("../api").composeTransaction | import("../api").customMessage | import("../api").eosGetPublicKey | import("../api").eosSignTransaction | import("../api").ethereumGetAddress | import("../api").ethereumGetPublicKey | import("../api").ethereumSignMessage | import("../api").ethereumSignTransaction | import("../api").ethereumSignTypedData | import("../api").ethereumVerifyMessage | import("../api").firmwareUpdate | import("../api").getAccountInfo | import("../api").getAddress | import("../api").getCoinInfo | import("../api").getDeviceState | import("../api").getFeatures | import("../api").getOwnershipId | import("../api").getOwnershipProof | import("../api").getPublicKey | import("../api").getSettings | import("../api").nemGetAddress | import("../api").nemSignTransaction | import("../api").pushTransaction | import("../api").rebootToBootloader | import("../api").recoveryDevice | import("../api").requestLogin | import("../api").resetDevice | import("../api").rippleGetAddress | import("../api").rippleSignTransaction | import("../api").setProxy | import("../api").signMessage | import("../api").signTransaction | import("../api").stellarGetAddress | import("../api").stellarSignTransaction | import("../api").tezosGetAddress | import("../api").tezosGetPublicKey | import("../api").tezosSignTransaction | import("../api").verifyMessage | import("../api").wipeDevice)[];
|
|
10
|
+
getCurrentMethod(): (import("../api").applyFlags | import("../api").applySettings | import("../api").authorizeCoinJoin | import("../api").backupDevice | import("../api").binanceGetAddress | import("../api").binanceGetPublicKey | import("../api").binanceSignTransaction | import("../api").blockchainDisconnect | import("../api").blockchainEstimateFee | import("../api").blockchainGetAccountBalanceHistory | import("../api").blockchainGetCurrentFiatRates | import("../api").blockchainGetFiatRatesForTimestamps | import("../api").blockchainGetTransactions | import("../api").blockchainSetCustomBackend | import("../api").blockchainSubscribe | import("../api").blockchainSubscribeFiatRates | import("../api").blockchainUnsubscribe | import("../api").blockchainUnsubscribeFiatRates | import("../api").cardanoGetAddress | import("../api").cardanoGetNativeScriptHash | import("../api").cardanoGetPublicKey | import("../api").cardanoSignTransaction | import("../api").changePin | import("../api").cipherKeyValue | import("../api").composeTransaction | import("../api").customMessage | import("../api").eosGetPublicKey | import("../api").eosSignTransaction | import("../api").ethereumGetAddress | import("../api").ethereumGetPublicKey | import("../api").ethereumSignMessage | import("../api").ethereumSignTransaction | import("../api").ethereumSignTypedData | import("../api").ethereumVerifyMessage | import("../api").firmwareUpdate | import("../api").getAccountInfo | import("../api").getAddress | import("../api").getCoinInfo | import("../api").getDeviceState | import("../api").getFeatures | import("../api").getFirmwareHash | import("../api").getOwnershipId | import("../api").getOwnershipProof | import("../api").getPublicKey | import("../api").getSettings | import("../api").nemGetAddress | import("../api").nemSignTransaction | import("../api").pushTransaction | import("../api").rebootToBootloader | import("../api").recoveryDevice | import("../api").requestLogin | import("../api").resetDevice | import("../api").rippleGetAddress | import("../api").rippleSignTransaction | import("../api").setProxy | import("../api").signMessage | import("../api").signTransaction | import("../api").stellarGetAddress | import("../api").stellarSignTransaction | import("../api").tezosGetAddress | import("../api").tezosGetPublicKey | import("../api").tezosSignTransaction | import("../api").verifyMessage | import("../api").wipeDevice)[];
|
|
11
11
|
getTransportInfo(): TransportInfo;
|
|
12
12
|
}
|
|
13
13
|
export declare const initCore: () => Core;
|
package/lib/core/method.d.ts
CHANGED
|
@@ -2,5 +2,5 @@ import * as Methods from '../api';
|
|
|
2
2
|
import type { IFrameCallMessage } from '../events';
|
|
3
3
|
export declare const getMethod: (message: IFrameCallMessage & {
|
|
4
4
|
id?: number;
|
|
5
|
-
}) => Methods.applyFlags | Methods.applySettings | Methods.authorizeCoinJoin | Methods.backupDevice | Methods.binanceGetAddress | Methods.binanceGetPublicKey | Methods.binanceSignTransaction | Methods.blockchainDisconnect | Methods.blockchainEstimateFee | Methods.blockchainGetAccountBalanceHistory | Methods.blockchainGetCurrentFiatRates | Methods.blockchainGetFiatRatesForTimestamps | Methods.blockchainGetTransactions | Methods.blockchainSetCustomBackend | Methods.blockchainSubscribe | Methods.blockchainSubscribeFiatRates | Methods.blockchainUnsubscribe | Methods.blockchainUnsubscribeFiatRates | Methods.cardanoGetAddress | Methods.cardanoGetNativeScriptHash | Methods.cardanoGetPublicKey | Methods.cardanoSignTransaction | Methods.changePin | Methods.cipherKeyValue | Methods.composeTransaction | Methods.customMessage | Methods.eosGetPublicKey | Methods.eosSignTransaction | Methods.ethereumGetAddress | Methods.ethereumGetPublicKey | Methods.ethereumSignMessage | Methods.ethereumSignTransaction | Methods.ethereumSignTypedData | Methods.ethereumVerifyMessage | Methods.firmwareUpdate | Methods.getAccountInfo | Methods.getAddress | Methods.getCoinInfo | Methods.getDeviceState | Methods.getFeatures | Methods.getOwnershipId | Methods.getOwnershipProof | Methods.getPublicKey | Methods.getSettings | Methods.nemGetAddress | Methods.nemSignTransaction | Methods.pushTransaction | Methods.rebootToBootloader | Methods.recoveryDevice | Methods.requestLogin | Methods.resetDevice | Methods.rippleGetAddress | Methods.rippleSignTransaction | Methods.setProxy | Methods.signMessage | Methods.signTransaction | Methods.stellarGetAddress | Methods.stellarSignTransaction | Methods.tezosGetAddress | Methods.tezosGetPublicKey | Methods.tezosSignTransaction | Methods.verifyMessage | Methods.wipeDevice;
|
|
5
|
+
}) => Methods.applyFlags | Methods.applySettings | Methods.authorizeCoinJoin | Methods.backupDevice | Methods.binanceGetAddress | Methods.binanceGetPublicKey | Methods.binanceSignTransaction | Methods.blockchainDisconnect | Methods.blockchainEstimateFee | Methods.blockchainGetAccountBalanceHistory | Methods.blockchainGetCurrentFiatRates | Methods.blockchainGetFiatRatesForTimestamps | Methods.blockchainGetTransactions | Methods.blockchainSetCustomBackend | Methods.blockchainSubscribe | Methods.blockchainSubscribeFiatRates | Methods.blockchainUnsubscribe | Methods.blockchainUnsubscribeFiatRates | Methods.cardanoGetAddress | Methods.cardanoGetNativeScriptHash | Methods.cardanoGetPublicKey | Methods.cardanoSignTransaction | Methods.changePin | Methods.cipherKeyValue | Methods.composeTransaction | Methods.customMessage | Methods.eosGetPublicKey | Methods.eosSignTransaction | Methods.ethereumGetAddress | Methods.ethereumGetPublicKey | Methods.ethereumSignMessage | Methods.ethereumSignTransaction | Methods.ethereumSignTypedData | Methods.ethereumVerifyMessage | Methods.firmwareUpdate | Methods.getAccountInfo | Methods.getAddress | Methods.getCoinInfo | Methods.getDeviceState | Methods.getFeatures | Methods.getFirmwareHash | Methods.getOwnershipId | Methods.getOwnershipProof | Methods.getPublicKey | Methods.getSettings | Methods.nemGetAddress | Methods.nemSignTransaction | Methods.pushTransaction | Methods.rebootToBootloader | Methods.recoveryDevice | Methods.requestLogin | Methods.resetDevice | Methods.rippleGetAddress | Methods.rippleSignTransaction | Methods.setProxy | Methods.signMessage | Methods.signTransaction | Methods.stellarGetAddress | Methods.stellarSignTransaction | Methods.tezosGetAddress | Methods.tezosGetPublicKey | Methods.tezosSignTransaction | Methods.verifyMessage | Methods.wipeDevice;
|
|
6
6
|
//# sourceMappingURL=method.d.ts.map
|
package/lib/data/firmwareInfo.js
CHANGED
|
@@ -6,20 +6,11 @@ const firmwareUtils_1 = require("../utils/firmwareUtils");
|
|
|
6
6
|
const releases = {};
|
|
7
7
|
releases[1] = [];
|
|
8
8
|
releases[2] = [];
|
|
9
|
-
const cleanUrl = (url) => {
|
|
10
|
-
if (typeof url !== 'string')
|
|
11
|
-
return;
|
|
12
|
-
if (url.indexOf('data/') === 0)
|
|
13
|
-
return url.substring(5);
|
|
14
|
-
return url;
|
|
15
|
-
};
|
|
16
9
|
const parseFirmware = (json, model) => {
|
|
17
10
|
Object.keys(json).forEach(key => {
|
|
18
11
|
const release = json[key];
|
|
19
12
|
releases[model].push({
|
|
20
13
|
...release,
|
|
21
|
-
url: cleanUrl(release.url),
|
|
22
|
-
url_bitcoinonly: cleanUrl(release.url_bitcoinonly),
|
|
23
14
|
});
|
|
24
15
|
});
|
|
25
16
|
};
|
package/lib/data/version.d.ts
CHANGED
package/lib/data/version.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.DEFAULT_DOMAIN = exports.VERSION = void 0;
|
|
4
|
-
exports.VERSION = '9.0.0-beta.
|
|
4
|
+
exports.VERSION = '9.0.0-beta.6';
|
|
5
5
|
const versionN = exports.VERSION.split('.').map(s => parseInt(s, 10));
|
|
6
6
|
exports.DEFAULT_DOMAIN = `https://connect.trezor.io/${versionN[0]}/`;
|
|
7
7
|
//# sourceMappingURL=version.js.map
|
package/lib/device/DeviceList.js
CHANGED
|
@@ -19,6 +19,7 @@ const { BridgeV2, Fallback } = transport_1.default;
|
|
|
19
19
|
const _log = (0, debug_1.initLog)('DeviceList');
|
|
20
20
|
class DeviceList extends events_1.default {
|
|
21
21
|
constructor() {
|
|
22
|
+
var _a, _b;
|
|
22
23
|
super();
|
|
23
24
|
this.devices = {};
|
|
24
25
|
this.creatingDevicesDescriptors = {};
|
|
@@ -37,7 +38,8 @@ class DeviceList extends events_1.default {
|
|
|
37
38
|
this.fetchController = (0, AbortController_1.getAbortController)();
|
|
38
39
|
const { signal } = this.fetchController;
|
|
39
40
|
const fetchWithSignal = (args, options = {}) => (0, cross_fetch_1.default)(args, { ...options, signal });
|
|
40
|
-
|
|
41
|
+
const isNode = ((_b = (_a = process === null || process === void 0 ? void 0 : process.release) === null || _a === void 0 ? void 0 : _a.name) === null || _b === void 0 ? void 0 : _b.search(/node|io\.js/)) !== -1;
|
|
42
|
+
BridgeV2.setFetch(fetchWithSignal, isNode);
|
|
41
43
|
transports.push(bridge);
|
|
42
44
|
}
|
|
43
45
|
if (webusb && typeof workers_1.WebUsbPlugin !== 'undefined') {
|
package/lib/factory.js
CHANGED
|
@@ -63,6 +63,7 @@ const factory = ({ eventEmitter, manifest, init, call, customMessage, requestLog
|
|
|
63
63
|
}),
|
|
64
64
|
getDeviceState: params => call({ ...params, method: 'getDeviceState' }),
|
|
65
65
|
getFeatures: params => call({ ...params, method: 'getFeatures' }),
|
|
66
|
+
getFirmwareHash: params => call({ ...params, method: 'getFirmwareHash' }),
|
|
66
67
|
getOwnershipId: params => call({ ...params, method: 'getOwnershipId' }),
|
|
67
68
|
getOwnershipProof: params => call({ ...params, method: 'getOwnershipProof' }),
|
|
68
69
|
getPublicKey: params => call({ ...params, method: 'getPublicKey' }),
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import type { PROTO } from '../../../constants';
|
|
2
|
+
export interface BinanceSDKTransaction {
|
|
3
|
+
chain_id: string;
|
|
4
|
+
account_number?: number;
|
|
5
|
+
memo?: string;
|
|
6
|
+
sequence?: number;
|
|
7
|
+
source?: number;
|
|
8
|
+
transfer?: PROTO.BinanceTransferMsg;
|
|
9
|
+
placeOrder?: PROTO.BinanceOrderMsg;
|
|
10
|
+
cancelOrder?: PROTO.BinanceCancelMsg;
|
|
11
|
+
}
|
|
12
|
+
export declare type BinancePreparedMessage = (PROTO.BinanceTransferMsg & {
|
|
13
|
+
type: 'BinanceTransferMsg';
|
|
14
|
+
}) | (PROTO.BinanceOrderMsg & {
|
|
15
|
+
type: 'BinanceOrderMsg';
|
|
16
|
+
}) | (PROTO.BinanceCancelMsg & {
|
|
17
|
+
type: 'BinanceCancelMsg';
|
|
18
|
+
});
|
|
19
|
+
export interface BinancePreparedTransaction extends BinanceSDKTransaction {
|
|
20
|
+
messages: BinancePreparedMessage[];
|
|
21
|
+
account_number: number;
|
|
22
|
+
sequence: number;
|
|
23
|
+
source: number;
|
|
24
|
+
}
|
|
25
|
+
export interface BinanceSignTransaction {
|
|
26
|
+
path: string | number[];
|
|
27
|
+
transaction: BinanceSDKTransaction;
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,31 +1,5 @@
|
|
|
1
1
|
import type { PROTO } from '../../constants';
|
|
2
2
|
import type { Params, Response } from '../params';
|
|
3
|
-
|
|
4
|
-
chain_id: string;
|
|
5
|
-
account_number?: number;
|
|
6
|
-
memo?: string;
|
|
7
|
-
sequence?: number;
|
|
8
|
-
source?: number;
|
|
9
|
-
transfer?: PROTO.BinanceTransferMsg;
|
|
10
|
-
placeOrder?: PROTO.BinanceOrderMsg;
|
|
11
|
-
cancelOrder?: PROTO.BinanceCancelMsg;
|
|
12
|
-
}
|
|
13
|
-
export declare type BinancePreparedMessage = (PROTO.BinanceTransferMsg & {
|
|
14
|
-
type: 'BinanceTransferMsg';
|
|
15
|
-
}) | (PROTO.BinanceOrderMsg & {
|
|
16
|
-
type: 'BinanceOrderMsg';
|
|
17
|
-
}) | (PROTO.BinanceCancelMsg & {
|
|
18
|
-
type: 'BinanceCancelMsg';
|
|
19
|
-
});
|
|
20
|
-
export interface BinancePreparedTransaction extends BinanceSDKTransaction {
|
|
21
|
-
messages: BinancePreparedMessage[];
|
|
22
|
-
account_number: number;
|
|
23
|
-
sequence: number;
|
|
24
|
-
source: number;
|
|
25
|
-
}
|
|
26
|
-
export interface BinanceSignTransaction {
|
|
27
|
-
path: string | number[];
|
|
28
|
-
transaction: BinanceSDKTransaction;
|
|
29
|
-
}
|
|
3
|
+
import type { BinanceSignTransaction } from './binance';
|
|
30
4
|
export declare function binanceSignTransaction(params: Params<BinanceSignTransaction>): Response<PROTO.BinanceSignedTx>;
|
|
31
5
|
//# sourceMappingURL=binanceSignTransaction.d.ts.map
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import type { PROTO } from '../../../constants';
|
|
2
|
+
import type { AccountAddresses } from '@trezor/blockchain-link';
|
|
3
|
+
export interface SignMessage {
|
|
4
|
+
path: string | number[];
|
|
5
|
+
coin: string;
|
|
6
|
+
message: string;
|
|
7
|
+
hex?: boolean;
|
|
8
|
+
no_script_type?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare type RefTransaction = {
|
|
11
|
+
hash: string;
|
|
12
|
+
version: number;
|
|
13
|
+
inputs: PROTO.PrevInput[];
|
|
14
|
+
bin_outputs: PROTO.TxOutputBinType[];
|
|
15
|
+
outputs?: typeof undefined;
|
|
16
|
+
lock_time: number;
|
|
17
|
+
extra_data?: string;
|
|
18
|
+
expiry?: number;
|
|
19
|
+
overwintered?: boolean;
|
|
20
|
+
version_group_id?: number;
|
|
21
|
+
timestamp?: number;
|
|
22
|
+
branch_id?: number;
|
|
23
|
+
} | {
|
|
24
|
+
hash: string;
|
|
25
|
+
version: number;
|
|
26
|
+
inputs: PROTO.TxInput[];
|
|
27
|
+
bin_outputs?: typeof undefined;
|
|
28
|
+
outputs: PROTO.TxOutputType[];
|
|
29
|
+
lock_time: number;
|
|
30
|
+
extra_data?: string;
|
|
31
|
+
expiry?: number;
|
|
32
|
+
overwintered?: boolean;
|
|
33
|
+
version_group_id?: number;
|
|
34
|
+
timestamp?: number;
|
|
35
|
+
branch_id?: number;
|
|
36
|
+
};
|
|
37
|
+
export interface TransactionOptions {
|
|
38
|
+
version?: number;
|
|
39
|
+
lock_time?: number;
|
|
40
|
+
expiry?: number;
|
|
41
|
+
overwintered?: boolean;
|
|
42
|
+
version_group_id?: number;
|
|
43
|
+
timestamp?: number;
|
|
44
|
+
branch_id?: number;
|
|
45
|
+
decred_staking_ticket?: boolean;
|
|
46
|
+
amount_unit?: PROTO.AmountUnit;
|
|
47
|
+
}
|
|
48
|
+
export interface SignTransaction {
|
|
49
|
+
inputs: PROTO.TxInputType[];
|
|
50
|
+
outputs: PROTO.TxOutputType[];
|
|
51
|
+
paymentRequests?: PROTO.TxAckPaymentRequest[];
|
|
52
|
+
refTxs?: RefTransaction[];
|
|
53
|
+
account?: {
|
|
54
|
+
addresses: AccountAddresses;
|
|
55
|
+
};
|
|
56
|
+
coin: string;
|
|
57
|
+
locktime?: number;
|
|
58
|
+
timestamp?: number;
|
|
59
|
+
version?: number;
|
|
60
|
+
expiry?: number;
|
|
61
|
+
overwintered?: boolean;
|
|
62
|
+
versionGroupId?: number;
|
|
63
|
+
branchId?: number;
|
|
64
|
+
decredStakingTicket?: boolean;
|
|
65
|
+
push?: boolean;
|
|
66
|
+
preauthorized?: boolean;
|
|
67
|
+
amountUnit?: PROTO.AmountUnit;
|
|
68
|
+
}
|
|
69
|
+
export declare type SignedTransaction = {
|
|
70
|
+
signatures: string[];
|
|
71
|
+
serializedTx: string;
|
|
72
|
+
witnesses?: (string | undefined)[];
|
|
73
|
+
txid?: string;
|
|
74
|
+
};
|
|
75
|
+
export interface VerifyMessage {
|
|
76
|
+
address: string;
|
|
77
|
+
signature: string;
|
|
78
|
+
message: string;
|
|
79
|
+
coin: string;
|
|
80
|
+
hex?: boolean;
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=index.d.ts.map
|