@trezor/connect 9.1.5 → 9.1.7
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 +66 -0
- package/README.md +1 -1
- package/lib/api/{binanceGetAddress.d.ts → binance/api/binanceGetAddress.d.ts} +4 -4
- package/lib/api/{binanceGetAddress.js → binance/api/binanceGetAddress.js} +10 -7
- package/lib/api/{binanceGetPublicKey.d.ts → binance/api/binanceGetPublicKey.d.ts} +3 -3
- package/lib/api/{binanceGetPublicKey.js → binance/api/binanceGetPublicKey.js} +5 -5
- package/lib/api/{binanceSignTransaction.d.ts → binance/api/binanceSignTransaction.d.ts} +3 -2
- package/lib/api/{binanceSignTransaction.js → binance/api/binanceSignTransaction.js} +8 -6
- package/lib/api/binance/api/index.d.ts +4 -0
- package/lib/api/binance/api/index.js +13 -0
- package/lib/api/binance/binanceSignTx.d.ts +1 -1
- package/lib/api/binance/binanceSignTx.js +2 -1
- package/lib/api/bitcoin/TransactionComposer.d.ts +4 -4
- package/lib/api/bitcoin/TransactionComposer.js +4 -18
- package/lib/api/bitcoin/inputs.d.ts +2 -2
- package/lib/api/bitcoin/inputs.js +4 -5
- package/lib/api/bitcoin/outputs.d.ts +4 -4
- package/lib/api/bitcoin/outputs.js +14 -23
- package/lib/api/blockchainEstimateFee.d.ts +2 -2
- package/lib/api/cardano/api/cardanoComposeTransaction.d.ts +8 -0
- package/lib/api/cardano/api/cardanoComposeTransaction.js +69 -0
- package/lib/api/{cardanoGetAddress.d.ts → cardano/api/cardanoGetAddress.d.ts} +4 -4
- package/lib/api/{cardanoGetAddress.js → cardano/api/cardanoGetAddress.js} +11 -8
- package/lib/api/{cardanoGetNativeScriptHash.d.ts → cardano/api/cardanoGetNativeScriptHash.d.ts} +3 -3
- package/lib/api/{cardanoGetNativeScriptHash.js → cardano/api/cardanoGetNativeScriptHash.js} +5 -5
- package/lib/api/{cardanoGetPublicKey.d.ts → cardano/api/cardanoGetPublicKey.d.ts} +3 -3
- package/lib/api/{cardanoGetPublicKey.js → cardano/api/cardanoGetPublicKey.js} +6 -6
- package/lib/api/{cardanoSignTransaction.d.ts → cardano/api/cardanoSignTransaction.d.ts} +19 -8
- package/lib/api/{cardanoSignTransaction.js → cardano/api/cardanoSignTransaction.js} +33 -13
- package/lib/api/cardano/api/index.d.ts +6 -0
- package/lib/api/cardano/api/index.js +17 -0
- package/lib/api/cardano/cardanoUtils.d.ts +6 -0
- package/lib/api/cardano/cardanoUtils.js +64 -1
- package/lib/api/common/paramsValidator.js +5 -3
- package/lib/api/composeTransaction.d.ts +5 -5
- package/lib/api/composeTransaction.js +14 -19
- package/lib/api/eos/api/eosGetPublicKey.d.ts +11 -0
- package/lib/api/{eosGetPublicKey.js → eos/api/eosGetPublicKey.js} +7 -5
- package/lib/api/{eosSignTransaction.d.ts → eos/api/eosSignTransaction.d.ts} +3 -2
- package/lib/api/{eosSignTransaction.js → eos/api/eosSignTransaction.js} +8 -6
- package/lib/api/eos/api/index.d.ts +3 -0
- package/lib/api/eos/api/index.js +11 -0
- package/lib/api/eos/eosSignTx.d.ts +1 -1
- package/lib/api/eos/eosSignTx.js +2 -1
- package/lib/api/{ethereumGetAddress.d.ts → ethereum/api/ethereumGetAddress.d.ts} +5 -5
- package/lib/api/{ethereumGetAddress.js → ethereum/api/ethereumGetAddress.js} +13 -10
- package/lib/api/ethereum/api/ethereumGetPublicKey.d.ts +16 -0
- package/lib/api/{ethereumGetPublicKey.js → ethereum/api/ethereumGetPublicKey.js} +6 -6
- package/lib/api/{ethereumSignMessage.d.ts → ethereum/api/ethereumSignMessage.d.ts} +3 -3
- package/lib/api/{ethereumSignMessage.js → ethereum/api/ethereumSignMessage.js} +7 -7
- package/lib/api/{ethereumSignTransaction.d.ts → ethereum/api/ethereumSignTransaction.d.ts} +12 -9
- package/lib/api/{ethereumSignTransaction.js → ethereum/api/ethereumSignTransaction.js} +38 -43
- package/lib/api/{ethereumSignTypedData.d.ts → ethereum/api/ethereumSignTypedData.d.ts} +3 -3
- package/lib/api/{ethereumSignTypedData.js → ethereum/api/ethereumSignTypedData.js} +10 -10
- package/lib/api/{ethereumVerifyMessage.d.ts → ethereum/api/ethereumVerifyMessage.d.ts} +2 -2
- package/lib/api/{ethereumVerifyMessage.js → ethereum/api/ethereumVerifyMessage.js} +3 -3
- package/lib/api/ethereum/api/index.d.ts +7 -0
- package/lib/api/ethereum/api/index.js +19 -0
- package/lib/api/ethereum/ethereumSignTx.d.ts +4 -2
- package/lib/api/ethereum/ethereumSignTx.js +19 -3
- package/lib/api/firmware/verifyAuthenticityProof.js +1 -1
- package/lib/api/firmware/x509certificate.d.ts +1 -0
- package/lib/api/firmware/x509certificate.js +34 -2
- package/lib/api/getAccountDescriptor.d.ts +20 -0
- package/lib/api/getAccountDescriptor.js +162 -0
- package/lib/api/getAccountInfo.d.ts +2 -0
- package/lib/api/getAddress.d.ts +1 -1
- package/lib/api/getAddress.js +4 -1
- package/lib/api/index.d.ts +1 -24
- package/lib/api/index.js +3 -50
- package/lib/api/nem/api/index.d.ts +3 -0
- package/lib/api/nem/api/index.js +11 -0
- package/lib/api/{nemGetAddress.d.ts → nem/api/nemGetAddress.d.ts} +4 -4
- package/lib/api/{nemGetAddress.js → nem/api/nemGetAddress.js} +10 -7
- package/lib/api/{nemSignTransaction.d.ts → nem/api/nemSignTransaction.d.ts} +2 -2
- package/lib/api/{nemSignTransaction.js → nem/api/nemSignTransaction.js} +7 -6
- package/lib/api/nem/nemSignTx.d.ts +1 -1
- package/lib/api/nem/nemSignTx.js +2 -1
- package/lib/api/ripple/api/index.d.ts +3 -0
- package/lib/api/ripple/api/index.js +11 -0
- package/lib/api/{rippleGetAddress.d.ts → ripple/api/rippleGetAddress.d.ts} +4 -4
- package/lib/api/{rippleGetAddress.js → ripple/api/rippleGetAddress.js} +10 -7
- package/lib/api/{rippleSignTransaction.d.ts → ripple/api/rippleSignTransaction.d.ts} +2 -2
- package/lib/api/{rippleSignTransaction.js → ripple/api/rippleSignTransaction.js} +7 -5
- package/lib/api/signTransaction.js +2 -0
- package/lib/api/solana/additionalInfo.d.ts +10 -0
- package/lib/api/solana/additionalInfo.js +33 -0
- package/lib/api/solana/api/index.d.ts +4 -0
- package/lib/api/solana/api/index.js +13 -0
- package/lib/api/solana/api/solanaGetAddress.d.ts +23 -0
- package/lib/api/solana/api/solanaGetAddress.js +133 -0
- package/lib/api/solana/api/solanaGetPublicKey.d.ts +12 -0
- package/lib/api/solana/api/solanaGetPublicKey.js +83 -0
- package/lib/api/solana/api/solanaSignTransaction.d.ts +10 -0
- package/lib/api/solana/api/solanaSignTransaction.js +34 -0
- package/lib/api/stellar/api/index.d.ts +3 -0
- package/lib/api/stellar/api/index.js +11 -0
- package/lib/api/{stellarGetAddress.d.ts → stellar/api/stellarGetAddress.d.ts} +4 -4
- package/lib/api/{stellarGetAddress.js → stellar/api/stellarGetAddress.js} +10 -7
- package/lib/api/{stellarSignTransaction.d.ts → stellar/api/stellarSignTransaction.d.ts} +2 -2
- package/lib/api/{stellarSignTransaction.js → stellar/api/stellarSignTransaction.js} +6 -6
- package/lib/api/tezos/api/index.d.ts +4 -0
- package/lib/api/tezos/api/index.js +13 -0
- package/lib/api/{tezosGetAddress.d.ts → tezos/api/tezosGetAddress.d.ts} +4 -4
- package/lib/api/{tezosGetAddress.js → tezos/api/tezosGetAddress.js} +10 -7
- package/lib/api/{tezosGetPublicKey.d.ts → tezos/api/tezosGetPublicKey.d.ts} +3 -3
- package/lib/api/{tezosGetPublicKey.js → tezos/api/tezosGetPublicKey.js} +7 -5
- package/lib/api/{tezosSignTransaction.d.ts → tezos/api/tezosSignTransaction.d.ts} +2 -2
- package/lib/api/{tezosSignTransaction.js → tezos/api/tezosSignTransaction.js} +5 -5
- package/lib/api/tezos/tezosSignTx.d.ts +1 -1
- package/lib/api/tezos/tezosSignTx.js +2 -1
- package/lib/backend/Blockchain.js +3 -0
- package/lib/constants/cardano.js +2 -2
- package/lib/constants/nem.js +3 -3
- package/lib/constants/network.d.ts +3 -0
- package/lib/constants/network.js +13 -1
- package/lib/core/AbstractMethod.js +3 -0
- package/lib/core/index.d.ts +3 -1
- package/lib/core/index.js +17 -4
- package/lib/core/method.d.ts +2 -2
- package/lib/core/method.js +8 -2
- package/lib/core/method.native.d.ts +5 -0
- package/lib/core/method.native.js +34 -0
- package/lib/data/DataManager.d.ts +22 -0
- package/lib/data/config.d.ts +22 -0
- package/lib/data/config.js +12 -1
- package/lib/data/connectSettings.js +4 -0
- package/lib/data/defaultFeeLevels.js +9 -0
- package/lib/data/deviceAuthenticityConfig.js +4 -1
- package/lib/data/firmwareInfo.d.ts +1 -1
- package/lib/data/firmwareInfo.js +4 -1
- package/lib/data/version.d.ts +1 -1
- package/lib/data/version.js +1 -1
- package/lib/device/Device.d.ts +3 -1
- package/lib/device/Device.js +23 -4
- package/lib/device/DeviceCommands.d.ts +2 -2
- package/lib/device/DeviceCommands.js +19 -3
- package/lib/device/DeviceList.js +4 -1
- package/lib/events/popup.d.ts +19 -3
- package/lib/events/popup.js +3 -0
- package/lib/events/ui-request.d.ts +1 -1
- package/lib/factory.js +5 -0
- package/lib/types/api/binance/index.d.ts +1 -0
- package/lib/types/api/bitcoin/index.d.ts +2 -0
- package/lib/types/api/cardano/index.d.ts +2 -0
- package/lib/types/api/cardanoComposeTransaction.d.ts +44 -0
- package/lib/types/api/cardanoComposeTransaction.js +3 -0
- package/lib/types/api/cardanoSignTransaction.d.ts +9 -0
- package/lib/types/api/composeTransaction.d.ts +28 -54
- package/lib/types/api/eos/index.d.ts +1 -0
- package/lib/types/api/ethereum/index.d.ts +2 -0
- package/lib/types/api/getAccountDescriptor.d.ts +16 -0
- package/lib/types/api/getAccountDescriptor.js +3 -0
- package/lib/types/api/index.d.ts +10 -0
- package/lib/types/api/nem/index.d.ts +1 -0
- package/lib/types/api/ripple/index.d.ts +1 -0
- package/lib/types/api/solana/index.d.ts +22 -0
- package/lib/types/api/solana/index.js +3 -0
- package/lib/types/api/solanaGetAddress.d.ts +4 -0
- package/lib/types/api/solanaGetAddress.js +3 -0
- package/lib/types/api/solanaGetPublicKey.d.ts +5 -0
- package/lib/types/api/solanaGetPublicKey.js +3 -0
- package/lib/types/api/solanaSignTransaction.d.ts +4 -0
- package/lib/types/api/solanaSignTransaction.js +3 -0
- package/lib/types/api/tezos/index.d.ts +1 -0
- package/lib/types/coinInfo.d.ts +5 -16
- package/lib/types/device.d.ts +1 -1
- package/lib/types/device.js +1 -1
- package/lib/types/index.d.ts +3 -1
- package/lib/types/index.js +1 -0
- package/lib/types/params.d.ts +3 -0
- package/lib/types/settings.d.ts +1 -0
- package/lib/utils/debug.d.ts +6 -3
- package/lib/utils/debug.js +13 -7
- package/lib/utils/deviceFeaturesUtils.js +8 -5
- package/lib/utils/formatUtils.d.ts +2 -0
- package/lib/utils/formatUtils.js +19 -1
- package/lib/workers/workers-browser.d.ts +2 -1
- package/lib/workers/workers-browser.js +3 -1
- package/lib/workers/workers-react-native.d.ts +2 -1
- package/lib/workers/workers-react-native.js +3 -1
- package/lib/workers/workers.d.ts +8 -5
- package/lib/workers/workers.js +34 -10
- package/package.json +22 -19
- package/lib/api/eosGetPublicKey.d.ts +0 -11
- package/lib/api/ethereumGetPublicKey.d.ts +0 -16
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const AbstractMethod_1 = require("
|
|
4
|
-
const paramsValidator_1 = require("
|
|
5
|
-
const coinInfo_1 = require("
|
|
6
|
-
const pathUtils_1 = require("
|
|
7
|
-
const cardanoAddressParameters_1 = require("
|
|
8
|
-
const constants_1 = require("
|
|
9
|
-
const events_1 = require("
|
|
3
|
+
const AbstractMethod_1 = require("../../../core/AbstractMethod");
|
|
4
|
+
const paramsValidator_1 = require("../../common/paramsValidator");
|
|
5
|
+
const coinInfo_1 = require("../../../data/coinInfo");
|
|
6
|
+
const pathUtils_1 = require("../../../utils/pathUtils");
|
|
7
|
+
const cardanoAddressParameters_1 = require("../cardanoAddressParameters");
|
|
8
|
+
const constants_1 = require("../../../constants");
|
|
9
|
+
const events_1 = require("../../../events");
|
|
10
10
|
class CardanoGetAddress extends AbstractMethod_1.AbstractMethod {
|
|
11
11
|
constructor() {
|
|
12
12
|
super(...arguments);
|
|
@@ -31,6 +31,7 @@ class CardanoGetAddress extends AbstractMethod_1.AbstractMethod {
|
|
|
31
31
|
{ name: 'derivationType', type: 'number' },
|
|
32
32
|
{ name: 'address', type: 'string' },
|
|
33
33
|
{ name: 'showOnTrezor', type: 'boolean' },
|
|
34
|
+
{ name: 'chunkify', type: 'boolean' },
|
|
34
35
|
]);
|
|
35
36
|
(0, cardanoAddressParameters_1.validateAddressParameters)(batch.addressParameters);
|
|
36
37
|
return {
|
|
@@ -42,6 +43,7 @@ class CardanoGetAddress extends AbstractMethod_1.AbstractMethod {
|
|
|
42
43
|
? batch.derivationType
|
|
43
44
|
: constants_1.PROTO.CardanoDerivationType.ICARUS_TREZOR,
|
|
44
45
|
show_display: typeof batch.showOnTrezor === 'boolean' ? batch.showOnTrezor : true,
|
|
46
|
+
chunkify: typeof batch.chunkify === 'boolean' ? batch.chunkify : false,
|
|
45
47
|
};
|
|
46
48
|
});
|
|
47
49
|
const useEventListener = payload.useEventListener &&
|
|
@@ -88,7 +90,7 @@ class CardanoGetAddress extends AbstractMethod_1.AbstractMethod {
|
|
|
88
90
|
const uiResp = await uiPromise.promise;
|
|
89
91
|
return uiResp.payload;
|
|
90
92
|
}
|
|
91
|
-
async _call({ address_parameters, protocol_magic, network_id, derivation_type, show_display, }) {
|
|
93
|
+
async _call({ address_parameters, protocol_magic, network_id, derivation_type, show_display, chunkify, }) {
|
|
92
94
|
const cmd = this.device.getCommands();
|
|
93
95
|
const response = await cmd.typedCall('CardanoGetAddress', 'CardanoAddress', {
|
|
94
96
|
address_parameters,
|
|
@@ -96,6 +98,7 @@ class CardanoGetAddress extends AbstractMethod_1.AbstractMethod {
|
|
|
96
98
|
network_id,
|
|
97
99
|
derivation_type,
|
|
98
100
|
show_display,
|
|
101
|
+
chunkify,
|
|
99
102
|
});
|
|
100
103
|
return response.message;
|
|
101
104
|
}
|
package/lib/api/{cardanoGetNativeScriptHash.d.ts → cardano/api/cardanoGetNativeScriptHash.d.ts}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { PROTO } from '
|
|
2
|
-
import { AbstractMethod } from '
|
|
3
|
-
import type { CardanoNativeScript } from '
|
|
1
|
+
import { PROTO } from '../../../constants';
|
|
2
|
+
import { AbstractMethod } from '../../../core/AbstractMethod';
|
|
3
|
+
import type { CardanoNativeScript } from '../../../types/api/cardano';
|
|
4
4
|
export default class CardanoGetNativeScriptHash extends AbstractMethod<'cardanoGetNativeScriptHash', PROTO.CardanoGetNativeScriptHash> {
|
|
5
5
|
init(): void;
|
|
6
6
|
get info(): string;
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const constants_1 = require("
|
|
4
|
-
const AbstractMethod_1 = require("
|
|
5
|
-
const paramsValidator_1 = require("
|
|
6
|
-
const coinInfo_1 = require("
|
|
7
|
-
const pathUtils_1 = require("
|
|
3
|
+
const constants_1 = require("../../../constants");
|
|
4
|
+
const AbstractMethod_1 = require("../../../core/AbstractMethod");
|
|
5
|
+
const paramsValidator_1 = require("../../common/paramsValidator");
|
|
6
|
+
const coinInfo_1 = require("../../../data/coinInfo");
|
|
7
|
+
const pathUtils_1 = require("../../../utils/pathUtils");
|
|
8
8
|
class CardanoGetNativeScriptHash extends AbstractMethod_1.AbstractMethod {
|
|
9
9
|
init() {
|
|
10
10
|
this.requiredPermissions = ['read'];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { PROTO } from '
|
|
2
|
-
import { AbstractMethod } from '
|
|
1
|
+
import { PROTO } from '../../../constants';
|
|
2
|
+
import { AbstractMethod } from '../../../core/AbstractMethod';
|
|
3
3
|
interface Params extends PROTO.CardanoGetPublicKey {
|
|
4
4
|
suppressBackupWarning?: boolean;
|
|
5
5
|
}
|
|
@@ -10,7 +10,7 @@ export default class CardanoGetPublicKey extends AbstractMethod<'cardanoGetPubli
|
|
|
10
10
|
get info(): string;
|
|
11
11
|
confirmation(): Promise<boolean>;
|
|
12
12
|
noBackupConfirmation(allowSuppression?: boolean): Promise<boolean>;
|
|
13
|
-
run(): Promise<import("
|
|
13
|
+
run(): Promise<import("../../..").CardanoPublicKey | import("../../..").CardanoPublicKey[]>;
|
|
14
14
|
}
|
|
15
15
|
export {};
|
|
16
16
|
//# sourceMappingURL=cardanoGetPublicKey.d.ts.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const constants_1 = require("
|
|
4
|
-
const AbstractMethod_1 = require("
|
|
5
|
-
const paramsValidator_1 = require("
|
|
6
|
-
const coinInfo_1 = require("
|
|
7
|
-
const pathUtils_1 = require("
|
|
8
|
-
const events_1 = require("
|
|
3
|
+
const constants_1 = require("../../../constants");
|
|
4
|
+
const AbstractMethod_1 = require("../../../core/AbstractMethod");
|
|
5
|
+
const paramsValidator_1 = require("../../common/paramsValidator");
|
|
6
|
+
const coinInfo_1 = require("../../../data/coinInfo");
|
|
7
|
+
const pathUtils_1 = require("../../../utils/pathUtils");
|
|
8
|
+
const events_1 = require("../../../events");
|
|
9
9
|
class CardanoGetPublicKey extends AbstractMethod_1.AbstractMethod {
|
|
10
10
|
init() {
|
|
11
11
|
this.requiredPermissions = ['read'];
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { AbstractMethod } from '
|
|
2
|
-
import type { CertificateWithPoolOwnersAndRelays } from '
|
|
3
|
-
import { Path, InputWithPath, CollateralInputWithPath } from '
|
|
4
|
-
import type { OutputWithData } from '
|
|
5
|
-
import { PROTO } from '
|
|
6
|
-
import type { CardanoSignedTxData } from '
|
|
7
|
-
import type { AssetGroupWithTokens } from '
|
|
1
|
+
import { AbstractMethod } from '../../../core/AbstractMethod';
|
|
2
|
+
import type { CertificateWithPoolOwnersAndRelays } from '../cardanoCertificate';
|
|
3
|
+
import { Path, InputWithPath, CollateralInputWithPath } from '../cardanoInputs';
|
|
4
|
+
import type { OutputWithData } from '../cardanoOutputs';
|
|
5
|
+
import { PROTO } from '../../../constants';
|
|
6
|
+
import type { CardanoAuxiliaryDataSupplement, CardanoSignedTxData, CardanoSignedTxWitness } from '../../../types/api/cardano';
|
|
7
|
+
import type { AssetGroupWithTokens } from '../cardanoTokenBundle';
|
|
8
8
|
declare const CardanoSignTransactionFeatures: Readonly<{
|
|
9
9
|
TransactionStreaming: string[];
|
|
10
10
|
TokenMinting: string[];
|
|
@@ -41,6 +41,12 @@ export type CardanoSignTransactionParams = {
|
|
|
41
41
|
additionalWitnessRequests: Path[];
|
|
42
42
|
derivationType: PROTO.CardanoDerivationType;
|
|
43
43
|
includeNetworkId?: boolean;
|
|
44
|
+
unsignedTx?: {
|
|
45
|
+
body: string;
|
|
46
|
+
hash: string;
|
|
47
|
+
};
|
|
48
|
+
testnet?: boolean;
|
|
49
|
+
chunkify?: boolean;
|
|
44
50
|
};
|
|
45
51
|
export default class CardanoSignTransaction extends AbstractMethod<'cardanoSignTransaction', CardanoSignTransactionParams> {
|
|
46
52
|
init(): void;
|
|
@@ -49,7 +55,12 @@ export default class CardanoSignTransaction extends AbstractMethod<'cardanoSignT
|
|
|
49
55
|
_ensureFeatureIsSupported(feature: keyof typeof CardanoSignTransactionFeatures): void;
|
|
50
56
|
_ensureFirmwareSupportsParams(): void;
|
|
51
57
|
_sign_tx(): Promise<CardanoSignedTxData>;
|
|
52
|
-
run(): Promise<CardanoSignedTxData
|
|
58
|
+
run(): Promise<CardanoSignedTxData | {
|
|
59
|
+
serializedTx: string;
|
|
60
|
+
hash: string;
|
|
61
|
+
witnesses: CardanoSignedTxWitness[];
|
|
62
|
+
auxiliaryDataSupplement?: CardanoAuxiliaryDataSupplement | undefined;
|
|
63
|
+
}>;
|
|
53
64
|
}
|
|
54
65
|
export {};
|
|
55
66
|
//# sourceMappingURL=cardanoSignTransaction.d.ts.map
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
const
|
|
11
|
-
const
|
|
12
|
-
const
|
|
13
|
-
const
|
|
3
|
+
const coin_selection_1 = require("@fivebinaries/coin-selection");
|
|
4
|
+
const AbstractMethod_1 = require("../../../core/AbstractMethod");
|
|
5
|
+
const paramsValidator_1 = require("../../common/paramsValidator");
|
|
6
|
+
const coinInfo_1 = require("../../../data/coinInfo");
|
|
7
|
+
const pathUtils_1 = require("../../../utils/pathUtils");
|
|
8
|
+
const cardanoAuxiliaryData_1 = require("../cardanoAuxiliaryData");
|
|
9
|
+
const cardanoCertificate_1 = require("../cardanoCertificate");
|
|
10
|
+
const cardanoInputs_1 = require("../cardanoInputs");
|
|
11
|
+
const cardanoOutputs_1 = require("../cardanoOutputs");
|
|
12
|
+
const constants_1 = require("../../../constants");
|
|
13
|
+
const cardanoWitnesses_1 = require("../cardanoWitnesses");
|
|
14
|
+
const cardanoTokenBundle_1 = require("../cardanoTokenBundle");
|
|
14
15
|
const CardanoSignTransactionFeatures = Object.freeze({
|
|
15
16
|
TransactionStreaming: ['0', '2.4.2'],
|
|
16
17
|
TokenMinting: ['0', '2.4.3'],
|
|
@@ -65,6 +66,9 @@ class CardanoSignTransaction extends AbstractMethod_1.AbstractMethod {
|
|
|
65
66
|
{ name: 'additionalWitnessRequests', type: 'array', allowEmpty: true },
|
|
66
67
|
{ name: 'derivationType', type: 'number' },
|
|
67
68
|
{ name: 'includeNetworkId', type: 'boolean' },
|
|
69
|
+
{ name: 'unsignedTx', type: 'object' },
|
|
70
|
+
{ name: 'testnet', type: 'boolean' },
|
|
71
|
+
{ name: 'chunkify', type: 'boolean' },
|
|
68
72
|
]);
|
|
69
73
|
const inputsWithPath = payload.inputs.map(cardanoInputs_1.transformInput);
|
|
70
74
|
const outputsWithData = payload.outputs.map(cardanoOutputs_1.transformOutput);
|
|
@@ -148,6 +152,9 @@ class CardanoSignTransaction extends AbstractMethod_1.AbstractMethod {
|
|
|
148
152
|
? payload.derivationType
|
|
149
153
|
: constants_1.PROTO.CardanoDerivationType.ICARUS_TREZOR,
|
|
150
154
|
includeNetworkId: payload.includeNetworkId,
|
|
155
|
+
unsignedTx: 'unsignedTx' in payload ? payload.unsignedTx : undefined,
|
|
156
|
+
testnet: 'testnet' in payload ? payload.testnet : undefined,
|
|
157
|
+
chunkify: typeof payload.chunkify === 'boolean' ? payload.chunkify : false,
|
|
151
158
|
};
|
|
152
159
|
}
|
|
153
160
|
get info() {
|
|
@@ -249,6 +256,7 @@ class CardanoSignTransaction extends AbstractMethod_1.AbstractMethod {
|
|
|
249
256
|
reference_inputs_count: this.params.referenceInputs.length,
|
|
250
257
|
derivation_type: this.params.derivationType,
|
|
251
258
|
include_network_id: this.params.includeNetworkId,
|
|
259
|
+
chunkify: this.params.chunkify,
|
|
252
260
|
};
|
|
253
261
|
await typedCall('CardanoSignTxInit', 'CardanoTxItemAck', signTxInitMessage);
|
|
254
262
|
for (const { input } of this.params.inputsWithPath) {
|
|
@@ -329,9 +337,21 @@ class CardanoSignTransaction extends AbstractMethod_1.AbstractMethod {
|
|
|
329
337
|
await typedCall('CardanoTxHostAck', 'CardanoSignTxFinished');
|
|
330
338
|
return { hash: txBodyHashMessage.tx_hash, witnesses, auxiliaryDataSupplement };
|
|
331
339
|
}
|
|
332
|
-
run() {
|
|
340
|
+
async run() {
|
|
333
341
|
this._ensureFirmwareSupportsParams();
|
|
334
|
-
|
|
342
|
+
const result = await this._sign_tx();
|
|
343
|
+
if (!this.params.unsignedTx)
|
|
344
|
+
return result;
|
|
345
|
+
const { unsignedTx, testnet } = this.params;
|
|
346
|
+
const { hash, witnesses } = result;
|
|
347
|
+
if (hash !== unsignedTx.hash) {
|
|
348
|
+
throw constants_1.ERRORS.TypedError('Runtime', "Constructed transaction doesn't match the hash returned by the device.");
|
|
349
|
+
}
|
|
350
|
+
const serializedTx = coin_selection_1.trezorUtils.signTransaction(unsignedTx.body, witnesses, { testnet });
|
|
351
|
+
return {
|
|
352
|
+
...result,
|
|
353
|
+
serializedTx,
|
|
354
|
+
};
|
|
335
355
|
}
|
|
336
356
|
}
|
|
337
357
|
exports.default = CardanoSignTransaction;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default as cardanoGetAddress } from './cardanoGetAddress';
|
|
2
|
+
export { default as cardanoGetNativeScriptHash } from './cardanoGetNativeScriptHash';
|
|
3
|
+
export { default as cardanoGetPublicKey } from './cardanoGetPublicKey';
|
|
4
|
+
export { default as cardanoSignTransaction } from './cardanoSignTransaction';
|
|
5
|
+
export { default as cardanoComposeTransaction } from './cardanoComposeTransaction';
|
|
6
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.cardanoComposeTransaction = exports.cardanoSignTransaction = exports.cardanoGetPublicKey = exports.cardanoGetNativeScriptHash = exports.cardanoGetAddress = void 0;
|
|
7
|
+
var cardanoGetAddress_1 = require("./cardanoGetAddress");
|
|
8
|
+
Object.defineProperty(exports, "cardanoGetAddress", { enumerable: true, get: function () { return __importDefault(cardanoGetAddress_1).default; } });
|
|
9
|
+
var cardanoGetNativeScriptHash_1 = require("./cardanoGetNativeScriptHash");
|
|
10
|
+
Object.defineProperty(exports, "cardanoGetNativeScriptHash", { enumerable: true, get: function () { return __importDefault(cardanoGetNativeScriptHash_1).default; } });
|
|
11
|
+
var cardanoGetPublicKey_1 = require("./cardanoGetPublicKey");
|
|
12
|
+
Object.defineProperty(exports, "cardanoGetPublicKey", { enumerable: true, get: function () { return __importDefault(cardanoGetPublicKey_1).default; } });
|
|
13
|
+
var cardanoSignTransaction_1 = require("./cardanoSignTransaction");
|
|
14
|
+
Object.defineProperty(exports, "cardanoSignTransaction", { enumerable: true, get: function () { return __importDefault(cardanoSignTransaction_1).default; } });
|
|
15
|
+
var cardanoComposeTransaction_1 = require("./cardanoComposeTransaction");
|
|
16
|
+
Object.defineProperty(exports, "cardanoComposeTransaction", { enumerable: true, get: function () { return __importDefault(cardanoComposeTransaction_1).default; } });
|
|
17
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
import { types } from '@fivebinaries/coin-selection';
|
|
2
|
+
import { AccountUtxo, CardanoCertificate } from '../../types';
|
|
3
|
+
export declare const transformUtxos: (utxos: AccountUtxo[]) => types.Utxo[];
|
|
4
|
+
export declare const prepareCertificates: (certs: CardanoCertificate[]) => types.Certificate[];
|
|
5
|
+
export declare const getTtl: (testnet: boolean) => number;
|
|
6
|
+
export declare const composeTxPlan: (descriptor: string, utxo: AccountUtxo[], outputs: types.UserOutput[], certificates: CardanoCertificate[], withdrawals: types.Withdrawal[], changeAddress: string, isTestnet: boolean, options?: types.Options) => types.PrecomposedTransaction;
|
|
1
7
|
export declare const hexStringByteLength: (s: string) => number;
|
|
2
8
|
export declare const sendChunkedHexString: (typedCall: any, data: string, chunkSize: number, messageType: string) => Promise<void>;
|
|
3
9
|
//# sourceMappingURL=cardanoUtils.d.ts.map
|
|
@@ -1,6 +1,69 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.sendChunkedHexString = exports.hexStringByteLength = void 0;
|
|
3
|
+
exports.sendChunkedHexString = exports.hexStringByteLength = exports.composeTxPlan = exports.getTtl = exports.prepareCertificates = exports.transformUtxos = void 0;
|
|
4
|
+
const coin_selection_1 = require("@fivebinaries/coin-selection");
|
|
5
|
+
const constants_1 = require("../../constants");
|
|
6
|
+
const CARDANO_DEFAULT_TTL_OFFSET = 7200;
|
|
7
|
+
const transformUtxos = (utxos) => {
|
|
8
|
+
const result = [];
|
|
9
|
+
utxos === null || utxos === void 0 ? void 0 : utxos.forEach(utxo => {
|
|
10
|
+
const foundItem = result.find(res => res.txHash === utxo.txid && res.outputIndex === utxo.vout);
|
|
11
|
+
if (utxo.cardanoSpecific) {
|
|
12
|
+
if (!foundItem) {
|
|
13
|
+
result.push({
|
|
14
|
+
address: utxo.address,
|
|
15
|
+
txHash: utxo.txid,
|
|
16
|
+
outputIndex: utxo.vout,
|
|
17
|
+
amount: [{ quantity: utxo.amount, unit: utxo.cardanoSpecific.unit }],
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
else {
|
|
21
|
+
foundItem.amount.push({ quantity: utxo.amount, unit: utxo.cardanoSpecific.unit });
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
return result;
|
|
26
|
+
};
|
|
27
|
+
exports.transformUtxos = transformUtxos;
|
|
28
|
+
const prepareCertificates = (certs) => {
|
|
29
|
+
const convertedCerts = [];
|
|
30
|
+
certs.forEach(cert => {
|
|
31
|
+
switch (cert.type) {
|
|
32
|
+
case constants_1.PROTO.CardanoCertificateType.STAKE_DELEGATION:
|
|
33
|
+
convertedCerts.push({
|
|
34
|
+
type: cert.type,
|
|
35
|
+
pool: cert.pool,
|
|
36
|
+
});
|
|
37
|
+
break;
|
|
38
|
+
case constants_1.PROTO.CardanoCertificateType.STAKE_REGISTRATION:
|
|
39
|
+
case constants_1.PROTO.CardanoCertificateType.STAKE_DEREGISTRATION:
|
|
40
|
+
convertedCerts.push({
|
|
41
|
+
type: cert.type,
|
|
42
|
+
});
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
});
|
|
46
|
+
return convertedCerts;
|
|
47
|
+
};
|
|
48
|
+
exports.prepareCertificates = prepareCertificates;
|
|
49
|
+
const getTtl = (testnet) => {
|
|
50
|
+
const shelleySlot = testnet ? 6192449 : 4924800;
|
|
51
|
+
const shelleyTimestamp = testnet ? 1672848449 : 1596491091;
|
|
52
|
+
const currentTimestamp = Math.floor(new Date().getTime() / 1000);
|
|
53
|
+
const currentSlot = shelleySlot + currentTimestamp - shelleyTimestamp;
|
|
54
|
+
return currentSlot + CARDANO_DEFAULT_TTL_OFFSET;
|
|
55
|
+
};
|
|
56
|
+
exports.getTtl = getTtl;
|
|
57
|
+
const composeTxPlan = (descriptor, utxo, outputs, certificates, withdrawals, changeAddress, isTestnet, options) => (0, coin_selection_1.coinSelection)({
|
|
58
|
+
utxos: (0, exports.transformUtxos)(utxo),
|
|
59
|
+
outputs,
|
|
60
|
+
changeAddress,
|
|
61
|
+
certificates: (0, exports.prepareCertificates)(certificates),
|
|
62
|
+
withdrawals,
|
|
63
|
+
accountPubKey: descriptor,
|
|
64
|
+
ttl: (0, exports.getTtl)(isTestnet),
|
|
65
|
+
}, options);
|
|
66
|
+
exports.composeTxPlan = composeTxPlan;
|
|
4
67
|
const hexStringByteLength = (s) => s.length / 2;
|
|
5
68
|
exports.hexStringByteLength = hexStringByteLength;
|
|
6
69
|
const sendChunkedHexString = async (typedCall, data, chunkSize, messageType) => {
|
|
@@ -72,12 +72,14 @@ const getFirmwareRange = (method, coinInfo, currentRange) => {
|
|
|
72
72
|
const models = Object.keys(range);
|
|
73
73
|
if (coinInfo) {
|
|
74
74
|
models.forEach(model => {
|
|
75
|
-
|
|
75
|
+
const supportVersion = coinInfo.support ? coinInfo.support[model] : false;
|
|
76
|
+
if (supportVersion === false) {
|
|
76
77
|
range[model].min = '0';
|
|
77
78
|
}
|
|
78
79
|
else if (range[model].min !== '0' &&
|
|
79
|
-
|
|
80
|
-
range[model].min
|
|
80
|
+
typeof supportVersion === 'string' &&
|
|
81
|
+
utils_1.versionUtils.isNewer(supportVersion, range[model].min)) {
|
|
82
|
+
range[model].min = supportVersion;
|
|
81
83
|
}
|
|
82
84
|
});
|
|
83
85
|
}
|
|
@@ -2,9 +2,9 @@ import BigNumber from 'bignumber.js';
|
|
|
2
2
|
import { AbstractMethod } from '../core/AbstractMethod';
|
|
3
3
|
import { Discovery } from './common/Discovery';
|
|
4
4
|
import { TransactionComposer } from './bitcoin';
|
|
5
|
-
import type { ComposeOutput
|
|
5
|
+
import type { ComposeOutput } from '@trezor/utxo-lib';
|
|
6
6
|
import type { BitcoinNetworkInfo, DiscoveryAccount, AccountUtxo } from '../types';
|
|
7
|
-
import type { SignedTransaction, PrecomposeParams,
|
|
7
|
+
import type { SignedTransaction, PrecomposeParams, ComposeResult, PrecomposedResult } from '../types/api/composeTransaction';
|
|
8
8
|
type Params = {
|
|
9
9
|
outputs: ComposeOutput[];
|
|
10
10
|
coinInfo: BitcoinNetworkInfo;
|
|
@@ -21,13 +21,13 @@ export default class ComposeTransaction extends AbstractMethod<'composeTransacti
|
|
|
21
21
|
discovery?: Discovery;
|
|
22
22
|
init(): void;
|
|
23
23
|
get info(): string;
|
|
24
|
-
precompose(account: PrecomposeParams['account'], feeLevels: PrecomposeParams['feeLevels']): Promise<
|
|
25
|
-
run(): Promise<SignedTransaction |
|
|
24
|
+
precompose(account: PrecomposeParams['account'], feeLevels: PrecomposeParams['feeLevels']): Promise<PrecomposedResult[]>;
|
|
25
|
+
run(): Promise<SignedTransaction | PrecomposedResult[]>;
|
|
26
26
|
selectAccount(): Promise<{
|
|
27
27
|
account: DiscoveryAccount;
|
|
28
28
|
utxo: AccountUtxo[];
|
|
29
29
|
}>;
|
|
30
|
-
selectFee(account: DiscoveryAccount,
|
|
30
|
+
selectFee(account: DiscoveryAccount, utxos: AccountUtxo[]): Promise<SignedTransaction | "change-account">;
|
|
31
31
|
_selectFeeUiResponse(composer: TransactionComposer): Promise<SignedTransaction | 'change-account'>;
|
|
32
32
|
_sign(tx: ComposeResult): Promise<import("../types").SignedTransaction>;
|
|
33
33
|
dispose(): void;
|
|
@@ -77,7 +77,7 @@ class ComposeTransaction extends AbstractMethod_1.AbstractMethod {
|
|
|
77
77
|
address_n,
|
|
78
78
|
addresses: account.addresses,
|
|
79
79
|
},
|
|
80
|
-
|
|
80
|
+
utxos: account.utxo,
|
|
81
81
|
coinInfo,
|
|
82
82
|
outputs,
|
|
83
83
|
baseFee,
|
|
@@ -89,21 +89,16 @@ class ComposeTransaction extends AbstractMethod_1.AbstractMethod {
|
|
|
89
89
|
composer.composeCustomFee(level.feePerUnit);
|
|
90
90
|
const tx = { ...composer.composed.custom };
|
|
91
91
|
if (tx.type === 'final') {
|
|
92
|
-
const inputs = tx.transaction.inputs.map(inp => (0, bitcoin_1.inputToTrezor)(inp, this.params.sequence || 0xffffffff));
|
|
93
|
-
const { sorted, permutation } = tx.transaction.outputs;
|
|
94
|
-
const txOutputs = sorted.map(out => (0, bitcoin_1.outputToTrezor)(out, coinInfo));
|
|
95
92
|
return {
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
outputsPermutation: permutation,
|
|
106
|
-
},
|
|
93
|
+
...tx,
|
|
94
|
+
inputs: tx.inputs.map(inp => (0, bitcoin_1.inputToTrezor)(inp, this.params.sequence)),
|
|
95
|
+
outputs: tx.outputs.map(bitcoin_1.outputToTrezor),
|
|
96
|
+
};
|
|
97
|
+
}
|
|
98
|
+
if (tx.type === 'nonfinal') {
|
|
99
|
+
return {
|
|
100
|
+
...tx,
|
|
101
|
+
inputs: tx.inputs.map(inp => (0, bitcoin_1.inputToTrezor)(inp, this.params.sequence)),
|
|
107
102
|
};
|
|
108
103
|
}
|
|
109
104
|
return tx;
|
|
@@ -184,12 +179,12 @@ class ComposeTransaction extends AbstractMethod_1.AbstractMethod {
|
|
|
184
179
|
utxo,
|
|
185
180
|
};
|
|
186
181
|
}
|
|
187
|
-
async selectFee(account,
|
|
182
|
+
async selectFee(account, utxos) {
|
|
188
183
|
const { coinInfo, outputs } = this.params;
|
|
189
184
|
const blockchain = await (0, BlockchainLink_1.initBlockchain)(coinInfo, this.postMessage);
|
|
190
185
|
const composer = new bitcoin_1.TransactionComposer({
|
|
191
186
|
account,
|
|
192
|
-
|
|
187
|
+
utxos,
|
|
193
188
|
coinInfo,
|
|
194
189
|
outputs,
|
|
195
190
|
});
|
|
@@ -227,8 +222,8 @@ class ComposeTransaction extends AbstractMethod_1.AbstractMethod {
|
|
|
227
222
|
throw constants_1.ERRORS.TypedError('Runtime', 'ComposeTransaction: Trying to sign unfinished tx');
|
|
228
223
|
const { coinInfo } = this.params;
|
|
229
224
|
const options = (0, bitcoin_1.enhanceSignTx)({}, coinInfo);
|
|
230
|
-
const inputs = tx.
|
|
231
|
-
const outputs = tx.
|
|
225
|
+
const inputs = tx.inputs.map(inp => (0, bitcoin_1.inputToTrezor)(inp, this.params.sequence));
|
|
226
|
+
const outputs = tx.outputs.map(bitcoin_1.outputToTrezor);
|
|
232
227
|
let refTxs = [];
|
|
233
228
|
const requiredRefTxs = (0, bitcoin_1.requireReferencedTransactions)(inputs, options, coinInfo);
|
|
234
229
|
const refTxsIds = (0, bitcoin_1.getReferencedTransactions)(inputs);
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { AbstractMethod } from '../../../core/AbstractMethod';
|
|
2
|
+
import type { PROTO } from '../../../constants';
|
|
3
|
+
export default class EosGetPublicKey extends AbstractMethod<'eosGetPublicKey', PROTO.EosGetPublicKey[]> {
|
|
4
|
+
hasBundle?: boolean;
|
|
5
|
+
confirmed?: boolean;
|
|
6
|
+
init(): void;
|
|
7
|
+
get info(): string;
|
|
8
|
+
confirmation(): Promise<boolean>;
|
|
9
|
+
run(): Promise<import("../../..").EosPublicKey | import("../../..").EosPublicKey[]>;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=eosGetPublicKey.d.ts.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const AbstractMethod_1 = require("
|
|
4
|
-
const paramsValidator_1 = require("
|
|
5
|
-
const coinInfo_1 = require("
|
|
6
|
-
const pathUtils_1 = require("
|
|
7
|
-
const events_1 = require("
|
|
3
|
+
const AbstractMethod_1 = require("../../../core/AbstractMethod");
|
|
4
|
+
const paramsValidator_1 = require("../../common/paramsValidator");
|
|
5
|
+
const coinInfo_1 = require("../../../data/coinInfo");
|
|
6
|
+
const pathUtils_1 = require("../../../utils/pathUtils");
|
|
7
|
+
const events_1 = require("../../../events");
|
|
8
8
|
class EosGetPublicKey extends AbstractMethod_1.AbstractMethod {
|
|
9
9
|
init() {
|
|
10
10
|
this.requiredPermissions = ['read'];
|
|
@@ -18,11 +18,13 @@ class EosGetPublicKey extends AbstractMethod_1.AbstractMethod {
|
|
|
18
18
|
(0, paramsValidator_1.validateParams)(batch, [
|
|
19
19
|
{ name: 'path', required: true },
|
|
20
20
|
{ name: 'showOnTrezor', type: 'boolean' },
|
|
21
|
+
{ name: 'chunkify', type: 'boolean' },
|
|
21
22
|
]);
|
|
22
23
|
const path = (0, pathUtils_1.validatePath)(batch.path, 3);
|
|
23
24
|
return {
|
|
24
25
|
address_n: path,
|
|
25
26
|
show_display: typeof batch.showOnTrezor === 'boolean' ? batch.showOnTrezor : false,
|
|
27
|
+
chunkify: typeof batch.chunkify === 'boolean' ? batch.chunkify : false,
|
|
26
28
|
};
|
|
27
29
|
});
|
|
28
30
|
}
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { AbstractMethod } from '
|
|
2
|
-
import type { PROTO } from '
|
|
1
|
+
import { AbstractMethod } from '../../../core/AbstractMethod';
|
|
2
|
+
import type { PROTO } from '../../../constants';
|
|
3
3
|
type Params = {
|
|
4
4
|
path: number[];
|
|
5
5
|
chain_id: string;
|
|
6
6
|
header: PROTO.EosTxHeader;
|
|
7
7
|
ack: PROTO.EosTxActionAck[];
|
|
8
|
+
chunkify: boolean;
|
|
8
9
|
};
|
|
9
10
|
export default class EosSignTransaction extends AbstractMethod<'eosSignTransaction', Params> {
|
|
10
11
|
init(): void;
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
const tslib_1 = require("tslib");
|
|
4
|
-
const AbstractMethod_1 = require("
|
|
5
|
-
const paramsValidator_1 = require("
|
|
6
|
-
const coinInfo_1 = require("
|
|
7
|
-
const pathUtils_1 = require("
|
|
8
|
-
const helper = tslib_1.__importStar(require("
|
|
4
|
+
const AbstractMethod_1 = require("../../../core/AbstractMethod");
|
|
5
|
+
const paramsValidator_1 = require("../../common/paramsValidator");
|
|
6
|
+
const coinInfo_1 = require("../../../data/coinInfo");
|
|
7
|
+
const pathUtils_1 = require("../../../utils/pathUtils");
|
|
8
|
+
const helper = tslib_1.__importStar(require("../eosSignTx"));
|
|
9
9
|
class EosSignTransaction extends AbstractMethod_1.AbstractMethod {
|
|
10
10
|
init() {
|
|
11
11
|
this.requiredPermissions = ['read', 'write'];
|
|
@@ -14,6 +14,7 @@ class EosSignTransaction extends AbstractMethod_1.AbstractMethod {
|
|
|
14
14
|
(0, paramsValidator_1.validateParams)(payload, [
|
|
15
15
|
{ name: 'path', required: true },
|
|
16
16
|
{ name: 'transaction', required: true },
|
|
17
|
+
{ name: 'chunkify', type: 'boolean' },
|
|
17
18
|
]);
|
|
18
19
|
const path = (0, pathUtils_1.validatePath)(payload.path, 3);
|
|
19
20
|
const { chain_id, header, ack } = helper.validate(payload.transaction);
|
|
@@ -22,13 +23,14 @@ class EosSignTransaction extends AbstractMethod_1.AbstractMethod {
|
|
|
22
23
|
chain_id,
|
|
23
24
|
header,
|
|
24
25
|
ack,
|
|
26
|
+
chunkify: typeof payload.chunkify === 'boolean' ? payload.chunkify : false,
|
|
25
27
|
};
|
|
26
28
|
}
|
|
27
29
|
get info() {
|
|
28
30
|
return 'Sign EOS transaction';
|
|
29
31
|
}
|
|
30
32
|
async run() {
|
|
31
|
-
const response = await helper.signTx(this.device.getCommands().typedCall.bind(this.device.getCommands()), this.params.path, this.params.chain_id, this.params.header, this.params.ack);
|
|
33
|
+
const response = await helper.signTx(this.device.getCommands().typedCall.bind(this.device.getCommands()), this.params.path, this.params.chain_id, this.params.header, this.params.ack, this.params.chunkify);
|
|
32
34
|
return {
|
|
33
35
|
signature: response.signature,
|
|
34
36
|
};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.eosSignTransaction = exports.eosGetPublicKey = void 0;
|
|
7
|
+
var eosGetPublicKey_1 = require("./eosGetPublicKey");
|
|
8
|
+
Object.defineProperty(exports, "eosGetPublicKey", { enumerable: true, get: function () { return __importDefault(eosGetPublicKey_1).default; } });
|
|
9
|
+
var eosSignTransaction_1 = require("./eosSignTransaction");
|
|
10
|
+
Object.defineProperty(exports, "eosSignTransaction", { enumerable: true, get: function () { return __importDefault(eosSignTransaction_1).default; } });
|
|
11
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -13,5 +13,5 @@ export declare const validate: (tx: EosSDKTransaction) => {
|
|
|
13
13
|
};
|
|
14
14
|
ack: PROTO.EosTxActionAck[];
|
|
15
15
|
};
|
|
16
|
-
export declare const signTx: (typedCall: TypedCall, address_n: number[], chain_id: string, header: PROTO.EosTxHeader, actions: PROTO.EosTxActionAck[]) => Promise<PROTO.EosSignedTx>;
|
|
16
|
+
export declare const signTx: (typedCall: TypedCall, address_n: number[], chain_id: string, header: PROTO.EosTxHeader, actions: PROTO.EosTxActionAck[], chunkify: boolean) => Promise<PROTO.EosSignedTx>;
|
|
17
17
|
//# sourceMappingURL=eosSignTx.d.ts.map
|
package/lib/api/eos/eosSignTx.js
CHANGED
|
@@ -334,12 +334,13 @@ const processTxRequest = async (typedCall, message, actions, index) => {
|
|
|
334
334
|
}
|
|
335
335
|
return processTxRequest(typedCall, ack.message, actions, index);
|
|
336
336
|
};
|
|
337
|
-
const signTx = async (typedCall, address_n, chain_id, header, actions) => {
|
|
337
|
+
const signTx = async (typedCall, address_n, chain_id, header, actions, chunkify) => {
|
|
338
338
|
const response = await typedCall('EosSignTx', 'EosTxActionRequest', {
|
|
339
339
|
address_n,
|
|
340
340
|
chain_id,
|
|
341
341
|
header,
|
|
342
342
|
num_actions: actions.length,
|
|
343
|
+
chunkify,
|
|
343
344
|
});
|
|
344
345
|
return processTxRequest(typedCall, response.message, actions, 0);
|
|
345
346
|
};
|