@nexus-cross/crossx-sdk-core 2.2.1 → 2.2.2-beta.1
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/core/constants.d.ts +1 -1
- package/dist/crossx.global +8 -8
- package/dist/index.cjs +1 -1
- package/dist/index.js +148 -144
- package/dist/sdk/CROSSxSDK.d.ts.map +1 -1
- package/package.json +1 -1
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 ?? "(없음)",
|
|
@@ -1378,7 +1378,7 @@ function fr() {
|
|
|
1378
1378
|
}
|
|
1379
1379
|
return Pe.production;
|
|
1380
1380
|
}
|
|
1381
|
-
const Ss = 2e3, Ut = 6e4, Es = 1e3, As = 1e4, Is = "0x77359400", Ht = "0x3B9ACA00", Wt = 130, Et = 6, Gt = 18, qt = 3e4, Ts = 5 * 60 * 1e3, ks = 30 * 1e3, gt = 100, Rs = "crossx-sdk-js/2.2.
|
|
1381
|
+
const Ss = 2e3, Ut = 6e4, Es = 1e3, As = 1e4, Is = "0x77359400", Ht = "0x3B9ACA00", Wt = 130, Et = 6, Gt = 18, qt = 3e4, Ts = 5 * 60 * 1e3, ks = 30 * 1e3, gt = 100, Rs = "crossx-sdk-js/2.2.2";
|
|
1382
1382
|
function gr(s) {
|
|
1383
1383
|
let e = s.length;
|
|
1384
1384
|
for (; e > 0 && s.charCodeAt(e - 1) === 48; ) e--;
|
|
@@ -1406,7 +1406,7 @@ function Ge(s, e, r, t = Et) {
|
|
|
1406
1406
|
return;
|
|
1407
1407
|
}
|
|
1408
1408
|
}
|
|
1409
|
-
function
|
|
1409
|
+
function Cs(s) {
|
|
1410
1410
|
const e = s.startsWith("0x") ? s.slice(2) : s;
|
|
1411
1411
|
if (!/^[0-9a-fA-F]+$/.test(e))
|
|
1412
1412
|
throw new f(
|
|
@@ -1419,7 +1419,7 @@ function Os(s) {
|
|
|
1419
1419
|
`서명 길이가 유효하지 않습니다: ${Wt} hex 문자(65 바이트) 예상, 현재 ${e.length}`
|
|
1420
1420
|
);
|
|
1421
1421
|
}
|
|
1422
|
-
function
|
|
1422
|
+
function Os(s) {
|
|
1423
1423
|
const e = s.startsWith("0x") ? s.slice(2) : s;
|
|
1424
1424
|
if (!/^[0-9a-fA-F]+$/.test(e))
|
|
1425
1425
|
throw new f(
|
|
@@ -1466,7 +1466,7 @@ function Ls(s) {
|
|
|
1466
1466
|
const t = Number(r);
|
|
1467
1467
|
return Number.isFinite(t) ? t : void 0;
|
|
1468
1468
|
}
|
|
1469
|
-
class
|
|
1469
|
+
class Oe {
|
|
1470
1470
|
constructor(e) {
|
|
1471
1471
|
this.deps = e, this.verifyPinMutex = null;
|
|
1472
1472
|
}
|
|
@@ -1539,7 +1539,7 @@ class Ce {
|
|
|
1539
1539
|
if (u.code === h.PIN_INVALID)
|
|
1540
1540
|
return { ok: !1, error: u.message };
|
|
1541
1541
|
if (u.code === h.PIN_LOCKED)
|
|
1542
|
-
return
|
|
1542
|
+
return Oe.buildPinLockedResult(u, a);
|
|
1543
1543
|
}
|
|
1544
1544
|
throw u;
|
|
1545
1545
|
}
|
|
@@ -1573,7 +1573,7 @@ class Ce {
|
|
|
1573
1573
|
return await e();
|
|
1574
1574
|
} catch (n) {
|
|
1575
1575
|
if (n instanceof f) {
|
|
1576
|
-
if (t =
|
|
1576
|
+
if (t = Oe.parsePinError(n, r), !t) throw n;
|
|
1577
1577
|
} else
|
|
1578
1578
|
throw n;
|
|
1579
1579
|
}
|
|
@@ -1587,7 +1587,7 @@ class Ce {
|
|
|
1587
1587
|
try {
|
|
1588
1588
|
return await e();
|
|
1589
1589
|
} catch (n) {
|
|
1590
|
-
if (n instanceof f && (t =
|
|
1590
|
+
if (n instanceof f && (t = Oe.parsePinError(n, r), t))
|
|
1591
1591
|
continue;
|
|
1592
1592
|
throw n;
|
|
1593
1593
|
}
|
|
@@ -1612,7 +1612,7 @@ class Ce {
|
|
|
1612
1612
|
return null;
|
|
1613
1613
|
}
|
|
1614
1614
|
static buildPinLockedResult(e, r) {
|
|
1615
|
-
const t =
|
|
1615
|
+
const t = Oe.parsePinError(e, r);
|
|
1616
1616
|
if (!t) return { ok: !1, error: e.message };
|
|
1617
1617
|
const { errorMessage: n, ...i } = t;
|
|
1618
1618
|
return { ok: !1, error: n, ...i };
|
|
@@ -2322,7 +2322,7 @@ const Te = class Te extends ys {
|
|
|
2322
2322
|
walletPreferenceKey: Te.WALLET_PREF_KEY,
|
|
2323
2323
|
storage: this.storage,
|
|
2324
2324
|
pinStore: this.pinStore
|
|
2325
|
-
}), this.pinOrchestrator = new
|
|
2325
|
+
}), this.pinOrchestrator = new Oe({
|
|
2326
2326
|
confirmation: this.confirmation,
|
|
2327
2327
|
walletProvider: this.walletProvider,
|
|
2328
2328
|
pinStore: this.pinStore,
|
|
@@ -2447,7 +2447,7 @@ const Te = class Te extends ys {
|
|
|
2447
2447
|
}
|
|
2448
2448
|
async _doInitialize(e) {
|
|
2449
2449
|
var r, t;
|
|
2450
|
-
d.log("[CROSSx SDK] v2.2.
|
|
2450
|
+
d.log("[CROSSx SDK] v2.2.2 초기화 중..."), this.confirmation.setMessages(xe(this._config.locale));
|
|
2451
2451
|
try {
|
|
2452
2452
|
const n = fr();
|
|
2453
2453
|
this.internalConfig.oauthServiceUrl = n.oauthServiceUrl, this.internalConfig.authApiUrl = n.authApiUrl, this.internalConfig.walletGatewayUrl = n.walletGatewayUrl, this.adapterConfig.gatewayUrl = n.walletGatewayUrl, (t = (r = this.crypto).setJWKSEndpoint) == null || t.call(r, `${n.authApiUrl}/.well-known/jwks.json`);
|
|
@@ -2476,7 +2476,7 @@ const Te = class Te extends ys {
|
|
|
2476
2476
|
d.log("[CROSSx] initialize: 비밀번호 입력 취소 — 지갑 미로드 상태로 계속");
|
|
2477
2477
|
}
|
|
2478
2478
|
}
|
|
2479
|
-
return this.initialized = !0, d.info("[CROSSx SDK] v2.2.
|
|
2479
|
+
return this.initialized = !0, d.info("[CROSSx SDK] v2.2.2 초기화 완료"), this.emit("initialized", { restored: !!(c != null && c.success) }), c ?? null;
|
|
2480
2480
|
} catch (n) {
|
|
2481
2481
|
throw new f(h.AUTH_NOT_INITIALIZED, "SDK 초기화에 실패했습니다", n);
|
|
2482
2482
|
}
|
|
@@ -2497,7 +2497,7 @@ const Te = class Te extends ys {
|
|
|
2497
2497
|
const e = new fe({
|
|
2498
2498
|
appId: this._config.projectId,
|
|
2499
2499
|
appVersion: "1.0.0",
|
|
2500
|
-
sdkVersion: "2.2.
|
|
2500
|
+
sdkVersion: "2.2.2",
|
|
2501
2501
|
keyId: "key-id-1",
|
|
2502
2502
|
userIdHash: "user-hash-placeholder",
|
|
2503
2503
|
projectId: this._config.projectId
|
|
@@ -3160,7 +3160,7 @@ const Te = class Te extends ys {
|
|
|
3160
3160
|
n.address
|
|
3161
3161
|
)
|
|
3162
3162
|
});
|
|
3163
|
-
return
|
|
3163
|
+
return Cs(i.signature), {
|
|
3164
3164
|
chainId: e,
|
|
3165
3165
|
signature: i.signature,
|
|
3166
3166
|
address: n.address
|
|
@@ -3238,7 +3238,7 @@ const Te = class Te extends ys {
|
|
|
3238
3238
|
a
|
|
3239
3239
|
)
|
|
3240
3240
|
});
|
|
3241
|
-
return
|
|
3241
|
+
return Os(o.signature), {
|
|
3242
3242
|
chainId: e,
|
|
3243
3243
|
signedTx: o.signature,
|
|
3244
3244
|
txHash: o.txHash ?? ""
|
|
@@ -3377,7 +3377,7 @@ const Te = class Te extends ys {
|
|
|
3377
3377
|
let g, _;
|
|
3378
3378
|
const x = this.waitForTxAndGetReceipt(a, e, { intervalMs: c, timeoutMs: l }).then((I) => {
|
|
3379
3379
|
g = I;
|
|
3380
|
-
const
|
|
3380
|
+
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);
|
|
3381
3381
|
return {
|
|
3382
3382
|
chainId: e,
|
|
3383
3383
|
txHash: a,
|
|
@@ -3725,6 +3725,10 @@ const Te = class Te extends ys {
|
|
|
3725
3725
|
d.warn("[walletChanged] invalid source — 이벤트 무시", t);
|
|
3726
3726
|
return;
|
|
3727
3727
|
}
|
|
3728
|
+
if (!this.authenticated) {
|
|
3729
|
+
d.warn("[walletChanged] not authenticated — 이벤트 무시", t);
|
|
3730
|
+
return;
|
|
3731
|
+
}
|
|
3728
3732
|
const i = typeof t.walletName == "string" ? t.walletName.trim() : "", o = i.length > 0 && i.length <= 64 ? i : void 0;
|
|
3729
3733
|
this.address && this.address.toLowerCase() === n.toLowerCase() || (d.log("[CROSSx] Native walletChanged 수신", { address: n, walletId: t.walletId, source: t.source, walletName: o }), this.setActiveWallet(n, 0, { walletName: o }), this._rnBridgeWalletAddress = n, this._rnBridgeWalletName = o);
|
|
3730
3734
|
}), d.log("[CROSSx] bridge.onEvent walletChanged 구독 완료");
|
|
@@ -4462,17 +4466,17 @@ function bn(s, e, r) {
|
|
|
4462
4466
|
const I = [];
|
|
4463
4467
|
for (; S < e; ) {
|
|
4464
4468
|
c = g();
|
|
4465
|
-
const
|
|
4466
|
-
I.push(
|
|
4469
|
+
const C = c.slice();
|
|
4470
|
+
I.push(C), S += c.length;
|
|
4467
4471
|
}
|
|
4468
4472
|
return Se(...I);
|
|
4469
4473
|
};
|
|
4470
4474
|
return (S, I) => {
|
|
4471
4475
|
p(), _(S);
|
|
4472
|
-
let
|
|
4473
|
-
for (; !(
|
|
4476
|
+
let C;
|
|
4477
|
+
for (; !(C = I(x())); )
|
|
4474
4478
|
_();
|
|
4475
|
-
return p(),
|
|
4479
|
+
return p(), C;
|
|
4476
4480
|
};
|
|
4477
4481
|
}
|
|
4478
4482
|
function Rt(s, e = {}, r = {}) {
|
|
@@ -4529,7 +4533,7 @@ function Nt(s, e, r) {
|
|
|
4529
4533
|
if (!s.eql(s.sqr(e), r))
|
|
4530
4534
|
throw new Error("Cannot find square root");
|
|
4531
4535
|
}
|
|
4532
|
-
function
|
|
4536
|
+
function Cr(s, e) {
|
|
4533
4537
|
const r = (s.ORDER + te) / Tr, t = s.pow(e, r);
|
|
4534
4538
|
return Nt(s, t, e), t;
|
|
4535
4539
|
}
|
|
@@ -4538,7 +4542,7 @@ function En(s, e) {
|
|
|
4538
4542
|
return Nt(s, a, e), a;
|
|
4539
4543
|
}
|
|
4540
4544
|
function An(s) {
|
|
4541
|
-
const e = rt(s), r =
|
|
4545
|
+
const e = rt(s), r = Or(s), t = r(e, e.neg(e.ONE)), n = r(e, t), i = r(e, e.neg(t)), o = (s + vn) / Nr;
|
|
4542
4546
|
return (a, c) => {
|
|
4543
4547
|
let l = a.pow(c, o), u = a.mul(l, t);
|
|
4544
4548
|
const p = a.mul(l, n), g = a.mul(l, i), _ = a.eql(a.sqr(u), c), x = a.eql(a.sqr(p), c);
|
|
@@ -4547,7 +4551,7 @@ function An(s) {
|
|
|
4547
4551
|
return Nt(a, S, c), S;
|
|
4548
4552
|
};
|
|
4549
4553
|
}
|
|
4550
|
-
function
|
|
4554
|
+
function Or(s) {
|
|
4551
4555
|
if (s < Ir)
|
|
4552
4556
|
throw new Error("sqrt is not defined for small field");
|
|
4553
4557
|
let e = s - te, r = 0;
|
|
@@ -4559,7 +4563,7 @@ function Cr(s) {
|
|
|
4559
4563
|
if (t++ > 1e3)
|
|
4560
4564
|
throw new Error("Cannot find square root: probably non-prime P");
|
|
4561
4565
|
if (r === 1)
|
|
4562
|
-
return
|
|
4566
|
+
return Cr;
|
|
4563
4567
|
let i = n.pow(t, e);
|
|
4564
4568
|
const o = (e + te) / ke;
|
|
4565
4569
|
return function(c, l) {
|
|
@@ -4582,7 +4586,7 @@ function Cr(s) {
|
|
|
4582
4586
|
};
|
|
4583
4587
|
}
|
|
4584
4588
|
function In(s) {
|
|
4585
|
-
return s % Tr === Ir ?
|
|
4589
|
+
return s % Tr === Ir ? Cr : s % Rr === kr ? En : s % Nr === Sn ? An(s) : Or(s);
|
|
4586
4590
|
}
|
|
4587
4591
|
const Tn = [
|
|
4588
4592
|
"create",
|
|
@@ -4638,7 +4642,7 @@ function Nn(s, e) {
|
|
|
4638
4642
|
const r = e !== void 0 ? e : s.toString(2).length, t = Math.ceil(r / 8);
|
|
4639
4643
|
return { nBitLength: r, nByteLength: t };
|
|
4640
4644
|
}
|
|
4641
|
-
class
|
|
4645
|
+
class Cn {
|
|
4642
4646
|
constructor(e, r = {}) {
|
|
4643
4647
|
P(this, "ORDER");
|
|
4644
4648
|
P(this, "BITS");
|
|
@@ -4751,7 +4755,7 @@ class On {
|
|
|
4751
4755
|
}
|
|
4752
4756
|
}
|
|
4753
4757
|
function rt(s, e = {}) {
|
|
4754
|
-
return new
|
|
4758
|
+
return new Cn(s, e);
|
|
4755
4759
|
}
|
|
4756
4760
|
function Lr(s) {
|
|
4757
4761
|
if (typeof s != "bigint")
|
|
@@ -4763,7 +4767,7 @@ function Dr(s) {
|
|
|
4763
4767
|
const e = Lr(s);
|
|
4764
4768
|
return e + Math.ceil(e / 2);
|
|
4765
4769
|
}
|
|
4766
|
-
function
|
|
4770
|
+
function On(s, e, r = !1) {
|
|
4767
4771
|
V(s);
|
|
4768
4772
|
const t = s.length, n = Lr(e), i = Dr(e);
|
|
4769
4773
|
if (t < 16 || t < i || t > 1024)
|
|
@@ -5114,18 +5118,18 @@ function Un(s, e = {}) {
|
|
|
5114
5118
|
throw new Error("compression is not supported: Field does not have .isOdd()");
|
|
5115
5119
|
}
|
|
5116
5120
|
function p(F, m, y) {
|
|
5117
|
-
const { x: k, y:
|
|
5121
|
+
const { x: k, y: O } = m.toAffine(), B = t.toBytes(k);
|
|
5118
5122
|
if (Xe(y, "isCompressed"), y) {
|
|
5119
5123
|
u();
|
|
5120
|
-
const b = !t.isOdd(
|
|
5124
|
+
const b = !t.isOdd(O);
|
|
5121
5125
|
return Se(Hr(b), B);
|
|
5122
5126
|
} else
|
|
5123
|
-
return Se(Uint8Array.of(4), B, t.toBytes(
|
|
5127
|
+
return Se(Uint8Array.of(4), B, t.toBytes(O));
|
|
5124
5128
|
}
|
|
5125
5129
|
function g(F) {
|
|
5126
5130
|
V(F, void 0, "Point");
|
|
5127
|
-
const { publicKey: m, publicKeyUncompressed: y } = l, k = F.length,
|
|
5128
|
-
if (k === m && (
|
|
5131
|
+
const { publicKey: m, publicKeyUncompressed: y } = l, k = F.length, O = F[0], B = F.subarray(1);
|
|
5132
|
+
if (k === m && (O === 2 || O === 3)) {
|
|
5129
5133
|
const b = t.fromBytes(B);
|
|
5130
5134
|
if (!t.isValid(b))
|
|
5131
5135
|
throw new Error("bad point: is not on curve, wrong x");
|
|
@@ -5139,8 +5143,8 @@ function Un(s, e = {}) {
|
|
|
5139
5143
|
}
|
|
5140
5144
|
u();
|
|
5141
5145
|
const T = t.isOdd(E);
|
|
5142
|
-
return (
|
|
5143
|
-
} else if (k === y &&
|
|
5146
|
+
return (O & 1) === 1 !== T && (E = t.neg(E)), { x: b, y: E };
|
|
5147
|
+
} else if (k === y && O === 4) {
|
|
5144
5148
|
const b = t.BYTES, v = t.fromBytes(B.subarray(0, b)), E = t.fromBytes(B.subarray(b, b * 2));
|
|
5145
5149
|
if (!S(v, E))
|
|
5146
5150
|
throw new Error("bad point: is not on curve");
|
|
@@ -5159,8 +5163,8 @@ function Un(s, e = {}) {
|
|
|
5159
5163
|
}
|
|
5160
5164
|
if (!S(i.Gx, i.Gy))
|
|
5161
5165
|
throw new Error("bad curve params: generator point");
|
|
5162
|
-
const I = t.mul(t.pow(i.a, ze), Fn),
|
|
5163
|
-
if (t.is0(t.add(I,
|
|
5166
|
+
const I = t.mul(t.pow(i.a, ze), Fn), C = t.mul(t.sqr(i.b), BigInt(27));
|
|
5167
|
+
if (t.is0(t.add(I, C)))
|
|
5164
5168
|
throw new Error("bad curve params: a or b");
|
|
5165
5169
|
function R(F, m, y = !1) {
|
|
5166
5170
|
if (!t.isValid(m) || y && t.is0(m))
|
|
@@ -5177,12 +5181,12 @@ function Un(s, e = {}) {
|
|
|
5177
5181
|
return Bn(F, c.basises, n.ORDER);
|
|
5178
5182
|
}
|
|
5179
5183
|
const q = Xt((F, m) => {
|
|
5180
|
-
const { X: y, Y: k, Z:
|
|
5181
|
-
if (t.eql(
|
|
5184
|
+
const { X: y, Y: k, Z: O } = F;
|
|
5185
|
+
if (t.eql(O, t.ONE))
|
|
5182
5186
|
return { x: y, y: k };
|
|
5183
5187
|
const B = F.is0();
|
|
5184
|
-
m == null && (m = B ? t.ONE : t.inv(
|
|
5185
|
-
const b = t.mul(y, m), v = t.mul(k, m), E = t.mul(
|
|
5188
|
+
m == null && (m = B ? t.ONE : t.inv(O));
|
|
5189
|
+
const b = t.mul(y, m), v = t.mul(k, m), E = t.mul(O, m);
|
|
5186
5190
|
if (B)
|
|
5187
5191
|
return { x: t.ZERO, y: t.ZERO };
|
|
5188
5192
|
if (!t.eql(E, t.ONE))
|
|
@@ -5203,8 +5207,8 @@ function Un(s, e = {}) {
|
|
|
5203
5207
|
throw new Error("bad point: not in prime-order subgroup");
|
|
5204
5208
|
return !0;
|
|
5205
5209
|
});
|
|
5206
|
-
function G(F, m, y, k,
|
|
5207
|
-
return y = new X(t.mul(y.X, F), y.Y, y.Z), m = Je(k, m), y = Je(
|
|
5210
|
+
function G(F, m, y, k, O) {
|
|
5211
|
+
return y = new X(t.mul(y.X, F), y.Y, y.Z), m = Je(k, m), y = Je(O, y), m.add(y);
|
|
5208
5212
|
}
|
|
5209
5213
|
const D = class D {
|
|
5210
5214
|
/** Does NOT validate if the point is valid. Use `.assertValidity()`. */
|
|
@@ -5262,7 +5266,7 @@ function Un(s, e = {}) {
|
|
|
5262
5266
|
/** Compare one point to another. */
|
|
5263
5267
|
equals(m) {
|
|
5264
5268
|
L(m);
|
|
5265
|
-
const { X: y, Y: k, Z:
|
|
5269
|
+
const { X: y, Y: k, Z: O } = this, { X: B, Y: b, Z: v } = m, E = t.eql(t.mul(y, v), t.mul(B, O)), T = t.eql(t.mul(k, v), t.mul(b, O));
|
|
5266
5270
|
return E && T;
|
|
5267
5271
|
}
|
|
5268
5272
|
/** Flips point to one corresponding to (x, -y) in Affine coordinates. */
|
|
@@ -5274,9 +5278,9 @@ function Un(s, e = {}) {
|
|
|
5274
5278
|
// https://eprint.iacr.org/2015/1060, algorithm 3
|
|
5275
5279
|
// Cost: 8M + 3S + 3*a + 2*b3 + 15add.
|
|
5276
5280
|
double() {
|
|
5277
|
-
const { a: m, b: y } = i, k = t.mul(y, ze), { X:
|
|
5278
|
-
let v = t.ZERO, E = t.ZERO, T = t.ZERO, N = t.mul(
|
|
5279
|
-
return $ = t.add($, $), T = t.mul(
|
|
5281
|
+
const { a: m, b: y } = i, k = t.mul(y, ze), { X: O, Y: B, Z: b } = this;
|
|
5282
|
+
let v = t.ZERO, E = t.ZERO, T = t.ZERO, N = t.mul(O, O), W = t.mul(B, B), U = t.mul(b, b), $ = t.mul(O, B);
|
|
5283
|
+
return $ = t.add($, $), T = t.mul(O, 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(N, U), $ = t.mul(m, $), $ = t.add($, T), T = t.add(N, N), N = t.add(T, N), N = t.add(N, U), N = t.mul(N, $), E = t.add(E, N), U = t.mul(B, b), U = t.add(U, U), N = t.mul(U, $), v = t.sub(v, N), T = t.mul(U, W), T = t.add(T, T), T = t.add(T, T), new D(v, E, T);
|
|
5280
5284
|
}
|
|
5281
5285
|
// Renes-Costello-Batina exception-free addition formula.
|
|
5282
5286
|
// There is 30% faster Jacobian formula, but it is not complete.
|
|
@@ -5284,13 +5288,13 @@ function Un(s, e = {}) {
|
|
|
5284
5288
|
// Cost: 12M + 0S + 3*a + 3*b3 + 23add.
|
|
5285
5289
|
add(m) {
|
|
5286
5290
|
L(m);
|
|
5287
|
-
const { X: y, Y: k, Z:
|
|
5291
|
+
const { X: y, Y: k, Z: O } = this, { X: B, Y: b, Z: v } = m;
|
|
5288
5292
|
let E = t.ZERO, T = t.ZERO, N = t.ZERO;
|
|
5289
5293
|
const W = i.a, U = t.mul(i.b, ze);
|
|
5290
|
-
let $ = t.mul(y, B), K = t.mul(k, b), Y = t.mul(
|
|
5291
|
-
ne = t.mul(ne, z), z = t.add($, K), ne = t.sub(ne, z), z = t.add(y,
|
|
5294
|
+
let $ = t.mul(y, B), K = t.mul(k, b), Y = t.mul(O, v), ne = t.add(y, k), z = t.add(B, b);
|
|
5295
|
+
ne = t.mul(ne, z), z = t.add($, K), ne = t.sub(ne, z), z = t.add(y, O);
|
|
5292
5296
|
let ee = t.add(B, v);
|
|
5293
|
-
return z = t.mul(z, ee), ee = t.add($, Y), z = t.sub(z, ee), ee = t.add(k,
|
|
5297
|
+
return z = t.mul(z, ee), ee = t.add($, Y), z = t.sub(z, ee), ee = t.add(k, O), E = t.add(b, v), ee = t.mul(ee, E), E = t.add(K, Y), ee = t.sub(ee, E), N = t.mul(W, z), E = t.mul(U, Y), N = t.add(E, N), E = t.sub(K, N), N = t.add(K, N), T = t.mul(E, N), 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), N = t.mul(ee, N), N = t.add(N, $), new D(E, T, N);
|
|
5294
5298
|
}
|
|
5295
5299
|
subtract(m) {
|
|
5296
5300
|
return this.add(m.negate());
|
|
@@ -5311,16 +5315,16 @@ function Un(s, e = {}) {
|
|
|
5311
5315
|
const { endo: y } = e;
|
|
5312
5316
|
if (!n.isValidNot0(m))
|
|
5313
5317
|
throw new Error("invalid scalar: out of range");
|
|
5314
|
-
let k,
|
|
5318
|
+
let k, O;
|
|
5315
5319
|
const B = (b) => H.cached(this, b, (v) => Qt(D, v));
|
|
5316
5320
|
if (y) {
|
|
5317
5321
|
const { k1neg: b, k1: v, k2neg: E, k2: T } = M(m), { p: N, f: W } = B(v), { p: U, f: $ } = B(T);
|
|
5318
|
-
|
|
5322
|
+
O = W.add($), k = G(y.beta, N, U, b, E);
|
|
5319
5323
|
} else {
|
|
5320
5324
|
const { p: b, f: v } = B(m);
|
|
5321
|
-
k = b,
|
|
5325
|
+
k = b, O = v;
|
|
5322
5326
|
}
|
|
5323
|
-
return Qt(D, [k,
|
|
5327
|
+
return Qt(D, [k, O])[0];
|
|
5324
5328
|
}
|
|
5325
5329
|
/**
|
|
5326
5330
|
* Non-constant-time multiplication. Uses double-and-add algorithm.
|
|
@@ -5338,8 +5342,8 @@ function Un(s, e = {}) {
|
|
|
5338
5342
|
if (H.hasCache(this))
|
|
5339
5343
|
return this.multiply(m);
|
|
5340
5344
|
if (y) {
|
|
5341
|
-
const { k1neg:
|
|
5342
|
-
return G(y.beta, E, T,
|
|
5345
|
+
const { k1neg: O, k1: B, k2neg: b, k2: v } = M(m), { p1: E, p2: T } = Ln(D, k, B, v);
|
|
5346
|
+
return G(y.beta, E, T, O, b);
|
|
5343
5347
|
} else
|
|
5344
5348
|
return H.unsafe(k, m);
|
|
5345
5349
|
}
|
|
@@ -5417,7 +5421,7 @@ function Hn(s, e = {}) {
|
|
|
5417
5421
|
}
|
|
5418
5422
|
}
|
|
5419
5423
|
function a(_ = t(n.seed)) {
|
|
5420
|
-
return
|
|
5424
|
+
return On(V(_, n.seed, "seed"), r.ORDER);
|
|
5421
5425
|
}
|
|
5422
5426
|
function c(_, x = !0) {
|
|
5423
5427
|
return s.BASE.multiply(r.fromBytes(_)).toBytes(x);
|
|
@@ -5467,37 +5471,37 @@ function Wn(s, e, r = {}) {
|
|
|
5467
5471
|
throw new Error(`invalid signature ${m}: out of range 1..Point.Fn.ORDER`);
|
|
5468
5472
|
return y;
|
|
5469
5473
|
}
|
|
5470
|
-
function
|
|
5474
|
+
function C() {
|
|
5471
5475
|
if (w)
|
|
5472
5476
|
throw new Error('"recovered" sig type is not supported for cofactor >2 curves');
|
|
5473
5477
|
}
|
|
5474
5478
|
function R(m, y) {
|
|
5475
5479
|
mt(y);
|
|
5476
|
-
const k = _.signature,
|
|
5477
|
-
return V(m,
|
|
5480
|
+
const k = _.signature, O = y === "compact" ? k : y === "recovered" ? k + 1 : void 0;
|
|
5481
|
+
return V(m, O);
|
|
5478
5482
|
}
|
|
5479
5483
|
class L {
|
|
5480
|
-
constructor(y, k,
|
|
5484
|
+
constructor(y, k, O) {
|
|
5481
5485
|
P(this, "r");
|
|
5482
5486
|
P(this, "s");
|
|
5483
5487
|
P(this, "recovery");
|
|
5484
|
-
if (this.r = I("r", y), this.s = I("s", k),
|
|
5485
|
-
if (
|
|
5488
|
+
if (this.r = I("r", y), this.s = I("s", k), O != null) {
|
|
5489
|
+
if (C(), ![0, 1, 2, 3].includes(O))
|
|
5486
5490
|
throw new Error("invalid recovery id");
|
|
5487
|
-
this.recovery =
|
|
5491
|
+
this.recovery = O;
|
|
5488
5492
|
}
|
|
5489
5493
|
Object.freeze(this);
|
|
5490
5494
|
}
|
|
5491
5495
|
static fromBytes(y, k = x.format) {
|
|
5492
5496
|
R(y, k);
|
|
5493
|
-
let
|
|
5497
|
+
let O;
|
|
5494
5498
|
if (k === "der") {
|
|
5495
5499
|
const { r: E, s: T } = ve.toSig(V(y));
|
|
5496
5500
|
return new L(E, T);
|
|
5497
5501
|
}
|
|
5498
|
-
k === "recovered" && (
|
|
5502
|
+
k === "recovered" && (O = y[0], k = "compact", y = y.subarray(1));
|
|
5499
5503
|
const B = _.signature / 2, b = y.subarray(0, B), v = y.subarray(B, B * 2);
|
|
5500
|
-
return new L(o.fromBytes(b), o.fromBytes(v),
|
|
5504
|
+
return new L(o.fromBytes(b), o.fromBytes(v), O);
|
|
5501
5505
|
}
|
|
5502
5506
|
static fromHex(y, k) {
|
|
5503
5507
|
return this.fromBytes(Ye(y), k);
|
|
@@ -5512,10 +5516,10 @@ function Wn(s, e, r = {}) {
|
|
|
5512
5516
|
return new L(this.r, this.s, y);
|
|
5513
5517
|
}
|
|
5514
5518
|
recoverPublicKey(y) {
|
|
5515
|
-
const { r: k, s:
|
|
5519
|
+
const { r: k, s: O } = this, B = this.assertRecovery(), b = B === 2 || B === 3 ? k + a : k;
|
|
5516
5520
|
if (!i.isValid(b))
|
|
5517
5521
|
throw new Error("invalid recovery id: sig.r+curve.n != R.x");
|
|
5518
|
-
const v = i.toBytes(b), E = s.fromBytes(Se(Hr((B & 1) === 0), v)), T = o.inv(b), N = q(V(y, void 0, "msgHash")), W = o.create(-N * T), U = o.create(
|
|
5522
|
+
const v = i.toBytes(b), E = s.fromBytes(Se(Hr((B & 1) === 0), v)), T = o.inv(b), N = q(V(y, void 0, "msgHash")), W = o.create(-N * T), U = o.create(O * T), $ = s.BASE.multiplyUnsafe(W).add(E.multiplyUnsafe(U));
|
|
5519
5523
|
if ($.is0())
|
|
5520
5524
|
throw new Error("invalid recovery: point at infinify");
|
|
5521
5525
|
return $.assertValidity(), $;
|
|
@@ -5527,8 +5531,8 @@ function Wn(s, e, r = {}) {
|
|
|
5527
5531
|
toBytes(y = x.format) {
|
|
5528
5532
|
if (mt(y), y === "der")
|
|
5529
5533
|
return Ye(ve.hexFromSig(this));
|
|
5530
|
-
const { r: k, s:
|
|
5531
|
-
return y === "recovered" ? (
|
|
5534
|
+
const { r: k, s: O } = this, B = o.toBytes(k), b = o.toBytes(O);
|
|
5535
|
+
return y === "recovered" ? (C(), Se(Uint8Array.of(this.assertRecovery()), B, b)) : Se(B, b);
|
|
5532
5536
|
}
|
|
5533
5537
|
toHex(y) {
|
|
5534
5538
|
return We(this.toBytes(y));
|
|
@@ -5537,8 +5541,8 @@ function Wn(s, e, r = {}) {
|
|
|
5537
5541
|
const M = r.bits2int || function(y) {
|
|
5538
5542
|
if (y.length > 8192)
|
|
5539
5543
|
throw new Error("input is too large");
|
|
5540
|
-
const k = tt(y),
|
|
5541
|
-
return
|
|
5544
|
+
const k = tt(y), O = y.length * 8 - c;
|
|
5545
|
+
return O > 0 ? k >> BigInt(O) : k;
|
|
5542
5546
|
}, q = r.bits2int_modN || function(y) {
|
|
5543
5547
|
return o.create(M(y));
|
|
5544
5548
|
}, J = kt(c);
|
|
@@ -5549,7 +5553,7 @@ function Wn(s, e, r = {}) {
|
|
|
5549
5553
|
return V(m, void 0, "message"), y ? V(e(m), void 0, "prehashed message") : m;
|
|
5550
5554
|
}
|
|
5551
5555
|
function Q(m, y, k) {
|
|
5552
|
-
const { lowS:
|
|
5556
|
+
const { lowS: O, prehash: B, extraEntropy: b } = ut(k, x);
|
|
5553
5557
|
m = X(m, B);
|
|
5554
5558
|
const v = q(m), E = o.fromBytes(y);
|
|
5555
5559
|
if (!o.isValidNot0(E))
|
|
@@ -5571,16 +5575,16 @@ function Wn(s, e, r = {}) {
|
|
|
5571
5575
|
if (ee === ge)
|
|
5572
5576
|
return;
|
|
5573
5577
|
let Lt = (ne.x === z ? 0 : 2) | Number(ne.y & Le), Dt = ee;
|
|
5574
|
-
return
|
|
5578
|
+
return O && S(ee) && (Dt = o.neg(ee), Lt ^= 1), new L(z, Dt, w ? void 0 : Lt);
|
|
5575
5579
|
}
|
|
5576
5580
|
return { seed: N, k2sig: U };
|
|
5577
5581
|
}
|
|
5578
5582
|
function H(m, y, k = {}) {
|
|
5579
|
-
const { seed:
|
|
5580
|
-
return bn(e.outputLen, o.BYTES, n)(
|
|
5583
|
+
const { seed: O, k2sig: B } = Q(m, y, k);
|
|
5584
|
+
return bn(e.outputLen, o.BYTES, n)(O, B).toBytes(k.format);
|
|
5581
5585
|
}
|
|
5582
|
-
function D(m, y, k,
|
|
5583
|
-
const { lowS: B, prehash: b, format: v } = ut(
|
|
5586
|
+
function D(m, y, k, O = {}) {
|
|
5587
|
+
const { lowS: B, prehash: b, format: v } = ut(O, x);
|
|
5584
5588
|
if (k = V(k, void 0, "publicKey"), y = X(y, b), !At(m)) {
|
|
5585
5589
|
const E = m instanceof L ? ", use sig.toBytes()" : "";
|
|
5586
5590
|
throw new Error("verify expects Uint8Array signature" + E);
|
|
@@ -5597,8 +5601,8 @@ function Wn(s, e, r = {}) {
|
|
|
5597
5601
|
}
|
|
5598
5602
|
}
|
|
5599
5603
|
function F(m, y, k = {}) {
|
|
5600
|
-
const { prehash:
|
|
5601
|
-
return y = X(y,
|
|
5604
|
+
const { prehash: O } = ut(k, x);
|
|
5605
|
+
return y = X(y, O), L.fromBytes(m, "recovered").recoverPublicKey(y).toBytes();
|
|
5602
5606
|
}
|
|
5603
5607
|
return Object.freeze({
|
|
5604
5608
|
keygen: l,
|
|
@@ -5615,7 +5619,7 @@ function Wn(s, e, r = {}) {
|
|
|
5615
5619
|
});
|
|
5616
5620
|
}
|
|
5617
5621
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
5618
|
-
const
|
|
5622
|
+
const Ct = {
|
|
5619
5623
|
p: BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),
|
|
5620
5624
|
n: BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),
|
|
5621
5625
|
h: BigInt(1),
|
|
@@ -5631,12 +5635,12 @@ const Ot = {
|
|
|
5631
5635
|
]
|
|
5632
5636
|
}, nr = /* @__PURE__ */ BigInt(2);
|
|
5633
5637
|
function qn(s) {
|
|
5634
|
-
const e =
|
|
5638
|
+
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);
|
|
5635
5639
|
if (!yt.eql(yt.sqr(q), s))
|
|
5636
5640
|
throw new Error("Cannot find square root");
|
|
5637
5641
|
return q;
|
|
5638
5642
|
}
|
|
5639
|
-
const yt = rt(
|
|
5643
|
+
const yt = rt(Ct.p, { sqrt: qn }), Kn = /* @__PURE__ */ Un(Ct, {
|
|
5640
5644
|
Fp: yt,
|
|
5641
5645
|
endo: Gn
|
|
5642
5646
|
}), 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 = [];
|
|
@@ -5673,7 +5677,7 @@ function ei(s, e = 24) {
|
|
|
5673
5677
|
}
|
|
5674
5678
|
$e(r);
|
|
5675
5679
|
}
|
|
5676
|
-
class
|
|
5680
|
+
class Ot {
|
|
5677
5681
|
// NOTE: we accept arguments in bytes instead of bits here.
|
|
5678
5682
|
constructor(e, r, t, n = !1, i = 24) {
|
|
5679
5683
|
P(this, "state");
|
|
@@ -5746,10 +5750,10 @@ class Ct {
|
|
|
5746
5750
|
}
|
|
5747
5751
|
_cloneInto(e) {
|
|
5748
5752
|
const { blockLen: r, suffix: t, outputLen: n, rounds: i, enableXOF: o } = this;
|
|
5749
|
-
return e || (e = new
|
|
5753
|
+
return e || (e = new Ot(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;
|
|
5750
5754
|
}
|
|
5751
5755
|
}
|
|
5752
|
-
const ti = (s, e, r, t = {}) => yr(() => new
|
|
5756
|
+
const ti = (s, e, r, t = {}) => yr(() => new Ot(e, s, r), t), ar = /* @__PURE__ */ ti(1, 136, 32), ri = 60;
|
|
5753
5757
|
class si {
|
|
5754
5758
|
constructor() {
|
|
5755
5759
|
this.jwks = null;
|
|
@@ -5969,7 +5973,7 @@ class Ae {
|
|
|
5969
5973
|
d.warn("[CROSSx] OAuth 타임아웃 (5분) — postMessage를 수신하지 못했습니다"), L(), t(new Error("Authentication timeout"));
|
|
5970
5974
|
}, 5 * 60 * 1e3), x = 10, w = 30;
|
|
5971
5975
|
let S = 0, I = null;
|
|
5972
|
-
const
|
|
5976
|
+
const C = () => {
|
|
5973
5977
|
clearInterval(R), d.warn("[CROSSx] COOP 감지 — OAuth 서버 응답을 " + w + "초간 대기합니다"), I = setTimeout(() => {
|
|
5974
5978
|
L(), t(new Error(
|
|
5975
5979
|
"OAuth 서버로부터 응답을 받지 못했습니다. 브라우저 보안 정책(COOP)으로 인해 팝업 통신이 차단되었을 수 있습니다. 다시 시도해 주세요."
|
|
@@ -5978,9 +5982,9 @@ class Ae {
|
|
|
5978
5982
|
}, R = setInterval(() => {
|
|
5979
5983
|
S++;
|
|
5980
5984
|
try {
|
|
5981
|
-
g.closed && (S <= x ?
|
|
5985
|
+
g.closed && (S <= x ? C() : (L(), t(new Error("로그인이 취소되었습니다"))));
|
|
5982
5986
|
} catch {
|
|
5983
|
-
|
|
5987
|
+
C();
|
|
5984
5988
|
}
|
|
5985
5989
|
}, 1e3), L = () => {
|
|
5986
5990
|
clearTimeout(_), clearInterval(R), I && clearTimeout(I), window.removeEventListener("message", M);
|
|
@@ -6019,8 +6023,8 @@ class Ae {
|
|
|
6019
6023
|
return;
|
|
6020
6024
|
}
|
|
6021
6025
|
const m = { token: D, email: F }, y = (k) => {
|
|
6022
|
-
Ae.verifyIdTokenNonce(k, l).then(() => r(m)).catch((
|
|
6023
|
-
d.error("[CROSSx] nonce 검증 실패:",
|
|
6026
|
+
Ae.verifyIdTokenNonce(k, l).then(() => r(m)).catch((O) => {
|
|
6027
|
+
d.error("[CROSSx] nonce 검증 실패:", O), t(O instanceof Error ? O : new Error("nonce verification failed"));
|
|
6024
6028
|
});
|
|
6025
6029
|
};
|
|
6026
6030
|
H ? H.split(".").length === 3 ? y(H) : Q ? y(Q) : (d.warn(
|
|
@@ -6266,9 +6270,9 @@ class Ie {
|
|
|
6266
6270
|
h.USER_NOT_FOUND,
|
|
6267
6271
|
Ie.getGatewayErrorMessage(_.code, x)
|
|
6268
6272
|
);
|
|
6269
|
-
const S = w === h.AUTH_NOT_AUTHENTICATED ? h.SESSION_EXPIRED : w, I = S === h.SESSION_EXPIRED ? "인증 세션이 만료되었습니다. 다시 로그인해 주세요." : Ie.getGatewayErrorMessage(_.code, x),
|
|
6273
|
+
const S = w === h.AUTH_NOT_AUTHENTICATED ? h.SESSION_EXPIRED : w, I = S === h.SESSION_EXPIRED ? "인증 세션이 만료되었습니다. 다시 로그인해 주세요." : Ie.getGatewayErrorMessage(_.code, x), C = _.data;
|
|
6270
6274
|
let R;
|
|
6271
|
-
throw w === h.PIN_LOCKED ? R = Ie.extractLockDetails(
|
|
6275
|
+
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);
|
|
6272
6276
|
}
|
|
6273
6277
|
return d.log("[CROSSx] Wallet Gateway API 성공:", { code: _.code, url: o, method: e }), _.data ?? _;
|
|
6274
6278
|
}
|
|
@@ -9151,7 +9155,7 @@ function _i(s) {
|
|
|
9151
9155
|
}, { passive: !0 });
|
|
9152
9156
|
}
|
|
9153
9157
|
const fi = () => /iPad|iPhone|iPod/.test(navigator.userAgent) || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1;
|
|
9154
|
-
function
|
|
9158
|
+
function Ce() {
|
|
9155
9159
|
if (fi()) {
|
|
9156
9160
|
const e = window.scrollY;
|
|
9157
9161
|
return document.body.style.position = "fixed", document.body.style.top = `-${e}px`, document.body.style.left = "0", document.body.style.right = "0", () => {
|
|
@@ -9429,7 +9433,7 @@ function Ri(s) {
|
|
|
9429
9433
|
function Ni(s) {
|
|
9430
9434
|
return `https://www.crossscan.io/address/${s}?tab=txs`;
|
|
9431
9435
|
}
|
|
9432
|
-
function
|
|
9436
|
+
function Ci(s, e) {
|
|
9433
9437
|
return `https://explorer.crosstoken.io/${Ri(s)}/tx/${e}`;
|
|
9434
9438
|
}
|
|
9435
9439
|
function Jr(s, e) {
|
|
@@ -9439,9 +9443,9 @@ function Ze(s) {
|
|
|
9439
9443
|
return Jr(de(s), Ni(s));
|
|
9440
9444
|
}
|
|
9441
9445
|
function Zr(s, e) {
|
|
9442
|
-
return Jr(de(e),
|
|
9446
|
+
return Jr(de(e), Ci(s, e));
|
|
9443
9447
|
}
|
|
9444
|
-
function
|
|
9448
|
+
function Oi(s, e, r) {
|
|
9445
9449
|
const t = j(
|
|
9446
9450
|
(r == null ? void 0 : r.label_from) ?? "From",
|
|
9447
9451
|
`${Ze(s.from)}
|
|
@@ -9521,10 +9525,10 @@ function Li(s, e, r, t) {
|
|
|
9521
9525
|
<button class="__crossx-approve-btn" id="__crossx-done-btn">${A((t == null ? void 0 : t.tx_complete_done_button) ?? (n ? "All Done" : "Done"))}</button>
|
|
9522
9526
|
`, c.querySelectorAll(".__crossx-copy-btn").forEach((w) => {
|
|
9523
9527
|
w.addEventListener("click", (S) => {
|
|
9524
|
-
var
|
|
9528
|
+
var C;
|
|
9525
9529
|
S.stopPropagation();
|
|
9526
9530
|
const I = w.dataset.copy;
|
|
9527
|
-
I && ((
|
|
9531
|
+
I && ((C = navigator.clipboard) == null || C.writeText(I).catch(() => {
|
|
9528
9532
|
}));
|
|
9529
9533
|
});
|
|
9530
9534
|
});
|
|
@@ -9963,7 +9967,7 @@ function to(s) {
|
|
|
9963
9967
|
return r > 0 ? `${r}h ${String(t).padStart(2, "0")}m` : `${String(t).padStart(2, "0")}:${String(n).padStart(2, "0")}`;
|
|
9964
9968
|
}
|
|
9965
9969
|
function _t(s, e, r, t, n, i, o) {
|
|
9966
|
-
var
|
|
9970
|
+
var O, B;
|
|
9967
9971
|
let a = !!(i && i > Date.now()), c = !1;
|
|
9968
9972
|
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 = () => {
|
|
9969
9973
|
var E;
|
|
@@ -9975,7 +9979,7 @@ function _t(s, e, r, t, n, i, o) {
|
|
|
9975
9979
|
const T = b.findIndex((W) => !W.value);
|
|
9976
9980
|
(E = v[T === -1 ? 5 : T]) == null || E.classList.add("--active");
|
|
9977
9981
|
}
|
|
9978
|
-
},
|
|
9982
|
+
}, C = () => {
|
|
9979
9983
|
s.querySelectorAll(".__crossx-pin6-numpad-key[data-key]").forEach((v) => v.classList.toggle("--disabled", a)), S().forEach((v) => v.classList.toggle("--locked", a)), I();
|
|
9980
9984
|
}, R = (b) => {
|
|
9981
9985
|
a = b, l().forEach((v) => {
|
|
@@ -10022,7 +10026,7 @@ function _t(s, e, r, t, n, i, o) {
|
|
|
10022
10026
|
var W;
|
|
10023
10027
|
R(!0), l().forEach((U) => {
|
|
10024
10028
|
U.value = "";
|
|
10025
|
-
}),
|
|
10029
|
+
}), C();
|
|
10026
10030
|
const v = p();
|
|
10027
10031
|
if (v && (v.textContent = "Too many failed attempts. Please wait."), !g()) {
|
|
10028
10032
|
const U = document.createElement("p");
|
|
@@ -10033,7 +10037,7 @@ function _t(s, e, r, t, n, i, o) {
|
|
|
10033
10037
|
const E = () => {
|
|
10034
10038
|
var K;
|
|
10035
10039
|
const U = b - Date.now(), $ = _();
|
|
10036
|
-
U <= 0 ? (clearInterval(T), R(!1), (K = g()) == null || K.remove(), v && (v.textContent = ""),
|
|
10040
|
+
U <= 0 ? (clearInterval(T), R(!1), (K = g()) == null || K.remove(), v && (v.textContent = ""), C(), setTimeout(() => {
|
|
10037
10041
|
var Y;
|
|
10038
10042
|
return (Y = l()[0]) == null ? void 0 : Y.focus();
|
|
10039
10043
|
}, 50)) : $ && ($.textContent = ` ${to(U)}`);
|
|
@@ -10074,7 +10078,7 @@ function _t(s, e, r, t, n, i, o) {
|
|
|
10074
10078
|
const b = l(), v = b.find((E) => !E.value) ?? b[b.length - 1];
|
|
10075
10079
|
v == null || v.focus();
|
|
10076
10080
|
};
|
|
10077
|
-
(
|
|
10081
|
+
(O = u()) == null || O.addEventListener("click", (b) => {
|
|
10078
10082
|
b.target.classList.contains("__crossx-pin6-box") || y();
|
|
10079
10083
|
}), (B = x()) == null || B.addEventListener("click", (b) => {
|
|
10080
10084
|
const v = b.target;
|
|
@@ -10134,7 +10138,7 @@ function _t(s, e, r, t, n, i, o) {
|
|
|
10134
10138
|
v();
|
|
10135
10139
|
const W = N.getBoundingClientRect();
|
|
10136
10140
|
T.clientX >= W.left && T.clientX <= W.right && T.clientY >= W.top && T.clientY <= W.bottom && !a && !c && E(N);
|
|
10137
|
-
}), k.addEventListener("pointercancel", v), k.addEventListener("pointerleave", v, !0), I(), i && i > Date.now() &&
|
|
10141
|
+
}), k.addEventListener("pointercancel", v), k.addEventListener("pointerleave", v, !0), I(), i && i > Date.now() && C();
|
|
10138
10142
|
}
|
|
10139
10143
|
}
|
|
10140
10144
|
const ro = `<svg width="22" height="17" viewBox="0 0 22 17" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
@@ -10207,9 +10211,9 @@ class oo {
|
|
|
10207
10211
|
*/
|
|
10208
10212
|
showWalletSelector(e, r, t) {
|
|
10209
10213
|
return new Promise((n, i) => {
|
|
10210
|
-
var
|
|
10214
|
+
var C;
|
|
10211
10215
|
ae();
|
|
10212
|
-
const o = [...e], a = Wi(o, this.tokens, t, this.messages), c =
|
|
10216
|
+
const o = [...e], a = Wi(o, this.tokens, t, this.messages), c = Ce();
|
|
10213
10217
|
ce(a);
|
|
10214
10218
|
let l = !1;
|
|
10215
10219
|
const u = () => {
|
|
@@ -10249,7 +10253,7 @@ class oo {
|
|
|
10249
10253
|
const L = R instanceof f && R.code === h.ADDRESS_LIMIT_EXCEEDED, M = this.resolveAddWalletErrorMessage(R);
|
|
10250
10254
|
w && (w.textContent = M, w.hidden = !1), L ? (S.disabled = !0, S.setAttribute("aria-disabled", "true")) : S.disabled = !1, p = R;
|
|
10251
10255
|
}
|
|
10252
|
-
}), (
|
|
10256
|
+
}), (C = a.querySelector("#__crossx-close-btn")) == null || C.addEventListener("click", _), a.addEventListener("click", (R) => {
|
|
10253
10257
|
R.target === a && _();
|
|
10254
10258
|
});
|
|
10255
10259
|
const I = (R) => {
|
|
@@ -10286,7 +10290,7 @@ class oo {
|
|
|
10286
10290
|
return new Promise((n) => {
|
|
10287
10291
|
var g, _, x, w;
|
|
10288
10292
|
ae();
|
|
10289
|
-
const i = zi(this.tokens, r, this.messages), o =
|
|
10293
|
+
const i = zi(this.tokens, r, this.messages), o = Ce();
|
|
10290
10294
|
ce(i);
|
|
10291
10295
|
const a = () => {
|
|
10292
10296
|
i.remove(), o();
|
|
@@ -10298,8 +10302,8 @@ class oo {
|
|
|
10298
10302
|
a(), n(null);
|
|
10299
10303
|
};
|
|
10300
10304
|
(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) => {
|
|
10301
|
-
const
|
|
10302
|
-
|
|
10305
|
+
const C = S.currentTarget.dataset.walletId ?? "";
|
|
10306
|
+
C && l(C);
|
|
10303
10307
|
}), (w = i.querySelector("#__crossx-close-btn")) == null || w.addEventListener("click", u), i.addEventListener("click", (S) => {
|
|
10304
10308
|
S.target === i && u();
|
|
10305
10309
|
}), i.querySelectorAll(".__crossx-login-terms-link").forEach((S) => {
|
|
@@ -10322,7 +10326,7 @@ class oo {
|
|
|
10322
10326
|
accountLabel: (t == null ? void 0 : t.session_alert_account_label) ?? "Account",
|
|
10323
10327
|
signOutLabel: (t == null ? void 0 : t.session_alert_sign_out_button) ?? "Sign out",
|
|
10324
10328
|
signInAgainLabel: (t == null ? void 0 : t.session_alert_sign_in_again_button) ?? "Sign in again"
|
|
10325
|
-
}), i =
|
|
10329
|
+
}), i = Ce();
|
|
10326
10330
|
ce(n);
|
|
10327
10331
|
let o = !1;
|
|
10328
10332
|
const a = () => {
|
|
@@ -10391,13 +10395,13 @@ class oo {
|
|
|
10391
10395
|
}, o = {
|
|
10392
10396
|
title: (t == null ? void 0 : t.pin_setup_confirm_title) ?? "Confirm PIN",
|
|
10393
10397
|
headerSubtitle: (t == null ? void 0 : t.pin_setup_confirm_subtitle) ?? "Enter your PIN again to confirm."
|
|
10394
|
-
}, a = hr(this.tokens, Qi(n)), c =
|
|
10398
|
+
}, a = hr(this.tokens, Qi(n)), c = Ce();
|
|
10395
10399
|
ce(a);
|
|
10396
10400
|
let l = !1;
|
|
10397
10401
|
const u = () => {
|
|
10398
10402
|
l || (l = !0, a.remove(), c());
|
|
10399
|
-
}, p = (
|
|
10400
|
-
u(), r(
|
|
10403
|
+
}, p = (C) => {
|
|
10404
|
+
u(), r(C);
|
|
10401
10405
|
}, g = () => {
|
|
10402
10406
|
u(), r(null);
|
|
10403
10407
|
}, _ = a.querySelector(".__crossx-card"), x = {
|
|
@@ -10406,21 +10410,21 @@ class oo {
|
|
|
10406
10410
|
repeatingDigit: (t == null ? void 0 : t.pin_validation_repeating_digit) ?? "Cannot use the same number 3+ times in a row.",
|
|
10407
10411
|
sequential: (t == null ? void 0 : t.pin_validation_sequential) ?? "Sequential numbers (e.g., 123456) are not allowed.",
|
|
10408
10412
|
alternatingPattern: (t == null ? void 0 : t.pin_validation_alternating_pattern) ?? "Repeating patterns (e.g., 121212) are not allowed."
|
|
10409
|
-
}, w = (
|
|
10413
|
+
}, w = (C) => {
|
|
10410
10414
|
var R;
|
|
10411
10415
|
_.innerHTML = pt({
|
|
10412
10416
|
title: o.title,
|
|
10413
10417
|
headerSubtitle: o.headerSubtitle
|
|
10414
10418
|
}), (R = _.querySelector("#__crossx-close-btn")) == null || R.addEventListener("click", g), _t(_, (L) => {
|
|
10415
|
-
L ===
|
|
10419
|
+
L === C ? p(C) : S(i.mismatchError);
|
|
10416
10420
|
}, g);
|
|
10417
|
-
}, S = (
|
|
10421
|
+
}, S = (C) => {
|
|
10418
10422
|
var R;
|
|
10419
10423
|
_.innerHTML = pt({
|
|
10420
10424
|
title: i.title,
|
|
10421
10425
|
headerSubtitle: i.headerSubtitle,
|
|
10422
10426
|
subtitle: i.subtitle,
|
|
10423
|
-
errorMessage:
|
|
10427
|
+
errorMessage: C
|
|
10424
10428
|
}), (R = _.querySelector("#__crossx-close-btn")) == null || R.addEventListener("click", g), _t(_, (L) => {
|
|
10425
10429
|
const M = eo(L, x);
|
|
10426
10430
|
M ? S(M) : w(L);
|
|
@@ -10428,10 +10432,10 @@ class oo {
|
|
|
10428
10432
|
};
|
|
10429
10433
|
(() => {
|
|
10430
10434
|
var Q;
|
|
10431
|
-
const
|
|
10435
|
+
const C = Array.from(_.querySelectorAll(".__crossx-pw-notice-item")), R = _.querySelector("#__crossx-pin-notice-next"), L = /* @__PURE__ */ new Set();
|
|
10432
10436
|
R.removeAttribute("disabled");
|
|
10433
10437
|
const M = R.dataset.nextLabel ?? "Next", q = R.dataset.submitLabel ?? "I Understand", J = () => {
|
|
10434
|
-
const H = L.size ===
|
|
10438
|
+
const H = L.size === C.length;
|
|
10435
10439
|
R.classList.toggle("--disabled", !H), R.textContent = H ? q : M;
|
|
10436
10440
|
}, G = (H, D) => {
|
|
10437
10441
|
if (L.has(D)) return;
|
|
@@ -10442,7 +10446,7 @@ class oo {
|
|
|
10442
10446
|
const F = H.querySelector(`#__crossx-notice-check-${D}`);
|
|
10443
10447
|
L.delete(D), F.classList.remove("--checked"), H.setAttribute("aria-checked", "false"), J();
|
|
10444
10448
|
};
|
|
10445
|
-
|
|
10449
|
+
C.forEach((H) => {
|
|
10446
10450
|
const D = parseInt(H.dataset.checkIndex ?? "0", 10);
|
|
10447
10451
|
H.addEventListener("click", () => {
|
|
10448
10452
|
L.has(D) ? X(H, D) : G(H, D);
|
|
@@ -10450,11 +10454,11 @@ class oo {
|
|
|
10450
10454
|
(F.key === " " || F.key === "Enter") && (F.preventDefault(), L.has(D) ? X(H, D) : G(H, D));
|
|
10451
10455
|
});
|
|
10452
10456
|
}), R.addEventListener("click", () => {
|
|
10453
|
-
if (L.size ===
|
|
10457
|
+
if (L.size === C.length) {
|
|
10454
10458
|
S(e == null ? void 0 : e.errorMessage);
|
|
10455
10459
|
return;
|
|
10456
10460
|
}
|
|
10457
|
-
const H =
|
|
10461
|
+
const H = C.find((F) => {
|
|
10458
10462
|
const m = parseInt(F.dataset.checkIndex ?? "0", 10);
|
|
10459
10463
|
return !L.has(m);
|
|
10460
10464
|
});
|
|
@@ -10464,8 +10468,8 @@ class oo {
|
|
|
10464
10468
|
H.classList.remove("--highlight"), G(H, D);
|
|
10465
10469
|
}, 400);
|
|
10466
10470
|
}), (Q = _.querySelector("#__crossx-close-btn")) == null || Q.addEventListener("click", g);
|
|
10467
|
-
})(), a.addEventListener("click", (
|
|
10468
|
-
|
|
10471
|
+
})(), a.addEventListener("click", (C) => {
|
|
10472
|
+
C.target === a && g();
|
|
10469
10473
|
});
|
|
10470
10474
|
});
|
|
10471
10475
|
}
|
|
@@ -10489,20 +10493,20 @@ class oo {
|
|
|
10489
10493
|
attemptCount: e == null ? void 0 : e.attemptCount,
|
|
10490
10494
|
maxAttempts: e == null ? void 0 : e.maxAttempts
|
|
10491
10495
|
})
|
|
10492
|
-
), u =
|
|
10496
|
+
), u = Ce();
|
|
10493
10497
|
ce(l);
|
|
10494
10498
|
let p = !1;
|
|
10495
10499
|
const g = () => {
|
|
10496
10500
|
p || (p = !0, l.remove(), u());
|
|
10497
|
-
}, _ = (
|
|
10498
|
-
g(), r(
|
|
10501
|
+
}, _ = (C) => {
|
|
10502
|
+
g(), r(C);
|
|
10499
10503
|
}, x = () => {
|
|
10500
10504
|
g(), r(null);
|
|
10501
|
-
}, w = (
|
|
10502
|
-
g(), t(
|
|
10505
|
+
}, w = (C) => {
|
|
10506
|
+
g(), t(C);
|
|
10503
10507
|
}, S = l.querySelector(".__crossx-card");
|
|
10504
|
-
(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", (
|
|
10505
|
-
|
|
10508
|
+
(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) => {
|
|
10509
|
+
C.target === l && x();
|
|
10506
10510
|
});
|
|
10507
10511
|
});
|
|
10508
10512
|
}
|
|
@@ -10559,7 +10563,7 @@ class oo {
|
|
|
10559
10563
|
return new Promise((r) => {
|
|
10560
10564
|
var a, c;
|
|
10561
10565
|
ae();
|
|
10562
|
-
const t =
|
|
10566
|
+
const t = Oi(e, this.tokens, this.messages);
|
|
10563
10567
|
ce(t);
|
|
10564
10568
|
const n = () => t.remove(), i = () => {
|
|
10565
10569
|
n(), r();
|
|
@@ -10615,7 +10619,7 @@ class oo {
|
|
|
10615
10619
|
ae();
|
|
10616
10620
|
let t;
|
|
10617
10621
|
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);
|
|
10618
|
-
const n =
|
|
10622
|
+
const n = Ce();
|
|
10619
10623
|
ce(t);
|
|
10620
10624
|
const i = () => {
|
|
10621
10625
|
t.remove(), n();
|
|
@@ -10887,7 +10891,7 @@ Example: createCROSSxSDK({ projectId: "your-project-id", ... })`
|
|
|
10887
10891
|
},
|
|
10888
10892
|
() => typeof window < "u" ? window.location.origin : "http://localhost",
|
|
10889
10893
|
x
|
|
10890
|
-
),
|
|
10894
|
+
), C = e != null && e.wrapConfirmation ? e.wrapConfirmation(I) : I, R = new xt(
|
|
10891
10895
|
t,
|
|
10892
10896
|
n,
|
|
10893
10897
|
o,
|
|
@@ -10896,7 +10900,7 @@ Example: createCROSSxSDK({ projectId: "your-project-id", ... })`
|
|
|
10896
10900
|
l,
|
|
10897
10901
|
g,
|
|
10898
10902
|
u,
|
|
10899
|
-
|
|
10903
|
+
C,
|
|
10900
10904
|
w,
|
|
10901
10905
|
p
|
|
10902
10906
|
);
|