@nexus-cross/crossx-sdk-core 2.2.1-beta.1 → 2.2.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/crossx.global +8 -8
- package/dist/index.cjs +1 -1
- package/dist/index.js +169 -147
- package/dist/sdk/CROSSxSDK.d.ts +13 -4
- 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 ?? "(없음)",
|
|
@@ -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,
|
|
@@ -2630,20 +2630,29 @@ const Te = class Te extends ys {
|
|
|
2630
2630
|
}
|
|
2631
2631
|
}
|
|
2632
2632
|
/**
|
|
2633
|
-
* OAuth deeplink로 수신한 Firebase 토큰을 직접 주입하여
|
|
2633
|
+
* OAuth deeplink로 수신한 Firebase 토큰을 직접 주입하여 로그인 + 지갑 준비까지 수행합니다.
|
|
2634
2634
|
*
|
|
2635
2635
|
* RN WebView 등 팝업이 불가능한 환경에서, 네이티브 앱이 OAuth deeplink로
|
|
2636
2636
|
* 수신한 Firebase 토큰을 JS injection으로 SDK에 전달할 때 사용합니다.
|
|
2637
2637
|
*
|
|
2638
|
-
*
|
|
2638
|
+
* 내부 흐름:
|
|
2639
|
+
* 1. Firebase 토큰 → CROSSx 인증 교환
|
|
2640
|
+
* 2. 지갑 상태 확인 → 필요 시 createWallet 자동 호출
|
|
2641
|
+
* - `migration_required`: 마이그레이션 UI 자동 트리거
|
|
2642
|
+
* - `not_found`: PIN 설정 UI 자동 트리거
|
|
2643
|
+
* - `exists`: PIN 검증 UI 자동 트리거
|
|
2644
|
+
* 3. 다중 지갑이면 selectWallet 모달로 활성 지갑 선택
|
|
2639
2645
|
*
|
|
2640
2646
|
* @param firebaseToken OAuth 서비스에서 발급받은 Firebase JWT
|
|
2647
|
+
* @returns `AuthResult` + `addresses` (지갑 주소 목록)
|
|
2648
|
+
* @throws 마이그레이션/PIN 설정을 사용자가 취소하면 `CROSSxError(MIGRATION_FAILED | PIN_CANCELLED)`
|
|
2641
2649
|
*
|
|
2642
2650
|
* @example
|
|
2643
2651
|
* // RN WebView에서 JS injection으로 호출
|
|
2644
2652
|
* const result = await sdk.signInWithOAuthToken(firebaseTokenFromDeeplink);
|
|
2645
2653
|
* if (result.success) {
|
|
2646
|
-
* console.log(result.address);
|
|
2654
|
+
* console.log(result.address); // '0x...'
|
|
2655
|
+
* console.log(result.addresses); // [{ address: '0x...', index: 0 }]
|
|
2647
2656
|
* }
|
|
2648
2657
|
*/
|
|
2649
2658
|
async signInWithOAuthToken(e) {
|
|
@@ -2652,11 +2661,24 @@ const Te = class Te extends ys {
|
|
|
2652
2661
|
h.ALREADY_AUTHENTICATED,
|
|
2653
2662
|
"이미 로그인된 상태입니다. signOut()을 먼저 호출하세요."
|
|
2654
2663
|
);
|
|
2664
|
+
let r;
|
|
2655
2665
|
try {
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2666
|
+
r = await this.signInUseCase.executeWithOAuthToken(e), r.success && this.applyAuthResult(r);
|
|
2667
|
+
} catch (t) {
|
|
2668
|
+
throw t instanceof f ? t : new f(h.AUTH_FAILED, "OAuth 토큰 로그인에 실패했습니다", t);
|
|
2669
|
+
}
|
|
2670
|
+
if (!r.success) return { ...r, addresses: [] };
|
|
2671
|
+
try {
|
|
2672
|
+
if (r.needsMigration || !r.address) {
|
|
2673
|
+
const { address: i } = await this.createWallet(), o = await this.getAddresses(), a = await this.selectWalletIfMultiple(o);
|
|
2674
|
+
return { ...r, address: (a == null ? void 0 : a.address) ?? i, needsMigration: !1, addresses: o };
|
|
2675
|
+
}
|
|
2676
|
+
const t = await this.getAddresses(), n = await this.selectWalletIfMultiple(t);
|
|
2677
|
+
return { ...r, address: (n == null ? void 0 : n.address) ?? r.address, addresses: t };
|
|
2678
|
+
} catch (t) {
|
|
2679
|
+
throw t instanceof f && t.code === h.PIN_CANCELLED && (d.log("[CROSSx] signInWithOAuthToken: 비밀번호 설정 취소 — 자동 로그아웃 진행"), await this.signOut().catch(
|
|
2680
|
+
(n) => d.warn("[CROSSx] signInWithOAuthToken: 자동 로그아웃 실패", n)
|
|
2681
|
+
)), t;
|
|
2660
2682
|
}
|
|
2661
2683
|
}
|
|
2662
2684
|
/**
|
|
@@ -3138,7 +3160,7 @@ const Te = class Te extends ys {
|
|
|
3138
3160
|
n.address
|
|
3139
3161
|
)
|
|
3140
3162
|
});
|
|
3141
|
-
return
|
|
3163
|
+
return Os(i.signature), {
|
|
3142
3164
|
chainId: e,
|
|
3143
3165
|
signature: i.signature,
|
|
3144
3166
|
address: n.address
|
|
@@ -3216,7 +3238,7 @@ const Te = class Te extends ys {
|
|
|
3216
3238
|
a
|
|
3217
3239
|
)
|
|
3218
3240
|
});
|
|
3219
|
-
return
|
|
3241
|
+
return Cs(o.signature), {
|
|
3220
3242
|
chainId: e,
|
|
3221
3243
|
signedTx: o.signature,
|
|
3222
3244
|
txHash: o.txHash ?? ""
|
|
@@ -3355,7 +3377,7 @@ const Te = class Te extends ys {
|
|
|
3355
3377
|
let g, _;
|
|
3356
3378
|
const x = this.waitForTxAndGetReceipt(a, e, { intervalMs: c, timeoutMs: l }).then((I) => {
|
|
3357
3379
|
g = I;
|
|
3358
|
-
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);
|
|
3359
3381
|
return {
|
|
3360
3382
|
chainId: e,
|
|
3361
3383
|
txHash: a,
|
|
@@ -4440,17 +4462,17 @@ function bn(s, e, r) {
|
|
|
4440
4462
|
const I = [];
|
|
4441
4463
|
for (; S < e; ) {
|
|
4442
4464
|
c = g();
|
|
4443
|
-
const
|
|
4444
|
-
I.push(
|
|
4465
|
+
const O = c.slice();
|
|
4466
|
+
I.push(O), S += c.length;
|
|
4445
4467
|
}
|
|
4446
4468
|
return Se(...I);
|
|
4447
4469
|
};
|
|
4448
4470
|
return (S, I) => {
|
|
4449
4471
|
p(), _(S);
|
|
4450
|
-
let
|
|
4451
|
-
for (; !(
|
|
4472
|
+
let O;
|
|
4473
|
+
for (; !(O = I(x())); )
|
|
4452
4474
|
_();
|
|
4453
|
-
return p(),
|
|
4475
|
+
return p(), O;
|
|
4454
4476
|
};
|
|
4455
4477
|
}
|
|
4456
4478
|
function Rt(s, e = {}, r = {}) {
|
|
@@ -4507,7 +4529,7 @@ function Nt(s, e, r) {
|
|
|
4507
4529
|
if (!s.eql(s.sqr(e), r))
|
|
4508
4530
|
throw new Error("Cannot find square root");
|
|
4509
4531
|
}
|
|
4510
|
-
function
|
|
4532
|
+
function Or(s, e) {
|
|
4511
4533
|
const r = (s.ORDER + te) / Tr, t = s.pow(e, r);
|
|
4512
4534
|
return Nt(s, t, e), t;
|
|
4513
4535
|
}
|
|
@@ -4516,7 +4538,7 @@ function En(s, e) {
|
|
|
4516
4538
|
return Nt(s, a, e), a;
|
|
4517
4539
|
}
|
|
4518
4540
|
function An(s) {
|
|
4519
|
-
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;
|
|
4520
4542
|
return (a, c) => {
|
|
4521
4543
|
let l = a.pow(c, o), u = a.mul(l, t);
|
|
4522
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);
|
|
@@ -4525,7 +4547,7 @@ function An(s) {
|
|
|
4525
4547
|
return Nt(a, S, c), S;
|
|
4526
4548
|
};
|
|
4527
4549
|
}
|
|
4528
|
-
function
|
|
4550
|
+
function Cr(s) {
|
|
4529
4551
|
if (s < Ir)
|
|
4530
4552
|
throw new Error("sqrt is not defined for small field");
|
|
4531
4553
|
let e = s - te, r = 0;
|
|
@@ -4537,7 +4559,7 @@ function Or(s) {
|
|
|
4537
4559
|
if (t++ > 1e3)
|
|
4538
4560
|
throw new Error("Cannot find square root: probably non-prime P");
|
|
4539
4561
|
if (r === 1)
|
|
4540
|
-
return
|
|
4562
|
+
return Or;
|
|
4541
4563
|
let i = n.pow(t, e);
|
|
4542
4564
|
const o = (e + te) / ke;
|
|
4543
4565
|
return function(c, l) {
|
|
@@ -4560,7 +4582,7 @@ function Or(s) {
|
|
|
4560
4582
|
};
|
|
4561
4583
|
}
|
|
4562
4584
|
function In(s) {
|
|
4563
|
-
return s % Tr === Ir ?
|
|
4585
|
+
return s % Tr === Ir ? Or : s % Rr === kr ? En : s % Nr === Sn ? An(s) : Cr(s);
|
|
4564
4586
|
}
|
|
4565
4587
|
const Tn = [
|
|
4566
4588
|
"create",
|
|
@@ -4616,7 +4638,7 @@ function Nn(s, e) {
|
|
|
4616
4638
|
const r = e !== void 0 ? e : s.toString(2).length, t = Math.ceil(r / 8);
|
|
4617
4639
|
return { nBitLength: r, nByteLength: t };
|
|
4618
4640
|
}
|
|
4619
|
-
class
|
|
4641
|
+
class On {
|
|
4620
4642
|
constructor(e, r = {}) {
|
|
4621
4643
|
P(this, "ORDER");
|
|
4622
4644
|
P(this, "BITS");
|
|
@@ -4729,7 +4751,7 @@ class Cn {
|
|
|
4729
4751
|
}
|
|
4730
4752
|
}
|
|
4731
4753
|
function rt(s, e = {}) {
|
|
4732
|
-
return new
|
|
4754
|
+
return new On(s, e);
|
|
4733
4755
|
}
|
|
4734
4756
|
function Lr(s) {
|
|
4735
4757
|
if (typeof s != "bigint")
|
|
@@ -4741,7 +4763,7 @@ function Dr(s) {
|
|
|
4741
4763
|
const e = Lr(s);
|
|
4742
4764
|
return e + Math.ceil(e / 2);
|
|
4743
4765
|
}
|
|
4744
|
-
function
|
|
4766
|
+
function Cn(s, e, r = !1) {
|
|
4745
4767
|
V(s);
|
|
4746
4768
|
const t = s.length, n = Lr(e), i = Dr(e);
|
|
4747
4769
|
if (t < 16 || t < i || t > 1024)
|
|
@@ -5092,18 +5114,18 @@ function Un(s, e = {}) {
|
|
|
5092
5114
|
throw new Error("compression is not supported: Field does not have .isOdd()");
|
|
5093
5115
|
}
|
|
5094
5116
|
function p(F, m, y) {
|
|
5095
|
-
const { x: k, y:
|
|
5117
|
+
const { x: k, y: C } = m.toAffine(), B = t.toBytes(k);
|
|
5096
5118
|
if (Xe(y, "isCompressed"), y) {
|
|
5097
5119
|
u();
|
|
5098
|
-
const b = !t.isOdd(
|
|
5120
|
+
const b = !t.isOdd(C);
|
|
5099
5121
|
return Se(Hr(b), B);
|
|
5100
5122
|
} else
|
|
5101
|
-
return Se(Uint8Array.of(4), B, t.toBytes(
|
|
5123
|
+
return Se(Uint8Array.of(4), B, t.toBytes(C));
|
|
5102
5124
|
}
|
|
5103
5125
|
function g(F) {
|
|
5104
5126
|
V(F, void 0, "Point");
|
|
5105
|
-
const { publicKey: m, publicKeyUncompressed: y } = l, k = F.length,
|
|
5106
|
-
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)) {
|
|
5107
5129
|
const b = t.fromBytes(B);
|
|
5108
5130
|
if (!t.isValid(b))
|
|
5109
5131
|
throw new Error("bad point: is not on curve, wrong x");
|
|
@@ -5117,8 +5139,8 @@ function Un(s, e = {}) {
|
|
|
5117
5139
|
}
|
|
5118
5140
|
u();
|
|
5119
5141
|
const T = t.isOdd(E);
|
|
5120
|
-
return (
|
|
5121
|
-
} 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) {
|
|
5122
5144
|
const b = t.BYTES, v = t.fromBytes(B.subarray(0, b)), E = t.fromBytes(B.subarray(b, b * 2));
|
|
5123
5145
|
if (!S(v, E))
|
|
5124
5146
|
throw new Error("bad point: is not on curve");
|
|
@@ -5137,8 +5159,8 @@ function Un(s, e = {}) {
|
|
|
5137
5159
|
}
|
|
5138
5160
|
if (!S(i.Gx, i.Gy))
|
|
5139
5161
|
throw new Error("bad curve params: generator point");
|
|
5140
|
-
const I = t.mul(t.pow(i.a, ze), Fn),
|
|
5141
|
-
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)))
|
|
5142
5164
|
throw new Error("bad curve params: a or b");
|
|
5143
5165
|
function R(F, m, y = !1) {
|
|
5144
5166
|
if (!t.isValid(m) || y && t.is0(m))
|
|
@@ -5155,12 +5177,12 @@ function Un(s, e = {}) {
|
|
|
5155
5177
|
return Bn(F, c.basises, n.ORDER);
|
|
5156
5178
|
}
|
|
5157
5179
|
const q = Xt((F, m) => {
|
|
5158
|
-
const { X: y, Y: k, Z:
|
|
5159
|
-
if (t.eql(
|
|
5180
|
+
const { X: y, Y: k, Z: C } = F;
|
|
5181
|
+
if (t.eql(C, t.ONE))
|
|
5160
5182
|
return { x: y, y: k };
|
|
5161
5183
|
const B = F.is0();
|
|
5162
|
-
m == null && (m = B ? t.ONE : t.inv(
|
|
5163
|
-
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);
|
|
5164
5186
|
if (B)
|
|
5165
5187
|
return { x: t.ZERO, y: t.ZERO };
|
|
5166
5188
|
if (!t.eql(E, t.ONE))
|
|
@@ -5181,8 +5203,8 @@ function Un(s, e = {}) {
|
|
|
5181
5203
|
throw new Error("bad point: not in prime-order subgroup");
|
|
5182
5204
|
return !0;
|
|
5183
5205
|
});
|
|
5184
|
-
function G(F, m, y, k,
|
|
5185
|
-
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);
|
|
5186
5208
|
}
|
|
5187
5209
|
const D = class D {
|
|
5188
5210
|
/** Does NOT validate if the point is valid. Use `.assertValidity()`. */
|
|
@@ -5240,7 +5262,7 @@ function Un(s, e = {}) {
|
|
|
5240
5262
|
/** Compare one point to another. */
|
|
5241
5263
|
equals(m) {
|
|
5242
5264
|
L(m);
|
|
5243
|
-
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));
|
|
5244
5266
|
return E && T;
|
|
5245
5267
|
}
|
|
5246
5268
|
/** Flips point to one corresponding to (x, -y) in Affine coordinates. */
|
|
@@ -5252,9 +5274,9 @@ function Un(s, e = {}) {
|
|
|
5252
5274
|
// https://eprint.iacr.org/2015/1060, algorithm 3
|
|
5253
5275
|
// Cost: 8M + 3S + 3*a + 2*b3 + 15add.
|
|
5254
5276
|
double() {
|
|
5255
|
-
const { a: m, b: y } = i, k = t.mul(y, ze), { X:
|
|
5256
|
-
let v = t.ZERO, E = t.ZERO, T = t.ZERO, N = t.mul(
|
|
5257
|
-
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);
|
|
5258
5280
|
}
|
|
5259
5281
|
// Renes-Costello-Batina exception-free addition formula.
|
|
5260
5282
|
// There is 30% faster Jacobian formula, but it is not complete.
|
|
@@ -5262,13 +5284,13 @@ function Un(s, e = {}) {
|
|
|
5262
5284
|
// Cost: 12M + 0S + 3*a + 3*b3 + 23add.
|
|
5263
5285
|
add(m) {
|
|
5264
5286
|
L(m);
|
|
5265
|
-
const { X: y, Y: k, Z:
|
|
5287
|
+
const { X: y, Y: k, Z: C } = this, { X: B, Y: b, Z: v } = m;
|
|
5266
5288
|
let E = t.ZERO, T = t.ZERO, N = t.ZERO;
|
|
5267
5289
|
const W = i.a, U = t.mul(i.b, ze);
|
|
5268
|
-
let $ = t.mul(y, B), K = t.mul(k, b), Y = t.mul(
|
|
5269
|
-
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);
|
|
5270
5292
|
let ee = t.add(B, v);
|
|
5271
|
-
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);
|
|
5272
5294
|
}
|
|
5273
5295
|
subtract(m) {
|
|
5274
5296
|
return this.add(m.negate());
|
|
@@ -5289,16 +5311,16 @@ function Un(s, e = {}) {
|
|
|
5289
5311
|
const { endo: y } = e;
|
|
5290
5312
|
if (!n.isValidNot0(m))
|
|
5291
5313
|
throw new Error("invalid scalar: out of range");
|
|
5292
|
-
let k,
|
|
5314
|
+
let k, C;
|
|
5293
5315
|
const B = (b) => H.cached(this, b, (v) => Qt(D, v));
|
|
5294
5316
|
if (y) {
|
|
5295
5317
|
const { k1neg: b, k1: v, k2neg: E, k2: T } = M(m), { p: N, f: W } = B(v), { p: U, f: $ } = B(T);
|
|
5296
|
-
|
|
5318
|
+
C = W.add($), k = G(y.beta, N, U, b, E);
|
|
5297
5319
|
} else {
|
|
5298
5320
|
const { p: b, f: v } = B(m);
|
|
5299
|
-
k = b,
|
|
5321
|
+
k = b, C = v;
|
|
5300
5322
|
}
|
|
5301
|
-
return Qt(D, [k,
|
|
5323
|
+
return Qt(D, [k, C])[0];
|
|
5302
5324
|
}
|
|
5303
5325
|
/**
|
|
5304
5326
|
* Non-constant-time multiplication. Uses double-and-add algorithm.
|
|
@@ -5316,8 +5338,8 @@ function Un(s, e = {}) {
|
|
|
5316
5338
|
if (H.hasCache(this))
|
|
5317
5339
|
return this.multiply(m);
|
|
5318
5340
|
if (y) {
|
|
5319
|
-
const { k1neg:
|
|
5320
|
-
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);
|
|
5321
5343
|
} else
|
|
5322
5344
|
return H.unsafe(k, m);
|
|
5323
5345
|
}
|
|
@@ -5395,7 +5417,7 @@ function Hn(s, e = {}) {
|
|
|
5395
5417
|
}
|
|
5396
5418
|
}
|
|
5397
5419
|
function a(_ = t(n.seed)) {
|
|
5398
|
-
return
|
|
5420
|
+
return Cn(V(_, n.seed, "seed"), r.ORDER);
|
|
5399
5421
|
}
|
|
5400
5422
|
function c(_, x = !0) {
|
|
5401
5423
|
return s.BASE.multiply(r.fromBytes(_)).toBytes(x);
|
|
@@ -5445,37 +5467,37 @@ function Wn(s, e, r = {}) {
|
|
|
5445
5467
|
throw new Error(`invalid signature ${m}: out of range 1..Point.Fn.ORDER`);
|
|
5446
5468
|
return y;
|
|
5447
5469
|
}
|
|
5448
|
-
function
|
|
5470
|
+
function O() {
|
|
5449
5471
|
if (w)
|
|
5450
5472
|
throw new Error('"recovered" sig type is not supported for cofactor >2 curves');
|
|
5451
5473
|
}
|
|
5452
5474
|
function R(m, y) {
|
|
5453
5475
|
mt(y);
|
|
5454
|
-
const k = _.signature,
|
|
5455
|
-
return V(m,
|
|
5476
|
+
const k = _.signature, C = y === "compact" ? k : y === "recovered" ? k + 1 : void 0;
|
|
5477
|
+
return V(m, C);
|
|
5456
5478
|
}
|
|
5457
5479
|
class L {
|
|
5458
|
-
constructor(y, k,
|
|
5480
|
+
constructor(y, k, C) {
|
|
5459
5481
|
P(this, "r");
|
|
5460
5482
|
P(this, "s");
|
|
5461
5483
|
P(this, "recovery");
|
|
5462
|
-
if (this.r = I("r", y), this.s = I("s", k),
|
|
5463
|
-
if (
|
|
5484
|
+
if (this.r = I("r", y), this.s = I("s", k), C != null) {
|
|
5485
|
+
if (O(), ![0, 1, 2, 3].includes(C))
|
|
5464
5486
|
throw new Error("invalid recovery id");
|
|
5465
|
-
this.recovery =
|
|
5487
|
+
this.recovery = C;
|
|
5466
5488
|
}
|
|
5467
5489
|
Object.freeze(this);
|
|
5468
5490
|
}
|
|
5469
5491
|
static fromBytes(y, k = x.format) {
|
|
5470
5492
|
R(y, k);
|
|
5471
|
-
let
|
|
5493
|
+
let C;
|
|
5472
5494
|
if (k === "der") {
|
|
5473
5495
|
const { r: E, s: T } = ve.toSig(V(y));
|
|
5474
5496
|
return new L(E, T);
|
|
5475
5497
|
}
|
|
5476
|
-
k === "recovered" && (
|
|
5498
|
+
k === "recovered" && (C = y[0], k = "compact", y = y.subarray(1));
|
|
5477
5499
|
const B = _.signature / 2, b = y.subarray(0, B), v = y.subarray(B, B * 2);
|
|
5478
|
-
return new L(o.fromBytes(b), o.fromBytes(v),
|
|
5500
|
+
return new L(o.fromBytes(b), o.fromBytes(v), C);
|
|
5479
5501
|
}
|
|
5480
5502
|
static fromHex(y, k) {
|
|
5481
5503
|
return this.fromBytes(Ye(y), k);
|
|
@@ -5490,10 +5512,10 @@ function Wn(s, e, r = {}) {
|
|
|
5490
5512
|
return new L(this.r, this.s, y);
|
|
5491
5513
|
}
|
|
5492
5514
|
recoverPublicKey(y) {
|
|
5493
|
-
const { r: k, s:
|
|
5515
|
+
const { r: k, s: C } = this, B = this.assertRecovery(), b = B === 2 || B === 3 ? k + a : k;
|
|
5494
5516
|
if (!i.isValid(b))
|
|
5495
5517
|
throw new Error("invalid recovery id: sig.r+curve.n != R.x");
|
|
5496
|
-
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));
|
|
5497
5519
|
if ($.is0())
|
|
5498
5520
|
throw new Error("invalid recovery: point at infinify");
|
|
5499
5521
|
return $.assertValidity(), $;
|
|
@@ -5505,8 +5527,8 @@ function Wn(s, e, r = {}) {
|
|
|
5505
5527
|
toBytes(y = x.format) {
|
|
5506
5528
|
if (mt(y), y === "der")
|
|
5507
5529
|
return Ye(ve.hexFromSig(this));
|
|
5508
|
-
const { r: k, s:
|
|
5509
|
-
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);
|
|
5510
5532
|
}
|
|
5511
5533
|
toHex(y) {
|
|
5512
5534
|
return We(this.toBytes(y));
|
|
@@ -5515,8 +5537,8 @@ function Wn(s, e, r = {}) {
|
|
|
5515
5537
|
const M = r.bits2int || function(y) {
|
|
5516
5538
|
if (y.length > 8192)
|
|
5517
5539
|
throw new Error("input is too large");
|
|
5518
|
-
const k = tt(y),
|
|
5519
|
-
return
|
|
5540
|
+
const k = tt(y), C = y.length * 8 - c;
|
|
5541
|
+
return C > 0 ? k >> BigInt(C) : k;
|
|
5520
5542
|
}, q = r.bits2int_modN || function(y) {
|
|
5521
5543
|
return o.create(M(y));
|
|
5522
5544
|
}, J = kt(c);
|
|
@@ -5527,7 +5549,7 @@ function Wn(s, e, r = {}) {
|
|
|
5527
5549
|
return V(m, void 0, "message"), y ? V(e(m), void 0, "prehashed message") : m;
|
|
5528
5550
|
}
|
|
5529
5551
|
function Q(m, y, k) {
|
|
5530
|
-
const { lowS:
|
|
5552
|
+
const { lowS: C, prehash: B, extraEntropy: b } = ut(k, x);
|
|
5531
5553
|
m = X(m, B);
|
|
5532
5554
|
const v = q(m), E = o.fromBytes(y);
|
|
5533
5555
|
if (!o.isValidNot0(E))
|
|
@@ -5549,16 +5571,16 @@ function Wn(s, e, r = {}) {
|
|
|
5549
5571
|
if (ee === ge)
|
|
5550
5572
|
return;
|
|
5551
5573
|
let Lt = (ne.x === z ? 0 : 2) | Number(ne.y & Le), Dt = ee;
|
|
5552
|
-
return
|
|
5574
|
+
return C && S(ee) && (Dt = o.neg(ee), Lt ^= 1), new L(z, Dt, w ? void 0 : Lt);
|
|
5553
5575
|
}
|
|
5554
5576
|
return { seed: N, k2sig: U };
|
|
5555
5577
|
}
|
|
5556
5578
|
function H(m, y, k = {}) {
|
|
5557
|
-
const { seed:
|
|
5558
|
-
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);
|
|
5559
5581
|
}
|
|
5560
|
-
function D(m, y, k,
|
|
5561
|
-
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);
|
|
5562
5584
|
if (k = V(k, void 0, "publicKey"), y = X(y, b), !At(m)) {
|
|
5563
5585
|
const E = m instanceof L ? ", use sig.toBytes()" : "";
|
|
5564
5586
|
throw new Error("verify expects Uint8Array signature" + E);
|
|
@@ -5575,8 +5597,8 @@ function Wn(s, e, r = {}) {
|
|
|
5575
5597
|
}
|
|
5576
5598
|
}
|
|
5577
5599
|
function F(m, y, k = {}) {
|
|
5578
|
-
const { prehash:
|
|
5579
|
-
return y = X(y,
|
|
5600
|
+
const { prehash: C } = ut(k, x);
|
|
5601
|
+
return y = X(y, C), L.fromBytes(m, "recovered").recoverPublicKey(y).toBytes();
|
|
5580
5602
|
}
|
|
5581
5603
|
return Object.freeze({
|
|
5582
5604
|
keygen: l,
|
|
@@ -5593,7 +5615,7 @@ function Wn(s, e, r = {}) {
|
|
|
5593
5615
|
});
|
|
5594
5616
|
}
|
|
5595
5617
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
5596
|
-
const
|
|
5618
|
+
const Ot = {
|
|
5597
5619
|
p: BigInt("0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffefffffc2f"),
|
|
5598
5620
|
n: BigInt("0xfffffffffffffffffffffffffffffffebaaedce6af48a03bbfd25e8cd0364141"),
|
|
5599
5621
|
h: BigInt(1),
|
|
@@ -5609,12 +5631,12 @@ const Ct = {
|
|
|
5609
5631
|
]
|
|
5610
5632
|
}, nr = /* @__PURE__ */ BigInt(2);
|
|
5611
5633
|
function qn(s) {
|
|
5612
|
-
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);
|
|
5613
5635
|
if (!yt.eql(yt.sqr(q), s))
|
|
5614
5636
|
throw new Error("Cannot find square root");
|
|
5615
5637
|
return q;
|
|
5616
5638
|
}
|
|
5617
|
-
const yt = rt(
|
|
5639
|
+
const yt = rt(Ot.p, { sqrt: qn }), Kn = /* @__PURE__ */ Un(Ot, {
|
|
5618
5640
|
Fp: yt,
|
|
5619
5641
|
endo: Gn
|
|
5620
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 = [];
|
|
@@ -5651,7 +5673,7 @@ function ei(s, e = 24) {
|
|
|
5651
5673
|
}
|
|
5652
5674
|
$e(r);
|
|
5653
5675
|
}
|
|
5654
|
-
class
|
|
5676
|
+
class Ct {
|
|
5655
5677
|
// NOTE: we accept arguments in bytes instead of bits here.
|
|
5656
5678
|
constructor(e, r, t, n = !1, i = 24) {
|
|
5657
5679
|
P(this, "state");
|
|
@@ -5724,10 +5746,10 @@ class Ot {
|
|
|
5724
5746
|
}
|
|
5725
5747
|
_cloneInto(e) {
|
|
5726
5748
|
const { blockLen: r, suffix: t, outputLen: n, rounds: i, enableXOF: o } = this;
|
|
5727
|
-
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;
|
|
5728
5750
|
}
|
|
5729
5751
|
}
|
|
5730
|
-
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;
|
|
5731
5753
|
class si {
|
|
5732
5754
|
constructor() {
|
|
5733
5755
|
this.jwks = null;
|
|
@@ -5947,7 +5969,7 @@ class Ae {
|
|
|
5947
5969
|
d.warn("[CROSSx] OAuth 타임아웃 (5분) — postMessage를 수신하지 못했습니다"), L(), t(new Error("Authentication timeout"));
|
|
5948
5970
|
}, 5 * 60 * 1e3), x = 10, w = 30;
|
|
5949
5971
|
let S = 0, I = null;
|
|
5950
|
-
const
|
|
5972
|
+
const O = () => {
|
|
5951
5973
|
clearInterval(R), d.warn("[CROSSx] COOP 감지 — OAuth 서버 응답을 " + w + "초간 대기합니다"), I = setTimeout(() => {
|
|
5952
5974
|
L(), t(new Error(
|
|
5953
5975
|
"OAuth 서버로부터 응답을 받지 못했습니다. 브라우저 보안 정책(COOP)으로 인해 팝업 통신이 차단되었을 수 있습니다. 다시 시도해 주세요."
|
|
@@ -5956,9 +5978,9 @@ class Ae {
|
|
|
5956
5978
|
}, R = setInterval(() => {
|
|
5957
5979
|
S++;
|
|
5958
5980
|
try {
|
|
5959
|
-
g.closed && (S <= x ?
|
|
5981
|
+
g.closed && (S <= x ? O() : (L(), t(new Error("로그인이 취소되었습니다"))));
|
|
5960
5982
|
} catch {
|
|
5961
|
-
|
|
5983
|
+
O();
|
|
5962
5984
|
}
|
|
5963
5985
|
}, 1e3), L = () => {
|
|
5964
5986
|
clearTimeout(_), clearInterval(R), I && clearTimeout(I), window.removeEventListener("message", M);
|
|
@@ -5997,8 +6019,8 @@ class Ae {
|
|
|
5997
6019
|
return;
|
|
5998
6020
|
}
|
|
5999
6021
|
const m = { token: D, email: F }, y = (k) => {
|
|
6000
|
-
Ae.verifyIdTokenNonce(k, l).then(() => r(m)).catch((
|
|
6001
|
-
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"));
|
|
6002
6024
|
});
|
|
6003
6025
|
};
|
|
6004
6026
|
H ? H.split(".").length === 3 ? y(H) : Q ? y(Q) : (d.warn(
|
|
@@ -6244,9 +6266,9 @@ class Ie {
|
|
|
6244
6266
|
h.USER_NOT_FOUND,
|
|
6245
6267
|
Ie.getGatewayErrorMessage(_.code, x)
|
|
6246
6268
|
);
|
|
6247
|
-
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;
|
|
6248
6270
|
let R;
|
|
6249
|
-
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);
|
|
6250
6272
|
}
|
|
6251
6273
|
return d.log("[CROSSx] Wallet Gateway API 성공:", { code: _.code, url: o, method: e }), _.data ?? _;
|
|
6252
6274
|
}
|
|
@@ -9129,7 +9151,7 @@ function _i(s) {
|
|
|
9129
9151
|
}, { passive: !0 });
|
|
9130
9152
|
}
|
|
9131
9153
|
const fi = () => /iPad|iPhone|iPod/.test(navigator.userAgent) || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1;
|
|
9132
|
-
function
|
|
9154
|
+
function Oe() {
|
|
9133
9155
|
if (fi()) {
|
|
9134
9156
|
const e = window.scrollY;
|
|
9135
9157
|
return document.body.style.position = "fixed", document.body.style.top = `-${e}px`, document.body.style.left = "0", document.body.style.right = "0", () => {
|
|
@@ -9407,7 +9429,7 @@ function Ri(s) {
|
|
|
9407
9429
|
function Ni(s) {
|
|
9408
9430
|
return `https://www.crossscan.io/address/${s}?tab=txs`;
|
|
9409
9431
|
}
|
|
9410
|
-
function
|
|
9432
|
+
function Oi(s, e) {
|
|
9411
9433
|
return `https://explorer.crosstoken.io/${Ri(s)}/tx/${e}`;
|
|
9412
9434
|
}
|
|
9413
9435
|
function Jr(s, e) {
|
|
@@ -9417,9 +9439,9 @@ function Ze(s) {
|
|
|
9417
9439
|
return Jr(de(s), Ni(s));
|
|
9418
9440
|
}
|
|
9419
9441
|
function Zr(s, e) {
|
|
9420
|
-
return Jr(de(e),
|
|
9442
|
+
return Jr(de(e), Oi(s, e));
|
|
9421
9443
|
}
|
|
9422
|
-
function
|
|
9444
|
+
function Ci(s, e, r) {
|
|
9423
9445
|
const t = j(
|
|
9424
9446
|
(r == null ? void 0 : r.label_from) ?? "From",
|
|
9425
9447
|
`${Ze(s.from)}
|
|
@@ -9499,10 +9521,10 @@ function Li(s, e, r, t) {
|
|
|
9499
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>
|
|
9500
9522
|
`, c.querySelectorAll(".__crossx-copy-btn").forEach((w) => {
|
|
9501
9523
|
w.addEventListener("click", (S) => {
|
|
9502
|
-
var
|
|
9524
|
+
var O;
|
|
9503
9525
|
S.stopPropagation();
|
|
9504
9526
|
const I = w.dataset.copy;
|
|
9505
|
-
I && ((
|
|
9527
|
+
I && ((O = navigator.clipboard) == null || O.writeText(I).catch(() => {
|
|
9506
9528
|
}));
|
|
9507
9529
|
});
|
|
9508
9530
|
});
|
|
@@ -9941,7 +9963,7 @@ function to(s) {
|
|
|
9941
9963
|
return r > 0 ? `${r}h ${String(t).padStart(2, "0")}m` : `${String(t).padStart(2, "0")}:${String(n).padStart(2, "0")}`;
|
|
9942
9964
|
}
|
|
9943
9965
|
function _t(s, e, r, t, n, i, o) {
|
|
9944
|
-
var
|
|
9966
|
+
var C, B;
|
|
9945
9967
|
let a = !!(i && i > Date.now()), c = !1;
|
|
9946
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 = () => {
|
|
9947
9969
|
var E;
|
|
@@ -9953,7 +9975,7 @@ function _t(s, e, r, t, n, i, o) {
|
|
|
9953
9975
|
const T = b.findIndex((W) => !W.value);
|
|
9954
9976
|
(E = v[T === -1 ? 5 : T]) == null || E.classList.add("--active");
|
|
9955
9977
|
}
|
|
9956
|
-
},
|
|
9978
|
+
}, O = () => {
|
|
9957
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();
|
|
9958
9980
|
}, R = (b) => {
|
|
9959
9981
|
a = b, l().forEach((v) => {
|
|
@@ -10000,7 +10022,7 @@ function _t(s, e, r, t, n, i, o) {
|
|
|
10000
10022
|
var W;
|
|
10001
10023
|
R(!0), l().forEach((U) => {
|
|
10002
10024
|
U.value = "";
|
|
10003
|
-
}),
|
|
10025
|
+
}), O();
|
|
10004
10026
|
const v = p();
|
|
10005
10027
|
if (v && (v.textContent = "Too many failed attempts. Please wait."), !g()) {
|
|
10006
10028
|
const U = document.createElement("p");
|
|
@@ -10011,7 +10033,7 @@ function _t(s, e, r, t, n, i, o) {
|
|
|
10011
10033
|
const E = () => {
|
|
10012
10034
|
var K;
|
|
10013
10035
|
const U = b - Date.now(), $ = _();
|
|
10014
|
-
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(() => {
|
|
10015
10037
|
var Y;
|
|
10016
10038
|
return (Y = l()[0]) == null ? void 0 : Y.focus();
|
|
10017
10039
|
}, 50)) : $ && ($.textContent = ` ${to(U)}`);
|
|
@@ -10052,7 +10074,7 @@ function _t(s, e, r, t, n, i, o) {
|
|
|
10052
10074
|
const b = l(), v = b.find((E) => !E.value) ?? b[b.length - 1];
|
|
10053
10075
|
v == null || v.focus();
|
|
10054
10076
|
};
|
|
10055
|
-
(
|
|
10077
|
+
(C = u()) == null || C.addEventListener("click", (b) => {
|
|
10056
10078
|
b.target.classList.contains("__crossx-pin6-box") || y();
|
|
10057
10079
|
}), (B = x()) == null || B.addEventListener("click", (b) => {
|
|
10058
10080
|
const v = b.target;
|
|
@@ -10112,7 +10134,7 @@ function _t(s, e, r, t, n, i, o) {
|
|
|
10112
10134
|
v();
|
|
10113
10135
|
const W = N.getBoundingClientRect();
|
|
10114
10136
|
T.clientX >= W.left && T.clientX <= W.right && T.clientY >= W.top && T.clientY <= W.bottom && !a && !c && E(N);
|
|
10115
|
-
}), 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();
|
|
10116
10138
|
}
|
|
10117
10139
|
}
|
|
10118
10140
|
const ro = `<svg width="22" height="17" viewBox="0 0 22 17" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
@@ -10185,9 +10207,9 @@ class oo {
|
|
|
10185
10207
|
*/
|
|
10186
10208
|
showWalletSelector(e, r, t) {
|
|
10187
10209
|
return new Promise((n, i) => {
|
|
10188
|
-
var
|
|
10210
|
+
var O;
|
|
10189
10211
|
ae();
|
|
10190
|
-
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();
|
|
10191
10213
|
ce(a);
|
|
10192
10214
|
let l = !1;
|
|
10193
10215
|
const u = () => {
|
|
@@ -10227,7 +10249,7 @@ class oo {
|
|
|
10227
10249
|
const L = R instanceof f && R.code === h.ADDRESS_LIMIT_EXCEEDED, M = this.resolveAddWalletErrorMessage(R);
|
|
10228
10250
|
w && (w.textContent = M, w.hidden = !1), L ? (S.disabled = !0, S.setAttribute("aria-disabled", "true")) : S.disabled = !1, p = R;
|
|
10229
10251
|
}
|
|
10230
|
-
}), (
|
|
10252
|
+
}), (O = a.querySelector("#__crossx-close-btn")) == null || O.addEventListener("click", _), a.addEventListener("click", (R) => {
|
|
10231
10253
|
R.target === a && _();
|
|
10232
10254
|
});
|
|
10233
10255
|
const I = (R) => {
|
|
@@ -10264,7 +10286,7 @@ class oo {
|
|
|
10264
10286
|
return new Promise((n) => {
|
|
10265
10287
|
var g, _, x, w;
|
|
10266
10288
|
ae();
|
|
10267
|
-
const i = zi(this.tokens, r, this.messages), o =
|
|
10289
|
+
const i = zi(this.tokens, r, this.messages), o = Oe();
|
|
10268
10290
|
ce(i);
|
|
10269
10291
|
const a = () => {
|
|
10270
10292
|
i.remove(), o();
|
|
@@ -10276,8 +10298,8 @@ class oo {
|
|
|
10276
10298
|
a(), n(null);
|
|
10277
10299
|
};
|
|
10278
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) => {
|
|
10279
|
-
const
|
|
10280
|
-
|
|
10301
|
+
const O = S.currentTarget.dataset.walletId ?? "";
|
|
10302
|
+
O && l(O);
|
|
10281
10303
|
}), (w = i.querySelector("#__crossx-close-btn")) == null || w.addEventListener("click", u), i.addEventListener("click", (S) => {
|
|
10282
10304
|
S.target === i && u();
|
|
10283
10305
|
}), i.querySelectorAll(".__crossx-login-terms-link").forEach((S) => {
|
|
@@ -10300,7 +10322,7 @@ class oo {
|
|
|
10300
10322
|
accountLabel: (t == null ? void 0 : t.session_alert_account_label) ?? "Account",
|
|
10301
10323
|
signOutLabel: (t == null ? void 0 : t.session_alert_sign_out_button) ?? "Sign out",
|
|
10302
10324
|
signInAgainLabel: (t == null ? void 0 : t.session_alert_sign_in_again_button) ?? "Sign in again"
|
|
10303
|
-
}), i =
|
|
10325
|
+
}), i = Oe();
|
|
10304
10326
|
ce(n);
|
|
10305
10327
|
let o = !1;
|
|
10306
10328
|
const a = () => {
|
|
@@ -10369,13 +10391,13 @@ class oo {
|
|
|
10369
10391
|
}, o = {
|
|
10370
10392
|
title: (t == null ? void 0 : t.pin_setup_confirm_title) ?? "Confirm PIN",
|
|
10371
10393
|
headerSubtitle: (t == null ? void 0 : t.pin_setup_confirm_subtitle) ?? "Enter your PIN again to confirm."
|
|
10372
|
-
}, a = hr(this.tokens, Qi(n)), c =
|
|
10394
|
+
}, a = hr(this.tokens, Qi(n)), c = Oe();
|
|
10373
10395
|
ce(a);
|
|
10374
10396
|
let l = !1;
|
|
10375
10397
|
const u = () => {
|
|
10376
10398
|
l || (l = !0, a.remove(), c());
|
|
10377
|
-
}, p = (
|
|
10378
|
-
u(), r(
|
|
10399
|
+
}, p = (O) => {
|
|
10400
|
+
u(), r(O);
|
|
10379
10401
|
}, g = () => {
|
|
10380
10402
|
u(), r(null);
|
|
10381
10403
|
}, _ = a.querySelector(".__crossx-card"), x = {
|
|
@@ -10384,21 +10406,21 @@ class oo {
|
|
|
10384
10406
|
repeatingDigit: (t == null ? void 0 : t.pin_validation_repeating_digit) ?? "Cannot use the same number 3+ times in a row.",
|
|
10385
10407
|
sequential: (t == null ? void 0 : t.pin_validation_sequential) ?? "Sequential numbers (e.g., 123456) are not allowed.",
|
|
10386
10408
|
alternatingPattern: (t == null ? void 0 : t.pin_validation_alternating_pattern) ?? "Repeating patterns (e.g., 121212) are not allowed."
|
|
10387
|
-
}, w = (
|
|
10409
|
+
}, w = (O) => {
|
|
10388
10410
|
var R;
|
|
10389
10411
|
_.innerHTML = pt({
|
|
10390
10412
|
title: o.title,
|
|
10391
10413
|
headerSubtitle: o.headerSubtitle
|
|
10392
10414
|
}), (R = _.querySelector("#__crossx-close-btn")) == null || R.addEventListener("click", g), _t(_, (L) => {
|
|
10393
|
-
L ===
|
|
10415
|
+
L === O ? p(O) : S(i.mismatchError);
|
|
10394
10416
|
}, g);
|
|
10395
|
-
}, S = (
|
|
10417
|
+
}, S = (O) => {
|
|
10396
10418
|
var R;
|
|
10397
10419
|
_.innerHTML = pt({
|
|
10398
10420
|
title: i.title,
|
|
10399
10421
|
headerSubtitle: i.headerSubtitle,
|
|
10400
10422
|
subtitle: i.subtitle,
|
|
10401
|
-
errorMessage:
|
|
10423
|
+
errorMessage: O
|
|
10402
10424
|
}), (R = _.querySelector("#__crossx-close-btn")) == null || R.addEventListener("click", g), _t(_, (L) => {
|
|
10403
10425
|
const M = eo(L, x);
|
|
10404
10426
|
M ? S(M) : w(L);
|
|
@@ -10406,10 +10428,10 @@ class oo {
|
|
|
10406
10428
|
};
|
|
10407
10429
|
(() => {
|
|
10408
10430
|
var Q;
|
|
10409
|
-
const
|
|
10431
|
+
const O = Array.from(_.querySelectorAll(".__crossx-pw-notice-item")), R = _.querySelector("#__crossx-pin-notice-next"), L = /* @__PURE__ */ new Set();
|
|
10410
10432
|
R.removeAttribute("disabled");
|
|
10411
10433
|
const M = R.dataset.nextLabel ?? "Next", q = R.dataset.submitLabel ?? "I Understand", J = () => {
|
|
10412
|
-
const H = L.size ===
|
|
10434
|
+
const H = L.size === O.length;
|
|
10413
10435
|
R.classList.toggle("--disabled", !H), R.textContent = H ? q : M;
|
|
10414
10436
|
}, G = (H, D) => {
|
|
10415
10437
|
if (L.has(D)) return;
|
|
@@ -10420,7 +10442,7 @@ class oo {
|
|
|
10420
10442
|
const F = H.querySelector(`#__crossx-notice-check-${D}`);
|
|
10421
10443
|
L.delete(D), F.classList.remove("--checked"), H.setAttribute("aria-checked", "false"), J();
|
|
10422
10444
|
};
|
|
10423
|
-
|
|
10445
|
+
O.forEach((H) => {
|
|
10424
10446
|
const D = parseInt(H.dataset.checkIndex ?? "0", 10);
|
|
10425
10447
|
H.addEventListener("click", () => {
|
|
10426
10448
|
L.has(D) ? X(H, D) : G(H, D);
|
|
@@ -10428,11 +10450,11 @@ class oo {
|
|
|
10428
10450
|
(F.key === " " || F.key === "Enter") && (F.preventDefault(), L.has(D) ? X(H, D) : G(H, D));
|
|
10429
10451
|
});
|
|
10430
10452
|
}), R.addEventListener("click", () => {
|
|
10431
|
-
if (L.size ===
|
|
10453
|
+
if (L.size === O.length) {
|
|
10432
10454
|
S(e == null ? void 0 : e.errorMessage);
|
|
10433
10455
|
return;
|
|
10434
10456
|
}
|
|
10435
|
-
const H =
|
|
10457
|
+
const H = O.find((F) => {
|
|
10436
10458
|
const m = parseInt(F.dataset.checkIndex ?? "0", 10);
|
|
10437
10459
|
return !L.has(m);
|
|
10438
10460
|
});
|
|
@@ -10442,8 +10464,8 @@ class oo {
|
|
|
10442
10464
|
H.classList.remove("--highlight"), G(H, D);
|
|
10443
10465
|
}, 400);
|
|
10444
10466
|
}), (Q = _.querySelector("#__crossx-close-btn")) == null || Q.addEventListener("click", g);
|
|
10445
|
-
})(), a.addEventListener("click", (
|
|
10446
|
-
|
|
10467
|
+
})(), a.addEventListener("click", (O) => {
|
|
10468
|
+
O.target === a && g();
|
|
10447
10469
|
});
|
|
10448
10470
|
});
|
|
10449
10471
|
}
|
|
@@ -10467,20 +10489,20 @@ class oo {
|
|
|
10467
10489
|
attemptCount: e == null ? void 0 : e.attemptCount,
|
|
10468
10490
|
maxAttempts: e == null ? void 0 : e.maxAttempts
|
|
10469
10491
|
})
|
|
10470
|
-
), u =
|
|
10492
|
+
), u = Oe();
|
|
10471
10493
|
ce(l);
|
|
10472
10494
|
let p = !1;
|
|
10473
10495
|
const g = () => {
|
|
10474
10496
|
p || (p = !0, l.remove(), u());
|
|
10475
|
-
}, _ = (
|
|
10476
|
-
g(), r(
|
|
10497
|
+
}, _ = (O) => {
|
|
10498
|
+
g(), r(O);
|
|
10477
10499
|
}, x = () => {
|
|
10478
10500
|
g(), r(null);
|
|
10479
|
-
}, w = (
|
|
10480
|
-
g(), t(
|
|
10501
|
+
}, w = (O) => {
|
|
10502
|
+
g(), t(O);
|
|
10481
10503
|
}, S = l.querySelector(".__crossx-card");
|
|
10482
|
-
(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", (
|
|
10483
|
-
|
|
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();
|
|
10484
10506
|
});
|
|
10485
10507
|
});
|
|
10486
10508
|
}
|
|
@@ -10537,7 +10559,7 @@ class oo {
|
|
|
10537
10559
|
return new Promise((r) => {
|
|
10538
10560
|
var a, c;
|
|
10539
10561
|
ae();
|
|
10540
|
-
const t =
|
|
10562
|
+
const t = Ci(e, this.tokens, this.messages);
|
|
10541
10563
|
ce(t);
|
|
10542
10564
|
const n = () => t.remove(), i = () => {
|
|
10543
10565
|
n(), r();
|
|
@@ -10593,7 +10615,7 @@ class oo {
|
|
|
10593
10615
|
ae();
|
|
10594
10616
|
let t;
|
|
10595
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);
|
|
10596
|
-
const n =
|
|
10618
|
+
const n = Oe();
|
|
10597
10619
|
ce(t);
|
|
10598
10620
|
const i = () => {
|
|
10599
10621
|
t.remove(), n();
|
|
@@ -10865,7 +10887,7 @@ Example: createCROSSxSDK({ projectId: "your-project-id", ... })`
|
|
|
10865
10887
|
},
|
|
10866
10888
|
() => typeof window < "u" ? window.location.origin : "http://localhost",
|
|
10867
10889
|
x
|
|
10868
|
-
),
|
|
10890
|
+
), O = e != null && e.wrapConfirmation ? e.wrapConfirmation(I) : I, R = new xt(
|
|
10869
10891
|
t,
|
|
10870
10892
|
n,
|
|
10871
10893
|
o,
|
|
@@ -10874,7 +10896,7 @@ Example: createCROSSxSDK({ projectId: "your-project-id", ... })`
|
|
|
10874
10896
|
l,
|
|
10875
10897
|
g,
|
|
10876
10898
|
u,
|
|
10877
|
-
|
|
10899
|
+
O,
|
|
10878
10900
|
w,
|
|
10879
10901
|
p
|
|
10880
10902
|
);
|