@sidhujag/sysweb3-keyring 2.1.9 → 2.1.11
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 +6 -0
- package/README.md +8 -5
- package/cjs/hardware-signing-data.js +85 -0
- package/cjs/hardware-signing-data.js.map +1 -0
- package/cjs/hardware-wallet-manager.js +36 -13
- package/cjs/hardware-wallet-manager.js.map +1 -1
- package/cjs/ledger/index.js +41 -51
- package/cjs/ledger/index.js.map +1 -1
- package/cjs/transactions/ethereum.js +92 -70
- package/cjs/transactions/ethereum.js.map +1 -1
- package/cjs/transactions/prepared-evm.js.map +1 -1
- package/cjs/trezor/connect.js +155 -50
- package/cjs/trezor/connect.js.map +1 -1
- package/cjs/trezor/index.js +159 -138
- package/cjs/trezor/index.js.map +1 -1
- package/cjs/types.js.map +1 -1
- package/esm/hardware-signing-data.js +82 -0
- package/esm/hardware-signing-data.js.map +1 -0
- package/esm/hardware-wallet-manager.js +36 -13
- package/esm/hardware-wallet-manager.js.map +1 -1
- package/esm/ledger/dmk-evm.js +13 -48
- package/esm/ledger/dmk-evm.js.map +1 -1
- package/esm/ledger/dmk-utxo.js +9 -6
- package/esm/ledger/dmk-utxo.js.map +1 -1
- package/esm/ledger/index.js +41 -51
- package/esm/ledger/index.js.map +1 -1
- package/esm/transactions/ethereum.js +92 -70
- package/esm/transactions/ethereum.js.map +1 -1
- package/esm/transactions/prepared-evm.js.map +1 -1
- package/esm/trezor/connect.js +155 -50
- package/esm/trezor/connect.js.map +1 -1
- package/esm/trezor/index.js +160 -139
- package/esm/trezor/index.js.map +1 -1
- package/esm/types.js.map +1 -1
- package/package.json +1 -1
- package/types/hardware-signing-data.d.ts +2 -0
- package/types/hardware-wallet-manager.d.ts +3 -1
- package/types/ledger/host-types.d.ts +3 -3
- package/types/ledger/index.d.ts +2 -1
- package/types/ledger/types.d.ts +4 -4
- package/types/transactions/ethereum.d.ts +4 -2
- package/types/transactions/prepared-evm.d.ts +1 -0
- package/types/trezor/connect.d.ts +10 -1
- package/types/trezor/index.d.ts +21 -11
- package/types/types.d.ts +2 -2
package/types/ledger/types.d.ts
CHANGED
|
@@ -37,16 +37,16 @@ export interface IEvmMethods {
|
|
|
37
37
|
s: string;
|
|
38
38
|
v: string;
|
|
39
39
|
}>;
|
|
40
|
-
signPersonalMessage: (
|
|
40
|
+
signPersonalMessage: (request: {
|
|
41
41
|
accountIndex: number;
|
|
42
42
|
message: string;
|
|
43
43
|
expectedAddress: string;
|
|
44
|
-
}) => Promise<string>;
|
|
45
|
-
signTypedData: (
|
|
44
|
+
}, authority: HardwareTransactionAuthority) => Promise<string>;
|
|
45
|
+
signTypedData: (request: {
|
|
46
46
|
accountIndex: number;
|
|
47
47
|
data: any;
|
|
48
48
|
expectedAddress: string;
|
|
49
49
|
version: SignTypedDataVersion;
|
|
50
|
-
}) => Promise<string>;
|
|
50
|
+
}, authority: HardwareTransactionAuthority) => Promise<string>;
|
|
51
51
|
}
|
|
52
52
|
export {};
|
|
@@ -6,6 +6,7 @@ import { CustomJsonRpcProvider } from '../providers';
|
|
|
6
6
|
import { IResponseFromSendErcSignedTransaction, ISendSignedErc20TransactionProps, ISendSignedErc721TransactionProps, ISendSignedErc1155TransactionProps, IReviewedEvmTokenApproval, IEthereumTransactions, IEvmCancellationOptions, IEvmReplacementOptions, EvmFormattedSendArguments, SimpleTransactionRequest, KeyringAccountType, accountType, IGasParams } from '../types';
|
|
7
7
|
import { type PreparedEvmTransaction } from './evm-envelope';
|
|
8
8
|
import { type CaptureEvmSubmission } from './evm-submission';
|
|
9
|
+
import { type HardwareTransactionAuthority } from '../hardware-transaction-authority';
|
|
9
10
|
import { type EvmDigestSignOptions, type PreparedSoftwareEvmSigningRequest, type PreparedEvmSigningOptions } from './prepared-evm';
|
|
10
11
|
import type { LedgerKeyring } from '../ledger';
|
|
11
12
|
import type { TrezorKeyring } from '../trezor';
|
|
@@ -52,7 +53,8 @@ export declare class EthereumTransactions<TLedger extends EthereumLedgerSigner |
|
|
|
52
53
|
private submitSignedHardwareTransaction;
|
|
53
54
|
get web3Provider(): CustomJsonRpcProvider;
|
|
54
55
|
private ensureProvidersInitialized;
|
|
55
|
-
|
|
56
|
+
private captureMessageSigning;
|
|
57
|
+
signTypedData: (addr: string, typedData: TypedDataV1 | TypedMessage<any>, version: SignTypedDataVersion, authority: HardwareTransactionAuthority) => Promise<string>;
|
|
56
58
|
verifyUtxoAddress: (accountIndex: number, currency: string, slip44: number) => Promise<string | undefined>;
|
|
57
59
|
verifyTypedSignature: (data: TypedDataV1 | TypedMessage<any>, signature: string, version: SignTypedDataVersion) => string;
|
|
58
60
|
signPreparedEvmTransaction(input: PreparedSoftwareEvmSigningRequest, options: PreparedEvmSigningOptions): Readonly<{
|
|
@@ -63,7 +65,7 @@ export declare class EthereumTransactions<TLedger extends EthereumLedgerSigner |
|
|
|
63
65
|
transaction: PreparedEvmTransaction;
|
|
64
66
|
}>;
|
|
65
67
|
ethSign: (params: string[], input: EvmDigestSignOptions) => Promise<string>;
|
|
66
|
-
signPersonalMessage: (params: string[]) => Promise<string>;
|
|
68
|
+
signPersonalMessage: (params: string[], authority: HardwareTransactionAuthority) => Promise<string>;
|
|
67
69
|
parsePersonalMessage: (hexMsg: string) => string;
|
|
68
70
|
verifyPersonalMessage: (message: string, sign: string) => string;
|
|
69
71
|
getEncryptedPubKey: () => string;
|
|
@@ -6,6 +6,7 @@ export type EvmSigningIdentity = Readonly<{
|
|
|
6
6
|
}>;
|
|
7
7
|
export declare function snapshotEvmSigningIdentity(input: unknown): EvmSigningIdentity;
|
|
8
8
|
export type EvmDigestSignOptions = Readonly<{
|
|
9
|
+
signal: AbortSignal;
|
|
9
10
|
selectedAccount: EvmSigningIdentity;
|
|
10
11
|
targetAccount: EvmSigningIdentity;
|
|
11
12
|
assertCurrent(): void;
|
|
@@ -2,7 +2,8 @@ import type { HardwareTransactionAuthority } from '../hardware-transaction-autho
|
|
|
2
2
|
import type { TrezorCalls, TrezorHost, TrezorMethod } from './host-types';
|
|
3
3
|
type Client = TrezorCalls;
|
|
4
4
|
type TransactionMethod = 'ethereumSignTransaction' | 'signTransaction';
|
|
5
|
-
type
|
|
5
|
+
type SigningMethod = TransactionMethod | 'signMessage' | 'ethereumSignMessage' | 'ethereumSignTypedData';
|
|
6
|
+
type ForwardedMethod = Exclude<TrezorMethod, SigningMethod>;
|
|
6
7
|
type Compatible<T> = T extends {
|
|
7
8
|
success: false;
|
|
8
9
|
} ? T & {
|
|
@@ -29,7 +30,15 @@ export type ConnectionEvent = {
|
|
|
29
30
|
type: 'model';
|
|
30
31
|
model: string;
|
|
31
32
|
};
|
|
33
|
+
export type TrezorSigningSession = {
|
|
34
|
+
[Name in SigningMethod]: CompatibleCall<Client[Name]>;
|
|
35
|
+
} & {
|
|
36
|
+
init(): Promise<void>;
|
|
37
|
+
dispose(): Promise<void>;
|
|
38
|
+
getFeatures: CompatibleCall<Client['getFeatures']>;
|
|
39
|
+
};
|
|
32
40
|
export type TrezorConnection = Calls & {
|
|
41
|
+
withOwnedSigning<Result>(authority: HardwareTransactionAuthority, operation: (session: TrezorSigningSession) => Promise<Result>): Promise<Result>;
|
|
33
42
|
ethereumSignTransactionOwned: (request: Parameters<Client['ethereumSignTransaction']>[0], authority: HardwareTransactionAuthority) => ReturnType<CompatibleCall<Client['ethereumSignTransaction']>>;
|
|
34
43
|
signTransactionOwned: (request: Parameters<Client['signTransaction']>[0], authority: HardwareTransactionAuthority) => ReturnType<CompatibleCall<Client['signTransaction']>>;
|
|
35
44
|
init: () => Promise<void>;
|
package/types/trezor/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { SignTypedDataVersion } from '@metamask/eth-sig-util';
|
|
2
2
|
import { Psbt } from 'bitcoinjs-lib';
|
|
3
3
|
import { Buffer } from 'buffer';
|
|
4
4
|
import type { HardwareTransactionAuthority } from '../hardware-transaction-authority';
|
|
5
5
|
import type { TrezorConnection } from './connect';
|
|
6
|
+
import type { LedgerTypedData } from '../ledger/host-types';
|
|
6
7
|
import type { AccountInfo, EthereumTransaction, EthereumTransactionEIP1559 } from '@trezor/connect-webextension';
|
|
7
8
|
export interface TrezorControllerState {
|
|
8
9
|
hdPath: string;
|
|
@@ -28,6 +29,7 @@ export declare class TrezorKeyring {
|
|
|
28
29
|
* Initialize Trezor script.
|
|
29
30
|
*/
|
|
30
31
|
init(assertCurrent?: () => void): Promise<boolean>;
|
|
32
|
+
private initSigning;
|
|
31
33
|
/**
|
|
32
34
|
* Execute operation with automatic retry
|
|
33
35
|
*/
|
|
@@ -144,26 +146,34 @@ export declare class TrezorKeyring {
|
|
|
144
146
|
* @param index - index of account for path derivation
|
|
145
147
|
* @returns signature object
|
|
146
148
|
*/
|
|
147
|
-
signMessage(
|
|
149
|
+
signMessage(request: {
|
|
148
150
|
address: string;
|
|
149
151
|
coin: string;
|
|
150
|
-
index
|
|
151
|
-
message
|
|
152
|
+
index: number;
|
|
153
|
+
message: string;
|
|
152
154
|
slip44: number;
|
|
153
|
-
}): Promise<
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
155
|
+
}, authority: HardwareTransactionAuthority): Promise<(import("@trezor/type-utils").Err<import("@trezor/connect-common/lib/constants/errors").SerializedError> & {
|
|
156
|
+
payload: {
|
|
157
|
+
error: string;
|
|
158
|
+
code?: string;
|
|
159
|
+
};
|
|
160
|
+
}) | import("@trezor/connect-webextension").OkWithDevice<{
|
|
161
|
+
address: string;
|
|
162
|
+
signature: string;
|
|
163
|
+
}> | {
|
|
164
|
+
signature: string;
|
|
165
|
+
success: boolean;
|
|
166
|
+
}>;
|
|
157
167
|
private _transformTypedData;
|
|
158
168
|
/**
|
|
159
169
|
* EIP-712 Sign Typed Data
|
|
160
170
|
*/
|
|
161
|
-
signTypedData(
|
|
171
|
+
signTypedData(request: {
|
|
162
172
|
address: string;
|
|
163
|
-
data:
|
|
173
|
+
data: LedgerTypedData;
|
|
164
174
|
index: number;
|
|
165
175
|
version: SignTypedDataVersion;
|
|
166
|
-
}): Promise<string>;
|
|
176
|
+
}, authority: HardwareTransactionAuthority): Promise<string>;
|
|
167
177
|
/**
|
|
168
178
|
* Verify UTXO address by displaying it on the Trezor device
|
|
169
179
|
* @param accountIndex - The account index
|
package/types/types.d.ts
CHANGED
|
@@ -135,7 +135,7 @@ export interface IEthereumTransactions {
|
|
|
135
135
|
getGasLimit: (toAddress: string) => Promise<number>;
|
|
136
136
|
getGasOracle?: () => Promise<any>;
|
|
137
137
|
getRecommendedNonce: (address: string) => Promise<number>;
|
|
138
|
-
signTypedData: (addr: string, typedData: TypedDataV1 | TypedMessage<any>, version: SignTypedDataVersion) => Promise<string>;
|
|
138
|
+
signTypedData: (addr: string, typedData: TypedDataV1 | TypedMessage<any>, version: SignTypedDataVersion, authority: import('./hardware-transaction-authority').HardwareTransactionAuthority) => Promise<string>;
|
|
139
139
|
importAccount: (mnemonicOrPrivKey: string) => EvmLocalAccount;
|
|
140
140
|
parsePersonalMessage: (hexMsg: string) => string;
|
|
141
141
|
sendFormattedTransaction: (...args: EvmFormattedSendArguments) => Promise<TransactionResponse>;
|
|
@@ -152,7 +152,7 @@ export interface IEthereumTransactions {
|
|
|
152
152
|
transaction?: TransactionResponse;
|
|
153
153
|
error?: boolean;
|
|
154
154
|
}>;
|
|
155
|
-
signPersonalMessage: (params: string[]) => Promise<string>;
|
|
155
|
+
signPersonalMessage: (params: string[], authority: import('./hardware-transaction-authority').HardwareTransactionAuthority) => Promise<string>;
|
|
156
156
|
verifyTypedSignature: (data: TypedDataV1 | TypedMessage<any>, signature: string, version: SignTypedDataVersion) => string;
|
|
157
157
|
verifyUtxoAddress: (accountIndex: number, currency: string, slip44: number) => Promise<string | undefined>;
|
|
158
158
|
setWeb3Provider: (network: INetwork) => void;
|