@sidhujag/sysweb3-keyring 1.0.491
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/README.md +201 -0
- package/cjs/errorUtils.js +75 -0
- package/cjs/errorUtils.js.map +1 -0
- package/cjs/hardware-wallet-manager.js +462 -0
- package/cjs/hardware-wallet-manager.js.map +1 -0
- package/cjs/index.js +31 -0
- package/cjs/index.js.map +1 -0
- package/cjs/initial-state.js +105 -0
- package/cjs/initial-state.js.map +1 -0
- package/cjs/keyring-manager.js +1687 -0
- package/cjs/keyring-manager.js.map +1 -0
- package/cjs/ledger/bitcoin_client/index.js +47 -0
- package/cjs/ledger/bitcoin_client/index.js.map +1 -0
- package/cjs/ledger/bitcoin_client/lib/appClient.js +408 -0
- package/cjs/ledger/bitcoin_client/lib/appClient.js.map +1 -0
- package/cjs/ledger/bitcoin_client/lib/bip32.js +61 -0
- package/cjs/ledger/bitcoin_client/lib/bip32.js.map +1 -0
- package/cjs/ledger/bitcoin_client/lib/buffertools.js +126 -0
- package/cjs/ledger/bitcoin_client/lib/buffertools.js.map +1 -0
- package/cjs/ledger/bitcoin_client/lib/clientCommands.js +270 -0
- package/cjs/ledger/bitcoin_client/lib/clientCommands.js.map +1 -0
- package/cjs/ledger/bitcoin_client/lib/constants.js +16 -0
- package/cjs/ledger/bitcoin_client/lib/constants.js.map +1 -0
- package/cjs/ledger/bitcoin_client/lib/merkelizedPsbt.js +54 -0
- package/cjs/ledger/bitcoin_client/lib/merkelizedPsbt.js.map +1 -0
- package/cjs/ledger/bitcoin_client/lib/merkle.js +109 -0
- package/cjs/ledger/bitcoin_client/lib/merkle.js.map +1 -0
- package/cjs/ledger/bitcoin_client/lib/merkleMap.js +46 -0
- package/cjs/ledger/bitcoin_client/lib/merkleMap.js.map +1 -0
- package/cjs/ledger/bitcoin_client/lib/policy.js +66 -0
- package/cjs/ledger/bitcoin_client/lib/policy.js.map +1 -0
- package/cjs/ledger/bitcoin_client/lib/psbtv2.js +640 -0
- package/cjs/ledger/bitcoin_client/lib/psbtv2.js.map +1 -0
- package/cjs/ledger/bitcoin_client/lib/varint.js +113 -0
- package/cjs/ledger/bitcoin_client/lib/varint.js.map +1 -0
- package/cjs/ledger/consts.js +7 -0
- package/cjs/ledger/consts.js.map +1 -0
- package/cjs/ledger/index.js +319 -0
- package/cjs/ledger/index.js.map +1 -0
- package/cjs/ledger/types.js +3 -0
- package/cjs/ledger/types.js.map +1 -0
- package/cjs/network-utils.js +76 -0
- package/cjs/network-utils.js.map +1 -0
- package/cjs/providers.js +270 -0
- package/cjs/providers.js.map +1 -0
- package/cjs/signers.js +64 -0
- package/cjs/signers.js.map +1 -0
- package/cjs/storage.js +30 -0
- package/cjs/storage.js.map +1 -0
- package/cjs/transactions/__tests__/integration.test.js +237 -0
- package/cjs/transactions/__tests__/integration.test.js.map +1 -0
- package/cjs/transactions/__tests__/syscoin.test.js +361 -0
- package/cjs/transactions/__tests__/syscoin.test.js.map +1 -0
- package/cjs/transactions/ethereum.js +1577 -0
- package/cjs/transactions/ethereum.js.map +1 -0
- package/cjs/transactions/index.js +19 -0
- package/cjs/transactions/index.js.map +1 -0
- package/cjs/transactions/syscoin.js +328 -0
- package/cjs/transactions/syscoin.js.map +1 -0
- package/cjs/trezor/index.js +718 -0
- package/cjs/trezor/index.js.map +1 -0
- package/cjs/types.js +12 -0
- package/cjs/types.js.map +1 -0
- package/cjs/utils/derivation-paths.js +99 -0
- package/cjs/utils/derivation-paths.js.map +1 -0
- package/cjs/utils/psbt.js +60 -0
- package/cjs/utils/psbt.js.map +1 -0
- package/cjs/utils.js +130 -0
- package/cjs/utils.js.map +1 -0
- package/package.json +46 -0
- package/types/errorUtils.d.ts +1 -0
- package/types/hardware-wallet-manager.d.ts +110 -0
- package/types/index.d.ts +12 -0
- package/types/initial-state.d.ts +79 -0
- package/types/keyring-manager.d.ts +184 -0
- package/types/ledger/bitcoin_client/index.d.ts +5 -0
- package/types/ledger/bitcoin_client/lib/appClient.d.ts +106 -0
- package/types/ledger/bitcoin_client/lib/bip32.d.ts +11 -0
- package/types/ledger/bitcoin_client/lib/buffertools.d.ts +28 -0
- package/types/ledger/bitcoin_client/lib/clientCommands.d.ts +77 -0
- package/types/ledger/bitcoin_client/lib/constants.d.ts +12 -0
- package/types/ledger/bitcoin_client/lib/merkelizedPsbt.d.ts +24 -0
- package/types/ledger/bitcoin_client/lib/merkle.d.ts +32 -0
- package/types/ledger/bitcoin_client/lib/merkleMap.d.ts +23 -0
- package/types/ledger/bitcoin_client/lib/policy.d.ts +36 -0
- package/types/ledger/bitcoin_client/lib/psbtv2.d.ts +167 -0
- package/types/ledger/bitcoin_client/lib/varint.d.ts +23 -0
- package/types/ledger/consts.d.ts +3 -0
- package/types/ledger/index.d.ts +51 -0
- package/types/ledger/types.d.ts +48 -0
- package/types/network-utils.d.ts +14 -0
- package/types/providers.d.ts +47 -0
- package/types/signers.d.ts +95 -0
- package/types/storage.d.ts +2 -0
- package/types/transactions/__tests__/integration.test.d.ts +1 -0
- package/types/transactions/__tests__/syscoin.test.d.ts +1 -0
- package/types/transactions/ethereum.d.ts +80 -0
- package/types/transactions/index.d.ts +2 -0
- package/types/transactions/syscoin.d.ts +61 -0
- package/types/trezor/index.d.ts +170 -0
- package/types/types.d.ts +294 -0
- package/types/utils/derivation-paths.d.ts +35 -0
- package/types/utils/psbt.d.ts +17 -0
- package/types/utils.d.ts +4 -0
|
@@ -0,0 +1,462 @@
|
|
|
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.HardwareWalletManager = exports.ConnectionStatus = exports.HardwareWalletType = void 0;
|
|
7
|
+
const hw_transport_webhid_1 = __importDefault(require("@ledgerhq/hw-transport-webhid"));
|
|
8
|
+
const logs_1 = require("@ledgerhq/logs");
|
|
9
|
+
const connect_webextension_1 = __importDefault(require("@trezor/connect-webextension"));
|
|
10
|
+
const events_1 = require("events");
|
|
11
|
+
var HardwareWalletType;
|
|
12
|
+
(function (HardwareWalletType) {
|
|
13
|
+
HardwareWalletType["LEDGER"] = "ledger";
|
|
14
|
+
HardwareWalletType["TREZOR"] = "trezor";
|
|
15
|
+
})(HardwareWalletType || (exports.HardwareWalletType = HardwareWalletType = {}));
|
|
16
|
+
var ConnectionStatus;
|
|
17
|
+
(function (ConnectionStatus) {
|
|
18
|
+
ConnectionStatus["DISCONNECTED"] = "disconnected";
|
|
19
|
+
ConnectionStatus["CONNECTING"] = "connecting";
|
|
20
|
+
ConnectionStatus["CONNECTED"] = "connected";
|
|
21
|
+
ConnectionStatus["ERROR"] = "error";
|
|
22
|
+
})(ConnectionStatus || (exports.ConnectionStatus = ConnectionStatus = {}));
|
|
23
|
+
/**
|
|
24
|
+
* Hardware Wallet Manager with connection pooling, status monitoring, and error recovery
|
|
25
|
+
*/
|
|
26
|
+
class HardwareWalletManager extends events_1.EventEmitter {
|
|
27
|
+
constructor() {
|
|
28
|
+
super();
|
|
29
|
+
this.connectionPool = new Map();
|
|
30
|
+
this.statusMonitorInterval = null;
|
|
31
|
+
this.CONNECTION_TIMEOUT = 30000; // 30 seconds
|
|
32
|
+
this.IDLE_TIMEOUT = 5 * 60 * 1000; // 5 minutes
|
|
33
|
+
this.STATUS_CHECK_INTERVAL = 5000; // 5 seconds
|
|
34
|
+
this.retryConfig = {
|
|
35
|
+
maxRetries: 3,
|
|
36
|
+
baseDelay: 1000, // 1 second
|
|
37
|
+
maxDelay: 10000, // 10 seconds
|
|
38
|
+
backoffMultiplier: 2,
|
|
39
|
+
};
|
|
40
|
+
this.startStatusMonitoring();
|
|
41
|
+
// Set up Ledger debug logging
|
|
42
|
+
if (process.env.NODE_ENV === 'development') {
|
|
43
|
+
(0, logs_1.listen)((log) => {
|
|
44
|
+
console.log(`[Ledger] ${log.type}: ${log.message}`);
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Get or create a Ledger connection with retry logic
|
|
50
|
+
*/
|
|
51
|
+
async getLedgerConnection() {
|
|
52
|
+
const key = `${HardwareWalletType.LEDGER}-default`;
|
|
53
|
+
const existing = this.connectionPool.get(key);
|
|
54
|
+
if (existing?.transport && existing.status === ConnectionStatus.CONNECTED) {
|
|
55
|
+
existing.lastActivity = Date.now();
|
|
56
|
+
return existing.transport;
|
|
57
|
+
}
|
|
58
|
+
return this.createLedgerConnectionWithRetry(key);
|
|
59
|
+
}
|
|
60
|
+
/**
|
|
61
|
+
* Create Ledger connection with exponential backoff retry
|
|
62
|
+
*/
|
|
63
|
+
async createLedgerConnectionWithRetry(key) {
|
|
64
|
+
const entry = {
|
|
65
|
+
status: ConnectionStatus.CONNECTING,
|
|
66
|
+
lastActivity: Date.now(),
|
|
67
|
+
retryCount: 0,
|
|
68
|
+
};
|
|
69
|
+
this.connectionPool.set(key, entry);
|
|
70
|
+
let lastError;
|
|
71
|
+
for (let attempt = 0; attempt <= this.retryConfig.maxRetries; attempt++) {
|
|
72
|
+
try {
|
|
73
|
+
this.emit('connectionAttempt', {
|
|
74
|
+
type: HardwareWalletType.LEDGER,
|
|
75
|
+
attempt: attempt + 1,
|
|
76
|
+
maxAttempts: this.retryConfig.maxRetries + 1,
|
|
77
|
+
});
|
|
78
|
+
const transport = await this.createLedgerTransport();
|
|
79
|
+
entry.transport = transport;
|
|
80
|
+
entry.status = ConnectionStatus.CONNECTED;
|
|
81
|
+
entry.retryCount = 0;
|
|
82
|
+
entry.error = undefined;
|
|
83
|
+
this.emit('connected', { type: HardwareWalletType.LEDGER });
|
|
84
|
+
// Set up disconnect handler
|
|
85
|
+
transport.on('disconnect', () => {
|
|
86
|
+
this.handleDisconnect(key, HardwareWalletType.LEDGER);
|
|
87
|
+
});
|
|
88
|
+
return transport;
|
|
89
|
+
}
|
|
90
|
+
catch (error) {
|
|
91
|
+
lastError = error;
|
|
92
|
+
entry.retryCount = attempt + 1;
|
|
93
|
+
entry.error = lastError;
|
|
94
|
+
if (attempt < this.retryConfig.maxRetries) {
|
|
95
|
+
const delay = this.calculateBackoffDelay(attempt);
|
|
96
|
+
this.emit('retrying', {
|
|
97
|
+
type: HardwareWalletType.LEDGER,
|
|
98
|
+
attempt: attempt + 1,
|
|
99
|
+
nextRetryIn: delay,
|
|
100
|
+
error: lastError.message,
|
|
101
|
+
});
|
|
102
|
+
await this.delay(delay);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
entry.status = ConnectionStatus.ERROR;
|
|
107
|
+
this.emit('connectionFailed', {
|
|
108
|
+
type: HardwareWalletType.LEDGER,
|
|
109
|
+
error: lastError?.message,
|
|
110
|
+
});
|
|
111
|
+
throw new Error(`Failed to connect to Ledger after ${this.retryConfig.maxRetries + 1} attempts: ${lastError?.message || 'Unknown error'}`);
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Create Ledger transport with timeout
|
|
115
|
+
*/
|
|
116
|
+
async createLedgerTransport() {
|
|
117
|
+
return Promise.race([
|
|
118
|
+
hw_transport_webhid_1.default.create(),
|
|
119
|
+
this.createTimeoutPromise(this.CONNECTION_TIMEOUT, 'Ledger connection timeout'),
|
|
120
|
+
]);
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Initialize Trezor with retry logic
|
|
124
|
+
*/
|
|
125
|
+
async initializeTrezor() {
|
|
126
|
+
const key = `${HardwareWalletType.TREZOR}-default`;
|
|
127
|
+
const existing = this.connectionPool.get(key);
|
|
128
|
+
if (existing?.status === ConnectionStatus.CONNECTED) {
|
|
129
|
+
existing.lastActivity = Date.now();
|
|
130
|
+
return true;
|
|
131
|
+
}
|
|
132
|
+
// Check if we're already trying to connect
|
|
133
|
+
if (existing?.status === ConnectionStatus.CONNECTING) {
|
|
134
|
+
console.log('[HardwareWalletManager] Trezor connection already in progress');
|
|
135
|
+
// Wait a bit and check again
|
|
136
|
+
await this.delay(1000);
|
|
137
|
+
const updated = this.connectionPool.get(key);
|
|
138
|
+
return updated?.status === ConnectionStatus.CONNECTED || false;
|
|
139
|
+
}
|
|
140
|
+
return this.initializeTrezorWithRetry(key);
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Initialize Trezor with exponential backoff retry
|
|
144
|
+
*/
|
|
145
|
+
async initializeTrezorWithRetry(key) {
|
|
146
|
+
const entry = {
|
|
147
|
+
status: ConnectionStatus.CONNECTING,
|
|
148
|
+
lastActivity: Date.now(),
|
|
149
|
+
retryCount: 0,
|
|
150
|
+
};
|
|
151
|
+
this.connectionPool.set(key, entry);
|
|
152
|
+
let lastError;
|
|
153
|
+
// Reduce retry attempts for Trezor to prevent repeated popups
|
|
154
|
+
const trezorRetryConfig = {
|
|
155
|
+
...this.retryConfig,
|
|
156
|
+
maxRetries: 1, // Only retry once for Trezor
|
|
157
|
+
};
|
|
158
|
+
for (let attempt = 0; attempt <= trezorRetryConfig.maxRetries; attempt++) {
|
|
159
|
+
try {
|
|
160
|
+
this.emit('connectionAttempt', {
|
|
161
|
+
type: HardwareWalletType.TREZOR,
|
|
162
|
+
attempt: attempt + 1,
|
|
163
|
+
maxAttempts: trezorRetryConfig.maxRetries + 1,
|
|
164
|
+
});
|
|
165
|
+
// Dispose any existing iframe before initialization
|
|
166
|
+
try {
|
|
167
|
+
await connect_webextension_1.default.dispose();
|
|
168
|
+
}
|
|
169
|
+
catch (disposeError) {
|
|
170
|
+
console.log('[HardwareWalletManager] Dispose error (safe to ignore):', disposeError);
|
|
171
|
+
}
|
|
172
|
+
await connect_webextension_1.default.init({
|
|
173
|
+
manifest: {
|
|
174
|
+
appUrl: 'https://paliwallet.com/',
|
|
175
|
+
email: 'support@syscoin.org',
|
|
176
|
+
},
|
|
177
|
+
lazyLoad: true,
|
|
178
|
+
popup: true,
|
|
179
|
+
connectSrc: 'https://connect.trezor.io/9/',
|
|
180
|
+
_extendWebextensionLifetime: true,
|
|
181
|
+
transports: ['BridgeTransport', 'WebUsbTransport'],
|
|
182
|
+
debug: false, // Disable debug mode to prevent extra logs
|
|
183
|
+
coreMode: 'popup', // Use popup mode for webUSB support in Chrome extension
|
|
184
|
+
});
|
|
185
|
+
entry.status = ConnectionStatus.CONNECTED;
|
|
186
|
+
entry.retryCount = 0;
|
|
187
|
+
entry.error = undefined;
|
|
188
|
+
this.emit('connected', { type: HardwareWalletType.TREZOR });
|
|
189
|
+
// Set up device event listeners
|
|
190
|
+
connect_webextension_1.default.on('DEVICE_EVENT', (event) => {
|
|
191
|
+
if (event.type === 'device-disconnect') {
|
|
192
|
+
this.handleDisconnect(key, HardwareWalletType.TREZOR);
|
|
193
|
+
}
|
|
194
|
+
});
|
|
195
|
+
return true;
|
|
196
|
+
}
|
|
197
|
+
catch (error) {
|
|
198
|
+
lastError = error;
|
|
199
|
+
// Check if already initialized - this is actually OK
|
|
200
|
+
if (lastError.message.includes('TrezorConnect has been already initialized')) {
|
|
201
|
+
// Instead of just marking as connected, verify the connection
|
|
202
|
+
try {
|
|
203
|
+
// Test the connection with a simple call
|
|
204
|
+
const testResponse = await connect_webextension_1.default.getFeatures();
|
|
205
|
+
if (testResponse.success) {
|
|
206
|
+
entry.status = ConnectionStatus.CONNECTED;
|
|
207
|
+
entry.retryCount = 0;
|
|
208
|
+
entry.error = undefined;
|
|
209
|
+
this.emit('connected', { type: HardwareWalletType.TREZOR });
|
|
210
|
+
return true;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
catch (testError) {
|
|
214
|
+
console.log('[HardwareWalletManager] Trezor test connection failed:', testError);
|
|
215
|
+
}
|
|
216
|
+
// If test failed, dispose and retry
|
|
217
|
+
try {
|
|
218
|
+
await connect_webextension_1.default.dispose();
|
|
219
|
+
await this.delay(500);
|
|
220
|
+
}
|
|
221
|
+
catch (disposeError) {
|
|
222
|
+
console.log('[HardwareWalletManager] Error disposing for retry:', disposeError);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
entry.retryCount = attempt + 1;
|
|
226
|
+
entry.error = lastError;
|
|
227
|
+
// Check for specific Trezor errors
|
|
228
|
+
if (lastError.message.includes('device is already in use') ||
|
|
229
|
+
lastError.message.includes('Device is being used in another window')) {
|
|
230
|
+
console.log('[HardwareWalletManager] Trezor device is in use by another application');
|
|
231
|
+
// Try to dispose and reinitialize
|
|
232
|
+
try {
|
|
233
|
+
await connect_webextension_1.default.dispose();
|
|
234
|
+
await this.delay(2000); // Wait 2 seconds before retry
|
|
235
|
+
}
|
|
236
|
+
catch (disposeError) {
|
|
237
|
+
console.log('[HardwareWalletManager] Error during dispose:', disposeError);
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
// Don't retry if user cancelled
|
|
241
|
+
if (lastError.message.includes('Popup closed') ||
|
|
242
|
+
lastError.message.includes('cancelled') ||
|
|
243
|
+
lastError.message.includes('denied')) {
|
|
244
|
+
console.log('[HardwareWalletManager] User cancelled Trezor connection');
|
|
245
|
+
break; // Exit retry loop
|
|
246
|
+
}
|
|
247
|
+
if (attempt < trezorRetryConfig.maxRetries) {
|
|
248
|
+
const delay = this.calculateBackoffDelay(attempt);
|
|
249
|
+
this.emit('retrying', {
|
|
250
|
+
type: HardwareWalletType.TREZOR,
|
|
251
|
+
attempt: attempt + 1,
|
|
252
|
+
nextRetryIn: delay,
|
|
253
|
+
error: lastError.message,
|
|
254
|
+
});
|
|
255
|
+
await this.delay(delay);
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
entry.status = ConnectionStatus.ERROR;
|
|
260
|
+
this.emit('connectionFailed', {
|
|
261
|
+
type: HardwareWalletType.TREZOR,
|
|
262
|
+
error: lastError?.message,
|
|
263
|
+
});
|
|
264
|
+
// Clean up on failure
|
|
265
|
+
try {
|
|
266
|
+
await connect_webextension_1.default.dispose();
|
|
267
|
+
}
|
|
268
|
+
catch (disposeError) {
|
|
269
|
+
console.log('[HardwareWalletManager] Failed to dispose on error:', disposeError);
|
|
270
|
+
}
|
|
271
|
+
return false;
|
|
272
|
+
}
|
|
273
|
+
/**
|
|
274
|
+
* Handle device disconnect
|
|
275
|
+
*/
|
|
276
|
+
handleDisconnect(key, type) {
|
|
277
|
+
const entry = this.connectionPool.get(key);
|
|
278
|
+
if (entry) {
|
|
279
|
+
entry.status = ConnectionStatus.DISCONNECTED;
|
|
280
|
+
entry.transport = null;
|
|
281
|
+
this.emit('disconnected', { type });
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Start real-time status monitoring
|
|
286
|
+
*/
|
|
287
|
+
startStatusMonitoring() {
|
|
288
|
+
if (this.statusMonitorInterval) {
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
this.statusMonitorInterval = setInterval(() => {
|
|
292
|
+
this.checkAllConnections();
|
|
293
|
+
}, this.STATUS_CHECK_INTERVAL);
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Check all connections and clean up idle ones
|
|
297
|
+
*/
|
|
298
|
+
async checkAllConnections() {
|
|
299
|
+
const now = Date.now();
|
|
300
|
+
const statuses = [];
|
|
301
|
+
for (const [key, entry] of this.connectionPool.entries()) {
|
|
302
|
+
const type = key.startsWith(HardwareWalletType.LEDGER)
|
|
303
|
+
? HardwareWalletType.LEDGER
|
|
304
|
+
: HardwareWalletType.TREZOR;
|
|
305
|
+
// Clean up idle connections
|
|
306
|
+
if (entry.status === ConnectionStatus.CONNECTED &&
|
|
307
|
+
now - entry.lastActivity > this.IDLE_TIMEOUT) {
|
|
308
|
+
await this.closeConnection(key);
|
|
309
|
+
continue;
|
|
310
|
+
}
|
|
311
|
+
// Build status
|
|
312
|
+
const status = {
|
|
313
|
+
type,
|
|
314
|
+
status: entry.status,
|
|
315
|
+
connected: entry.status === ConnectionStatus.CONNECTED,
|
|
316
|
+
lastSeen: entry.lastActivity,
|
|
317
|
+
error: entry.error?.message,
|
|
318
|
+
};
|
|
319
|
+
statuses.push(status);
|
|
320
|
+
}
|
|
321
|
+
this.emit('statusUpdate', statuses);
|
|
322
|
+
}
|
|
323
|
+
/**
|
|
324
|
+
* Get current status of all hardware wallets
|
|
325
|
+
*/
|
|
326
|
+
getStatus() {
|
|
327
|
+
const statuses = [];
|
|
328
|
+
// Check Ledger
|
|
329
|
+
const ledgerEntry = this.connectionPool.get(`${HardwareWalletType.LEDGER}-default`);
|
|
330
|
+
statuses.push({
|
|
331
|
+
type: HardwareWalletType.LEDGER,
|
|
332
|
+
status: ledgerEntry?.status || ConnectionStatus.DISCONNECTED,
|
|
333
|
+
connected: ledgerEntry?.status === ConnectionStatus.CONNECTED,
|
|
334
|
+
lastSeen: ledgerEntry?.lastActivity,
|
|
335
|
+
error: ledgerEntry?.error?.message,
|
|
336
|
+
});
|
|
337
|
+
// Check Trezor
|
|
338
|
+
const trezorEntry = this.connectionPool.get(`${HardwareWalletType.TREZOR}-default`);
|
|
339
|
+
statuses.push({
|
|
340
|
+
type: HardwareWalletType.TREZOR,
|
|
341
|
+
status: trezorEntry?.status || ConnectionStatus.DISCONNECTED,
|
|
342
|
+
connected: trezorEntry?.status === ConnectionStatus.CONNECTED,
|
|
343
|
+
lastSeen: trezorEntry?.lastActivity,
|
|
344
|
+
error: trezorEntry?.error?.message,
|
|
345
|
+
});
|
|
346
|
+
return statuses;
|
|
347
|
+
}
|
|
348
|
+
/**
|
|
349
|
+
* Check if a specific device is connected
|
|
350
|
+
*/
|
|
351
|
+
isConnected(type) {
|
|
352
|
+
const key = `${type}-default`;
|
|
353
|
+
const entry = this.connectionPool.get(key);
|
|
354
|
+
return entry?.status === ConnectionStatus.CONNECTED;
|
|
355
|
+
}
|
|
356
|
+
/**
|
|
357
|
+
* Ensure connection before operation
|
|
358
|
+
*/
|
|
359
|
+
async ensureConnection(type) {
|
|
360
|
+
if (type === HardwareWalletType.LEDGER) {
|
|
361
|
+
await this.getLedgerConnection();
|
|
362
|
+
}
|
|
363
|
+
else if (type === HardwareWalletType.TREZOR) {
|
|
364
|
+
const initialized = await this.initializeTrezor();
|
|
365
|
+
if (!initialized) {
|
|
366
|
+
throw new Error('Failed to initialize Trezor');
|
|
367
|
+
}
|
|
368
|
+
}
|
|
369
|
+
}
|
|
370
|
+
/**
|
|
371
|
+
* Close a specific connection
|
|
372
|
+
*/
|
|
373
|
+
async closeConnection(key) {
|
|
374
|
+
const entry = this.connectionPool.get(key);
|
|
375
|
+
// Handle Trezor connections
|
|
376
|
+
if (key.startsWith(HardwareWalletType.TREZOR)) {
|
|
377
|
+
try {
|
|
378
|
+
await connect_webextension_1.default.dispose();
|
|
379
|
+
}
|
|
380
|
+
catch (error) {
|
|
381
|
+
console.error('Error disposing Trezor:', error);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
// Handle Ledger connections
|
|
385
|
+
if (entry?.transport) {
|
|
386
|
+
try {
|
|
387
|
+
await entry.transport.close();
|
|
388
|
+
}
|
|
389
|
+
catch (error) {
|
|
390
|
+
console.error('Error closing transport:', error);
|
|
391
|
+
}
|
|
392
|
+
}
|
|
393
|
+
this.connectionPool.delete(key);
|
|
394
|
+
}
|
|
395
|
+
/**
|
|
396
|
+
* Close all connections and stop monitoring
|
|
397
|
+
*/
|
|
398
|
+
async destroy() {
|
|
399
|
+
// Stop monitoring
|
|
400
|
+
if (this.statusMonitorInterval) {
|
|
401
|
+
clearInterval(this.statusMonitorInterval);
|
|
402
|
+
this.statusMonitorInterval = null;
|
|
403
|
+
}
|
|
404
|
+
// Close all connections
|
|
405
|
+
for (const key of this.connectionPool.keys()) {
|
|
406
|
+
await this.closeConnection(key);
|
|
407
|
+
}
|
|
408
|
+
this.removeAllListeners();
|
|
409
|
+
}
|
|
410
|
+
/**
|
|
411
|
+
* Calculate exponential backoff delay
|
|
412
|
+
*/
|
|
413
|
+
calculateBackoffDelay(attempt) {
|
|
414
|
+
const delay = Math.min(this.retryConfig.baseDelay *
|
|
415
|
+
Math.pow(this.retryConfig.backoffMultiplier, attempt), this.retryConfig.maxDelay);
|
|
416
|
+
// Add jitter (±20%)
|
|
417
|
+
const jitter = delay * 0.2 * (Math.random() - 0.5);
|
|
418
|
+
return Math.round(delay + jitter);
|
|
419
|
+
}
|
|
420
|
+
/**
|
|
421
|
+
* Create a timeout promise
|
|
422
|
+
*/
|
|
423
|
+
createTimeoutPromise(ms, message) {
|
|
424
|
+
return new Promise((_, reject) => {
|
|
425
|
+
setTimeout(() => reject(new Error(message)), ms);
|
|
426
|
+
});
|
|
427
|
+
}
|
|
428
|
+
/**
|
|
429
|
+
* Delay helper
|
|
430
|
+
*/
|
|
431
|
+
delay(ms) {
|
|
432
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
433
|
+
}
|
|
434
|
+
/**
|
|
435
|
+
* Retry an operation with exponential backoff
|
|
436
|
+
*/
|
|
437
|
+
async retryOperation(operation, operationName, customRetryConfig) {
|
|
438
|
+
const config = { ...this.retryConfig, ...customRetryConfig };
|
|
439
|
+
let lastError;
|
|
440
|
+
for (let attempt = 0; attempt <= config.maxRetries; attempt++) {
|
|
441
|
+
try {
|
|
442
|
+
return await operation();
|
|
443
|
+
}
|
|
444
|
+
catch (error) {
|
|
445
|
+
lastError = error;
|
|
446
|
+
if (attempt < config.maxRetries) {
|
|
447
|
+
const delay = this.calculateBackoffDelay(attempt);
|
|
448
|
+
this.emit('operationRetry', {
|
|
449
|
+
operation: operationName,
|
|
450
|
+
attempt: attempt + 1,
|
|
451
|
+
nextRetryIn: delay,
|
|
452
|
+
error: lastError.message,
|
|
453
|
+
});
|
|
454
|
+
await this.delay(delay);
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
}
|
|
458
|
+
throw new Error(`${operationName} failed after ${config.maxRetries + 1} attempts: ${lastError?.message || 'Unknown error'}`);
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
exports.HardwareWalletManager = HardwareWalletManager;
|
|
462
|
+
//# sourceMappingURL=hardware-wallet-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
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AE,OAAO,IAAI,MAAM,CAAC,UAAU,EAAE,OAAO,EAAE,EAAE,CAAC;YAC9D,IAAI,CAAC;gBACH,OAAO,MAAM,SAAS,EAAE,CAAC;YAC3B,CAAC;YAAC,OAAO,KAAK,EAAE,CAAC;gBACf,SAAS,GAAG,KAAc,CAAC;gBAE3B,IAAI,OAAO,GAAG,MAAM,CAAC,UAAU,EAAE,CAAC;oBAChC,MAAM,KAAK,GAAG,IAAI,CAAC,qBAAqB,CAAC,OAAO,CAAC,CAAC;oBAElD,IAAI,CAAC,IAAI,CAAC,gBAAgB,EAAE;wBAC1B,SAAS,EAAE,aAAa;wBACxB,OAAO,EAAE,OAAO,GAAG,CAAC;wBACpB,WAAW,EAAE,KAAK;wBAClB,KAAK,EAAE,SAAS,CAAC,OAAO;qBACzB,CAAC,CAAC;oBAEH,MAAM,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;gBAC1B,CAAC;YACH,CAAC;QACH,CAAC;QAED,MAAM,IAAI,KAAK,CACb,GAAG,aAAa,iBAAiB,MAAM,CAAC,UAAU,GAAG,CAAC,cACpD,SAAS,EAAE,OAAO,IAAI,eACxB,EAAE,CACH,CAAC;IACJ,CAAC;CACF;AA3iBD,sDA2iBC"}
|
package/cjs/index.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
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 __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
exports.PsbtUtils = void 0;
|
|
18
|
+
__exportStar(require("./transactions"), exports);
|
|
19
|
+
__exportStar(require("./trezor"), exports);
|
|
20
|
+
__exportStar(require("./types"), exports);
|
|
21
|
+
__exportStar(require("./storage"), exports);
|
|
22
|
+
__exportStar(require("./signers"), exports);
|
|
23
|
+
__exportStar(require("./initial-state"), exports);
|
|
24
|
+
__exportStar(require("./keyring-manager"), exports);
|
|
25
|
+
__exportStar(require("./providers"), exports);
|
|
26
|
+
__exportStar(require("./utils/derivation-paths"), exports);
|
|
27
|
+
__exportStar(require("./network-utils"), exports);
|
|
28
|
+
__exportStar(require("./hardware-wallet-manager"), exports);
|
|
29
|
+
var psbt_1 = require("./utils/psbt");
|
|
30
|
+
Object.defineProperty(exports, "PsbtUtils", { enumerable: true, get: function () { return psbt_1.PsbtUtils; } });
|
|
31
|
+
//# sourceMappingURL=index.js.map
|
package/cjs/index.js.map
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,iDAA+B;AAC/B,2CAAyB;AACzB,0CAAwB;AACxB,4CAA0B;AAC1B,4CAA0B;AAC1B,kDAAgC;AAChC,oDAAkC;AAClC,8CAA4B;AAC5B,2DAAyC;AACzC,kDAAgC;AAChC,4DAA0C;AAC1C,qCAAyC;AAAhC,iGAAA,SAAS,OAAA"}
|
|
@@ -0,0 +1,105 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.initialNetworksState = exports.initialActiveLedgerAccountState = exports.initialActiveTrezorAccountState = exports.initialActiveImportedAccountState = exports.initialActiveHdAccountState = void 0;
|
|
4
|
+
const sysweb3_network_1 = require("@sidhujag/sysweb3-network");
|
|
5
|
+
const network_utils_1 = require("./network-utils");
|
|
6
|
+
exports.initialActiveHdAccountState = {
|
|
7
|
+
address: '',
|
|
8
|
+
balances: {
|
|
9
|
+
ethereum: 0,
|
|
10
|
+
syscoin: 0,
|
|
11
|
+
},
|
|
12
|
+
id: 0,
|
|
13
|
+
isTrezorWallet: false,
|
|
14
|
+
isLedgerWallet: false,
|
|
15
|
+
label: 'Account 1',
|
|
16
|
+
xprv: '',
|
|
17
|
+
xpub: '',
|
|
18
|
+
isImported: false,
|
|
19
|
+
};
|
|
20
|
+
exports.initialActiveImportedAccountState = {
|
|
21
|
+
...exports.initialActiveHdAccountState,
|
|
22
|
+
isImported: true,
|
|
23
|
+
};
|
|
24
|
+
exports.initialActiveTrezorAccountState = {
|
|
25
|
+
...exports.initialActiveHdAccountState,
|
|
26
|
+
isTrezorWallet: true,
|
|
27
|
+
isLedgerWallet: false,
|
|
28
|
+
};
|
|
29
|
+
exports.initialActiveLedgerAccountState = {
|
|
30
|
+
...exports.initialActiveHdAccountState,
|
|
31
|
+
isLedgerWallet: true,
|
|
32
|
+
isTrezorWallet: false,
|
|
33
|
+
};
|
|
34
|
+
exports.initialNetworksState = {
|
|
35
|
+
syscoin: (0, network_utils_1.getDefaultUTXONetworks)(),
|
|
36
|
+
ethereum: {
|
|
37
|
+
1: {
|
|
38
|
+
chainId: 1,
|
|
39
|
+
url: 'https://rpc.ankr.com/eth',
|
|
40
|
+
label: 'Ethereum Mainnet',
|
|
41
|
+
default: false,
|
|
42
|
+
currency: 'eth',
|
|
43
|
+
explorer: 'https://etherscan.io',
|
|
44
|
+
apiUrl: 'https://api.etherscan.io/api',
|
|
45
|
+
slip44: 60,
|
|
46
|
+
kind: sysweb3_network_1.INetworkType.Ethereum,
|
|
47
|
+
},
|
|
48
|
+
137: {
|
|
49
|
+
chainId: 137,
|
|
50
|
+
currency: 'matic',
|
|
51
|
+
default: false,
|
|
52
|
+
label: 'Polygon Mainnet',
|
|
53
|
+
url: 'https://polygon-rpc.com',
|
|
54
|
+
apiUrl: 'https://api.polygonscan.com/api',
|
|
55
|
+
explorer: 'https://polygonscan.com',
|
|
56
|
+
slip44: 60,
|
|
57
|
+
kind: sysweb3_network_1.INetworkType.Ethereum,
|
|
58
|
+
},
|
|
59
|
+
80001: {
|
|
60
|
+
chainId: 80001,
|
|
61
|
+
currency: 'matic',
|
|
62
|
+
default: false,
|
|
63
|
+
label: 'Mumbai Testnet',
|
|
64
|
+
url: 'https://endpoints.omniatech.io/v1/matic/mumbai/public',
|
|
65
|
+
apiUrl: 'https://api-testnet.polygonscan.com/api',
|
|
66
|
+
explorer: 'https://mumbai.polygonscan.com',
|
|
67
|
+
slip44: 60,
|
|
68
|
+
kind: sysweb3_network_1.INetworkType.Ethereum,
|
|
69
|
+
},
|
|
70
|
+
57: {
|
|
71
|
+
chainId: 57,
|
|
72
|
+
currency: 'sys',
|
|
73
|
+
default: true,
|
|
74
|
+
label: 'Syscoin NEVM',
|
|
75
|
+
url: 'https://rpc.syscoin.org',
|
|
76
|
+
apiUrl: 'https://explorer.syscoin.org/api',
|
|
77
|
+
explorer: 'https://explorer.syscoin.org',
|
|
78
|
+
slip44: 60,
|
|
79
|
+
kind: sysweb3_network_1.INetworkType.Ethereum,
|
|
80
|
+
},
|
|
81
|
+
570: {
|
|
82
|
+
chainId: 570,
|
|
83
|
+
currency: 'sys',
|
|
84
|
+
default: true,
|
|
85
|
+
label: 'Rollux',
|
|
86
|
+
url: 'https://rpc.rollux.com',
|
|
87
|
+
apiUrl: 'https://explorer.rollux.com/api',
|
|
88
|
+
explorer: 'https://explorer.rollux.com',
|
|
89
|
+
slip44: 60,
|
|
90
|
+
kind: sysweb3_network_1.INetworkType.Ethereum,
|
|
91
|
+
},
|
|
92
|
+
5700: {
|
|
93
|
+
chainId: 5700,
|
|
94
|
+
currency: 'tsys',
|
|
95
|
+
default: false,
|
|
96
|
+
label: 'Tanenbaum Testnet',
|
|
97
|
+
url: 'https://rpc.tanenbaum.io',
|
|
98
|
+
apiUrl: 'https://explorer.tanenbaum.io/api',
|
|
99
|
+
explorer: 'https://explorer.tanenbaum.io',
|
|
100
|
+
slip44: 60,
|
|
101
|
+
kind: sysweb3_network_1.INetworkType.Ethereum,
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
};
|
|
105
|
+
//# sourceMappingURL=initial-state.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"initial-state.js","sourceRoot":"","sources":["../../src/initial-state.ts"],"names":[],"mappings":";;;AAAA,+DAAyD;AAEzD,mDAAyD;AAG5C,QAAA,2BAA2B,GAAyB;IAC/D,OAAO,EAAE,EAAE;IACX,QAAQ,EAAE;QACR,QAAQ,EAAE,CAAC;QACX,OAAO,EAAE,CAAC;KACX;IACD,EAAE,EAAE,CAAC;IACL,cAAc,EAAE,KAAK;IACrB,cAAc,EAAE,KAAK;IACrB,KAAK,EAAE,WAAW;IAClB,IAAI,EAAE,EAAE;IACR,IAAI,EAAE,EAAE;IACR,UAAU,EAAE,KAAK;CAClB,CAAC;AAEW,QAAA,iCAAiC,GAAyB;IACrE,GAAG,mCAA2B;IAC9B,UAAU,EAAE,IAAI;CACjB,CAAC;AAEW,QAAA,+BAA+B,GAAyB;IACnE,GAAG,mCAA2B;IAC9B,cAAc,EAAE,IAAI;IACpB,cAAc,EAAE,KAAK;CACtB,CAAC;AAEW,QAAA,+BAA+B,GAAyB;IACnE,GAAG,mCAA2B;IAC9B,cAAc,EAAE,IAAI;IACpB,cAAc,EAAE,KAAK;CACtB,CAAC;AAEW,QAAA,oBAAoB,GAAG;IAClC,OAAO,EAAE,IAAA,sCAAsB,GAAE;IACjC,QAAQ,EAAE;QACR,CAAC,EAAE;YACD,OAAO,EAAE,CAAC;YACV,GAAG,EAAE,0BAA0B;YAC/B,KAAK,EAAE,kBAAkB;YACzB,OAAO,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