@trezor/connect 9.5.5 → 9.6.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +47 -4
- package/README.md +1 -1
- package/lib/api/cardano/api/cardanoSignTransaction.d.ts +2 -2
- package/lib/api/discoverAccounts.d.ts +33 -0
- package/lib/api/discoverAccounts.js +180 -0
- package/lib/api/eos/eosSignTx.d.ts +4 -4
- package/lib/api/ethereum/ethereumSignTx.js +8 -6
- package/lib/api/firmware/getBinary.d.ts +1 -1
- package/lib/api/getAccountInfo.d.ts +4 -0
- package/lib/api/getAccountInfo.js +2 -0
- package/lib/api/getFeatures.d.ts +1 -1
- package/lib/api/index.d.ts +1 -0
- package/lib/api/index.js +4 -1
- package/lib/api/nem/nemSignTx.d.ts +9 -9
- package/lib/api/resetDevice.d.ts +1 -0
- package/lib/api/resetDevice.js +4 -0
- package/lib/api/signTransaction.d.ts +12 -12
- package/lib/api/solana/api/solanaSignTransaction.d.ts +1 -0
- package/lib/api/solana/api/solanaSignTransaction.js +12 -0
- package/lib/api/solana/solanaDefinitions.d.ts +8 -0
- package/lib/api/solana/solanaDefinitions.js +39 -0
- package/lib/api/solana/solanaUtils.js +1 -1
- package/lib/api/stellar/stellarSignTx.d.ts +1 -1
- package/lib/api/tezos/tezosSignTx.d.ts +6 -6
- package/lib/backend/Blockchain.js +6 -1
- package/lib/constants/network.d.ts +1 -1
- package/lib/constants/network.js +0 -1
- package/lib/core/method.native.js +0 -1
- package/lib/data/defaultFeeLevels.js +9 -0
- package/lib/data/downloadReleasesMetadata.d.ts +1 -1
- package/lib/data/firmwareInfo.d.ts +2 -2
- package/lib/data/version.d.ts +1 -1
- package/lib/data/version.js +1 -1
- package/lib/device/Device.d.ts +5 -10
- package/lib/device/Device.js +3 -2
- package/lib/device/DeviceCommands.d.ts +9 -8
- package/lib/device/DeviceCommands.js +10 -5
- package/lib/device/DeviceCurrentSession.d.ts +142 -263
- package/lib/device/DeviceCurrentSession.js +9 -9
- package/lib/device/checkFirmwareRevision.d.ts +1 -1
- package/lib/device/checkFirmwareRevision.js +1 -1
- package/lib/factory.js +1 -7
- package/lib/impl/dynamic.d.ts +2 -0
- package/lib/impl/dynamic.js +27 -8
- package/lib/tsconfig.lib.tsbuildinfo +1 -1
- package/lib/types/api/discoverAccounts.d.ts +222 -0
- package/lib/types/api/discoverAccounts.js +57 -0
- package/lib/types/api/index.d.ts +2 -6
- package/lib/types/firmware.d.ts +1 -17
- package/lib/types/index.d.ts +0 -1
- package/lib/types/index.js +0 -1
- package/lib/types/settings.d.ts +1 -1
- package/lib/utils/deviceFeaturesUtils.js +3 -0
- package/lib/utils/firmwareUtils.d.ts +2 -2
- package/lib/workers/workers-browser.d.ts +2 -1
- package/lib/workers/workers-browser.js +3 -1
- package/lib/workers/workers.d.ts +2 -1
- package/lib/workers/workers.js +3 -1
- package/lib/workers/workers.native.d.ts +2 -1
- package/lib/workers/workers.native.js +3 -1
- package/package.json +16 -16
- package/lib/api/binance/api/binanceGetAddress.d.ts +0 -26
- package/lib/api/binance/api/binanceGetAddress.js +0 -109
- package/lib/api/binance/api/binanceGetPublicKey.d.ts +0 -21
- package/lib/api/binance/api/binanceGetPublicKey.js +0 -63
- package/lib/api/binance/api/binanceSignTransaction.d.ts +0 -17
- package/lib/api/binance/api/binanceSignTransaction.js +0 -34
- package/lib/api/binance/api/index.d.ts +0 -4
- package/lib/api/binance/api/index.js +0 -11
- package/lib/api/binance/binanceSignTx.d.ts +0 -87
- package/lib/api/binance/binanceSignTx.js +0 -69
- package/lib/types/api/binance/index.d.ts +0 -204
- package/lib/types/api/binance/index.js +0 -51
- package/lib/types/api/binanceGetAddress.d.ts +0 -4
- package/lib/types/api/binanceGetAddress.js +0 -3
- package/lib/types/api/binanceGetPublicKey.d.ts +0 -4
- package/lib/types/api/binanceGetPublicKey.js +0 -3
- package/lib/types/api/binanceSignTransaction.d.ts +0 -5
- package/lib/types/api/binanceSignTransaction.js +0 -3
package/lib/types/index.js
CHANGED
|
@@ -11,7 +11,6 @@ tslib_1.__exportStar(require("./firmware"), exports);
|
|
|
11
11
|
tslib_1.__exportStar(require("./params"), exports);
|
|
12
12
|
tslib_1.__exportStar(require("./settings"), exports);
|
|
13
13
|
tslib_1.__exportStar(require("./api/cardano"), exports);
|
|
14
|
-
tslib_1.__exportStar(require("./api/binance"), exports);
|
|
15
14
|
tslib_1.__exportStar(require("./api/bitcoin"), exports);
|
|
16
15
|
tslib_1.__exportStar(require("./api/eos"), exports);
|
|
17
16
|
tslib_1.__exportStar(require("./api/ripple"), exports);
|
package/lib/types/settings.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import type { ThpCredentials, ThpPairingMethod } from '@trezor/protocol';
|
|
|
3
3
|
import type { Transport } from '@trezor/transport';
|
|
4
4
|
export type { SystemInfo } from '@trezor/connect-common';
|
|
5
5
|
export interface Manifest {
|
|
6
|
-
appName
|
|
6
|
+
appName: string;
|
|
7
7
|
appIcon?: string;
|
|
8
8
|
appUrl: string;
|
|
9
9
|
email: string;
|
|
@@ -78,6 +78,9 @@ const getUnavailableCapabilities = (features, coins) => {
|
|
|
78
78
|
if (info.shortcut === 'XRP' || info.shortcut === 'tXRP') {
|
|
79
79
|
return !capabilities.includes('Capability_Ripple');
|
|
80
80
|
}
|
|
81
|
+
if (info.shortcut === 'XLM' || info.shortcut === 'tXLM') {
|
|
82
|
+
return !capabilities.includes('Capability_Stellar');
|
|
83
|
+
}
|
|
81
84
|
if (info.shortcut === 'SOL' || info.shortcut === 'DSOL') {
|
|
82
85
|
return !capabilities.includes('Capability_Solana');
|
|
83
86
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { DeviceModelInternal } from '@trezor/device-utils';
|
|
2
|
-
import { Features,
|
|
1
|
+
import type { DeviceModelInternal, FirmwareRelease } from '@trezor/device-utils';
|
|
2
|
+
import { Features, FirmwareType, StrictFeatures, VersionArray } from '../types';
|
|
3
3
|
export declare const isStrictFeatures: (extFeatures: Features) => extFeatures is StrictFeatures;
|
|
4
4
|
export declare const isValidReleases: (extReleases: any) => extReleases is FirmwareRelease[];
|
|
5
5
|
export declare const filterSafeListByBootloader: (releasesList: FirmwareRelease[], bootloaderVersion: VersionArray) => FirmwareRelease[];
|
|
@@ -2,8 +2,9 @@ import type { BaseWorker } from '@trezor/blockchain-link/lib/workers/baseWorker'
|
|
|
2
2
|
import BlockbookWorker from '@trezor/blockchain-link/lib/workers/blockbook';
|
|
3
3
|
import BlockfrostWorker from '@trezor/blockchain-link/lib/workers/blockfrost';
|
|
4
4
|
import RippleWorker from '@trezor/blockchain-link/lib/workers/ripple';
|
|
5
|
+
import StellarWorker from '@trezor/blockchain-link/lib/workers/stellar';
|
|
5
6
|
type WorkerAsyncImporter = () => Promise<BaseWorker<unknown>>;
|
|
6
7
|
declare const SolanaWorker: WorkerAsyncImporter;
|
|
7
8
|
declare const ElectrumWorker: undefined;
|
|
8
|
-
export { BlockbookWorker, RippleWorker, BlockfrostWorker, ElectrumWorker, SolanaWorker };
|
|
9
|
+
export { BlockbookWorker, RippleWorker, BlockfrostWorker, ElectrumWorker, SolanaWorker, StellarWorker, };
|
|
9
10
|
//# sourceMappingURL=workers-browser.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SolanaWorker = exports.ElectrumWorker = exports.BlockfrostWorker = exports.RippleWorker = exports.BlockbookWorker = void 0;
|
|
3
|
+
exports.StellarWorker = exports.SolanaWorker = exports.ElectrumWorker = exports.BlockfrostWorker = exports.RippleWorker = exports.BlockbookWorker = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const blockbook_1 = tslib_1.__importDefault(require("@trezor/blockchain-link/lib/workers/blockbook"));
|
|
6
6
|
exports.BlockbookWorker = blockbook_1.default;
|
|
@@ -8,6 +8,8 @@ const blockfrost_1 = tslib_1.__importDefault(require("@trezor/blockchain-link/li
|
|
|
8
8
|
exports.BlockfrostWorker = blockfrost_1.default;
|
|
9
9
|
const ripple_1 = tslib_1.__importDefault(require("@trezor/blockchain-link/lib/workers/ripple"));
|
|
10
10
|
exports.RippleWorker = ripple_1.default;
|
|
11
|
+
const stellar_1 = tslib_1.__importDefault(require("@trezor/blockchain-link/lib/workers/stellar"));
|
|
12
|
+
exports.StellarWorker = stellar_1.default;
|
|
11
13
|
const SolanaWorker = () => Promise.resolve().then(() => tslib_1.__importStar(require('@trezor/blockchain-link/lib/workers/solana'))).then(w => w.default());
|
|
12
14
|
exports.SolanaWorker = SolanaWorker;
|
|
13
15
|
const ElectrumWorker = undefined;
|
package/lib/workers/workers.d.ts
CHANGED
|
@@ -5,5 +5,6 @@ declare const RippleWorker: WorkerAsyncImporter;
|
|
|
5
5
|
declare const BlockfrostWorker: WorkerAsyncImporter;
|
|
6
6
|
declare const ElectrumWorker: WorkerAsyncImporter;
|
|
7
7
|
declare const SolanaWorker: WorkerAsyncImporter;
|
|
8
|
-
|
|
8
|
+
declare const StellarWorker: WorkerAsyncImporter;
|
|
9
|
+
export { BlockbookWorker, RippleWorker, BlockfrostWorker, ElectrumWorker, SolanaWorker, StellarWorker, };
|
|
9
10
|
//# sourceMappingURL=workers.d.ts.map
|
package/lib/workers/workers.js
CHANGED
|
@@ -33,7 +33,7 @@ var __importStar = (this && this.__importStar) || (function () {
|
|
|
33
33
|
};
|
|
34
34
|
})();
|
|
35
35
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.SolanaWorker = exports.ElectrumWorker = exports.BlockfrostWorker = exports.RippleWorker = exports.BlockbookWorker = void 0;
|
|
36
|
+
exports.StellarWorker = exports.SolanaWorker = exports.ElectrumWorker = exports.BlockfrostWorker = exports.RippleWorker = exports.BlockbookWorker = void 0;
|
|
37
37
|
const BlockbookWorker = () => Promise.resolve().then(() => __importStar(require('@trezor/blockchain-link/lib/workers/blockbook'))).then(w => w.default());
|
|
38
38
|
exports.BlockbookWorker = BlockbookWorker;
|
|
39
39
|
const RippleWorker = () => Promise.resolve().then(() => __importStar(require('@trezor/blockchain-link/lib/workers/ripple'))).then(w => w.default());
|
|
@@ -44,4 +44,6 @@ const ElectrumWorker = () => Promise.resolve().then(() => __importStar(require('
|
|
|
44
44
|
exports.ElectrumWorker = ElectrumWorker;
|
|
45
45
|
const SolanaWorker = () => Promise.resolve().then(() => __importStar(require('@trezor/blockchain-link/lib/workers/solana'))).then(w => w.default());
|
|
46
46
|
exports.SolanaWorker = SolanaWorker;
|
|
47
|
+
const StellarWorker = () => Promise.resolve().then(() => __importStar(require('@trezor/blockchain-link/lib/workers/stellar'))).then(w => w.default());
|
|
48
|
+
exports.StellarWorker = StellarWorker;
|
|
47
49
|
//# sourceMappingURL=workers.js.map
|
|
@@ -2,6 +2,7 @@ import BlockbookWorker from '@trezor/blockchain-link/lib/workers/blockbook';
|
|
|
2
2
|
import BlockfrostWorker from '@trezor/blockchain-link/lib/workers/blockfrost';
|
|
3
3
|
import RippleWorker from '@trezor/blockchain-link/lib/workers/ripple';
|
|
4
4
|
import SolanaWorker from '@trezor/blockchain-link/lib/workers/solana';
|
|
5
|
+
import StellarWorker from '@trezor/blockchain-link/lib/workers/stellar';
|
|
5
6
|
declare const ElectrumWorker: undefined;
|
|
6
|
-
export { BlockbookWorker, RippleWorker, BlockfrostWorker, ElectrumWorker, SolanaWorker };
|
|
7
|
+
export { BlockbookWorker, RippleWorker, BlockfrostWorker, ElectrumWorker, SolanaWorker, StellarWorker, };
|
|
7
8
|
//# sourceMappingURL=workers.native.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SolanaWorker = exports.ElectrumWorker = exports.BlockfrostWorker = exports.RippleWorker = exports.BlockbookWorker = void 0;
|
|
3
|
+
exports.StellarWorker = exports.SolanaWorker = exports.ElectrumWorker = exports.BlockfrostWorker = exports.RippleWorker = exports.BlockbookWorker = void 0;
|
|
4
4
|
const tslib_1 = require("tslib");
|
|
5
5
|
const blockbook_1 = tslib_1.__importDefault(require("@trezor/blockchain-link/lib/workers/blockbook"));
|
|
6
6
|
exports.BlockbookWorker = blockbook_1.default;
|
|
@@ -10,6 +10,8 @@ const ripple_1 = tslib_1.__importDefault(require("@trezor/blockchain-link/lib/wo
|
|
|
10
10
|
exports.RippleWorker = ripple_1.default;
|
|
11
11
|
const solana_1 = tslib_1.__importDefault(require("@trezor/blockchain-link/lib/workers/solana"));
|
|
12
12
|
exports.SolanaWorker = solana_1.default;
|
|
13
|
+
const stellar_1 = tslib_1.__importDefault(require("@trezor/blockchain-link/lib/workers/stellar"));
|
|
14
|
+
exports.StellarWorker = stellar_1.default;
|
|
13
15
|
const ElectrumWorker = undefined;
|
|
14
16
|
exports.ElectrumWorker = ElectrumWorker;
|
|
15
17
|
//# sourceMappingURL=workers.native.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@trezor/connect",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.6.0",
|
|
4
4
|
"author": "Trezor <info@trezor.io>",
|
|
5
5
|
"homepage": "https://github.com/trezor/trezor-suite/tree/develop/packages/connect",
|
|
6
6
|
"description": "High-level javascript interface for Trezor hardware wallet.",
|
|
@@ -68,8 +68,8 @@
|
|
|
68
68
|
"prepublish": "yarn tsx ../../scripts/prepublish.js"
|
|
69
69
|
},
|
|
70
70
|
"dependencies": {
|
|
71
|
-
"@ethereumjs/common": "^
|
|
72
|
-
"@ethereumjs/tx": "^
|
|
71
|
+
"@ethereumjs/common": "^10.0.0",
|
|
72
|
+
"@ethereumjs/tx": "^10.0.0",
|
|
73
73
|
"@fivebinaries/coin-selection": "3.0.0",
|
|
74
74
|
"@mobily/ts-belt": "^3.13.1",
|
|
75
75
|
"@noble/hashes": "^1.6.1",
|
|
@@ -77,29 +77,29 @@
|
|
|
77
77
|
"@solana-program/compute-budget": "^0.7.0",
|
|
78
78
|
"@solana-program/system": "^0.7.0",
|
|
79
79
|
"@solana-program/token": "^0.5.1",
|
|
80
|
-
"@solana-program/token-2022": "^0.4.
|
|
81
|
-
"@solana/kit": "^2.
|
|
82
|
-
"@trezor/blockchain-link": "2.
|
|
83
|
-
"@trezor/blockchain-link-types": "1.
|
|
84
|
-
"@trezor/blockchain-link-utils": "1.
|
|
80
|
+
"@solana-program/token-2022": "^0.4.1",
|
|
81
|
+
"@solana/kit": "^2.1.1",
|
|
82
|
+
"@trezor/blockchain-link": "2.5.0",
|
|
83
|
+
"@trezor/blockchain-link-types": "1.4.0",
|
|
84
|
+
"@trezor/blockchain-link-utils": "1.4.0",
|
|
85
85
|
"@trezor/connect-analytics": "1.3.3",
|
|
86
|
-
"@trezor/connect-common": "0.
|
|
86
|
+
"@trezor/connect-common": "0.4.0",
|
|
87
87
|
"@trezor/crypto-utils": "1.1.3",
|
|
88
|
-
"@trezor/device-utils": "1.0
|
|
89
|
-
"@trezor/protobuf": "1.
|
|
88
|
+
"@trezor/device-utils": "1.1.0",
|
|
89
|
+
"@trezor/protobuf": "1.4.0",
|
|
90
90
|
"@trezor/protocol": "1.2.6",
|
|
91
91
|
"@trezor/schema-utils": "1.3.3",
|
|
92
|
-
"@trezor/transport": "1.
|
|
92
|
+
"@trezor/transport": "1.5.0",
|
|
93
93
|
"@trezor/type-utils": "1.1.6",
|
|
94
|
-
"@trezor/utils": "9.
|
|
95
|
-
"@trezor/utxo-lib": "2.
|
|
94
|
+
"@trezor/utils": "9.4.0",
|
|
95
|
+
"@trezor/utxo-lib": "2.4.0",
|
|
96
96
|
"blakejs": "^1.2.1",
|
|
97
97
|
"bs58": "^6.0.0",
|
|
98
98
|
"bs58check": "^4.0.0",
|
|
99
99
|
"cross-fetch": "^4.0.0"
|
|
100
100
|
},
|
|
101
101
|
"devDependencies": {
|
|
102
|
-
"@babel/preset-typescript": "^7.27.
|
|
102
|
+
"@babel/preset-typescript": "^7.27.1",
|
|
103
103
|
"@trezor/eslint": "1.0.0",
|
|
104
104
|
"@trezor/trezor-user-env-link": "1.0.2",
|
|
105
105
|
"@types/karma": "^6.3.9",
|
|
@@ -117,7 +117,7 @@
|
|
|
117
117
|
"ts-node": "^10.9.2",
|
|
118
118
|
"tsx": "^4.19.3",
|
|
119
119
|
"web3-utils": "^4.3.2",
|
|
120
|
-
"webpack": "
|
|
120
|
+
"webpack": "5.98.0",
|
|
121
121
|
"ws": "^8.18.0"
|
|
122
122
|
},
|
|
123
123
|
"peerDependencies": {
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import { PROTO } from '../../../constants';
|
|
2
|
-
import { AbstractMethod } from '../../../core/AbstractMethod';
|
|
3
|
-
type Params = PROTO.BinanceGetAddress & {
|
|
4
|
-
address?: string;
|
|
5
|
-
};
|
|
6
|
-
export default class BinanceGetAddress extends AbstractMethod<'binanceGetAddress', Params[]> {
|
|
7
|
-
hasBundle?: boolean;
|
|
8
|
-
progress: number;
|
|
9
|
-
init(): void;
|
|
10
|
-
get info(): string;
|
|
11
|
-
getButtonRequestData(code: string): {
|
|
12
|
-
type: "address";
|
|
13
|
-
serializedPath: string;
|
|
14
|
-
address: string;
|
|
15
|
-
} | undefined;
|
|
16
|
-
get confirmation(): {
|
|
17
|
-
view: "export-address";
|
|
18
|
-
label: string;
|
|
19
|
-
} | undefined;
|
|
20
|
-
_call({ address_n, show_display, chunkify }: Params): Promise<{
|
|
21
|
-
address: string;
|
|
22
|
-
}>;
|
|
23
|
-
run(): Promise<import("../../../types").Address | import("../../../types").Address[]>;
|
|
24
|
-
}
|
|
25
|
-
export {};
|
|
26
|
-
//# sourceMappingURL=binanceGetAddress.d.ts.map
|
|
@@ -1,109 +0,0 @@
|
|
|
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 coinInfo_1 = require("../../../data/coinInfo");
|
|
7
|
-
const events_1 = require("../../../events");
|
|
8
|
-
const types_1 = require("../../../types");
|
|
9
|
-
const getAddress_1 = require("../../../types/api/getAddress");
|
|
10
|
-
const pathUtils_1 = require("../../../utils/pathUtils");
|
|
11
|
-
const paramsValidator_1 = require("../../common/paramsValidator");
|
|
12
|
-
class BinanceGetAddress extends AbstractMethod_1.AbstractMethod {
|
|
13
|
-
hasBundle;
|
|
14
|
-
progress = 0;
|
|
15
|
-
init() {
|
|
16
|
-
this.noBackupConfirmationMode = 'always';
|
|
17
|
-
this.requiredPermissions = ['read'];
|
|
18
|
-
this.requiredDeviceCapabilities = ['Capability_Binance'];
|
|
19
|
-
this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, (0, coinInfo_1.getMiscNetwork)('BNB'), this.firmwareRange);
|
|
20
|
-
this.hasBundle = !!this.payload.bundle;
|
|
21
|
-
const payload = !this.payload.bundle
|
|
22
|
-
? { ...this.payload, bundle: [this.payload] }
|
|
23
|
-
: this.payload;
|
|
24
|
-
(0, schema_utils_1.Assert)((0, types_1.Bundle)(getAddress_1.GetAddress), payload);
|
|
25
|
-
this.params = payload.bundle.map(batch => {
|
|
26
|
-
const path = (0, pathUtils_1.validatePath)(batch.path, 3);
|
|
27
|
-
return {
|
|
28
|
-
address_n: path,
|
|
29
|
-
address: batch.address,
|
|
30
|
-
show_display: typeof batch.showOnTrezor === 'boolean' ? batch.showOnTrezor : true,
|
|
31
|
-
chunkify: typeof batch.chunkify === 'boolean' ? batch.chunkify : false,
|
|
32
|
-
};
|
|
33
|
-
});
|
|
34
|
-
const useEventListener = payload.useEventListener &&
|
|
35
|
-
this.params.length === 1 &&
|
|
36
|
-
typeof this.params[0].address === 'string' &&
|
|
37
|
-
this.params[0].show_display;
|
|
38
|
-
this.useUi = !useEventListener;
|
|
39
|
-
}
|
|
40
|
-
get info() {
|
|
41
|
-
if (this.params.length === 1) {
|
|
42
|
-
return `Export Binance address for account #${(0, pathUtils_1.fromHardened)(this.params[0].address_n[2]) + 1}`;
|
|
43
|
-
}
|
|
44
|
-
return 'Export multiple Binance addresses';
|
|
45
|
-
}
|
|
46
|
-
getButtonRequestData(code) {
|
|
47
|
-
if (code === 'ButtonRequest_Address') {
|
|
48
|
-
return {
|
|
49
|
-
type: 'address',
|
|
50
|
-
serializedPath: (0, pathUtils_1.getSerializedPath)(this.params[this.progress].address_n),
|
|
51
|
-
address: this.params[this.progress].address || 'not-set',
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
get confirmation() {
|
|
56
|
-
return !this.useUi
|
|
57
|
-
? undefined
|
|
58
|
-
: {
|
|
59
|
-
view: 'export-address',
|
|
60
|
-
label: this.info,
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
async _call({ address_n, show_display, chunkify }) {
|
|
64
|
-
const cmd = this.device.getCommands();
|
|
65
|
-
const response = await cmd.typedCall('BinanceGetAddress', 'BinanceAddress', {
|
|
66
|
-
address_n,
|
|
67
|
-
show_display,
|
|
68
|
-
chunkify,
|
|
69
|
-
});
|
|
70
|
-
return response.message;
|
|
71
|
-
}
|
|
72
|
-
async run() {
|
|
73
|
-
const responses = [];
|
|
74
|
-
for (let i = 0; i < this.params.length; i++) {
|
|
75
|
-
const batch = this.params[i];
|
|
76
|
-
if (batch.show_display) {
|
|
77
|
-
const silent = await this._call({
|
|
78
|
-
...batch,
|
|
79
|
-
show_display: false,
|
|
80
|
-
});
|
|
81
|
-
if (typeof batch.address === 'string') {
|
|
82
|
-
if (batch.address !== silent.address) {
|
|
83
|
-
throw constants_1.ERRORS.TypedError('Method_AddressNotMatch');
|
|
84
|
-
}
|
|
85
|
-
}
|
|
86
|
-
else {
|
|
87
|
-
batch.address = silent.address;
|
|
88
|
-
}
|
|
89
|
-
}
|
|
90
|
-
const response = await this._call(batch);
|
|
91
|
-
responses.push({
|
|
92
|
-
path: batch.address_n,
|
|
93
|
-
serializedPath: (0, pathUtils_1.getSerializedPath)(batch.address_n),
|
|
94
|
-
address: response.address,
|
|
95
|
-
});
|
|
96
|
-
if (this.hasBundle) {
|
|
97
|
-
this.postMessage((0, events_1.createUiMessage)(events_1.UI.BUNDLE_PROGRESS, {
|
|
98
|
-
total: this.params.length,
|
|
99
|
-
progress: i,
|
|
100
|
-
response,
|
|
101
|
-
}));
|
|
102
|
-
}
|
|
103
|
-
this.progress++;
|
|
104
|
-
}
|
|
105
|
-
return this.hasBundle ? responses : responses[0];
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
exports.default = BinanceGetAddress;
|
|
109
|
-
//# sourceMappingURL=binanceGetAddress.js.map
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import type { PROTO } from '../../../constants';
|
|
2
|
-
import { AbstractMethod } from '../../../core/AbstractMethod';
|
|
3
|
-
export default class BinanceGetPublicKey extends AbstractMethod<'binanceGetPublicKey', PROTO.BinanceGetPublicKey[]> {
|
|
4
|
-
hasBundle?: boolean;
|
|
5
|
-
init(): void;
|
|
6
|
-
get info(): string;
|
|
7
|
-
get confirmation(): {
|
|
8
|
-
view: "export-address";
|
|
9
|
-
label: string;
|
|
10
|
-
};
|
|
11
|
-
run(): Promise<{
|
|
12
|
-
path: number[];
|
|
13
|
-
publicKey: string;
|
|
14
|
-
serializedPath: string;
|
|
15
|
-
} | {
|
|
16
|
-
path: number[];
|
|
17
|
-
publicKey: string;
|
|
18
|
-
serializedPath: string;
|
|
19
|
-
}[]>;
|
|
20
|
-
}
|
|
21
|
-
//# sourceMappingURL=binanceGetPublicKey.d.ts.map
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const schema_utils_1 = require("@trezor/schema-utils");
|
|
4
|
-
const AbstractMethod_1 = require("../../../core/AbstractMethod");
|
|
5
|
-
const coinInfo_1 = require("../../../data/coinInfo");
|
|
6
|
-
const events_1 = require("../../../events");
|
|
7
|
-
const types_1 = require("../../../types");
|
|
8
|
-
const pathUtils_1 = require("../../../utils/pathUtils");
|
|
9
|
-
const paramsValidator_1 = require("../../common/paramsValidator");
|
|
10
|
-
class BinanceGetPublicKey extends AbstractMethod_1.AbstractMethod {
|
|
11
|
-
hasBundle;
|
|
12
|
-
init() {
|
|
13
|
-
this.requiredPermissions = ['read'];
|
|
14
|
-
this.requiredDeviceCapabilities = ['Capability_Binance'];
|
|
15
|
-
this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, (0, coinInfo_1.getMiscNetwork)('BNB'), this.firmwareRange);
|
|
16
|
-
this.hasBundle = !!this.payload.bundle;
|
|
17
|
-
const payload = !this.payload.bundle
|
|
18
|
-
? { ...this.payload, bundle: [this.payload] }
|
|
19
|
-
: this.payload;
|
|
20
|
-
(0, schema_utils_1.Assert)((0, types_1.Bundle)(types_1.GetPublicKey), payload);
|
|
21
|
-
this.params = payload.bundle.map(batch => {
|
|
22
|
-
const path = (0, pathUtils_1.validatePath)(batch.path, 3);
|
|
23
|
-
return {
|
|
24
|
-
address_n: path,
|
|
25
|
-
show_display: typeof batch.showOnTrezor === 'boolean' ? batch.showOnTrezor : true,
|
|
26
|
-
};
|
|
27
|
-
});
|
|
28
|
-
}
|
|
29
|
-
get info() {
|
|
30
|
-
return 'Export Binance public key';
|
|
31
|
-
}
|
|
32
|
-
get confirmation() {
|
|
33
|
-
return {
|
|
34
|
-
view: 'export-address',
|
|
35
|
-
label: this.params.length > 1
|
|
36
|
-
? 'Export multiple Binance public keys'
|
|
37
|
-
: `Export Binance public key for account #${(0, pathUtils_1.fromHardened)(this.params[0].address_n[2]) + 1}`,
|
|
38
|
-
};
|
|
39
|
-
}
|
|
40
|
-
async run() {
|
|
41
|
-
const responses = [];
|
|
42
|
-
const cmd = this.device.getCommands();
|
|
43
|
-
for (let i = 0; i < this.params.length; i++) {
|
|
44
|
-
const batch = this.params[i];
|
|
45
|
-
const { message } = await cmd.typedCall('BinanceGetPublicKey', 'BinancePublicKey', batch);
|
|
46
|
-
responses.push({
|
|
47
|
-
path: batch.address_n,
|
|
48
|
-
serializedPath: (0, pathUtils_1.getSerializedPath)(batch.address_n),
|
|
49
|
-
publicKey: message.public_key,
|
|
50
|
-
});
|
|
51
|
-
if (this.hasBundle) {
|
|
52
|
-
this.postMessage((0, events_1.createUiMessage)(events_1.UI.BUNDLE_PROGRESS, {
|
|
53
|
-
total: this.params.length,
|
|
54
|
-
progress: i,
|
|
55
|
-
response: message,
|
|
56
|
-
}));
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
return this.hasBundle ? responses : responses[0];
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
exports.default = BinanceGetPublicKey;
|
|
63
|
-
//# sourceMappingURL=binanceGetPublicKey.js.map
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { AbstractMethod } from '../../../core/AbstractMethod';
|
|
2
|
-
import type { BinancePreparedTransaction } from '../../../types/api/binance';
|
|
3
|
-
type Params = {
|
|
4
|
-
path: number[];
|
|
5
|
-
transaction: BinancePreparedTransaction;
|
|
6
|
-
chunkify?: boolean;
|
|
7
|
-
};
|
|
8
|
-
export default class BinanceSignTransaction extends AbstractMethod<'binanceSignTransaction', Params> {
|
|
9
|
-
init(): void;
|
|
10
|
-
get info(): string;
|
|
11
|
-
run(): Promise<{
|
|
12
|
-
signature: string;
|
|
13
|
-
public_key: string;
|
|
14
|
-
}>;
|
|
15
|
-
}
|
|
16
|
-
export {};
|
|
17
|
-
//# sourceMappingURL=binanceSignTransaction.d.ts.map
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
const schema_utils_1 = require("@trezor/schema-utils");
|
|
5
|
-
const AbstractMethod_1 = require("../../../core/AbstractMethod");
|
|
6
|
-
const coinInfo_1 = require("../../../data/coinInfo");
|
|
7
|
-
const binance_1 = require("../../../types/api/binance");
|
|
8
|
-
const pathUtils_1 = require("../../../utils/pathUtils");
|
|
9
|
-
const paramsValidator_1 = require("../../common/paramsValidator");
|
|
10
|
-
const helper = tslib_1.__importStar(require("../binanceSignTx"));
|
|
11
|
-
class BinanceSignTransaction extends AbstractMethod_1.AbstractMethod {
|
|
12
|
-
init() {
|
|
13
|
-
this.requiredPermissions = ['read', 'write'];
|
|
14
|
-
this.requiredDeviceCapabilities = ['Capability_Binance'];
|
|
15
|
-
this.firmwareRange = (0, paramsValidator_1.getFirmwareRange)(this.name, (0, coinInfo_1.getMiscNetwork)('BNB'), this.firmwareRange);
|
|
16
|
-
const { payload } = this;
|
|
17
|
-
(0, schema_utils_1.AssertWeak)(binance_1.BinanceSignTransaction, payload);
|
|
18
|
-
const path = (0, pathUtils_1.validatePath)(payload.path, 3);
|
|
19
|
-
const transaction = helper.validate(payload.transaction);
|
|
20
|
-
this.params = {
|
|
21
|
-
path,
|
|
22
|
-
transaction,
|
|
23
|
-
chunkify: payload.chunkify ?? false,
|
|
24
|
-
};
|
|
25
|
-
}
|
|
26
|
-
get info() {
|
|
27
|
-
return 'Sign Binance transaction';
|
|
28
|
-
}
|
|
29
|
-
run() {
|
|
30
|
-
return helper.signTx(this.device.getCommands().typedCall, this.params.path, this.params.transaction, this.params.chunkify);
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
exports.default = BinanceSignTransaction;
|
|
34
|
-
//# sourceMappingURL=binanceSignTransaction.js.map
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.binanceSignTransaction = exports.binanceGetPublicKey = exports.binanceGetAddress = void 0;
|
|
4
|
-
const tslib_1 = require("tslib");
|
|
5
|
-
var binanceGetAddress_1 = require("./binanceGetAddress");
|
|
6
|
-
Object.defineProperty(exports, "binanceGetAddress", { enumerable: true, get: function () { return tslib_1.__importDefault(binanceGetAddress_1).default; } });
|
|
7
|
-
var binanceGetPublicKey_1 = require("./binanceGetPublicKey");
|
|
8
|
-
Object.defineProperty(exports, "binanceGetPublicKey", { enumerable: true, get: function () { return tslib_1.__importDefault(binanceGetPublicKey_1).default; } });
|
|
9
|
-
var binanceSignTransaction_1 = require("./binanceSignTransaction");
|
|
10
|
-
Object.defineProperty(exports, "binanceSignTransaction", { enumerable: true, get: function () { return tslib_1.__importDefault(binanceSignTransaction_1).default; } });
|
|
11
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1,87 +0,0 @@
|
|
|
1
|
-
import { PROTO } from '../../constants';
|
|
2
|
-
import type { TypedCall } from '../../device/DeviceCommands';
|
|
3
|
-
import { BinancePreparedTransaction, BinanceSDKTransaction } from '../../types/api/binance';
|
|
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
|
-
}>;
|
|
87
|
-
//# sourceMappingURL=binanceSignTx.d.ts.map
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.signTx = exports.validate = void 0;
|
|
4
|
-
const schema_utils_1 = require("@trezor/schema-utils");
|
|
5
|
-
const constants_1 = require("../../constants");
|
|
6
|
-
const binance_1 = require("../../types/api/binance");
|
|
7
|
-
const processTxRequest = async (typedCall, messages, index) => {
|
|
8
|
-
const { type, ...params } = messages[index];
|
|
9
|
-
const lastOp = index + 1 >= messages.length;
|
|
10
|
-
if (lastOp) {
|
|
11
|
-
const response = await typedCall(type, 'BinanceSignedTx', params);
|
|
12
|
-
return response.message;
|
|
13
|
-
}
|
|
14
|
-
await typedCall(type, 'BinanceTxRequest', params);
|
|
15
|
-
index++;
|
|
16
|
-
return processTxRequest(typedCall, messages, index);
|
|
17
|
-
};
|
|
18
|
-
const validate = (tx) => {
|
|
19
|
-
(0, schema_utils_1.Assert)(binance_1.BinanceSDKTransaction, tx);
|
|
20
|
-
const preparedTx = {
|
|
21
|
-
chain_id: tx.chain_id,
|
|
22
|
-
account_number: tx.account_number || 0,
|
|
23
|
-
memo: tx.memo,
|
|
24
|
-
sequence: tx.sequence || 0,
|
|
25
|
-
source: tx.source || 0,
|
|
26
|
-
messages: [],
|
|
27
|
-
};
|
|
28
|
-
const { transfer, placeOrder, cancelOrder } = tx;
|
|
29
|
-
if (transfer) {
|
|
30
|
-
preparedTx.messages.push({
|
|
31
|
-
...transfer,
|
|
32
|
-
type: 'BinanceTransferMsg',
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
if (placeOrder) {
|
|
36
|
-
preparedTx.messages.push({
|
|
37
|
-
...placeOrder,
|
|
38
|
-
type: 'BinanceOrderMsg',
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
if (cancelOrder) {
|
|
42
|
-
preparedTx.messages.push({
|
|
43
|
-
...cancelOrder,
|
|
44
|
-
type: 'BinanceCancelMsg',
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
if (preparedTx.messages.length < 1) {
|
|
48
|
-
throw constants_1.ERRORS.TypedError('Method_InvalidParameter', 'Transaction does not have any message');
|
|
49
|
-
}
|
|
50
|
-
return preparedTx;
|
|
51
|
-
};
|
|
52
|
-
exports.validate = validate;
|
|
53
|
-
const signTx = async (typedCall, address_n, tx, chunkify) => {
|
|
54
|
-
const { account_number, chain_id, memo, sequence, source, messages } = tx;
|
|
55
|
-
const msg_count = messages.length;
|
|
56
|
-
await typedCall('BinanceSignTx', 'BinanceTxRequest', {
|
|
57
|
-
address_n,
|
|
58
|
-
msg_count,
|
|
59
|
-
account_number,
|
|
60
|
-
chain_id,
|
|
61
|
-
memo,
|
|
62
|
-
sequence,
|
|
63
|
-
source,
|
|
64
|
-
chunkify,
|
|
65
|
-
});
|
|
66
|
-
return processTxRequest(typedCall, messages, 0);
|
|
67
|
-
};
|
|
68
|
-
exports.signTx = signTx;
|
|
69
|
-
//# sourceMappingURL=binanceSignTx.js.map
|