@pollar/react 0.5.2 → 0.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,9 +1,1001 @@
1
1
  'use client';
2
2
  import { AUTH_ERROR_CODES, WalletType, PollarClient } from '@pollar/core';
3
- import { createContext, useState, useEffect, useMemo, useContext, useRef, Component } from 'react';
3
+ import { forwardRef, createContext, useState, useEffect, useRef, useCallback, useMemo, useContext, Component } from 'react';
4
4
  import { jsxs, jsx, Fragment } from 'react/jsx-runtime';
5
5
 
6
- // src/context.tsx
6
+ var __create = Object.create;
7
+ var __defProp = Object.defineProperty;
8
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
9
+ var __getOwnPropNames = Object.getOwnPropertyNames;
10
+ var __getProtoOf = Object.getPrototypeOf;
11
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
12
+ var __commonJS = (cb, mod) => function __require() {
13
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
14
+ };
15
+ var __copyProps = (to, from, except, desc) => {
16
+ if (from && typeof from === "object" || typeof from === "function") {
17
+ for (let key of __getOwnPropNames(from))
18
+ if (!__hasOwnProp.call(to, key) && key !== except)
19
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
20
+ }
21
+ return to;
22
+ };
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
24
+ // If the importer is in node compatibility mode or this is not an ESM
25
+ // file that has been converted to a CommonJS file using a Babel-
26
+ // compatible transform (i.e. "__esModule" has not been set), then set
27
+ // "default" to the CommonJS "module.exports" for node compatibility.
28
+ !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
29
+ mod
30
+ ));
31
+
32
+ // ../../node_modules/qr.js/lib/ErrorCorrectLevel.js
33
+ var require_ErrorCorrectLevel = __commonJS({
34
+ "../../node_modules/qr.js/lib/ErrorCorrectLevel.js"(exports$1, module) {
35
+ module.exports = {
36
+ L: 1,
37
+ M: 0,
38
+ Q: 3,
39
+ H: 2
40
+ };
41
+ }
42
+ });
43
+
44
+ // ../../node_modules/qr.js/lib/mode.js
45
+ var require_mode = __commonJS({
46
+ "../../node_modules/qr.js/lib/mode.js"(exports$1, module) {
47
+ module.exports = {
48
+ MODE_NUMBER: 1 << 0,
49
+ MODE_ALPHA_NUM: 1 << 1,
50
+ MODE_8BIT_BYTE: 1 << 2,
51
+ MODE_KANJI: 1 << 3
52
+ };
53
+ }
54
+ });
55
+
56
+ // ../../node_modules/qr.js/lib/8BitByte.js
57
+ var require_BitByte = __commonJS({
58
+ "../../node_modules/qr.js/lib/8BitByte.js"(exports$1, module) {
59
+ var mode = require_mode();
60
+ function QR8bitByte(data) {
61
+ this.mode = mode.MODE_8BIT_BYTE;
62
+ this.data = data;
63
+ }
64
+ QR8bitByte.prototype = {
65
+ getLength: function(buffer) {
66
+ return this.data.length;
67
+ },
68
+ write: function(buffer) {
69
+ for (var i = 0; i < this.data.length; i++) {
70
+ buffer.put(this.data.charCodeAt(i), 8);
71
+ }
72
+ }
73
+ };
74
+ module.exports = QR8bitByte;
75
+ }
76
+ });
77
+
78
+ // ../../node_modules/qr.js/lib/RSBlock.js
79
+ var require_RSBlock = __commonJS({
80
+ "../../node_modules/qr.js/lib/RSBlock.js"(exports$1, module) {
81
+ var ECL = require_ErrorCorrectLevel();
82
+ function QRRSBlock(totalCount, dataCount) {
83
+ this.totalCount = totalCount;
84
+ this.dataCount = dataCount;
85
+ }
86
+ QRRSBlock.RS_BLOCK_TABLE = [
87
+ // L
88
+ // M
89
+ // Q
90
+ // H
91
+ // 1
92
+ [1, 26, 19],
93
+ [1, 26, 16],
94
+ [1, 26, 13],
95
+ [1, 26, 9],
96
+ // 2
97
+ [1, 44, 34],
98
+ [1, 44, 28],
99
+ [1, 44, 22],
100
+ [1, 44, 16],
101
+ // 3
102
+ [1, 70, 55],
103
+ [1, 70, 44],
104
+ [2, 35, 17],
105
+ [2, 35, 13],
106
+ // 4
107
+ [1, 100, 80],
108
+ [2, 50, 32],
109
+ [2, 50, 24],
110
+ [4, 25, 9],
111
+ // 5
112
+ [1, 134, 108],
113
+ [2, 67, 43],
114
+ [2, 33, 15, 2, 34, 16],
115
+ [2, 33, 11, 2, 34, 12],
116
+ // 6
117
+ [2, 86, 68],
118
+ [4, 43, 27],
119
+ [4, 43, 19],
120
+ [4, 43, 15],
121
+ // 7
122
+ [2, 98, 78],
123
+ [4, 49, 31],
124
+ [2, 32, 14, 4, 33, 15],
125
+ [4, 39, 13, 1, 40, 14],
126
+ // 8
127
+ [2, 121, 97],
128
+ [2, 60, 38, 2, 61, 39],
129
+ [4, 40, 18, 2, 41, 19],
130
+ [4, 40, 14, 2, 41, 15],
131
+ // 9
132
+ [2, 146, 116],
133
+ [3, 58, 36, 2, 59, 37],
134
+ [4, 36, 16, 4, 37, 17],
135
+ [4, 36, 12, 4, 37, 13],
136
+ // 10
137
+ [2, 86, 68, 2, 87, 69],
138
+ [4, 69, 43, 1, 70, 44],
139
+ [6, 43, 19, 2, 44, 20],
140
+ [6, 43, 15, 2, 44, 16],
141
+ // 11
142
+ [4, 101, 81],
143
+ [1, 80, 50, 4, 81, 51],
144
+ [4, 50, 22, 4, 51, 23],
145
+ [3, 36, 12, 8, 37, 13],
146
+ // 12
147
+ [2, 116, 92, 2, 117, 93],
148
+ [6, 58, 36, 2, 59, 37],
149
+ [4, 46, 20, 6, 47, 21],
150
+ [7, 42, 14, 4, 43, 15],
151
+ // 13
152
+ [4, 133, 107],
153
+ [8, 59, 37, 1, 60, 38],
154
+ [8, 44, 20, 4, 45, 21],
155
+ [12, 33, 11, 4, 34, 12],
156
+ // 14
157
+ [3, 145, 115, 1, 146, 116],
158
+ [4, 64, 40, 5, 65, 41],
159
+ [11, 36, 16, 5, 37, 17],
160
+ [11, 36, 12, 5, 37, 13],
161
+ // 15
162
+ [5, 109, 87, 1, 110, 88],
163
+ [5, 65, 41, 5, 66, 42],
164
+ [5, 54, 24, 7, 55, 25],
165
+ [11, 36, 12],
166
+ // 16
167
+ [5, 122, 98, 1, 123, 99],
168
+ [7, 73, 45, 3, 74, 46],
169
+ [15, 43, 19, 2, 44, 20],
170
+ [3, 45, 15, 13, 46, 16],
171
+ // 17
172
+ [1, 135, 107, 5, 136, 108],
173
+ [10, 74, 46, 1, 75, 47],
174
+ [1, 50, 22, 15, 51, 23],
175
+ [2, 42, 14, 17, 43, 15],
176
+ // 18
177
+ [5, 150, 120, 1, 151, 121],
178
+ [9, 69, 43, 4, 70, 44],
179
+ [17, 50, 22, 1, 51, 23],
180
+ [2, 42, 14, 19, 43, 15],
181
+ // 19
182
+ [3, 141, 113, 4, 142, 114],
183
+ [3, 70, 44, 11, 71, 45],
184
+ [17, 47, 21, 4, 48, 22],
185
+ [9, 39, 13, 16, 40, 14],
186
+ // 20
187
+ [3, 135, 107, 5, 136, 108],
188
+ [3, 67, 41, 13, 68, 42],
189
+ [15, 54, 24, 5, 55, 25],
190
+ [15, 43, 15, 10, 44, 16],
191
+ // 21
192
+ [4, 144, 116, 4, 145, 117],
193
+ [17, 68, 42],
194
+ [17, 50, 22, 6, 51, 23],
195
+ [19, 46, 16, 6, 47, 17],
196
+ // 22
197
+ [2, 139, 111, 7, 140, 112],
198
+ [17, 74, 46],
199
+ [7, 54, 24, 16, 55, 25],
200
+ [34, 37, 13],
201
+ // 23
202
+ [4, 151, 121, 5, 152, 122],
203
+ [4, 75, 47, 14, 76, 48],
204
+ [11, 54, 24, 14, 55, 25],
205
+ [16, 45, 15, 14, 46, 16],
206
+ // 24
207
+ [6, 147, 117, 4, 148, 118],
208
+ [6, 73, 45, 14, 74, 46],
209
+ [11, 54, 24, 16, 55, 25],
210
+ [30, 46, 16, 2, 47, 17],
211
+ // 25
212
+ [8, 132, 106, 4, 133, 107],
213
+ [8, 75, 47, 13, 76, 48],
214
+ [7, 54, 24, 22, 55, 25],
215
+ [22, 45, 15, 13, 46, 16],
216
+ // 26
217
+ [10, 142, 114, 2, 143, 115],
218
+ [19, 74, 46, 4, 75, 47],
219
+ [28, 50, 22, 6, 51, 23],
220
+ [33, 46, 16, 4, 47, 17],
221
+ // 27
222
+ [8, 152, 122, 4, 153, 123],
223
+ [22, 73, 45, 3, 74, 46],
224
+ [8, 53, 23, 26, 54, 24],
225
+ [12, 45, 15, 28, 46, 16],
226
+ // 28
227
+ [3, 147, 117, 10, 148, 118],
228
+ [3, 73, 45, 23, 74, 46],
229
+ [4, 54, 24, 31, 55, 25],
230
+ [11, 45, 15, 31, 46, 16],
231
+ // 29
232
+ [7, 146, 116, 7, 147, 117],
233
+ [21, 73, 45, 7, 74, 46],
234
+ [1, 53, 23, 37, 54, 24],
235
+ [19, 45, 15, 26, 46, 16],
236
+ // 30
237
+ [5, 145, 115, 10, 146, 116],
238
+ [19, 75, 47, 10, 76, 48],
239
+ [15, 54, 24, 25, 55, 25],
240
+ [23, 45, 15, 25, 46, 16],
241
+ // 31
242
+ [13, 145, 115, 3, 146, 116],
243
+ [2, 74, 46, 29, 75, 47],
244
+ [42, 54, 24, 1, 55, 25],
245
+ [23, 45, 15, 28, 46, 16],
246
+ // 32
247
+ [17, 145, 115],
248
+ [10, 74, 46, 23, 75, 47],
249
+ [10, 54, 24, 35, 55, 25],
250
+ [19, 45, 15, 35, 46, 16],
251
+ // 33
252
+ [17, 145, 115, 1, 146, 116],
253
+ [14, 74, 46, 21, 75, 47],
254
+ [29, 54, 24, 19, 55, 25],
255
+ [11, 45, 15, 46, 46, 16],
256
+ // 34
257
+ [13, 145, 115, 6, 146, 116],
258
+ [14, 74, 46, 23, 75, 47],
259
+ [44, 54, 24, 7, 55, 25],
260
+ [59, 46, 16, 1, 47, 17],
261
+ // 35
262
+ [12, 151, 121, 7, 152, 122],
263
+ [12, 75, 47, 26, 76, 48],
264
+ [39, 54, 24, 14, 55, 25],
265
+ [22, 45, 15, 41, 46, 16],
266
+ // 36
267
+ [6, 151, 121, 14, 152, 122],
268
+ [6, 75, 47, 34, 76, 48],
269
+ [46, 54, 24, 10, 55, 25],
270
+ [2, 45, 15, 64, 46, 16],
271
+ // 37
272
+ [17, 152, 122, 4, 153, 123],
273
+ [29, 74, 46, 14, 75, 47],
274
+ [49, 54, 24, 10, 55, 25],
275
+ [24, 45, 15, 46, 46, 16],
276
+ // 38
277
+ [4, 152, 122, 18, 153, 123],
278
+ [13, 74, 46, 32, 75, 47],
279
+ [48, 54, 24, 14, 55, 25],
280
+ [42, 45, 15, 32, 46, 16],
281
+ // 39
282
+ [20, 147, 117, 4, 148, 118],
283
+ [40, 75, 47, 7, 76, 48],
284
+ [43, 54, 24, 22, 55, 25],
285
+ [10, 45, 15, 67, 46, 16],
286
+ // 40
287
+ [19, 148, 118, 6, 149, 119],
288
+ [18, 75, 47, 31, 76, 48],
289
+ [34, 54, 24, 34, 55, 25],
290
+ [20, 45, 15, 61, 46, 16]
291
+ ];
292
+ QRRSBlock.getRSBlocks = function(typeNumber, errorCorrectLevel) {
293
+ var rsBlock = QRRSBlock.getRsBlockTable(typeNumber, errorCorrectLevel);
294
+ if (rsBlock == void 0) {
295
+ throw new Error("bad rs block @ typeNumber:" + typeNumber + "/errorCorrectLevel:" + errorCorrectLevel);
296
+ }
297
+ var length = rsBlock.length / 3;
298
+ var list = new Array();
299
+ for (var i = 0; i < length; i++) {
300
+ var count = rsBlock[i * 3 + 0];
301
+ var totalCount = rsBlock[i * 3 + 1];
302
+ var dataCount = rsBlock[i * 3 + 2];
303
+ for (var j = 0; j < count; j++) {
304
+ list.push(new QRRSBlock(totalCount, dataCount));
305
+ }
306
+ }
307
+ return list;
308
+ };
309
+ QRRSBlock.getRsBlockTable = function(typeNumber, errorCorrectLevel) {
310
+ switch (errorCorrectLevel) {
311
+ case ECL.L:
312
+ return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 0];
313
+ case ECL.M:
314
+ return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 1];
315
+ case ECL.Q:
316
+ return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 2];
317
+ case ECL.H:
318
+ return QRRSBlock.RS_BLOCK_TABLE[(typeNumber - 1) * 4 + 3];
319
+ default:
320
+ return void 0;
321
+ }
322
+ };
323
+ module.exports = QRRSBlock;
324
+ }
325
+ });
326
+
327
+ // ../../node_modules/qr.js/lib/BitBuffer.js
328
+ var require_BitBuffer = __commonJS({
329
+ "../../node_modules/qr.js/lib/BitBuffer.js"(exports$1, module) {
330
+ function QRBitBuffer() {
331
+ this.buffer = new Array();
332
+ this.length = 0;
333
+ }
334
+ QRBitBuffer.prototype = {
335
+ get: function(index) {
336
+ var bufIndex = Math.floor(index / 8);
337
+ return (this.buffer[bufIndex] >>> 7 - index % 8 & 1) == 1;
338
+ },
339
+ put: function(num, length) {
340
+ for (var i = 0; i < length; i++) {
341
+ this.putBit((num >>> length - i - 1 & 1) == 1);
342
+ }
343
+ },
344
+ getLengthInBits: function() {
345
+ return this.length;
346
+ },
347
+ putBit: function(bit) {
348
+ var bufIndex = Math.floor(this.length / 8);
349
+ if (this.buffer.length <= bufIndex) {
350
+ this.buffer.push(0);
351
+ }
352
+ if (bit) {
353
+ this.buffer[bufIndex] |= 128 >>> this.length % 8;
354
+ }
355
+ this.length++;
356
+ }
357
+ };
358
+ module.exports = QRBitBuffer;
359
+ }
360
+ });
361
+
362
+ // ../../node_modules/qr.js/lib/math.js
363
+ var require_math = __commonJS({
364
+ "../../node_modules/qr.js/lib/math.js"(exports$1, module) {
365
+ var QRMath = {
366
+ glog: function(n) {
367
+ if (n < 1) {
368
+ throw new Error("glog(" + n + ")");
369
+ }
370
+ return QRMath.LOG_TABLE[n];
371
+ },
372
+ gexp: function(n) {
373
+ while (n < 0) {
374
+ n += 255;
375
+ }
376
+ while (n >= 256) {
377
+ n -= 255;
378
+ }
379
+ return QRMath.EXP_TABLE[n];
380
+ },
381
+ EXP_TABLE: new Array(256),
382
+ LOG_TABLE: new Array(256)
383
+ };
384
+ for (i = 0; i < 8; i++) {
385
+ QRMath.EXP_TABLE[i] = 1 << i;
386
+ }
387
+ var i;
388
+ for (i = 8; i < 256; i++) {
389
+ QRMath.EXP_TABLE[i] = QRMath.EXP_TABLE[i - 4] ^ QRMath.EXP_TABLE[i - 5] ^ QRMath.EXP_TABLE[i - 6] ^ QRMath.EXP_TABLE[i - 8];
390
+ }
391
+ var i;
392
+ for (i = 0; i < 255; i++) {
393
+ QRMath.LOG_TABLE[QRMath.EXP_TABLE[i]] = i;
394
+ }
395
+ var i;
396
+ module.exports = QRMath;
397
+ }
398
+ });
399
+
400
+ // ../../node_modules/qr.js/lib/Polynomial.js
401
+ var require_Polynomial = __commonJS({
402
+ "../../node_modules/qr.js/lib/Polynomial.js"(exports$1, module) {
403
+ var math = require_math();
404
+ function QRPolynomial(num, shift) {
405
+ if (num.length == void 0) {
406
+ throw new Error(num.length + "/" + shift);
407
+ }
408
+ var offset = 0;
409
+ while (offset < num.length && num[offset] == 0) {
410
+ offset++;
411
+ }
412
+ this.num = new Array(num.length - offset + shift);
413
+ for (var i = 0; i < num.length - offset; i++) {
414
+ this.num[i] = num[i + offset];
415
+ }
416
+ }
417
+ QRPolynomial.prototype = {
418
+ get: function(index) {
419
+ return this.num[index];
420
+ },
421
+ getLength: function() {
422
+ return this.num.length;
423
+ },
424
+ multiply: function(e) {
425
+ var num = new Array(this.getLength() + e.getLength() - 1);
426
+ for (var i = 0; i < this.getLength(); i++) {
427
+ for (var j = 0; j < e.getLength(); j++) {
428
+ num[i + j] ^= math.gexp(math.glog(this.get(i)) + math.glog(e.get(j)));
429
+ }
430
+ }
431
+ return new QRPolynomial(num, 0);
432
+ },
433
+ mod: function(e) {
434
+ if (this.getLength() - e.getLength() < 0) {
435
+ return this;
436
+ }
437
+ var ratio = math.glog(this.get(0)) - math.glog(e.get(0));
438
+ var num = new Array(this.getLength());
439
+ for (var i = 0; i < this.getLength(); i++) {
440
+ num[i] = this.get(i);
441
+ }
442
+ for (var i = 0; i < e.getLength(); i++) {
443
+ num[i] ^= math.gexp(math.glog(e.get(i)) + ratio);
444
+ }
445
+ return new QRPolynomial(num, 0).mod(e);
446
+ }
447
+ };
448
+ module.exports = QRPolynomial;
449
+ }
450
+ });
451
+
452
+ // ../../node_modules/qr.js/lib/util.js
453
+ var require_util = __commonJS({
454
+ "../../node_modules/qr.js/lib/util.js"(exports$1, module) {
455
+ var Mode = require_mode();
456
+ var Polynomial = require_Polynomial();
457
+ var math = require_math();
458
+ var QRMaskPattern = {
459
+ PATTERN000: 0,
460
+ PATTERN001: 1,
461
+ PATTERN010: 2,
462
+ PATTERN011: 3,
463
+ PATTERN100: 4,
464
+ PATTERN101: 5,
465
+ PATTERN110: 6,
466
+ PATTERN111: 7
467
+ };
468
+ var QRUtil = {
469
+ PATTERN_POSITION_TABLE: [
470
+ [],
471
+ [6, 18],
472
+ [6, 22],
473
+ [6, 26],
474
+ [6, 30],
475
+ [6, 34],
476
+ [6, 22, 38],
477
+ [6, 24, 42],
478
+ [6, 26, 46],
479
+ [6, 28, 50],
480
+ [6, 30, 54],
481
+ [6, 32, 58],
482
+ [6, 34, 62],
483
+ [6, 26, 46, 66],
484
+ [6, 26, 48, 70],
485
+ [6, 26, 50, 74],
486
+ [6, 30, 54, 78],
487
+ [6, 30, 56, 82],
488
+ [6, 30, 58, 86],
489
+ [6, 34, 62, 90],
490
+ [6, 28, 50, 72, 94],
491
+ [6, 26, 50, 74, 98],
492
+ [6, 30, 54, 78, 102],
493
+ [6, 28, 54, 80, 106],
494
+ [6, 32, 58, 84, 110],
495
+ [6, 30, 58, 86, 114],
496
+ [6, 34, 62, 90, 118],
497
+ [6, 26, 50, 74, 98, 122],
498
+ [6, 30, 54, 78, 102, 126],
499
+ [6, 26, 52, 78, 104, 130],
500
+ [6, 30, 56, 82, 108, 134],
501
+ [6, 34, 60, 86, 112, 138],
502
+ [6, 30, 58, 86, 114, 142],
503
+ [6, 34, 62, 90, 118, 146],
504
+ [6, 30, 54, 78, 102, 126, 150],
505
+ [6, 24, 50, 76, 102, 128, 154],
506
+ [6, 28, 54, 80, 106, 132, 158],
507
+ [6, 32, 58, 84, 110, 136, 162],
508
+ [6, 26, 54, 82, 110, 138, 166],
509
+ [6, 30, 58, 86, 114, 142, 170]
510
+ ],
511
+ G15: 1 << 10 | 1 << 8 | 1 << 5 | 1 << 4 | 1 << 2 | 1 << 1 | 1 << 0,
512
+ G18: 1 << 12 | 1 << 11 | 1 << 10 | 1 << 9 | 1 << 8 | 1 << 5 | 1 << 2 | 1 << 0,
513
+ G15_MASK: 1 << 14 | 1 << 12 | 1 << 10 | 1 << 4 | 1 << 1,
514
+ getBCHTypeInfo: function(data) {
515
+ var d = data << 10;
516
+ while (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G15) >= 0) {
517
+ d ^= QRUtil.G15 << QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G15);
518
+ }
519
+ return (data << 10 | d) ^ QRUtil.G15_MASK;
520
+ },
521
+ getBCHTypeNumber: function(data) {
522
+ var d = data << 12;
523
+ while (QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G18) >= 0) {
524
+ d ^= QRUtil.G18 << QRUtil.getBCHDigit(d) - QRUtil.getBCHDigit(QRUtil.G18);
525
+ }
526
+ return data << 12 | d;
527
+ },
528
+ getBCHDigit: function(data) {
529
+ var digit = 0;
530
+ while (data != 0) {
531
+ digit++;
532
+ data >>>= 1;
533
+ }
534
+ return digit;
535
+ },
536
+ getPatternPosition: function(typeNumber) {
537
+ return QRUtil.PATTERN_POSITION_TABLE[typeNumber - 1];
538
+ },
539
+ getMask: function(maskPattern, i, j) {
540
+ switch (maskPattern) {
541
+ case QRMaskPattern.PATTERN000:
542
+ return (i + j) % 2 == 0;
543
+ case QRMaskPattern.PATTERN001:
544
+ return i % 2 == 0;
545
+ case QRMaskPattern.PATTERN010:
546
+ return j % 3 == 0;
547
+ case QRMaskPattern.PATTERN011:
548
+ return (i + j) % 3 == 0;
549
+ case QRMaskPattern.PATTERN100:
550
+ return (Math.floor(i / 2) + Math.floor(j / 3)) % 2 == 0;
551
+ case QRMaskPattern.PATTERN101:
552
+ return i * j % 2 + i * j % 3 == 0;
553
+ case QRMaskPattern.PATTERN110:
554
+ return (i * j % 2 + i * j % 3) % 2 == 0;
555
+ case QRMaskPattern.PATTERN111:
556
+ return (i * j % 3 + (i + j) % 2) % 2 == 0;
557
+ default:
558
+ throw new Error("bad maskPattern:" + maskPattern);
559
+ }
560
+ },
561
+ getErrorCorrectPolynomial: function(errorCorrectLength) {
562
+ var a = new Polynomial([1], 0);
563
+ for (var i = 0; i < errorCorrectLength; i++) {
564
+ a = a.multiply(new Polynomial([1, math.gexp(i)], 0));
565
+ }
566
+ return a;
567
+ },
568
+ getLengthInBits: function(mode, type) {
569
+ if (1 <= type && type < 10) {
570
+ switch (mode) {
571
+ case Mode.MODE_NUMBER:
572
+ return 10;
573
+ case Mode.MODE_ALPHA_NUM:
574
+ return 9;
575
+ case Mode.MODE_8BIT_BYTE:
576
+ return 8;
577
+ case Mode.MODE_KANJI:
578
+ return 8;
579
+ default:
580
+ throw new Error("mode:" + mode);
581
+ }
582
+ } else if (type < 27) {
583
+ switch (mode) {
584
+ case Mode.MODE_NUMBER:
585
+ return 12;
586
+ case Mode.MODE_ALPHA_NUM:
587
+ return 11;
588
+ case Mode.MODE_8BIT_BYTE:
589
+ return 16;
590
+ case Mode.MODE_KANJI:
591
+ return 10;
592
+ default:
593
+ throw new Error("mode:" + mode);
594
+ }
595
+ } else if (type < 41) {
596
+ switch (mode) {
597
+ case Mode.MODE_NUMBER:
598
+ return 14;
599
+ case Mode.MODE_ALPHA_NUM:
600
+ return 13;
601
+ case Mode.MODE_8BIT_BYTE:
602
+ return 16;
603
+ case Mode.MODE_KANJI:
604
+ return 12;
605
+ default:
606
+ throw new Error("mode:" + mode);
607
+ }
608
+ } else {
609
+ throw new Error("type:" + type);
610
+ }
611
+ },
612
+ getLostPoint: function(qrCode) {
613
+ var moduleCount = qrCode.getModuleCount();
614
+ var lostPoint = 0;
615
+ for (var row = 0; row < moduleCount; row++) {
616
+ for (var col = 0; col < moduleCount; col++) {
617
+ var sameCount = 0;
618
+ var dark = qrCode.isDark(row, col);
619
+ for (var r = -1; r <= 1; r++) {
620
+ if (row + r < 0 || moduleCount <= row + r) {
621
+ continue;
622
+ }
623
+ for (var c = -1; c <= 1; c++) {
624
+ if (col + c < 0 || moduleCount <= col + c) {
625
+ continue;
626
+ }
627
+ if (r == 0 && c == 0) {
628
+ continue;
629
+ }
630
+ if (dark == qrCode.isDark(row + r, col + c)) {
631
+ sameCount++;
632
+ }
633
+ }
634
+ }
635
+ if (sameCount > 5) {
636
+ lostPoint += 3 + sameCount - 5;
637
+ }
638
+ }
639
+ }
640
+ for (var row = 0; row < moduleCount - 1; row++) {
641
+ for (var col = 0; col < moduleCount - 1; col++) {
642
+ var count = 0;
643
+ if (qrCode.isDark(row, col)) count++;
644
+ if (qrCode.isDark(row + 1, col)) count++;
645
+ if (qrCode.isDark(row, col + 1)) count++;
646
+ if (qrCode.isDark(row + 1, col + 1)) count++;
647
+ if (count == 0 || count == 4) {
648
+ lostPoint += 3;
649
+ }
650
+ }
651
+ }
652
+ for (var row = 0; row < moduleCount; row++) {
653
+ for (var col = 0; col < moduleCount - 6; col++) {
654
+ if (qrCode.isDark(row, col) && !qrCode.isDark(row, col + 1) && qrCode.isDark(row, col + 2) && qrCode.isDark(row, col + 3) && qrCode.isDark(row, col + 4) && !qrCode.isDark(row, col + 5) && qrCode.isDark(row, col + 6)) {
655
+ lostPoint += 40;
656
+ }
657
+ }
658
+ }
659
+ for (var col = 0; col < moduleCount; col++) {
660
+ for (var row = 0; row < moduleCount - 6; row++) {
661
+ if (qrCode.isDark(row, col) && !qrCode.isDark(row + 1, col) && qrCode.isDark(row + 2, col) && qrCode.isDark(row + 3, col) && qrCode.isDark(row + 4, col) && !qrCode.isDark(row + 5, col) && qrCode.isDark(row + 6, col)) {
662
+ lostPoint += 40;
663
+ }
664
+ }
665
+ }
666
+ var darkCount = 0;
667
+ for (var col = 0; col < moduleCount; col++) {
668
+ for (var row = 0; row < moduleCount; row++) {
669
+ if (qrCode.isDark(row, col)) {
670
+ darkCount++;
671
+ }
672
+ }
673
+ }
674
+ var ratio = Math.abs(100 * darkCount / moduleCount / moduleCount - 50) / 5;
675
+ lostPoint += ratio * 10;
676
+ return lostPoint;
677
+ }
678
+ };
679
+ module.exports = QRUtil;
680
+ }
681
+ });
682
+
683
+ // ../../node_modules/qr.js/lib/QRCode.js
684
+ var require_QRCode = __commonJS({
685
+ "../../node_modules/qr.js/lib/QRCode.js"(exports$1, module) {
686
+ var BitByte = require_BitByte();
687
+ var RSBlock = require_RSBlock();
688
+ var BitBuffer = require_BitBuffer();
689
+ var util = require_util();
690
+ var Polynomial = require_Polynomial();
691
+ function QRCode3(typeNumber, errorCorrectLevel) {
692
+ this.typeNumber = typeNumber;
693
+ this.errorCorrectLevel = errorCorrectLevel;
694
+ this.modules = null;
695
+ this.moduleCount = 0;
696
+ this.dataCache = null;
697
+ this.dataList = [];
698
+ }
699
+ var proto = QRCode3.prototype;
700
+ proto.addData = function(data) {
701
+ var newData = new BitByte(data);
702
+ this.dataList.push(newData);
703
+ this.dataCache = null;
704
+ };
705
+ proto.isDark = function(row, col) {
706
+ if (row < 0 || this.moduleCount <= row || col < 0 || this.moduleCount <= col) {
707
+ throw new Error(row + "," + col);
708
+ }
709
+ return this.modules[row][col];
710
+ };
711
+ proto.getModuleCount = function() {
712
+ return this.moduleCount;
713
+ };
714
+ proto.make = function() {
715
+ if (this.typeNumber < 1) {
716
+ var typeNumber = 1;
717
+ for (typeNumber = 1; typeNumber < 40; typeNumber++) {
718
+ var rsBlocks = RSBlock.getRSBlocks(typeNumber, this.errorCorrectLevel);
719
+ var buffer = new BitBuffer();
720
+ var totalDataCount = 0;
721
+ for (var i = 0; i < rsBlocks.length; i++) {
722
+ totalDataCount += rsBlocks[i].dataCount;
723
+ }
724
+ for (var i = 0; i < this.dataList.length; i++) {
725
+ var data = this.dataList[i];
726
+ buffer.put(data.mode, 4);
727
+ buffer.put(data.getLength(), util.getLengthInBits(data.mode, typeNumber));
728
+ data.write(buffer);
729
+ }
730
+ if (buffer.getLengthInBits() <= totalDataCount * 8)
731
+ break;
732
+ }
733
+ this.typeNumber = typeNumber;
734
+ }
735
+ this.makeImpl(false, this.getBestMaskPattern());
736
+ };
737
+ proto.makeImpl = function(test, maskPattern) {
738
+ this.moduleCount = this.typeNumber * 4 + 17;
739
+ this.modules = new Array(this.moduleCount);
740
+ for (var row = 0; row < this.moduleCount; row++) {
741
+ this.modules[row] = new Array(this.moduleCount);
742
+ for (var col = 0; col < this.moduleCount; col++) {
743
+ this.modules[row][col] = null;
744
+ }
745
+ }
746
+ this.setupPositionProbePattern(0, 0);
747
+ this.setupPositionProbePattern(this.moduleCount - 7, 0);
748
+ this.setupPositionProbePattern(0, this.moduleCount - 7);
749
+ this.setupPositionAdjustPattern();
750
+ this.setupTimingPattern();
751
+ this.setupTypeInfo(test, maskPattern);
752
+ if (this.typeNumber >= 7) {
753
+ this.setupTypeNumber(test);
754
+ }
755
+ if (this.dataCache == null) {
756
+ this.dataCache = QRCode3.createData(this.typeNumber, this.errorCorrectLevel, this.dataList);
757
+ }
758
+ this.mapData(this.dataCache, maskPattern);
759
+ };
760
+ proto.setupPositionProbePattern = function(row, col) {
761
+ for (var r = -1; r <= 7; r++) {
762
+ if (row + r <= -1 || this.moduleCount <= row + r) continue;
763
+ for (var c = -1; c <= 7; c++) {
764
+ if (col + c <= -1 || this.moduleCount <= col + c) continue;
765
+ if (0 <= r && r <= 6 && (c == 0 || c == 6) || 0 <= c && c <= 6 && (r == 0 || r == 6) || 2 <= r && r <= 4 && 2 <= c && c <= 4) {
766
+ this.modules[row + r][col + c] = true;
767
+ } else {
768
+ this.modules[row + r][col + c] = false;
769
+ }
770
+ }
771
+ }
772
+ };
773
+ proto.getBestMaskPattern = function() {
774
+ var minLostPoint = 0;
775
+ var pattern = 0;
776
+ for (var i = 0; i < 8; i++) {
777
+ this.makeImpl(true, i);
778
+ var lostPoint = util.getLostPoint(this);
779
+ if (i == 0 || minLostPoint > lostPoint) {
780
+ minLostPoint = lostPoint;
781
+ pattern = i;
782
+ }
783
+ }
784
+ return pattern;
785
+ };
786
+ proto.createMovieClip = function(target_mc, instance_name, depth) {
787
+ var qr_mc = target_mc.createEmptyMovieClip(instance_name, depth);
788
+ var cs = 1;
789
+ this.make();
790
+ for (var row = 0; row < this.modules.length; row++) {
791
+ var y = row * cs;
792
+ for (var col = 0; col < this.modules[row].length; col++) {
793
+ var x = col * cs;
794
+ var dark = this.modules[row][col];
795
+ if (dark) {
796
+ qr_mc.beginFill(0, 100);
797
+ qr_mc.moveTo(x, y);
798
+ qr_mc.lineTo(x + cs, y);
799
+ qr_mc.lineTo(x + cs, y + cs);
800
+ qr_mc.lineTo(x, y + cs);
801
+ qr_mc.endFill();
802
+ }
803
+ }
804
+ }
805
+ return qr_mc;
806
+ };
807
+ proto.setupTimingPattern = function() {
808
+ for (var r = 8; r < this.moduleCount - 8; r++) {
809
+ if (this.modules[r][6] != null) {
810
+ continue;
811
+ }
812
+ this.modules[r][6] = r % 2 == 0;
813
+ }
814
+ for (var c = 8; c < this.moduleCount - 8; c++) {
815
+ if (this.modules[6][c] != null) {
816
+ continue;
817
+ }
818
+ this.modules[6][c] = c % 2 == 0;
819
+ }
820
+ };
821
+ proto.setupPositionAdjustPattern = function() {
822
+ var pos = util.getPatternPosition(this.typeNumber);
823
+ for (var i = 0; i < pos.length; i++) {
824
+ for (var j = 0; j < pos.length; j++) {
825
+ var row = pos[i];
826
+ var col = pos[j];
827
+ if (this.modules[row][col] != null) {
828
+ continue;
829
+ }
830
+ for (var r = -2; r <= 2; r++) {
831
+ for (var c = -2; c <= 2; c++) {
832
+ if (r == -2 || r == 2 || c == -2 || c == 2 || r == 0 && c == 0) {
833
+ this.modules[row + r][col + c] = true;
834
+ } else {
835
+ this.modules[row + r][col + c] = false;
836
+ }
837
+ }
838
+ }
839
+ }
840
+ }
841
+ };
842
+ proto.setupTypeNumber = function(test) {
843
+ var bits = util.getBCHTypeNumber(this.typeNumber);
844
+ for (var i = 0; i < 18; i++) {
845
+ var mod = !test && (bits >> i & 1) == 1;
846
+ this.modules[Math.floor(i / 3)][i % 3 + this.moduleCount - 8 - 3] = mod;
847
+ }
848
+ for (var i = 0; i < 18; i++) {
849
+ var mod = !test && (bits >> i & 1) == 1;
850
+ this.modules[i % 3 + this.moduleCount - 8 - 3][Math.floor(i / 3)] = mod;
851
+ }
852
+ };
853
+ proto.setupTypeInfo = function(test, maskPattern) {
854
+ var data = this.errorCorrectLevel << 3 | maskPattern;
855
+ var bits = util.getBCHTypeInfo(data);
856
+ for (var i = 0; i < 15; i++) {
857
+ var mod = !test && (bits >> i & 1) == 1;
858
+ if (i < 6) {
859
+ this.modules[i][8] = mod;
860
+ } else if (i < 8) {
861
+ this.modules[i + 1][8] = mod;
862
+ } else {
863
+ this.modules[this.moduleCount - 15 + i][8] = mod;
864
+ }
865
+ }
866
+ for (var i = 0; i < 15; i++) {
867
+ var mod = !test && (bits >> i & 1) == 1;
868
+ if (i < 8) {
869
+ this.modules[8][this.moduleCount - i - 1] = mod;
870
+ } else if (i < 9) {
871
+ this.modules[8][15 - i - 1 + 1] = mod;
872
+ } else {
873
+ this.modules[8][15 - i - 1] = mod;
874
+ }
875
+ }
876
+ this.modules[this.moduleCount - 8][8] = !test;
877
+ };
878
+ proto.mapData = function(data, maskPattern) {
879
+ var inc = -1;
880
+ var row = this.moduleCount - 1;
881
+ var bitIndex = 7;
882
+ var byteIndex = 0;
883
+ for (var col = this.moduleCount - 1; col > 0; col -= 2) {
884
+ if (col == 6) col--;
885
+ while (true) {
886
+ for (var c = 0; c < 2; c++) {
887
+ if (this.modules[row][col - c] == null) {
888
+ var dark = false;
889
+ if (byteIndex < data.length) {
890
+ dark = (data[byteIndex] >>> bitIndex & 1) == 1;
891
+ }
892
+ var mask = util.getMask(maskPattern, row, col - c);
893
+ if (mask) {
894
+ dark = !dark;
895
+ }
896
+ this.modules[row][col - c] = dark;
897
+ bitIndex--;
898
+ if (bitIndex == -1) {
899
+ byteIndex++;
900
+ bitIndex = 7;
901
+ }
902
+ }
903
+ }
904
+ row += inc;
905
+ if (row < 0 || this.moduleCount <= row) {
906
+ row -= inc;
907
+ inc = -inc;
908
+ break;
909
+ }
910
+ }
911
+ }
912
+ };
913
+ QRCode3.PAD0 = 236;
914
+ QRCode3.PAD1 = 17;
915
+ QRCode3.createData = function(typeNumber, errorCorrectLevel, dataList) {
916
+ var rsBlocks = RSBlock.getRSBlocks(typeNumber, errorCorrectLevel);
917
+ var buffer = new BitBuffer();
918
+ for (var i = 0; i < dataList.length; i++) {
919
+ var data = dataList[i];
920
+ buffer.put(data.mode, 4);
921
+ buffer.put(data.getLength(), util.getLengthInBits(data.mode, typeNumber));
922
+ data.write(buffer);
923
+ }
924
+ var totalDataCount = 0;
925
+ for (var i = 0; i < rsBlocks.length; i++) {
926
+ totalDataCount += rsBlocks[i].dataCount;
927
+ }
928
+ if (buffer.getLengthInBits() > totalDataCount * 8) {
929
+ throw new Error("code length overflow. (" + buffer.getLengthInBits() + ">" + totalDataCount * 8 + ")");
930
+ }
931
+ if (buffer.getLengthInBits() + 4 <= totalDataCount * 8) {
932
+ buffer.put(0, 4);
933
+ }
934
+ while (buffer.getLengthInBits() % 8 != 0) {
935
+ buffer.putBit(false);
936
+ }
937
+ while (true) {
938
+ if (buffer.getLengthInBits() >= totalDataCount * 8) {
939
+ break;
940
+ }
941
+ buffer.put(QRCode3.PAD0, 8);
942
+ if (buffer.getLengthInBits() >= totalDataCount * 8) {
943
+ break;
944
+ }
945
+ buffer.put(QRCode3.PAD1, 8);
946
+ }
947
+ return QRCode3.createBytes(buffer, rsBlocks);
948
+ };
949
+ QRCode3.createBytes = function(buffer, rsBlocks) {
950
+ var offset = 0;
951
+ var maxDcCount = 0;
952
+ var maxEcCount = 0;
953
+ var dcdata = new Array(rsBlocks.length);
954
+ var ecdata = new Array(rsBlocks.length);
955
+ for (var r = 0; r < rsBlocks.length; r++) {
956
+ var dcCount = rsBlocks[r].dataCount;
957
+ var ecCount = rsBlocks[r].totalCount - dcCount;
958
+ maxDcCount = Math.max(maxDcCount, dcCount);
959
+ maxEcCount = Math.max(maxEcCount, ecCount);
960
+ dcdata[r] = new Array(dcCount);
961
+ for (var i = 0; i < dcdata[r].length; i++) {
962
+ dcdata[r][i] = 255 & buffer.buffer[i + offset];
963
+ }
964
+ offset += dcCount;
965
+ var rsPoly = util.getErrorCorrectPolynomial(ecCount);
966
+ var rawPoly = new Polynomial(dcdata[r], rsPoly.getLength() - 1);
967
+ var modPoly = rawPoly.mod(rsPoly);
968
+ ecdata[r] = new Array(rsPoly.getLength() - 1);
969
+ for (var i = 0; i < ecdata[r].length; i++) {
970
+ var modIndex = i + modPoly.getLength() - ecdata[r].length;
971
+ ecdata[r][i] = modIndex >= 0 ? modPoly.get(modIndex) : 0;
972
+ }
973
+ }
974
+ var totalCodeCount = 0;
975
+ for (var i = 0; i < rsBlocks.length; i++) {
976
+ totalCodeCount += rsBlocks[i].totalCount;
977
+ }
978
+ var data = new Array(totalCodeCount);
979
+ var index = 0;
980
+ for (var i = 0; i < maxDcCount; i++) {
981
+ for (var r = 0; r < rsBlocks.length; r++) {
982
+ if (i < dcdata[r].length) {
983
+ data[index++] = dcdata[r][i];
984
+ }
985
+ }
986
+ }
987
+ for (var i = 0; i < maxEcCount; i++) {
988
+ for (var r = 0; r < rsBlocks.length; r++) {
989
+ if (i < ecdata[r].length) {
990
+ data[index++] = ecdata[r][i];
991
+ }
992
+ }
993
+ }
994
+ return data;
995
+ };
996
+ module.exports = QRCode3;
997
+ }
998
+ });
7
999
 
8
1000
  // src/constants.ts
9
1001
  var LOGO_POLLAR = "https://pollar.xyz/assets/logo_pollar.png";
@@ -36,7 +1028,7 @@ var PollarModalFooter = () => {
36
1028
  /* @__PURE__ */ jsx("span", { className: "pollar-footer-name", children: "Pollar" }),
37
1029
  /* @__PURE__ */ jsxs("span", { className: "pollar-footer-version", children: [
38
1030
  "v",
39
- "0.5.2"
1031
+ "0.6.0"
40
1032
  ] })
41
1033
  ] })
42
1034
  ] });
@@ -96,15 +1088,25 @@ function KycModalTemplate({
96
1088
  const isDark = theme === "dark";
97
1089
  const cssVars = {
98
1090
  "--pollar-accent": accentColor,
99
- "--pollar-buttons-border-radius": "6px",
100
- "--pollar-buttons-height": "44px",
101
1091
  "--pollar-bg": isDark ? "#1a1a1a" : "#ffffff",
102
1092
  "--pollar-border": isDark ? "#374151" : "#e5e7eb",
103
1093
  "--pollar-text": isDark ? "#ffffff" : "#111827",
104
1094
  "--pollar-muted": isDark ? "#9ca3af" : "#6b7280",
105
- "--pollar-input-bg": isDark ? "#374151" : "#f9fafb"
1095
+ "--pollar-input-bg": isDark ? "#374151" : "#f9fafb",
1096
+ "--pollar-error-bg": isDark ? "#2a1515" : "#fef2f2",
1097
+ "--pollar-error-border": isDark ? "#7f1d1d" : "#fecaca",
1098
+ "--pollar-error-text": isDark ? "#f87171" : "#dc2626",
1099
+ "--pollar-success-text": isDark ? "#4ade80" : "#16a34a",
1100
+ "--pollar-buttons-border-radius": "6px",
1101
+ "--pollar-buttons-height": "44px",
1102
+ "--pollar-input-height": "44px",
1103
+ "--pollar-input-border-radius": "0.5rem",
1104
+ "--pollar-card-border-radius": "10px",
1105
+ "--pollar-modal-padding": "2rem",
1106
+ "--pollar-modal-heading-size": "1.375rem",
1107
+ "--pollar-modal-subtitle-size": "0.9rem"
106
1108
  };
107
- return /* @__PURE__ */ jsxs("div", { className: "pollar-kyc-modal", style: cssVars, onClick: (e) => e.stopPropagation(), children: [
1109
+ return /* @__PURE__ */ jsxs("div", { className: "pollar-modal-card pollar-kyc-modal", style: cssVars, onClick: (e) => e.stopPropagation(), children: [
108
1110
  /* @__PURE__ */ jsxs("div", { className: "pollar-kyc-header", children: [
109
1111
  /* @__PURE__ */ jsx("h2", { className: "pollar-kyc-title", children: "Identity verification" }),
110
1112
  /* @__PURE__ */ jsxs("p", { className: "pollar-kyc-subtitle", children: [
@@ -159,8 +1161,8 @@ function KycModal({ onClose, country = "MX", level = "basic", onApproved }) {
159
1161
  const { theme = "light", accentColor = "#005DB4" } = styles;
160
1162
  useEffect(() => {
161
1163
  setIsLoading(true);
162
- client.getKycProviders(country).then((result) => setProviders(result.providers)).catch(() => setProviders([])).finally(() => setIsLoading(false));
163
- }, [country]);
1164
+ getClient().getKycProviders(country).then((result) => setProviders(result.providers)).catch(() => setProviders([])).finally(() => setIsLoading(false));
1165
+ }, [getClient, country]);
164
1166
  async function handleSelectProvider(provider) {
165
1167
  setSelectedProvider(provider);
166
1168
  setIsLoading(true);
@@ -374,16 +1376,23 @@ function LoginModalTemplate({
374
1376
  const enabledSocial = Object.entries(providers).filter(([, enabled]) => enabled);
375
1377
  const cssVars = {
376
1378
  "--pollar-accent": accentColor,
377
- "--pollar-buttons-border-radius": "6px",
378
- "--pollar-buttons-height": "44px",
379
1379
  "--pollar-bg": isDark ? "#1a1a1a" : "#ffffff",
380
1380
  "--pollar-border": isDark ? "#374151" : "#e5e7eb",
381
1381
  "--pollar-text": isDark ? "#ffffff" : "#111827",
382
1382
  "--pollar-muted": isDark ? "#9ca3af" : "#6b7280",
383
- "--pollar-input-bg": isDark ? "#374151" : "#ffffff",
1383
+ "--pollar-input-bg": isDark ? "#374151" : "#f9fafb",
384
1384
  "--pollar-error-bg": isDark ? "#2a1515" : "#fef2f2",
385
1385
  "--pollar-error-border": isDark ? "#7f1d1d" : "#fecaca",
386
- "--pollar-error-text": isDark ? "#f87171" : "#dc2626"
1386
+ "--pollar-error-text": isDark ? "#f87171" : "#dc2626",
1387
+ "--pollar-success-text": isDark ? "#4ade80" : "#16a34a",
1388
+ "--pollar-buttons-border-radius": "6px",
1389
+ "--pollar-buttons-height": "44px",
1390
+ "--pollar-input-height": "44px",
1391
+ "--pollar-input-border-radius": "0.5rem",
1392
+ "--pollar-card-border-radius": "10px",
1393
+ "--pollar-modal-padding": "2rem",
1394
+ "--pollar-modal-heading-size": "1.375rem",
1395
+ "--pollar-modal-subtitle-size": "0.9rem"
387
1396
  };
388
1397
  const status = authStateToStatus(authState.step);
389
1398
  const isLoading = status === "LOADING";
@@ -391,7 +1400,7 @@ function LoginModalTemplate({
391
1400
  const awaitingEmailCode = authState.step === "entering_code" || authState.step === "verifying_email_code" || isEmailCodeError;
392
1401
  const statusMessage = authState.step === "error" ? authState.message : AUTH_STATE_MESSAGES[authState.step];
393
1402
  const BackButton = ({ onClick }) => /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-back-btn", onClick, "aria-label": "Back", children: /* @__PURE__ */ jsx("svg", { width: "20", height: "20", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx("path", { d: "M15 19l-7-7 7-7" }) }) });
394
- return /* @__PURE__ */ jsxs("div", { className: "pollar-modal", style: cssVars, onClick: (e) => e.stopPropagation(), children: [
1403
+ return /* @__PURE__ */ jsxs("div", { className: "pollar-modal-card pollar-modal", style: cssVars, onClick: (e) => e.stopPropagation(), children: [
395
1404
  /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-close-btn", onClick: onCancel, "aria-label": "Close", children: /* @__PURE__ */ jsx("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.5", strokeLinecap: "round", strokeLinejoin: "round", children: /* @__PURE__ */ jsx("path", { d: "M18 6L6 18M6 6l12 12" }) }) }),
396
1405
  /* @__PURE__ */ jsxs("div", { className: "pollar-header", children: [
397
1406
  /* @__PURE__ */ jsx("div", { className: "pollar-logo-wrap", children: /* @__PURE__ */ jsx("img", { src: logoUrl ?? LOGO_POLLAR, alt: "Logo", className: "pollar-logo" }) }),
@@ -446,7 +1455,7 @@ function LoginModalTemplate({
446
1455
  onKeyDown: (e) => e.key === "Enter" && onEmailSubmit?.()
447
1456
  }
448
1457
  ),
449
- /* @__PURE__ */ jsx("button", { type: "button", disabled: isLoading || !email, className: "pollar-submit-btn", onClick: onEmailSubmit, children: "Submit" })
1458
+ /* @__PURE__ */ jsx("button", { type: "button", disabled: isLoading || !email, className: "pollar-btn-primary", style: { marginTop: "0.75rem", width: "100%" }, onClick: onEmailSubmit, children: "Submit" })
450
1459
  ] }),
451
1460
  emailEnabled && enabledSocial.length > 0 && /* @__PURE__ */ jsxs("div", { className: "pollar-divider", children: [
452
1461
  /* @__PURE__ */ jsx("div", { className: "pollar-divider-line" }),
@@ -484,10 +1493,12 @@ function LoginModalTemplate({
484
1493
  }
485
1494
  function LoginModal({ onClose }) {
486
1495
  const [email, setEmail] = useState("");
487
- const { getClient, styles, config } = usePollar();
1496
+ const { getClient, styles, appConfig: config } = usePollar();
488
1497
  const [authState, setAuthState] = useState(() => getClient().getAuthState());
489
1498
  const [codeInputKey, setCodeInputKey] = useState(0);
490
1499
  const pendingEmail = useRef(null);
1500
+ const onCloseRef = useRef(onClose);
1501
+ onCloseRef.current = onClose;
491
1502
  useEffect(() => {
492
1503
  return getClient().onAuthStateChange((next) => {
493
1504
  setAuthState(next);
@@ -499,10 +1510,10 @@ function LoginModal({ onClose }) {
499
1510
  setCodeInputKey((k) => k + 1);
500
1511
  }
501
1512
  if (next.step === "authenticated") {
502
- setTimeout(onClose, 1e3);
1513
+ setTimeout(onCloseRef.current, 1e3);
503
1514
  }
504
1515
  });
505
- }, []);
1516
+ }, [getClient]);
506
1517
  const { theme = "light", accentColor = "#005DB4", logoUrl, emailEnabled, embeddedWallets, providers } = styles;
507
1518
  function handleClose() {
508
1519
  setEmail("");
@@ -564,67 +1575,227 @@ function LoginModal({ onClose }) {
564
1575
  }
565
1576
  ) });
566
1577
  }
567
- var RAIL_LABELS = {
568
- SPEI: "SPEI (Mexico)",
569
- PIX: "PIX (Brazil)",
570
- PSE: "PSE (Colombia)",
571
- ACH: "ACH (US)"
572
- };
573
- function RouteDisplay({ quote, onSelect }) {
574
- return /* @__PURE__ */ jsxs(
575
- "div",
1578
+
1579
+ // src/lib/qr-code/index.tsx
1580
+ var import_ErrorCorrectLevel = __toESM(require_ErrorCorrectLevel());
1581
+ var import_QRCode = __toESM(require_QRCode());
1582
+ var QRCodeSvg = forwardRef(function QRCodeSvg2({
1583
+ bgColor,
1584
+ bgD,
1585
+ fgD,
1586
+ fgColor,
1587
+ size,
1588
+ title,
1589
+ viewBoxSize,
1590
+ xmlns = "http://www.w3.org/2000/svg",
1591
+ ...props
1592
+ }, ref) {
1593
+ return /* @__PURE__ */ jsxs("svg", { ...props, height: size, ref, viewBox: `0 0 ${viewBoxSize} ${viewBoxSize}`, width: size, xmlns, children: [
1594
+ title ? /* @__PURE__ */ jsx("title", { children: title }) : null,
1595
+ /* @__PURE__ */ jsx("path", { d: bgD, fill: bgColor }),
1596
+ /* @__PURE__ */ jsx("path", { d: fgD, fill: fgColor })
1597
+ ] });
1598
+ });
1599
+ QRCodeSvg.displayName = "QRCodeSvg";
1600
+ function bytesToBinaryString(bytes) {
1601
+ return bytes.map((b) => String.fromCharCode(b & 255)).join("");
1602
+ }
1603
+ function encodeStringToUtf8Bytes(input) {
1604
+ return Array.from(new TextEncoder().encode(input));
1605
+ }
1606
+ var QRCode = forwardRef(function QRCode2({ bgColor = "#FFFFFF", fgColor = "#000000", level = "L", size = 256, value, ...props }, ref) {
1607
+ const qrcode = new import_QRCode.default(-1, import_ErrorCorrectLevel.default[level]);
1608
+ const utf8Bytes = encodeStringToUtf8Bytes(value);
1609
+ const binaryString = bytesToBinaryString(utf8Bytes);
1610
+ qrcode.addData(binaryString, "Byte");
1611
+ qrcode.make();
1612
+ const cells = qrcode.modules;
1613
+ return /* @__PURE__ */ jsx(
1614
+ QRCodeSvg,
576
1615
  {
577
- className: "pollar-ramp-route-card",
578
- "data-recommended": quote.recommended,
579
- role: "button",
580
- tabIndex: 0,
581
- onClick: () => onSelect(quote),
582
- onKeyDown: (e) => e.key === "Enter" && onSelect(quote),
583
- children: [
584
- /* @__PURE__ */ jsxs("div", { className: "pollar-ramp-route-left", children: [
585
- /* @__PURE__ */ jsx("span", { className: "pollar-ramp-route-provider", children: quote.provider }),
586
- /* @__PURE__ */ jsxs("span", { className: "pollar-ramp-route-meta", children: [
587
- RAIL_LABELS[quote.rail] ?? quote.rail,
588
- " \xB7 ",
589
- quote.protocol,
590
- " \xB7 ",
591
- quote.estimatedTime
592
- ] })
593
- ] }),
594
- /* @__PURE__ */ jsxs("div", { className: "pollar-ramp-route-right", children: [
595
- /* @__PURE__ */ jsxs("span", { className: "pollar-ramp-route-fee", children: [
596
- quote.fee,
597
- "% fee"
598
- ] }),
599
- quote.recommended && /* @__PURE__ */ jsx("span", { className: "pollar-ramp-route-badge", children: "Best rate" })
600
- ] })
601
- ]
1616
+ ...props,
1617
+ bgColor,
1618
+ bgD: cells.map((row, rowIndex) => row.map((cell, cellIndex) => !cell ? `M ${cellIndex} ${rowIndex} l 1 0 0 1 -1 0 Z` : "").join(" ")).join(" "),
1619
+ fgColor,
1620
+ fgD: cells.map((row, rowIndex) => row.map((cell, cellIndex) => cell ? `M ${cellIndex} ${rowIndex} l 1 0 0 1 -1 0 Z` : "").join(" ")).join(" "),
1621
+ ref,
1622
+ size,
1623
+ viewBoxSize: cells.length
602
1624
  }
603
1625
  );
604
- }
605
- var LOADING_STEPS = ["Detecting your country\u2026", "Consulting providers\u2026", "Route found!"];
606
- var COUNTRY_CURRENCIES = {
607
- MX: "MXN",
608
- BR: "BRL",
609
- CO: "COP",
610
- CL: "CLP",
611
- PE: "PEN",
612
- AR: "ARS"
613
- };
614
- function RampWidgetTemplate({
1626
+ });
1627
+ function ReceiveModalTemplate({
615
1628
  theme,
616
1629
  accentColor,
617
- step,
618
- direction,
619
- amount,
620
- currency,
621
- country,
622
- quotes,
623
- paymentInstructions,
624
- isLoading,
625
- onDirectionChange,
626
- onAmountChange,
627
- onCurrencyChange,
1630
+ walletAddress,
1631
+ copied,
1632
+ onCopy,
1633
+ onClose
1634
+ }) {
1635
+ const isDark = theme === "dark";
1636
+ const cssVars = {
1637
+ "--pollar-accent": accentColor,
1638
+ "--pollar-bg": isDark ? "#1a1a1a" : "#ffffff",
1639
+ "--pollar-border": isDark ? "#374151" : "#e5e7eb",
1640
+ "--pollar-text": isDark ? "#ffffff" : "#111827",
1641
+ "--pollar-muted": isDark ? "#9ca3af" : "#6b7280",
1642
+ "--pollar-input-bg": isDark ? "#374151" : "#f9fafb",
1643
+ "--pollar-error-bg": isDark ? "#2a1515" : "#fef2f2",
1644
+ "--pollar-error-border": isDark ? "#7f1d1d" : "#fecaca",
1645
+ "--pollar-error-text": isDark ? "#f87171" : "#dc2626",
1646
+ "--pollar-success-text": isDark ? "#4ade80" : "#16a34a",
1647
+ "--pollar-buttons-border-radius": "6px",
1648
+ "--pollar-buttons-height": "44px",
1649
+ "--pollar-input-height": "44px",
1650
+ "--pollar-input-border-radius": "0.5rem",
1651
+ "--pollar-card-border-radius": "10px"
1652
+ };
1653
+ return /* @__PURE__ */ jsxs(
1654
+ "div",
1655
+ {
1656
+ className: "pollar-modal-card pollar-receive-modal",
1657
+ "data-theme": theme,
1658
+ style: cssVars,
1659
+ onClick: (e) => e.stopPropagation(),
1660
+ children: [
1661
+ /* @__PURE__ */ jsxs("div", { className: "pollar-modal-header", children: [
1662
+ /* @__PURE__ */ jsx("h2", { className: "pollar-modal-title", children: "Receive" }),
1663
+ /* @__PURE__ */ jsx("div", { className: "pollar-modal-header-actions", children: /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-modal-close", onClick: onClose, "aria-label": "Close", children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M2 2l12 12M14 2L2 14", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }) }) })
1664
+ ] }),
1665
+ walletAddress ? /* @__PURE__ */ jsxs(Fragment, { children: [
1666
+ /* @__PURE__ */ jsx("div", { className: "pollar-receive-qr", children: /* @__PURE__ */ jsx(
1667
+ QRCode,
1668
+ {
1669
+ value: walletAddress,
1670
+ size: 180,
1671
+ fgColor: isDark ? "#ffffff" : "#111827",
1672
+ bgColor: "transparent"
1673
+ }
1674
+ ) }),
1675
+ /* @__PURE__ */ jsx("p", { className: "pollar-receive-instructions", children: "Share your Stellar address to receive any asset. Only send Stellar assets to this address." }),
1676
+ /* @__PURE__ */ jsxs("div", { className: "pollar-receive-address-row", children: [
1677
+ /* @__PURE__ */ jsx("span", { className: "pollar-receive-address", children: walletAddress }),
1678
+ /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-receive-copy-btn", onClick: onCopy, "aria-label": "Copy address", children: copied ? /* @__PURE__ */ jsxs(Fragment, { children: [
1679
+ /* @__PURE__ */ jsxs("svg", { width: "13", height: "13", viewBox: "0 0 14 14", fill: "none", "aria-hidden": true, children: [
1680
+ /* @__PURE__ */ jsx("circle", { cx: "7", cy: "7", r: "7", fill: "currentColor" }),
1681
+ /* @__PURE__ */ jsx(
1682
+ "path",
1683
+ {
1684
+ d: "M3.5 7l2.5 2.5 4.5-5",
1685
+ stroke: "white",
1686
+ strokeWidth: "1.5",
1687
+ strokeLinecap: "round",
1688
+ strokeLinejoin: "round"
1689
+ }
1690
+ )
1691
+ ] }),
1692
+ "Copied!"
1693
+ ] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
1694
+ /* @__PURE__ */ jsxs("svg", { width: "13", height: "13", viewBox: "0 0 13 13", fill: "none", "aria-hidden": true, children: [
1695
+ /* @__PURE__ */ jsx("rect", { x: "4", y: "4", width: "8", height: "8", rx: "1.5", stroke: "currentColor", strokeWidth: "1.5" }),
1696
+ /* @__PURE__ */ jsx(
1697
+ "path",
1698
+ {
1699
+ d: "M3 9H2a1 1 0 01-1-1V2a1 1 0 011-1h6a1 1 0 011 1v1",
1700
+ stroke: "currentColor",
1701
+ strokeWidth: "1.5",
1702
+ strokeLinecap: "round"
1703
+ }
1704
+ )
1705
+ ] }),
1706
+ "Copy address"
1707
+ ] }) })
1708
+ ] })
1709
+ ] }) : /* @__PURE__ */ jsx("div", { className: "pollar-modal-empty", children: "No wallet connected." }),
1710
+ /* @__PURE__ */ jsx(PollarModalFooter, {})
1711
+ ]
1712
+ }
1713
+ );
1714
+ }
1715
+ function ReceiveModal({ onClose }) {
1716
+ const { walletAddress, styles } = usePollar();
1717
+ const { theme = "light", accentColor = "#005DB4" } = styles;
1718
+ const [copied, setCopied] = useState(false);
1719
+ function handleCopy() {
1720
+ if (!walletAddress) return;
1721
+ navigator.clipboard.writeText(walletAddress).then(() => {
1722
+ setCopied(true);
1723
+ setTimeout(() => setCopied(false), 2e3);
1724
+ });
1725
+ }
1726
+ return /* @__PURE__ */ jsx("div", { className: "pollar-overlay", onClick: onClose, children: /* @__PURE__ */ jsx(
1727
+ ReceiveModalTemplate,
1728
+ {
1729
+ theme,
1730
+ accentColor,
1731
+ walletAddress,
1732
+ copied,
1733
+ onCopy: handleCopy,
1734
+ onClose
1735
+ }
1736
+ ) });
1737
+ }
1738
+ var RAIL_LABELS = {
1739
+ SPEI: "SPEI (Mexico)",
1740
+ PIX: "PIX (Brazil)",
1741
+ PSE: "PSE (Colombia)",
1742
+ ACH: "ACH (US)"
1743
+ };
1744
+ function RouteDisplay({ quote, onSelect }) {
1745
+ return /* @__PURE__ */ jsxs(
1746
+ "div",
1747
+ {
1748
+ className: "pollar-ramp-route-card",
1749
+ "data-recommended": quote.recommended,
1750
+ role: "button",
1751
+ tabIndex: 0,
1752
+ onClick: () => onSelect(quote),
1753
+ onKeyDown: (e) => e.key === "Enter" && onSelect(quote),
1754
+ children: [
1755
+ /* @__PURE__ */ jsxs("div", { className: "pollar-ramp-route-left", children: [
1756
+ /* @__PURE__ */ jsx("span", { className: "pollar-ramp-route-provider", children: quote.provider }),
1757
+ /* @__PURE__ */ jsxs("span", { className: "pollar-ramp-route-meta", children: [
1758
+ RAIL_LABELS[quote.rail] ?? quote.rail,
1759
+ " \xB7 ",
1760
+ quote.protocol,
1761
+ " \xB7 ",
1762
+ quote.estimatedTime
1763
+ ] })
1764
+ ] }),
1765
+ /* @__PURE__ */ jsxs("div", { className: "pollar-ramp-route-right", children: [
1766
+ /* @__PURE__ */ jsxs("span", { className: "pollar-ramp-route-fee", children: [
1767
+ quote.fee,
1768
+ "% fee"
1769
+ ] }),
1770
+ quote.recommended && /* @__PURE__ */ jsx("span", { className: "pollar-ramp-route-badge", children: "Best rate" })
1771
+ ] })
1772
+ ]
1773
+ }
1774
+ );
1775
+ }
1776
+ var LOADING_STEPS = ["Detecting your country\u2026", "Consulting providers\u2026", "Route found!"];
1777
+ var COUNTRY_CURRENCIES = {
1778
+ MX: "MXN",
1779
+ BR: "BRL",
1780
+ CO: "COP",
1781
+ CL: "CLP",
1782
+ PE: "PEN",
1783
+ AR: "ARS"
1784
+ };
1785
+ function RampWidgetTemplate({
1786
+ theme,
1787
+ accentColor,
1788
+ step,
1789
+ direction,
1790
+ amount,
1791
+ currency,
1792
+ country,
1793
+ quotes,
1794
+ paymentInstructions,
1795
+ isLoading,
1796
+ onDirectionChange,
1797
+ onAmountChange,
1798
+ onCurrencyChange,
628
1799
  onCountryChange,
629
1800
  onFindRoute,
630
1801
  onSelectQuote,
@@ -634,13 +1805,23 @@ function RampWidgetTemplate({
634
1805
  const isDark = theme === "dark";
635
1806
  const cssVars = {
636
1807
  "--pollar-accent": accentColor,
637
- "--pollar-buttons-border-radius": "6px",
638
- "--pollar-buttons-height": "44px",
639
1808
  "--pollar-bg": isDark ? "#1a1a1a" : "#ffffff",
640
1809
  "--pollar-border": isDark ? "#374151" : "#e5e7eb",
641
1810
  "--pollar-text": isDark ? "#ffffff" : "#111827",
642
1811
  "--pollar-muted": isDark ? "#9ca3af" : "#6b7280",
643
- "--pollar-input-bg": isDark ? "#374151" : "#f9fafb"
1812
+ "--pollar-input-bg": isDark ? "#374151" : "#f9fafb",
1813
+ "--pollar-error-bg": isDark ? "#2a1515" : "#fef2f2",
1814
+ "--pollar-error-border": isDark ? "#7f1d1d" : "#fecaca",
1815
+ "--pollar-error-text": isDark ? "#f87171" : "#dc2626",
1816
+ "--pollar-success-text": isDark ? "#4ade80" : "#16a34a",
1817
+ "--pollar-buttons-border-radius": "6px",
1818
+ "--pollar-buttons-height": "44px",
1819
+ "--pollar-input-height": "44px",
1820
+ "--pollar-input-border-radius": "0.5rem",
1821
+ "--pollar-card-border-radius": "10px",
1822
+ "--pollar-modal-padding": "2rem",
1823
+ "--pollar-modal-heading-size": "1.375rem",
1824
+ "--pollar-modal-subtitle-size": "0.9rem"
644
1825
  };
645
1826
  const stepTitle = {
646
1827
  input: direction === "onramp" ? "Buy crypto" : "Sell crypto",
@@ -654,7 +1835,7 @@ function RampWidgetTemplate({
654
1835
  select_route: "All prices include fees",
655
1836
  payment_instructions: "Send the exact amount to complete your transaction"
656
1837
  };
657
- return /* @__PURE__ */ jsxs("div", { className: "pollar-ramp-modal", style: cssVars, onClick: (e) => e.stopPropagation(), children: [
1838
+ return /* @__PURE__ */ jsxs("div", { className: "pollar-modal-card pollar-ramp-modal", style: cssVars, onClick: (e) => e.stopPropagation(), children: [
658
1839
  /* @__PURE__ */ jsxs("div", { className: "pollar-ramp-header", children: [
659
1840
  /* @__PURE__ */ jsx("h2", { className: "pollar-ramp-title", children: stepTitle[step] }),
660
1841
  /* @__PURE__ */ jsx("p", { className: "pollar-ramp-subtitle", children: stepSubtitle[step] })
@@ -876,33 +2057,18 @@ var STATUS_MESSAGES = {
876
2057
  success: "Transaction sent successfully",
877
2058
  error: "Transaction failed"
878
2059
  };
879
- function TransactionModalTemplate({
880
- theme,
881
- accentColor,
2060
+ function TxStatusView({
882
2061
  transaction,
883
2062
  showXdr,
884
2063
  copied,
885
2064
  explorerUrl,
886
2065
  walletType,
887
- onClose,
888
2066
  onSignAndSend,
889
2067
  onToggleXdr,
890
2068
  onCopyHash,
891
- onRetry
2069
+ onRetry,
2070
+ onDone
892
2071
  }) {
893
- const isDark = theme === "dark";
894
- const cssVars = {
895
- "--pollar-accent": accentColor,
896
- "--pollar-buttons-border-radius": "8px",
897
- "--pollar-buttons-height": "44px",
898
- "--pollar-bg": isDark ? "#1a1a1a" : "#ffffff",
899
- "--pollar-border": isDark ? "#374151" : "#e5e7eb",
900
- "--pollar-text": isDark ? "#ffffff" : "#111827",
901
- "--pollar-muted": isDark ? "#9ca3af" : "#6b7280",
902
- "--pollar-input-bg": isDark ? "#374151" : "rgba(0,0,0,0.04)",
903
- "--pollar-error-text": isDark ? "#f87171" : "#dc2626",
904
- "--pollar-success-text": isDark ? "#4ade80" : "#16a34a"
905
- };
906
2072
  const buildData = "buildData" in transaction ? transaction.buildData : null;
907
2073
  const hash = transaction.step === "success" ? transaction.hash : null;
908
2074
  const errorDetails = transaction.step === "error" ? transaction.details ?? null : null;
@@ -911,23 +2077,9 @@ function TransactionModalTemplate({
911
2077
  const isSuccess = transaction.step === "success";
912
2078
  const isError = transaction.step === "error";
913
2079
  const showDetails = buildData !== null && (isBuilt || isSigning || isSuccess);
914
- return /* @__PURE__ */ jsxs("div", { className: "pollar-tx-modal", "data-theme": theme, style: cssVars, onClick: (e) => e.stopPropagation(), children: [
915
- /* @__PURE__ */ jsx("div", { className: "pollar-modal-header", children: /* @__PURE__ */ jsx("h2", { className: "pollar-modal-title", children: "Transaction" }) }),
916
- /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-close-btn", onClick: onClose, "aria-label": "Close", children: /* @__PURE__ */ jsx(
917
- "svg",
918
- {
919
- width: "18",
920
- height: "18",
921
- viewBox: "0 0 24 24",
922
- fill: "none",
923
- stroke: "currentColor",
924
- strokeWidth: "2.5",
925
- strokeLinecap: "round",
926
- strokeLinejoin: "round",
927
- "aria-hidden": true,
928
- children: /* @__PURE__ */ jsx("path", { d: "M18 6L6 18M6 6l12 12" })
929
- }
930
- ) }),
2080
+ const walletImg = walletType === WalletType.FREIGHTER ? LOGO_FREIGHTER : walletType === WalletType.ALBEDO ? LOGO_ALBEDO : LOGO_POLLAR;
2081
+ const walletAlt = walletType === WalletType.FREIGHTER ? "Freighter" : walletType === WalletType.ALBEDO ? "Albedo" : "Pollar";
2082
+ return /* @__PURE__ */ jsxs(Fragment, { children: [
931
2083
  showDetails && buildData && /* @__PURE__ */ jsxs(Fragment, { children: [
932
2084
  /* @__PURE__ */ jsxs("div", { className: "pollar-tx-summary", children: [
933
2085
  /* @__PURE__ */ jsx("p", { className: "pollar-tx-summary-title", children: "Details" }),
@@ -997,14 +2149,7 @@ function TransactionModalTemplate({
997
2149
  ]
998
2150
  }
999
2151
  ),
1000
- /* @__PURE__ */ jsx("div", { className: "pollar-tx-wallet-icon", children: /* @__PURE__ */ jsx(
1001
- "img",
1002
- {
1003
- src: walletType === WalletType.FREIGHTER ? LOGO_FREIGHTER : walletType === WalletType.ALBEDO ? LOGO_ALBEDO : LOGO_POLLAR,
1004
- alt: walletType === WalletType.FREIGHTER ? "Freighter" : walletType === WalletType.ALBEDO ? "Albedo" : "Pollar",
1005
- className: "pollar-tx-wallet-img"
1006
- }
1007
- ) })
2152
+ /* @__PURE__ */ jsx("div", { className: "pollar-tx-wallet-icon", children: /* @__PURE__ */ jsx("img", { src: walletImg, alt: walletAlt, className: "pollar-tx-wallet-img" }) })
1008
2153
  ] }),
1009
2154
  isSigning && /* @__PURE__ */ jsx("p", { className: "pollar-tx-spinner-label", children: walletType === WalletType.FREIGHTER ? "Waiting for Freighter\u2026" : walletType === WalletType.ALBEDO ? "Waiting for Albedo\u2026" : "Signing and sending\u2026" }),
1010
2155
  isError && onRetry && "buildData" in transaction && transaction.buildData && /* @__PURE__ */ jsx("button", { className: "pollar-btn-secondary pollar-tx-retry-btn", onClick: onRetry, children: "Try again" })
@@ -1069,25 +2214,375 @@ function TransactionModalTemplate({
1069
2214
  ] })
1070
2215
  ] })
1071
2216
  ] }),
1072
- isSuccess && /* @__PURE__ */ jsx("button", { className: "pollar-btn-primary pollar-tx-sign-btn", onClick: onClose, children: "Done" }),
2217
+ isSuccess && /* @__PURE__ */ jsx("button", { className: "pollar-btn-primary pollar-tx-sign-btn", onClick: onDone, children: "Done" }),
1073
2218
  /* @__PURE__ */ jsx(
1074
2219
  ModalStatusBanner,
1075
2220
  {
1076
2221
  message: STATUS_MESSAGES[transaction.step],
1077
2222
  status: isError ? "ERROR" : isSigning || transaction.step === "building" ? "LOADING" : isSuccess ? "SUCCESS" : "NONE"
1078
2223
  }
1079
- ),
1080
- /* @__PURE__ */ jsx(PollarModalFooter, {})
2224
+ )
1081
2225
  ] });
1082
2226
  }
2227
+ function formatBalance(balance) {
2228
+ const n = parseFloat(balance);
2229
+ return isNaN(n) ? balance : n.toLocaleString(void 0, { maximumFractionDigits: 7 });
2230
+ }
2231
+ function assetKey(record) {
2232
+ return `${record.code}:${record.issuer ?? "native"}`;
2233
+ }
2234
+ function SendModalTemplate({
2235
+ theme,
2236
+ accentColor,
2237
+ step,
2238
+ txTitle,
2239
+ assets,
2240
+ selectedAsset,
2241
+ amount,
2242
+ destination,
2243
+ formError,
2244
+ isLoadingBalance,
2245
+ transaction,
2246
+ showXdr,
2247
+ copied,
2248
+ explorerUrl,
2249
+ walletType,
2250
+ showBack,
2251
+ isInProgress,
2252
+ onClose,
2253
+ onBack,
2254
+ onSelectAsset,
2255
+ onAmountChange,
2256
+ onDestinationChange,
2257
+ onSubmit,
2258
+ onSignAndSend,
2259
+ onToggleXdr,
2260
+ onCopyHash,
2261
+ onRetry,
2262
+ onDone
2263
+ }) {
2264
+ const isDark = theme === "dark";
2265
+ const cssVars = {
2266
+ "--pollar-accent": accentColor,
2267
+ "--pollar-bg": isDark ? "#1a1a1a" : "#ffffff",
2268
+ "--pollar-border": isDark ? "#374151" : "#e5e7eb",
2269
+ "--pollar-text": isDark ? "#ffffff" : "#111827",
2270
+ "--pollar-muted": isDark ? "#9ca3af" : "#6b7280",
2271
+ "--pollar-input-bg": isDark ? "#374151" : "#f9fafb",
2272
+ "--pollar-error-bg": isDark ? "#2a1515" : "#fef2f2",
2273
+ "--pollar-error-border": isDark ? "#7f1d1d" : "#fecaca",
2274
+ "--pollar-error-text": isDark ? "#f87171" : "#dc2626",
2275
+ "--pollar-success-text": isDark ? "#4ade80" : "#16a34a",
2276
+ "--pollar-buttons-border-radius": "6px",
2277
+ "--pollar-buttons-height": "44px",
2278
+ "--pollar-input-height": "44px",
2279
+ "--pollar-input-border-radius": "0.5rem",
2280
+ "--pollar-card-border-radius": "10px"
2281
+ };
2282
+ const enabledAssets = assets.filter((a) => a.enabledInApp);
2283
+ const otherAssets = assets.filter((a) => !a.enabledInApp);
2284
+ const selectedKey = selectedAsset ? assetKey(selectedAsset) : "";
2285
+ const canSubmit = !!selectedAsset && !!amount && !!destination.trim() && !isLoadingBalance;
2286
+ const title = step === "form" ? "Send" : txTitle;
2287
+ return /* @__PURE__ */ jsxs(
2288
+ "div",
2289
+ {
2290
+ className: "pollar-modal-card pollar-send-modal",
2291
+ "data-theme": theme,
2292
+ style: cssVars,
2293
+ onClick: (e) => e.stopPropagation(),
2294
+ children: [
2295
+ /* @__PURE__ */ jsxs("div", { className: "pollar-modal-header", children: [
2296
+ /* @__PURE__ */ jsxs("div", { className: "pollar-send-header-left", children: [
2297
+ showBack && /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-modal-close", onClick: onBack, "aria-label": "Back", children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M10 3L5 8l5 5", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round" }) }) }),
2298
+ /* @__PURE__ */ jsx("h2", { className: "pollar-modal-title", children: title })
2299
+ ] }),
2300
+ !isInProgress && /* @__PURE__ */ jsx("div", { className: "pollar-modal-header-actions", children: /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-modal-close", onClick: onClose, "aria-label": "Close", children: /* @__PURE__ */ jsx("svg", { width: "16", height: "16", viewBox: "0 0 16 16", fill: "none", "aria-hidden": true, children: /* @__PURE__ */ jsx("path", { d: "M2 2l12 12M14 2L2 14", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round" }) }) }) })
2301
+ ] }),
2302
+ step === "form" && /* @__PURE__ */ jsxs(Fragment, { children: [
2303
+ /* @__PURE__ */ jsxs("div", { className: "pollar-send-field", children: [
2304
+ /* @__PURE__ */ jsx("label", { className: "pollar-send-label", children: "Asset" }),
2305
+ isLoadingBalance ? /* @__PURE__ */ jsx("div", { className: "pollar-send-skeleton" }) : /* @__PURE__ */ jsxs(
2306
+ "select",
2307
+ {
2308
+ className: "pollar-input pollar-send-select",
2309
+ value: selectedKey,
2310
+ onChange: (e) => {
2311
+ const all = [...enabledAssets, ...otherAssets];
2312
+ const found = all.find((a) => assetKey(a) === e.target.value);
2313
+ if (found) onSelectAsset(found);
2314
+ },
2315
+ children: [
2316
+ /* @__PURE__ */ jsx("option", { value: "", disabled: true, children: "Select asset" }),
2317
+ enabledAssets.length > 0 && /* @__PURE__ */ jsx("optgroup", { label: "App assets", children: enabledAssets.map((a) => /* @__PURE__ */ jsxs("option", { value: assetKey(a), children: [
2318
+ a.code,
2319
+ " \u2014 ",
2320
+ formatBalance(a.available),
2321
+ " available"
2322
+ ] }, assetKey(a))) }),
2323
+ otherAssets.length > 0 && /* @__PURE__ */ jsx("optgroup", { label: "Other assets", children: otherAssets.map((a) => /* @__PURE__ */ jsxs("option", { value: assetKey(a), children: [
2324
+ a.code,
2325
+ " \u2014 ",
2326
+ formatBalance(a.available),
2327
+ " available"
2328
+ ] }, assetKey(a))) })
2329
+ ]
2330
+ }
2331
+ )
2332
+ ] }),
2333
+ /* @__PURE__ */ jsxs("div", { className: "pollar-send-field", children: [
2334
+ /* @__PURE__ */ jsxs("div", { className: "pollar-send-label-row", children: [
2335
+ /* @__PURE__ */ jsx("label", { className: "pollar-send-label", children: "Amount" }),
2336
+ selectedAsset && /* @__PURE__ */ jsxs("span", { className: "pollar-send-hint", children: [
2337
+ "Available: ",
2338
+ formatBalance(selectedAsset.available),
2339
+ " ",
2340
+ selectedAsset.code
2341
+ ] })
2342
+ ] }),
2343
+ /* @__PURE__ */ jsx(
2344
+ "input",
2345
+ {
2346
+ className: "pollar-input",
2347
+ type: "text",
2348
+ inputMode: "decimal",
2349
+ placeholder: "0.00",
2350
+ value: amount,
2351
+ onChange: (e) => onAmountChange(e.target.value)
2352
+ }
2353
+ )
2354
+ ] }),
2355
+ /* @__PURE__ */ jsxs("div", { className: "pollar-send-field", children: [
2356
+ /* @__PURE__ */ jsx("label", { className: "pollar-send-label", children: "Destination wallet" }),
2357
+ /* @__PURE__ */ jsx(
2358
+ "input",
2359
+ {
2360
+ className: "pollar-input",
2361
+ type: "text",
2362
+ placeholder: "G\u2026",
2363
+ value: destination,
2364
+ onChange: (e) => onDestinationChange(e.target.value)
2365
+ }
2366
+ )
2367
+ ] }),
2368
+ formError && /* @__PURE__ */ jsx("div", { className: "pollar-modal-error", children: formError }),
2369
+ /* @__PURE__ */ jsx("div", { className: "pollar-modal-actions", children: /* @__PURE__ */ jsx("button", { className: "pollar-btn-primary", onClick: onSubmit, disabled: !canSubmit, children: "Continue" }) })
2370
+ ] }),
2371
+ step === "tx" && /* @__PURE__ */ jsx(
2372
+ TxStatusView,
2373
+ {
2374
+ transaction,
2375
+ showXdr,
2376
+ copied,
2377
+ explorerUrl,
2378
+ walletType,
2379
+ onSignAndSend,
2380
+ onToggleXdr,
2381
+ onCopyHash,
2382
+ onRetry,
2383
+ onDone
2384
+ }
2385
+ ),
2386
+ /* @__PURE__ */ jsx(PollarModalFooter, {})
2387
+ ]
2388
+ }
2389
+ );
2390
+ }
2391
+ function assetParam(record) {
2392
+ if (record.type === "native") return { type: "native" };
2393
+ if (record.type === "credit_alphanum4") {
2394
+ return { type: "credit_alphanum4", code: record.code, issuer: record.issuer };
2395
+ }
2396
+ return { type: "credit_alphanum12", code: record.code, issuer: record.issuer };
2397
+ }
2398
+ function SendModal({ onClose }) {
2399
+ const { walletBalance, refreshWalletBalance, buildTx, signAndSubmitTx, tx: transaction, walletType, network, styles } = usePollar();
2400
+ const { theme = "light", accentColor = "#005DB4" } = styles;
2401
+ const [step, setStep] = useState("form");
2402
+ const [amount, setAmount] = useState("");
2403
+ const [destination, setDestination] = useState("");
2404
+ const [selectedAsset, setSelectedAsset] = useState(null);
2405
+ const [showXdr, setShowXdr] = useState(false);
2406
+ const [copied, setCopied] = useState(false);
2407
+ const [formError, setFormError] = useState("");
2408
+ useEffect(() => {
2409
+ void refreshWalletBalance();
2410
+ }, [refreshWalletBalance]);
2411
+ const balanceData = walletBalance.step === "loaded" ? walletBalance.data : null;
2412
+ const allAssets = balanceData?.balances ?? [];
2413
+ const sortedAssets = [
2414
+ ...allAssets.filter((b) => b.enabledInApp),
2415
+ ...allAssets.filter((b) => !b.enabledInApp && parseFloat(b.balance) > 0)
2416
+ ];
2417
+ const hash = transaction.step === "success" ? transaction.hash : null;
2418
+ const buildData = "buildData" in transaction ? transaction.buildData : null;
2419
+ const explorerNetwork = buildData?.summary.network?.toLowerCase().includes("testnet") ? "testnet" : buildData ? "public" : network === "testnet" ? "testnet" : "public";
2420
+ const explorerUrl = hash ? `https://stellar.expert/explorer/${explorerNetwork}/tx/${hash}` : null;
2421
+ const isInProgress = transaction.step === "building" || transaction.step === "signing";
2422
+ const showBack = step === "tx" && (transaction.step === "error" || transaction.step === "success") && !isInProgress;
2423
+ const txTitle = transaction.step === "signing" ? "Sending\u2026" : transaction.step === "success" ? "Sent!" : transaction.step === "error" ? "Send failed" : "Confirm Send";
2424
+ async function handleSubmit() {
2425
+ setFormError("");
2426
+ if (!selectedAsset) {
2427
+ setFormError("Select an asset");
2428
+ return;
2429
+ }
2430
+ const parsed = parseFloat(amount);
2431
+ if (!amount || isNaN(parsed) || parsed <= 0) {
2432
+ setFormError("Enter a valid amount");
2433
+ return;
2434
+ }
2435
+ if (parsed > parseFloat(selectedAsset.available)) {
2436
+ setFormError("Insufficient balance");
2437
+ return;
2438
+ }
2439
+ if (!destination.trim()) {
2440
+ setFormError("Enter a destination address");
2441
+ return;
2442
+ }
2443
+ setStep("tx");
2444
+ await buildTx("payment", { destination: destination.trim(), amount, asset: assetParam(selectedAsset) });
2445
+ }
2446
+ function handleSignAndSend() {
2447
+ if (transaction.step === "built") {
2448
+ void signAndSubmitTx(transaction.buildData.unsignedXdr);
2449
+ }
2450
+ }
2451
+ function handleCopyHash() {
2452
+ if (!hash) return;
2453
+ navigator.clipboard.writeText(hash).then(() => {
2454
+ setCopied(true);
2455
+ setTimeout(() => setCopied(false), 2e3);
2456
+ });
2457
+ }
2458
+ async function handleRetry() {
2459
+ if (transaction.step === "error" && transaction.buildData) {
2460
+ await signAndSubmitTx(transaction.buildData.unsignedXdr);
2461
+ }
2462
+ }
2463
+ function handleBack() {
2464
+ setStep("form");
2465
+ setShowXdr(false);
2466
+ setCopied(false);
2467
+ }
2468
+ return /* @__PURE__ */ jsx("div", { className: "pollar-overlay", onClick: !isInProgress ? onClose : void 0, children: /* @__PURE__ */ jsx(
2469
+ SendModalTemplate,
2470
+ {
2471
+ theme,
2472
+ accentColor,
2473
+ step,
2474
+ txTitle,
2475
+ assets: sortedAssets,
2476
+ selectedAsset,
2477
+ amount,
2478
+ destination,
2479
+ formError,
2480
+ isLoadingBalance: walletBalance.step === "loading",
2481
+ transaction,
2482
+ showXdr,
2483
+ copied,
2484
+ explorerUrl,
2485
+ walletType,
2486
+ showBack,
2487
+ isInProgress,
2488
+ onClose,
2489
+ onBack: handleBack,
2490
+ onSelectAsset: setSelectedAsset,
2491
+ onAmountChange: setAmount,
2492
+ onDestinationChange: setDestination,
2493
+ onSubmit: () => void handleSubmit(),
2494
+ onSignAndSend: handleSignAndSend,
2495
+ onToggleXdr: () => setShowXdr((v) => !v),
2496
+ onCopyHash: handleCopyHash,
2497
+ onRetry: () => void handleRetry(),
2498
+ onDone: onClose
2499
+ }
2500
+ ) });
2501
+ }
2502
+ function TransactionModalTemplate({
2503
+ theme,
2504
+ accentColor,
2505
+ transaction,
2506
+ showXdr,
2507
+ copied,
2508
+ explorerUrl,
2509
+ walletType,
2510
+ onClose,
2511
+ onSignAndSend,
2512
+ onToggleXdr,
2513
+ onCopyHash,
2514
+ onRetry
2515
+ }) {
2516
+ const isDark = theme === "dark";
2517
+ const cssVars = {
2518
+ "--pollar-accent": accentColor,
2519
+ "--pollar-bg": isDark ? "#1a1a1a" : "#ffffff",
2520
+ "--pollar-border": isDark ? "#374151" : "#e5e7eb",
2521
+ "--pollar-text": isDark ? "#ffffff" : "#111827",
2522
+ "--pollar-muted": isDark ? "#9ca3af" : "#6b7280",
2523
+ "--pollar-input-bg": isDark ? "#374151" : "#f9fafb",
2524
+ "--pollar-error-bg": isDark ? "#2a1515" : "#fef2f2",
2525
+ "--pollar-error-border": isDark ? "#7f1d1d" : "#fecaca",
2526
+ "--pollar-error-text": isDark ? "#f87171" : "#dc2626",
2527
+ "--pollar-success-text": isDark ? "#4ade80" : "#16a34a",
2528
+ "--pollar-buttons-border-radius": "6px",
2529
+ "--pollar-buttons-height": "44px",
2530
+ "--pollar-input-height": "44px",
2531
+ "--pollar-input-border-radius": "0.5rem",
2532
+ "--pollar-card-border-radius": "10px"
2533
+ };
2534
+ return /* @__PURE__ */ jsxs(
2535
+ "div",
2536
+ {
2537
+ className: "pollar-modal-card pollar-tx-modal",
2538
+ "data-theme": theme,
2539
+ style: cssVars,
2540
+ onClick: (e) => e.stopPropagation(),
2541
+ children: [
2542
+ /* @__PURE__ */ jsx("div", { className: "pollar-modal-header", children: /* @__PURE__ */ jsx("h2", { className: "pollar-modal-title", children: "Transaction" }) }),
2543
+ /* @__PURE__ */ jsx("button", { type: "button", className: "pollar-close-btn", onClick: onClose, "aria-label": "Close", children: /* @__PURE__ */ jsx(
2544
+ "svg",
2545
+ {
2546
+ width: "18",
2547
+ height: "18",
2548
+ viewBox: "0 0 24 24",
2549
+ fill: "none",
2550
+ stroke: "currentColor",
2551
+ strokeWidth: "2.5",
2552
+ strokeLinecap: "round",
2553
+ strokeLinejoin: "round",
2554
+ "aria-hidden": true,
2555
+ children: /* @__PURE__ */ jsx("path", { d: "M18 6L6 18M6 6l12 12" })
2556
+ }
2557
+ ) }),
2558
+ /* @__PURE__ */ jsx(
2559
+ TxStatusView,
2560
+ {
2561
+ transaction,
2562
+ showXdr,
2563
+ copied,
2564
+ explorerUrl,
2565
+ walletType,
2566
+ onSignAndSend,
2567
+ onToggleXdr,
2568
+ onCopyHash,
2569
+ onRetry,
2570
+ onDone: onClose
2571
+ }
2572
+ ),
2573
+ /* @__PURE__ */ jsx(PollarModalFooter, {})
2574
+ ]
2575
+ }
2576
+ );
2577
+ }
1083
2578
  function TransactionModal({ onClose }) {
1084
- const { getClient, styles, transaction, network, walletType } = usePollar();
2579
+ const { getClient, styles, tx: transaction, network, walletType } = usePollar();
1085
2580
  const { theme = "light", accentColor = "#005DB4" } = styles;
1086
2581
  const [showXdr, setShowXdr] = useState(false);
1087
2582
  const [copied, setCopied] = useState(false);
1088
2583
  const hash = transaction.step === "success" ? transaction.hash : null;
1089
2584
  const buildData = "buildData" in transaction ? transaction.buildData : null;
1090
- const explorerNetwork = buildData?.summary.network?.toLowerCase().includes("testnet") ? "testnet" : "public";
2585
+ const explorerNetwork = buildData?.summary.network?.toLowerCase().includes("testnet") ? "testnet" : buildData ? "public" : network === "testnet" ? "testnet" : "public";
1091
2586
  const explorerUrl = hash ? `https://stellar.expert/explorer/${explorerNetwork}/tx/${hash}` : null;
1092
2587
  function handleSignAndSend() {
1093
2588
  if (transaction.step === "built") {
@@ -1144,15 +2639,20 @@ function TxHistoryModalTemplate({
1144
2639
  const isDark = theme === "dark";
1145
2640
  const cssVars = {
1146
2641
  "--pollar-accent": accentColor,
1147
- "--pollar-buttons-border-radius": "8px",
1148
- "--pollar-buttons-height": "44px",
1149
2642
  "--pollar-bg": isDark ? "#1a1a1a" : "#ffffff",
1150
2643
  "--pollar-border": isDark ? "#374151" : "#e5e7eb",
1151
2644
  "--pollar-text": isDark ? "#ffffff" : "#111827",
1152
2645
  "--pollar-muted": isDark ? "#9ca3af" : "#6b7280",
1153
- "--pollar-input-bg": isDark ? "#374151" : "rgba(0,0,0,0.04)",
2646
+ "--pollar-input-bg": isDark ? "#374151" : "#f9fafb",
2647
+ "--pollar-error-bg": isDark ? "#2a1515" : "#fef2f2",
2648
+ "--pollar-error-border": isDark ? "#7f1d1d" : "#fecaca",
1154
2649
  "--pollar-error-text": isDark ? "#f87171" : "#dc2626",
1155
- "--pollar-success-text": isDark ? "#4ade80" : "#16a34a"
2650
+ "--pollar-success-text": isDark ? "#4ade80" : "#16a34a",
2651
+ "--pollar-buttons-border-radius": "6px",
2652
+ "--pollar-buttons-height": "44px",
2653
+ "--pollar-input-height": "44px",
2654
+ "--pollar-input-border-radius": "0.5rem",
2655
+ "--pollar-card-border-radius": "10px"
1156
2656
  };
1157
2657
  const isLoading = txHistory.step === "loading";
1158
2658
  const records = txHistory.step === "loaded" ? txHistory.data.records : [];
@@ -1160,7 +2660,7 @@ function TxHistoryModalTemplate({
1160
2660
  const hasPrev = offset > 0;
1161
2661
  const hasNext = offset + PAGE_SIZE < total;
1162
2662
  const showPagination = txHistory.step === "loaded" && total > PAGE_SIZE;
1163
- return /* @__PURE__ */ jsxs("div", { className: "pollar-hist-modal", "data-theme": theme, style: cssVars, onClick: (e) => e.stopPropagation(), children: [
2663
+ return /* @__PURE__ */ jsxs("div", { className: "pollar-modal-card pollar-hist-modal", "data-theme": theme, style: cssVars, onClick: (e) => e.stopPropagation(), children: [
1164
2664
  /* @__PURE__ */ jsxs("div", { className: "pollar-modal-header", children: [
1165
2665
  /* @__PURE__ */ jsx("h2", { className: "pollar-modal-title", children: "Transaction History" }),
1166
2666
  /* @__PURE__ */ jsxs("div", { className: "pollar-modal-header-actions", children: [
@@ -1198,22 +2698,33 @@ function TxHistoryModalTemplate({
1198
2698
  isLoading && /* @__PURE__ */ jsx("div", { className: "pollar-modal-empty", children: "Loading\u2026" }),
1199
2699
  txHistory.step === "error" && /* @__PURE__ */ jsx("div", { className: "pollar-modal-empty", children: txHistory.message }),
1200
2700
  txHistory.step === "loaded" && records.length === 0 && /* @__PURE__ */ jsx("div", { className: "pollar-modal-empty", children: "No transactions yet." }),
1201
- records.map((record) => /* @__PURE__ */ jsxs("div", { className: "pollar-hist-item", children: [
1202
- /* @__PURE__ */ jsx("span", { className: "pollar-hist-item-summary", children: record.summary }),
1203
- /* @__PURE__ */ jsx(StatusBadge, { status: record.status }),
1204
- /* @__PURE__ */ jsxs("span", { className: "pollar-hist-item-meta", children: [
1205
- /* @__PURE__ */ jsx("span", { children: record.operation }),
1206
- record.feeXlm && /* @__PURE__ */ jsxs("span", { children: [
1207
- "\xB7 ",
1208
- record.feeXlm,
1209
- " XLM"
1210
- ] }),
1211
- /* @__PURE__ */ jsxs("span", { children: [
1212
- "\xB7 ",
1213
- formatDate(record.createdAt)
2701
+ records.map((record) => {
2702
+ const explorerUrl = `https://stellar.expert/explorer/${record.network === "testnet" ? "testnet" : "public"}/tx/${record.hash}`;
2703
+ return /* @__PURE__ */ jsxs("div", { className: "pollar-hist-item", children: [
2704
+ /* @__PURE__ */ jsx("span", { className: "pollar-hist-item-summary", children: record.summary }),
2705
+ /* @__PURE__ */ jsx(StatusBadge, { status: record.status }),
2706
+ /* @__PURE__ */ jsxs("span", { className: "pollar-hist-item-meta", children: [
2707
+ /* @__PURE__ */ jsx("span", { children: record.operation }),
2708
+ record.feeXlm && /* @__PURE__ */ jsxs("span", { children: [
2709
+ "\xB7 ",
2710
+ record.feeXlm,
2711
+ " XLM"
2712
+ ] }),
2713
+ /* @__PURE__ */ jsxs("span", { children: [
2714
+ "\xB7 ",
2715
+ formatDate(record.createdAt)
2716
+ ] }),
2717
+ /* @__PURE__ */ jsx("span", { children: "\xB7" }),
2718
+ /* @__PURE__ */ jsxs("a", { className: "pollar-hist-item-explorer", href: explorerUrl, target: "_blank", rel: "noopener noreferrer", "aria-label": "View on Stellar Explorer", children: [
2719
+ /* @__PURE__ */ jsxs("svg", { width: "11", height: "11", viewBox: "0 0 13 13", fill: "none", "aria-hidden": true, children: [
2720
+ /* @__PURE__ */ jsx("path", { d: "M5 2H2a1 1 0 00-1 1v8a1 1 0 001 1h8a1 1 0 001-1V8", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round" }),
2721
+ /* @__PURE__ */ jsx("path", { d: "M8 1h4m0 0v4m0-4L6 7", stroke: "currentColor", strokeWidth: "1.5", strokeLinecap: "round", strokeLinejoin: "round" })
2722
+ ] }),
2723
+ "Explorer"
2724
+ ] })
1214
2725
  ] })
1215
- ] })
1216
- ] }, record.id))
2726
+ ] }, record.id);
2727
+ })
1217
2728
  ] }),
1218
2729
  showPagination && /* @__PURE__ */ jsxs("div", { className: "pollar-hist-pagination", children: [
1219
2730
  /* @__PURE__ */ jsxs("span", { className: "pollar-hist-pagination-info", children: [
@@ -1236,10 +2747,13 @@ function TxHistoryModal({ onClose }) {
1236
2747
  const { getClient, styles, txHistory } = usePollar();
1237
2748
  const { theme = "light", accentColor = "#005DB4" } = styles;
1238
2749
  const [offset, setOffset] = useState(0);
1239
- function load(nextOffset) {
2750
+ const load = useCallback((nextOffset) => {
1240
2751
  setOffset(nextOffset);
1241
2752
  void getClient().fetchTxHistory({ limit: PAGE_SIZE2, offset: nextOffset });
1242
- }
2753
+ }, [getClient]);
2754
+ useEffect(() => {
2755
+ load(0);
2756
+ }, [load]);
1243
2757
  return /* @__PURE__ */ jsx("div", { className: "pollar-overlay", onClick: onClose, children: /* @__PURE__ */ jsx(
1244
2758
  TxHistoryModalTemplate,
1245
2759
  {
@@ -1254,7 +2768,7 @@ function TxHistoryModal({ onClose }) {
1254
2768
  }
1255
2769
  ) });
1256
2770
  }
1257
- function formatBalance(balance) {
2771
+ function formatBalance2(balance) {
1258
2772
  const n = parseFloat(balance);
1259
2773
  return isNaN(n) ? balance : n.toLocaleString(void 0, { maximumFractionDigits: 7 });
1260
2774
  }
@@ -1267,9 +2781,9 @@ function BalanceItem({ record }) {
1267
2781
  return /* @__PURE__ */ jsxs("div", { className: "pollar-bal-item", children: [
1268
2782
  /* @__PURE__ */ jsx("span", { className: "pollar-bal-asset", children: record.code }),
1269
2783
  /* @__PURE__ */ jsxs("div", { className: "pollar-bal-amounts", children: [
1270
- /* @__PURE__ */ jsx("span", { className: "pollar-bal-amount", children: formatBalance(record.balance) }),
2784
+ /* @__PURE__ */ jsx("span", { className: "pollar-bal-amount", children: formatBalance2(record.balance) }),
1271
2785
  balanceDiffers && /* @__PURE__ */ jsxs("span", { className: "pollar-bal-available", children: [
1272
- formatBalance(record.available),
2786
+ formatBalance2(record.available),
1273
2787
  " available"
1274
2788
  ] })
1275
2789
  ] })
@@ -1290,12 +2804,20 @@ function WalletBalanceModalTemplate({
1290
2804
  "--pollar-border": isDark ? "#374151" : "#e5e7eb",
1291
2805
  "--pollar-text": isDark ? "#ffffff" : "#111827",
1292
2806
  "--pollar-muted": isDark ? "#9ca3af" : "#6b7280",
1293
- "--pollar-input-bg": isDark ? "#374151" : "rgba(0,0,0,0.04)",
1294
- "--pollar-error-text": isDark ? "#f87171" : "#dc2626"
2807
+ "--pollar-input-bg": isDark ? "#374151" : "#f9fafb",
2808
+ "--pollar-error-bg": isDark ? "#2a1515" : "#fef2f2",
2809
+ "--pollar-error-border": isDark ? "#7f1d1d" : "#fecaca",
2810
+ "--pollar-error-text": isDark ? "#f87171" : "#dc2626",
2811
+ "--pollar-success-text": isDark ? "#4ade80" : "#16a34a",
2812
+ "--pollar-buttons-border-radius": "6px",
2813
+ "--pollar-buttons-height": "44px",
2814
+ "--pollar-input-height": "44px",
2815
+ "--pollar-input-border-radius": "0.5rem",
2816
+ "--pollar-card-border-radius": "10px"
1295
2817
  };
1296
2818
  const isLoading = walletBalance.step === "loading";
1297
2819
  const data = walletBalance.step === "loaded" ? walletBalance.data : null;
1298
- return /* @__PURE__ */ jsxs("div", { className: "pollar-bal-modal", "data-theme": theme, style: cssVars, onClick: (e) => e.stopPropagation(), children: [
2820
+ return /* @__PURE__ */ jsxs("div", { className: "pollar-modal-card pollar-bal-modal", "data-theme": theme, style: cssVars, onClick: (e) => e.stopPropagation(), children: [
1299
2821
  /* @__PURE__ */ jsxs("div", { className: "pollar-modal-header", children: [
1300
2822
  /* @__PURE__ */ jsx("h2", { className: "pollar-modal-title", children: "Wallet Balance" }),
1301
2823
  /* @__PURE__ */ jsxs("div", { className: "pollar-modal-header-actions", children: [
@@ -1334,11 +2856,11 @@ function WalletBalanceModalTemplate({
1334
2856
  ] });
1335
2857
  }
1336
2858
  function WalletBalanceModal({ onClose }) {
1337
- const { walletBalance, refreshBalance, walletAddress, styles } = usePollar();
2859
+ const { walletBalance, refreshWalletBalance, walletAddress, styles } = usePollar();
1338
2860
  const { theme = "light", accentColor = "#005DB4" } = styles;
1339
2861
  useEffect(() => {
1340
- void refreshBalance();
1341
- }, []);
2862
+ void refreshWalletBalance();
2863
+ }, [refreshWalletBalance]);
1342
2864
  return /* @__PURE__ */ jsx("div", { className: "pollar-overlay", onClick: onClose, children: /* @__PURE__ */ jsx(
1343
2865
  WalletBalanceModalTemplate,
1344
2866
  {
@@ -1346,7 +2868,7 @@ function WalletBalanceModal({ onClose }) {
1346
2868
  accentColor,
1347
2869
  walletBalance,
1348
2870
  walletAddress,
1349
- onRefresh: () => refreshBalance(),
2871
+ onRefresh: () => refreshWalletBalance(),
1350
2872
  onClose
1351
2873
  }
1352
2874
  ) });
@@ -1362,7 +2884,7 @@ async function fetchRemoteConfig(client) {
1362
2884
  return content ?? emptyResponse;
1363
2885
  }
1364
2886
  var PollarContext = createContext(null);
1365
- function PollarProvider({ config, styles: propStyles, children }) {
2887
+ function PollarProvider({ config, styles: propStyles, adapters, children }) {
1366
2888
  const [pollarClient] = useState(() => new PollarClient(config));
1367
2889
  const [networkState, setNetworkState] = useState(() => pollarClient.getNetworkState());
1368
2890
  const [sessionState, setSessionState] = useState(null);
@@ -1371,6 +2893,8 @@ function PollarProvider({ config, styles: propStyles, children }) {
1371
2893
  const [walletBalance, setWalletBalance] = useState({ step: "idle" });
1372
2894
  const [remoteConfig, setRemoteConfig] = useState(emptyResponse);
1373
2895
  const [styles, setStyles] = useState(propStyles ?? {});
2896
+ const propStylesRef = useRef(propStyles);
2897
+ propStylesRef.current = propStyles;
1374
2898
  useEffect(() => {
1375
2899
  return pollarClient.onTransactionStateChange(setTransaction);
1376
2900
  }, [pollarClient]);
@@ -1395,58 +2919,75 @@ function PollarProvider({ config, styles: propStyles, children }) {
1395
2919
  });
1396
2920
  }, [pollarClient]);
1397
2921
  useEffect(() => {
2922
+ const propStyles2 = propStylesRef.current;
1398
2923
  fetchRemoteConfig(pollarClient).then((fetched) => {
1399
2924
  setRemoteConfig(fetched);
1400
2925
  setStyles({
1401
2926
  ...fetched.styles,
1402
- ...propStyles,
1403
- providers: { ...fetched.styles?.providers, ...propStyles?.providers }
2927
+ ...propStyles2,
2928
+ providers: { ...fetched.styles?.providers, ...propStyles2?.providers }
1404
2929
  });
1405
2930
  }).catch(() => {
1406
- setStyles(propStyles ?? {});
2931
+ setStyles(propStyles2 ?? {});
1407
2932
  });
1408
2933
  }, [pollarClient]);
1409
- useEffect(() => {
1410
- if (transaction.step !== "idle") {
1411
- setTransactionModalOpen(true);
1412
- }
1413
- }, [transaction.step]);
1414
2934
  const [loginModalOpen, setLoginModalOpen] = useState(false);
1415
2935
  const [transactionModalOpen, setTransactionModalOpen] = useState(false);
1416
2936
  const [kycModalOpen, setKycModalOpen] = useState(false);
1417
2937
  const [kycModalOptions, setKycModalOptions] = useState({});
1418
- const [rampWidgetOpen, setRampWidgetOpen] = useState(false);
2938
+ const [rampModalOpen, setRampModalOpen] = useState(false);
1419
2939
  const [txHistoryModalOpen, setTxHistoryModalOpen] = useState(false);
1420
2940
  const [walletBalanceModalOpen, setWalletBalanceModalOpen] = useState(false);
2941
+ const [sendModalOpen, setSendModalOpen] = useState(false);
2942
+ const [receiveModalOpen, setReceiveModalOpen] = useState(false);
2943
+ const adaptersRef = useRef(adapters);
2944
+ adaptersRef.current = adapters;
2945
+ const walletAddress = sessionState?.data?.providers?.wallet?.address || sessionState?.wallet?.publicKey || "";
2946
+ const getClient = useCallback(() => pollarClient, [pollarClient]);
2947
+ const refreshWalletBalance = useCallback(() => pollarClient.refreshBalance(walletAddress), [pollarClient, walletAddress]);
1421
2948
  const contextValue = useMemo(
1422
2949
  () => ({
1423
- walletAddress: sessionState?.data?.providers?.wallet?.address || sessionState?.wallet?.publicKey || "",
1424
- getClient: () => pollarClient,
1425
- transaction,
2950
+ // session
2951
+ walletAddress,
2952
+ isAuthenticated: !!walletAddress,
2953
+ walletType: pollarClient.getWalletType(),
2954
+ // client
2955
+ getClient,
2956
+ // auth
1426
2957
  login: (options) => pollarClient.login(options),
1427
2958
  logout: () => pollarClient.logout(),
1428
- isAuthenticated: !!sessionState?.wallet?.publicKey,
2959
+ openLoginModal: () => setLoginModalOpen(true),
2960
+ // transactions
2961
+ tx: transaction,
1429
2962
  buildTx: (operation, params, options) => pollarClient.buildTx(operation, params, options),
1430
2963
  signAndSubmitTx: (unsignedXdr) => pollarClient.signAndSubmitTx(unsignedXdr),
1431
- walletType: pollarClient.getWalletType(),
1432
- openTransactionModal: () => setTransactionModalOpen(true),
1433
- openLoginModal: () => setLoginModalOpen(true),
1434
- openKycModal: (options = {}) => {
1435
- setKycModalOptions(options);
1436
- setKycModalOpen(true);
1437
- },
1438
- openRampWidget: () => setRampWidgetOpen(true),
2964
+ openTxModal: () => setTransactionModalOpen(true),
2965
+ // tx history
1439
2966
  txHistory,
1440
2967
  openTxHistoryModal: () => setTxHistoryModalOpen(true),
1441
- openWalletBalanceModal: () => setWalletBalanceModalOpen(true),
2968
+ // wallet balance
1442
2969
  walletBalance,
1443
- refreshBalance: (publicKey) => pollarClient.refreshBalance(publicKey),
2970
+ refreshWalletBalance,
2971
+ openWalletBalanceModal: () => setWalletBalanceModalOpen(true),
2972
+ // send / receive
2973
+ openSendModal: () => setSendModalOpen(true),
2974
+ openReceiveModal: () => setReceiveModalOpen(true),
2975
+ // network
1444
2976
  network: networkState.step === "connected" ? networkState.network : "testnet",
1445
2977
  setNetwork: (network) => pollarClient.setNetwork(network),
1446
- config: remoteConfig,
1447
- styles
2978
+ // kyc
2979
+ openKycModal: (options = {}) => {
2980
+ setKycModalOptions(options);
2981
+ setKycModalOpen(true);
2982
+ },
2983
+ // ramp
2984
+ openRampModal: () => setRampModalOpen(true),
2985
+ // config
2986
+ appConfig: remoteConfig,
2987
+ styles,
2988
+ adapters: adaptersRef.current
1448
2989
  }),
1449
- [sessionState, remoteConfig, styles, pollarClient, transaction, txHistory, networkState, walletBalance]
2990
+ [walletAddress, pollarClient, getClient, transaction, txHistory, walletBalance, refreshWalletBalance, networkState, remoteConfig, styles]
1450
2991
  );
1451
2992
  return /* @__PURE__ */ jsxs(PollarContext.Provider, { value: contextValue, children: [
1452
2993
  children,
@@ -1461,9 +3002,11 @@ function PollarProvider({ config, styles: propStyles, children }) {
1461
3002
  ...kycModalOptions.onApproved !== void 0 && { onApproved: kycModalOptions.onApproved }
1462
3003
  }
1463
3004
  ) }),
1464
- rampWidgetOpen && /* @__PURE__ */ jsx(ModalErrorBoundary, { onClose: () => setRampWidgetOpen(false), children: /* @__PURE__ */ jsx(RampWidget, { onClose: () => setRampWidgetOpen(false) }) }),
3005
+ rampModalOpen && /* @__PURE__ */ jsx(ModalErrorBoundary, { onClose: () => setRampModalOpen(false), children: /* @__PURE__ */ jsx(RampWidget, { onClose: () => setRampModalOpen(false) }) }),
1465
3006
  txHistoryModalOpen && /* @__PURE__ */ jsx(ModalErrorBoundary, { onClose: () => setTxHistoryModalOpen(false), children: /* @__PURE__ */ jsx(TxHistoryModal, { onClose: () => setTxHistoryModalOpen(false) }) }),
1466
- walletBalanceModalOpen && /* @__PURE__ */ jsx(ModalErrorBoundary, { onClose: () => setWalletBalanceModalOpen(false), children: /* @__PURE__ */ jsx(WalletBalanceModal, { onClose: () => setWalletBalanceModalOpen(false) }) })
3007
+ walletBalanceModalOpen && /* @__PURE__ */ jsx(ModalErrorBoundary, { onClose: () => setWalletBalanceModalOpen(false), children: /* @__PURE__ */ jsx(WalletBalanceModal, { onClose: () => setWalletBalanceModalOpen(false) }) }),
3008
+ sendModalOpen && /* @__PURE__ */ jsx(ModalErrorBoundary, { onClose: () => setSendModalOpen(false), children: /* @__PURE__ */ jsx(SendModal, { onClose: () => setSendModalOpen(false) }) }),
3009
+ receiveModalOpen && /* @__PURE__ */ jsx(ModalErrorBoundary, { onClose: () => setReceiveModalOpen(false), children: /* @__PURE__ */ jsx(ReceiveModal, { onClose: () => setReceiveModalOpen(false) }) })
1467
3010
  ] });
1468
3011
  }
1469
3012
  function usePollar() {
@@ -1473,6 +3016,26 @@ function usePollar() {
1473
3016
  }
1474
3017
  return ctx;
1475
3018
  }
3019
+
3020
+ // src/usePollarAdapter.ts
3021
+ function createPollarAdapterHook(key) {
3022
+ return function usePollarAdapter() {
3023
+ const { adapters, signAndSubmitTx } = usePollar();
3024
+ const adapter = adapters?.[key];
3025
+ if (!adapter) {
3026
+ throw new Error(`No adapter "${key}" provided to PollarProvider`);
3027
+ }
3028
+ return Object.fromEntries(
3029
+ Object.entries(adapter).map(([name, fn]) => [
3030
+ name,
3031
+ async (params) => {
3032
+ const { unsignedTransaction } = await fn(params);
3033
+ await signAndSubmitTx(unsignedTransaction);
3034
+ }
3035
+ ])
3036
+ );
3037
+ };
3038
+ }
1476
3039
  function ButtonLogo() {
1477
3040
  return /* @__PURE__ */ jsx("img", { src: LOGO_POLLAR, alt: "Pollar", width: 22, height: 22, className: "wallet-btn-logo" });
1478
3041
  }
@@ -1489,10 +3052,13 @@ function WalletButtonTemplate({
1489
3052
  dropdownBorder,
1490
3053
  itemColor,
1491
3054
  wrapperRef,
3055
+ isInProgress,
1492
3056
  onToggleOpen,
1493
3057
  onCopy,
1494
3058
  onWalletBalance,
1495
3059
  onTxHistory,
3060
+ onSend,
3061
+ onReceive,
1496
3062
  onLogout,
1497
3063
  onLogin
1498
3064
  }) {
@@ -1503,132 +3069,129 @@ function WalletButtonTemplate({
1503
3069
  ] });
1504
3070
  }
1505
3071
  return /* @__PURE__ */ jsxs("div", { className: "wallet-wrapper", ref: wrapperRef, children: [
1506
- /* @__PURE__ */ jsxs("button", { className: "wallet-btn", style: { backgroundColor: accentColor }, onClick: onToggleOpen, children: [
1507
- cropWallet(walletAddress),
1508
- /* @__PURE__ */ jsx(
1509
- "svg",
1510
- {
1511
- className: `wallet-chevron${open ? " open" : ""}`,
1512
- viewBox: "0 0 12 12",
1513
- fill: "none",
1514
- stroke: "currentColor",
1515
- strokeWidth: "2",
1516
- strokeLinecap: "round",
1517
- strokeLinejoin: "round",
1518
- children: /* @__PURE__ */ jsx("polyline", { points: "2,4 6,8 10,4" })
1519
- }
1520
- )
1521
- ] }),
3072
+ /* @__PURE__ */ jsxs(
3073
+ "button",
3074
+ {
3075
+ className: "wallet-btn",
3076
+ style: { backgroundColor: accentColor },
3077
+ onClick: isInProgress ? void 0 : onToggleOpen,
3078
+ disabled: isInProgress,
3079
+ "aria-busy": isInProgress,
3080
+ children: [
3081
+ /* @__PURE__ */ jsx("span", { className: "wallet-btn-label", children: cropWallet(walletAddress) }),
3082
+ isInProgress ? /* @__PURE__ */ jsxs(
3083
+ "svg",
3084
+ {
3085
+ className: "wallet-btn-spinner",
3086
+ viewBox: "0 0 12 12",
3087
+ width: "12",
3088
+ height: "12",
3089
+ fill: "none",
3090
+ "aria-hidden": true,
3091
+ children: [
3092
+ /* @__PURE__ */ jsx("circle", { cx: "6", cy: "6", r: "4.5", stroke: "rgba(255,255,255,0.35)", strokeWidth: "1.5" }),
3093
+ /* @__PURE__ */ jsx(
3094
+ "circle",
3095
+ {
3096
+ cx: "6",
3097
+ cy: "6",
3098
+ r: "4.5",
3099
+ stroke: "white",
3100
+ strokeWidth: "1.5",
3101
+ strokeLinecap: "round",
3102
+ strokeDasharray: "14 9",
3103
+ transform: "rotate(-90 6 6)"
3104
+ }
3105
+ )
3106
+ ]
3107
+ }
3108
+ ) : /* @__PURE__ */ jsx(
3109
+ "svg",
3110
+ {
3111
+ className: `wallet-chevron${open ? " open" : ""}`,
3112
+ viewBox: "0 0 12 12",
3113
+ fill: "none",
3114
+ stroke: "currentColor",
3115
+ strokeWidth: "2",
3116
+ strokeLinecap: "round",
3117
+ strokeLinejoin: "round",
3118
+ children: /* @__PURE__ */ jsx("polyline", { points: "2,4 6,8 10,4" })
3119
+ }
3120
+ )
3121
+ ]
3122
+ }
3123
+ ),
1522
3124
  open && /* @__PURE__ */ jsxs("div", { className: "wallet-dropdown", style: { backgroundColor: dropdownBg, borderColor: dropdownBorder }, children: [
3125
+ /* @__PURE__ */ jsxs("button", { className: "wallet-dropdown-item", style: { color: itemColor }, onClick: onSend, children: [
3126
+ /* @__PURE__ */ jsxs("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
3127
+ /* @__PURE__ */ jsx("line", { x1: "22", y1: "2", x2: "11", y2: "13" }),
3128
+ /* @__PURE__ */ jsx("polygon", { points: "22 2 15 22 11 13 2 9 22 2" })
3129
+ ] }),
3130
+ "Send"
3131
+ ] }),
3132
+ /* @__PURE__ */ jsxs("button", { className: "wallet-dropdown-item", style: { color: itemColor }, onClick: onReceive, children: [
3133
+ /* @__PURE__ */ jsxs("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
3134
+ /* @__PURE__ */ jsx("polyline", { points: "8 17 12 21 16 17" }),
3135
+ /* @__PURE__ */ jsx("line", { x1: "12", y1: "12", x2: "12", y2: "21" }),
3136
+ /* @__PURE__ */ jsx("path", { d: "M20.88 18.09A5 5 0 0 0 18 9h-1.26A8 8 0 1 0 3 16.29" })
3137
+ ] }),
3138
+ "Receive"
3139
+ ] }),
3140
+ /* @__PURE__ */ jsx("div", { className: "wallet-dropdown-divider" }),
1523
3141
  /* @__PURE__ */ jsxs("button", { className: "wallet-dropdown-item", style: { color: itemColor }, onClick: onCopy, children: [
1524
- /* @__PURE__ */ jsxs(
1525
- "svg",
1526
- {
1527
- width: "14",
1528
- height: "14",
1529
- viewBox: "0 0 24 24",
1530
- fill: "none",
1531
- stroke: "currentColor",
1532
- strokeWidth: "2",
1533
- strokeLinecap: "round",
1534
- strokeLinejoin: "round",
1535
- children: [
1536
- /* @__PURE__ */ jsx("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2" }),
1537
- /* @__PURE__ */ jsx("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })
1538
- ]
1539
- }
1540
- ),
3142
+ /* @__PURE__ */ jsxs("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
3143
+ /* @__PURE__ */ jsx("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2" }),
3144
+ /* @__PURE__ */ jsx("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })
3145
+ ] }),
1541
3146
  copied ? "Copied!" : "Copy address"
1542
3147
  ] }),
1543
- /* @__PURE__ */ jsxs(
1544
- "button",
1545
- {
1546
- className: "wallet-dropdown-item",
1547
- style: { color: itemColor },
1548
- onClick: onWalletBalance,
1549
- children: [
1550
- /* @__PURE__ */ jsxs(
1551
- "svg",
1552
- {
1553
- width: "14",
1554
- height: "14",
1555
- viewBox: "0 0 24 24",
1556
- fill: "none",
1557
- stroke: "currentColor",
1558
- strokeWidth: "2",
1559
- strokeLinecap: "round",
1560
- strokeLinejoin: "round",
1561
- children: [
1562
- /* @__PURE__ */ jsx("rect", { x: "1", y: "4", width: "22", height: "16", rx: "2", ry: "2" }),
1563
- /* @__PURE__ */ jsx("circle", { cx: "16", cy: "12", r: "2" }),
1564
- /* @__PURE__ */ jsx("path", { d: "M22 8H12" })
1565
- ]
1566
- }
1567
- ),
1568
- "Wallet balance"
1569
- ]
1570
- }
1571
- ),
1572
- /* @__PURE__ */ jsxs(
1573
- "button",
1574
- {
1575
- className: "wallet-dropdown-item",
1576
- style: { color: itemColor },
1577
- onClick: onTxHistory,
1578
- children: [
1579
- /* @__PURE__ */ jsxs(
1580
- "svg",
1581
- {
1582
- width: "14",
1583
- height: "14",
1584
- viewBox: "0 0 24 24",
1585
- fill: "none",
1586
- stroke: "currentColor",
1587
- strokeWidth: "2",
1588
- strokeLinecap: "round",
1589
- strokeLinejoin: "round",
1590
- children: [
1591
- /* @__PURE__ */ jsx("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
1592
- /* @__PURE__ */ jsx("polyline", { points: "14,2 14,8 20,8" }),
1593
- /* @__PURE__ */ jsx("line", { x1: "16", y1: "13", x2: "8", y2: "13" }),
1594
- /* @__PURE__ */ jsx("line", { x1: "16", y1: "17", x2: "8", y2: "17" }),
1595
- /* @__PURE__ */ jsx("polyline", { points: "10,9 9,9 8,9" })
1596
- ]
1597
- }
1598
- ),
1599
- "Transaction history"
1600
- ]
1601
- }
1602
- ),
3148
+ /* @__PURE__ */ jsxs("button", { className: "wallet-dropdown-item", style: { color: itemColor }, onClick: onWalletBalance, children: [
3149
+ /* @__PURE__ */ jsxs("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
3150
+ /* @__PURE__ */ jsx("rect", { x: "1", y: "4", width: "22", height: "16", rx: "2", ry: "2" }),
3151
+ /* @__PURE__ */ jsx("circle", { cx: "16", cy: "12", r: "2" }),
3152
+ /* @__PURE__ */ jsx("path", { d: "M22 8H12" })
3153
+ ] }),
3154
+ "Wallet balance"
3155
+ ] }),
3156
+ /* @__PURE__ */ jsxs("button", { className: "wallet-dropdown-item", style: { color: itemColor }, onClick: onTxHistory, children: [
3157
+ /* @__PURE__ */ jsxs("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
3158
+ /* @__PURE__ */ jsx("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
3159
+ /* @__PURE__ */ jsx("polyline", { points: "14,2 14,8 20,8" }),
3160
+ /* @__PURE__ */ jsx("line", { x1: "16", y1: "13", x2: "8", y2: "13" }),
3161
+ /* @__PURE__ */ jsx("line", { x1: "16", y1: "17", x2: "8", y2: "17" }),
3162
+ /* @__PURE__ */ jsx("polyline", { points: "10,9 9,9 8,9" })
3163
+ ] }),
3164
+ "Transaction history"
3165
+ ] }),
3166
+ /* @__PURE__ */ jsx("div", { className: "wallet-dropdown-divider" }),
1603
3167
  /* @__PURE__ */ jsxs("button", { className: "wallet-dropdown-item danger", onClick: onLogout, children: [
1604
- /* @__PURE__ */ jsxs(
1605
- "svg",
1606
- {
1607
- width: "14",
1608
- height: "14",
1609
- viewBox: "0 0 24 24",
1610
- fill: "none",
1611
- stroke: "currentColor",
1612
- strokeWidth: "2",
1613
- strokeLinecap: "round",
1614
- strokeLinejoin: "round",
1615
- children: [
1616
- /* @__PURE__ */ jsx("path", { d: "M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" }),
1617
- /* @__PURE__ */ jsx("polyline", { points: "16,17 21,12 16,7" }),
1618
- /* @__PURE__ */ jsx("line", { x1: "21", y1: "12", x2: "9", y2: "12" })
1619
- ]
1620
- }
1621
- ),
3168
+ /* @__PURE__ */ jsxs("svg", { width: "14", height: "14", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", strokeLinecap: "round", strokeLinejoin: "round", children: [
3169
+ /* @__PURE__ */ jsx("path", { d: "M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4" }),
3170
+ /* @__PURE__ */ jsx("polyline", { points: "16,17 21,12 16,7" }),
3171
+ /* @__PURE__ */ jsx("line", { x1: "21", y1: "12", x2: "9", y2: "12" })
3172
+ ] }),
1622
3173
  "Log out"
1623
3174
  ] })
1624
3175
  ] })
1625
3176
  ] });
1626
3177
  }
1627
3178
  function WalletButton() {
1628
- const { getClient, walletAddress, styles, openLoginModal, openTxHistoryModal, openWalletBalanceModal } = usePollar();
3179
+ const {
3180
+ getClient,
3181
+ walletAddress,
3182
+ styles,
3183
+ openLoginModal,
3184
+ openTxHistoryModal,
3185
+ openWalletBalanceModal,
3186
+ openSendModal,
3187
+ openReceiveModal,
3188
+ tx: transaction,
3189
+ walletType
3190
+ } = usePollar();
1629
3191
  const [open, setOpen] = useState(false);
1630
3192
  const [copied, setCopied] = useState(false);
1631
3193
  const wrapperRef = useRef(null);
3194
+ const isInProgress = transaction.step === "building" || transaction.step === "signing";
1632
3195
  const { theme = "light", accentColor = "#005DB4" } = styles;
1633
3196
  const isDark = theme === "dark";
1634
3197
  const dropdownBg = isDark ? "#18181b" : "#fff";
@@ -1661,6 +3224,14 @@ function WalletButton() {
1661
3224
  setOpen(false);
1662
3225
  openTxHistoryModal();
1663
3226
  }
3227
+ function handleSend() {
3228
+ setOpen(false);
3229
+ openSendModal();
3230
+ }
3231
+ function handleReceive() {
3232
+ setOpen(false);
3233
+ openReceiveModal();
3234
+ }
1664
3235
  return /* @__PURE__ */ jsx(
1665
3236
  WalletButtonTemplate,
1666
3237
  {
@@ -1672,16 +3243,20 @@ function WalletButton() {
1672
3243
  dropdownBorder,
1673
3244
  itemColor,
1674
3245
  wrapperRef,
3246
+ isInProgress,
3247
+ walletType,
1675
3248
  onToggleOpen: () => setOpen((v) => !v),
1676
3249
  onCopy: handleCopy,
1677
3250
  onWalletBalance: handleWalletBalance,
1678
3251
  onTxHistory: handleTxHistory,
3252
+ onSend: handleSend,
3253
+ onReceive: handleReceive,
1679
3254
  onLogout: handleLogout,
1680
3255
  onLogin: openLoginModal
1681
3256
  }
1682
3257
  );
1683
3258
  }
1684
3259
 
1685
- export { KycModal, KycModalTemplate, KycStatus, LoginModalTemplate, PollarProvider, RampWidget, RampWidgetTemplate, RouteDisplay, TransactionModalTemplate, TxHistoryModalTemplate, WalletBalanceModal, WalletBalanceModalTemplate, WalletButton, usePollar };
3260
+ export { KycModal, KycModalTemplate, KycStatus, LoginModalTemplate, PollarProvider, RampWidget, RampWidgetTemplate, ReceiveModal, ReceiveModalTemplate, RouteDisplay, SendModal, SendModalTemplate, TransactionModalTemplate, TxHistoryModalTemplate, TxStatusView, WalletBalanceModal, WalletBalanceModalTemplate, WalletButton, createPollarAdapterHook, usePollar };
1686
3261
  //# sourceMappingURL=index.mjs.map
1687
3262
  //# sourceMappingURL=index.mjs.map