@payai/x402-solana-react 2.0.0-canary.1 → 2.0.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/README.md +71 -62
- package/dist/hooks/useX402Payment.d.ts +2 -1
- package/dist/hooks/useX402Payment.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +152 -135
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -5
package/dist/index.mjs
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { jsx as a, jsxs as m, Fragment as
|
|
1
|
+
import { jsx as a, jsxs as m, Fragment as ve } from "react/jsx-runtime";
|
|
2
2
|
import * as A from "react";
|
|
3
|
-
import { useState as Y, useCallback as
|
|
3
|
+
import { useState as Y, useCallback as Se, useMemo as Ce, useRef as dt, useEffect as re } from "react";
|
|
4
4
|
import { ConnectionProvider as mt, WalletProvider as ut, useWallet as gt } from "@solana/wallet-adapter-react";
|
|
5
5
|
import { WalletModalProvider as ht, WalletMultiButton as bt } from "@solana/wallet-adapter-react-ui";
|
|
6
|
-
import { WalletAdapterNetwork as
|
|
6
|
+
import { WalletAdapterNetwork as Pe } from "@solana/wallet-adapter-base";
|
|
7
7
|
import { PhantomWalletAdapter as pt, SolflareWalletAdapter as ft } from "@solana/wallet-adapter-wallets";
|
|
8
8
|
import { Connection as Ge, PublicKey as Z, ComputeBudgetProgram as Be, TransactionMessage as xt, VersionedTransaction as kt, clusterApiUrl as wt } from "@solana/web3.js";
|
|
9
|
-
import { getAssociatedTokenAddress as Ne, getAccount as
|
|
9
|
+
import { getAssociatedTokenAddress as Ne, getAccount as vt, TOKEN_2022_PROGRAM_ID as Re, TOKEN_PROGRAM_ID as yt, getMint as Ft, createTransferCheckedInstruction as Ct } from "@solana/spl-token";
|
|
10
10
|
function Nt(t) {
|
|
11
11
|
return t === "solana" ? "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v" : "4zMMC9srt5Ri5X14GAgXhaHii3GnPAEERYPJgZJDncDU";
|
|
12
12
|
}
|
|
@@ -18,7 +18,7 @@ async function At(t, o, r) {
|
|
|
18
18
|
const n = r || Et(o), s = new Ge(n, "confirmed"), l = new Z(t), i = new Z(Nt(o)), u = await Ne(
|
|
19
19
|
i,
|
|
20
20
|
l
|
|
21
|
-
), g = await
|
|
21
|
+
), g = await vt(s, u);
|
|
22
22
|
return (Number(g.amount) / 1e6).toFixed(2);
|
|
23
23
|
} catch (n) {
|
|
24
24
|
return console.error("Error fetching USDC balance:", n), "0.00";
|
|
@@ -51,7 +51,7 @@ const Tt = (t, o) => {
|
|
|
51
51
|
nextPart: t,
|
|
52
52
|
validators: o,
|
|
53
53
|
classGroupId: r
|
|
54
|
-
}), he = "-", Ie = [],
|
|
54
|
+
}), he = "-", Ie = [], Mt = "arbitrary..", St = (t) => {
|
|
55
55
|
const o = Bt(t), {
|
|
56
56
|
conflictingClassGroups: r,
|
|
57
57
|
conflictingClassGroupModifiers: n
|
|
@@ -59,7 +59,7 @@ const Tt = (t, o) => {
|
|
|
59
59
|
return {
|
|
60
60
|
getClassGroupId: (i) => {
|
|
61
61
|
if (i.startsWith("[") && i.endsWith("]"))
|
|
62
|
-
return
|
|
62
|
+
return Pt(i);
|
|
63
63
|
const u = i.split(he), g = u[0] === "" && u.length > 1 ? 1 : 0;
|
|
64
64
|
return Ye(u, g, o);
|
|
65
65
|
},
|
|
@@ -88,9 +88,9 @@ const Tt = (t, o) => {
|
|
|
88
88
|
if (k.validator(u))
|
|
89
89
|
return k.classGroupId;
|
|
90
90
|
}
|
|
91
|
-
},
|
|
91
|
+
}, Pt = (t) => t.slice(1, -1).indexOf(":") === -1 ? void 0 : (() => {
|
|
92
92
|
const o = t.slice(1, -1), r = o.indexOf(":"), n = o.slice(0, r);
|
|
93
|
-
return n ?
|
|
93
|
+
return n ? Mt + n : void 0;
|
|
94
94
|
})(), Bt = (t) => {
|
|
95
95
|
const {
|
|
96
96
|
theme: o,
|
|
@@ -101,10 +101,10 @@ const Tt = (t, o) => {
|
|
|
101
101
|
const r = qe();
|
|
102
102
|
for (const n in t) {
|
|
103
103
|
const s = t[n];
|
|
104
|
-
|
|
104
|
+
Me(s, r, n, o);
|
|
105
105
|
}
|
|
106
106
|
return r;
|
|
107
|
-
},
|
|
107
|
+
}, Me = (t, o, r, n) => {
|
|
108
108
|
const s = t.length;
|
|
109
109
|
for (let l = 0; l < s; l++) {
|
|
110
110
|
const i = t[l];
|
|
@@ -125,7 +125,7 @@ const Tt = (t, o) => {
|
|
|
125
125
|
n.classGroupId = r;
|
|
126
126
|
}, Lt = (t, o, r, n) => {
|
|
127
127
|
if (Ut(t)) {
|
|
128
|
-
|
|
128
|
+
Me(t(n), o, r, n);
|
|
129
129
|
return;
|
|
130
130
|
}
|
|
131
131
|
o.validators === null && (o.validators = []), o.validators.push(Dt(r, t));
|
|
@@ -133,7 +133,7 @@ const Tt = (t, o) => {
|
|
|
133
133
|
const s = Object.entries(t), l = s.length;
|
|
134
134
|
for (let i = 0; i < l; i++) {
|
|
135
135
|
const [u, g] = s[i];
|
|
136
|
-
|
|
136
|
+
Me(g, He(o, u), r, n);
|
|
137
137
|
}
|
|
138
138
|
}, He = (t, o) => {
|
|
139
139
|
let r = t;
|
|
@@ -206,8 +206,8 @@ const Tt = (t, o) => {
|
|
|
206
206
|
*/
|
|
207
207
|
w.startsWith(Ee) && (d = w.slice(1), T = !0)
|
|
208
208
|
);
|
|
209
|
-
const
|
|
210
|
-
return Le(l, T, d,
|
|
209
|
+
const M = p && p > g ? p - g : void 0;
|
|
210
|
+
return Le(l, T, d, M);
|
|
211
211
|
};
|
|
212
212
|
if (o) {
|
|
213
213
|
const s = o + ze, l = n;
|
|
@@ -238,7 +238,7 @@ const Tt = (t, o) => {
|
|
|
238
238
|
cache: _t(t.cacheSize),
|
|
239
239
|
parseClassName: Ot(t),
|
|
240
240
|
sortModifiers: Wt(t),
|
|
241
|
-
...
|
|
241
|
+
...St(t)
|
|
242
242
|
}), Vt = /\s+/, Kt = (t, o) => {
|
|
243
243
|
const {
|
|
244
244
|
parseClassName: r,
|
|
@@ -252,30 +252,30 @@ const Tt = (t, o) => {
|
|
|
252
252
|
isExternal: w,
|
|
253
253
|
modifiers: d,
|
|
254
254
|
hasImportantModifier: T,
|
|
255
|
-
baseClassName:
|
|
255
|
+
baseClassName: M,
|
|
256
256
|
maybePostfixModifierPosition: N
|
|
257
257
|
} = r(k);
|
|
258
258
|
if (w) {
|
|
259
259
|
g = k + (g.length > 0 ? " " + g : g);
|
|
260
260
|
continue;
|
|
261
261
|
}
|
|
262
|
-
let E = !!N,
|
|
263
|
-
if (!
|
|
262
|
+
let E = !!N, P = n(E ? M.substring(0, N) : M);
|
|
263
|
+
if (!P) {
|
|
264
264
|
if (!E) {
|
|
265
265
|
g = k + (g.length > 0 ? " " + g : g);
|
|
266
266
|
continue;
|
|
267
267
|
}
|
|
268
|
-
if (
|
|
268
|
+
if (P = n(M), !P) {
|
|
269
269
|
g = k + (g.length > 0 ? " " + g : g);
|
|
270
270
|
continue;
|
|
271
271
|
}
|
|
272
272
|
E = !1;
|
|
273
273
|
}
|
|
274
|
-
const I = d.length === 0 ? "" : d.length === 1 ? d[0] : l(d).join(":"), C = T ? I + Ee : I,
|
|
275
|
-
if (i.indexOf(
|
|
274
|
+
const I = d.length === 0 ? "" : d.length === 1 ? d[0] : l(d).join(":"), C = T ? I + Ee : I, y = C + P;
|
|
275
|
+
if (i.indexOf(y) > -1)
|
|
276
276
|
continue;
|
|
277
|
-
i.push(
|
|
278
|
-
const z = s(
|
|
277
|
+
i.push(y);
|
|
278
|
+
const z = s(P, E);
|
|
279
279
|
for (let L = 0; L < z.length; ++L) {
|
|
280
280
|
const $ = z[L];
|
|
281
281
|
i.push(C + $);
|
|
@@ -308,22 +308,22 @@ const Tt = (t, o) => {
|
|
|
308
308
|
return s(g, k), k;
|
|
309
309
|
};
|
|
310
310
|
return l = i, (...g) => l(qt(...g));
|
|
311
|
-
}, Ht = [],
|
|
311
|
+
}, Ht = [], S = (t) => {
|
|
312
312
|
const o = (r) => r[t] || Ht;
|
|
313
313
|
return o.isThemeGetter = !0, o;
|
|
314
|
-
}, Je = /^\[(?:(\w[\w-]*):)?(.+)\]$/i, Ze = /^\((?:(\w[\w-]*):)?(.+)\)$/i, Xt = /^\d+\/\d+$/, Jt = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/, Zt = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/, Qt = /^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/, er = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/, tr = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/, J = (t) => Xt.test(t),
|
|
314
|
+
}, Je = /^\[(?:(\w[\w-]*):)?(.+)\]$/i, Ze = /^\((?:(\w[\w-]*):)?(.+)\)$/i, Xt = /^\d+\/\d+$/, Jt = /^(\d+(\.\d+)?)?(xs|sm|md|lg|xl)$/, Zt = /\d+(%|px|r?em|[sdl]?v([hwib]|min|max)|pt|pc|in|cm|mm|cap|ch|ex|r?lh|cq(w|h|i|b|min|max))|\b(calc|min|max|clamp)\(.+\)|^0$/, Qt = /^(rgba?|hsla?|hwb|(ok)?(lab|lch)|color-mix)\(.+\)$/, er = /^(inset_)?-?((\d+)?\.?(\d+)[a-z]+|0)_-?((\d+)?\.?(\d+)[a-z]+|0)/, tr = /^(url|image|image-set|cross-fade|element|(repeating-)?(linear|radial|conic)-gradient)\(.+\)$/, J = (t) => Xt.test(t), v = (t) => !!t && !Number.isNaN(Number(t)), q = (t) => !!t && Number.isInteger(Number(t)), ye = (t) => t.endsWith("%") && v(t.slice(0, -1)), V = (t) => Jt.test(t), rr = () => !0, or = (t) => (
|
|
315
315
|
// `colorFunctionRegex` check is necessary because color functions can have percentages in them which which would be incorrectly classified as lengths.
|
|
316
316
|
// For example, `hsl(0 0% 0%)` would be classified as a length without this check.
|
|
317
317
|
// I could also use lookbehind assertion in `lengthUnitRegex` but that isn't supported widely enough.
|
|
318
318
|
Zt.test(t) && !Qt.test(t)
|
|
319
|
-
), Qe = () => !1, nr = (t) => er.test(t), ar = (t) => tr.test(t), lr = (t) => !h(t) && !b(t), sr = (t) => Q(t, rt, Qe), h = (t) => Je.test(t), H = (t) => Q(t, ot, or), Fe = (t) => Q(t, ur,
|
|
319
|
+
), Qe = () => !1, nr = (t) => er.test(t), ar = (t) => tr.test(t), lr = (t) => !h(t) && !b(t), sr = (t) => Q(t, rt, Qe), h = (t) => Je.test(t), H = (t) => Q(t, ot, or), Fe = (t) => Q(t, ur, v), je = (t) => Q(t, et, Qe), ir = (t) => Q(t, tt, ar), me = (t) => Q(t, nt, nr), b = (t) => Ze.test(t), oe = (t) => ee(t, ot), cr = (t) => ee(t, gr), Ue = (t) => ee(t, et), dr = (t) => ee(t, rt), mr = (t) => ee(t, tt), ue = (t) => ee(t, nt, !0), Q = (t, o, r) => {
|
|
320
320
|
const n = Je.exec(t);
|
|
321
321
|
return n ? n[1] ? o(n[1]) : r(n[2]) : !1;
|
|
322
322
|
}, ee = (t, o, r = !1) => {
|
|
323
323
|
const n = Ze.exec(t);
|
|
324
324
|
return n ? n[1] ? o(n[1]) : r : !1;
|
|
325
325
|
}, et = (t) => t === "position" || t === "percentage", tt = (t) => t === "image" || t === "url", rt = (t) => t === "length" || t === "size" || t === "bg-size", ot = (t) => t === "length", ur = (t) => t === "number", gr = (t) => t === "family-name", nt = (t) => t === "shadow", hr = () => {
|
|
326
|
-
const t =
|
|
326
|
+
const t = S("color"), o = S("font"), r = S("text"), n = S("font-weight"), s = S("tracking"), l = S("leading"), i = S("breakpoint"), u = S("container"), g = S("spacing"), p = S("radius"), k = S("shadow"), w = S("inset-shadow"), d = S("text-shadow"), T = S("drop-shadow"), M = S("blur"), N = S("perspective"), E = S("aspect"), P = S("ease"), I = S("animate"), C = () => ["auto", "avoid", "all", "avoid-page", "page", "left", "right", "column"], y = () => [
|
|
327
327
|
"center",
|
|
328
328
|
"top",
|
|
329
329
|
"bottom",
|
|
@@ -341,15 +341,15 @@ const Tt = (t, o) => {
|
|
|
341
341
|
"bottom-left",
|
|
342
342
|
// Deprecated since Tailwind CSS v4.1.0, see https://github.com/tailwindlabs/tailwindcss/pull/17378
|
|
343
343
|
"left-bottom"
|
|
344
|
-
], z = () => [...
|
|
344
|
+
], z = () => [...y(), b, h], L = () => ["auto", "hidden", "clip", "visible", "scroll"], $ = () => ["auto", "contain", "none"], x = () => [b, h, g], e = () => [J, "full", "auto", ...x()], j = () => [q, "none", "subgrid", b, h], te = () => ["auto", {
|
|
345
345
|
span: ["full", q, b, h]
|
|
346
|
-
}, q, b, h], W = () => [q, "auto", b, h], ne = () => ["auto", "min", "max", "fr", b, h], K = () => ["start", "end", "center", "between", "around", "evenly", "stretch", "baseline", "center-safe", "end-safe"], G = () => ["start", "end", "center", "stretch", "center-safe", "end-safe"], R = () => ["auto", ...x()], O = () => [J, "auto", "full", "dvw", "dvh", "lvw", "lvh", "svw", "svh", "min", "max", "fit", ...x()], f = () => [t, b, h], ae = () => [...
|
|
346
|
+
}, q, b, h], W = () => [q, "auto", b, h], ne = () => ["auto", "min", "max", "fr", b, h], K = () => ["start", "end", "center", "between", "around", "evenly", "stretch", "baseline", "center-safe", "end-safe"], G = () => ["start", "end", "center", "stretch", "center-safe", "end-safe"], R = () => ["auto", ...x()], O = () => [J, "auto", "full", "dvw", "dvh", "lvw", "lvh", "svw", "svh", "min", "max", "fit", ...x()], f = () => [t, b, h], ae = () => [...y(), Ue, je, {
|
|
347
347
|
position: [b, h]
|
|
348
348
|
}], le = () => ["no-repeat", {
|
|
349
349
|
repeat: ["", "x", "y", "space", "round"]
|
|
350
350
|
}], se = () => ["auto", "cover", "contain", dr, sr, {
|
|
351
351
|
size: [b, h]
|
|
352
|
-
}], X = () => [
|
|
352
|
+
}], X = () => [ye, oe, H], B = () => [
|
|
353
353
|
// Deprecated since Tailwind CSS v4.0.0
|
|
354
354
|
"",
|
|
355
355
|
"none",
|
|
@@ -357,14 +357,14 @@ const Tt = (t, o) => {
|
|
|
357
357
|
p,
|
|
358
358
|
b,
|
|
359
359
|
h
|
|
360
|
-
], U = () => ["",
|
|
360
|
+
], U = () => ["", v, oe, H], _ = () => ["solid", "dashed", "dotted", "double"], D = () => ["normal", "multiply", "screen", "overlay", "darken", "lighten", "color-dodge", "color-burn", "hard-light", "soft-light", "difference", "exclusion", "hue", "saturation", "color", "luminosity"], F = () => [v, ye, Ue, je], ke = () => [
|
|
361
361
|
// Deprecated since Tailwind CSS v4.0.0
|
|
362
362
|
"",
|
|
363
363
|
"none",
|
|
364
|
-
|
|
364
|
+
M,
|
|
365
365
|
b,
|
|
366
366
|
h
|
|
367
|
-
], ie = () => ["none",
|
|
367
|
+
], ie = () => ["none", v, b, h], ce = () => ["none", v, b, h], we = () => [v, b, h], de = () => [J, "full", ...x()];
|
|
368
368
|
return {
|
|
369
369
|
cacheSize: 500,
|
|
370
370
|
theme: {
|
|
@@ -383,7 +383,7 @@ const Tt = (t, o) => {
|
|
|
383
383
|
perspective: ["dramatic", "near", "normal", "midrange", "distant", "none"],
|
|
384
384
|
radius: [V],
|
|
385
385
|
shadow: [V],
|
|
386
|
-
spacing: ["px",
|
|
386
|
+
spacing: ["px", v],
|
|
387
387
|
text: [V],
|
|
388
388
|
"text-shadow": [V],
|
|
389
389
|
tracking: ["tighter", "tight", "normal", "wide", "wider", "widest"]
|
|
@@ -410,7 +410,7 @@ const Tt = (t, o) => {
|
|
|
410
410
|
* @see https://tailwindcss.com/docs/columns
|
|
411
411
|
*/
|
|
412
412
|
columns: [{
|
|
413
|
-
columns: [
|
|
413
|
+
columns: [v, h, b, u]
|
|
414
414
|
}],
|
|
415
415
|
/**
|
|
416
416
|
* Break After
|
|
@@ -641,21 +641,21 @@ const Tt = (t, o) => {
|
|
|
641
641
|
* @see https://tailwindcss.com/docs/flex
|
|
642
642
|
*/
|
|
643
643
|
flex: [{
|
|
644
|
-
flex: [
|
|
644
|
+
flex: [v, J, "auto", "initial", "none", h]
|
|
645
645
|
}],
|
|
646
646
|
/**
|
|
647
647
|
* Flex Grow
|
|
648
648
|
* @see https://tailwindcss.com/docs/flex-grow
|
|
649
649
|
*/
|
|
650
650
|
grow: [{
|
|
651
|
-
grow: ["",
|
|
651
|
+
grow: ["", v, b, h]
|
|
652
652
|
}],
|
|
653
653
|
/**
|
|
654
654
|
* Flex Shrink
|
|
655
655
|
* @see https://tailwindcss.com/docs/flex-shrink
|
|
656
656
|
*/
|
|
657
657
|
shrink: [{
|
|
658
|
-
shrink: ["",
|
|
658
|
+
shrink: ["", v, b, h]
|
|
659
659
|
}],
|
|
660
660
|
/**
|
|
661
661
|
* Order
|
|
@@ -1081,7 +1081,7 @@ const Tt = (t, o) => {
|
|
|
1081
1081
|
* @see https://tailwindcss.com/docs/font-stretch
|
|
1082
1082
|
*/
|
|
1083
1083
|
"font-stretch": [{
|
|
1084
|
-
"font-stretch": ["ultra-condensed", "extra-condensed", "condensed", "semi-condensed", "normal", "semi-expanded", "expanded", "extra-expanded", "ultra-expanded",
|
|
1084
|
+
"font-stretch": ["ultra-condensed", "extra-condensed", "condensed", "semi-condensed", "normal", "semi-expanded", "expanded", "extra-expanded", "ultra-expanded", ye, h]
|
|
1085
1085
|
}],
|
|
1086
1086
|
/**
|
|
1087
1087
|
* Font Family
|
|
@@ -1132,7 +1132,7 @@ const Tt = (t, o) => {
|
|
|
1132
1132
|
* @see https://tailwindcss.com/docs/line-clamp
|
|
1133
1133
|
*/
|
|
1134
1134
|
"line-clamp": [{
|
|
1135
|
-
"line-clamp": [
|
|
1135
|
+
"line-clamp": [v, "none", b, Fe]
|
|
1136
1136
|
}],
|
|
1137
1137
|
/**
|
|
1138
1138
|
* Line Height
|
|
@@ -1205,7 +1205,7 @@ const Tt = (t, o) => {
|
|
|
1205
1205
|
* @see https://tailwindcss.com/docs/text-decoration-thickness
|
|
1206
1206
|
*/
|
|
1207
1207
|
"text-decoration-thickness": [{
|
|
1208
|
-
decoration: [
|
|
1208
|
+
decoration: [v, "from-font", "auto", b, H]
|
|
1209
1209
|
}],
|
|
1210
1210
|
/**
|
|
1211
1211
|
* Text Decoration Color
|
|
@@ -1219,7 +1219,7 @@ const Tt = (t, o) => {
|
|
|
1219
1219
|
* @see https://tailwindcss.com/docs/text-underline-offset
|
|
1220
1220
|
*/
|
|
1221
1221
|
"underline-offset": [{
|
|
1222
|
-
"underline-offset": [
|
|
1222
|
+
"underline-offset": [v, "auto", b, h]
|
|
1223
1223
|
}],
|
|
1224
1224
|
/**
|
|
1225
1225
|
* Text Transform
|
|
@@ -1685,14 +1685,14 @@ const Tt = (t, o) => {
|
|
|
1685
1685
|
* @see https://tailwindcss.com/docs/outline-offset
|
|
1686
1686
|
*/
|
|
1687
1687
|
"outline-offset": [{
|
|
1688
|
-
"outline-offset": [
|
|
1688
|
+
"outline-offset": [v, b, h]
|
|
1689
1689
|
}],
|
|
1690
1690
|
/**
|
|
1691
1691
|
* Outline Width
|
|
1692
1692
|
* @see https://tailwindcss.com/docs/outline-width
|
|
1693
1693
|
*/
|
|
1694
1694
|
"outline-w": [{
|
|
1695
|
-
outline: ["",
|
|
1695
|
+
outline: ["", v, oe, H]
|
|
1696
1696
|
}],
|
|
1697
1697
|
/**
|
|
1698
1698
|
* Outline Color
|
|
@@ -1767,7 +1767,7 @@ const Tt = (t, o) => {
|
|
|
1767
1767
|
* @see https://github.com/tailwindlabs/tailwindcss/blob/v4.0.0/packages/tailwindcss/src/utilities.ts#L4158
|
|
1768
1768
|
*/
|
|
1769
1769
|
"ring-offset-w": [{
|
|
1770
|
-
"ring-offset": [
|
|
1770
|
+
"ring-offset": [v, H]
|
|
1771
1771
|
}],
|
|
1772
1772
|
/**
|
|
1773
1773
|
* Ring Offset Color
|
|
@@ -1811,7 +1811,7 @@ const Tt = (t, o) => {
|
|
|
1811
1811
|
* @see https://tailwindcss.com/docs/opacity
|
|
1812
1812
|
*/
|
|
1813
1813
|
opacity: [{
|
|
1814
|
-
opacity: [
|
|
1814
|
+
opacity: [v, b, h]
|
|
1815
1815
|
}],
|
|
1816
1816
|
/**
|
|
1817
1817
|
* Mix Blend Mode
|
|
@@ -1846,7 +1846,7 @@ const Tt = (t, o) => {
|
|
|
1846
1846
|
* @see https://tailwindcss.com/docs/mask-image
|
|
1847
1847
|
*/
|
|
1848
1848
|
"mask-image-linear-pos": [{
|
|
1849
|
-
"mask-linear": [
|
|
1849
|
+
"mask-linear": [v]
|
|
1850
1850
|
}],
|
|
1851
1851
|
"mask-image-linear-from-pos": [{
|
|
1852
1852
|
"mask-linear-from": F()
|
|
@@ -1957,10 +1957,10 @@ const Tt = (t, o) => {
|
|
|
1957
1957
|
}]
|
|
1958
1958
|
}],
|
|
1959
1959
|
"mask-image-radial-pos": [{
|
|
1960
|
-
"mask-radial-at":
|
|
1960
|
+
"mask-radial-at": y()
|
|
1961
1961
|
}],
|
|
1962
1962
|
"mask-image-conic-pos": [{
|
|
1963
|
-
"mask-conic": [
|
|
1963
|
+
"mask-conic": [v]
|
|
1964
1964
|
}],
|
|
1965
1965
|
"mask-image-conic-from-pos": [{
|
|
1966
1966
|
"mask-conic-from": F()
|
|
@@ -2051,14 +2051,14 @@ const Tt = (t, o) => {
|
|
|
2051
2051
|
* @see https://tailwindcss.com/docs/brightness
|
|
2052
2052
|
*/
|
|
2053
2053
|
brightness: [{
|
|
2054
|
-
brightness: [
|
|
2054
|
+
brightness: [v, b, h]
|
|
2055
2055
|
}],
|
|
2056
2056
|
/**
|
|
2057
2057
|
* Contrast
|
|
2058
2058
|
* @see https://tailwindcss.com/docs/contrast
|
|
2059
2059
|
*/
|
|
2060
2060
|
contrast: [{
|
|
2061
|
-
contrast: [
|
|
2061
|
+
contrast: [v, b, h]
|
|
2062
2062
|
}],
|
|
2063
2063
|
/**
|
|
2064
2064
|
* Drop Shadow
|
|
@@ -2086,35 +2086,35 @@ const Tt = (t, o) => {
|
|
|
2086
2086
|
* @see https://tailwindcss.com/docs/grayscale
|
|
2087
2087
|
*/
|
|
2088
2088
|
grayscale: [{
|
|
2089
|
-
grayscale: ["",
|
|
2089
|
+
grayscale: ["", v, b, h]
|
|
2090
2090
|
}],
|
|
2091
2091
|
/**
|
|
2092
2092
|
* Hue Rotate
|
|
2093
2093
|
* @see https://tailwindcss.com/docs/hue-rotate
|
|
2094
2094
|
*/
|
|
2095
2095
|
"hue-rotate": [{
|
|
2096
|
-
"hue-rotate": [
|
|
2096
|
+
"hue-rotate": [v, b, h]
|
|
2097
2097
|
}],
|
|
2098
2098
|
/**
|
|
2099
2099
|
* Invert
|
|
2100
2100
|
* @see https://tailwindcss.com/docs/invert
|
|
2101
2101
|
*/
|
|
2102
2102
|
invert: [{
|
|
2103
|
-
invert: ["",
|
|
2103
|
+
invert: ["", v, b, h]
|
|
2104
2104
|
}],
|
|
2105
2105
|
/**
|
|
2106
2106
|
* Saturate
|
|
2107
2107
|
* @see https://tailwindcss.com/docs/saturate
|
|
2108
2108
|
*/
|
|
2109
2109
|
saturate: [{
|
|
2110
|
-
saturate: [
|
|
2110
|
+
saturate: [v, b, h]
|
|
2111
2111
|
}],
|
|
2112
2112
|
/**
|
|
2113
2113
|
* Sepia
|
|
2114
2114
|
* @see https://tailwindcss.com/docs/sepia
|
|
2115
2115
|
*/
|
|
2116
2116
|
sepia: [{
|
|
2117
|
-
sepia: ["",
|
|
2117
|
+
sepia: ["", v, b, h]
|
|
2118
2118
|
}],
|
|
2119
2119
|
/**
|
|
2120
2120
|
* Backdrop Filter
|
|
@@ -2141,56 +2141,56 @@ const Tt = (t, o) => {
|
|
|
2141
2141
|
* @see https://tailwindcss.com/docs/backdrop-brightness
|
|
2142
2142
|
*/
|
|
2143
2143
|
"backdrop-brightness": [{
|
|
2144
|
-
"backdrop-brightness": [
|
|
2144
|
+
"backdrop-brightness": [v, b, h]
|
|
2145
2145
|
}],
|
|
2146
2146
|
/**
|
|
2147
2147
|
* Backdrop Contrast
|
|
2148
2148
|
* @see https://tailwindcss.com/docs/backdrop-contrast
|
|
2149
2149
|
*/
|
|
2150
2150
|
"backdrop-contrast": [{
|
|
2151
|
-
"backdrop-contrast": [
|
|
2151
|
+
"backdrop-contrast": [v, b, h]
|
|
2152
2152
|
}],
|
|
2153
2153
|
/**
|
|
2154
2154
|
* Backdrop Grayscale
|
|
2155
2155
|
* @see https://tailwindcss.com/docs/backdrop-grayscale
|
|
2156
2156
|
*/
|
|
2157
2157
|
"backdrop-grayscale": [{
|
|
2158
|
-
"backdrop-grayscale": ["",
|
|
2158
|
+
"backdrop-grayscale": ["", v, b, h]
|
|
2159
2159
|
}],
|
|
2160
2160
|
/**
|
|
2161
2161
|
* Backdrop Hue Rotate
|
|
2162
2162
|
* @see https://tailwindcss.com/docs/backdrop-hue-rotate
|
|
2163
2163
|
*/
|
|
2164
2164
|
"backdrop-hue-rotate": [{
|
|
2165
|
-
"backdrop-hue-rotate": [
|
|
2165
|
+
"backdrop-hue-rotate": [v, b, h]
|
|
2166
2166
|
}],
|
|
2167
2167
|
/**
|
|
2168
2168
|
* Backdrop Invert
|
|
2169
2169
|
* @see https://tailwindcss.com/docs/backdrop-invert
|
|
2170
2170
|
*/
|
|
2171
2171
|
"backdrop-invert": [{
|
|
2172
|
-
"backdrop-invert": ["",
|
|
2172
|
+
"backdrop-invert": ["", v, b, h]
|
|
2173
2173
|
}],
|
|
2174
2174
|
/**
|
|
2175
2175
|
* Backdrop Opacity
|
|
2176
2176
|
* @see https://tailwindcss.com/docs/backdrop-opacity
|
|
2177
2177
|
*/
|
|
2178
2178
|
"backdrop-opacity": [{
|
|
2179
|
-
"backdrop-opacity": [
|
|
2179
|
+
"backdrop-opacity": [v, b, h]
|
|
2180
2180
|
}],
|
|
2181
2181
|
/**
|
|
2182
2182
|
* Backdrop Saturate
|
|
2183
2183
|
* @see https://tailwindcss.com/docs/backdrop-saturate
|
|
2184
2184
|
*/
|
|
2185
2185
|
"backdrop-saturate": [{
|
|
2186
|
-
"backdrop-saturate": [
|
|
2186
|
+
"backdrop-saturate": [v, b, h]
|
|
2187
2187
|
}],
|
|
2188
2188
|
/**
|
|
2189
2189
|
* Backdrop Sepia
|
|
2190
2190
|
* @see https://tailwindcss.com/docs/backdrop-sepia
|
|
2191
2191
|
*/
|
|
2192
2192
|
"backdrop-sepia": [{
|
|
2193
|
-
"backdrop-sepia": ["",
|
|
2193
|
+
"backdrop-sepia": ["", v, b, h]
|
|
2194
2194
|
}],
|
|
2195
2195
|
// --------------
|
|
2196
2196
|
// --- Tables ---
|
|
@@ -2259,21 +2259,21 @@ const Tt = (t, o) => {
|
|
|
2259
2259
|
* @see https://tailwindcss.com/docs/transition-duration
|
|
2260
2260
|
*/
|
|
2261
2261
|
duration: [{
|
|
2262
|
-
duration: [
|
|
2262
|
+
duration: [v, "initial", b, h]
|
|
2263
2263
|
}],
|
|
2264
2264
|
/**
|
|
2265
2265
|
* Transition Timing Function
|
|
2266
2266
|
* @see https://tailwindcss.com/docs/transition-timing-function
|
|
2267
2267
|
*/
|
|
2268
2268
|
ease: [{
|
|
2269
|
-
ease: ["linear", "initial",
|
|
2269
|
+
ease: ["linear", "initial", P, b, h]
|
|
2270
2270
|
}],
|
|
2271
2271
|
/**
|
|
2272
2272
|
* Transition Delay
|
|
2273
2273
|
* @see https://tailwindcss.com/docs/transition-delay
|
|
2274
2274
|
*/
|
|
2275
2275
|
delay: [{
|
|
2276
|
-
delay: [
|
|
2276
|
+
delay: [v, b, h]
|
|
2277
2277
|
}],
|
|
2278
2278
|
/**
|
|
2279
2279
|
* Animation
|
|
@@ -2717,7 +2717,7 @@ const Tt = (t, o) => {
|
|
|
2717
2717
|
* @see https://tailwindcss.com/docs/stroke-width
|
|
2718
2718
|
*/
|
|
2719
2719
|
"stroke-w": [{
|
|
2720
|
-
stroke: [
|
|
2720
|
+
stroke: [v, oe, H, Fe]
|
|
2721
2721
|
}],
|
|
2722
2722
|
/**
|
|
2723
2723
|
* Stroke
|
|
@@ -2876,7 +2876,7 @@ function at(t) {
|
|
|
2876
2876
|
}
|
|
2877
2877
|
// @__NO_SIDE_EFFECTS__
|
|
2878
2878
|
function wr(t) {
|
|
2879
|
-
const o = /* @__PURE__ */
|
|
2879
|
+
const o = /* @__PURE__ */ yr(t), r = A.forwardRef((n, s) => {
|
|
2880
2880
|
let { children: l, ...i } = n;
|
|
2881
2881
|
at(l) && typeof fe == "function" && (l = fe(l._payload));
|
|
2882
2882
|
const u = A.Children.toArray(l), g = u.find(Cr);
|
|
@@ -2888,9 +2888,9 @@ function wr(t) {
|
|
|
2888
2888
|
});
|
|
2889
2889
|
return r.displayName = `${t}.Slot`, r;
|
|
2890
2890
|
}
|
|
2891
|
-
var
|
|
2891
|
+
var vr = /* @__PURE__ */ wr("Slot");
|
|
2892
2892
|
// @__NO_SIDE_EFFECTS__
|
|
2893
|
-
function
|
|
2893
|
+
function yr(t) {
|
|
2894
2894
|
const o = A.forwardRef((r, n) => {
|
|
2895
2895
|
let { children: s, ...l } = r;
|
|
2896
2896
|
if (at(s) && typeof fe == "function" && (s = fe(s._payload)), A.isValidElement(s)) {
|
|
@@ -2933,8 +2933,8 @@ const $e = (t) => typeof t == "boolean" ? `${t}` : t === 0 ? "0" : t, Oe = Ke, l
|
|
|
2933
2933
|
return d === void 0 || (p[w] = d), p;
|
|
2934
2934
|
}, {}), g = o == null || (n = o.compoundVariants) === null || n === void 0 ? void 0 : n.reduce((p, k) => {
|
|
2935
2935
|
let { class: w, className: d, ...T } = k;
|
|
2936
|
-
return Object.entries(T).every((
|
|
2937
|
-
let [N, E] =
|
|
2936
|
+
return Object.entries(T).every((M) => {
|
|
2937
|
+
let [N, E] = M;
|
|
2938
2938
|
return Array.isArray(E) ? E.includes({
|
|
2939
2939
|
...l,
|
|
2940
2940
|
...u
|
|
@@ -2975,7 +2975,7 @@ const $e = (t) => typeof t == "boolean" ? `${t}` : t === 0 ? "0" : t, Oe = Ke, l
|
|
|
2975
2975
|
}
|
|
2976
2976
|
), st = A.forwardRef(
|
|
2977
2977
|
({ className: t, variant: o, size: r, asChild: n = !1, ...s }, l) => /* @__PURE__ */ a(
|
|
2978
|
-
n ?
|
|
2978
|
+
n ? vr : "button",
|
|
2979
2979
|
{
|
|
2980
2980
|
className: c(Ar({ variant: o, size: r, className: t })),
|
|
2981
2981
|
ref: l,
|
|
@@ -3222,14 +3222,16 @@ const ct = ({
|
|
|
3222
3222
|
};
|
|
3223
3223
|
ct.displayName = "WalletSection";
|
|
3224
3224
|
var Dr = "solana:5eykt4UsFv8P8NJdTREpY1vzqKqZKvdp";
|
|
3225
|
-
function
|
|
3225
|
+
function Mr(t) {
|
|
3226
3226
|
return t === "solana" || t === "solana-devnet" || t.startsWith("solana:");
|
|
3227
3227
|
}
|
|
3228
|
-
function
|
|
3228
|
+
function Sr(t) {
|
|
3229
3229
|
return t === "solana" || t === Dr;
|
|
3230
3230
|
}
|
|
3231
|
-
function
|
|
3232
|
-
const n = Buffer.from(t.serialize()).toString(
|
|
3231
|
+
function Pr(t, o, r) {
|
|
3232
|
+
const n = Buffer.from(t.serialize()).toString(
|
|
3233
|
+
"base64"
|
|
3234
|
+
), s = {
|
|
3233
3235
|
x402Version: 2,
|
|
3234
3236
|
resource: {
|
|
3235
3237
|
url: r,
|
|
@@ -3241,16 +3243,20 @@ function Sr(t, o, r) {
|
|
|
3241
3243
|
transaction: n
|
|
3242
3244
|
}
|
|
3243
3245
|
};
|
|
3244
|
-
return Buffer.from(JSON.stringify(s)).toString(
|
|
3246
|
+
return Buffer.from(JSON.stringify(s)).toString(
|
|
3247
|
+
"base64"
|
|
3248
|
+
);
|
|
3245
3249
|
}
|
|
3246
3250
|
function Br(t) {
|
|
3247
|
-
return
|
|
3251
|
+
return Sr(t) ? "https://api.mainnet-beta.solana.com" : "https://api.devnet.solana.com";
|
|
3248
3252
|
}
|
|
3249
3253
|
var Rr = 7e3, Ir = 1;
|
|
3250
3254
|
async function zr(t, o, r) {
|
|
3251
3255
|
const n = new Ge(r, "confirmed"), s = o.extra?.feePayer;
|
|
3252
3256
|
if (!s)
|
|
3253
|
-
throw new Error(
|
|
3257
|
+
throw new Error(
|
|
3258
|
+
"Missing facilitator feePayer in payment requirements (extra.feePayer)."
|
|
3259
|
+
);
|
|
3254
3260
|
const l = new Z(s), i = t?.publicKey?.toString() || t?.address;
|
|
3255
3261
|
if (!i)
|
|
3256
3262
|
throw new Error("Missing connected Solana wallet address or publicKey");
|
|
@@ -3270,12 +3276,25 @@ async function zr(t, o, r) {
|
|
|
3270
3276
|
microLamports: Ir
|
|
3271
3277
|
})
|
|
3272
3278
|
);
|
|
3273
|
-
const d = (await n.getAccountInfo(p, "confirmed"))?.owner?.toBase58() === Re.toBase58() ? Re :
|
|
3274
|
-
|
|
3279
|
+
const d = (await n.getAccountInfo(p, "confirmed"))?.owner?.toBase58() === Re.toBase58() ? Re : yt, T = await Ft(n, p, void 0, d), M = await Ne(
|
|
3280
|
+
p,
|
|
3281
|
+
u,
|
|
3282
|
+
!1,
|
|
3283
|
+
d
|
|
3284
|
+
), N = await Ne(
|
|
3285
|
+
p,
|
|
3286
|
+
g,
|
|
3287
|
+
!1,
|
|
3288
|
+
d
|
|
3289
|
+
);
|
|
3290
|
+
if (!await n.getAccountInfo(M, "confirmed"))
|
|
3275
3291
|
throw new Error(
|
|
3276
3292
|
`User does not have an Associated Token Account for ${o.asset}. Please create one first or ensure you have the required token.`
|
|
3277
3293
|
);
|
|
3278
|
-
if (!await n.getAccountInfo(
|
|
3294
|
+
if (!await n.getAccountInfo(
|
|
3295
|
+
N,
|
|
3296
|
+
"confirmed"
|
|
3297
|
+
))
|
|
3279
3298
|
throw new Error(
|
|
3280
3299
|
`Destination does not have an Associated Token Account for ${o.asset}. The receiver must create their token account before receiving payments.`
|
|
3281
3300
|
);
|
|
@@ -3285,7 +3304,7 @@ async function zr(t, o, r) {
|
|
|
3285
3304
|
const C = BigInt(I);
|
|
3286
3305
|
k.push(
|
|
3287
3306
|
Ct(
|
|
3288
|
-
|
|
3307
|
+
M,
|
|
3289
3308
|
p,
|
|
3290
3309
|
N,
|
|
3291
3310
|
u,
|
|
@@ -3295,9 +3314,9 @@ async function zr(t, o, r) {
|
|
|
3295
3314
|
d
|
|
3296
3315
|
)
|
|
3297
3316
|
);
|
|
3298
|
-
const { blockhash:
|
|
3317
|
+
const { blockhash: y } = await n.getLatestBlockhash("confirmed"), z = new xt({
|
|
3299
3318
|
payerKey: l,
|
|
3300
|
-
recentBlockhash:
|
|
3319
|
+
recentBlockhash: y,
|
|
3301
3320
|
instructions: k
|
|
3302
3321
|
}).compileToV0Message(), L = new kt(z);
|
|
3303
3322
|
if (typeof t?.signTransaction != "function")
|
|
@@ -3318,7 +3337,7 @@ function Lr(t, o, r, n = BigInt(0), s = !1) {
|
|
|
3318
3337
|
const k = await p.json();
|
|
3319
3338
|
l("Payment requirements:", JSON.stringify(k, null, 2));
|
|
3320
3339
|
const w = k.accepts || [], d = w.find(
|
|
3321
|
-
(C) => C.scheme === "exact" &&
|
|
3340
|
+
(C) => C.scheme === "exact" && Mr(C.network)
|
|
3322
3341
|
);
|
|
3323
3342
|
if (!d)
|
|
3324
3343
|
throw console.error(
|
|
@@ -3330,7 +3349,7 @@ function Lr(t, o, r, n = BigInt(0), s = !1) {
|
|
|
3330
3349
|
);
|
|
3331
3350
|
if (n > BigInt(0) && T > n)
|
|
3332
3351
|
throw new Error("Payment amount exceeds maximum allowed");
|
|
3333
|
-
const
|
|
3352
|
+
const M = typeof i == "string" ? i : i.url;
|
|
3334
3353
|
l("Creating signed transaction...");
|
|
3335
3354
|
const N = await zr(
|
|
3336
3355
|
o,
|
|
@@ -3338,13 +3357,13 @@ function Lr(t, o, r, n = BigInt(0), s = !1) {
|
|
|
3338
3357
|
r
|
|
3339
3358
|
);
|
|
3340
3359
|
l("Transaction signed successfully");
|
|
3341
|
-
const E =
|
|
3360
|
+
const E = Pr(
|
|
3342
3361
|
N,
|
|
3343
3362
|
d,
|
|
3344
|
-
|
|
3363
|
+
M
|
|
3345
3364
|
);
|
|
3346
3365
|
l("Payment header created, length:", E.length);
|
|
3347
|
-
const
|
|
3366
|
+
const P = {
|
|
3348
3367
|
...u,
|
|
3349
3368
|
headers: {
|
|
3350
3369
|
...u?.headers || {},
|
|
@@ -3352,7 +3371,7 @@ function Lr(t, o, r, n = BigInt(0), s = !1) {
|
|
|
3352
3371
|
}
|
|
3353
3372
|
};
|
|
3354
3373
|
l("Retrying request with PAYMENT-SIGNATURE header...");
|
|
3355
|
-
const I = await t(i,
|
|
3374
|
+
const I = await t(i, P);
|
|
3356
3375
|
return l("Retry response status:", I.status), I;
|
|
3357
3376
|
};
|
|
3358
3377
|
}
|
|
@@ -3364,7 +3383,7 @@ var jr = class {
|
|
|
3364
3383
|
r,
|
|
3365
3384
|
t.wallet,
|
|
3366
3385
|
o,
|
|
3367
|
-
t.
|
|
3386
|
+
t.amount || BigInt(0),
|
|
3368
3387
|
t.verbose || !1
|
|
3369
3388
|
);
|
|
3370
3389
|
}
|
|
@@ -3380,17 +3399,15 @@ function Ur(t) {
|
|
|
3380
3399
|
return new jr(t);
|
|
3381
3400
|
}
|
|
3382
3401
|
function _r(t) {
|
|
3383
|
-
const [o, r] = Y("idle"), [n, s] = Y(null), [l, i] = Y(null), [u, g] = Y(null), [p, k] = Y(!1), w =
|
|
3402
|
+
const [o, r] = Y("idle"), [n, s] = Y(null), [l, i] = Y(null), [u, g] = Y(null), [p, k] = Y(!1), w = Se(() => {
|
|
3384
3403
|
r("idle"), s(null), i(null), g(null), k(!1);
|
|
3385
3404
|
}, []);
|
|
3386
3405
|
return {
|
|
3387
|
-
pay:
|
|
3388
|
-
async (T,
|
|
3406
|
+
pay: Se(
|
|
3407
|
+
async (T, M) => {
|
|
3389
3408
|
try {
|
|
3390
|
-
if (k(!0), r("pending"), s(null), t.
|
|
3391
|
-
throw new Error(
|
|
3392
|
-
`Payment amount ${T} exceeds maximum allowed ${t.maxPaymentAmount}`
|
|
3393
|
-
);
|
|
3409
|
+
if (k(!0), r("pending"), s(null), t.amount && T > t.amount)
|
|
3410
|
+
throw new Error(`Payment amount ${T} exceeds maximum allowed ${t.amount}`);
|
|
3394
3411
|
const N = t.wallet.publicKey?.toString() || t.wallet.address;
|
|
3395
3412
|
if (!N)
|
|
3396
3413
|
throw new Error("Wallet not connected");
|
|
@@ -3398,42 +3415,42 @@ function _r(t) {
|
|
|
3398
3415
|
wallet: t.wallet,
|
|
3399
3416
|
network: t.network,
|
|
3400
3417
|
rpcUrl: t.rpcUrl,
|
|
3401
|
-
|
|
3418
|
+
amount: t.amount ? BigInt(Math.floor(t.amount * 1e6)) : void 0,
|
|
3402
3419
|
verbose: t.verbose
|
|
3403
3420
|
});
|
|
3404
|
-
let
|
|
3405
|
-
t.network === "solana" ?
|
|
3406
|
-
const I = t.apiEndpoint ||
|
|
3421
|
+
let P;
|
|
3422
|
+
t.network === "solana" ? P = "https://x402.payai.network/api/solana/paid-content" : P = "https://x402.payai.network/api/solana-devnet/paid-content";
|
|
3423
|
+
const I = t.apiEndpoint || P, C = I === P;
|
|
3407
3424
|
t.verbose && console.log("Initiating x402 payment:", {
|
|
3408
3425
|
endpoint: I,
|
|
3409
3426
|
isDemo: C,
|
|
3410
3427
|
amount: T,
|
|
3411
|
-
description:
|
|
3428
|
+
description: M,
|
|
3412
3429
|
wallet: N,
|
|
3413
3430
|
network: t.network
|
|
3414
3431
|
});
|
|
3415
|
-
const
|
|
3432
|
+
const y = await E.fetch(I, {
|
|
3416
3433
|
method: "POST",
|
|
3417
3434
|
headers: {
|
|
3418
3435
|
"Content-Type": "application/json"
|
|
3419
3436
|
},
|
|
3420
3437
|
body: JSON.stringify({
|
|
3421
|
-
message:
|
|
3438
|
+
message: M,
|
|
3422
3439
|
amount: T
|
|
3423
3440
|
})
|
|
3424
3441
|
});
|
|
3425
|
-
if (!
|
|
3426
|
-
throw new Error(`Payment request failed: ${
|
|
3442
|
+
if (!y.ok)
|
|
3443
|
+
throw new Error(`Payment request failed: ${y.statusText}`);
|
|
3427
3444
|
let z, L = null;
|
|
3428
|
-
const $ =
|
|
3445
|
+
const $ = y.headers.get("content-type");
|
|
3429
3446
|
if ($ && $.includes("application/json"))
|
|
3430
|
-
z = await
|
|
3447
|
+
z = await y.json(), L = JSON.stringify(z);
|
|
3431
3448
|
else {
|
|
3432
|
-
const j = await
|
|
3449
|
+
const j = await y.text();
|
|
3433
3450
|
z = { content: j }, L = j;
|
|
3434
3451
|
}
|
|
3435
3452
|
g(L), t.verbose && console.log("Payment successful:", z);
|
|
3436
|
-
const x =
|
|
3453
|
+
const x = y.headers.get("PAYMENT-RESPONSE");
|
|
3437
3454
|
let e = `tx_${Date.now()}`;
|
|
3438
3455
|
if (x)
|
|
3439
3456
|
try {
|
|
@@ -3475,22 +3492,22 @@ const We = ({
|
|
|
3475
3492
|
maxPaymentAmount: T,
|
|
3476
3493
|
// enablePaymentCaching = false, // TODO: Implement in future
|
|
3477
3494
|
// autoRetry = false, // TODO: Implement in future
|
|
3478
|
-
onPaymentStart:
|
|
3495
|
+
onPaymentStart: M,
|
|
3479
3496
|
onPaymentSuccess: N,
|
|
3480
3497
|
onPaymentError: E,
|
|
3481
|
-
onWalletConnect:
|
|
3498
|
+
onWalletConnect: P,
|
|
3482
3499
|
children: I
|
|
3483
3500
|
}) => {
|
|
3484
|
-
const C = gt(),
|
|
3501
|
+
const C = gt(), y = Ce(() => r || {
|
|
3485
3502
|
publicKey: C.publicKey ? { toString: () => C.publicKey.toString() } : void 0,
|
|
3486
3503
|
signTransaction: C.signTransaction
|
|
3487
3504
|
}, [r, C.publicKey, C.signTransaction]), [z, L] = Y(!1), [$, x] = Y("0.00"), [e, j] = Y(() => u === "system" ? typeof window < "u" && window.matchMedia ? window.matchMedia("(prefers-color-scheme: dark)").matches ? "dark" : "light" : "dark" : u), te = dt(null), W = n === "solana" ? "Mainnet" : "Devnet", { pay: ne, isLoading: K, status: G, error: R, transactionId: O, responseContent: f, reset: ae } = _r({
|
|
3488
|
-
wallet:
|
|
3505
|
+
wallet: y,
|
|
3489
3506
|
network: n,
|
|
3490
3507
|
rpcUrl: s,
|
|
3491
3508
|
apiEndpoint: l,
|
|
3492
3509
|
facilitatorUrl: i,
|
|
3493
|
-
|
|
3510
|
+
amount: T
|
|
3494
3511
|
}), le = () => {
|
|
3495
3512
|
k ? k() : !r && C.disconnect && C.disconnect();
|
|
3496
3513
|
}, se = r ? !!(r.publicKey || r.address) : !!(C.connected || C.publicKey);
|
|
@@ -3517,7 +3534,7 @@ const We = ({
|
|
|
3517
3534
|
};
|
|
3518
3535
|
}, [u, e]), re(() => {
|
|
3519
3536
|
const D = C.publicKey?.toString() || r?.publicKey?.toString() || r?.address;
|
|
3520
|
-
D && C.connected && (console.log("Wallet connected:", D),
|
|
3537
|
+
D && C.connected && (console.log("Wallet connected:", D), P?.(D), At(D, n, s).then(x)), !C.connected && !r && x("0.00");
|
|
3521
3538
|
}, [
|
|
3522
3539
|
C.publicKey,
|
|
3523
3540
|
C.connected,
|
|
@@ -3525,17 +3542,17 @@ const We = ({
|
|
|
3525
3542
|
r,
|
|
3526
3543
|
n,
|
|
3527
3544
|
s,
|
|
3528
|
-
|
|
3545
|
+
P
|
|
3529
3546
|
]), re(() => {
|
|
3530
3547
|
G === "success" && O && (L(!0), N?.(O, f));
|
|
3531
3548
|
}, [G, O, f, N]), re(() => {
|
|
3532
3549
|
R && E?.(R);
|
|
3533
3550
|
}, [R, E]);
|
|
3534
3551
|
const X = async () => {
|
|
3535
|
-
|
|
3552
|
+
M?.(), await ne(t, o);
|
|
3536
3553
|
};
|
|
3537
3554
|
if (z)
|
|
3538
|
-
return /* @__PURE__ */ a(
|
|
3555
|
+
return /* @__PURE__ */ a(ve, { children: I });
|
|
3539
3556
|
const B = R && (e === "dark" || e === "solana-dark" || e === "light" || e === "solana-light" || e === "seeker" || e === "seeker-2" || e === "seeker-light" || e === "terminal" || e === "terminal-light"), _ = (() => {
|
|
3540
3557
|
switch (e) {
|
|
3541
3558
|
case "solana-dark":
|
|
@@ -4336,7 +4353,7 @@ const We = ({
|
|
|
4336
4353
|
)
|
|
4337
4354
|
] })
|
|
4338
4355
|
] }),
|
|
4339
|
-
/* @__PURE__ */ a(pe, { className: "space-y-6", children: B ? /* @__PURE__ */ m(
|
|
4356
|
+
/* @__PURE__ */ a(pe, { className: "space-y-6", children: B ? /* @__PURE__ */ m(ve, { children: [
|
|
4340
4357
|
/* @__PURE__ */ a("div", { className: "flex justify-center mb-4", children: /* @__PURE__ */ a("div", { className: "w-16 h-16 rounded-full bg-red-500 flex items-center justify-center", children: /* @__PURE__ */ a(
|
|
4341
4358
|
"svg",
|
|
4342
4359
|
{
|
|
@@ -4416,7 +4433,7 @@ const We = ({
|
|
|
4416
4433
|
"text-sm",
|
|
4417
4434
|
e === "dark" || e === "solana-dark" || e === "seeker" || e === "seeker-2" ? "text-white" : "text-slate-900"
|
|
4418
4435
|
),
|
|
4419
|
-
children:
|
|
4436
|
+
children: y?.publicKey?.toString() ? `${y.publicKey.toString().slice(0, 6)}...${y.publicKey.toString().slice(-4)}` : y?.address ? `${y.address.slice(0, 6)}...${y.address.slice(
|
|
4420
4437
|
-4
|
|
4421
4438
|
)}` : "Not connected"
|
|
4422
4439
|
}
|
|
@@ -4545,7 +4562,7 @@ const We = ({
|
|
|
4545
4562
|
ae(), X();
|
|
4546
4563
|
},
|
|
4547
4564
|
loading: K,
|
|
4548
|
-
disabled: K || !
|
|
4565
|
+
disabled: K || !y?.publicKey,
|
|
4549
4566
|
className: c(
|
|
4550
4567
|
"w-full h-12",
|
|
4551
4568
|
e === "dark" || e === "solana-dark" ? e === "dark" ? "bg-[#FFFFFF1F] rounded-full" : "bg-solana-gradient rounded-full" : e === "light" ? "bg-black hover:bg-gray-800 text-white font-light rounded-full" : e === "solana-light" ? "bg-solana-gradient hover:opacity-90 text-white font-light rounded-full" : e === "seeker" || e === "seeker-2" ? "bg-gradient-to-r from-emerald-500 to-teal-500 hover:from-emerald-600 hover:to-teal-600 text-white rounded-full" : e === "seeker-light" ? "text-white rounded-full" : e === "terminal" || e === "terminal-light" ? "text-black hover:opacity-90 font-vt323 rounded-none" : "bg-solana-gradient rounded-full",
|
|
@@ -4634,11 +4651,11 @@ const We = ({
|
|
|
4634
4651
|
]
|
|
4635
4652
|
}
|
|
4636
4653
|
) })
|
|
4637
|
-
] }) : /* @__PURE__ */ m(
|
|
4654
|
+
] }) : /* @__PURE__ */ m(ve, { children: [
|
|
4638
4655
|
/* @__PURE__ */ a(
|
|
4639
4656
|
ct,
|
|
4640
4657
|
{
|
|
4641
|
-
wallet:
|
|
4658
|
+
wallet: y,
|
|
4642
4659
|
onDisconnect: le,
|
|
4643
4660
|
theme: u,
|
|
4644
4661
|
className: c(
|
|
@@ -4680,10 +4697,10 @@ const We = ({
|
|
|
4680
4697
|
/* @__PURE__ */ m("div", { className: "space-y-3", children: [
|
|
4681
4698
|
/* @__PURE__ */ m("div", { className: "flex items-center justify-between", children: [
|
|
4682
4699
|
/* @__PURE__ */ a("span", { className: "text-sm text-white", children: "Wallet" }),
|
|
4683
|
-
/* @__PURE__ */ a("div", { className: "text-sm text-white", children:
|
|
4700
|
+
/* @__PURE__ */ a("div", { className: "text-sm text-white", children: y?.publicKey?.toString() ? `${y.publicKey.toString().slice(0, 6)}...${y.publicKey.toString().slice(-4)}` : y?.address ? `${y.address.slice(
|
|
4684
4701
|
0,
|
|
4685
4702
|
6
|
|
4686
|
-
)}...${
|
|
4703
|
+
)}...${y.address.slice(-4)}` : "Not connected" })
|
|
4687
4704
|
] }),
|
|
4688
4705
|
/* @__PURE__ */ m("div", { className: "flex items-center justify-between", children: [
|
|
4689
4706
|
/* @__PURE__ */ a("span", { className: "text-sm text-white", children: "Available Balance" }),
|
|
@@ -4782,10 +4799,10 @@ const We = ({
|
|
|
4782
4799
|
"text-sm",
|
|
4783
4800
|
e === "dark" || e === "solana-dark" ? "text-white" : e === "terminal-light" ? "text-black font-vt323" : e === "seeker-light" ? "text-black" : e === "terminal" ? "text-white font-vt323" : "text-slate-900"
|
|
4784
4801
|
),
|
|
4785
|
-
children:
|
|
4802
|
+
children: y?.publicKey?.toString() ? `${y.publicKey.toString().slice(0, 6)}...${y.publicKey.toString().slice(-4)}` : y?.address ? `${y.address.slice(
|
|
4786
4803
|
0,
|
|
4787
4804
|
6
|
|
4788
|
-
)}...${
|
|
4805
|
+
)}...${y.address.slice(-4)}` : "Not connected"
|
|
4789
4806
|
}
|
|
4790
4807
|
)
|
|
4791
4808
|
] }),
|
|
@@ -4909,7 +4926,7 @@ const We = ({
|
|
|
4909
4926
|
description: o,
|
|
4910
4927
|
onClick: X,
|
|
4911
4928
|
loading: K,
|
|
4912
|
-
disabled: K || !
|
|
4929
|
+
disabled: K || !y?.publicKey,
|
|
4913
4930
|
className: c(
|
|
4914
4931
|
"w-full h-12",
|
|
4915
4932
|
e === "dark" || e === "solana-dark" ? e === "dark" ? "bg-[#FFFFFF1F] rounded-full" : "bg-solana-gradient rounded-full" : _.button,
|
|
@@ -5006,7 +5023,7 @@ const We = ({
|
|
|
5006
5023
|
providerEndpoint: r,
|
|
5007
5024
|
...n
|
|
5008
5025
|
}) => {
|
|
5009
|
-
const s = o ?? (n.network === "solana" ?
|
|
5026
|
+
const s = o ?? (n.network === "solana" ? Pe.Mainnet : Pe.Devnet), l = Ce(
|
|
5010
5027
|
() => r || n.rpcUrl || wt(s),
|
|
5011
5028
|
[r, n.rpcUrl, s]
|
|
5012
5029
|
), i = Ce(() => [new pt(), new ft()], []);
|