@nexus-cross/crossx-sdk-core 2.2.0-beta.9 → 2.2.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.js
CHANGED
|
@@ -657,18 +657,18 @@ const Bt = "crossx_access_token", Mt = "crossx_refresh_token", Ft = "crossx_user
|
|
|
657
657
|
try {
|
|
658
658
|
const I = this.crypto.decodeJWT(e);
|
|
659
659
|
d.log("[CROSSx] Firebase JWT 필드:", Object.keys(I).join(", ")), x = (i = I.firebase) == null ? void 0 : i.sign_in_provider;
|
|
660
|
-
const
|
|
661
|
-
w = I.email ?? ((a =
|
|
660
|
+
const C = ((o = I.firebase) == null ? void 0 : o.identities) ?? {};
|
|
661
|
+
w = I.email ?? ((a = C.email) == null ? void 0 : a[0]), x === "google.com" ? _ = (c = C["google.com"]) == null ? void 0 : c[0] : x === "apple.com" && (_ = (l = C["apple.com"]) == null ? void 0 : l[0]), d.log("[CROSSx] OAuth provider sub 추출 — provider:", x, "hasProviderSub:", !!_, "email:", w ?? "(없음)");
|
|
662
662
|
} catch {
|
|
663
663
|
d.warn("[CROSSx] firebaseToken에서 providerSub 추출 실패");
|
|
664
664
|
}
|
|
665
665
|
if (p) {
|
|
666
666
|
const I = this.crypto.decodeJWT(p);
|
|
667
667
|
d.log("[CROSSx] access_token 디코딩 — sub:", I.sub, "exp:", I.exp, "필드:", Object.keys(I).join(", "));
|
|
668
|
-
const
|
|
669
|
-
if (n =
|
|
668
|
+
const C = await this.crypto.verifyJWT(p);
|
|
669
|
+
if (n = C.signatureVerified ?? !1, !C.valid)
|
|
670
670
|
throw d.error("[CROSSx] access_token 검증 실패"), new Error("유효하지 않은 access token");
|
|
671
|
-
const R =
|
|
671
|
+
const R = C.payload, L = R.email ?? w ?? r;
|
|
672
672
|
d.log(
|
|
673
673
|
"[CROSSx] email 소스 — CROSSx JWT:",
|
|
674
674
|
R.email ?? "(없음)",
|
|
@@ -1404,7 +1404,7 @@ function Ge(s, e, r, t = Et) {
|
|
|
1404
1404
|
return;
|
|
1405
1405
|
}
|
|
1406
1406
|
}
|
|
1407
|
-
function
|
|
1407
|
+
function Cs(s) {
|
|
1408
1408
|
const e = s.startsWith("0x") ? s.slice(2) : s;
|
|
1409
1409
|
if (!/^[0-9a-fA-F]+$/.test(e))
|
|
1410
1410
|
throw new f(
|
|
@@ -1417,7 +1417,7 @@ function Ns(s) {
|
|
|
1417
1417
|
`서명 길이가 유효하지 않습니다: ${Wt} hex 문자(65 바이트) 예상, 현재 ${e.length}`
|
|
1418
1418
|
);
|
|
1419
1419
|
}
|
|
1420
|
-
function
|
|
1420
|
+
function Ns(s) {
|
|
1421
1421
|
const e = s.startsWith("0x") ? s.slice(2) : s;
|
|
1422
1422
|
if (!/^[0-9a-fA-F]+$/.test(e))
|
|
1423
1423
|
throw new f(
|
|
@@ -1464,7 +1464,7 @@ function Ls(s) {
|
|
|
1464
1464
|
const t = Number(r);
|
|
1465
1465
|
return Number.isFinite(t) ? t : void 0;
|
|
1466
1466
|
}
|
|
1467
|
-
class
|
|
1467
|
+
class Ne {
|
|
1468
1468
|
constructor(e) {
|
|
1469
1469
|
this.deps = e, this.verifyPinMutex = null;
|
|
1470
1470
|
}
|
|
@@ -1537,7 +1537,7 @@ class Ce {
|
|
|
1537
1537
|
if (u.code === h.PIN_INVALID)
|
|
1538
1538
|
return { ok: !1, error: u.message };
|
|
1539
1539
|
if (u.code === h.PIN_LOCKED)
|
|
1540
|
-
return
|
|
1540
|
+
return Ne.buildPinLockedResult(u, a);
|
|
1541
1541
|
}
|
|
1542
1542
|
throw u;
|
|
1543
1543
|
}
|
|
@@ -1571,7 +1571,7 @@ class Ce {
|
|
|
1571
1571
|
return await e();
|
|
1572
1572
|
} catch (n) {
|
|
1573
1573
|
if (n instanceof f) {
|
|
1574
|
-
if (t =
|
|
1574
|
+
if (t = Ne.parsePinError(n, r), !t) throw n;
|
|
1575
1575
|
} else
|
|
1576
1576
|
throw n;
|
|
1577
1577
|
}
|
|
@@ -1585,7 +1585,7 @@ class Ce {
|
|
|
1585
1585
|
try {
|
|
1586
1586
|
return await e();
|
|
1587
1587
|
} catch (n) {
|
|
1588
|
-
if (n instanceof f && (t =
|
|
1588
|
+
if (n instanceof f && (t = Ne.parsePinError(n, r), t))
|
|
1589
1589
|
continue;
|
|
1590
1590
|
throw n;
|
|
1591
1591
|
}
|
|
@@ -1610,7 +1610,7 @@ class Ce {
|
|
|
1610
1610
|
return null;
|
|
1611
1611
|
}
|
|
1612
1612
|
static buildPinLockedResult(e, r) {
|
|
1613
|
-
const t =
|
|
1613
|
+
const t = Ne.parsePinError(e, r);
|
|
1614
1614
|
if (!t) return { ok: !1, error: e.message };
|
|
1615
1615
|
const { errorMessage: n, ...i } = t;
|
|
1616
1616
|
return { ok: !1, error: n, ...i };
|
|
@@ -1751,13 +1751,20 @@ class Ms {
|
|
|
1751
1751
|
if (d.log("[CROSSx] loadWalletAfterAuth 지갑 상태:", n), n !== "exists") return;
|
|
1752
1752
|
const i = await this.deps.walletProvider.getAddresses(t);
|
|
1753
1753
|
if (i.length > 0) {
|
|
1754
|
-
|
|
1755
|
-
|
|
1756
|
-
|
|
1757
|
-
|
|
1754
|
+
let a, c = !1;
|
|
1755
|
+
if (r) {
|
|
1756
|
+
const l = i.find(
|
|
1757
|
+
(u) => u.address.toLowerCase() === r.toLowerCase()
|
|
1758
|
+
);
|
|
1759
|
+
l ? a = l : (a = { address: r, index: 0 }, c = !0);
|
|
1760
|
+
} else e !== void 0 ? a = i.find((l) => l.index === e) ?? i[0] : a = i[0];
|
|
1761
|
+
c ? d.log(
|
|
1762
|
+
"[CROSSx] preferredWalletAddress 가 서버 캐시에 없음 — raw address 채택:",
|
|
1763
|
+
a.address
|
|
1764
|
+
) : d.log(
|
|
1758
1765
|
"[CROSSx] 캐시된 주소 로드 완료 (비밀번호 불필요):",
|
|
1759
|
-
|
|
1760
|
-
), this.deps.setActiveWallet(
|
|
1766
|
+
a.address
|
|
1767
|
+
), this.deps.setActiveWallet(a.address, a.index);
|
|
1761
1768
|
return;
|
|
1762
1769
|
}
|
|
1763
1770
|
d.log("[CROSSx] 주소 캐시 없음 — 비밀번호 확인 후 address(0) 조회"), await this.deps.pinOrchestrator.ensureVerifiedPin();
|
|
@@ -2307,7 +2314,7 @@ const Te = class Te extends ys {
|
|
|
2307
2314
|
walletPreferenceKey: Te.WALLET_PREF_KEY,
|
|
2308
2315
|
storage: this.storage,
|
|
2309
2316
|
pinStore: this.pinStore
|
|
2310
|
-
}), this.pinOrchestrator = new
|
|
2317
|
+
}), this.pinOrchestrator = new Ne({
|
|
2311
2318
|
confirmation: this.confirmation,
|
|
2312
2319
|
walletProvider: this.walletProvider,
|
|
2313
2320
|
pinStore: this.pinStore,
|
|
@@ -2440,7 +2447,7 @@ const Te = class Te extends ys {
|
|
|
2440
2447
|
Te.WALLET_PREF_KEY
|
|
2441
2448
|
).catch(() => null) : null, o = (e == null ? void 0 : e.preferredWalletIndex) ?? (i == null ? void 0 : i.index);
|
|
2442
2449
|
let a = (e == null ? void 0 : e.preferredWalletAddress) ?? (i == null ? void 0 : i.address), c = await this.tryRNBridgeBootstrap();
|
|
2443
|
-
if (
|
|
2450
|
+
if (this._rnBridgeWalletAddress && ((a == null ? void 0 : a.toLowerCase()) !== this._rnBridgeWalletAddress.toLowerCase() && d.log("[CROSSx] RN Bridge active wallet으로 preferredWalletAddress 갱신:", this._rnBridgeWalletAddress), a = this._rnBridgeWalletAddress), c || (c = await this.signInUseCase.restoreSession()), c != null && c.success)
|
|
2444
2451
|
if (this.applyAuthResult(c), this.address && (!a || this.address.toLowerCase() === a.toLowerCase()))
|
|
2445
2452
|
this.address && this.setActiveWallet(this.address, o ?? this.activeWalletIndex);
|
|
2446
2453
|
else try {
|
|
@@ -3093,7 +3100,7 @@ const Te = class Te extends ys {
|
|
|
3093
3100
|
n.address
|
|
3094
3101
|
)
|
|
3095
3102
|
});
|
|
3096
|
-
return
|
|
3103
|
+
return Cs(i.signature), {
|
|
3097
3104
|
chainId: e,
|
|
3098
3105
|
signature: i.signature,
|
|
3099
3106
|
address: n.address
|
|
@@ -3171,7 +3178,7 @@ const Te = class Te extends ys {
|
|
|
3171
3178
|
a
|
|
3172
3179
|
)
|
|
3173
3180
|
});
|
|
3174
|
-
return
|
|
3181
|
+
return Ns(o.signature), {
|
|
3175
3182
|
chainId: e,
|
|
3176
3183
|
signedTx: o.signature,
|
|
3177
3184
|
txHash: o.txHash ?? ""
|
|
@@ -3310,7 +3317,7 @@ const Te = class Te extends ys {
|
|
|
3310
3317
|
let g, _;
|
|
3311
3318
|
const x = this.waitForTxAndGetReceipt(a, e, { intervalMs: c, timeoutMs: l }).then((I) => {
|
|
3312
3319
|
g = I;
|
|
3313
|
-
const
|
|
3320
|
+
const C = BigInt(I.gasUsed) * BigInt(I.effectiveGasPrice), R = r.value ? BigInt(r.value) : 0n, L = Ge(r.value, u.symbol, u.decimals, this._config.displayDecimals), M = Ge("0x" + C.toString(16), u.symbol, u.decimals, this._config.displayDecimals), q = Ge("0x" + (R + C).toString(16), u.symbol, u.decimals, this._config.displayDecimals);
|
|
3314
3321
|
return {
|
|
3315
3322
|
chainId: e,
|
|
3316
3323
|
txHash: a,
|
|
@@ -4394,17 +4401,17 @@ function bn(s, e, r) {
|
|
|
4394
4401
|
const I = [];
|
|
4395
4402
|
for (; S < e; ) {
|
|
4396
4403
|
c = g();
|
|
4397
|
-
const
|
|
4398
|
-
I.push(
|
|
4404
|
+
const C = c.slice();
|
|
4405
|
+
I.push(C), S += c.length;
|
|
4399
4406
|
}
|
|
4400
4407
|
return Se(...I);
|
|
4401
4408
|
};
|
|
4402
4409
|
return (S, I) => {
|
|
4403
4410
|
p(), _(S);
|
|
4404
|
-
let
|
|
4405
|
-
for (; !(
|
|
4411
|
+
let C;
|
|
4412
|
+
for (; !(C = I(x())); )
|
|
4406
4413
|
_();
|
|
4407
|
-
return p(),
|
|
4414
|
+
return p(), C;
|
|
4408
4415
|
};
|
|
4409
4416
|
}
|
|
4410
4417
|
function Rt(s, e = {}, r = {}) {
|
|
@@ -4461,7 +4468,7 @@ function Ot(s, e, r) {
|
|
|
4461
4468
|
if (!s.eql(s.sqr(e), r))
|
|
4462
4469
|
throw new Error("Cannot find square root");
|
|
4463
4470
|
}
|
|
4464
|
-
function
|
|
4471
|
+
function Cr(s, e) {
|
|
4465
4472
|
const r = (s.ORDER + te) / Tr, t = s.pow(e, r);
|
|
4466
4473
|
return Ot(s, t, e), t;
|
|
4467
4474
|
}
|
|
@@ -4470,7 +4477,7 @@ function En(s, e) {
|
|
|
4470
4477
|
return Ot(s, a, e), a;
|
|
4471
4478
|
}
|
|
4472
4479
|
function An(s) {
|
|
4473
|
-
const e = rt(s), r =
|
|
4480
|
+
const e = rt(s), r = Nr(s), t = r(e, e.neg(e.ONE)), n = r(e, t), i = r(e, e.neg(t)), o = (s + vn) / Or;
|
|
4474
4481
|
return (a, c) => {
|
|
4475
4482
|
let l = a.pow(c, o), u = a.mul(l, t);
|
|
4476
4483
|
const p = a.mul(l, n), g = a.mul(l, i), _ = a.eql(a.sqr(u), c), x = a.eql(a.sqr(p), c);
|
|
@@ -4479,7 +4486,7 @@ function An(s) {
|
|
|
4479
4486
|
return Ot(a, S, c), S;
|
|
4480
4487
|
};
|
|
4481
4488
|
}
|
|
4482
|
-
function
|
|
4489
|
+
function Nr(s) {
|
|
4483
4490
|
if (s < Ir)
|
|
4484
4491
|
throw new Error("sqrt is not defined for small field");
|
|
4485
4492
|
let e = s - te, r = 0;
|
|
@@ -4491,7 +4498,7 @@ function Cr(s) {
|
|
|
4491
4498
|
if (t++ > 1e3)
|
|
4492
4499
|
throw new Error("Cannot find square root: probably non-prime P");
|
|
4493
4500
|
if (r === 1)
|
|
4494
|
-
return
|
|
4501
|
+
return Cr;
|
|
4495
4502
|
let i = n.pow(t, e);
|
|
4496
4503
|
const o = (e + te) / ke;
|
|
4497
4504
|
return function(c, l) {
|
|
@@ -4514,7 +4521,7 @@ function Cr(s) {
|
|
|
4514
4521
|
};
|
|
4515
4522
|
}
|
|
4516
4523
|
function In(s) {
|
|
4517
|
-
return s % Tr === Ir ?
|
|
4524
|
+
return s % Tr === Ir ? Cr : s % Rr === kr ? En : s % Or === Sn ? An(s) : Nr(s);
|
|
4518
4525
|
}
|
|
4519
4526
|
const Tn = [
|
|
4520
4527
|
"create",
|
|
@@ -4570,7 +4577,7 @@ function On(s, e) {
|
|
|
4570
4577
|
const r = e !== void 0 ? e : s.toString(2).length, t = Math.ceil(r / 8);
|
|
4571
4578
|
return { nBitLength: r, nByteLength: t };
|
|
4572
4579
|
}
|
|
4573
|
-
class
|
|
4580
|
+
class Cn {
|
|
4574
4581
|
constructor(e, r = {}) {
|
|
4575
4582
|
P(this, "ORDER");
|
|
4576
4583
|
P(this, "BITS");
|
|
@@ -4683,7 +4690,7 @@ class Nn {
|
|
|
4683
4690
|
}
|
|
4684
4691
|
}
|
|
4685
4692
|
function rt(s, e = {}) {
|
|
4686
|
-
return new
|
|
4693
|
+
return new Cn(s, e);
|
|
4687
4694
|
}
|
|
4688
4695
|
function Lr(s) {
|
|
4689
4696
|
if (typeof s != "bigint")
|
|
@@ -4695,7 +4702,7 @@ function Dr(s) {
|
|
|
4695
4702
|
const e = Lr(s);
|
|
4696
4703
|
return e + Math.ceil(e / 2);
|
|
4697
4704
|
}
|
|
4698
|
-
function
|
|
4705
|
+
function Nn(s, e, r = !1) {
|
|
4699
4706
|
V(s);
|
|
4700
4707
|
const t = s.length, n = Lr(e), i = Dr(e);
|
|
4701
4708
|
if (t < 16 || t < i || t > 1024)
|
|
@@ -5046,18 +5053,18 @@ function Un(s, e = {}) {
|
|
|
5046
5053
|
throw new Error("compression is not supported: Field does not have .isOdd()");
|
|
5047
5054
|
}
|
|
5048
5055
|
function p(F, m, y) {
|
|
5049
|
-
const { x: k, y:
|
|
5056
|
+
const { x: k, y: N } = m.toAffine(), B = t.toBytes(k);
|
|
5050
5057
|
if (Xe(y, "isCompressed"), y) {
|
|
5051
5058
|
u();
|
|
5052
|
-
const b = !t.isOdd(
|
|
5059
|
+
const b = !t.isOdd(N);
|
|
5053
5060
|
return Se(Hr(b), B);
|
|
5054
5061
|
} else
|
|
5055
|
-
return Se(Uint8Array.of(4), B, t.toBytes(
|
|
5062
|
+
return Se(Uint8Array.of(4), B, t.toBytes(N));
|
|
5056
5063
|
}
|
|
5057
5064
|
function g(F) {
|
|
5058
5065
|
V(F, void 0, "Point");
|
|
5059
|
-
const { publicKey: m, publicKeyUncompressed: y } = l, k = F.length,
|
|
5060
|
-
if (k === m && (
|
|
5066
|
+
const { publicKey: m, publicKeyUncompressed: y } = l, k = F.length, N = F[0], B = F.subarray(1);
|
|
5067
|
+
if (k === m && (N === 2 || N === 3)) {
|
|
5061
5068
|
const b = t.fromBytes(B);
|
|
5062
5069
|
if (!t.isValid(b))
|
|
5063
5070
|
throw new Error("bad point: is not on curve, wrong x");
|
|
@@ -5071,8 +5078,8 @@ function Un(s, e = {}) {
|
|
|
5071
5078
|
}
|
|
5072
5079
|
u();
|
|
5073
5080
|
const T = t.isOdd(E);
|
|
5074
|
-
return (
|
|
5075
|
-
} else if (k === y &&
|
|
5081
|
+
return (N & 1) === 1 !== T && (E = t.neg(E)), { x: b, y: E };
|
|
5082
|
+
} else if (k === y && N === 4) {
|
|
5076
5083
|
const b = t.BYTES, v = t.fromBytes(B.subarray(0, b)), E = t.fromBytes(B.subarray(b, b * 2));
|
|
5077
5084
|
if (!S(v, E))
|
|
5078
5085
|
throw new Error("bad point: is not on curve");
|
|
@@ -5091,8 +5098,8 @@ function Un(s, e = {}) {
|
|
|
5091
5098
|
}
|
|
5092
5099
|
if (!S(i.Gx, i.Gy))
|
|
5093
5100
|
throw new Error("bad curve params: generator point");
|
|
5094
|
-
const I = t.mul(t.pow(i.a, ze), Fn),
|
|
5095
|
-
if (t.is0(t.add(I,
|
|
5101
|
+
const I = t.mul(t.pow(i.a, ze), Fn), C = t.mul(t.sqr(i.b), BigInt(27));
|
|
5102
|
+
if (t.is0(t.add(I, C)))
|
|
5096
5103
|
throw new Error("bad curve params: a or b");
|
|
5097
5104
|
function R(F, m, y = !1) {
|
|
5098
5105
|
if (!t.isValid(m) || y && t.is0(m))
|
|
@@ -5109,12 +5116,12 @@ function Un(s, e = {}) {
|
|
|
5109
5116
|
return Bn(F, c.basises, n.ORDER);
|
|
5110
5117
|
}
|
|
5111
5118
|
const q = Xt((F, m) => {
|
|
5112
|
-
const { X: y, Y: k, Z:
|
|
5113
|
-
if (t.eql(
|
|
5119
|
+
const { X: y, Y: k, Z: N } = F;
|
|
5120
|
+
if (t.eql(N, t.ONE))
|
|
5114
5121
|
return { x: y, y: k };
|
|
5115
5122
|
const B = F.is0();
|
|
5116
|
-
m == null && (m = B ? t.ONE : t.inv(
|
|
5117
|
-
const b = t.mul(y, m), v = t.mul(k, m), E = t.mul(
|
|
5123
|
+
m == null && (m = B ? t.ONE : t.inv(N));
|
|
5124
|
+
const b = t.mul(y, m), v = t.mul(k, m), E = t.mul(N, m);
|
|
5118
5125
|
if (B)
|
|
5119
5126
|
return { x: t.ZERO, y: t.ZERO };
|
|
5120
5127
|
if (!t.eql(E, t.ONE))
|
|
@@ -5135,8 +5142,8 @@ function Un(s, e = {}) {
|
|
|
5135
5142
|
throw new Error("bad point: not in prime-order subgroup");
|
|
5136
5143
|
return !0;
|
|
5137
5144
|
});
|
|
5138
|
-
function G(F, m, y, k,
|
|
5139
|
-
return y = new X(t.mul(y.X, F), y.Y, y.Z), m = Je(k, m), y = Je(
|
|
5145
|
+
function G(F, m, y, k, N) {
|
|
5146
|
+
return y = new X(t.mul(y.X, F), y.Y, y.Z), m = Je(k, m), y = Je(N, y), m.add(y);
|
|
5140
5147
|
}
|
|
5141
5148
|
const D = class D {
|
|
5142
5149
|
/** Does NOT validate if the point is valid. Use `.assertValidity()`. */
|
|
@@ -5194,7 +5201,7 @@ function Un(s, e = {}) {
|
|
|
5194
5201
|
/** Compare one point to another. */
|
|
5195
5202
|
equals(m) {
|
|
5196
5203
|
L(m);
|
|
5197
|
-
const { X: y, Y: k, Z:
|
|
5204
|
+
const { X: y, Y: k, Z: N } = this, { X: B, Y: b, Z: v } = m, E = t.eql(t.mul(y, v), t.mul(B, N)), T = t.eql(t.mul(k, v), t.mul(b, N));
|
|
5198
5205
|
return E && T;
|
|
5199
5206
|
}
|
|
5200
5207
|
/** Flips point to one corresponding to (x, -y) in Affine coordinates. */
|
|
@@ -5206,9 +5213,9 @@ function Un(s, e = {}) {
|
|
|
5206
5213
|
// https://eprint.iacr.org/2015/1060, algorithm 3
|
|
5207
5214
|
// Cost: 8M + 3S + 3*a + 2*b3 + 15add.
|
|
5208
5215
|
double() {
|
|
5209
|
-
const { a: m, b: y } = i, k = t.mul(y, ze), { X:
|
|
5210
|
-
let v = t.ZERO, E = t.ZERO, T = t.ZERO, O = t.mul(
|
|
5211
|
-
return $ = t.add($, $), T = t.mul(
|
|
5216
|
+
const { a: m, b: y } = i, k = t.mul(y, ze), { X: N, Y: B, Z: b } = this;
|
|
5217
|
+
let v = t.ZERO, E = t.ZERO, T = t.ZERO, O = t.mul(N, N), W = t.mul(B, B), U = t.mul(b, b), $ = t.mul(N, B);
|
|
5218
|
+
return $ = t.add($, $), T = t.mul(N, b), T = t.add(T, T), v = t.mul(m, T), E = t.mul(k, U), E = t.add(v, E), v = t.sub(W, E), E = t.add(W, E), E = t.mul(v, E), v = t.mul($, v), T = t.mul(k, T), U = t.mul(m, U), $ = t.sub(O, U), $ = t.mul(m, $), $ = t.add($, T), T = t.add(O, O), O = t.add(T, O), O = t.add(O, U), O = t.mul(O, $), E = t.add(E, O), U = t.mul(B, b), U = t.add(U, U), O = t.mul(U, $), v = t.sub(v, O), T = t.mul(U, W), T = t.add(T, T), T = t.add(T, T), new D(v, E, T);
|
|
5212
5219
|
}
|
|
5213
5220
|
// Renes-Costello-Batina exception-free addition formula.
|
|
5214
5221
|
// There is 30% faster Jacobian formula, but it is not complete.
|
|
@@ -5216,13 +5223,13 @@ function Un(s, e = {}) {
|
|
|
5216
5223
|
// Cost: 12M + 0S + 3*a + 3*b3 + 23add.
|
|
5217
5224
|
add(m) {
|
|
5218
5225
|
L(m);
|
|
5219
|
-
const { X: y, Y: k, Z:
|
|
5226
|
+
const { X: y, Y: k, Z: N } = this, { X: B, Y: b, Z: v } = m;
|
|
5220
5227
|
let E = t.ZERO, T = t.ZERO, O = t.ZERO;
|
|
5221
5228
|
const W = i.a, U = t.mul(i.b, ze);
|
|
5222
|
-
let $ = t.mul(y, B), K = t.mul(k, b), Y = t.mul(
|
|
5223
|
-
ne = t.mul(ne, z), z = t.add($, K), ne = t.sub(ne, z), z = t.add(y,
|
|
5229
|
+
let $ = t.mul(y, B), K = t.mul(k, b), Y = t.mul(N, v), ne = t.add(y, k), z = t.add(B, b);
|
|
5230
|
+
ne = t.mul(ne, z), z = t.add($, K), ne = t.sub(ne, z), z = t.add(y, N);
|
|
5224
5231
|
let ee = t.add(B, v);
|
|
5225
|
-
return z = t.mul(z, ee), ee = t.add($, Y), z = t.sub(z, ee), ee = t.add(k,
|
|
5232
|
+
return z = t.mul(z, ee), ee = t.add($, Y), z = t.sub(z, ee), ee = t.add(k, N), E = t.add(b, v), ee = t.mul(ee, E), E = t.add(K, Y), ee = t.sub(ee, E), O = t.mul(W, z), E = t.mul(U, Y), O = t.add(E, O), E = t.sub(K, O), O = t.add(K, O), T = t.mul(E, O), K = t.add($, $), K = t.add(K, $), Y = t.mul(W, Y), z = t.mul(U, z), K = t.add(K, Y), Y = t.sub($, Y), Y = t.mul(W, Y), z = t.add(z, Y), $ = t.mul(K, z), T = t.add(T, $), $ = t.mul(ee, z), E = t.mul(ne, E), E = t.sub(E, $), $ = t.mul(ne, K), O = t.mul(ee, O), O = t.add(O, $), new D(E, T, O);
|
|
5226
5233
|
}
|
|
5227
5234
|
subtract(m) {
|
|
5228
5235
|
return this.add(m.negate());
|
|
@@ -5243,16 +5250,16 @@ function Un(s, e = {}) {
|
|
|
5243
5250
|
const { endo: y } = e;
|
|
5244
5251
|
if (!n.isValidNot0(m))
|
|
5245
5252
|
throw new Error("invalid scalar: out of range");
|
|
5246
|
-
let k,
|
|
5253
|
+
let k, N;
|
|
5247
5254
|
const B = (b) => H.cached(this, b, (v) => Qt(D, v));
|
|
5248
5255
|
if (y) {
|
|
5249
5256
|
const { k1neg: b, k1: v, k2neg: E, k2: T } = M(m), { p: O, f: W } = B(v), { p: U, f: $ } = B(T);
|
|
5250
|
-
|
|
5257
|
+
N = W.add($), k = G(y.beta, O, U, b, E);
|
|
5251
5258
|
} else {
|
|
5252
5259
|
const { p: b, f: v } = B(m);
|
|
5253
|
-
k = b,
|
|
5260
|
+
k = b, N = v;
|
|
5254
5261
|
}
|
|
5255
|
-
return Qt(D, [k,
|
|
5262
|
+
return Qt(D, [k, N])[0];
|
|
5256
5263
|
}
|
|
5257
5264
|
/**
|
|
5258
5265
|
* Non-constant-time multiplication. Uses double-and-add algorithm.
|
|
@@ -5270,8 +5277,8 @@ function Un(s, e = {}) {
|
|
|
5270
5277
|
if (H.hasCache(this))
|
|
5271
5278
|
return this.multiply(m);
|
|
5272
5279
|
if (y) {
|
|
5273
|
-
const { k1neg:
|
|
5274
|
-
return G(y.beta, E, T,
|
|
5280
|
+
const { k1neg: N, k1: B, k2neg: b, k2: v } = M(m), { p1: E, p2: T } = Ln(D, k, B, v);
|
|
5281
|
+
return G(y.beta, E, T, N, b);
|
|
5275
5282
|
} else
|
|
5276
5283
|
return H.unsafe(k, m);
|
|
5277
5284
|
}
|
|
@@ -5349,7 +5356,7 @@ function Hn(s, e = {}) {
|
|
|
5349
5356
|
}
|
|
5350
5357
|
}
|
|
5351
5358
|
function a(_ = t(n.seed)) {
|
|
5352
|
-
return
|
|
5359
|
+
return Nn(V(_, n.seed, "seed"), r.ORDER);
|
|
5353
5360
|
}
|
|
5354
5361
|
function c(_, x = !0) {
|
|
5355
5362
|
return s.BASE.multiply(r.fromBytes(_)).toBytes(x);
|
|
@@ -5399,37 +5406,37 @@ function Wn(s, e, r = {}) {
|
|
|
5399
5406
|
throw new Error(`invalid signature ${m}: out of range 1..Point.Fn.ORDER`);
|
|
5400
5407
|
return y;
|
|
5401
5408
|
}
|
|
5402
|
-
function
|
|
5409
|
+
function C() {
|
|
5403
5410
|
if (w)
|
|
5404
5411
|
throw new Error('"recovered" sig type is not supported for cofactor >2 curves');
|
|
5405
5412
|
}
|
|
5406
5413
|
function R(m, y) {
|
|
5407
5414
|
mt(y);
|
|
5408
|
-
const k = _.signature,
|
|
5409
|
-
return V(m,
|
|
5415
|
+
const k = _.signature, N = y === "compact" ? k : y === "recovered" ? k + 1 : void 0;
|
|
5416
|
+
return V(m, N);
|
|
5410
5417
|
}
|
|
5411
5418
|
class L {
|
|
5412
|
-
constructor(y, k,
|
|
5419
|
+
constructor(y, k, N) {
|
|
5413
5420
|
P(this, "r");
|
|
5414
5421
|
P(this, "s");
|
|
5415
5422
|
P(this, "recovery");
|
|
5416
|
-
if (this.r = I("r", y), this.s = I("s", k),
|
|
5417
|
-
if (
|
|
5423
|
+
if (this.r = I("r", y), this.s = I("s", k), N != null) {
|
|
5424
|
+
if (C(), ![0, 1, 2, 3].includes(N))
|
|
5418
5425
|
throw new Error("invalid recovery id");
|
|
5419
|
-
this.recovery =
|
|
5426
|
+
this.recovery = N;
|
|
5420
5427
|
}
|
|
5421
5428
|
Object.freeze(this);
|
|
5422
5429
|
}
|
|
5423
5430
|
static fromBytes(y, k = x.format) {
|
|
5424
5431
|
R(y, k);
|
|
5425
|
-
let
|
|
5432
|
+
let N;
|
|
5426
5433
|
if (k === "der") {
|
|
5427
5434
|
const { r: E, s: T } = ve.toSig(V(y));
|
|
5428
5435
|
return new L(E, T);
|
|
5429
5436
|
}
|
|
5430
|
-
k === "recovered" && (
|
|
5437
|
+
k === "recovered" && (N = y[0], k = "compact", y = y.subarray(1));
|
|
5431
5438
|
const B = _.signature / 2, b = y.subarray(0, B), v = y.subarray(B, B * 2);
|
|
5432
|
-
return new L(o.fromBytes(b), o.fromBytes(v),
|
|
5439
|
+
return new L(o.fromBytes(b), o.fromBytes(v), N);
|
|
5433
5440
|
}
|
|
5434
5441
|
static fromHex(y, k) {
|
|
5435
5442
|
return this.fromBytes(Ye(y), k);
|
|
@@ -5444,10 +5451,10 @@ function Wn(s, e, r = {}) {
|
|
|
5444
5451
|
return new L(this.r, this.s, y);
|
|
5445
5452
|
}
|
|
5446
5453
|
recoverPublicKey(y) {
|
|
5447
|
-
const { r: k, s:
|
|
5454
|
+
const { r: k, s: N } = this, B = this.assertRecovery(), b = B === 2 || B === 3 ? k + a : k;
|
|
5448
5455
|
if (!i.isValid(b))
|
|
5449
5456
|
throw new Error("invalid recovery id: sig.r+curve.n != R.x");
|
|
5450
|
-
const v = i.toBytes(b), E = s.fromBytes(Se(Hr((B & 1) === 0), v)), T = o.inv(b), O = q(V(y, void 0, "msgHash")), W = o.create(-O * T), U = o.create(
|
|
5457
|
+
const v = i.toBytes(b), E = s.fromBytes(Se(Hr((B & 1) === 0), v)), T = o.inv(b), O = q(V(y, void 0, "msgHash")), W = o.create(-O * T), U = o.create(N * T), $ = s.BASE.multiplyUnsafe(W).add(E.multiplyUnsafe(U));
|
|
5451
5458
|
if ($.is0())
|
|
5452
5459
|
throw new Error("invalid recovery: point at infinify");
|
|
5453
5460
|
return $.assertValidity(), $;
|
|
@@ -5459,8 +5466,8 @@ function Wn(s, e, r = {}) {
|
|
|
5459
5466
|
toBytes(y = x.format) {
|
|
5460
5467
|
if (mt(y), y === "der")
|
|
5461
5468
|
return Ye(ve.hexFromSig(this));
|
|
5462
|
-
const { r: k, s:
|
|
5463
|
-
return y === "recovered" ? (
|
|
5469
|
+
const { r: k, s: N } = this, B = o.toBytes(k), b = o.toBytes(N);
|
|
5470
|
+
return y === "recovered" ? (C(), Se(Uint8Array.of(this.assertRecovery()), B, b)) : Se(B, b);
|
|
5464
5471
|
}
|
|
5465
5472
|
toHex(y) {
|
|
5466
5473
|
return We(this.toBytes(y));
|
|
@@ -5469,8 +5476,8 @@ function Wn(s, e, r = {}) {
|
|
|
5469
5476
|
const M = r.bits2int || function(y) {
|
|
5470
5477
|
if (y.length > 8192)
|
|
5471
5478
|
throw new Error("input is too large");
|
|
5472
|
-
const k = tt(y),
|
|
5473
|
-
return
|
|
5479
|
+
const k = tt(y), N = y.length * 8 - c;
|
|
5480
|
+
return N > 0 ? k >> BigInt(N) : k;
|
|
5474
5481
|
}, q = r.bits2int_modN || function(y) {
|
|
5475
5482
|
return o.create(M(y));
|
|
5476
5483
|
}, J = kt(c);
|
|
@@ -5481,7 +5488,7 @@ function Wn(s, e, r = {}) {
|
|
|
5481
5488
|
return V(m, void 0, "message"), y ? V(e(m), void 0, "prehashed message") : m;
|
|
5482
5489
|
}
|
|
5483
5490
|
function Q(m, y, k) {
|
|
5484
|
-
const { lowS:
|
|
5491
|
+
const { lowS: N, prehash: B, extraEntropy: b } = ut(k, x);
|
|
5485
5492
|
m = X(m, B);
|
|
5486
5493
|
const v = q(m), E = o.fromBytes(y);
|
|
5487
5494
|
if (!o.isValidNot0(E))
|
|
@@ -5503,16 +5510,16 @@ function Wn(s, e, r = {}) {
|
|
|
5503
5510
|
if (ee === ge)
|
|
5504
5511
|
return;
|
|
5505
5512
|
let Lt = (ne.x === z ? 0 : 2) | Number(ne.y & Le), Dt = ee;
|
|
5506
|
-
return
|
|
5513
|
+
return N && S(ee) && (Dt = o.neg(ee), Lt ^= 1), new L(z, Dt, w ? void 0 : Lt);
|
|
5507
5514
|
}
|
|
5508
5515
|
return { seed: O, k2sig: U };
|
|
5509
5516
|
}
|
|
5510
5517
|
function H(m, y, k = {}) {
|
|
5511
|
-
const { seed:
|
|
5512
|
-
return bn(e.outputLen, o.BYTES, n)(
|
|
5518
|
+
const { seed: N, k2sig: B } = Q(m, y, k);
|
|
5519
|
+
return bn(e.outputLen, o.BYTES, n)(N, B).toBytes(k.format);
|
|
5513
5520
|
}
|
|
5514
|
-
function D(m, y, k,
|
|
5515
|
-
const { lowS: B, prehash: b, format: v } = ut(
|
|
5521
|
+
function D(m, y, k, N = {}) {
|
|
5522
|
+
const { lowS: B, prehash: b, format: v } = ut(N, x);
|
|
5516
5523
|
if (k = V(k, void 0, "publicKey"), y = X(y, b), !At(m)) {
|
|
5517
5524
|
const E = m instanceof L ? ", use sig.toBytes()" : "";
|
|
5518
5525
|
throw new Error("verify expects Uint8Array signature" + E);
|
|
@@ -5529,8 +5536,8 @@ function Wn(s, e, r = {}) {
|
|
|
5529
5536
|
}
|
|
5530
5537
|
}
|
|
5531
5538
|
function F(m, y, k = {}) {
|
|
5532
|
-
const { prehash:
|
|
5533
|
-
return y = X(y,
|
|
5539
|
+
const { prehash: N } = ut(k, x);
|
|
5540
|
+
return y = X(y, N), L.fromBytes(m, "recovered").recoverPublicKey(y).toBytes();
|
|
5534
5541
|
}
|
|
5535
5542
|
return Object.freeze({
|
|
5536
5543
|
keygen: l,
|
|
@@ -5547,7 +5554,7 @@ function Wn(s, e, r = {}) {
|
|
|
5547
5554
|
});
|
|
5548
5555
|
}
|
|
5549
5556
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
5550
|
-
const
|
|
5557
|
+
const Ct = {
|
|
5551
5558
|
p: BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),
|
|
5552
5559
|
n: BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),
|
|
5553
5560
|
h: BigInt(1),
|
|
@@ -5563,12 +5570,12 @@ const Nt = {
|
|
|
5563
5570
|
]
|
|
5564
5571
|
}, nr = /* @__PURE__ */ BigInt(2);
|
|
5565
5572
|
function qn(s) {
|
|
5566
|
-
const e =
|
|
5573
|
+
const e = Ct.p, r = BigInt(3), t = BigInt(6), n = BigInt(11), i = BigInt(22), o = BigInt(23), a = BigInt(44), c = BigInt(88), l = s * s * s % e, u = l * l * s % e, p = oe(u, r, e) * u % e, g = oe(p, r, e) * u % e, _ = oe(g, nr, e) * l % e, x = oe(_, n, e) * _ % e, w = oe(x, i, e) * x % e, S = oe(w, a, e) * w % e, I = oe(S, c, e) * S % e, C = oe(I, a, e) * w % e, R = oe(C, r, e) * u % e, L = oe(R, o, e) * x % e, M = oe(L, t, e) * l % e, q = oe(M, nr, e);
|
|
5567
5574
|
if (!yt.eql(yt.sqr(q), s))
|
|
5568
5575
|
throw new Error("Cannot find square root");
|
|
5569
5576
|
return q;
|
|
5570
5577
|
}
|
|
5571
|
-
const yt = rt(
|
|
5578
|
+
const yt = rt(Ct.p, { sqrt: qn }), Kn = /* @__PURE__ */ Un(Ct, {
|
|
5572
5579
|
Fp: yt,
|
|
5573
5580
|
endo: Gn
|
|
5574
5581
|
}), Vn = /* @__PURE__ */ Wn(Kn, gn), zn = BigInt(0), Me = BigInt(1), jn = BigInt(2), Yn = BigInt(7), Xn = BigInt(256), Jn = BigInt(113), Gr = [], qr = [], Kr = [];
|
|
@@ -5605,7 +5612,7 @@ function ei(s, e = 24) {
|
|
|
5605
5612
|
}
|
|
5606
5613
|
$e(r);
|
|
5607
5614
|
}
|
|
5608
|
-
class
|
|
5615
|
+
class Nt {
|
|
5609
5616
|
// NOTE: we accept arguments in bytes instead of bits here.
|
|
5610
5617
|
constructor(e, r, t, n = !1, i = 24) {
|
|
5611
5618
|
P(this, "state");
|
|
@@ -5678,10 +5685,10 @@ class Ct {
|
|
|
5678
5685
|
}
|
|
5679
5686
|
_cloneInto(e) {
|
|
5680
5687
|
const { blockLen: r, suffix: t, outputLen: n, rounds: i, enableXOF: o } = this;
|
|
5681
|
-
return e || (e = new
|
|
5688
|
+
return e || (e = new Nt(r, t, n, o, i)), e.state32.set(this.state32), e.pos = this.pos, e.posOut = this.posOut, e.finished = this.finished, e.rounds = i, e.suffix = t, e.outputLen = n, e.enableXOF = o, e.destroyed = this.destroyed, e;
|
|
5682
5689
|
}
|
|
5683
5690
|
}
|
|
5684
|
-
const ti = (s, e, r, t = {}) => yr(() => new
|
|
5691
|
+
const ti = (s, e, r, t = {}) => yr(() => new Nt(e, s, r), t), ar = /* @__PURE__ */ ti(1, 136, 32), ri = 60;
|
|
5685
5692
|
class si {
|
|
5686
5693
|
constructor() {
|
|
5687
5694
|
this.jwks = null;
|
|
@@ -5901,7 +5908,7 @@ class Ae {
|
|
|
5901
5908
|
d.warn("[CROSSx] OAuth 타임아웃 (5분) — postMessage를 수신하지 못했습니다"), L(), t(new Error("Authentication timeout"));
|
|
5902
5909
|
}, 5 * 60 * 1e3), x = 10, w = 30;
|
|
5903
5910
|
let S = 0, I = null;
|
|
5904
|
-
const
|
|
5911
|
+
const C = () => {
|
|
5905
5912
|
clearInterval(R), d.warn("[CROSSx] COOP 감지 — OAuth 서버 응답을 " + w + "초간 대기합니다"), I = setTimeout(() => {
|
|
5906
5913
|
L(), t(new Error(
|
|
5907
5914
|
"OAuth 서버로부터 응답을 받지 못했습니다. 브라우저 보안 정책(COOP)으로 인해 팝업 통신이 차단되었을 수 있습니다. 다시 시도해 주세요."
|
|
@@ -5910,9 +5917,9 @@ class Ae {
|
|
|
5910
5917
|
}, R = setInterval(() => {
|
|
5911
5918
|
S++;
|
|
5912
5919
|
try {
|
|
5913
|
-
g.closed && (S <= x ?
|
|
5920
|
+
g.closed && (S <= x ? C() : (L(), t(new Error("로그인이 취소되었습니다"))));
|
|
5914
5921
|
} catch {
|
|
5915
|
-
|
|
5922
|
+
C();
|
|
5916
5923
|
}
|
|
5917
5924
|
}, 1e3), L = () => {
|
|
5918
5925
|
clearTimeout(_), clearInterval(R), I && clearTimeout(I), window.removeEventListener("message", M);
|
|
@@ -5951,8 +5958,8 @@ class Ae {
|
|
|
5951
5958
|
return;
|
|
5952
5959
|
}
|
|
5953
5960
|
const m = { token: D, email: F }, y = (k) => {
|
|
5954
|
-
Ae.verifyIdTokenNonce(k, l).then(() => r(m)).catch((
|
|
5955
|
-
d.error("[CROSSx] nonce 검증 실패:",
|
|
5961
|
+
Ae.verifyIdTokenNonce(k, l).then(() => r(m)).catch((N) => {
|
|
5962
|
+
d.error("[CROSSx] nonce 검증 실패:", N), t(N instanceof Error ? N : new Error("nonce verification failed"));
|
|
5956
5963
|
});
|
|
5957
5964
|
};
|
|
5958
5965
|
H ? H.split(".").length === 3 ? y(H) : Q ? y(Q) : (d.warn(
|
|
@@ -6198,9 +6205,9 @@ class Ie {
|
|
|
6198
6205
|
h.USER_NOT_FOUND,
|
|
6199
6206
|
Ie.getGatewayErrorMessage(_.code, x)
|
|
6200
6207
|
);
|
|
6201
|
-
const S = w === h.AUTH_NOT_AUTHENTICATED ? h.SESSION_EXPIRED : w, I = S === h.SESSION_EXPIRED ? "인증 세션이 만료되었습니다. 다시 로그인해 주세요." : Ie.getGatewayErrorMessage(_.code, x),
|
|
6208
|
+
const S = w === h.AUTH_NOT_AUTHENTICATED ? h.SESSION_EXPIRED : w, I = S === h.SESSION_EXPIRED ? "인증 세션이 만료되었습니다. 다시 로그인해 주세요." : Ie.getGatewayErrorMessage(_.code, x), C = _.data;
|
|
6202
6209
|
let R;
|
|
6203
|
-
throw w === h.PIN_LOCKED ? R = Ie.extractLockDetails(
|
|
6210
|
+
throw w === h.PIN_LOCKED ? R = Ie.extractLockDetails(C) : w === h.ADDRESS_LIMIT_EXCEEDED ? R = { limit: gt, raw: C } : R = C ?? void 0, new f(S, I, R);
|
|
6204
6211
|
}
|
|
6205
6212
|
return d.log("[CROSSx] Wallet Gateway API 성공:", { code: _.code, url: o, method: e }), _.data ?? _;
|
|
6206
6213
|
}
|
|
@@ -9083,7 +9090,7 @@ function _i(s) {
|
|
|
9083
9090
|
}, { passive: !0 });
|
|
9084
9091
|
}
|
|
9085
9092
|
const fi = () => /iPad|iPhone|iPod/.test(navigator.userAgent) || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1;
|
|
9086
|
-
function
|
|
9093
|
+
function Ce() {
|
|
9087
9094
|
if (fi()) {
|
|
9088
9095
|
const e = window.scrollY;
|
|
9089
9096
|
return document.body.style.position = "fixed", document.body.style.top = `-${e}px`, document.body.style.left = "0", document.body.style.right = "0", () => {
|
|
@@ -9361,7 +9368,7 @@ function Ri(s) {
|
|
|
9361
9368
|
function Oi(s) {
|
|
9362
9369
|
return `https://www.crossscan.io/address/${s}?tab=txs`;
|
|
9363
9370
|
}
|
|
9364
|
-
function
|
|
9371
|
+
function Ci(s, e) {
|
|
9365
9372
|
return `https://explorer.crosstoken.io/${Ri(s)}/tx/${e}`;
|
|
9366
9373
|
}
|
|
9367
9374
|
function Jr(s, e) {
|
|
@@ -9371,9 +9378,9 @@ function Ze(s) {
|
|
|
9371
9378
|
return Jr(de(s), Oi(s));
|
|
9372
9379
|
}
|
|
9373
9380
|
function Zr(s, e) {
|
|
9374
|
-
return Jr(de(e),
|
|
9381
|
+
return Jr(de(e), Ci(s, e));
|
|
9375
9382
|
}
|
|
9376
|
-
function
|
|
9383
|
+
function Ni(s, e, r) {
|
|
9377
9384
|
const t = j(
|
|
9378
9385
|
(r == null ? void 0 : r.label_from) ?? "From",
|
|
9379
9386
|
`${Ze(s.from)}
|
|
@@ -9453,10 +9460,10 @@ function Li(s, e, r, t) {
|
|
|
9453
9460
|
<button class="__crossx-approve-btn" id="__crossx-done-btn">${A((t == null ? void 0 : t.tx_complete_done_button) ?? (n ? "All Done" : "Done"))}</button>
|
|
9454
9461
|
`, c.querySelectorAll(".__crossx-copy-btn").forEach((w) => {
|
|
9455
9462
|
w.addEventListener("click", (S) => {
|
|
9456
|
-
var
|
|
9463
|
+
var C;
|
|
9457
9464
|
S.stopPropagation();
|
|
9458
9465
|
const I = w.dataset.copy;
|
|
9459
|
-
I && ((
|
|
9466
|
+
I && ((C = navigator.clipboard) == null || C.writeText(I).catch(() => {
|
|
9460
9467
|
}));
|
|
9461
9468
|
});
|
|
9462
9469
|
});
|
|
@@ -9895,7 +9902,7 @@ function to(s) {
|
|
|
9895
9902
|
return r > 0 ? `${r}h ${String(t).padStart(2, "0")}m` : `${String(t).padStart(2, "0")}:${String(n).padStart(2, "0")}`;
|
|
9896
9903
|
}
|
|
9897
9904
|
function _t(s, e, r, t, n, i, o) {
|
|
9898
|
-
var
|
|
9905
|
+
var N, B;
|
|
9899
9906
|
let a = !!(i && i > Date.now()), c = !1;
|
|
9900
9907
|
const l = () => Array.from(s.querySelectorAll(".__crossx-pin6-box")), u = () => s.querySelector("#__crossx-pin6-boxes"), p = () => s.querySelector("#__crossx-pin6-error"), g = () => s.querySelector("#__crossx-pin6-lock-msg"), _ = () => s.querySelector("#__crossx-pin6-lock-countdown"), x = () => s.querySelector(".__crossx-pin6-body"), w = () => l().map((b) => b.value).join(""), S = () => Array.from(s.querySelectorAll(".__crossx-pin6-dot")), I = () => {
|
|
9901
9908
|
var E;
|
|
@@ -9907,7 +9914,7 @@ function _t(s, e, r, t, n, i, o) {
|
|
|
9907
9914
|
const T = b.findIndex((W) => !W.value);
|
|
9908
9915
|
(E = v[T === -1 ? 5 : T]) == null || E.classList.add("--active");
|
|
9909
9916
|
}
|
|
9910
|
-
},
|
|
9917
|
+
}, C = () => {
|
|
9911
9918
|
s.querySelectorAll(".__crossx-pin6-numpad-key[data-key]").forEach((v) => v.classList.toggle("--disabled", a)), S().forEach((v) => v.classList.toggle("--locked", a)), I();
|
|
9912
9919
|
}, R = (b) => {
|
|
9913
9920
|
a = b, l().forEach((v) => {
|
|
@@ -9954,7 +9961,7 @@ function _t(s, e, r, t, n, i, o) {
|
|
|
9954
9961
|
var W;
|
|
9955
9962
|
R(!0), l().forEach((U) => {
|
|
9956
9963
|
U.value = "";
|
|
9957
|
-
}),
|
|
9964
|
+
}), C();
|
|
9958
9965
|
const v = p();
|
|
9959
9966
|
if (v && (v.textContent = "Too many failed attempts. Please wait."), !g()) {
|
|
9960
9967
|
const U = document.createElement("p");
|
|
@@ -9965,7 +9972,7 @@ function _t(s, e, r, t, n, i, o) {
|
|
|
9965
9972
|
const E = () => {
|
|
9966
9973
|
var K;
|
|
9967
9974
|
const U = b - Date.now(), $ = _();
|
|
9968
|
-
U <= 0 ? (clearInterval(T), R(!1), (K = g()) == null || K.remove(), v && (v.textContent = ""),
|
|
9975
|
+
U <= 0 ? (clearInterval(T), R(!1), (K = g()) == null || K.remove(), v && (v.textContent = ""), C(), setTimeout(() => {
|
|
9969
9976
|
var Y;
|
|
9970
9977
|
return (Y = l()[0]) == null ? void 0 : Y.focus();
|
|
9971
9978
|
}, 50)) : $ && ($.textContent = ` ${to(U)}`);
|
|
@@ -10006,7 +10013,7 @@ function _t(s, e, r, t, n, i, o) {
|
|
|
10006
10013
|
const b = l(), v = b.find((E) => !E.value) ?? b[b.length - 1];
|
|
10007
10014
|
v == null || v.focus();
|
|
10008
10015
|
};
|
|
10009
|
-
(
|
|
10016
|
+
(N = u()) == null || N.addEventListener("click", (b) => {
|
|
10010
10017
|
b.target.classList.contains("__crossx-pin6-box") || y();
|
|
10011
10018
|
}), (B = x()) == null || B.addEventListener("click", (b) => {
|
|
10012
10019
|
const v = b.target;
|
|
@@ -10066,7 +10073,7 @@ function _t(s, e, r, t, n, i, o) {
|
|
|
10066
10073
|
v();
|
|
10067
10074
|
const W = O.getBoundingClientRect();
|
|
10068
10075
|
T.clientX >= W.left && T.clientX <= W.right && T.clientY >= W.top && T.clientY <= W.bottom && !a && !c && E(O);
|
|
10069
|
-
}), k.addEventListener("pointercancel", v), k.addEventListener("pointerleave", v, !0), I(), i && i > Date.now() &&
|
|
10076
|
+
}), k.addEventListener("pointercancel", v), k.addEventListener("pointerleave", v, !0), I(), i && i > Date.now() && C();
|
|
10070
10077
|
}
|
|
10071
10078
|
}
|
|
10072
10079
|
const ro = `<svg width="22" height="17" viewBox="0 0 22 17" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
@@ -10139,9 +10146,9 @@ class oo {
|
|
|
10139
10146
|
*/
|
|
10140
10147
|
showWalletSelector(e, r, t) {
|
|
10141
10148
|
return new Promise((n, i) => {
|
|
10142
|
-
var
|
|
10149
|
+
var C;
|
|
10143
10150
|
ae();
|
|
10144
|
-
const o = [...e], a = Wi(o, this.tokens, t, this.messages), c =
|
|
10151
|
+
const o = [...e], a = Wi(o, this.tokens, t, this.messages), c = Ce();
|
|
10145
10152
|
ce(a);
|
|
10146
10153
|
let l = !1;
|
|
10147
10154
|
const u = () => {
|
|
@@ -10181,7 +10188,7 @@ class oo {
|
|
|
10181
10188
|
const L = R instanceof f && R.code === h.ADDRESS_LIMIT_EXCEEDED, M = this.resolveAddWalletErrorMessage(R);
|
|
10182
10189
|
w && (w.textContent = M, w.hidden = !1), L ? (S.disabled = !0, S.setAttribute("aria-disabled", "true")) : S.disabled = !1, p = R;
|
|
10183
10190
|
}
|
|
10184
|
-
}), (
|
|
10191
|
+
}), (C = a.querySelector("#__crossx-close-btn")) == null || C.addEventListener("click", _), a.addEventListener("click", (R) => {
|
|
10185
10192
|
R.target === a && _();
|
|
10186
10193
|
});
|
|
10187
10194
|
const I = (R) => {
|
|
@@ -10218,7 +10225,7 @@ class oo {
|
|
|
10218
10225
|
return new Promise((n) => {
|
|
10219
10226
|
var g, _, x, w;
|
|
10220
10227
|
ae();
|
|
10221
|
-
const i = zi(this.tokens, r, this.messages), o =
|
|
10228
|
+
const i = zi(this.tokens, r, this.messages), o = Ce();
|
|
10222
10229
|
ce(i);
|
|
10223
10230
|
const a = () => {
|
|
10224
10231
|
i.remove(), o();
|
|
@@ -10230,8 +10237,8 @@ class oo {
|
|
|
10230
10237
|
a(), n(null);
|
|
10231
10238
|
};
|
|
10232
10239
|
(g = i.querySelector("#__crossx-apple-btn")) == null || g.addEventListener("click", () => c("apple")), (_ = i.querySelector("#__crossx-google-btn")) == null || _.addEventListener("click", () => c("google")), (x = i.querySelector("#__crossx-connect-other-wallet-btn")) == null || x.addEventListener("click", (S) => {
|
|
10233
|
-
const
|
|
10234
|
-
|
|
10240
|
+
const C = S.currentTarget.dataset.walletId ?? "";
|
|
10241
|
+
C && l(C);
|
|
10235
10242
|
}), (w = i.querySelector("#__crossx-close-btn")) == null || w.addEventListener("click", u), i.addEventListener("click", (S) => {
|
|
10236
10243
|
S.target === i && u();
|
|
10237
10244
|
}), i.querySelectorAll(".__crossx-login-terms-link").forEach((S) => {
|
|
@@ -10254,7 +10261,7 @@ class oo {
|
|
|
10254
10261
|
accountLabel: (t == null ? void 0 : t.session_alert_account_label) ?? "Account",
|
|
10255
10262
|
signOutLabel: (t == null ? void 0 : t.session_alert_sign_out_button) ?? "Sign out",
|
|
10256
10263
|
signInAgainLabel: (t == null ? void 0 : t.session_alert_sign_in_again_button) ?? "Sign in again"
|
|
10257
|
-
}), i =
|
|
10264
|
+
}), i = Ce();
|
|
10258
10265
|
ce(n);
|
|
10259
10266
|
let o = !1;
|
|
10260
10267
|
const a = () => {
|
|
@@ -10323,13 +10330,13 @@ class oo {
|
|
|
10323
10330
|
}, o = {
|
|
10324
10331
|
title: (t == null ? void 0 : t.pin_setup_confirm_title) ?? "Confirm PIN",
|
|
10325
10332
|
headerSubtitle: (t == null ? void 0 : t.pin_setup_confirm_subtitle) ?? "Enter your PIN again to confirm."
|
|
10326
|
-
}, a = hr(this.tokens, Qi(n)), c =
|
|
10333
|
+
}, a = hr(this.tokens, Qi(n)), c = Ce();
|
|
10327
10334
|
ce(a);
|
|
10328
10335
|
let l = !1;
|
|
10329
10336
|
const u = () => {
|
|
10330
10337
|
l || (l = !0, a.remove(), c());
|
|
10331
|
-
}, p = (
|
|
10332
|
-
u(), r(
|
|
10338
|
+
}, p = (C) => {
|
|
10339
|
+
u(), r(C);
|
|
10333
10340
|
}, g = () => {
|
|
10334
10341
|
u(), r(null);
|
|
10335
10342
|
}, _ = a.querySelector(".__crossx-card"), x = {
|
|
@@ -10338,21 +10345,21 @@ class oo {
|
|
|
10338
10345
|
repeatingDigit: (t == null ? void 0 : t.pin_validation_repeating_digit) ?? "Cannot use the same number 3+ times in a row.",
|
|
10339
10346
|
sequential: (t == null ? void 0 : t.pin_validation_sequential) ?? "Sequential numbers (e.g., 123456) are not allowed.",
|
|
10340
10347
|
alternatingPattern: (t == null ? void 0 : t.pin_validation_alternating_pattern) ?? "Repeating patterns (e.g., 121212) are not allowed."
|
|
10341
|
-
}, w = (
|
|
10348
|
+
}, w = (C) => {
|
|
10342
10349
|
var R;
|
|
10343
10350
|
_.innerHTML = pt({
|
|
10344
10351
|
title: o.title,
|
|
10345
10352
|
headerSubtitle: o.headerSubtitle
|
|
10346
10353
|
}), (R = _.querySelector("#__crossx-close-btn")) == null || R.addEventListener("click", g), _t(_, (L) => {
|
|
10347
|
-
L ===
|
|
10354
|
+
L === C ? p(C) : S(i.mismatchError);
|
|
10348
10355
|
}, g);
|
|
10349
|
-
}, S = (
|
|
10356
|
+
}, S = (C) => {
|
|
10350
10357
|
var R;
|
|
10351
10358
|
_.innerHTML = pt({
|
|
10352
10359
|
title: i.title,
|
|
10353
10360
|
headerSubtitle: i.headerSubtitle,
|
|
10354
10361
|
subtitle: i.subtitle,
|
|
10355
|
-
errorMessage:
|
|
10362
|
+
errorMessage: C
|
|
10356
10363
|
}), (R = _.querySelector("#__crossx-close-btn")) == null || R.addEventListener("click", g), _t(_, (L) => {
|
|
10357
10364
|
const M = eo(L, x);
|
|
10358
10365
|
M ? S(M) : w(L);
|
|
@@ -10360,10 +10367,10 @@ class oo {
|
|
|
10360
10367
|
};
|
|
10361
10368
|
(() => {
|
|
10362
10369
|
var Q;
|
|
10363
|
-
const
|
|
10370
|
+
const C = Array.from(_.querySelectorAll(".__crossx-pw-notice-item")), R = _.querySelector("#__crossx-pin-notice-next"), L = /* @__PURE__ */ new Set();
|
|
10364
10371
|
R.removeAttribute("disabled");
|
|
10365
10372
|
const M = R.dataset.nextLabel ?? "Next", q = R.dataset.submitLabel ?? "I Understand", J = () => {
|
|
10366
|
-
const H = L.size ===
|
|
10373
|
+
const H = L.size === C.length;
|
|
10367
10374
|
R.classList.toggle("--disabled", !H), R.textContent = H ? q : M;
|
|
10368
10375
|
}, G = (H, D) => {
|
|
10369
10376
|
if (L.has(D)) return;
|
|
@@ -10374,7 +10381,7 @@ class oo {
|
|
|
10374
10381
|
const F = H.querySelector(`#__crossx-notice-check-${D}`);
|
|
10375
10382
|
L.delete(D), F.classList.remove("--checked"), H.setAttribute("aria-checked", "false"), J();
|
|
10376
10383
|
};
|
|
10377
|
-
|
|
10384
|
+
C.forEach((H) => {
|
|
10378
10385
|
const D = parseInt(H.dataset.checkIndex ?? "0", 10);
|
|
10379
10386
|
H.addEventListener("click", () => {
|
|
10380
10387
|
L.has(D) ? X(H, D) : G(H, D);
|
|
@@ -10382,11 +10389,11 @@ class oo {
|
|
|
10382
10389
|
(F.key === " " || F.key === "Enter") && (F.preventDefault(), L.has(D) ? X(H, D) : G(H, D));
|
|
10383
10390
|
});
|
|
10384
10391
|
}), R.addEventListener("click", () => {
|
|
10385
|
-
if (L.size ===
|
|
10392
|
+
if (L.size === C.length) {
|
|
10386
10393
|
S(e == null ? void 0 : e.errorMessage);
|
|
10387
10394
|
return;
|
|
10388
10395
|
}
|
|
10389
|
-
const H =
|
|
10396
|
+
const H = C.find((F) => {
|
|
10390
10397
|
const m = parseInt(F.dataset.checkIndex ?? "0", 10);
|
|
10391
10398
|
return !L.has(m);
|
|
10392
10399
|
});
|
|
@@ -10396,8 +10403,8 @@ class oo {
|
|
|
10396
10403
|
H.classList.remove("--highlight"), G(H, D);
|
|
10397
10404
|
}, 400);
|
|
10398
10405
|
}), (Q = _.querySelector("#__crossx-close-btn")) == null || Q.addEventListener("click", g);
|
|
10399
|
-
})(), a.addEventListener("click", (
|
|
10400
|
-
|
|
10406
|
+
})(), a.addEventListener("click", (C) => {
|
|
10407
|
+
C.target === a && g();
|
|
10401
10408
|
});
|
|
10402
10409
|
});
|
|
10403
10410
|
}
|
|
@@ -10421,20 +10428,20 @@ class oo {
|
|
|
10421
10428
|
attemptCount: e == null ? void 0 : e.attemptCount,
|
|
10422
10429
|
maxAttempts: e == null ? void 0 : e.maxAttempts
|
|
10423
10430
|
})
|
|
10424
|
-
), u =
|
|
10431
|
+
), u = Ce();
|
|
10425
10432
|
ce(l);
|
|
10426
10433
|
let p = !1;
|
|
10427
10434
|
const g = () => {
|
|
10428
10435
|
p || (p = !0, l.remove(), u());
|
|
10429
|
-
}, _ = (
|
|
10430
|
-
g(), r(
|
|
10436
|
+
}, _ = (C) => {
|
|
10437
|
+
g(), r(C);
|
|
10431
10438
|
}, x = () => {
|
|
10432
10439
|
g(), r(null);
|
|
10433
|
-
}, w = (
|
|
10434
|
-
g(), t(
|
|
10440
|
+
}, w = (C) => {
|
|
10441
|
+
g(), t(C);
|
|
10435
10442
|
}, S = l.querySelector(".__crossx-card");
|
|
10436
|
-
(I = S.querySelector("#__crossx-close-btn")) == null || I.addEventListener("click", x), _t(S, _, x, w, e == null ? void 0 : e.onSubmit, e == null ? void 0 : e.lockExpiresAt, c), l.addEventListener("click", (
|
|
10437
|
-
|
|
10443
|
+
(I = S.querySelector("#__crossx-close-btn")) == null || I.addEventListener("click", x), _t(S, _, x, w, e == null ? void 0 : e.onSubmit, e == null ? void 0 : e.lockExpiresAt, c), l.addEventListener("click", (C) => {
|
|
10444
|
+
C.target === l && x();
|
|
10438
10445
|
});
|
|
10439
10446
|
});
|
|
10440
10447
|
}
|
|
@@ -10491,7 +10498,7 @@ class oo {
|
|
|
10491
10498
|
return new Promise((r) => {
|
|
10492
10499
|
var a, c;
|
|
10493
10500
|
ae();
|
|
10494
|
-
const t =
|
|
10501
|
+
const t = Ni(e, this.tokens, this.messages);
|
|
10495
10502
|
ce(t);
|
|
10496
10503
|
const n = () => t.remove(), i = () => {
|
|
10497
10504
|
n(), r();
|
|
@@ -10547,7 +10554,7 @@ class oo {
|
|
|
10547
10554
|
ae();
|
|
10548
10555
|
let t;
|
|
10549
10556
|
e.type === "sign-message" ? t = Di(e, this.tokens, this.messages) : e.type === "sign-typed-data" ? t = $i(e, this.tokens, this.messages) : e.type === "sign" ? t = Ai(e, this.tokens, this.displayDecimals, this.messages) : t = Ii(e, this.tokens, this.displayDecimals, this.messages);
|
|
10550
|
-
const n =
|
|
10557
|
+
const n = Ce();
|
|
10551
10558
|
ce(t);
|
|
10552
10559
|
const i = () => {
|
|
10553
10560
|
t.remove(), n();
|
|
@@ -10819,7 +10826,7 @@ Example: createCROSSxSDK({ projectId: "your-project-id", ... })`
|
|
|
10819
10826
|
},
|
|
10820
10827
|
() => typeof window < "u" ? window.location.origin : "http://localhost",
|
|
10821
10828
|
x
|
|
10822
|
-
),
|
|
10829
|
+
), C = e != null && e.wrapConfirmation ? e.wrapConfirmation(I) : I, R = new xt(
|
|
10823
10830
|
t,
|
|
10824
10831
|
n,
|
|
10825
10832
|
o,
|
|
@@ -10828,7 +10835,7 @@ Example: createCROSSxSDK({ projectId: "your-project-id", ... })`
|
|
|
10828
10835
|
l,
|
|
10829
10836
|
g,
|
|
10830
10837
|
u,
|
|
10831
|
-
|
|
10838
|
+
C,
|
|
10832
10839
|
w,
|
|
10833
10840
|
p
|
|
10834
10841
|
);
|