@sidhujag/sysweb3-keyring 2.1.2 → 2.1.4
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 +55 -47
- package/cjs/current-vault-refusal.js +6 -0
- package/cjs/current-vault-refusal.js.map +1 -0
- package/cjs/evm-fees.js +29 -1
- package/cjs/evm-fees.js.map +1 -1
- package/cjs/hardware-transaction-authority.js +36 -0
- package/cjs/hardware-transaction-authority.js.map +1 -0
- package/cjs/index.js +5 -5
- package/cjs/index.js.map +1 -1
- package/cjs/keyring-core.js +466 -250
- package/cjs/keyring-core.js.map +1 -1
- package/cjs/keyring-host.js +113 -0
- package/cjs/keyring-host.js.map +1 -0
- package/cjs/keyring-manager.js +15 -55
- package/cjs/keyring-manager.js.map +1 -1
- package/cjs/ledger/host-types.js.map +1 -1
- package/cjs/ledger/index.js +44 -19
- package/cjs/ledger/index.js.map +1 -1
- package/cjs/providers.js +3 -1
- package/cjs/providers.js.map +1 -1
- package/cjs/software.js +10 -43
- package/cjs/software.js.map +1 -1
- package/cjs/storage-core.js +44 -4
- package/cjs/storage-core.js.map +1 -1
- package/cjs/transactions/ethereum.js +358 -294
- package/cjs/transactions/ethereum.js.map +1 -1
- package/cjs/transactions/evm-cancellation.js +43 -0
- package/cjs/transactions/evm-cancellation.js.map +1 -0
- package/cjs/transactions/evm-local-signer.js +15 -0
- package/cjs/transactions/evm-local-signer.js.map +1 -1
- package/cjs/transactions/evm-submission.js +61 -65
- package/cjs/transactions/evm-submission.js.map +1 -1
- package/cjs/transactions/hardware-psbt.js +11 -8
- package/cjs/transactions/hardware-psbt.js.map +1 -1
- package/cjs/transactions/index.js +10 -2
- package/cjs/transactions/index.js.map +1 -1
- package/cjs/transactions/prepared-evm.js +10 -7
- package/cjs/transactions/prepared-evm.js.map +1 -1
- package/cjs/transactions/syscoin-core.js +282 -202
- package/cjs/transactions/syscoin-core.js.map +1 -1
- package/cjs/trezor/connect.js +19 -2
- package/cjs/trezor/connect.js.map +1 -1
- package/cjs/trezor/index.js +38 -16
- package/cjs/trezor/index.js.map +1 -1
- package/cjs/types.js.map +1 -1
- package/cjs/utils/owned-blockbook-account.js +45 -0
- package/cjs/utils/owned-blockbook-account.js.map +1 -0
- package/esm/current-vault-refusal.js +3 -0
- package/esm/current-vault-refusal.js.map +1 -0
- package/esm/evm-fees.js +242 -0
- package/esm/evm-fees.js.map +1 -0
- package/esm/hardware-transaction-authority.js +33 -0
- package/esm/hardware-transaction-authority.js.map +1 -0
- package/esm/initial-state.js +102 -0
- package/esm/initial-state.js.map +1 -0
- package/esm/keyring-core.js +2781 -0
- package/esm/keyring-core.js.map +1 -0
- package/esm/keyring-host.js +108 -0
- package/esm/keyring-host.js.map +1 -0
- package/esm/ledger/dmk-host.js +31 -0
- package/esm/ledger/dmk-host.js.map +1 -0
- package/esm/ledger/dmk-selected-host.js +6 -0
- package/esm/ledger/dmk-selected-host.js.map +1 -0
- package/esm/ledger/dmk-session.js +154 -34
- package/esm/ledger/dmk-session.js.map +1 -1
- package/esm/ledger/dmk-utxo.js +9 -3
- package/esm/ledger/dmk-utxo.js.map +1 -1
- package/esm/ledger/host-types.js.map +1 -1
- package/esm/ledger/index.js +44 -19
- package/esm/ledger/index.js.map +1 -1
- package/esm/ledger-host.js +3 -27
- package/esm/ledger-host.js.map +1 -1
- package/esm/network-utils.js +70 -0
- package/esm/network-utils.js.map +1 -0
- package/esm/providers.js +3 -1
- package/esm/providers.js.map +1 -1
- package/esm/software-hd-account.js +20 -0
- package/esm/software-hd-account.js.map +1 -0
- package/esm/storage-core.js +258 -0
- package/esm/storage-core.js.map +1 -0
- package/esm/transactions/ethereum.js +2753 -0
- package/esm/transactions/ethereum.js.map +1 -0
- package/esm/transactions/evm-cancellation.js +40 -0
- package/esm/transactions/evm-cancellation.js.map +1 -0
- package/esm/transactions/evm-local-signer.js +202 -0
- package/esm/transactions/evm-local-signer.js.map +1 -0
- package/esm/transactions/evm-submission.js +187 -0
- package/esm/transactions/evm-submission.js.map +1 -0
- package/esm/transactions/prepared-evm.js +194 -0
- package/esm/transactions/prepared-evm.js.map +1 -0
- package/esm/transactions/syscoin-core.js +691 -0
- package/esm/transactions/syscoin-core.js.map +1 -0
- package/esm/trezor/connect.js +19 -2
- package/esm/trezor/connect.js.map +1 -1
- package/esm/trezor/index.js +38 -16
- package/esm/trezor/index.js.map +1 -1
- package/esm/types.js.map +1 -1
- package/esm/utils/excluded-utxos.js +53 -0
- package/esm/utils/excluded-utxos.js.map +1 -0
- package/esm/utils/owned-blockbook-account.js +9 -0
- package/esm/utils/owned-blockbook-account.js.map +1 -0
- package/esm/utils/psbt.js +32 -0
- package/esm/utils/psbt.js.map +1 -0
- package/esm/utils/watch-descriptor.js +138 -0
- package/esm/utils/watch-descriptor.js.map +1 -0
- package/package.json +17 -11
- package/types/current-vault-refusal.d.ts +2 -0
- package/types/evm-fees.d.ts +25 -0
- package/types/hardware-transaction-authority.d.ts +5 -0
- package/types/index.d.ts +3 -3
- package/types/keyring-core.d.ts +48 -44
- package/types/keyring-host.d.ts +46 -0
- package/types/keyring-manager.d.ts +14 -7
- package/types/ledger/dmk-host.d.ts +7 -0
- package/types/ledger/dmk-selected-host.d.ts +7 -0
- package/types/ledger/dmk-session.d.ts +10 -2
- package/types/ledger/host-types.d.ts +4 -1
- package/types/ledger/index.d.ts +1 -1
- package/types/ledger/types.d.ts +3 -2
- package/types/ledger-host.d.ts +6 -2
- package/types/providers.d.ts +1 -1
- package/types/software.d.ts +7 -19
- package/types/storage-core.d.ts +3 -1
- package/types/transactions/ethereum.d.ts +14 -11
- package/types/transactions/evm-cancellation.d.ts +10 -0
- package/types/transactions/evm-local-signer.d.ts +2 -2
- package/types/transactions/evm-submission.d.ts +11 -4
- package/types/transactions/hardware-psbt.d.ts +1 -1
- package/types/transactions/index.d.ts +3 -2
- package/types/transactions/prepared-evm.d.ts +4 -1
- package/types/transactions/syscoin-core.d.ts +48 -21
- package/types/trezor/connect.d.ts +6 -3
- package/types/trezor/index.d.ts +4 -3
- package/types/types.d.ts +95 -63
- package/types/utils/owned-blockbook-account.d.ts +3 -0
- package/cjs/hardware-wallet-manager-singleton.js +0 -34
- package/cjs/hardware-wallet-manager-singleton.js.map +0 -1
- package/cjs/storage.js +0 -20
- package/cjs/storage.js.map +0 -1
- package/cjs/transactions/syscoin.js +0 -16
- package/cjs/transactions/syscoin.js.map +0 -1
- package/cjs/utils/blockbook-cache.js +0 -76
- package/cjs/utils/blockbook-cache.js.map +0 -1
- package/types/hardware-wallet-manager-singleton.d.ts +0 -19
- package/types/storage.d.ts +0 -5
- package/types/transactions/syscoin.d.ts +0 -9
- package/types/utils/blockbook-cache.d.ts +0 -6
package/types/types.d.ts
CHANGED
|
@@ -7,6 +7,8 @@ import { LedgerKeyring } from './ledger';
|
|
|
7
7
|
import { IDecryptPrivateRecordParams, IEncryptedPrivateRecord, IEncryptPrivateRecordParams } from './private-records';
|
|
8
8
|
import { SyscoinHDSigner } from './signers';
|
|
9
9
|
import { TrezorKeyring } from './trezor';
|
|
10
|
+
import type { KeyringCore } from './keyring-core';
|
|
11
|
+
import type { PreparedEvmTransaction } from './transactions/prepared-evm';
|
|
10
12
|
export type AccessListish = Array<{
|
|
11
13
|
address: string;
|
|
12
14
|
storageKeys: string[];
|
|
@@ -37,46 +39,44 @@ export type EvmLocalAccount = {
|
|
|
37
39
|
};
|
|
38
40
|
export interface IEvmSendOptions {
|
|
39
41
|
/** Synchronous host admission, rechecked immediately before signing and broadcast. */
|
|
40
|
-
assertCurrent
|
|
42
|
+
assertCurrent: () => void;
|
|
43
|
+
mode: 'reviewed-native' | 'specialized';
|
|
41
44
|
}
|
|
42
|
-
export
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
45
|
+
export type EvmFormattedSendArguments = [
|
|
46
|
+
approvedTransaction: PreparedEvmTransaction,
|
|
47
|
+
isLegacy: boolean | undefined,
|
|
48
|
+
options: IEvmSendOptions & {
|
|
49
|
+
mode: 'reviewed-native';
|
|
50
|
+
}
|
|
51
|
+
] | [
|
|
52
|
+
transaction: SimpleTransactionRequest,
|
|
53
|
+
isLegacy: boolean | undefined,
|
|
54
|
+
options: IEvmSendOptions & {
|
|
55
|
+
mode: 'specialized';
|
|
56
|
+
}
|
|
57
|
+
];
|
|
58
|
+
export type EvmReplacementFeeApproval = {
|
|
59
|
+
previewOnly: true;
|
|
60
|
+
approvedMaximumFee?: never;
|
|
61
|
+
} | {
|
|
62
|
+
previewOnly?: false;
|
|
63
|
+
approvedMaximumFee: string;
|
|
64
|
+
};
|
|
65
|
+
type EvmOriginalAdmission<Original> = {
|
|
66
|
+
/** Select a distinct locally controlled gas payer for a smart account. */
|
|
60
67
|
targetAccount?: {
|
|
61
68
|
id: number;
|
|
62
69
|
type: KeyringAccountType;
|
|
63
70
|
};
|
|
64
|
-
/**
|
|
65
|
-
previewOnly?: boolean;
|
|
66
|
-
/** Required for sending: maximum execution gas fee in decimal wei approved by the user. */
|
|
67
|
-
approvedMaximumFee?: string;
|
|
68
|
-
/** Synchronous host guard for selection or session state outside the keyring. */
|
|
71
|
+
/** Synchronous host guard for the current account, network, session and pending original. */
|
|
69
72
|
assertCurrentContext: () => void;
|
|
70
|
-
/**
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
*/
|
|
78
|
-
validateOriginal: (transaction: TransactionResponse | null) => void;
|
|
79
|
-
}
|
|
73
|
+
/** Receives authenticated signed fields. Null requires explicit cancellation fallback admission. */
|
|
74
|
+
validateOriginal: (transaction: Original) => void;
|
|
75
|
+
};
|
|
76
|
+
export type IEvmReplacementOptions = EvmReplacementFeeApproval & EvmOriginalAdmission<TransactionResponse> & {
|
|
77
|
+
beforeBroadcast?: () => void;
|
|
78
|
+
};
|
|
79
|
+
export type IEvmCancellationOptions = EvmReplacementFeeApproval & EvmOriginalAdmission<TransactionResponse | null>;
|
|
80
80
|
export interface IEthereumTransactions {
|
|
81
81
|
cancelSentTransaction: (txHash: string, isLegacy: boolean | undefined, fallbackNonce: number | undefined, options: IEvmCancellationOptions) => Promise<{
|
|
82
82
|
error?: boolean;
|
|
@@ -99,13 +99,13 @@ export interface IEthereumTransactions {
|
|
|
99
99
|
signTypedData: (addr: string, typedData: TypedDataV1 | TypedMessage<any>, version: SignTypedDataVersion) => Promise<string>;
|
|
100
100
|
importAccount: (mnemonicOrPrivKey: string) => EvmLocalAccount;
|
|
101
101
|
parsePersonalMessage: (hexMsg: string) => string;
|
|
102
|
-
sendFormattedTransaction: (
|
|
103
|
-
sendSignedErc1155Transaction: (
|
|
102
|
+
sendFormattedTransaction: (...args: EvmFormattedSendArguments) => Promise<TransactionResponse>;
|
|
103
|
+
sendSignedErc1155Transaction: (params: ISendSignedErc1155TransactionProps, approval: IReviewedEvmTokenApproval) => Promise<IResponseFromSendErcSignedTransaction>;
|
|
104
104
|
verifyPersonalMessage: (msg: string, sign: string) => string;
|
|
105
105
|
toBigNumber: (aBigNumberish: string | number) => BigNumber;
|
|
106
|
-
sendSignedErc20Transaction: (
|
|
107
|
-
sendSignedErc721Transaction: (
|
|
108
|
-
sendTransactionWithEditedFee: (txHash: string, isLegacy
|
|
106
|
+
sendSignedErc20Transaction: (params: ISendSignedErc20TransactionProps, approval: IReviewedEvmTokenApproval) => Promise<IResponseFromSendErcSignedTransaction>;
|
|
107
|
+
sendSignedErc721Transaction: (params: ISendSignedErc721TransactionProps, approval: IReviewedEvmTokenApproval) => Promise<IResponseFromSendErcSignedTransaction>;
|
|
108
|
+
sendTransactionWithEditedFee: (txHash: string, isLegacy: boolean | undefined, options: IEvmReplacementOptions) => Promise<{
|
|
109
109
|
maximumFee?: string;
|
|
110
110
|
isSpeedUp: boolean;
|
|
111
111
|
transactionNotBroadcast?: boolean;
|
|
@@ -131,6 +131,21 @@ export interface ISyscoinTransactionFeeQuote {
|
|
|
131
131
|
grossAmount?: string;
|
|
132
132
|
recipientAmount?: string;
|
|
133
133
|
}
|
|
134
|
+
/** A trusted wallet host owns the lifetime and HTTP policy of these reads. */
|
|
135
|
+
export type SyscoinOwnedReadOptions = Readonly<{
|
|
136
|
+
assertCurrent: () => void;
|
|
137
|
+
fetch: typeof globalThis.fetch;
|
|
138
|
+
signal: AbortSignal;
|
|
139
|
+
}>;
|
|
140
|
+
/** Exact signed bytes presented to a wallet host before the only POST. */
|
|
141
|
+
export type SyscoinSubmissionDescriptor = Readonly<{
|
|
142
|
+
rawTransaction: string;
|
|
143
|
+
txid: string;
|
|
144
|
+
url: string;
|
|
145
|
+
}>;
|
|
146
|
+
export type SyscoinOwnedSubmissionOptions = SyscoinOwnedReadOptions & Readonly<{
|
|
147
|
+
prepare: (descriptor: SyscoinSubmissionDescriptor) => Promise<void>;
|
|
148
|
+
}>;
|
|
134
149
|
export interface ISyscoinTransactions {
|
|
135
150
|
getEstimateSysTransactionFee: ({ txOptions, amount, receivingAddress, feeRate, token, isMax, nativeSweep, excludedOutpoints, }: {
|
|
136
151
|
amount: number | string;
|
|
@@ -149,15 +164,15 @@ export interface ISyscoinTransactions {
|
|
|
149
164
|
txid: string;
|
|
150
165
|
vout: number;
|
|
151
166
|
}[];
|
|
152
|
-
}) => Promise<ISyscoinTransactionFeeQuote>;
|
|
153
|
-
getRecommendedFee: (explorerUrl: string) => Promise<number>;
|
|
167
|
+
}, ownedRead: SyscoinOwnedReadOptions) => Promise<ISyscoinTransactionFeeQuote>;
|
|
168
|
+
getRecommendedFee: (explorerUrl: string, ownedRead: SyscoinOwnedReadOptions) => Promise<number>;
|
|
154
169
|
decodeRawTransaction: (psbtOrHex: any, isRawHex?: boolean) => any;
|
|
155
|
-
sendTransaction: (
|
|
170
|
+
sendTransaction: (rawTransaction: string, authority: SyscoinOwnedSubmissionOptions) => Promise<ITxid>;
|
|
156
171
|
signPSBT: ({ psbt, isTrezor, isLedger, }: {
|
|
157
172
|
isLedger?: boolean;
|
|
158
173
|
isTrezor?: boolean;
|
|
159
174
|
psbt: any;
|
|
160
|
-
}) => Promise<any>;
|
|
175
|
+
}, ownedRead: SyscoinOwnedReadOptions) => Promise<any>;
|
|
161
176
|
}
|
|
162
177
|
export interface IKeyringManager {
|
|
163
178
|
addNewAccount: (label?: string) => Promise<IKeyringAccountState>;
|
|
@@ -179,7 +194,6 @@ export interface IKeyringManager {
|
|
|
179
194
|
success: boolean;
|
|
180
195
|
}>;
|
|
181
196
|
getPrivateKeyByAccountId: (id: number, accountType: KeyringAccountType, pwd: string) => Promise<string>;
|
|
182
|
-
setStorage: (client: any) => void;
|
|
183
197
|
syscoinTransaction: ISyscoinTransactions;
|
|
184
198
|
isSeedValid: (seedPhrase: string) => boolean;
|
|
185
199
|
getSeed: (pwd: string) => Promise<string>;
|
|
@@ -204,11 +218,11 @@ export interface IKeyringManager {
|
|
|
204
218
|
importAccount: (privKey: string, label?: string, options?: {
|
|
205
219
|
utxoAddressType?: 'p2wpkh' | 'p2pkh';
|
|
206
220
|
}) => Promise<IKeyringAccountState>;
|
|
207
|
-
getNewChangeAddress: () => Promise<string>;
|
|
208
|
-
getChangeAddress: (id: number) => Promise<string>;
|
|
209
|
-
getPubkey: (id: number, isChangeAddress: boolean) => Promise<string>;
|
|
210
|
-
getBip32Path: (id: number, isChangeAddress: boolean) => Promise<string>;
|
|
211
|
-
updateReceivingAddress: () => Promise<string>;
|
|
221
|
+
getNewChangeAddress: (ownedRead: SyscoinOwnedReadOptions) => Promise<string>;
|
|
222
|
+
getChangeAddress: (id: number, ownedRead: SyscoinOwnedReadOptions) => Promise<string>;
|
|
223
|
+
getPubkey: (id: number, isChangeAddress: boolean, ownedRead: SyscoinOwnedReadOptions) => Promise<string>;
|
|
224
|
+
getBip32Path: (id: number, isChangeAddress: boolean, ownedRead: SyscoinOwnedReadOptions) => Promise<string>;
|
|
225
|
+
updateReceivingAddress: (ownedRead: SyscoinOwnedReadOptions) => Promise<string>;
|
|
212
226
|
getActiveAccount: () => {
|
|
213
227
|
activeAccount: Omit<IKeyringAccountState, 'xprv'>;
|
|
214
228
|
activeAccountType: KeyringAccountType;
|
|
@@ -219,12 +233,11 @@ export interface IKeyringManager {
|
|
|
219
233
|
importLedgerAccount: (label?: string) => Promise<IKeyringAccountState | undefined>;
|
|
220
234
|
getActiveUTXOAccountState: () => any;
|
|
221
235
|
createEthAccount: (privateKey: string) => any;
|
|
222
|
-
getAddress: (xpub: string, isChangeAddress: boolean) => Promise<string>;
|
|
236
|
+
getAddress: (xpub: string, isChangeAddress: boolean, ownedRead: SyscoinOwnedReadOptions) => Promise<string>;
|
|
223
237
|
initializeWalletSecurely: (seedPhrase: string, password: string, prvPassword?: string) => Promise<IKeyringAccountState>;
|
|
224
238
|
initializeSession: (seedPhrase: string, password: string) => Promise<void>;
|
|
225
239
|
createFirstAccount: (label?: string) => Promise<IKeyringAccountState>;
|
|
226
|
-
transferSessionTo: (targetKeyring:
|
|
227
|
-
receiveSessionOwnership: (sessionPassword: any, sessionMnemonic: any) => void;
|
|
240
|
+
transferSessionTo: (targetKeyring: KeyringCore) => void;
|
|
228
241
|
lockWallet: () => Promise<void>;
|
|
229
242
|
setVaultStateGetter: (getter: () => any) => void;
|
|
230
243
|
}
|
|
@@ -326,20 +339,39 @@ export interface ILatestUpdateForSysAccount {
|
|
|
326
339
|
receivingAddress: any;
|
|
327
340
|
xpub: any;
|
|
328
341
|
}
|
|
329
|
-
export
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
342
|
+
export type IReviewedEvmTokenApproval = Readonly<{
|
|
343
|
+
assertCurrent: () => void;
|
|
344
|
+
signal: AbortSignal;
|
|
345
|
+
}>;
|
|
346
|
+
export type IReviewedEvmTokenFees = {
|
|
347
|
+
gasLimit: BigNumberish;
|
|
348
|
+
} & ({
|
|
349
|
+
isLegacy: true;
|
|
350
|
+
gasPrice: BigNumberish;
|
|
351
|
+
maxFeePerGas?: never;
|
|
352
|
+
maxPriorityFeePerGas?: never;
|
|
353
|
+
} | {
|
|
354
|
+
isLegacy: false;
|
|
355
|
+
maxFeePerGas: BigNumberish;
|
|
356
|
+
maxPriorityFeePerGas: BigNumberish;
|
|
357
|
+
gasPrice?: never;
|
|
358
|
+
});
|
|
359
|
+
type ISendReviewedTokenBase = IReviewedEvmTokenFees & {
|
|
336
360
|
networkUrl: string;
|
|
337
361
|
receiver: string;
|
|
338
|
-
saveTrezorTx?: (tx: any) => void;
|
|
339
362
|
tokenAddress: string;
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
363
|
+
};
|
|
364
|
+
/** Integer amounts and token identifiers are canonical uint256 strings. */
|
|
365
|
+
export type ISendSignedErc20TransactionProps = ISendReviewedTokenBase & {
|
|
366
|
+
tokenAmountUnits: string;
|
|
367
|
+
saveTrezorTx?: (tx: any) => void;
|
|
368
|
+
};
|
|
369
|
+
export type ISendSignedErc721TransactionProps = ISendReviewedTokenBase & {
|
|
370
|
+
tokenId: string;
|
|
371
|
+
};
|
|
372
|
+
export type ISendSignedErc1155TransactionProps = ISendSignedErc721TransactionProps & {
|
|
373
|
+
tokenAmount: string;
|
|
374
|
+
};
|
|
343
375
|
export interface IResponseFromSendErcSignedTransaction {
|
|
344
376
|
accessList: any[];
|
|
345
377
|
chainId: number;
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { SyscoinOwnedReadOptions } from '../types';
|
|
2
|
+
/** Read address paths with the host's endpoint policy and independent lifetime. */
|
|
3
|
+
export declare function fetchOwnedBlockbookAccount(backendUrl: string, xpub: string, transport: Pick<SyscoinOwnedReadOptions, 'fetch' | 'signal'>): Promise<any>;
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.HardwareWalletManagerSingleton = void 0;
|
|
4
|
-
const hardware_wallet_manager_1 = require("./hardware-wallet-manager");
|
|
5
|
-
/**
|
|
6
|
-
* Singleton wrapper for HardwareWalletManager to ensure a single instance
|
|
7
|
-
* is shared across all KeyringManager instances. This prevents "device already open"
|
|
8
|
-
* errors when multiple networks try to connect to the same Ledger device.
|
|
9
|
-
*/
|
|
10
|
-
class HardwareWalletManagerSingleton {
|
|
11
|
-
/**
|
|
12
|
-
* Get the shared HardwareWalletManager instance
|
|
13
|
-
* Creates one if it doesn't exist
|
|
14
|
-
*/
|
|
15
|
-
static getInstance() {
|
|
16
|
-
if (!HardwareWalletManagerSingleton.instance) {
|
|
17
|
-
HardwareWalletManagerSingleton.instance = new hardware_wallet_manager_1.HardwareWalletManager();
|
|
18
|
-
}
|
|
19
|
-
return HardwareWalletManagerSingleton.instance;
|
|
20
|
-
}
|
|
21
|
-
/**
|
|
22
|
-
* Reset the singleton instance (useful for testing)
|
|
23
|
-
*/
|
|
24
|
-
static resetInstance() {
|
|
25
|
-
if (HardwareWalletManagerSingleton.instance) {
|
|
26
|
-
// Clean up any existing connections
|
|
27
|
-
HardwareWalletManagerSingleton.instance.destroy();
|
|
28
|
-
HardwareWalletManagerSingleton.instance = null;
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
exports.HardwareWalletManagerSingleton = HardwareWalletManagerSingleton;
|
|
33
|
-
HardwareWalletManagerSingleton.instance = null;
|
|
34
|
-
//# sourceMappingURL=hardware-wallet-manager-singleton.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"hardware-wallet-manager-singleton.js","sourceRoot":"","sources":["../../src/hardware-wallet-manager-singleton.ts"],"names":[],"mappings":";;;AAAA,uEAAkE;AAElE;;;;GAIG;AACH,MAAM,8BAA8B;IAGlC;;;OAGG;IACH,MAAM,CAAC,WAAW;QAChB,IAAI,CAAC,8BAA8B,CAAC,QAAQ,EAAE,CAAC;YAC7C,8BAA8B,CAAC,QAAQ,GAAG,IAAI,+CAAqB,EAAE,CAAC;QACxE,CAAC;QACD,OAAO,8BAA8B,CAAC,QAAQ,CAAC;IACjD,CAAC;IAED;;OAEG;IACH,MAAM,CAAC,aAAa;QAClB,IAAI,8BAA8B,CAAC,QAAQ,EAAE,CAAC;YAC5C,oCAAoC;YACpC,8BAA8B,CAAC,QAAQ,CAAC,OAAO,EAAE,CAAC;YAClD,8BAA8B,CAAC,QAAQ,GAAG,IAAI,CAAC;QACjD,CAAC;IACH,CAAC;;AAGM,wEAA8B;AAzBtB,uCAAQ,GAAiC,IAAI,CAAC"}
|
package/cjs/storage.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.VaultAuthenticationError = exports.getDecryptedVault = exports.setEncryptedVault = void 0;
|
|
4
|
-
const sysweb3_core_1 = require("@sidhujag/sysweb3-core");
|
|
5
|
-
const storage_core_1 = require("./storage-core");
|
|
6
|
-
// Preserve the legacy process-wide storage authority. Host-isolated consumers
|
|
7
|
-
// import storage-core directly and supply their own asynchronous storage port.
|
|
8
|
-
const storage = sysweb3_core_1.sysweb3Di.getStateStorageDb();
|
|
9
|
-
const persistence = (0, storage_core_1.createVaultPersistence)({
|
|
10
|
-
get: async (key) => storage.get(key),
|
|
11
|
-
set: async (key, value) => {
|
|
12
|
-
await storage.set(key, value);
|
|
13
|
-
},
|
|
14
|
-
createManyIfAbsent: async (items) => storage.createManyIfAbsent(items),
|
|
15
|
-
});
|
|
16
|
-
exports.setEncryptedVault = persistence.setEncryptedVault;
|
|
17
|
-
exports.getDecryptedVault = persistence.getDecryptedVault;
|
|
18
|
-
var storage_core_2 = require("./storage-core");
|
|
19
|
-
Object.defineProperty(exports, "VaultAuthenticationError", { enumerable: true, get: function () { return storage_core_2.VaultAuthenticationError; } });
|
|
20
|
-
//# sourceMappingURL=storage.js.map
|
package/cjs/storage.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"storage.js","sourceRoot":"","sources":["../../src/storage.ts"],"names":[],"mappings":";;;AAAA,yDAAmD;AAEnD,iDAAwD;AAExD,8EAA8E;AAC9E,+EAA+E;AAC/E,MAAM,OAAO,GAAG,wBAAS,CAAC,iBAAiB,EAAE,CAAC;AAC9C,MAAM,WAAW,GAAG,IAAA,qCAAsB,EAAC;IACzC,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,CAAC,OAAO,CAAC,GAAG,CAAC,GAAG,CAAC;IACpC,GAAG,EAAE,KAAK,EAAE,GAAG,EAAE,KAAK,EAAE,EAAE;QACxB,MAAM,OAAO,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,CAAC,CAAC;IAChC,CAAC;IACD,kBAAkB,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,CAAC,OAAO,CAAC,kBAAkB,CAAC,KAAK,CAAC;CACvE,CAAC,CAAC;AAEU,QAAA,iBAAiB,GAAG,WAAW,CAAC,iBAAiB,CAAC;AAClD,QAAA,iBAAiB,GAAG,WAAW,CAAC,iBAAiB,CAAC;AAC/D,+CAA0D;AAAjD,wHAAA,wBAAwB,OAAA"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.SyscoinTransactions = void 0;
|
|
4
|
-
const hardware_psbt_1 = require("./hardware-psbt");
|
|
5
|
-
const syscoin_core_1 = require("./syscoin-core");
|
|
6
|
-
/** Legacy constructor: preserve device arguments while composing shared logic. */
|
|
7
|
-
class SyscoinTransactions extends syscoin_core_1.SyscoinTransactionsCore {
|
|
8
|
-
constructor(getSyscoinSigner, getReadOnlySigner, getState, getAddress, ledgerSigner, trezorSigner, captureSigningContext) {
|
|
9
|
-
super(getSyscoinSigner, getReadOnlySigner, getState, getAddress, {
|
|
10
|
-
ledger: ledgerSigner ? (0, hardware_psbt_1.createLedgerPsbtSigner)(ledgerSigner) : undefined,
|
|
11
|
-
trezor: trezorSigner ? (0, hardware_psbt_1.createTrezorPsbtSigner)(trezorSigner) : undefined,
|
|
12
|
-
}, captureSigningContext);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
exports.SyscoinTransactions = SyscoinTransactions;
|
|
16
|
-
//# sourceMappingURL=syscoin.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"syscoin.js","sourceRoot":"","sources":["../../../src/transactions/syscoin.ts"],"names":[],"mappings":";;;AAAA,mDAGyB;AACzB,iDAAyD;AAOzD,kFAAkF;AAClF,MAAa,mBAAoB,SAAQ,sCAAuB;IAC9D,YACE,gBAAkC,EAClC,iBAAmC,EACnC,QAA0B,EAC1B,UAA4B,EAC5B,YAA2B,EAC3B,YAA2B,EAC3B,qBAAwC;QAExC,KAAK,CACH,gBAAgB,EAChB,iBAAiB,EACjB,QAAQ,EACR,UAAU,EACV;YACE,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,IAAA,sCAAsB,EAAC,YAAY,CAAC,CAAC,CAAC,CAAC,SAAS;YACvE,MAAM,EAAE,YAAY,CAAC,CAAC,CAAC,IAAA,sCAAsB,EAAC,YAAY,CAAC,CAAC,CAAC,CAAC,SAAS;SACxE,EACD,qBAAqB,CACtB,CAAC;IACJ,CAAC;CACF;AAtBD,kDAsBC"}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
-
var ownKeys = function(o) {
|
|
20
|
-
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
-
var ar = [];
|
|
22
|
-
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
-
return ar;
|
|
24
|
-
};
|
|
25
|
-
return ownKeys(o);
|
|
26
|
-
};
|
|
27
|
-
return function (mod) {
|
|
28
|
-
if (mod && mod.__esModule) return mod;
|
|
29
|
-
var result = {};
|
|
30
|
-
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
-
__setModuleDefault(result, mod);
|
|
32
|
-
return result;
|
|
33
|
-
};
|
|
34
|
-
})();
|
|
35
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
-
exports.invalidateBlockbookAccountCache = exports.fetchBackendAccountCached = void 0;
|
|
37
|
-
const syscoinjs = __importStar(require("syscoinjs-lib"));
|
|
38
|
-
const inflightFetches = new Map();
|
|
39
|
-
const buildKey = (backendUrl, xpub, options) => `${backendUrl}::${xpub}::${options}`;
|
|
40
|
-
const fetchBackendAccountCached = (backendUrl, xpub, options) => {
|
|
41
|
-
const key = buildKey(backendUrl, xpub, options);
|
|
42
|
-
const inflight = inflightFetches.get(key);
|
|
43
|
-
if (inflight) {
|
|
44
|
-
return inflight.promise;
|
|
45
|
-
}
|
|
46
|
-
const promise = Promise.resolve(syscoinjs.utils.fetchBackendAccount(backendUrl, xpub, options, true));
|
|
47
|
-
inflightFetches.set(key, { promise });
|
|
48
|
-
// Drop the entry as soon as the request settles so subsequent
|
|
49
|
-
// callers always fetch fresh data
|
|
50
|
-
const dropEntry = () => {
|
|
51
|
-
const entry = inflightFetches.get(key);
|
|
52
|
-
if (entry && entry.promise === promise) {
|
|
53
|
-
inflightFetches.delete(key);
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
promise.then(dropEntry, dropEntry);
|
|
57
|
-
return promise;
|
|
58
|
-
};
|
|
59
|
-
exports.fetchBackendAccountCached = fetchBackendAccountCached;
|
|
60
|
-
/**
|
|
61
|
-
* Drop in-flight account fetches. Without arguments clears everything;
|
|
62
|
-
* with an xpub only that account's entries are dropped (any backend).
|
|
63
|
-
*/
|
|
64
|
-
const invalidateBlockbookAccountCache = (xpub) => {
|
|
65
|
-
if (!xpub) {
|
|
66
|
-
inflightFetches.clear();
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
for (const key of Array.from(inflightFetches.keys())) {
|
|
70
|
-
if (key.includes(`::${xpub}::`)) {
|
|
71
|
-
inflightFetches.delete(key);
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
exports.invalidateBlockbookAccountCache = invalidateBlockbookAccountCache;
|
|
76
|
-
//# sourceMappingURL=blockbook-cache.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"blockbook-cache.js","sourceRoot":"","sources":["../../../src/utils/blockbook-cache.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,yDAA2C;AAmB3C,MAAM,eAAe,GAAG,IAAI,GAAG,EAAuB,CAAC;AAEvD,MAAM,QAAQ,GAAG,CAAC,UAAkB,EAAE,IAAY,EAAE,OAAe,EAAE,EAAE,CACrE,GAAG,UAAU,KAAK,IAAI,KAAK,OAAO,EAAE,CAAC;AAEhC,MAAM,yBAAyB,GAAG,CACvC,UAAkB,EAClB,IAAY,EACZ,OAAe,EACD,EAAE;IAChB,MAAM,GAAG,GAAG,QAAQ,CAAC,UAAU,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC;IAEhD,MAAM,QAAQ,GAAG,eAAe,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;IAC1C,IAAI,QAAQ,EAAE,CAAC;QACb,OAAO,QAAQ,CAAC,OAAO,CAAC;IAC1B,CAAC;IAED,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAC5B,SAAS,CAAC,KAAa,CAAC,mBAAmB,CAC1C,UAAU,EACV,IAAI,EACJ,OAAO,EACP,IAAI,CACL,CACF,CAAC;IAEF,eAAe,CAAC,GAAG,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;IAEtC,8DAA8D;IAC9D,kCAAkC;IAClC,MAAM,SAAS,GAAG,GAAG,EAAE;QACrB,MAAM,KAAK,GAAG,eAAe,CAAC,GAAG,CAAC,GAAG,CAAC,CAAC;QACvC,IAAI,KAAK,IAAI,KAAK,CAAC,OAAO,KAAK,OAAO,EAAE,CAAC;YACvC,eAAe,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC,CAAC;IACF,OAAO,CAAC,IAAI,CAAC,SAAS,EAAE,SAAS,CAAC,CAAC;IAEnC,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAlCW,QAAA,yBAAyB,6BAkCpC;AAEF;;;GAGG;AACI,MAAM,+BAA+B,GAAG,CAAC,IAAa,EAAE,EAAE;IAC/D,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,eAAe,CAAC,KAAK,EAAE,CAAC;QACxB,OAAO;IACT,CAAC;IACD,KAAK,MAAM,GAAG,IAAI,KAAK,CAAC,IAAI,CAAC,eAAe,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC;QACrD,IAAI,GAAG,CAAC,QAAQ,CAAC,KAAK,IAAI,IAAI,CAAC,EAAE,CAAC;YAChC,eAAe,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;QAC9B,CAAC;IACH,CAAC;AACH,CAAC,CAAC;AAVW,QAAA,+BAA+B,mCAU1C"}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import { HardwareWalletManager } from './hardware-wallet-manager';
|
|
2
|
-
/**
|
|
3
|
-
* Singleton wrapper for HardwareWalletManager to ensure a single instance
|
|
4
|
-
* is shared across all KeyringManager instances. This prevents "device already open"
|
|
5
|
-
* errors when multiple networks try to connect to the same Ledger device.
|
|
6
|
-
*/
|
|
7
|
-
declare class HardwareWalletManagerSingleton {
|
|
8
|
-
private static instance;
|
|
9
|
-
/**
|
|
10
|
-
* Get the shared HardwareWalletManager instance
|
|
11
|
-
* Creates one if it doesn't exist
|
|
12
|
-
*/
|
|
13
|
-
static getInstance(): HardwareWalletManager;
|
|
14
|
-
/**
|
|
15
|
-
* Reset the singleton instance (useful for testing)
|
|
16
|
-
*/
|
|
17
|
-
static resetInstance(): void;
|
|
18
|
-
}
|
|
19
|
-
export { HardwareWalletManagerSingleton };
|
package/types/storage.d.ts
DELETED
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
export declare const setEncryptedVault: (decryptedVault: any, pwd: string, freshVaultKeys?: {
|
|
2
|
-
salt: string;
|
|
3
|
-
}) => Promise<void>;
|
|
4
|
-
export declare const getDecryptedVault: (pwd: string, legacyPassword?: string) => Promise<any>;
|
|
5
|
-
export { VaultAuthenticationError } from './storage-core';
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { SyscoinTransactionsCore } from './syscoin-core';
|
|
2
|
-
import type { LedgerKeyring } from '../ledger';
|
|
3
|
-
import type { TrezorKeyring } from '../trezor';
|
|
4
|
-
type CoreArguments = ConstructorParameters<typeof SyscoinTransactionsCore>;
|
|
5
|
-
/** Legacy constructor: preserve device arguments while composing shared logic. */
|
|
6
|
-
export declare class SyscoinTransactions extends SyscoinTransactionsCore {
|
|
7
|
-
constructor(getSyscoinSigner: CoreArguments[0], getReadOnlySigner: CoreArguments[1], getState: CoreArguments[2], getAddress: CoreArguments[3], ledgerSigner: LedgerKeyring, trezorSigner: TrezorKeyring, captureSigningContext?: CoreArguments[5]);
|
|
8
|
-
}
|
|
9
|
-
export {};
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export declare const fetchBackendAccountCached: (backendUrl: string, xpub: string, options: string) => Promise<any>;
|
|
2
|
-
/**
|
|
3
|
-
* Drop in-flight account fetches. Without arguments clears everything;
|
|
4
|
-
* with an xpub only that account's entries are dropped (any backend).
|
|
5
|
-
*/
|
|
6
|
-
export declare const invalidateBlockbookAccountCache: (xpub?: string) => void;
|