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