@pioneer-platform/pioneer-react 0.2.46 → 0.2.47

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.
Files changed (57) hide show
  1. package/dist/index.js +163952 -215421
  2. package/dist/{index_7b095b99.js → index_003befba.js} +1312 -1122
  3. package/dist/{index_9a2fa5ba.js → index_0364269a.js} +3 -3
  4. package/dist/{index_0233ab6e.js → index_0e37f5ff.js} +1 -1
  5. package/dist/{index_e21338b4.js → index_167c5f7a.js} +3 -3
  6. package/dist/{index_f1c394c8.js → index_1990afbf.js} +4 -4
  7. package/dist/{index_343f9468.js → index_29e62962.js} +4 -4
  8. package/dist/{index_cd7b7000.js → index_2cbf1530.js} +6 -6
  9. package/dist/{index_3d7082d3.js → index_310b7772.js} +9 -9
  10. package/dist/{index_fd3a5ec6.js → index_354cce52.js} +3 -3
  11. package/dist/{index_a2c6091a.js → index_37894947.js} +3 -3
  12. package/dist/{index_66933ca6.js → index_3891b298.js} +1 -1
  13. package/dist/{index_bfe24110.js → index_3a6b0cd3.js} +3 -3
  14. package/dist/{index_0e190af0.js → index_4a548214.js} +8 -8
  15. package/dist/{index_8f7f1311.js → index_542dbb9a.js} +4 -4
  16. package/dist/{index_dce9b56f.js → index_547d2868.js} +4 -4
  17. package/dist/{index_8ef2dd82.js → index_61a33920.js} +6 -6
  18. package/dist/{index_be8c55cd.js → index_674ffbfa.js} +9 -9
  19. package/dist/{index_192f4d2e.js → index_6d2a3e5c.js} +2 -6
  20. package/dist/{index_a47b2b71.js → index_7382dec1.js} +5 -5
  21. package/dist/{index_d0632736.js → index_7a1bb0b1.js} +8 -8
  22. package/dist/{index_5eb2fe9f.js → index_7c12bb44.js} +1 -1
  23. package/dist/{index_52e88303.js → index_85b01410.js} +6 -6
  24. package/dist/{index_c964d4f9.js → index_8b9255eb.js} +10 -10
  25. package/dist/{index_8c886fbb.js → index_a4f5a15a.js} +19 -19
  26. package/dist/{index_d910f98e.js → index_a682c1a8.js} +1 -3
  27. package/dist/{index_b9f8fd38.js → index_a6b45215.js} +3 -7
  28. package/dist/{index_af178090.js → index_ae6c3b10.js} +3 -3
  29. package/dist/{index_50faa3fa.js → index_b21f58b7.js} +4 -4
  30. package/dist/{index_66728978.js → index_b3022c1a.js} +5 -5
  31. package/dist/{index_41dc30a7.js → index_bd7e0d56.js} +2 -2
  32. package/dist/{index_394e6e8f.js → index_c8ebd6e3.js} +11 -11
  33. package/dist/{index_a46ee29a.js → index_ca633a1c.js} +7 -7
  34. package/dist/{index_1af9af9e.js → index_d8e757ba.js} +3 -3
  35. package/dist/{index_ada459da.js → index_e168f4c0.js} +7 -7
  36. package/dist/{index_8edb57a9.js → index_e233a036.js} +1 -1
  37. package/dist/{index_98d1dfc6.js → index_e57ba5a5.js} +3 -3
  38. package/dist/{index_05b89cc8.js → index_f19b5fe5.js} +3 -3
  39. package/dist/{index_d7d50cc6.js → index_f3922fc1.js} +3 -3
  40. package/dist/{index_92a17a5e.js → index_f80541a0.js} +25 -38
  41. package/dist/{index_2c508270.js → index_f9d1a3bf.js} +1 -3
  42. package/dist/{index_df76109e.js → index_f9d461d1.js} +3 -3
  43. package/package.json +1 -2
  44. package/src/lib/context/Pioneer/sdk/connect.ts +11 -11
  45. package/dist/index_0a85a2ce.js +0 -25
  46. package/dist/index_10812439.js +0 -25
  47. package/dist/index_1098f328.js +0 -12913
  48. package/dist/index_180735b4.js +0 -22872
  49. package/dist/index_24fdd0ba.js +0 -130
  50. package/dist/index_36ed5d98.js +0 -2856
  51. package/dist/index_3d5897c4.js +0 -1115
  52. package/dist/index_a591ed33.js +0 -446
  53. package/dist/index_ab332746.js +0 -121
  54. package/dist/index_b19211e4.js +0 -112
  55. package/dist/index_b2e7cbe3.js +0 -11003
  56. package/dist/index_ccf11e2f.js +0 -65
  57. package/dist/index_d8a5e2ef.js +0 -116
@@ -1,446 +0,0 @@
1
- import { d as dist, E as EventEmitter$1 } from "./index_180735b4.js";
2
- import { TransportInterfaceNotAvailable as A, DisconnectedDeviceDuringOperation as N, TransportWebUSBGestureRequired as u, TransportOpenUserCancelled as C$1, TransportError as U, TransportStatusError as I, StatusCodes as E, TransportRaceCondition as d$1, DisconnectedDevice as x } from "./index_d8a5e2ef.js";
3
- import { identifyUSBProductId as z$1, ledgerUSBVendorId as k } from "./index_b19211e4.js";
4
- import { d } from "./index_10812439.js";
5
- import "./index_192f4d2e.js";
6
- import "./index_b9f8fd38.js";
7
- import "./index_41dc30a7.js";
8
- import "./index_d7d50cc6.js";
9
- import "./index_0233ab6e.js";
10
- import "./index_2c508270.js";
11
- import "./index_7b095b99.js";
12
- import "./index_d910f98e.js";
13
- import "./index_3d5897c4.js";
14
- import "./index_92a17a5e.js";
15
- import "react";
16
- import "@chakra-ui/react";
17
- import "react-dom";
18
- import "./index_8edb57a9.js";
19
- import "./index_fd3a5ec6.js";
20
- var g = globalThis && globalThis.__awaiter || function(u2, e, n, t) {
21
- function s(o) {
22
- return o instanceof n ? o : new n(function(i) {
23
- i(o);
24
- });
25
- }
26
- return new (n || (n = Promise))(function(o, i) {
27
- function r(c) {
28
- try {
29
- d2(t.next(c));
30
- } catch (f) {
31
- i(f);
32
- }
33
- }
34
- function a(c) {
35
- try {
36
- d2(t.throw(c));
37
- } catch (f) {
38
- i(f);
39
- }
40
- }
41
- function d2(c) {
42
- c.done ? o(c.value) : s(c.value).then(r, a);
43
- }
44
- d2((t = t.apply(u2, e || [])).next());
45
- });
46
- };
47
- class v {
48
- constructor() {
49
- this.exchangeTimeout = 3e4, this.unresponsiveTimeout = 15e3, this.deviceModel = null, this._events = new EventEmitter$1(), this.send = (e, n, t, s, o = dist.Buffer.alloc(0), i = [E.OK]) => g(this, void 0, void 0, function* () {
50
- if (o.length >= 256)
51
- throw new U("data.length exceed 256 bytes limit. Got: " + o.length, "DataLengthTooBig");
52
- const r = yield this.exchange(dist.Buffer.concat([dist.Buffer.from([e, n, t, s]), dist.Buffer.from([o.length]), o])), a = r.readUInt16BE(r.length - 2);
53
- if (!i.some((d2) => d2 === a))
54
- throw new I(a);
55
- return r;
56
- }), this.exchangeAtomicImpl = (e) => g(this, void 0, void 0, function* () {
57
- if (this.exchangeBusyPromise)
58
- throw new d$1("An action was already pending on the Ledger device. Please deny or reconnect.");
59
- let n;
60
- const t = new Promise((i) => {
61
- n = i;
62
- });
63
- this.exchangeBusyPromise = t;
64
- let s = false;
65
- const o = setTimeout(() => {
66
- s = true, this.emit("unresponsive");
67
- }, this.unresponsiveTimeout);
68
- try {
69
- const i = yield e();
70
- return s && this.emit("responsive"), i;
71
- } finally {
72
- clearTimeout(o), n && n(), this.exchangeBusyPromise = null;
73
- }
74
- }), this._appAPIlock = null;
75
- }
76
- /**
77
- * Send data to the device using a low level API.
78
- * It's recommended to use the "send" method for a higher level API.
79
- * @param {Buffer} apdu - The data to send.
80
- * @returns {Promise<Buffer>} A promise that resolves with the response data from the device.
81
- */
82
- exchange(e) {
83
- throw new Error("exchange not implemented");
84
- }
85
- /**
86
- * Send apdus in batch to the device using a low level API.
87
- * The default implementation is to call exchange for each apdu.
88
- * @param {Array<Buffer>} apdus - array of apdus to send.
89
- * @param {Observer<Buffer>} observer - an observer that will receive the response of each apdu.
90
- * @returns {Subscription} A Subscription object on which you can call ".unsubscribe()" to stop sending apdus.
91
- */
92
- exchangeBulk(e, n) {
93
- let t = false;
94
- const s = () => {
95
- t = true;
96
- };
97
- return (() => g(this, void 0, void 0, function* () {
98
- if (!t)
99
- for (const i of e) {
100
- const r = yield this.exchange(i);
101
- if (t)
102
- return;
103
- const a = r.readUInt16BE(r.length - 2);
104
- if (a !== E.OK)
105
- throw new I(a);
106
- n.next(r);
107
- }
108
- }))().then(() => !t && n.complete(), (i) => !t && n.error(i)), { unsubscribe: s };
109
- }
110
- /**
111
- * Set the "scramble key" for the next data exchanges with the device.
112
- * Each app can have a different scramble key and it is set internally during instantiation.
113
- * @param {string} key - The scramble key to set.
114
- * @deprecated This method is no longer needed for modern transports and should be migrated away from.
115
- */
116
- setScrambleKey(e) {
117
- }
118
- /**
119
- * Close the connection with the device.
120
- * @returns {Promise<void>} A promise that resolves when the transport is closed.
121
- */
122
- close() {
123
- return Promise.resolve();
124
- }
125
- /**
126
- * Listen for an event on the transport instance.
127
- * Transport implementations may have specific events. Common events include:
128
- * "disconnect" : triggered when the transport is disconnected.
129
- * @param {string} eventName - The name of the event to listen for.
130
- * @param {(...args: Array<any>) => any} cb - The callback function to be invoked when the event occurs.
131
- */
132
- on(e, n) {
133
- this._events.on(e, n);
134
- }
135
- /**
136
- * Stop listening to an event on an instance of transport.
137
- */
138
- off(e, n) {
139
- this._events.removeListener(e, n);
140
- }
141
- emit(e, ...n) {
142
- this._events.emit(e, ...n);
143
- }
144
- /**
145
- * Enable or not logs of the binary exchange
146
- */
147
- setDebugMode() {
148
- console.warn("setDebugMode is deprecated. use @ledgerhq/logs instead. No logs are emitted in this anymore.");
149
- }
150
- /**
151
- * Set a timeout (in milliseconds) for the exchange call. Only some transport might implement it. (e.g. U2F)
152
- */
153
- setExchangeTimeout(e) {
154
- this.exchangeTimeout = e;
155
- }
156
- /**
157
- * Define the delay before emitting "unresponsive" on an exchange that does not respond
158
- */
159
- setExchangeUnresponsiveTimeout(e) {
160
- this.unresponsiveTimeout = e;
161
- }
162
- /**
163
- * create() allows to open the first descriptor available or
164
- * throw if there is none or if timeout is reached.
165
- * This is a light helper, alternative to using listen() and open() (that you may need for any more advanced usecase)
166
- * @example
167
- TransportFoo.create().then(transport => ...)
168
- */
169
- static create(e = 3e3, n) {
170
- return new Promise((t, s) => {
171
- let o = false;
172
- const i = this.listen({
173
- next: (a) => {
174
- o = true, i && i.unsubscribe(), r && clearTimeout(r), this.open(a.descriptor, e).then(t, s);
175
- },
176
- error: (a) => {
177
- r && clearTimeout(r), s(a);
178
- },
179
- complete: () => {
180
- r && clearTimeout(r), o || s(new U(this.ErrorMessage_NoDeviceFound, "NoDeviceFound"));
181
- }
182
- }), r = n ? setTimeout(() => {
183
- i.unsubscribe(), s(new U(this.ErrorMessage_ListenTimeout, "ListenTimeout"));
184
- }, n) : null;
185
- });
186
- }
187
- decorateAppAPIMethods(e, n, t) {
188
- for (const s of n)
189
- e[s] = this.decorateAppAPIMethod(s, e[s], e, t);
190
- }
191
- decorateAppAPIMethod(e, n, t, s) {
192
- return (...o) => g(this, void 0, void 0, function* () {
193
- const { _appAPIlock: i } = this;
194
- if (i)
195
- return Promise.reject(new U("Ledger Device is busy (lock " + i + ")", "TransportLocked"));
196
- try {
197
- return this._appAPIlock = e, this.setScrambleKey(s), yield n.apply(t, o);
198
- } finally {
199
- this._appAPIlock = null;
200
- }
201
- });
202
- }
203
- }
204
- v.ErrorMessage_ListenTimeout = "No Ledger device found (timeout)";
205
- v.ErrorMessage_NoDeviceFound = "No Ledger device found";
206
- const T = 5;
207
- function R(u2) {
208
- const e = dist.Buffer.alloc(2);
209
- return e.writeUInt16BE(u2, 0), e;
210
- }
211
- const q = {
212
- data: dist.Buffer.alloc(0),
213
- dataLength: 0,
214
- sequence: 0
215
- }, C = (u2, e) => ({
216
- makeBlocks(n) {
217
- let t = dist.Buffer.concat([R(n.length), n]);
218
- const s = e - 5, o = Math.ceil(t.length / s);
219
- t = dist.Buffer.concat([
220
- t,
221
- dist.Buffer.alloc(o * s - t.length + 1).fill(0)
222
- ]);
223
- const i = [];
224
- for (let r = 0; r < o; r++) {
225
- const a = dist.Buffer.alloc(5);
226
- a.writeUInt16BE(u2, 0), a.writeUInt8(T, 2), a.writeUInt16BE(r, 3);
227
- const d2 = t.slice(r * s, (r + 1) * s);
228
- i.push(dist.Buffer.concat([a, d2]));
229
- }
230
- return i;
231
- },
232
- reduceResponse(n, t) {
233
- let { data: s, dataLength: o, sequence: i } = n || q;
234
- if (t.readUInt16BE(0) !== u2)
235
- throw new U("Invalid channel", "InvalidChannel");
236
- if (t.readUInt8(2) !== T)
237
- throw new U("Invalid tag", "InvalidTag");
238
- if (t.readUInt16BE(3) !== i)
239
- throw new U("Invalid sequence", "InvalidSequence");
240
- n || (o = t.readUInt16BE(5)), i++;
241
- const r = t.slice(n ? 5 : 7);
242
- return s = dist.Buffer.concat([s, r]), s.length > o && (s = s.slice(0, o)), {
243
- data: s,
244
- dataLength: o,
245
- sequence: i
246
- };
247
- },
248
- getReducedResult(n) {
249
- if (n && n.dataLength === n.data.length)
250
- return n.data;
251
- }
252
- });
253
- var w = globalThis && globalThis.__awaiter || function(u2, e, n, t) {
254
- function s(o) {
255
- return o instanceof n ? o : new n(function(i) {
256
- i(o);
257
- });
258
- }
259
- return new (n || (n = Promise))(function(o, i) {
260
- function r(c) {
261
- try {
262
- d2(t.next(c));
263
- } catch (f) {
264
- i(f);
265
- }
266
- }
267
- function a(c) {
268
- try {
269
- d2(t.throw(c));
270
- } catch (f) {
271
- i(f);
272
- }
273
- }
274
- function d2(c) {
275
- c.done ? o(c.value) : s(c.value).then(r, a);
276
- }
277
- d2((t = t.apply(u2, e || [])).next());
278
- });
279
- };
280
- const O = [
281
- {
282
- vendorId: k
283
- }
284
- ];
285
- function M() {
286
- return w(this, void 0, void 0, function* () {
287
- return yield navigator.usb.requestDevice({
288
- filters: O
289
- });
290
- });
291
- }
292
- function y() {
293
- return w(this, void 0, void 0, function* () {
294
- return (yield navigator.usb.getDevices()).filter((e) => e.vendorId === k);
295
- });
296
- }
297
- function K() {
298
- return w(this, void 0, void 0, function* () {
299
- const u2 = yield y();
300
- return u2.length > 0 ? u2[0] : M();
301
- });
302
- }
303
- const F = () => Promise.resolve(!!navigator && !!navigator.usb && typeof navigator.usb.getDevices == "function");
304
- var h = globalThis && globalThis.__awaiter || function(u2, e, n, t) {
305
- function s(o) {
306
- return o instanceof n ? o : new n(function(i) {
307
- i(o);
308
- });
309
- }
310
- return new (n || (n = Promise))(function(o, i) {
311
- function r(c) {
312
- try {
313
- d2(t.next(c));
314
- } catch (f) {
315
- i(f);
316
- }
317
- }
318
- function a(c) {
319
- try {
320
- d2(t.throw(c));
321
- } catch (f) {
322
- i(f);
323
- }
324
- }
325
- function d2(c) {
326
- c.done ? o(c.value) : s(c.value).then(r, a);
327
- }
328
- d2((t = t.apply(u2, e || [])).next());
329
- });
330
- };
331
- const z = 1, D = 3;
332
- class p extends v {
333
- constructor(e, n) {
334
- super(), this.channel = Math.floor(Math.random() * 65535), this.packetSize = 64, this._disconnectEmitted = false, this._emitDisconnect = (t) => {
335
- this._disconnectEmitted || (this._disconnectEmitted = true, this.emit("disconnect", t));
336
- }, this.device = e, this.interfaceNumber = n, this.deviceModel = z$1(e.productId);
337
- }
338
- /**
339
- * Similar to create() except it will always display the device permission (even if some devices are already accepted).
340
- */
341
- static request() {
342
- return h(this, void 0, void 0, function* () {
343
- const e = yield M();
344
- return p.open(e);
345
- });
346
- }
347
- /**
348
- * Similar to create() except it will never display the device permission (it returns a Promise<?Transport>, null if it fails to find a device).
349
- */
350
- static openConnected() {
351
- return h(this, void 0, void 0, function* () {
352
- const e = yield y();
353
- return e.length === 0 ? null : p.open(e[0]);
354
- });
355
- }
356
- /**
357
- * Create a Ledger transport with a USBDevice
358
- */
359
- static open(e) {
360
- return h(this, void 0, void 0, function* () {
361
- yield e.open(), e.configuration === null && (yield e.selectConfiguration(z)), yield _(e);
362
- const n = e.configurations[0].interfaces.find(({ alternates: i }) => i.some((r) => r.interfaceClass === 255));
363
- if (!n)
364
- throw new A("No WebUSB interface found for your Ledger device. Please upgrade firmware or contact techsupport.");
365
- const t = n.interfaceNumber;
366
- try {
367
- yield e.claimInterface(t);
368
- } catch (i) {
369
- throw yield e.close(), new A(i.message);
370
- }
371
- const s = new p(e, t), o = (i) => {
372
- e === i.device && (navigator.usb.removeEventListener("disconnect", o), s._emitDisconnect(new x()));
373
- };
374
- return navigator.usb.addEventListener("disconnect", o), s;
375
- });
376
- }
377
- /**
378
- * Release the transport device
379
- */
380
- close() {
381
- return h(this, void 0, void 0, function* () {
382
- yield this.exchangeBusyPromise, yield this.device.releaseInterface(this.interfaceNumber), yield _(this.device), yield this.device.close();
383
- });
384
- }
385
- /**
386
- * Exchange with the device using APDU protocol.
387
- * @param apdu
388
- * @returns a promise of apdu response
389
- */
390
- exchange(e) {
391
- return h(this, void 0, void 0, function* () {
392
- return yield this.exchangeAtomicImpl(() => h(this, void 0, void 0, function* () {
393
- const { channel: t, packetSize: s } = this;
394
- d("apdu", "=> " + e.toString("hex"));
395
- const o = C(t, s), i = o.makeBlocks(e);
396
- for (let d2 = 0; d2 < i.length; d2++)
397
- yield this.device.transferOut(D, i[d2]);
398
- let r, a;
399
- for (; !(r = o.getReducedResult(a)); ) {
400
- const d2 = yield this.device.transferIn(D, s), c = dist.Buffer.from(d2.data.buffer);
401
- a = o.reduceResponse(a, c);
402
- }
403
- return d("apdu", "<= " + r.toString("hex")), r;
404
- })).catch((t) => {
405
- throw t && t.message && t.message.includes("disconnected") ? (this._emitDisconnect(t), new N(t.message)) : t;
406
- });
407
- });
408
- }
409
- setScrambleKey() {
410
- }
411
- }
412
- p.isSupported = F;
413
- p.list = y;
414
- p.listen = (u$1) => {
415
- let e = false;
416
- K().then((t) => {
417
- if (!e) {
418
- const s = z$1(t.productId);
419
- u$1.next({
420
- type: "add",
421
- descriptor: t,
422
- deviceModel: s
423
- }), u$1.complete();
424
- }
425
- }, (t) => {
426
- window.DOMException && t instanceof window.DOMException && t.code === 18 ? u$1.error(new u(t.message)) : u$1.error(new C$1(t.message));
427
- });
428
- function n() {
429
- e = true;
430
- }
431
- return {
432
- unsubscribe: n
433
- };
434
- };
435
- function _(u2) {
436
- return h(this, void 0, void 0, function* () {
437
- try {
438
- yield u2.reset();
439
- } catch (e) {
440
- console.warn(e);
441
- }
442
- });
443
- }
444
- export {
445
- p as default
446
- };
@@ -1,121 +0,0 @@
1
- import { d as dist } from "./index_180735b4.js";
2
- import { s } from "./index_ccf11e2f.js";
3
- import { UserRefusedOnDevice as S$1 } from "./index_d8a5e2ef.js";
4
- import "./index_192f4d2e.js";
5
- import "./index_b9f8fd38.js";
6
- import "./index_41dc30a7.js";
7
- import "./index_d7d50cc6.js";
8
- import "./index_0233ab6e.js";
9
- import "./index_2c508270.js";
10
- import "./index_7b095b99.js";
11
- import "./index_d910f98e.js";
12
- import "./index_92a17a5e.js";
13
- import "react";
14
- import "@chakra-ui/react";
15
- import "react-dom";
16
- import "./index_8edb57a9.js";
17
- import "./index_fd3a5ec6.js";
18
- var P = globalThis && globalThis.__awaiter || function(d, t, n, f) {
19
- function l(e) {
20
- return e instanceof n ? e : new n(function(r) {
21
- r(e);
22
- });
23
- }
24
- return new (n || (n = Promise))(function(e, r) {
25
- function s2(c) {
26
- try {
27
- o(f.next(c));
28
- } catch (a) {
29
- r(a);
30
- }
31
- }
32
- function i(c) {
33
- try {
34
- o(f.throw(c));
35
- } catch (a) {
36
- r(a);
37
- }
38
- }
39
- function o(c) {
40
- c.done ? e(c.value) : l(c.value).then(s2, i);
41
- }
42
- o((f = f.apply(d, t || [])).next());
43
- });
44
- };
45
- const p = 250, h = 85, A = "CSM", E = 0, w = 2, I = 4, S = 0, x = 1, C = 2, _ = 36864, L = 27014;
46
- class M {
47
- constructor(t, n = A) {
48
- this.transport = t, t.decorateAppAPIMethods(this, ["getAddress", "sign", "getAppConfiguration"], n);
49
- }
50
- // FIXME: understand what is going on with the return type here
51
- getAppConfiguration() {
52
- return this.transport.send(h, E, 0, 0).then((t) => ({
53
- test_mode: t[0] !== 0,
54
- version: "" + t[1] + "." + t[2] + "." + t[3],
55
- device_locked: t[4] === 1,
56
- major: t[1]
57
- }));
58
- }
59
- serializePath(t) {
60
- const n = dist.Buffer.alloc(20);
61
- return n.writeUInt32LE((2147483648 | t[0]) >>> 0, 0), n.writeUInt32LE((2147483648 | t[1]) >>> 0, 4), n.writeUInt32LE((2147483648 | t[2]) >>> 0, 8), n.writeUInt32LE(t[3], 12), n.writeUInt32LE(t[4], 16), n;
62
- }
63
- serializeHRP(t) {
64
- if (t == null || t.length === 0 || t.length > 83)
65
- throw new Error("Invalid HRP");
66
- const n = dist.Buffer.alloc(1 + t.length);
67
- return n.writeUInt8(t.length, 0), n.write(t, 1), n;
68
- }
69
- /**
70
- * get Cosmos address for a given BIP 32 path.
71
- * @param path a path in BIP 32 format
72
- * @param hrp usually cosmos
73
- * @option boolDisplay optionally enable or not the display
74
- * @return an object with a publicKey, address and (optionally) chainCode
75
- * @example
76
- * cosmos.getAddress("44'/60'/0'/0/0", "cosmos").then(o => o.address)
77
- */
78
- getAddress(t, n, f) {
79
- const l = s.fromString(t).toPathArray(), e = this.serializePath(l), r = dist.Buffer.concat([this.serializeHRP(n), e]);
80
- return this.transport.send(h, I, f ? 1 : 0, 0, r, [_]).then((s2) => {
81
- const i = dist.Buffer.from(s2.slice(33, -2)).toString(), o = dist.Buffer.from(s2.slice(0, 33)).toString("hex");
82
- return {
83
- address: i,
84
- publicKey: o
85
- };
86
- });
87
- }
88
- foreach(t, n) {
89
- function f(l, e, r) {
90
- return l >= e.length ? r : n(e[l], l).then(function(s2) {
91
- return r.push(s2), f(l + 1, e, r);
92
- });
93
- }
94
- return Promise.resolve().then(() => f(0, t, []));
95
- }
96
- sign(t, n) {
97
- return P(this, void 0, void 0, function* () {
98
- const f = s.fromString(t).toPathArray(), l = this.serializePath(f), e = [];
99
- e.push(l);
100
- const r = dist.Buffer.from(n);
101
- for (let i = 0; i < r.length; i += p) {
102
- let o = i + p;
103
- i > r.length && (o = r.length), e.push(r.slice(i, o));
104
- }
105
- let s$1 = {};
106
- return this.foreach(e, (i, o) => this.transport.send(h, w, o === 0 ? S : o + 1 === e.length ? C : x, 0, i, [_, L]).then((c) => s$1 = c)).then(() => {
107
- const i = s$1.slice(-2), o = i[0] * 256 + i[1];
108
- let c = null;
109
- if (s$1.length > 2 && (c = s$1.slice(0, s$1.length - 2)), o === 27014)
110
- throw new S$1();
111
- return {
112
- signature: c,
113
- return_code: o
114
- };
115
- });
116
- });
117
- }
118
- }
119
- export {
120
- M as default
121
- };
@@ -1,112 +0,0 @@
1
- import { v as vn } from "./index_3d5897c4.js";
2
- import "./index_180735b4.js";
3
- import "./index_192f4d2e.js";
4
- import "./index_b9f8fd38.js";
5
- import "./index_41dc30a7.js";
6
- import "./index_d7d50cc6.js";
7
- import "./index_0233ab6e.js";
8
- import "./index_2c508270.js";
9
- import "./index_7b095b99.js";
10
- import "./index_d910f98e.js";
11
- import "./index_92a17a5e.js";
12
- import "react";
13
- import "@chakra-ui/react";
14
- import "react-dom";
15
- import "./index_8edb57a9.js";
16
- import "./index_fd3a5ec6.js";
17
- var e;
18
- (function(o) {
19
- o.blue = "blue", o.nanoS = "nanoS", o.nanoSP = "nanoSP", o.nanoX = "nanoX", o.stax = "stax";
20
- })(e || (e = {}));
21
- const n = {
22
- [e.blue]: {
23
- id: e.blue,
24
- productName: "Ledger Blue",
25
- productIdMM: 0,
26
- legacyUsbProductId: 0,
27
- usbOnly: true,
28
- memorySize: 480 * 1024,
29
- masks: [822083584, 822149120],
30
- getBlockSize: (o) => 4 * 1024
31
- },
32
- [e.nanoS]: {
33
- id: e.nanoS,
34
- productName: "Ledger Nano S",
35
- productIdMM: 16,
36
- legacyUsbProductId: 1,
37
- usbOnly: true,
38
- memorySize: 320 * 1024,
39
- masks: [823132160],
40
- getBlockSize: (o) => {
41
- var t;
42
- return vn.lt((t = vn.coerce(o)) !== null && t !== void 0 ? t : "", "2.0.0") ? 4 * 1024 : 2 * 1024;
43
- }
44
- },
45
- [e.nanoSP]: {
46
- id: e.nanoSP,
47
- productName: "Ledger Nano S Plus",
48
- productIdMM: 80,
49
- legacyUsbProductId: 5,
50
- usbOnly: true,
51
- memorySize: 1536 * 1024,
52
- masks: [856686592],
53
- getBlockSize: (o) => 32
54
- },
55
- [e.nanoX]: {
56
- id: e.nanoX,
57
- productName: "Ledger Nano X",
58
- productIdMM: 64,
59
- legacyUsbProductId: 4,
60
- usbOnly: false,
61
- memorySize: 2 * 1024 * 1024,
62
- masks: [855638016],
63
- getBlockSize: (o) => 4 * 1024,
64
- bluetoothSpec: [
65
- {
66
- serviceUuid: "13d63400-2c97-0004-0000-4c6564676572",
67
- notifyUuid: "13d63400-2c97-0004-0001-4c6564676572",
68
- writeUuid: "13d63400-2c97-0004-0002-4c6564676572",
69
- writeCmdUuid: "13d63400-2c97-0004-0003-4c6564676572"
70
- }
71
- ]
72
- },
73
- [e.stax]: {
74
- id: e.stax,
75
- productName: "Ledger Stax",
76
- productIdMM: 96,
77
- legacyUsbProductId: 6,
78
- usbOnly: false,
79
- memorySize: 1536 * 1024,
80
- masks: [857735168],
81
- getBlockSize: (o) => 32,
82
- bluetoothSpec: [
83
- {
84
- serviceUuid: "13d63400-2c97-6004-0000-4c6564676572",
85
- notifyUuid: "13d63400-2c97-6004-0001-4c6564676572",
86
- writeUuid: "13d63400-2c97-6004-0002-4c6564676572",
87
- writeCmdUuid: "13d63400-2c97-6004-0003-4c6564676572"
88
- }
89
- ]
90
- }
91
- };
92
- e.blue, e.nanoS, e.nanoSP, e.nanoX, e.stax;
93
- const s = Object.values(n), k = 11415, z = (o) => {
94
- const t = s.find((r) => r.legacyUsbProductId === o);
95
- if (t)
96
- return t;
97
- const c = o >> 8;
98
- return s.find((r) => r.productIdMM === c);
99
- }, u = [], a = {};
100
- for (const o in n) {
101
- const t = n[o], { bluetoothSpec: c } = t;
102
- if (c)
103
- for (let i = 0; i < c.length; i++) {
104
- const r = c[i];
105
- u.push(r.serviceUuid), a[r.serviceUuid] = a[r.serviceUuid.replace(/-/g, "")] = Object.assign({ deviceModel: t }, r);
106
- }
107
- }
108
- export {
109
- e as DeviceModelId,
110
- z as identifyUSBProductId,
111
- k as ledgerUSBVendorId
112
- };