@cardano-sdk/hardware-trezor 0.4.26 → 0.4.27
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/dist/cjs/TrezorKeyAgent.d.ts +5 -3
- package/dist/cjs/TrezorKeyAgent.d.ts.map +1 -1
- package/dist/cjs/TrezorKeyAgent.js +6 -4
- package/dist/cjs/TrezorKeyAgent.js.map +1 -1
- package/dist/cjs/transformers/additionalWitnessRequests.js +4 -4
- package/dist/cjs/transformers/additionalWitnessRequests.js.map +1 -1
- package/dist/cjs/tsconfig.tsbuildinfo +1 -1
- package/dist/esm/TrezorKeyAgent.d.ts +5 -3
- package/dist/esm/TrezorKeyAgent.d.ts.map +1 -1
- package/dist/esm/TrezorKeyAgent.js +8 -6
- package/dist/esm/TrezorKeyAgent.js.map +1 -1
- package/dist/esm/index.d.ts +3 -3
- package/dist/esm/index.js +3 -3
- package/dist/esm/transformers/additionalWitnessRequests.d.ts +1 -1
- package/dist/esm/transformers/additionalWitnessRequests.js +3 -3
- package/dist/esm/transformers/additionalWitnessRequests.js.map +1 -1
- package/dist/esm/transformers/certificates.d.ts +1 -1
- package/dist/esm/transformers/index.d.ts +7 -7
- package/dist/esm/transformers/index.js +7 -7
- package/dist/esm/transformers/keyPaths.d.ts +1 -1
- package/dist/esm/transformers/requiredSigners.d.ts +1 -1
- package/dist/esm/transformers/tx.d.ts +1 -1
- package/dist/esm/transformers/tx.js +3 -3
- package/dist/esm/transformers/txIn.d.ts +1 -1
- package/dist/esm/transformers/txIn.js +1 -1
- package/dist/esm/transformers/txOut.d.ts +1 -1
- package/dist/esm/transformers/txOut.js +1 -1
- package/dist/esm/transformers/withdrawals.d.ts +1 -1
- package/dist/esm/transformers/withdrawals.js +1 -1
- package/dist/esm/tsconfig.tsbuildinfo +1 -1
- package/package.json +10 -11
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as Crypto from '@cardano-sdk/crypto';
|
|
2
2
|
import * as Trezor from '@trezor/connect';
|
|
3
3
|
import { Cardano } from '@cardano-sdk/core';
|
|
4
|
-
import { CommunicationType, KeyAgentBase, KeyAgentDependencies, SerializableTrezorKeyAgentData, SignBlobResult, SignTransactionContext, TrezorConfig } from '@cardano-sdk/key-management';
|
|
4
|
+
import { CommunicationType, KeyAgentBase, KeyAgentDependencies, KeyPurpose, SerializableTrezorKeyAgentData, SignBlobResult, SignTransactionContext, TrezorConfig } from '@cardano-sdk/key-management';
|
|
5
5
|
declare const TrezorConnectNode: Trezor.TrezorConnect;
|
|
6
6
|
declare const TrezorConnectWeb: Trezor.TrezorConnect;
|
|
7
7
|
export interface TrezorKeyAgentProps extends Omit<SerializableTrezorKeyAgentData, '__typename'> {
|
|
@@ -10,11 +10,13 @@ export interface TrezorKeyAgentProps extends Omit<SerializableTrezorKeyAgentData
|
|
|
10
10
|
export interface GetTrezorXpubProps {
|
|
11
11
|
accountIndex: number;
|
|
12
12
|
communicationType: CommunicationType;
|
|
13
|
+
purpose: KeyPurpose;
|
|
13
14
|
}
|
|
14
15
|
export interface CreateTrezorKeyAgentProps {
|
|
15
16
|
chainId: Cardano.ChainId;
|
|
16
17
|
accountIndex?: number;
|
|
17
18
|
trezorConfig: TrezorConfig;
|
|
19
|
+
purpose?: KeyPurpose;
|
|
18
20
|
}
|
|
19
21
|
export declare type TrezorConnectInstanceType = typeof TrezorConnectNode | typeof TrezorConnectWeb;
|
|
20
22
|
export declare class TrezorKeyAgent extends KeyAgentBase {
|
|
@@ -23,8 +25,8 @@ export declare class TrezorKeyAgent extends KeyAgentBase {
|
|
|
23
25
|
constructor({ isTrezorInitialized, ...serializableData }: TrezorKeyAgentProps, dependencies: KeyAgentDependencies);
|
|
24
26
|
static initializeTrezorTransport({ manifest, communicationType, silentMode, lazyLoad }: TrezorConfig): Promise<boolean>;
|
|
25
27
|
static checkDeviceConnection(communicationType: CommunicationType): Promise<Trezor.Features>;
|
|
26
|
-
static getXpub({ accountIndex, communicationType }: GetTrezorXpubProps): Promise<Crypto.Bip32PublicKeyHex>;
|
|
27
|
-
static createWithDevice({ chainId, accountIndex, trezorConfig }: CreateTrezorKeyAgentProps, dependencies: KeyAgentDependencies): Promise<TrezorKeyAgent>;
|
|
28
|
+
static getXpub({ accountIndex, communicationType, purpose }: GetTrezorXpubProps): Promise<Crypto.Bip32PublicKeyHex>;
|
|
29
|
+
static createWithDevice({ chainId, accountIndex, trezorConfig, purpose }: CreateTrezorKeyAgentProps, dependencies: KeyAgentDependencies): Promise<TrezorKeyAgent>;
|
|
28
30
|
static matchSigningMode(tx: Omit<Trezor.CardanoSignTransaction, 'signingMode'>): Trezor.PROTO.CardanoTxSigningMode;
|
|
29
31
|
signTransaction({ body, hash }: Cardano.TxBodyWithHash, { knownAddresses, txInKeyPathMap }: SignTransactionContext): Promise<Cardano.Signatures>;
|
|
30
32
|
signBlob(): Promise<SignBlobResult>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TrezorKeyAgent.d.ts","sourceRoot":"","sources":["../../src/TrezorKeyAgent.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,qBAAqB,CAAC;AAC9C,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAE,OAAO,EAAuB,MAAM,mBAAmB,CAAC;AACjE,OAAO,EAEL,iBAAiB,EACjB,YAAY,EACZ,oBAAoB,EAEpB,8BAA8B,EAC9B,cAAc,EACd,sBAAsB,EACtB,YAAY,EAGb,MAAM,6BAA6B,CAAC;AAKrC,QAAA,MAAM,iBAAiB,sBAAiB,CAAC;AACzC,QAAA,MAAM,gBAAgB,sBAED,CAAC;AAQtB,MAAM,WAAW,mBAAoB,SAAQ,IAAI,CAAC,8BAA8B,EAAE,YAAY,CAAC;IAC7F,mBAAmB,CAAC,EAAE,OAAO,CAAC;CAC/B;AAED,MAAM,WAAW,kBAAkB;IACjC,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,EAAE,iBAAiB,CAAC;
|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AY,GAAG,OAAO,CAAC,OAAO,CAAC;WAsBrB,qBAAqB,CAAC,iBAAiB,EAAE,iBAAiB,GAAG,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC;WAgBrF,OAAO,CAAC,EACnB,YAAY,EACZ,iBAAiB,EACjB,OAAO,EACR,EAAE,kBAAkB,GAAG,OAAO,CAAC,MAAM,CAAC,iBAAiB,CAAC;WAkB5C,gBAAgB,CAC3B,EAAE,OAAO,EAAE,YAAgB,EAAE,YAAY,EAAE,OAA6B,EAAE,EAAE,yBAAyB,EACrG,YAAY,EAAE,oBAAoB;IA0BpC,MAAM,CAAC,gBAAgB,CAAC,EAAE,EAAE,IAAI,CAAC,MAAM,CAAC,sBAAsB,EAAE,aAAa,CAAC,GAAG,MAAM,CAAC,KAAK,CAAC,oBAAoB;IA2B5G,eAAe,CACnB,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,OAAO,CAAC,cAAc,EACtC,EAAE,cAAc,EAAE,cAAc,EAAE,EAAE,sBAAsB,GACzD,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC;IAqDxB,QAAQ,IAAI,OAAO,CAAC,cAAc,CAAC;IAInC,oBAAoB,IAAI,OAAO,CAAC,MAAM,CAAC,kBAAkB,CAAC;CAGjE"}
|
|
@@ -13,9 +13,9 @@ var _TrezorKeyAgent_communicationType;
|
|
|
13
13
|
import * as Crypto from '@cardano-sdk/crypto';
|
|
14
14
|
import * as Trezor from '@trezor/connect';
|
|
15
15
|
import { NotImplementedError } from '@cardano-sdk/core';
|
|
16
|
-
import { CardanoKeyConst, CommunicationType, KeyAgentBase, KeyAgentType, errors, util } from '@cardano-sdk/key-management';
|
|
16
|
+
import { CardanoKeyConst, CommunicationType, KeyAgentBase, KeyAgentType, KeyPurpose, errors, util } from '@cardano-sdk/key-management';
|
|
17
17
|
import { areStringsEqualInConstantTime } from '@cardano-sdk/util';
|
|
18
|
-
import { txToTrezor } from './transformers/tx';
|
|
18
|
+
import { txToTrezor } from './transformers/tx.js';
|
|
19
19
|
import _TrezorConnectWeb from '@trezor/connect-web';
|
|
20
20
|
const TrezorConnectNode = Trezor.default;
|
|
21
21
|
const TrezorConnectWeb = _TrezorConnectWeb.default
|
|
@@ -87,10 +87,10 @@ export class TrezorKeyAgent extends KeyAgentBase {
|
|
|
87
87
|
throw transportTypedError(error);
|
|
88
88
|
}
|
|
89
89
|
}
|
|
90
|
-
static async getXpub({ accountIndex, communicationType }) {
|
|
90
|
+
static async getXpub({ accountIndex, communicationType, purpose }) {
|
|
91
91
|
try {
|
|
92
92
|
await TrezorKeyAgent.checkDeviceConnection(communicationType);
|
|
93
|
-
const derivationPath = `m/${
|
|
93
|
+
const derivationPath = `m/${purpose}'/${CardanoKeyConst.COIN_TYPE}'/${accountIndex}'`;
|
|
94
94
|
const trezorConnect = getTrezorConnect(communicationType);
|
|
95
95
|
const extendedPublicKey = await trezorConnect.cardanoGetPublicKey({
|
|
96
96
|
path: derivationPath,
|
|
@@ -105,17 +105,19 @@ export class TrezorKeyAgent extends KeyAgentBase {
|
|
|
105
105
|
throw transportTypedError(error);
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
|
-
static async createWithDevice({ chainId, accountIndex = 0, trezorConfig }, dependencies) {
|
|
108
|
+
static async createWithDevice({ chainId, accountIndex = 0, trezorConfig, purpose = KeyPurpose.STANDARD }, dependencies) {
|
|
109
109
|
const isTrezorInitialized = await TrezorKeyAgent.initializeTrezorTransport(trezorConfig);
|
|
110
110
|
const extendedAccountPublicKey = await TrezorKeyAgent.getXpub({
|
|
111
111
|
accountIndex,
|
|
112
|
-
communicationType: trezorConfig.communicationType
|
|
112
|
+
communicationType: trezorConfig.communicationType,
|
|
113
|
+
purpose
|
|
113
114
|
});
|
|
114
115
|
return new TrezorKeyAgent({
|
|
115
116
|
accountIndex,
|
|
116
117
|
chainId,
|
|
117
118
|
extendedAccountPublicKey,
|
|
118
119
|
isTrezorInitialized,
|
|
120
|
+
purpose,
|
|
119
121
|
trezorConfig
|
|
120
122
|
}, dependencies);
|
|
121
123
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TrezorKeyAgent.js","sourceRoot":"","sources":["../../src/TrezorKeyAgent.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,OAAO,KAAK,MAAM,MAAM,qBAAqB,CAAC;AAC9C,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAW,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,YAAY,EAEZ,YAAY,
|
|
1
|
+
{"version":3,"file":"TrezorKeyAgent.js","sourceRoot":"","sources":["../../src/TrezorKeyAgent.ts"],"names":[],"mappings":";;;;;;;;;;;;AACA,OAAO,KAAK,MAAM,MAAM,qBAAqB,CAAC;AAC9C,OAAO,KAAK,MAAM,MAAM,iBAAiB,CAAC;AAC1C,OAAO,EAAW,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AACjE,OAAO,EACL,eAAe,EACf,iBAAiB,EACjB,YAAY,EAEZ,YAAY,EACZ,UAAU,EAKV,MAAM,EACN,IAAI,EACL,MAAM,6BAA6B,CAAC;AACrC,OAAO,EAAE,6BAA6B,EAAE,MAAM,mBAAmB,CAAC;AAClE,OAAO,EAAE,UAAU,EAAE,MAAM,mBAAmB,CAAC;AAC/C,OAAO,iBAAiB,MAAM,qBAAqB,CAAC;AAEpD,MAAM,iBAAiB,GAAG,MAAM,CAAC,OAAO,CAAC;AACzC,MAAM,gBAAgB,GAAI,iBAAyB,CAAC,OAAO;IACzD,CAAC,CAAG,iBAAyB,CAAC,OAAoC;IAClE,CAAC,CAAC,iBAAiB,CAAC;AAEtB,MAAM,mBAAmB,GAAG,CAAC,KAAW,EAAE,EAAE,CAC1C,IAAI,MAAM,CAAC,mBAAmB,CAC5B,yBAAyB,EACzB,IAAI,MAAM,CAAC,cAAc,CAAC,yBAAyB,EAAE,KAAK,CAAC,CAC5D,CAAC;AAqB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AO,IAAI,GAAG,CACZ,MAAM,OAAO,CAAC,GAAG,CACf,UAAU,CAAC,SAAS;iBACjB,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,kBAAkB,CAAC,QAAQ,CAAC,MAAM,CAAC,mBAAmB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,CAAC;iBAC5F,GAAG,CAAC,KAAK,EAAE,OAAO,EAAE,EAAE;gBACrB,MAAM,SAAS,GAAG,MAAM,CAAC,mBAAmB,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC;gBAC7D,MAAM,SAAS,GAAG,MAAM,CAAC,mBAAmB,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;gBAChE,OAAO,CAAC,SAAS,EAAE,SAAS,CAAU,CAAC;YACzC,CAAC,CAAC,CACL,CACF,CAAC;SACH;QAAC,OAAO,KAAU,EAAE;YACnB,IAAI,KAAK,CAAC,UAAU,CAAC,IAAI,KAAK,yBAAyB,EAAE;gBACvD,MAAM,IAAI,MAAM,CAAC,mBAAmB,CAAC,6BAA6B,EAAE,KAAK,CAAC,CAAC;aAC5E;YACD,MAAM,mBAAmB,CAAC,KAAK,CAAC,CAAC;SAClC;IACH,CAAC;IAED,KAAK,CAAC,QAAQ;QACZ,MAAM,IAAI,mBAAmB,CAAC,UAAU,CAAC,CAAC;IAC5C,CAAC;IAED,KAAK,CAAC,oBAAoB;QACxB,MAAM,IAAI,mBAAmB,CAAC,0BAA0B,CAAC,CAAC;IAC5D,CAAC;CACF"}
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './transformers';
|
|
2
|
-
export * from './types';
|
|
3
|
-
export * from './TrezorKeyAgent';
|
|
1
|
+
export * from './transformers/index.js';
|
|
2
|
+
export * from './types.js';
|
|
3
|
+
export * from './TrezorKeyAgent.js';
|
|
4
4
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/esm/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export * from './transformers';
|
|
2
|
-
export * from './types';
|
|
3
|
-
export * from './TrezorKeyAgent';
|
|
1
|
+
export * from './transformers/index.js';
|
|
2
|
+
export * from './types.js';
|
|
3
|
+
export * from './TrezorKeyAgent.js';
|
|
4
4
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as Trezor from '@trezor/connect';
|
|
2
2
|
import { Cardano } from '@cardano-sdk/core';
|
|
3
3
|
import { Transform } from '@cardano-sdk/util';
|
|
4
|
-
import { TrezorTxTransformerContext } from '../types';
|
|
4
|
+
import { TrezorTxTransformerContext } from '../types.js';
|
|
5
5
|
export declare const mapAdditionalWitnessRequests: Transform<Cardano.TxIn[], Trezor.DerivationPath[], TrezorTxTransformerContext>;
|
|
6
6
|
//# sourceMappingURL=additionalWitnessRequests.d.ts.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { isNotNil } from '@cardano-sdk/util';
|
|
2
|
-
import { resolvePaymentKeyPathForTxIn } from './keyPaths';
|
|
2
|
+
import { resolvePaymentKeyPathForTxIn } from './keyPaths.js';
|
|
3
3
|
import { util } from '@cardano-sdk/key-management';
|
|
4
|
-
import isArray from 'lodash/isArray';
|
|
5
|
-
import uniq from 'lodash/uniq';
|
|
4
|
+
import isArray from 'lodash/isArray.js';
|
|
5
|
+
import uniq from 'lodash/uniq.js';
|
|
6
6
|
export const mapAdditionalWitnessRequests = (inputs, context) => {
|
|
7
7
|
const paymentKeyPaths = uniq(inputs
|
|
8
8
|
.map((input) => resolvePaymentKeyPathForTxIn(input, context))
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"additionalWitnessRequests.js","sourceRoot":"","sources":["../../../src/transformers/additionalWitnessRequests.ts"],"names":[],"mappings":"AAEA,OAAO,EAAa,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,EAAE,4BAA4B,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AACnD,OAAO,OAAO,MAAM,
|
|
1
|
+
{"version":3,"file":"additionalWitnessRequests.js","sourceRoot":"","sources":["../../../src/transformers/additionalWitnessRequests.ts"],"names":[],"mappings":"AAEA,OAAO,EAAa,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAExD,OAAO,EAAE,4BAA4B,EAAE,MAAM,YAAY,CAAC;AAC1D,OAAO,EAAE,IAAI,EAAE,MAAM,6BAA6B,CAAC;AACnD,OAAO,OAAO,MAAM,mBAAmB,CAAC;AACxC,OAAO,IAAI,MAAM,gBAAgB,CAAC;AAElC,MAAM,CAAC,MAAM,4BAA4B,GAIrC,CAAC,MAAM,EAAE,OAAO,EAAE,EAAE;IACtB,MAAM,eAAe,GAAG,IAAI,CAC1B,MAAM;SACH,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,4BAA4B,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;SAC5D,MAAM,CAAC,QAAQ,CAAC;SAChB,MAAM,CAAC,OAAO,CAAC,CACnB,CAAC;IAEF,MAAM,sBAAsB,GAA4B,CAAC,GAAG,eAAe,CAAC,CAAC;IAE7E,IAAI,OAAO,EAAE,cAAc,EAAE,MAAM,EAAE;QACnC,MAAM,YAAY,GAAG,IAAI,CAAC,8BAA8B,CAAC,OAAO,CAAC,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;QACpF,IAAI,YAAY;YAAE,sBAAsB,CAAC,IAAI,CAAC,YAAY,CAAC,CAAC;KAC7D;IACD,OAAO,sBAAsB,CAAC;AAChC,CAAC,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as Trezor from '@trezor/connect';
|
|
2
2
|
import { Cardano } from '@cardano-sdk/core';
|
|
3
3
|
import { Transform } from '@cardano-sdk/util';
|
|
4
|
-
import { TrezorTxTransformerContext } from '../types';
|
|
4
|
+
import { TrezorTxTransformerContext } from '../types.js';
|
|
5
5
|
export declare const getStakeAddressCertificate: Transform<Cardano.StakeAddressCertificate, Trezor.CardanoCertificate, TrezorTxTransformerContext>;
|
|
6
6
|
export declare const getStakeDelegationCertificate: Transform<Cardano.StakeDelegationCertificate, Trezor.CardanoCertificate, TrezorTxTransformerContext>;
|
|
7
7
|
export declare const getPoolRegistrationCertificate: Transform<Cardano.PoolRegistrationCertificate, Trezor.CardanoCertificate, TrezorTxTransformerContext>;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export * from './keyPaths';
|
|
2
|
-
export * from './txIn';
|
|
3
|
-
export * from './txOut';
|
|
4
|
-
export * from './withdrawals';
|
|
5
|
-
export * from './certificates';
|
|
6
|
-
export * from './auxiliaryData';
|
|
7
|
-
export * from './requiredSigners';
|
|
1
|
+
export * from './keyPaths.js';
|
|
2
|
+
export * from './txIn.js';
|
|
3
|
+
export * from './txOut.js';
|
|
4
|
+
export * from './withdrawals.js';
|
|
5
|
+
export * from './certificates.js';
|
|
6
|
+
export * from './auxiliaryData.js';
|
|
7
|
+
export * from './requiredSigners.js';
|
|
8
8
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
export * from './keyPaths';
|
|
2
|
-
export * from './txIn';
|
|
3
|
-
export * from './txOut';
|
|
4
|
-
export * from './withdrawals';
|
|
5
|
-
export * from './certificates';
|
|
6
|
-
export * from './auxiliaryData';
|
|
7
|
-
export * from './requiredSigners';
|
|
1
|
+
export * from './keyPaths.js';
|
|
2
|
+
export * from './txIn.js';
|
|
3
|
+
export * from './txOut.js';
|
|
4
|
+
export * from './withdrawals.js';
|
|
5
|
+
export * from './certificates.js';
|
|
6
|
+
export * from './auxiliaryData.js';
|
|
7
|
+
export * from './requiredSigners.js';
|
|
8
8
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { BIP32Path } from '@cardano-sdk/crypto';
|
|
2
2
|
import { Cardano } from '@cardano-sdk/core';
|
|
3
3
|
import { GroupedAddress } from '@cardano-sdk/key-management';
|
|
4
|
-
import { TrezorTxTransformerContext } from '../types';
|
|
4
|
+
import { TrezorTxTransformerContext } from '../types.js';
|
|
5
5
|
export declare const resolvePaymentKeyPathForTxIn: (txIn: Cardano.TxIn, context?: TrezorTxTransformerContext) => BIP32Path | undefined;
|
|
6
6
|
export declare const resolveStakeKeyPath: (rewardAddress: Cardano.RewardAddress, knownAddresses: GroupedAddress[]) => BIP32Path | null;
|
|
7
7
|
//# sourceMappingURL=keyPaths.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as Crypto from '@cardano-sdk/crypto';
|
|
2
2
|
import * as Trezor from '@trezor/connect';
|
|
3
3
|
import { Transform } from '@cardano-sdk/util';
|
|
4
|
-
import { TrezorTxTransformerContext } from '../types';
|
|
4
|
+
import { TrezorTxTransformerContext } from '../types.js';
|
|
5
5
|
export declare const toRequiredSigner: Transform<Crypto.Ed25519KeyHashHex, Trezor.CardanoRequiredSigner, TrezorTxTransformerContext>;
|
|
6
6
|
export declare const mapRequiredSigners: (signers: Crypto.Ed25519KeyHashHex[], context: TrezorTxTransformerContext) => Trezor.CardanoRequiredSigner[];
|
|
7
7
|
//# sourceMappingURL=requiredSigners.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as Trezor from '@trezor/connect';
|
|
2
2
|
import { Cardano } from '@cardano-sdk/core';
|
|
3
3
|
import { Transformer } from '@cardano-sdk/util';
|
|
4
|
-
import { TrezorTxTransformerContext } from '../types';
|
|
4
|
+
import { TrezorTxTransformerContext } from '../types.js';
|
|
5
5
|
export declare const trezorTxTransformer: Transformer<Cardano.TxBody, Omit<Trezor.CardanoSignTransaction, 'signingMode' | 'derivationType' | 'includeNetworkId'>, TrezorTxTransformerContext>;
|
|
6
6
|
export declare const txToTrezor: (body: Cardano.TxBody, context: TrezorTxTransformerContext) => Promise<Omit<Trezor.CardanoSignTransaction, "signingMode" | "derivationType" | "includeNetworkId">>;
|
|
7
7
|
//# sourceMappingURL=tx.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { transformObj } from '@cardano-sdk/util';
|
|
2
|
-
import { mapAdditionalWitnessRequests } from './additionalWitnessRequests';
|
|
3
|
-
import { mapAuxiliaryData, mapCerts, mapRequiredSigners, mapTxIns, mapTxOuts, mapWithdrawals, toTxOut } from './';
|
|
4
|
-
import { mapTokenMap } from './assets';
|
|
2
|
+
import { mapAdditionalWitnessRequests } from './additionalWitnessRequests.js';
|
|
3
|
+
import { mapAuxiliaryData, mapCerts, mapRequiredSigners, mapTxIns, mapTxOuts, mapWithdrawals, toTxOut } from './index.js';
|
|
4
|
+
import { mapTokenMap } from './assets.js';
|
|
5
5
|
export const trezorTxTransformer = {
|
|
6
6
|
additionalWitnessRequests: ({ inputs }, context) => mapAdditionalWitnessRequests(inputs, context),
|
|
7
7
|
auxiliaryData: ({ auxiliaryDataHash }) => (auxiliaryDataHash ? mapAuxiliaryData(auxiliaryDataHash) : undefined),
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as Trezor from '@trezor/connect';
|
|
2
2
|
import { Cardano } from '@cardano-sdk/core';
|
|
3
3
|
import { Transform } from '@cardano-sdk/util';
|
|
4
|
-
import { TrezorTxTransformerContext } from '../types';
|
|
4
|
+
import { TrezorTxTransformerContext } from '../types.js';
|
|
5
5
|
export declare const toTrezorTxIn: Transform<Cardano.TxIn, Trezor.CardanoInput, TrezorTxTransformerContext>;
|
|
6
6
|
export declare const mapTxIns: (txIns: Cardano.TxIn[], context: TrezorTxTransformerContext) => Trezor.CardanoInput[];
|
|
7
7
|
//# sourceMappingURL=txIn.d.ts.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as Trezor from '@trezor/connect';
|
|
2
2
|
import { Cardano } from '@cardano-sdk/core';
|
|
3
3
|
import { Transform } from '@cardano-sdk/util';
|
|
4
|
-
import { TrezorTxTransformerContext } from '../types';
|
|
4
|
+
import { TrezorTxTransformerContext } from '../types.js';
|
|
5
5
|
export declare const toTxOut: Transform<Cardano.TxOut, Trezor.CardanoOutput, TrezorTxTransformerContext>;
|
|
6
6
|
export declare const mapTxOuts: (txOuts: Cardano.TxOut[], context: TrezorTxTransformerContext) => Trezor.CardanoOutput[];
|
|
7
7
|
//# sourceMappingURL=txOut.d.ts.map
|
|
@@ -2,7 +2,7 @@ import * as Trezor from '@trezor/connect';
|
|
|
2
2
|
import { Serialization } from '@cardano-sdk/core';
|
|
3
3
|
import { util } from '@cardano-sdk/key-management';
|
|
4
4
|
import { InvalidArgumentError } from '@cardano-sdk/util';
|
|
5
|
-
import { mapTokenMap } from './assets';
|
|
5
|
+
import { mapTokenMap } from './assets.js';
|
|
6
6
|
const toDestination = (txOut, context) => {
|
|
7
7
|
const knownAddress = context?.knownAddresses.find((address) => address.address === txOut.address);
|
|
8
8
|
if (!knownAddress) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import * as Trezor from '@trezor/connect';
|
|
2
2
|
import { Cardano } from '@cardano-sdk/core';
|
|
3
3
|
import { Transform } from '@cardano-sdk/util';
|
|
4
|
-
import { TrezorTxTransformerContext } from '../types';
|
|
4
|
+
import { TrezorTxTransformerContext } from '../types.js';
|
|
5
5
|
export declare const toTrezorWithdrawal: Transform<Cardano.Withdrawal, Trezor.CardanoWithdrawal, TrezorTxTransformerContext>;
|
|
6
6
|
export declare const mapWithdrawals: (withdrawals: Cardano.Withdrawal[] | undefined, context: TrezorTxTransformerContext) => Trezor.CardanoWithdrawal[] | undefined;
|
|
7
7
|
//# sourceMappingURL=withdrawals.d.ts.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Cardano } from '@cardano-sdk/core';
|
|
2
2
|
import { InvalidArgumentError, areNumbersEqualInConstantTime } from '@cardano-sdk/util';
|
|
3
|
-
import { resolveStakeKeyPath } from './keyPaths';
|
|
3
|
+
import { resolveStakeKeyPath } from './keyPaths.js';
|
|
4
4
|
export const toTrezorWithdrawal = (withdrawal, context) => {
|
|
5
5
|
const address = Cardano.Address.fromString(withdrawal.stakeAddress);
|
|
6
6
|
const rewardAddress = address?.asReward();
|