@trezor/connect 9.1.8 → 9.1.10
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 +11 -0
- package/README.md +1 -1
- package/lib/api/applyFlags.d.ts +4 -2
- package/lib/api/applyFlags.js +3 -2
- package/lib/api/applySettings.d.ts +4 -2
- package/lib/api/applySettings.js +3 -13
- package/lib/api/authenticateDevice.js +3 -11
- package/lib/api/authorizeCoinjoin.d.ts +3 -1
- package/lib/api/authorizeCoinjoin.js +3 -11
- package/lib/api/backupDevice.d.ts +3 -1
- package/lib/api/binance/api/binanceGetAddress.d.ts +4 -2
- package/lib/api/binance/api/binanceGetAddress.js +4 -10
- package/lib/api/binance/api/binanceGetPublicKey.d.ts +9 -1
- package/lib/api/binance/api/binanceGetPublicKey.js +3 -5
- package/lib/api/binance/api/binanceSignTransaction.d.ts +4 -1
- package/lib/api/binance/api/binanceSignTransaction.js +5 -6
- package/lib/api/binance/binanceSignTx.d.ts +84 -3
- package/lib/api/binance/binanceSignTx.js +3 -26
- package/lib/api/bitcoin/Fees.d.ts +14 -2
- package/lib/api/bitcoin/TransactionComposer.d.ts +13 -2
- package/lib/api/bitcoin/refTx.d.ts +2 -2
- package/lib/api/bitcoin/refTx.js +22 -24
- package/lib/api/bitcoin/signtxVerify.d.ts +1 -1
- package/lib/api/blockchainDisconnect.d.ts +1 -1
- package/lib/api/blockchainDisconnect.js +3 -2
- package/lib/api/blockchainGetAccountBalanceHistory.d.ts +1 -1
- package/lib/api/blockchainGetCurrentFiatRates.d.ts +1 -1
- package/lib/api/blockchainGetFiatRatesForTimestamps.d.ts +1 -1
- package/lib/api/blockchainGetTransactions.d.ts +1 -1
- package/lib/api/cancelCoinjoinAuthorization.d.ts +3 -1
- package/lib/api/cancelCoinjoinAuthorization.js +3 -0
- package/lib/api/cardano/api/cardanoGetAddress.d.ts +4 -2
- package/lib/api/cardano/api/cardanoGetAddress.js +4 -13
- package/lib/api/cardano/api/cardanoGetNativeScriptHash.d.ts +1 -1
- package/lib/api/cardano/api/cardanoGetNativeScriptHash.js +3 -13
- package/lib/api/cardano/api/cardanoGetPublicKey.d.ts +1 -1
- package/lib/api/cardano/api/cardanoGetPublicKey.js +4 -7
- package/lib/api/cardano/api/cardanoSignTransaction.d.ts +26 -4
- package/lib/api/cardano/api/cardanoSignTransaction.js +15 -46
- package/lib/api/cardano/cardanoAddressParameters.d.ts +1 -1
- package/lib/api/cardano/cardanoAddressParameters.js +3 -14
- package/lib/api/cardano/cardanoAuxiliaryData.d.ts +1 -1
- package/lib/api/cardano/cardanoAuxiliaryData.js +5 -20
- package/lib/api/cardano/cardanoCertificate.d.ts +1 -1
- package/lib/api/cardano/cardanoCertificate.js +20 -59
- package/lib/api/cardano/cardanoInputs.d.ts +20 -8
- package/lib/api/cardano/cardanoInputs.js +18 -14
- package/lib/api/cardano/cardanoOutputs.d.ts +31 -2
- package/lib/api/cardano/cardanoOutputs.js +14 -11
- package/lib/api/cardano/cardanoTokenBundle.d.ts +11 -6
- package/lib/api/cardano/cardanoTokenBundle.js +9 -21
- package/lib/api/changePin.d.ts +4 -2
- package/lib/api/changePin.js +3 -2
- package/lib/api/changeWipeCode.d.ts +3 -1
- package/lib/api/cipherKeyValue.d.ts +5 -1
- package/lib/api/cipherKeyValue.js +13 -21
- package/lib/api/common/paramsValidator.js +5 -4
- package/lib/api/eos/api/eosGetPublicKey.d.ts +11 -1
- package/lib/api/eos/api/eosGetPublicKey.js +3 -6
- package/lib/api/eos/api/eosSignTransaction.js +3 -5
- package/lib/api/eos/eosSignTx.d.ts +160 -2
- package/lib/api/ethereum/api/ethereumGetAddress.js +4 -10
- package/lib/api/ethereum/api/ethereumGetPublicKey.d.ts +21 -1
- package/lib/api/ethereum/api/ethereumGetPublicKey.js +3 -5
- package/lib/api/ethereum/api/ethereumSignMessage.d.ts +6 -3
- package/lib/api/ethereum/api/ethereumSignMessage.js +3 -5
- package/lib/api/ethereum/api/ethereumSignTransaction.d.ts +2 -2
- package/lib/api/ethereum/api/ethereumSignTransaction.js +3 -25
- package/lib/api/ethereum/api/ethereumSignTypedData.d.ts +83 -3
- package/lib/api/ethereum/api/ethereumSignTypedData.js +20 -12
- package/lib/api/ethereum/api/ethereumVerifyMessage.d.ts +3 -1
- package/lib/api/ethereum/api/ethereumVerifyMessage.js +3 -6
- package/lib/api/ethereum/ethereumDefinitions.d.ts +37 -19
- package/lib/api/ethereum/ethereumDefinitions.js +21 -15
- package/lib/api/ethereum/ethereumSignTx.d.ts +1 -1
- package/lib/api/firmware/getBinary.js +5 -4
- package/lib/api/firmware/modifyFirmware.js +3 -2
- package/lib/api/firmware/uploadFirmware.d.ts +3 -1
- package/lib/api/firmware/verifyAuthenticityProof.js +3 -3
- package/lib/api/firmwareUpdate.js +10 -15
- package/lib/api/getAccountDescriptor.d.ts +2 -2
- package/lib/api/getAccountDescriptor.js +4 -7
- package/lib/api/getAccountInfo.d.ts +8 -8
- package/lib/api/getAddress.d.ts +8 -2
- package/lib/api/getAddress.js +4 -20
- package/lib/api/getCoinInfo.d.ts +117 -2
- package/lib/api/getCoinInfo.js +3 -2
- package/lib/api/getFeatures.d.ts +49 -1
- package/lib/api/getFirmwareHash.d.ts +3 -1
- package/lib/api/getFirmwareHash.js +3 -1
- package/lib/api/getOwnershipId.js +4 -7
- package/lib/api/getOwnershipProof.js +4 -11
- package/lib/api/getPublicKey.d.ts +21 -1
- package/lib/api/getPublicKey.js +4 -18
- package/lib/api/nem/api/nemGetAddress.d.ts +4 -2
- package/lib/api/nem/api/nemGetAddress.js +4 -11
- package/lib/api/nem/api/nemSignTransaction.d.ts +4 -1
- package/lib/api/nem/api/nemSignTransaction.js +3 -5
- package/lib/api/nem/nemSignTx.d.ts +75 -1
- package/lib/api/pushTransaction.js +3 -5
- package/lib/api/rebootToBootloader.d.ts +3 -1
- package/lib/api/recoveryDevice.d.ts +3 -1
- package/lib/api/recoveryDevice.js +3 -12
- package/lib/api/requestLogin.js +7 -9
- package/lib/api/resetDevice.d.ts +3 -1
- package/lib/api/resetDevice.js +3 -12
- package/lib/api/ripple/api/rippleGetAddress.d.ts +4 -2
- package/lib/api/ripple/api/rippleGetAddress.js +4 -10
- package/lib/api/ripple/api/rippleSignTransaction.js +3 -17
- package/lib/api/setBusy.d.ts +3 -1
- package/lib/api/setBusy.js +3 -1
- package/lib/api/showDeviceTutorial.d.ts +3 -1
- package/lib/api/signMessage.d.ts +4 -1
- package/lib/api/signMessage.js +3 -7
- package/lib/api/solana/additionalInfo.js +3 -14
- package/lib/api/solana/api/solanaGetAddress.d.ts +4 -2
- package/lib/api/solana/api/solanaGetAddress.js +4 -7
- package/lib/api/solana/api/solanaGetPublicKey.d.ts +13 -1
- package/lib/api/solana/api/solanaGetPublicKey.js +3 -5
- package/lib/api/solana/api/solanaSignTransaction.js +3 -4
- package/lib/api/stellar/api/stellarGetAddress.d.ts +4 -2
- package/lib/api/stellar/api/stellarGetAddress.js +4 -10
- package/lib/api/stellar/api/stellarSignTransaction.js +3 -5
- package/lib/api/stellar/stellarSignTx.d.ts +5 -3
- package/lib/api/stellar/stellarSignTx.js +3 -15
- package/lib/api/tezos/api/tezosGetAddress.d.ts +4 -2
- package/lib/api/tezos/api/tezosGetAddress.js +4 -10
- package/lib/api/tezos/api/tezosGetPublicKey.d.ts +9 -1
- package/lib/api/tezos/api/tezosGetPublicKey.js +3 -6
- package/lib/api/tezos/api/tezosSignTransaction.d.ts +5 -1
- package/lib/api/tezos/api/tezosSignTransaction.js +3 -5
- package/lib/api/tezos/tezosSignTx.d.ts +70 -2
- package/lib/api/tezos/tezosSignTx.js +3 -44
- package/lib/api/unlockPath.js +3 -4
- package/lib/api/verifyMessage.d.ts +3 -1
- package/lib/api/verifyMessage.js +3 -7
- package/lib/api/wipeDevice.d.ts +3 -1
- package/lib/constants/index.d.ts +1 -1
- package/lib/constants/index.js +1 -1
- package/lib/constants/nem.d.ts +7 -0
- package/lib/constants/nem.js +5 -1
- package/lib/core/AbstractMethod.d.ts +1 -1
- package/lib/core/AbstractMethod.js +4 -3
- package/lib/core/index.js +3 -3
- package/lib/data/coinInfo.d.ts +588 -12
- package/lib/data/coinInfo.js +6 -6
- package/lib/data/config.js +5 -0
- package/lib/data/deviceAuthenticityConfig.d.ts +19 -13
- package/lib/data/deviceAuthenticityConfig.js +23 -1
- package/lib/data/firmwareInfo.js +11 -10
- package/lib/data/version.d.ts +1 -1
- package/lib/data/version.js +1 -1
- package/lib/device/Device.d.ts +2 -6
- package/lib/device/Device.js +8 -27
- package/lib/device/DeviceCommands.d.ts +36 -4
- package/lib/device/DeviceCommands.js +5 -2
- package/lib/device/DeviceList.js +1 -1
- package/lib/events/index.d.ts +1 -0
- package/lib/events/index.js +1 -0
- package/lib/events/ui-promise.d.ts +1 -1
- package/lib/events/webextension.d.ts +7 -0
- package/lib/events/webextension.js +10 -0
- package/lib/index.d.ts +1 -1
- package/lib/index.js +2 -2
- package/lib/types/api/applySettings.d.ts +18 -2
- package/lib/types/api/applySettings.js +9 -0
- package/lib/types/api/authenticateDevice.d.ts +22 -5
- package/lib/types/api/authenticateDevice.js +7 -0
- package/lib/types/api/authorizeCoinjoin.d.ts +15 -13
- package/lib/types/api/authorizeCoinjoin.js +15 -0
- package/lib/types/api/binance/index.d.ts +203 -30
- package/lib/types/api/binance/index.js +48 -0
- package/lib/types/api/bitcoin/index.d.ts +18 -15
- package/lib/types/api/bitcoin/index.js +17 -0
- package/lib/types/api/cancelCoinjoinAuthorization.d.ts +5 -4
- package/lib/types/api/cancelCoinjoinAuthorization.js +5 -0
- package/lib/types/api/cardano/index.d.ts +685 -187
- package/lib/types/api/cardano/index.js +208 -0
- package/lib/types/api/cardanoSignTransaction.d.ts +5 -8
- package/lib/types/api/cipherKeyValue.d.ts +12 -11
- package/lib/types/api/cipherKeyValue.js +12 -0
- package/lib/types/api/eos/index.d.ts +783 -116
- package/lib/types/api/eos/index.js +177 -0
- package/lib/types/api/ethereum/index.d.ts +162 -56
- package/lib/types/api/ethereum/index.js +90 -0
- package/lib/types/api/firmwareUpdate.d.ts +11 -11
- package/lib/types/api/firmwareUpdate.js +15 -0
- package/lib/types/api/getAccountDescriptor.d.ts +10 -8
- package/lib/types/api/getAccountDescriptor.js +10 -0
- package/lib/types/api/getAddress.d.ts +42 -9
- package/lib/types/api/getAddress.js +14 -0
- package/lib/types/api/getOwnershipId.d.ts +33 -8
- package/lib/types/api/getOwnershipId.js +10 -0
- package/lib/types/api/getOwnershipProof.d.ts +37 -12
- package/lib/types/api/getOwnershipProof.js +14 -0
- package/lib/types/api/getPublicKey.d.ts +31 -21
- package/lib/types/api/getPublicKey.js +26 -0
- package/lib/types/api/nem/index.d.ts +841 -91
- package/lib/types/api/nem/index.js +130 -0
- package/lib/types/api/pushTransaction.d.ts +6 -4
- package/lib/types/api/pushTransaction.js +6 -0
- package/lib/types/api/recoveryDevice.d.ts +14 -4
- package/lib/types/api/recoveryDevice.js +9 -0
- package/lib/types/api/requestLogin.d.ts +38 -13
- package/lib/types/api/requestLogin.js +15 -0
- package/lib/types/api/resetDevice.d.ts +15 -13
- package/lib/types/api/resetDevice.js +9 -0
- package/lib/types/api/ripple/index.d.ts +40 -22
- package/lib/types/api/ripple/index.js +24 -0
- package/lib/types/api/solana/index.d.ts +42 -21
- package/lib/types/api/solana/index.js +26 -0
- package/lib/types/api/stellar/index.d.ts +890 -180
- package/lib/types/api/stellar/index.js +249 -0
- package/lib/types/api/tezos/index.d.ts +162 -59
- package/lib/types/api/tezos/index.js +61 -0
- package/lib/types/api/unlockPath.d.ts +7 -5
- package/lib/types/api/unlockPath.js +7 -0
- package/lib/types/coinInfo.d.ts +273 -56
- package/lib/types/coinInfo.js +81 -0
- package/lib/types/device.d.ts +1 -1
- package/lib/types/device.js +2 -2
- package/lib/types/fees.d.ts +29 -25
- package/lib/types/fees.js +36 -0
- package/lib/types/firmware.d.ts +1 -0
- package/lib/types/firmware.js +3 -0
- package/lib/types/params.d.ts +26 -17
- package/lib/types/params.js +23 -0
- package/lib/utils/deviceFeaturesUtils.js +5 -4
- package/lib/utils/firmwareUtils.js +5 -4
- package/lib/utils/hdnodeUtils.d.ts +191 -1
- package/lib/utils/pathUtils.d.ts +191 -1
- package/lib/utils/urlUtils.js +3 -3
- package/package.json +10 -9
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,14 @@
|
|
|
1
|
+
# 9.1.10
|
|
2
|
+
|
|
3
|
+
- chore(connect): bump ADA support version, min required version is now 2.4.3 (7937fea3ec)
|
|
4
|
+
- fix(connect): always check ADA passphrase (42c28cc95d)
|
|
5
|
+
- chore(connect): decrease build size by using lib of utils which is not treeshaken (b4ab48b25f)
|
|
6
|
+
- refactor(connect): rework validation of input params (0c035c26a6, 44430e47ff, c78cd9ad28, c5e9d50bf4)
|
|
7
|
+
|
|
8
|
+
# 9.1.9
|
|
9
|
+
|
|
10
|
+
- fix(connect-popup): webusb pairing in webextensions using manifest version 2 [#10709](https://github.com/trezor/trezor-suite/pull/10709).
|
|
11
|
+
|
|
1
12
|
# 9.1.8
|
|
2
13
|
|
|
3
14
|
- fix(connect-explorer): eth getAccountInfo coin fix (0108b96)
|
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @trezor/connect
|
|
2
2
|
|
|
3
|
-
API version 9.1.
|
|
3
|
+
API version 9.1.10
|
|
4
4
|
|
|
5
5
|
[](https://github.com/trezor/trezor-suite/actions/workflows/connect-test.yml)
|
|
6
6
|
[](https://www.npmjs.org/package/@trezor/connect)
|
package/lib/api/applyFlags.d.ts
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { AbstractMethod } from '../core/AbstractMethod';
|
|
2
|
-
import
|
|
2
|
+
import { PROTO } from '../constants';
|
|
3
3
|
export default class ApplyFlags extends AbstractMethod<'applyFlags', PROTO.ApplyFlags> {
|
|
4
4
|
init(): void;
|
|
5
5
|
confirmation(): Promise<boolean>;
|
|
6
|
-
run(): Promise<
|
|
6
|
+
run(): Promise<{
|
|
7
|
+
message: string;
|
|
8
|
+
}>;
|
|
7
9
|
}
|
|
8
10
|
//# sourceMappingURL=applyFlags.d.ts.map
|
package/lib/api/applyFlags.js
CHANGED
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const AbstractMethod_1 = require("../core/AbstractMethod");
|
|
4
|
-
const paramsValidator_1 = require("./common/paramsValidator");
|
|
5
4
|
const events_1 = require("../events");
|
|
5
|
+
const constants_1 = require("../constants");
|
|
6
|
+
const schema_utils_1 = require("@trezor/schema-utils");
|
|
6
7
|
class ApplyFlags extends AbstractMethod_1.AbstractMethod {
|
|
7
8
|
init() {
|
|
8
9
|
this.requiredPermissions = ['management'];
|
|
9
10
|
this.useDeviceState = false;
|
|
10
11
|
const { payload } = this;
|
|
11
|
-
(0,
|
|
12
|
+
(0, schema_utils_1.Assert)(constants_1.PROTO.ApplyFlags, payload);
|
|
12
13
|
this.params = {
|
|
13
14
|
flags: payload.flags,
|
|
14
15
|
};
|
|
@@ -1,8 +1,10 @@
|
|
|
1
1
|
import { AbstractMethod } from '../core/AbstractMethod';
|
|
2
|
-
import
|
|
2
|
+
import { PROTO } from '../constants';
|
|
3
3
|
export default class ApplySettings extends AbstractMethod<'applySettings', PROTO.ApplySettings> {
|
|
4
4
|
init(): void;
|
|
5
5
|
confirmation(): Promise<boolean>;
|
|
6
|
-
run(): Promise<
|
|
6
|
+
run(): Promise<{
|
|
7
|
+
message: string;
|
|
8
|
+
}>;
|
|
7
9
|
}
|
|
8
10
|
//# sourceMappingURL=applySettings.d.ts.map
|
package/lib/api/applySettings.js
CHANGED
|
@@ -2,24 +2,14 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const AbstractMethod_1 = require("../core/AbstractMethod");
|
|
4
4
|
const events_1 = require("../events");
|
|
5
|
-
const
|
|
5
|
+
const schema_utils_1 = require("@trezor/schema-utils");
|
|
6
|
+
const applySettings_1 = require("../types/api/applySettings");
|
|
6
7
|
class ApplySettings extends AbstractMethod_1.AbstractMethod {
|
|
7
8
|
init() {
|
|
8
9
|
this.requiredPermissions = ['management'];
|
|
9
10
|
this.useDeviceState = false;
|
|
10
11
|
const { payload } = this;
|
|
11
|
-
(0,
|
|
12
|
-
{ name: 'language', type: 'string' },
|
|
13
|
-
{ name: 'label', type: 'string' },
|
|
14
|
-
{ name: 'use_passphrase', type: 'boolean' },
|
|
15
|
-
{ name: 'homescreen', type: 'string' },
|
|
16
|
-
{ name: 'passphrase_source', type: 'number' },
|
|
17
|
-
{ name: 'passphrase_always_on_device', type: 'boolean' },
|
|
18
|
-
{ name: 'auto_lock_delay_ms', type: 'number' },
|
|
19
|
-
{ name: 'display_rotation', type: 'number' },
|
|
20
|
-
{ name: 'safety_checks', type: 'string' },
|
|
21
|
-
{ name: 'experimental_features', type: 'boolean' },
|
|
22
|
-
]);
|
|
12
|
+
(0, schema_utils_1.Assert)(applySettings_1.ApplySettings, payload);
|
|
23
13
|
this.params = {
|
|
24
14
|
language: payload.language,
|
|
25
15
|
label: payload.label,
|
|
@@ -4,7 +4,9 @@ const AbstractMethod_1 = require("../core/AbstractMethod");
|
|
|
4
4
|
const events_1 = require("../events");
|
|
5
5
|
const paramsValidator_1 = require("./common/paramsValidator");
|
|
6
6
|
const deviceAuthenticityConfig_1 = require("../data/deviceAuthenticityConfig");
|
|
7
|
+
const authenticateDevice_1 = require("../types/api/authenticateDevice");
|
|
7
8
|
const verifyAuthenticityProof_1 = require("./firmware/verifyAuthenticityProof");
|
|
9
|
+
const schema_utils_1 = require("@trezor/schema-utils");
|
|
8
10
|
class AuthenticateDevice extends AbstractMethod_1.AbstractMethod {
|
|
9
11
|
init() {
|
|
10
12
|
this.useEmptyPassphrase = true;
|
|
@@ -13,17 +15,7 @@ class AuthenticateDevice extends AbstractMethod_1.AbstractMethod {
|
|
|
13
15
|
this.useDeviceState = false;
|
|
14
16
|
this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, null, this.firmwareRange);
|
|
15
17
|
const { payload } = this;
|
|
16
|
-
(0,
|
|
17
|
-
{ name: 'config', type: 'object' },
|
|
18
|
-
{ name: 'allowDebugKeys', type: 'boolean' },
|
|
19
|
-
]);
|
|
20
|
-
if (payload.config) {
|
|
21
|
-
(0, paramsValidator_1.validateParams)(payload.config, [{ name: 'timestamp', type: 'string', required: true }]);
|
|
22
|
-
(0, paramsValidator_1.validateParams)(payload.config.T2B1, [
|
|
23
|
-
{ name: 'rootPubKeys', type: 'array', required: true },
|
|
24
|
-
{ name: 'caPubKeys', type: 'array', required: true },
|
|
25
|
-
]);
|
|
26
|
-
}
|
|
18
|
+
(0, schema_utils_1.Assert)(authenticateDevice_1.AuthenticateDeviceParams, payload);
|
|
27
19
|
this.params = {
|
|
28
20
|
config: payload.config,
|
|
29
21
|
allowDebugKeys: payload.allowDebugKeys,
|
|
@@ -2,6 +2,8 @@ import { AbstractMethod } from '../core/AbstractMethod';
|
|
|
2
2
|
import { PROTO } from '../constants';
|
|
3
3
|
export default class AuthorizeCoinjoin extends AbstractMethod<'authorizeCoinjoin', PROTO.AuthorizeCoinJoin> {
|
|
4
4
|
init(): void;
|
|
5
|
-
run(): Promise<
|
|
5
|
+
run(): Promise<{
|
|
6
|
+
message: string;
|
|
7
|
+
}>;
|
|
6
8
|
}
|
|
7
9
|
//# sourceMappingURL=authorizeCoinjoin.d.ts.map
|
|
@@ -4,20 +4,12 @@ const AbstractMethod_1 = require("../core/AbstractMethod");
|
|
|
4
4
|
const paramsValidator_1 = require("./common/paramsValidator");
|
|
5
5
|
const pathUtils_1 = require("../utils/pathUtils");
|
|
6
6
|
const coinInfo_1 = require("../data/coinInfo");
|
|
7
|
+
const schema_utils_1 = require("@trezor/schema-utils");
|
|
8
|
+
const authorizeCoinjoin_1 = require("../types/api/authorizeCoinjoin");
|
|
7
9
|
class AuthorizeCoinjoin extends AbstractMethod_1.AbstractMethod {
|
|
8
10
|
init() {
|
|
9
11
|
const { payload } = this;
|
|
10
|
-
(0,
|
|
11
|
-
{ name: 'path', required: true },
|
|
12
|
-
{ name: 'coordinator', type: 'string', required: true },
|
|
13
|
-
{ name: 'maxRounds', type: 'number', required: true },
|
|
14
|
-
{ name: 'maxCoordinatorFeeRate', type: 'number', required: true },
|
|
15
|
-
{ name: 'maxFeePerKvbyte', type: 'number', required: true },
|
|
16
|
-
{ name: 'coin', type: 'string' },
|
|
17
|
-
{ name: 'scriptType', type: 'string' },
|
|
18
|
-
{ name: 'amountUnit', type: 'uint' },
|
|
19
|
-
{ name: 'preauthorized', type: 'boolean' },
|
|
20
|
-
]);
|
|
12
|
+
(0, schema_utils_1.Assert)(authorizeCoinjoin_1.AuthorizeCoinjoin, payload);
|
|
21
13
|
const address_n = (0, pathUtils_1.validatePath)(payload.path, 3);
|
|
22
14
|
const script_type = payload.scriptType || (0, pathUtils_1.getScriptType)(address_n);
|
|
23
15
|
const coinInfo = (0, coinInfo_1.getBitcoinNetwork)(payload.coin || address_n);
|
|
@@ -2,6 +2,8 @@ import { AbstractMethod } from '../core/AbstractMethod';
|
|
|
2
2
|
export default class BackupDevice extends AbstractMethod<'backupDevice'> {
|
|
3
3
|
init(): void;
|
|
4
4
|
confirmation(): Promise<boolean>;
|
|
5
|
-
run(): Promise<
|
|
5
|
+
run(): Promise<{
|
|
6
|
+
message: string;
|
|
7
|
+
}>;
|
|
6
8
|
}
|
|
7
9
|
//# sourceMappingURL=backupDevice.d.ts.map
|
|
@@ -16,8 +16,10 @@ export default class BinanceGetAddress extends AbstractMethod<'binanceGetAddress
|
|
|
16
16
|
} | undefined;
|
|
17
17
|
confirmation(): Promise<boolean>;
|
|
18
18
|
noBackupConfirmation(): Promise<boolean>;
|
|
19
|
-
_call({ address_n, show_display, chunkify }: Params): Promise<
|
|
20
|
-
|
|
19
|
+
_call({ address_n, show_display, chunkify }: Params): Promise<{
|
|
20
|
+
address: string;
|
|
21
|
+
}>;
|
|
22
|
+
run(): Promise<import("../../../types").Address | import("../../../types").Address[]>;
|
|
21
23
|
}
|
|
22
24
|
export {};
|
|
23
25
|
//# sourceMappingURL=binanceGetAddress.d.ts.map
|
|
@@ -6,6 +6,9 @@ const coinInfo_1 = require("../../../data/coinInfo");
|
|
|
6
6
|
const pathUtils_1 = require("../../../utils/pathUtils");
|
|
7
7
|
const constants_1 = require("../../../constants");
|
|
8
8
|
const events_1 = require("../../../events");
|
|
9
|
+
const schema_utils_1 = require("@trezor/schema-utils");
|
|
10
|
+
const types_1 = require("../../../types");
|
|
11
|
+
const getAddress_1 = require("../../../types/api/getAddress");
|
|
9
12
|
class BinanceGetAddress extends AbstractMethod_1.AbstractMethod {
|
|
10
13
|
constructor() {
|
|
11
14
|
super(...arguments);
|
|
@@ -18,17 +21,8 @@ class BinanceGetAddress extends AbstractMethod_1.AbstractMethod {
|
|
|
18
21
|
const payload = !this.payload.bundle
|
|
19
22
|
? { ...this.payload, bundle: [this.payload] }
|
|
20
23
|
: this.payload;
|
|
21
|
-
(0,
|
|
22
|
-
{ name: 'bundle', type: 'array' },
|
|
23
|
-
{ name: 'useEventListener', type: 'boolean' },
|
|
24
|
-
]);
|
|
24
|
+
(0, schema_utils_1.Assert)((0, types_1.Bundle)(getAddress_1.GetAddress), payload);
|
|
25
25
|
this.params = payload.bundle.map(batch => {
|
|
26
|
-
(0, paramsValidator_1.validateParams)(batch, [
|
|
27
|
-
{ name: 'path', required: true },
|
|
28
|
-
{ name: 'address', type: 'string' },
|
|
29
|
-
{ name: 'showOnTrezor', type: 'boolean' },
|
|
30
|
-
{ name: 'chunkify', type: 'boolean' },
|
|
31
|
-
]);
|
|
32
26
|
const path = (0, pathUtils_1.validatePath)(batch.path, 3);
|
|
33
27
|
return {
|
|
34
28
|
address_n: path,
|
|
@@ -6,6 +6,14 @@ export default class BinanceGetPublicKey extends AbstractMethod<'binanceGetPubli
|
|
|
6
6
|
init(): void;
|
|
7
7
|
get info(): string;
|
|
8
8
|
confirmation(): Promise<boolean>;
|
|
9
|
-
run(): Promise<
|
|
9
|
+
run(): Promise<{
|
|
10
|
+
path: number[];
|
|
11
|
+
publicKey: string;
|
|
12
|
+
serializedPath: string;
|
|
13
|
+
} | {
|
|
14
|
+
path: number[];
|
|
15
|
+
publicKey: string;
|
|
16
|
+
serializedPath: string;
|
|
17
|
+
}[]>;
|
|
10
18
|
}
|
|
11
19
|
//# sourceMappingURL=binanceGetPublicKey.d.ts.map
|
|
@@ -5,6 +5,8 @@ const paramsValidator_1 = require("../../common/paramsValidator");
|
|
|
5
5
|
const coinInfo_1 = require("../../../data/coinInfo");
|
|
6
6
|
const pathUtils_1 = require("../../../utils/pathUtils");
|
|
7
7
|
const events_1 = require("../../../events");
|
|
8
|
+
const schema_utils_1 = require("@trezor/schema-utils");
|
|
9
|
+
const types_1 = require("../../../types");
|
|
8
10
|
class BinanceGetPublicKey extends AbstractMethod_1.AbstractMethod {
|
|
9
11
|
init() {
|
|
10
12
|
this.requiredPermissions = ['read'];
|
|
@@ -13,12 +15,8 @@ class BinanceGetPublicKey extends AbstractMethod_1.AbstractMethod {
|
|
|
13
15
|
const payload = !this.payload.bundle
|
|
14
16
|
? { ...this.payload, bundle: [this.payload] }
|
|
15
17
|
: this.payload;
|
|
16
|
-
(0,
|
|
18
|
+
(0, schema_utils_1.Assert)((0, types_1.Bundle)(types_1.GetPublicKey), payload);
|
|
17
19
|
this.params = payload.bundle.map(batch => {
|
|
18
|
-
(0, paramsValidator_1.validateParams)(batch, [
|
|
19
|
-
{ name: 'path', required: true },
|
|
20
|
-
{ name: 'showOnTrezor', type: 'boolean' },
|
|
21
|
-
]);
|
|
22
20
|
const path = (0, pathUtils_1.validatePath)(batch.path, 3);
|
|
23
21
|
return {
|
|
24
22
|
address_n: path,
|
|
@@ -8,7 +8,10 @@ type Params = {
|
|
|
8
8
|
export default class BinanceSignTransaction extends AbstractMethod<'binanceSignTransaction', Params> {
|
|
9
9
|
init(): void;
|
|
10
10
|
get info(): string;
|
|
11
|
-
run(): Promise<
|
|
11
|
+
run(): Promise<{
|
|
12
|
+
signature: string;
|
|
13
|
+
public_key: string;
|
|
14
|
+
}>;
|
|
12
15
|
}
|
|
13
16
|
export {};
|
|
14
17
|
//# sourceMappingURL=binanceSignTransaction.d.ts.map
|
|
@@ -6,22 +6,21 @@ const paramsValidator_1 = require("../../common/paramsValidator");
|
|
|
6
6
|
const coinInfo_1 = require("../../../data/coinInfo");
|
|
7
7
|
const pathUtils_1 = require("../../../utils/pathUtils");
|
|
8
8
|
const helper = tslib_1.__importStar(require("../binanceSignTx"));
|
|
9
|
+
const binance_1 = require("../../../types/api/binance");
|
|
10
|
+
const schema_utils_1 = require("@trezor/schema-utils");
|
|
9
11
|
class BinanceSignTransaction extends AbstractMethod_1.AbstractMethod {
|
|
10
12
|
init() {
|
|
13
|
+
var _a;
|
|
11
14
|
this.requiredPermissions = ['read', 'write'];
|
|
12
15
|
this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, (0, coinInfo_1.getMiscNetwork)('BNB'), this.firmwareRange);
|
|
13
16
|
const { payload } = this;
|
|
14
|
-
(0,
|
|
15
|
-
{ name: 'path', type: 'string', required: true },
|
|
16
|
-
{ name: 'transaction', required: true },
|
|
17
|
-
{ name: 'chunkify', type: 'boolean' },
|
|
18
|
-
]);
|
|
17
|
+
(0, schema_utils_1.Assert)(binance_1.BinanceSignTransaction, payload);
|
|
19
18
|
const path = (0, pathUtils_1.validatePath)(payload.path, 3);
|
|
20
19
|
const transaction = helper.validate(payload.transaction);
|
|
21
20
|
this.params = {
|
|
22
21
|
path,
|
|
23
22
|
transaction,
|
|
24
|
-
chunkify:
|
|
23
|
+
chunkify: (_a = payload.chunkify) !== null && _a !== void 0 ? _a : false,
|
|
25
24
|
};
|
|
26
25
|
}
|
|
27
26
|
get info() {
|
|
@@ -1,6 +1,87 @@
|
|
|
1
1
|
import { PROTO } from '../../constants';
|
|
2
|
-
import
|
|
2
|
+
import { BinanceSDKTransaction, BinancePreparedTransaction } from '../../types/api/binance';
|
|
3
3
|
import type { TypedCall } from '../../device/DeviceCommands';
|
|
4
|
-
export declare const validate: (tx: BinanceSDKTransaction) =>
|
|
5
|
-
|
|
4
|
+
export declare const validate: (tx: BinanceSDKTransaction) => {
|
|
5
|
+
account_number?: number | undefined;
|
|
6
|
+
memo?: string | undefined;
|
|
7
|
+
sequence?: number | undefined;
|
|
8
|
+
source?: number | undefined;
|
|
9
|
+
transfer?: {
|
|
10
|
+
chunkify?: boolean | undefined;
|
|
11
|
+
inputs: {
|
|
12
|
+
address: string;
|
|
13
|
+
coins: {
|
|
14
|
+
amount: string | number;
|
|
15
|
+
denom: string;
|
|
16
|
+
}[];
|
|
17
|
+
}[];
|
|
18
|
+
outputs: {
|
|
19
|
+
address: string;
|
|
20
|
+
coins: {
|
|
21
|
+
amount: string | number;
|
|
22
|
+
denom: string;
|
|
23
|
+
}[];
|
|
24
|
+
}[];
|
|
25
|
+
} | undefined;
|
|
26
|
+
placeOrder?: {
|
|
27
|
+
symbol?: string | undefined;
|
|
28
|
+
id?: string | undefined;
|
|
29
|
+
sender?: string | undefined;
|
|
30
|
+
ordertype: PROTO.BinanceOrderType;
|
|
31
|
+
price: number;
|
|
32
|
+
quantity: number;
|
|
33
|
+
side: PROTO.BinanceOrderSide;
|
|
34
|
+
timeinforce: PROTO.BinanceTimeInForce;
|
|
35
|
+
} | undefined;
|
|
36
|
+
cancelOrder?: {
|
|
37
|
+
symbol?: string | undefined;
|
|
38
|
+
sender?: string | undefined;
|
|
39
|
+
refid?: string | undefined;
|
|
40
|
+
} | undefined;
|
|
41
|
+
chain_id: string;
|
|
42
|
+
} & {
|
|
43
|
+
account_number: number;
|
|
44
|
+
sequence: number;
|
|
45
|
+
source: number;
|
|
46
|
+
messages: (({
|
|
47
|
+
chunkify?: boolean | undefined;
|
|
48
|
+
inputs: {
|
|
49
|
+
address: string;
|
|
50
|
+
coins: {
|
|
51
|
+
amount: string | number;
|
|
52
|
+
denom: string;
|
|
53
|
+
}[];
|
|
54
|
+
}[];
|
|
55
|
+
outputs: {
|
|
56
|
+
address: string;
|
|
57
|
+
coins: {
|
|
58
|
+
amount: string | number;
|
|
59
|
+
denom: string;
|
|
60
|
+
}[];
|
|
61
|
+
}[];
|
|
62
|
+
} & {
|
|
63
|
+
type: "BinanceTransferMsg";
|
|
64
|
+
}) | ({
|
|
65
|
+
symbol?: string | undefined;
|
|
66
|
+
id?: string | undefined;
|
|
67
|
+
sender?: string | undefined;
|
|
68
|
+
ordertype: PROTO.BinanceOrderType;
|
|
69
|
+
price: number;
|
|
70
|
+
quantity: number;
|
|
71
|
+
side: PROTO.BinanceOrderSide;
|
|
72
|
+
timeinforce: PROTO.BinanceTimeInForce;
|
|
73
|
+
} & {
|
|
74
|
+
type: "BinanceOrderMsg";
|
|
75
|
+
}) | ({
|
|
76
|
+
symbol?: string | undefined;
|
|
77
|
+
sender?: string | undefined;
|
|
78
|
+
refid?: string | undefined;
|
|
79
|
+
} & {
|
|
80
|
+
type: "BinanceCancelMsg";
|
|
81
|
+
}))[];
|
|
82
|
+
};
|
|
83
|
+
export declare const signTx: (typedCall: TypedCall, address_n: number[], tx: BinancePreparedTransaction, chunkify?: boolean) => Promise<{
|
|
84
|
+
signature: string;
|
|
85
|
+
public_key: string;
|
|
86
|
+
}>;
|
|
6
87
|
//# sourceMappingURL=binanceSignTx.d.ts.map
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.signTx = exports.validate = void 0;
|
|
4
4
|
const constants_1 = require("../../constants");
|
|
5
|
-
const
|
|
5
|
+
const binance_1 = require("../../types/api/binance");
|
|
6
|
+
const schema_utils_1 = require("@trezor/schema-utils");
|
|
6
7
|
const processTxRequest = async (typedCall, messages, index) => {
|
|
7
8
|
const { type, ...params } = messages[index];
|
|
8
9
|
const lastOp = index + 1 >= messages.length;
|
|
@@ -15,14 +16,7 @@ const processTxRequest = async (typedCall, messages, index) => {
|
|
|
15
16
|
return processTxRequest(typedCall, messages, index);
|
|
16
17
|
};
|
|
17
18
|
const validate = (tx) => {
|
|
18
|
-
(0,
|
|
19
|
-
{ name: 'chain_id', type: 'string', required: true },
|
|
20
|
-
{ name: 'account_number', type: 'number' },
|
|
21
|
-
{ name: 'memo', type: 'string' },
|
|
22
|
-
{ name: 'sequence', type: 'number' },
|
|
23
|
-
{ name: 'source', type: 'number' },
|
|
24
|
-
{ name: 'message', type: 'object' },
|
|
25
|
-
]);
|
|
19
|
+
(0, schema_utils_1.Assert)(binance_1.BinanceSDKTransaction, tx);
|
|
26
20
|
const preparedTx = {
|
|
27
21
|
chain_id: tx.chain_id,
|
|
28
22
|
account_number: tx.account_number || 0,
|
|
@@ -33,35 +27,18 @@ const validate = (tx) => {
|
|
|
33
27
|
};
|
|
34
28
|
const { transfer, placeOrder, cancelOrder } = tx;
|
|
35
29
|
if (transfer) {
|
|
36
|
-
(0, paramsValidator_1.validateParams)(transfer, [
|
|
37
|
-
{ name: 'inputs', type: 'array', required: true },
|
|
38
|
-
{ name: 'outputs', type: 'array', required: true },
|
|
39
|
-
]);
|
|
40
30
|
preparedTx.messages.push({
|
|
41
31
|
...transfer,
|
|
42
32
|
type: 'BinanceTransferMsg',
|
|
43
33
|
});
|
|
44
34
|
}
|
|
45
35
|
if (placeOrder) {
|
|
46
|
-
(0, paramsValidator_1.validateParams)(placeOrder, [
|
|
47
|
-
{ name: 'id', type: 'string' },
|
|
48
|
-
{ name: 'ordertype', type: 'number' },
|
|
49
|
-
{ name: 'price', type: 'number' },
|
|
50
|
-
{ name: 'quantity', type: 'number' },
|
|
51
|
-
{ name: 'sender', type: 'string' },
|
|
52
|
-
{ name: 'side', type: 'number' },
|
|
53
|
-
]);
|
|
54
36
|
preparedTx.messages.push({
|
|
55
37
|
...placeOrder,
|
|
56
38
|
type: 'BinanceOrderMsg',
|
|
57
39
|
});
|
|
58
40
|
}
|
|
59
41
|
if (cancelOrder) {
|
|
60
|
-
(0, paramsValidator_1.validateParams)(cancelOrder, [
|
|
61
|
-
{ name: 'refid', type: 'string', required: true },
|
|
62
|
-
{ name: 'sender', type: 'string', required: true },
|
|
63
|
-
{ name: 'symbol', type: 'string', required: true },
|
|
64
|
-
]);
|
|
65
42
|
preparedTx.messages.push({
|
|
66
43
|
...cancelOrder,
|
|
67
44
|
type: 'BinanceCancelMsg',
|
|
@@ -7,8 +7,20 @@ export declare class FeeLevels {
|
|
|
7
7
|
longTermFeeRate?: string;
|
|
8
8
|
blocks: Blocks;
|
|
9
9
|
constructor(coinInfo: CoinInfo);
|
|
10
|
-
loadMisc(blockchain: Blockchain): Promise<
|
|
11
|
-
|
|
10
|
+
loadMisc(blockchain: Blockchain): Promise<{
|
|
11
|
+
feeLimit?: string | undefined;
|
|
12
|
+
feePerTx?: string | undefined;
|
|
13
|
+
label: "high" | "normal" | "economy" | "low" | "custom";
|
|
14
|
+
feePerUnit: string;
|
|
15
|
+
blocks: number;
|
|
16
|
+
}[]>;
|
|
17
|
+
load(blockchain: Blockchain): Promise<{
|
|
18
|
+
feeLimit?: string | undefined;
|
|
19
|
+
feePerTx?: string | undefined;
|
|
20
|
+
label: "high" | "normal" | "economy" | "low" | "custom";
|
|
21
|
+
feePerUnit: string;
|
|
22
|
+
blocks: number;
|
|
23
|
+
}[]>;
|
|
12
24
|
updateCustomFee(feePerUnit: string): void;
|
|
13
25
|
}
|
|
14
26
|
export {};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ComposeOutput } from '@trezor/utxo-lib';
|
|
2
2
|
import { FeeLevels } from './Fees';
|
|
3
3
|
import { Blockchain } from '../../backend/BlockchainLink';
|
|
4
|
-
import type { BitcoinNetworkInfo, DiscoveryAccount
|
|
4
|
+
import type { BitcoinNetworkInfo, DiscoveryAccount } from '../../types';
|
|
5
5
|
import type { ComposeUtxo, ComposedInputs, ComposeResult } from '../../types/api/composeTransaction';
|
|
6
6
|
type Options = {
|
|
7
7
|
account: DiscoveryAccount;
|
|
@@ -27,7 +27,18 @@ export declare class TransactionComposer {
|
|
|
27
27
|
init(blockchain: Blockchain): Promise<void>;
|
|
28
28
|
composeAllFeeLevels(): boolean;
|
|
29
29
|
composeCustomFee(fee: string): void;
|
|
30
|
-
getFeeLevelList():
|
|
30
|
+
getFeeLevelList(): ({
|
|
31
|
+
feePerByte?: undefined;
|
|
32
|
+
name: string;
|
|
33
|
+
fee: "0";
|
|
34
|
+
disabled: true;
|
|
35
|
+
} | {
|
|
36
|
+
name: string;
|
|
37
|
+
fee: string;
|
|
38
|
+
feePerByte: string;
|
|
39
|
+
minutes: number;
|
|
40
|
+
total: string;
|
|
41
|
+
})[];
|
|
31
42
|
compose(feeRate: string): ComposeResult;
|
|
32
43
|
dispose(): void;
|
|
33
44
|
}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { Transaction as BitcoinJsTransaction, Network } from '@trezor/utxo-lib';
|
|
2
2
|
import type { CoinInfo, AccountAddresses, AccountTransaction, BitcoinNetworkInfo } from '../../types';
|
|
3
3
|
import type { RefTransaction, TransactionOptions } from '../../types/api/bitcoin';
|
|
4
|
-
import
|
|
4
|
+
import { PROTO } from '../../constants';
|
|
5
5
|
export declare const requireReferencedTransactions: (inputs: PROTO.TxInputType[], options?: TransactionOptions, coinInfo?: CoinInfo) => boolean;
|
|
6
6
|
export declare const getReferencedTransactions: (inputs: PROTO.TxInputType[]) => string[];
|
|
7
7
|
export declare const getOrigTransactions: (inputs: PROTO.TxInputType[], outputs: PROTO.TxOutputType[]) => string[];
|
|
8
|
-
export declare const parseTransactionHexes: (network?: Network) => (hexes: string[]) => (import("@trezor/utxo-lib/lib/transaction/base").TransactionBase<undefined> | import("@trezor/utxo-lib/lib/transaction/base").TransactionBase<import("
|
|
8
|
+
export declare const parseTransactionHexes: (network?: Network) => (hexes: string[]) => (import("@trezor/utxo-lib/lib/transaction/base").TransactionBase<undefined> | import("@trezor/utxo-lib/lib/transaction/base").TransactionBase<import("@trezor/utxo-lib/lib/transaction/dash").DashSpecific> | import("@trezor/utxo-lib/lib/transaction/base").TransactionBase<import("@trezor/utxo-lib/lib/transaction/zcash").ZcashSpecific>)[];
|
|
9
9
|
export declare const transformOrigTransactions: (txs: BitcoinJsTransaction[], coinInfo: BitcoinNetworkInfo, currentInputs: PROTO.TxInputType[], addresses: AccountAddresses) => RefTransaction[];
|
|
10
10
|
export declare const transformReferencedTransaction: (tx: BitcoinJsTransaction) => RefTransaction;
|
|
11
11
|
export declare const transformReferencedTransactions: (txs: BitcoinJsTransaction[]) => RefTransaction[];
|
package/lib/api/bitcoin/refTx.js
CHANGED
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.validateReferencedTransactions = exports.transformReferencedTransactions = exports.transformReferencedTransaction = exports.transformOrigTransactions = exports.parseTransactionHexes = exports.getOrigTransactions = exports.getReferencedTransactions = exports.requireReferencedTransactions = void 0;
|
|
4
|
+
const tslib_1 = require("tslib");
|
|
4
5
|
const utxo_lib_1 = require("@trezor/utxo-lib");
|
|
5
|
-
const
|
|
6
|
+
const bufferUtils = tslib_1.__importStar(require("@trezor/utils/lib/bufferUtils"));
|
|
6
7
|
const pathUtils_1 = require("../../utils/pathUtils");
|
|
7
|
-
const paramsValidator_1 = require("../common/paramsValidator");
|
|
8
8
|
const errors_1 = require("../../constants/errors");
|
|
9
|
+
const constants_1 = require("../../constants");
|
|
10
|
+
const schema_utils_1 = require("@trezor/schema-utils");
|
|
9
11
|
const requireReferencedTransactions = (inputs, options = {}, coinInfo) => {
|
|
10
12
|
if ((coinInfo === null || coinInfo === void 0 ? void 0 : coinInfo.shortcut) === 'ZEC' || (coinInfo === null || coinInfo === void 0 ? void 0 : coinInfo.shortcut) === 'TAZ') {
|
|
11
13
|
return !(options.version && options.version >= 5);
|
|
@@ -75,7 +77,7 @@ const parseOutputScript = (output, network) => {
|
|
|
75
77
|
const transformOrigTransaction = (tx, coinInfo, currentInputs, addresses) => {
|
|
76
78
|
const inputsMap = (input, i) => {
|
|
77
79
|
var _a;
|
|
78
|
-
const prev_hash =
|
|
80
|
+
const prev_hash = bufferUtils.reverseBuffer(input.hash).toString('hex');
|
|
79
81
|
const currentInput = currentInputs.find(inp => inp.prev_hash === prev_hash && inp.prev_index === input.index);
|
|
80
82
|
if (!(currentInput === null || currentInput === void 0 ? void 0 : currentInput.address_n)) {
|
|
81
83
|
throw (0, errors_1.TypedError)('Method_InvalidParameter', `transformOrigTransactions: invalid input at ${tx.getId()} [${i}]`);
|
|
@@ -149,7 +151,7 @@ const transformReferencedTransaction = (tx) => {
|
|
|
149
151
|
const inputsMap = (input) => ({
|
|
150
152
|
prev_index: input.index,
|
|
151
153
|
sequence: input.sequence,
|
|
152
|
-
prev_hash:
|
|
154
|
+
prev_hash: bufferUtils.reverseBuffer(input.hash).toString('hex'),
|
|
153
155
|
script_sig: input.script.toString('hex'),
|
|
154
156
|
});
|
|
155
157
|
const binOutputsMap = (output) => ({
|
|
@@ -187,29 +189,25 @@ const validateReferencedTransactions = ({ transactions, inputs, outputs, address
|
|
|
187
189
|
}
|
|
188
190
|
return (0, exports.transformReferencedTransaction)(srcTx);
|
|
189
191
|
}
|
|
190
|
-
(0,
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
]);
|
|
192
|
+
(0, schema_utils_1.Assert)(schema_utils_1.Type.Object({
|
|
193
|
+
hash: schema_utils_1.Type.String(),
|
|
194
|
+
version: schema_utils_1.Type.Number(),
|
|
195
|
+
lock_time: schema_utils_1.Type.Number(),
|
|
196
|
+
extra_data: schema_utils_1.Type.Optional(schema_utils_1.Type.String()),
|
|
197
|
+
timestamp: schema_utils_1.Type.Optional(schema_utils_1.Type.Number()),
|
|
198
|
+
version_group_id: schema_utils_1.Type.Optional(schema_utils_1.Type.Number()),
|
|
199
|
+
}), tx);
|
|
199
200
|
if (origTxs.includes(tx.hash)) {
|
|
200
|
-
(0,
|
|
201
|
+
(0, schema_utils_1.Assert)(schema_utils_1.Type.Object({
|
|
202
|
+
inputs: schema_utils_1.Type.Array(constants_1.PROTO.TxInput, { minItems: 1 }),
|
|
203
|
+
outputs: schema_utils_1.Type.Array(constants_1.PROTO.TxOutputType, { minItems: 1 }),
|
|
204
|
+
}), tx);
|
|
201
205
|
return tx;
|
|
202
206
|
}
|
|
203
|
-
(0,
|
|
204
|
-
|
|
205
|
-
(
|
|
206
|
-
|
|
207
|
-
{ name: 'prev_index', type: 'number', required: true },
|
|
208
|
-
{ name: 'script_sig', type: 'string', required: true },
|
|
209
|
-
{ name: 'sequence', type: 'number', required: true },
|
|
210
|
-
{ name: 'decred_tree', type: 'number' },
|
|
211
|
-
]);
|
|
212
|
-
});
|
|
207
|
+
(0, schema_utils_1.Assert)(schema_utils_1.Type.Object({
|
|
208
|
+
inputs: schema_utils_1.Type.Array(constants_1.PROTO.PrevInput, { minItems: 1 }),
|
|
209
|
+
bin_outputs: schema_utils_1.Type.Array(constants_1.PROTO.TxOutputBinType, { minItems: 1 }),
|
|
210
|
+
}), tx);
|
|
213
211
|
return {
|
|
214
212
|
hash: tx.hash,
|
|
215
213
|
version: tx.version,
|
|
@@ -2,7 +2,7 @@ import { PROTO } from '../../constants';
|
|
|
2
2
|
import type { BitcoinNetworkInfo } from '../../types';
|
|
3
3
|
import type { DeviceCommands } from '../../device/DeviceCommands';
|
|
4
4
|
type GetHDNode = DeviceCommands['getHDNode'];
|
|
5
|
-
export declare const verifyTx: (getHDNode: GetHDNode, inputs: PROTO.TxInputType[], outputs: PROTO.TxOutputType[], serializedTx: string, coinInfo: BitcoinNetworkInfo, unlockPath?: PROTO.UnlockPath) => Promise<import("
|
|
5
|
+
export declare const verifyTx: (getHDNode: GetHDNode, inputs: PROTO.TxInputType[], outputs: PROTO.TxOutputType[], serializedTx: string, coinInfo: BitcoinNetworkInfo, unlockPath?: PROTO.UnlockPath) => Promise<import("@trezor/utxo-lib/lib/transaction/base").TransactionBase<undefined> | import("@trezor/utxo-lib/lib/transaction/base").TransactionBase<import("@trezor/utxo-lib/lib/transaction/dash").DashSpecific> | import("@trezor/utxo-lib/lib/transaction/base").TransactionBase<import("@trezor/utxo-lib/lib/transaction/zcash").ZcashSpecific>>;
|
|
6
6
|
export declare const verifyTicketTx: (getHDNode: GetHDNode, inputs: PROTO.TxInputType[], outputs: PROTO.TxOutputType[], serializedTx: string, coinInfo: BitcoinNetworkInfo) => Promise<void>;
|
|
7
7
|
export {};
|
|
8
8
|
//# sourceMappingURL=signtxVerify.d.ts.map
|