@nexus-cross/crossx-sdk-core 2.1.0-beta.2 → 2.1.0-beta.3
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/adapters/wallet/RemoteWalletProviderAdapter.d.ts.map +1 -1
- package/dist/core/constants.d.ts +10 -0
- package/dist/core/constants.d.ts.map +1 -1
- package/dist/core/types/errors.d.ts +5 -0
- package/dist/core/types/errors.d.ts.map +1 -1
- package/dist/crossx.global +58 -58
- package/dist/index.cjs +77 -77
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +658 -652
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var P = (r, e, s) =>
|
|
4
|
-
import { createRemoteJWKSet as
|
|
5
|
-
var h = /* @__PURE__ */ ((r) => (r.AUTH_NOT_INITIALIZED = "AUTH_NOT_INITIALIZED", r.AUTH_FAILED = "AUTH_FAILED", r.AUTH_TOKEN_INVALID = "AUTH_TOKEN_INVALID", r.AUTH_TOKEN_EXPIRED = "AUTH_TOKEN_EXPIRED", r.AUTH_NOT_AUTHENTICATED = "AUTH_NOT_AUTHENTICATED", r.ALREADY_AUTHENTICATED = "ALREADY_AUTHENTICATED", r.SESSION_EXPIRED = "SESSION_EXPIRED", r.OAUTH_POPUP_BLOCKED = "OAUTH_POPUP_BLOCKED", r.WALLET_NOT_FOUND = "WALLET_NOT_FOUND", r.WALLET_CREATION_FAILED = "WALLET_CREATION_FAILED", r.WALLET_ALREADY_EXISTS = "WALLET_ALREADY_EXISTS", r.SIGN_FAILED = "SIGN_FAILED", r.SIGN_REJECTED = "SIGN_REJECTED", r.TX_FAILED = "TX_FAILED", r.TX_REJECTED = "TX_REJECTED", r.BROADCAST_FAILED = "BROADCAST_FAILED", r.USER_REJECTED = "USER_REJECTED", r.TX_INVALID_PARAMS = "TX_INVALID_PARAMS", r.NETWORK_ERROR = "NETWORK_ERROR", r.NETWORK_NOT_CONFIGURED = "NETWORK_NOT_CONFIGURED", r.INVALID_CHAIN = "INVALID_CHAIN", r.CHAIN_NOT_SUPPORTED = "CHAIN_NOT_SUPPORTED", r.CHAIN_ADAPTER_NOT_FOUND = "CHAIN_ADAPTER_NOT_FOUND", r.NOT_IMPLEMENTED = "NOT_IMPLEMENTED", r.SIGNATURE_FAILED = "SIGNATURE_FAILED", r.TRANSACTION_FAILED = "TRANSACTION_FAILED", r.PREPARE_FAILED = "PREPARE_FAILED", r.PREPARE_EXPIRED = "PREPARE_EXPIRED", r.PREPARE_MISMATCH = "PREPARE_MISMATCH", r.MIGRATION_FAILED = "MIGRATION_FAILED", r.MIGRATION_BACKUP_EXISTS = "MIGRATION_BACKUP_EXISTS", r.MIGRATION_PIN_LOCKED = "MIGRATION_PIN_LOCKED", r.GATEWAY_INTERNAL_ERROR = "GATEWAY_INTERNAL_ERROR", r.GATEWAY_LOCK_CONFLICT = "GATEWAY_LOCK_CONFLICT", r.WALLET_INCONSISTENT_STATE = "WALLET_INCONSISTENT_STATE", r.PROJECT_ID_MISSING = "PROJECT_ID_MISSING", r.ORIGIN_NOT_ALLOWED = "ORIGIN_NOT_ALLOWED", r.APP_IDENTIFIER_MISSING = "APP_IDENTIFIER_MISSING", r.INVALID_APP_TYPE = "INVALID_APP_TYPE", r.PROJECT_NOT_REGISTERED = "PROJECT_NOT_REGISTERED", r.SIGNATURE_SIGNER_MISMATCH = "SIGNATURE_SIGNER_MISMATCH", r.GAS_ESTIMATION_FAILED = "GAS_ESTIMATION_FAILED", r.TYPED_DATA_CHAIN_ID_MISMATCH = "TYPED_DATA_CHAIN_ID_MISMATCH", r.PIN_NOT_SET = "PIN_NOT_SET", r.PIN_WRONG = "PIN_WRONG", r.PIN_INVALID = "PIN_INVALID", r.PIN_REPEATED_PATTERN = "PIN_REPEATED_PATTERN", r.PIN_CANCELLED = "PIN_CANCELLED", r.EXTERNAL_WALLET_REQUESTED = "EXTERNAL_WALLET_REQUESTED", r.PIN_LOCKED = "PIN_LOCKED", r.HMAC_REQUIRED = "HMAC_REQUIRED", r.HMAC_VERIFICATION_FAILED = "HMAC_VERIFICATION_FAILED", r.WITHDRAW_FAILED = "WITHDRAW_FAILED", r.USER_NOT_FOUND = "USER_NOT_FOUND", r.INVALID_CONFIG = "INVALID_CONFIG", r.UNKNOWN_ERROR = "UNKNOWN_ERROR", r))(h || {});
|
|
1
|
+
var js = Object.defineProperty;
|
|
2
|
+
var Ys = (r, e, s) => e in r ? js(r, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : r[e] = s;
|
|
3
|
+
var P = (r, e, s) => Ys(r, typeof e != "symbol" ? e + "" : e, s);
|
|
4
|
+
import { createRemoteJWKSet as Xs, jwtVerify as Js, decodeJwt as Zs } from "jose";
|
|
5
|
+
var h = /* @__PURE__ */ ((r) => (r.AUTH_NOT_INITIALIZED = "AUTH_NOT_INITIALIZED", r.AUTH_FAILED = "AUTH_FAILED", r.AUTH_TOKEN_INVALID = "AUTH_TOKEN_INVALID", r.AUTH_TOKEN_EXPIRED = "AUTH_TOKEN_EXPIRED", r.AUTH_NOT_AUTHENTICATED = "AUTH_NOT_AUTHENTICATED", r.ALREADY_AUTHENTICATED = "ALREADY_AUTHENTICATED", r.SESSION_EXPIRED = "SESSION_EXPIRED", r.OAUTH_POPUP_BLOCKED = "OAUTH_POPUP_BLOCKED", r.WALLET_NOT_FOUND = "WALLET_NOT_FOUND", r.WALLET_CREATION_FAILED = "WALLET_CREATION_FAILED", r.WALLET_ALREADY_EXISTS = "WALLET_ALREADY_EXISTS", r.ADDRESS_LIMIT_EXCEEDED = "ADDRESS_LIMIT_EXCEEDED", r.SIGN_FAILED = "SIGN_FAILED", r.SIGN_REJECTED = "SIGN_REJECTED", r.TX_FAILED = "TX_FAILED", r.TX_REJECTED = "TX_REJECTED", r.BROADCAST_FAILED = "BROADCAST_FAILED", r.USER_REJECTED = "USER_REJECTED", r.TX_INVALID_PARAMS = "TX_INVALID_PARAMS", r.NETWORK_ERROR = "NETWORK_ERROR", r.NETWORK_NOT_CONFIGURED = "NETWORK_NOT_CONFIGURED", r.INVALID_CHAIN = "INVALID_CHAIN", r.CHAIN_NOT_SUPPORTED = "CHAIN_NOT_SUPPORTED", r.CHAIN_ADAPTER_NOT_FOUND = "CHAIN_ADAPTER_NOT_FOUND", r.NOT_IMPLEMENTED = "NOT_IMPLEMENTED", r.SIGNATURE_FAILED = "SIGNATURE_FAILED", r.TRANSACTION_FAILED = "TRANSACTION_FAILED", r.PREPARE_FAILED = "PREPARE_FAILED", r.PREPARE_EXPIRED = "PREPARE_EXPIRED", r.PREPARE_MISMATCH = "PREPARE_MISMATCH", r.MIGRATION_FAILED = "MIGRATION_FAILED", r.MIGRATION_BACKUP_EXISTS = "MIGRATION_BACKUP_EXISTS", r.MIGRATION_PIN_LOCKED = "MIGRATION_PIN_LOCKED", r.GATEWAY_INTERNAL_ERROR = "GATEWAY_INTERNAL_ERROR", r.GATEWAY_LOCK_CONFLICT = "GATEWAY_LOCK_CONFLICT", r.WALLET_INCONSISTENT_STATE = "WALLET_INCONSISTENT_STATE", r.PROJECT_ID_MISSING = "PROJECT_ID_MISSING", r.ORIGIN_NOT_ALLOWED = "ORIGIN_NOT_ALLOWED", r.APP_IDENTIFIER_MISSING = "APP_IDENTIFIER_MISSING", r.INVALID_APP_TYPE = "INVALID_APP_TYPE", r.PROJECT_NOT_REGISTERED = "PROJECT_NOT_REGISTERED", r.SIGNATURE_SIGNER_MISMATCH = "SIGNATURE_SIGNER_MISMATCH", r.GAS_ESTIMATION_FAILED = "GAS_ESTIMATION_FAILED", r.TYPED_DATA_CHAIN_ID_MISMATCH = "TYPED_DATA_CHAIN_ID_MISMATCH", r.PIN_NOT_SET = "PIN_NOT_SET", r.PIN_WRONG = "PIN_WRONG", r.PIN_INVALID = "PIN_INVALID", r.PIN_REPEATED_PATTERN = "PIN_REPEATED_PATTERN", r.PIN_CANCELLED = "PIN_CANCELLED", r.EXTERNAL_WALLET_REQUESTED = "EXTERNAL_WALLET_REQUESTED", r.PIN_LOCKED = "PIN_LOCKED", r.HMAC_REQUIRED = "HMAC_REQUIRED", r.HMAC_VERIFICATION_FAILED = "HMAC_VERIFICATION_FAILED", r.WITHDRAW_FAILED = "WITHDRAW_FAILED", r.USER_NOT_FOUND = "USER_NOT_FOUND", r.INVALID_CONFIG = "INVALID_CONFIG", r.UNKNOWN_ERROR = "UNKNOWN_ERROR", r))(h || {});
|
|
6
6
|
class g extends Error {
|
|
7
7
|
constructor(e, s, t) {
|
|
8
8
|
super(s), this.code = e, this.details = t, this.name = "CROSSxError", Object.setPrototypeOf(this, g.prototype);
|
|
@@ -17,21 +17,21 @@ class g extends Error {
|
|
|
17
17
|
}
|
|
18
18
|
}
|
|
19
19
|
var Ue = /* @__PURE__ */ ((r) => (r.MetaMask = "io.metamask", r.Binance = "com.binance.wallet", r.CROSSx = "crossx", r))(Ue || {});
|
|
20
|
-
const
|
|
20
|
+
const Qs = {
|
|
21
21
|
"io.metamask": "MetaMask",
|
|
22
22
|
"com.binance.wallet": "Binance Wallet",
|
|
23
23
|
crossx: "CROSSx"
|
|
24
|
-
},
|
|
24
|
+
}, er = [
|
|
25
25
|
"crossx",
|
|
26
26
|
"io.metamask",
|
|
27
27
|
"com.binance.wallet"
|
|
28
28
|
/* Binance */
|
|
29
29
|
];
|
|
30
|
-
function er(r) {
|
|
31
|
-
return Zs[r] ?? r;
|
|
32
|
-
}
|
|
33
30
|
function tr(r) {
|
|
34
|
-
return
|
|
31
|
+
return Qs[r] ?? r;
|
|
32
|
+
}
|
|
33
|
+
function sr(r) {
|
|
34
|
+
return Array.isArray(r.connectOtherWallets) && r.connectOtherWallets.length > 0 ? [...r.connectOtherWallets] : r.showConnectOtherWallets === !0 ? [...er] : [];
|
|
35
35
|
}
|
|
36
36
|
const Ze = {
|
|
37
37
|
// ─── CROSS ────────────────────────────────────────────
|
|
@@ -82,20 +82,20 @@ const Ze = {
|
|
|
82
82
|
rpcUrl: "https://saigon-testnet.roninchain.com/rpc",
|
|
83
83
|
testnet: !0
|
|
84
84
|
}
|
|
85
|
-
},
|
|
85
|
+
}, Ji = Object.fromEntries(
|
|
86
86
|
Object.entries(Ze).map(([r, e]) => [r, e.caipId])
|
|
87
|
-
),
|
|
87
|
+
), rr = new Map(
|
|
88
88
|
Object.values(Ze).map((r) => [r.caipId, r])
|
|
89
89
|
);
|
|
90
90
|
new Map(
|
|
91
91
|
Object.values(Ze).map((r) => [r.chainId, r])
|
|
92
92
|
);
|
|
93
|
-
const
|
|
93
|
+
const nr = { symbol: "", decimals: 18 };
|
|
94
94
|
function st(r) {
|
|
95
95
|
var e;
|
|
96
|
-
return ((e =
|
|
96
|
+
return ((e = rr.get(r)) == null ? void 0 : e.nativeCurrency) ?? nr;
|
|
97
97
|
}
|
|
98
|
-
class
|
|
98
|
+
class ir {
|
|
99
99
|
constructor(e, s) {
|
|
100
100
|
this.sdk = e, this.chainId = s, this._listeners = /* @__PURE__ */ new Map();
|
|
101
101
|
}
|
|
@@ -215,7 +215,7 @@ const d = {
|
|
|
215
215
|
return;
|
|
216
216
|
}
|
|
217
217
|
}
|
|
218
|
-
},
|
|
218
|
+
}, or = {
|
|
219
219
|
// ── 공통 버튼 ────────────────────────────────────────────────
|
|
220
220
|
confirm: "확인",
|
|
221
221
|
cancel: "취소",
|
|
@@ -296,7 +296,7 @@ const d = {
|
|
|
296
296
|
sessionAlert_appleAccount: "Apple 계정",
|
|
297
297
|
sessionAlert_signOutButton: "로그아웃",
|
|
298
298
|
sessionAlert_signInAgainButton: "다시 로그인"
|
|
299
|
-
},
|
|
299
|
+
}, as = {
|
|
300
300
|
// ── Common buttons ───────────────────────────────────────────
|
|
301
301
|
confirm: "Confirm",
|
|
302
302
|
cancel: "Cancel",
|
|
@@ -377,12 +377,12 @@ For security, you must continue with the same account.`,
|
|
|
377
377
|
sessionAlert_appleAccount: "Apple account",
|
|
378
378
|
sessionAlert_signOutButton: "Sign out",
|
|
379
379
|
sessionAlert_signInAgainButton: "Sign in again"
|
|
380
|
-
},
|
|
381
|
-
ko:
|
|
382
|
-
en:
|
|
380
|
+
}, ar = {
|
|
381
|
+
ko: or,
|
|
382
|
+
en: as
|
|
383
383
|
};
|
|
384
384
|
function xe(r = "en", e) {
|
|
385
|
-
return
|
|
385
|
+
return ar[r] ?? as;
|
|
386
386
|
}
|
|
387
387
|
const Pt = "crossx_access_token", Ct = "crossx_refresh_token", Nt = "crossx_user_info", Je = class Je {
|
|
388
388
|
constructor(e, s, t, n, i, o, a) {
|
|
@@ -468,12 +468,12 @@ const Pt = "crossx_access_token", Ct = "crossx_refresh_token", Nt = "crossx_user
|
|
|
468
468
|
let t, n = !1;
|
|
469
469
|
try {
|
|
470
470
|
const { authApiUrl: u } = this.config, { accessToken: f, refreshToken: x } = await this.exchangeFirebaseToken(e, u);
|
|
471
|
-
let _, p,
|
|
471
|
+
let _, p, v;
|
|
472
472
|
try {
|
|
473
473
|
const I = this.crypto.decodeJWT(e);
|
|
474
474
|
d.log("[CROSSx] Firebase JWT 필드:", Object.keys(I).join(", ")), p = (i = I.firebase) == null ? void 0 : i.sign_in_provider;
|
|
475
475
|
const T = ((o = I.firebase) == null ? void 0 : o.identities) ?? {};
|
|
476
|
-
|
|
476
|
+
v = I.email ?? ((a = T.email) == null ? void 0 : a[0]), p === "google.com" ? _ = (c = T["google.com"]) == null ? void 0 : c[0] : p === "apple.com" && (_ = (l = T["apple.com"]) == null ? void 0 : l[0]), d.log("[CROSSx] OAuth provider sub 추출 — provider:", p, "hasProviderSub:", !!_, "email:", v ?? "(없음)");
|
|
477
477
|
} catch {
|
|
478
478
|
d.warn("[CROSSx] firebaseToken에서 providerSub 추출 실패");
|
|
479
479
|
}
|
|
@@ -483,18 +483,18 @@ const Pt = "crossx_access_token", Ct = "crossx_refresh_token", Nt = "crossx_user
|
|
|
483
483
|
const T = await this.crypto.verifyJWT(f);
|
|
484
484
|
if (n = T.signatureVerified ?? !1, !T.valid)
|
|
485
485
|
throw d.error("[CROSSx] access_token 검증 실패"), new Error("유효하지 않은 access token");
|
|
486
|
-
const
|
|
486
|
+
const B = T.payload, D = B.email ?? v ?? s;
|
|
487
487
|
d.log(
|
|
488
488
|
"[CROSSx] email 소스 — CROSSx JWT:",
|
|
489
|
-
|
|
489
|
+
B.email ?? "(없음)",
|
|
490
490
|
"/ Firebase JWT:",
|
|
491
|
-
|
|
491
|
+
v ?? "(없음)",
|
|
492
492
|
"/ OAuth 콜백:",
|
|
493
493
|
s ?? "(없음)",
|
|
494
494
|
"→",
|
|
495
495
|
D ?? "(없음)"
|
|
496
496
|
), t = {
|
|
497
|
-
id:
|
|
497
|
+
id: B.sub,
|
|
498
498
|
email: D,
|
|
499
499
|
signInProvider: p,
|
|
500
500
|
providerSub: _
|
|
@@ -509,8 +509,8 @@ const Pt = "crossx_access_token", Ct = "crossx_refresh_token", Nt = "crossx_user
|
|
|
509
509
|
}, d.log("[CROSSx] Cookie 모드 — Firebase 토큰에서 사용자 정보 추출 — id:", t.id);
|
|
510
510
|
}
|
|
511
511
|
d.log("[CROSSx] 사용자 정보 — id:", t.id, "email:", t.email ?? "(없음)");
|
|
512
|
-
const
|
|
513
|
-
await this.storage.set(this.STORAGE_KEY_USER,
|
|
512
|
+
const S = this.useCookieAuth ? { id: t.id, email: t.email, signInProvider: t.signInProvider, providerSub: t.providerSub } : t;
|
|
513
|
+
await this.storage.set(this.STORAGE_KEY_USER, S), d.log("[CROSSx] 사용자 정보 저장 완료 (authMode:", this.useCookieAuth ? "cookie" : "token", ")");
|
|
514
514
|
} catch (u) {
|
|
515
515
|
return d.error("[CROSSx] SignIn 에러 (토큰 교환 단계):", u), {
|
|
516
516
|
success: !1,
|
|
@@ -790,7 +790,7 @@ const Pt = "crossx_access_token", Ct = "crossx_refresh_token", Nt = "crossx_user
|
|
|
790
790
|
};
|
|
791
791
|
Je.REFRESH_RELOGIN_CODES = /* @__PURE__ */ new Set([1007, 1008]);
|
|
792
792
|
let pt = Je;
|
|
793
|
-
class
|
|
793
|
+
class cr {
|
|
794
794
|
constructor(e, s, t) {
|
|
795
795
|
this.config = e, this.storage = s, this.tokenStore = t;
|
|
796
796
|
const n = e.projectId;
|
|
@@ -800,7 +800,7 @@ class ar {
|
|
|
800
800
|
this.tokenStore.clear(), this.config.authMode !== "cookie" && (await this.storage.remove(this.STORAGE_KEY_ACCESS_TOKEN), await this.storage.remove(this.STORAGE_KEY_REFRESH_TOKEN)), await this.storage.remove(this.STORAGE_KEY_USER), await this.storage.clear();
|
|
801
801
|
}
|
|
802
802
|
}
|
|
803
|
-
class
|
|
803
|
+
class lr {
|
|
804
804
|
constructor(e, s) {
|
|
805
805
|
this.storage = e, this.walletProvider = s;
|
|
806
806
|
}
|
|
@@ -817,7 +817,7 @@ class cr {
|
|
|
817
817
|
};
|
|
818
818
|
}
|
|
819
819
|
}
|
|
820
|
-
class
|
|
820
|
+
class cs {
|
|
821
821
|
constructor() {
|
|
822
822
|
this.encryptedBytes = null, this.xorKey = null;
|
|
823
823
|
}
|
|
@@ -858,7 +858,7 @@ class as {
|
|
|
858
858
|
return this.encryptedBytes !== null;
|
|
859
859
|
}
|
|
860
860
|
}
|
|
861
|
-
class
|
|
861
|
+
class dr {
|
|
862
862
|
constructor(e, s) {
|
|
863
863
|
this.chainRegistry = e, this.transport = s, this._nextId = 1;
|
|
864
864
|
}
|
|
@@ -890,7 +890,7 @@ class lr {
|
|
|
890
890
|
return a == null ? void 0 : a.result;
|
|
891
891
|
}
|
|
892
892
|
}
|
|
893
|
-
class
|
|
893
|
+
class ur {
|
|
894
894
|
constructor() {
|
|
895
895
|
this.listeners = /* @__PURE__ */ new Map();
|
|
896
896
|
}
|
|
@@ -933,14 +933,14 @@ const Ce = {
|
|
|
933
933
|
portraitBaseUrl: "https://dev-portrait.crosstoken.io"
|
|
934
934
|
}
|
|
935
935
|
};
|
|
936
|
-
function
|
|
936
|
+
function hr(r) {
|
|
937
937
|
const e = r.environment;
|
|
938
938
|
return e && e in Ce ? Ce[e] : null;
|
|
939
939
|
}
|
|
940
|
-
function
|
|
940
|
+
function ls() {
|
|
941
941
|
try {
|
|
942
942
|
if (typeof __CROSSX_CONFIG__ < "u") {
|
|
943
|
-
const r = typeof __CROSSX_CONFIG__ == "string" ? JSON.parse(__CROSSX_CONFIG__) : __CROSSX_CONFIG__, e =
|
|
943
|
+
const r = typeof __CROSSX_CONFIG__ == "string" ? JSON.parse(__CROSSX_CONFIG__) : __CROSSX_CONFIG__, e = hr(r);
|
|
944
944
|
if (e) return e;
|
|
945
945
|
}
|
|
946
946
|
} catch {
|
|
@@ -953,13 +953,13 @@ function cs() {
|
|
|
953
953
|
}
|
|
954
954
|
return Ce.production;
|
|
955
955
|
}
|
|
956
|
-
const
|
|
957
|
-
function
|
|
956
|
+
const pr = 2e3, Lt = 6e4, fr = 1e3, _r = 1e4, xr = "0x77359400", Dt = "0x3B9ACA00", Mt = 130, ds = 6, $t = 18, Bt = 3e4, gr = 5 * 60 * 1e3, mr = 30 * 1e3, Ut = 100;
|
|
957
|
+
function wr(r) {
|
|
958
958
|
if (!r || r === "0x0" || r === "0x") return "0";
|
|
959
959
|
try {
|
|
960
960
|
const e = BigInt(r);
|
|
961
961
|
if (e === 0n) return "0";
|
|
962
|
-
const s = 10n ** BigInt(
|
|
962
|
+
const s = 10n ** BigInt($t), t = e / s, i = (e % s).toString().padStart($t, "0").replace(/0+$/, "").slice(0, ds);
|
|
963
963
|
return i ? `${t}.${i}` : `${t}`;
|
|
964
964
|
} catch {
|
|
965
965
|
return "?";
|
|
@@ -970,26 +970,26 @@ function We(r, e, s) {
|
|
|
970
970
|
try {
|
|
971
971
|
const t = BigInt(r);
|
|
972
972
|
if (t === 0n) return;
|
|
973
|
-
const n = 10n ** BigInt(s), i = t / n, a = (t % n).toString().padStart(s, "0").slice(0,
|
|
973
|
+
const n = 10n ** BigInt(s), i = t / n, a = (t % n).toString().padStart(s, "0").slice(0, ds).replace(/0+$/, "");
|
|
974
974
|
return `${a ? `${i}.${a}` : `${i}`} ${e}`;
|
|
975
975
|
} catch {
|
|
976
976
|
return;
|
|
977
977
|
}
|
|
978
978
|
}
|
|
979
|
-
function
|
|
979
|
+
function yr(r) {
|
|
980
980
|
const e = r.startsWith("0x") ? r.slice(2) : r;
|
|
981
981
|
if (!/^[0-9a-fA-F]+$/.test(e))
|
|
982
982
|
throw new g(
|
|
983
983
|
h.SIGNATURE_FAILED,
|
|
984
984
|
"유효하지 않은 서명: 올바른 hex 문자열이 아닙니다"
|
|
985
985
|
);
|
|
986
|
-
if (e.length !==
|
|
986
|
+
if (e.length !== Mt)
|
|
987
987
|
throw new g(
|
|
988
988
|
h.SIGNATURE_FAILED,
|
|
989
|
-
`서명 길이가 유효하지 않습니다: ${
|
|
989
|
+
`서명 길이가 유효하지 않습니다: ${Mt} hex 문자(65 바이트) 예상, 현재 ${e.length}`
|
|
990
990
|
);
|
|
991
991
|
}
|
|
992
|
-
function
|
|
992
|
+
function br(r) {
|
|
993
993
|
const e = r.startsWith("0x") ? r.slice(2) : r;
|
|
994
994
|
if (!/^[0-9a-fA-F]+$/.test(e))
|
|
995
995
|
throw new g(
|
|
@@ -1002,7 +1002,7 @@ function yr(r) {
|
|
|
1002
1002
|
"유효하지 않은 서명된 트랜잭션: 너무 짧습니다"
|
|
1003
1003
|
);
|
|
1004
1004
|
}
|
|
1005
|
-
function
|
|
1005
|
+
function Sr(r, e) {
|
|
1006
1006
|
const s = vr(e);
|
|
1007
1007
|
if (r === "0") {
|
|
1008
1008
|
if (s !== void 0 && s !== 0)
|
|
@@ -1188,7 +1188,7 @@ class Pe {
|
|
|
1188
1188
|
return { ok: !1, error: n, ...i };
|
|
1189
1189
|
}
|
|
1190
1190
|
}
|
|
1191
|
-
class
|
|
1191
|
+
class Er {
|
|
1192
1192
|
constructor(e) {
|
|
1193
1193
|
this.deps = e;
|
|
1194
1194
|
}
|
|
@@ -1206,10 +1206,10 @@ class Sr {
|
|
|
1206
1206
|
});
|
|
1207
1207
|
}
|
|
1208
1208
|
}
|
|
1209
|
-
function
|
|
1209
|
+
function Ar(r) {
|
|
1210
1210
|
return r === "google" || r === "apple";
|
|
1211
1211
|
}
|
|
1212
|
-
class
|
|
1212
|
+
class Ir {
|
|
1213
1213
|
constructor(e) {
|
|
1214
1214
|
this.deps = e;
|
|
1215
1215
|
}
|
|
@@ -1220,7 +1220,7 @@ class Ar {
|
|
|
1220
1220
|
this.deps.setRecoveringSession(!0);
|
|
1221
1221
|
try {
|
|
1222
1222
|
this.deps.setAuthenticated(!1), this.deps.clearTokenStore();
|
|
1223
|
-
const n =
|
|
1223
|
+
const n = Ar(e.loginType) ? { provider: e.loginType } : void 0;
|
|
1224
1224
|
let i;
|
|
1225
1225
|
try {
|
|
1226
1226
|
i = await this.deps.executeSignIn(n);
|
|
@@ -1300,7 +1300,7 @@ class Ar {
|
|
|
1300
1300
|
}
|
|
1301
1301
|
}
|
|
1302
1302
|
}
|
|
1303
|
-
class
|
|
1303
|
+
class kr {
|
|
1304
1304
|
constructor(e) {
|
|
1305
1305
|
this.deps = e;
|
|
1306
1306
|
}
|
|
@@ -1334,7 +1334,7 @@ class Ir {
|
|
|
1334
1334
|
d.log("[CROSSx] 세션 복원 후 지갑 주소 로드 완료:", o.address), this.deps.setActiveWallet(o.address, 0);
|
|
1335
1335
|
}
|
|
1336
1336
|
}
|
|
1337
|
-
class
|
|
1337
|
+
class Tr {
|
|
1338
1338
|
constructor(e) {
|
|
1339
1339
|
this.deps = e;
|
|
1340
1340
|
}
|
|
@@ -1385,12 +1385,12 @@ class kr {
|
|
|
1385
1385
|
const _ = x.lockExpiresAt * 1e3, p = Math.max(
|
|
1386
1386
|
1,
|
|
1387
1387
|
Math.round((_ - Date.now()) / 1e3)
|
|
1388
|
-
),
|
|
1388
|
+
), v = p <= 1800 ? "Too many failed attempts. Please try again in 30 minutes." : "Too many failed attempts. Please try again in 24 hours.";
|
|
1389
1389
|
d.warn(
|
|
1390
|
-
`[CROSSx][Migration Phase 4] verify-recovery-pin 잠금 — ${p}초, 메시지: ${
|
|
1390
|
+
`[CROSSx][Migration Phase 4] verify-recovery-pin 잠금 — ${p}초, 메시지: ${v}`
|
|
1391
1391
|
), await this.deps.confirmation.showRecoveryPinLockedPrompt(
|
|
1392
1392
|
p,
|
|
1393
|
-
|
|
1393
|
+
v
|
|
1394
1394
|
), i = 0, n = "Your account lock has been lifted. You may try again.";
|
|
1395
1395
|
} else
|
|
1396
1396
|
d.warn(
|
|
@@ -1427,12 +1427,12 @@ class kr {
|
|
|
1427
1427
|
const _ = ((x == null ? void 0 : x.lockExpiresAt) ?? 0) * 1e3, p = Math.max(
|
|
1428
1428
|
1,
|
|
1429
1429
|
Math.round((_ - Date.now()) / 1e3)
|
|
1430
|
-
),
|
|
1430
|
+
), v = p <= 1800 ? "Too many failed attempts. Please try again in 30 minutes." : "Too many failed attempts. Please try again in 24 hours.";
|
|
1431
1431
|
d.warn(
|
|
1432
1432
|
`[CROSSx][Migration Phase 4] verify-recovery-pin 이미 잠금 — ${p}초`
|
|
1433
1433
|
), await this.deps.confirmation.showRecoveryPinLockedPrompt(
|
|
1434
1434
|
p,
|
|
1435
|
-
|
|
1435
|
+
v
|
|
1436
1436
|
), i = 0, n = "Your account lock has been lifted. You may try again.";
|
|
1437
1437
|
} else
|
|
1438
1438
|
throw d.error(
|
|
@@ -1470,19 +1470,19 @@ class kr {
|
|
|
1470
1470
|
"[CROSSx][Migration Phase 5] 재로그인 성공 — 마이그레이션 재시도 (검증된 PIN 유지)"
|
|
1471
1471
|
);
|
|
1472
1472
|
try {
|
|
1473
|
-
const
|
|
1473
|
+
const v = await this.deps.executeMigrate(
|
|
1474
1474
|
a,
|
|
1475
1475
|
e
|
|
1476
1476
|
);
|
|
1477
1477
|
return d.log(
|
|
1478
1478
|
"[CROSSx][Migration Phase 5] 마이그레이션 재시도 성공 — address:",
|
|
1479
|
-
|
|
1480
|
-
),
|
|
1481
|
-
} catch (
|
|
1479
|
+
v.address
|
|
1480
|
+
), v;
|
|
1481
|
+
} catch (v) {
|
|
1482
1482
|
throw d.error(
|
|
1483
1483
|
"[CROSSx][Migration Phase 5] 마이그레이션 재시도 실패:",
|
|
1484
|
-
|
|
1485
|
-
),
|
|
1484
|
+
v
|
|
1485
|
+
), v;
|
|
1486
1486
|
}
|
|
1487
1487
|
}
|
|
1488
1488
|
throw this.deps.clearAuthState(), u;
|
|
@@ -1491,7 +1491,7 @@ class kr {
|
|
|
1491
1491
|
}
|
|
1492
1492
|
}
|
|
1493
1493
|
}
|
|
1494
|
-
class
|
|
1494
|
+
class Rr {
|
|
1495
1495
|
constructor(e) {
|
|
1496
1496
|
this.deps = e;
|
|
1497
1497
|
}
|
|
@@ -1527,12 +1527,12 @@ class Tr {
|
|
|
1527
1527
|
"maxPriorityFeePerGas: 1 Gwei"
|
|
1528
1528
|
);
|
|
1529
1529
|
} else
|
|
1530
|
-
c.gasPrice =
|
|
1530
|
+
c.gasPrice = xr, d.log("[CROSSx] Legacy 체인 감지 — gasPrice: 2 Gwei");
|
|
1531
1531
|
}
|
|
1532
1532
|
return !o && a && (c.maxPriorityFeePerGas = Dt, d.log("[CROSSx] maxPriorityFeePerGas 비어있음 → 1 Gwei 기본값 적용")), c;
|
|
1533
1533
|
}
|
|
1534
1534
|
}
|
|
1535
|
-
class
|
|
1535
|
+
class Or {
|
|
1536
1536
|
constructor(e) {
|
|
1537
1537
|
this.crypto = e;
|
|
1538
1538
|
}
|
|
@@ -1558,10 +1558,10 @@ class Rr {
|
|
|
1558
1558
|
}
|
|
1559
1559
|
}
|
|
1560
1560
|
}
|
|
1561
|
-
function
|
|
1561
|
+
function Pr(r) {
|
|
1562
1562
|
return r ? r.includes("google") ? "google" : r.includes("apple") ? "apple" : r : null;
|
|
1563
1563
|
}
|
|
1564
|
-
class
|
|
1564
|
+
class Cr {
|
|
1565
1565
|
constructor(e) {
|
|
1566
1566
|
this.deps = e;
|
|
1567
1567
|
}
|
|
@@ -1581,7 +1581,7 @@ class Pr {
|
|
|
1581
1581
|
activeWalletIndex: 0,
|
|
1582
1582
|
userEmail: ((n = e.user) == null ? void 0 : n.email) ?? null,
|
|
1583
1583
|
providerSub: ((i = e.user) == null ? void 0 : i.providerSub) ?? null,
|
|
1584
|
-
loginType:
|
|
1584
|
+
loginType: Pr(
|
|
1585
1585
|
(o = e.user) == null ? void 0 : o.signInProvider
|
|
1586
1586
|
),
|
|
1587
1587
|
tokenSignatureVerified: e.tokenSignatureVerified ?? !1
|
|
@@ -1610,7 +1610,7 @@ class Pr {
|
|
|
1610
1610
|
});
|
|
1611
1611
|
}
|
|
1612
1612
|
}
|
|
1613
|
-
class
|
|
1613
|
+
class Nr {
|
|
1614
1614
|
constructor(e) {
|
|
1615
1615
|
this.deps = e;
|
|
1616
1616
|
}
|
|
@@ -1629,7 +1629,7 @@ class Cr {
|
|
|
1629
1629
|
)).address, index: e };
|
|
1630
1630
|
}
|
|
1631
1631
|
}
|
|
1632
|
-
class
|
|
1632
|
+
class Lr {
|
|
1633
1633
|
constructor(e) {
|
|
1634
1634
|
this.deps = e;
|
|
1635
1635
|
}
|
|
@@ -1648,7 +1648,7 @@ class Nr {
|
|
|
1648
1648
|
);
|
|
1649
1649
|
}
|
|
1650
1650
|
}
|
|
1651
|
-
class
|
|
1651
|
+
class Dr {
|
|
1652
1652
|
constructor(e) {
|
|
1653
1653
|
this.deps = e;
|
|
1654
1654
|
}
|
|
@@ -1710,19 +1710,19 @@ function rt(r, e = "Apple account") {
|
|
|
1710
1710
|
const t = r.substring(0, s), n = r.substring(s);
|
|
1711
1711
|
return t.length <= 1 ? `${t}${"*".repeat(Math.max(t.length, 1))}${n}` : `${t[0]}${"*".repeat(t.length - 1)}${n}`;
|
|
1712
1712
|
}
|
|
1713
|
-
const Ie = class Ie extends
|
|
1713
|
+
const Ie = class Ie extends ur {
|
|
1714
1714
|
constructor(e, s, t, n, i, o, a, c, l, u, f) {
|
|
1715
1715
|
var x, _;
|
|
1716
|
-
super(), this.storage = t, this.crypto = n, this.transport = i, this.oauth = o, this.walletProvider = a, this.tokenStore = c, this.initialized = !1, this._initPromise = null, this.authenticated = !1, this.userId = null, this.address = null, this.activeWalletIndex = 0, this.userEmail = null, this.loginType = null, this.providerSub = null, this.tokenSignatureVerified = !1, this._themeMediaCleanup = null, this._isRecoveringSession = !1, this._config = Object.freeze({ ...e }), this.internalConfig = e, this.adapterConfig = s, e.logger && Ot(e.logger), this.confirmation = l, this.pinStore = f ?? new
|
|
1716
|
+
super(), this.storage = t, this.crypto = n, this.transport = i, this.oauth = o, this.walletProvider = a, this.tokenStore = c, this.initialized = !1, this._initPromise = null, this.authenticated = !1, this.userId = null, this.address = null, this.activeWalletIndex = 0, this.userEmail = null, this.loginType = null, this.providerSub = null, this.tokenSignatureVerified = !1, this._themeMediaCleanup = null, this._isRecoveringSession = !1, this._config = Object.freeze({ ...e }), this.internalConfig = e, this.adapterConfig = s, e.logger && Ot(e.logger), this.confirmation = l, this.pinStore = f ?? new cs(), this.stateManager = new Cr({
|
|
1717
1717
|
setState: (p) => {
|
|
1718
1718
|
p.authenticated !== void 0 && (this.authenticated = p.authenticated), p.userId !== void 0 && (this.userId = p.userId), p.address !== void 0 && (this.address = p.address), p.activeWalletIndex !== void 0 && (this.activeWalletIndex = p.activeWalletIndex), p.userEmail !== void 0 && (this.userEmail = p.userEmail), p.providerSub !== void 0 && (this.providerSub = p.providerSub), p.loginType !== void 0 && (this.loginType = p.loginType), p.tokenSignatureVerified !== void 0 && (this.tokenSignatureVerified = p.tokenSignatureVerified);
|
|
1719
1719
|
},
|
|
1720
1720
|
getIsRecoveringSession: () => this._isRecoveringSession,
|
|
1721
|
-
emitAddressChanged: ({ address: p, index:
|
|
1722
|
-
this.emit("addressChanged", { address: p, index:
|
|
1721
|
+
emitAddressChanged: ({ address: p, index: v }) => {
|
|
1722
|
+
this.emit("addressChanged", { address: p, index: v });
|
|
1723
1723
|
},
|
|
1724
|
-
emitAuthChanged: ({ isAuthenticated: p, address:
|
|
1725
|
-
this.emit("authChanged", { isAuthenticated: p, address:
|
|
1724
|
+
emitAuthChanged: ({ isAuthenticated: p, address: v, userId: S }) => {
|
|
1725
|
+
this.emit("authChanged", { isAuthenticated: p, address: v, userId: S });
|
|
1726
1726
|
},
|
|
1727
1727
|
shouldPersistWalletPreference: () => this._config.persistWalletPreference !== !1,
|
|
1728
1728
|
walletPreferenceKey: Ie.WALLET_PREF_KEY,
|
|
@@ -1736,20 +1736,20 @@ const Ie = class Ie extends dr {
|
|
|
1736
1736
|
getUserEmail: () => this.userEmail,
|
|
1737
1737
|
maskEmail: rt,
|
|
1738
1738
|
signInAgain: () => this.signInAgain()
|
|
1739
|
-
}), this.signingOrchestrator = new
|
|
1739
|
+
}), this.signingOrchestrator = new Er({
|
|
1740
1740
|
confirmation: this.confirmation,
|
|
1741
1741
|
walletProvider: this.walletProvider,
|
|
1742
1742
|
pinOrchestrator: this.pinOrchestrator
|
|
1743
|
-
}), this.walletLifecycleService = new
|
|
1743
|
+
}), this.walletLifecycleService = new kr({
|
|
1744
1744
|
walletProvider: this.walletProvider,
|
|
1745
1745
|
pinOrchestrator: this.pinOrchestrator,
|
|
1746
1746
|
getUserId: () => this.userId,
|
|
1747
|
-
setActiveWallet: (p,
|
|
1748
|
-
}), this.migrationOrchestrator = new
|
|
1747
|
+
setActiveWallet: (p, v) => this.setActiveWallet(p, v)
|
|
1748
|
+
}), this.migrationOrchestrator = new Tr({
|
|
1749
1749
|
confirmation: this.confirmation,
|
|
1750
1750
|
walletProvider: this.walletProvider,
|
|
1751
1751
|
pinOrchestrator: this.pinOrchestrator,
|
|
1752
|
-
executeMigrate: (p,
|
|
1752
|
+
executeMigrate: (p, v) => this.migrateWalletUseCase.execute(p, v),
|
|
1753
1753
|
getLocale: () => this._config.locale,
|
|
1754
1754
|
getUserEmail: () => this.userEmail,
|
|
1755
1755
|
maskEmail: rt,
|
|
@@ -1759,29 +1759,29 @@ const Ie = class Ie extends dr {
|
|
|
1759
1759
|
var p;
|
|
1760
1760
|
return ((p = this._config.migration) == null ? void 0 : p.allowSkip) ?? !0;
|
|
1761
1761
|
}
|
|
1762
|
-
}), this.transactionLifecycleService = new
|
|
1762
|
+
}), this.transactionLifecycleService = new Rr({
|
|
1763
1763
|
getActiveAddress: () => this.address,
|
|
1764
|
-
estimateGas: (p,
|
|
1764
|
+
estimateGas: (p, v) => this.estimateGas(p, v),
|
|
1765
1765
|
getBaseFeePerGas: (p) => this.getBaseFeePerGas(p),
|
|
1766
|
-
jsonRpcCall: (p,
|
|
1767
|
-
}), this.signatureVerifier = new
|
|
1766
|
+
jsonRpcCall: (p, v, S) => this.jsonRpc.call(p, v, S)
|
|
1767
|
+
}), this.signatureVerifier = new Or(this.crypto), this.addressResolverService = new Nr({
|
|
1768
1768
|
walletProvider: this.walletProvider,
|
|
1769
1769
|
pinOrchestrator: this.pinOrchestrator,
|
|
1770
1770
|
getActiveAddress: () => this.address,
|
|
1771
1771
|
getActiveWalletIndex: () => this.activeWalletIndex,
|
|
1772
1772
|
getUserId: () => this.userId
|
|
1773
|
-
}), this.authGuardService = new
|
|
1773
|
+
}), this.authGuardService = new Lr({
|
|
1774
1774
|
isInitialized: () => this.initialized,
|
|
1775
1775
|
isAuthenticated: () => this.authenticated
|
|
1776
|
-
}), this.walletCreationService = new
|
|
1776
|
+
}), this.walletCreationService = new Dr({
|
|
1777
1777
|
walletProvider: this.walletProvider,
|
|
1778
1778
|
pinOrchestrator: this.pinOrchestrator,
|
|
1779
1779
|
migrationOrchestrator: this.migrationOrchestrator,
|
|
1780
1780
|
walletLifecycleService: this.walletLifecycleService,
|
|
1781
1781
|
getUserId: () => this.userId,
|
|
1782
1782
|
getProviderSub: () => this.providerSub,
|
|
1783
|
-
setActiveWallet: (p,
|
|
1784
|
-
}), this.sessionOrchestrator = new
|
|
1783
|
+
setActiveWallet: (p, v) => this.setActiveWallet(p, v)
|
|
1784
|
+
}), this.sessionOrchestrator = new Ir({
|
|
1785
1785
|
ensureInitialized: () => this.ensureInitialized(),
|
|
1786
1786
|
getSessionSnapshot: () => ({
|
|
1787
1787
|
providerSub: this.providerSub,
|
|
@@ -1804,7 +1804,7 @@ const Ie = class Ie extends dr {
|
|
|
1804
1804
|
loadWalletAfterAuth: () => this.walletLifecycleService.loadWalletAfterAuth(),
|
|
1805
1805
|
getLocale: () => this._config.locale,
|
|
1806
1806
|
maskEmail: rt
|
|
1807
|
-
}), this.chainRegistry = u, this.jsonRpc = new
|
|
1807
|
+
}), this.chainRegistry = u, this.jsonRpc = new dr(u, i), this.signInUseCase = new pt(
|
|
1808
1808
|
this.internalConfig,
|
|
1809
1809
|
t,
|
|
1810
1810
|
n,
|
|
@@ -1812,7 +1812,7 @@ const Ie = class Ie extends dr {
|
|
|
1812
1812
|
i,
|
|
1813
1813
|
a,
|
|
1814
1814
|
c
|
|
1815
|
-
), this.signOutUseCase = new
|
|
1815
|
+
), this.signOutUseCase = new cr(this.internalConfig, t, c), this.migrateWalletUseCase = new lr(t, a), (x = a.setOnUnauthorized) == null || x.call(a, () => this.forceLogout()), (_ = a.setTokenRefresher) == null || _.call(
|
|
1816
1816
|
a,
|
|
1817
1817
|
() => this.signInUseCase.refreshAccessToken()
|
|
1818
1818
|
), e.autoDetectTheme && this._setupAutoDetectTheme();
|
|
@@ -1843,7 +1843,7 @@ const Ie = class Ie extends dr {
|
|
|
1843
1843
|
var s, t;
|
|
1844
1844
|
d.log("[CROSSx SDK] v2.0.2 초기화 중..."), this.confirmation.setMessages(xe(this._config.locale));
|
|
1845
1845
|
try {
|
|
1846
|
-
const n =
|
|
1846
|
+
const n = ls();
|
|
1847
1847
|
this.internalConfig.oauthServiceUrl = n.oauthServiceUrl, this.internalConfig.authApiUrl = n.authApiUrl, this.internalConfig.walletGatewayUrl = n.walletGatewayUrl, this.adapterConfig.gatewayUrl = n.walletGatewayUrl, (t = (s = this.crypto).setJWKSEndpoint) == null || t.call(s, `${n.authApiUrl}/.well-known/jwks.json`);
|
|
1848
1848
|
const i = this._config.persistWalletPreference !== !1 ? await this.storage.get(
|
|
1849
1849
|
Ie.WALLET_PREF_KEY
|
|
@@ -1872,7 +1872,7 @@ const Ie = class Ie extends dr {
|
|
|
1872
1872
|
let s = e;
|
|
1873
1873
|
if (!(e != null && e.provider)) {
|
|
1874
1874
|
const t = await this.confirmation.showLoginSelector({
|
|
1875
|
-
connectOtherWallets:
|
|
1875
|
+
connectOtherWallets: sr(this._config)
|
|
1876
1876
|
});
|
|
1877
1877
|
if (t === null)
|
|
1878
1878
|
return { success: !1, error: "User cancelled login" };
|
|
@@ -2379,7 +2379,7 @@ const Ie = class Ie extends dr {
|
|
|
2379
2379
|
throw new g(h.AUTH_NOT_AUTHENTICATED, "사용자 ID를 찾을 수 없습니다");
|
|
2380
2380
|
if (!this.walletProvider.signTypedData)
|
|
2381
2381
|
throw new g(h.NOT_IMPLEMENTED, "signTypedData가 구현되어 있지 않습니다");
|
|
2382
|
-
|
|
2382
|
+
Sr(e, s);
|
|
2383
2383
|
const n = await this.resolveAddress(t == null ? void 0 : t.index);
|
|
2384
2384
|
try {
|
|
2385
2385
|
const i = await this.signingOrchestrator.confirmAndExecuteWithPreparedPin({
|
|
@@ -2403,7 +2403,7 @@ const Ie = class Ie extends dr {
|
|
|
2403
2403
|
n.address
|
|
2404
2404
|
)
|
|
2405
2405
|
});
|
|
2406
|
-
return
|
|
2406
|
+
return yr(i.signature), {
|
|
2407
2407
|
chainId: e,
|
|
2408
2408
|
signature: i.signature,
|
|
2409
2409
|
address: n.address
|
|
@@ -2481,7 +2481,7 @@ const Ie = class Ie extends dr {
|
|
|
2481
2481
|
a
|
|
2482
2482
|
)
|
|
2483
2483
|
});
|
|
2484
|
-
return
|
|
2484
|
+
return br(o.signature), {
|
|
2485
2485
|
chainId: e,
|
|
2486
2486
|
signedTx: o.signature,
|
|
2487
2487
|
txHash: o.txHash ?? ""
|
|
@@ -2580,7 +2580,7 @@ const Ie = class Ie extends dr {
|
|
|
2580
2580
|
* @param opts.timeoutMs 최대 대기 시간 (기본 60000ms)
|
|
2581
2581
|
*/
|
|
2582
2582
|
async waitForTxAndGetReceipt(e, s, t = {}) {
|
|
2583
|
-
const n = t.intervalMs ??
|
|
2583
|
+
const n = t.intervalMs ?? fr, i = _r, o = t.timeoutMs ?? Lt, a = Date.now() + o;
|
|
2584
2584
|
let c = n;
|
|
2585
2585
|
for (; Date.now() < a; ) {
|
|
2586
2586
|
const l = await this.getTransactionReceipt(e, s);
|
|
@@ -2608,12 +2608,12 @@ const Ie = class Ie extends dr {
|
|
|
2608
2608
|
* logger.log(receipt.status); // '0x1' | '0x0'
|
|
2609
2609
|
*/
|
|
2610
2610
|
async sendTransactionWithWaitForReceipt(e, s, t = {}) {
|
|
2611
|
-
var
|
|
2612
|
-
const { intervalMs: n, timeoutMs: i, ...o } = t, { txHash: a } = await this.sendTransaction(e, s, o), c = n ?? ((
|
|
2611
|
+
var v, S;
|
|
2612
|
+
const { intervalMs: n, timeoutMs: i, ...o } = t, { txHash: a } = await this.sendTransaction(e, s, o), c = n ?? ((v = this._config.receiptPolling) == null ? void 0 : v.intervalMs) ?? pr, l = i ?? ((S = this._config.receiptPolling) == null ? void 0 : S.timeoutMs) ?? Lt, u = st(e), f = s.from ?? "";
|
|
2613
2613
|
let x, _;
|
|
2614
2614
|
const p = this.waitForTxAndGetReceipt(a, e, { intervalMs: c, timeoutMs: l }).then((I) => {
|
|
2615
2615
|
x = I;
|
|
2616
|
-
const T = BigInt(I.gasUsed) * BigInt(I.effectiveGasPrice),
|
|
2616
|
+
const T = BigInt(I.gasUsed) * BigInt(I.effectiveGasPrice), B = s.value ? BigInt(s.value) : 0n, D = We(s.value, u.symbol, u.decimals), K = We("0x" + T.toString(16), u.symbol, u.decimals), q = We("0x" + (B + T).toString(16), u.symbol, u.decimals);
|
|
2617
2617
|
return {
|
|
2618
2618
|
chainId: e,
|
|
2619
2619
|
txHash: a,
|
|
@@ -2808,7 +2808,7 @@ const Ie = class Ie extends dr {
|
|
|
2808
2808
|
return { wei: "0x0", formatted: "0", chainId: e };
|
|
2809
2809
|
try {
|
|
2810
2810
|
const n = await this.jsonRpc.call("eth_getBalance", [s, "latest"], e) ?? "0x0";
|
|
2811
|
-
return { wei: n, formatted:
|
|
2811
|
+
return { wei: n, formatted: wr(n), chainId: e };
|
|
2812
2812
|
} catch (t) {
|
|
2813
2813
|
if (t instanceof g) throw t;
|
|
2814
2814
|
const n = t instanceof Error ? t.message : String(t);
|
|
@@ -2834,7 +2834,7 @@ const Ie = class Ie extends dr {
|
|
|
2834
2834
|
* const client = createWalletClient({ transport: custom(provider) });
|
|
2835
2835
|
*/
|
|
2836
2836
|
getProvider(e) {
|
|
2837
|
-
return this.ensureAuthenticated(), new
|
|
2837
|
+
return this.ensureAuthenticated(), new ir(this, e);
|
|
2838
2838
|
}
|
|
2839
2839
|
/**
|
|
2840
2840
|
* 범용 JSON-RPC 요청 — 노드에 직접 연결.
|
|
@@ -2965,7 +2965,7 @@ const Ie = class Ie extends dr {
|
|
|
2965
2965
|
};
|
|
2966
2966
|
Ie.WALLET_PREF_KEY = "wallet_preference", Ie.OFFCHAIN_CHAIN_ID = "0";
|
|
2967
2967
|
let ft = Ie;
|
|
2968
|
-
class
|
|
2968
|
+
class Mr {
|
|
2969
2969
|
constructor() {
|
|
2970
2970
|
this.prefix = "crossx_";
|
|
2971
2971
|
}
|
|
@@ -3002,8 +3002,8 @@ class Dr {
|
|
|
3002
3002
|
}
|
|
3003
3003
|
}
|
|
3004
3004
|
}
|
|
3005
|
-
const nt = "crossx-sdk", $r = 1, ue = "data",
|
|
3006
|
-
class
|
|
3005
|
+
const nt = "crossx-sdk", $r = 1, ue = "data", ve = "keys", Ge = "aes-primary", Br = 12;
|
|
3006
|
+
class Ht {
|
|
3007
3007
|
constructor(e) {
|
|
3008
3008
|
this.db = null, this.cryptoKey = null, this.initPromise = null, this.dbName = `crossx-sdk-${e}`;
|
|
3009
3009
|
}
|
|
@@ -3015,7 +3015,7 @@ class Ut {
|
|
|
3015
3015
|
const n = indexedDB.open(e, $r);
|
|
3016
3016
|
n.onupgradeneeded = () => {
|
|
3017
3017
|
const i = n.result;
|
|
3018
|
-
i.objectStoreNames.contains(ue) || i.createObjectStore(ue), i.objectStoreNames.contains(
|
|
3018
|
+
i.objectStoreNames.contains(ue) || i.createObjectStore(ue), i.objectStoreNames.contains(ve) || i.createObjectStore(ve);
|
|
3019
3019
|
}, n.onsuccess = () => s(n.result), n.onerror = () => t(n.error);
|
|
3020
3020
|
});
|
|
3021
3021
|
}
|
|
@@ -3045,7 +3045,7 @@ class Ut {
|
|
|
3045
3045
|
}
|
|
3046
3046
|
async init() {
|
|
3047
3047
|
this.db = await this.openDB();
|
|
3048
|
-
const e = await this.idbGet(
|
|
3048
|
+
const e = await this.idbGet(ve, Ge);
|
|
3049
3049
|
if (e) {
|
|
3050
3050
|
this.cryptoKey = e;
|
|
3051
3051
|
return;
|
|
@@ -3059,7 +3059,7 @@ class Ut {
|
|
|
3059
3059
|
{ name: "AES-GCM", length: 256 },
|
|
3060
3060
|
!1,
|
|
3061
3061
|
["encrypt", "decrypt"]
|
|
3062
|
-
), await this.idbPut(
|
|
3062
|
+
), await this.idbPut(ve, Ge, this.cryptoKey);
|
|
3063
3063
|
}
|
|
3064
3064
|
/**
|
|
3065
3065
|
* 레거시 DB('crossx-sdk')에서 projectId 스코프 DB로 암호키·데이터 마이그레이션.
|
|
@@ -3068,7 +3068,7 @@ class Ut {
|
|
|
3068
3068
|
async migrateFromLegacyDB() {
|
|
3069
3069
|
if (this.dbName === nt) return null;
|
|
3070
3070
|
try {
|
|
3071
|
-
const e = await this.openDB(nt), s = e.transaction([
|
|
3071
|
+
const e = await this.openDB(nt), s = e.transaction([ve, ue], "readonly"), t = s.objectStore(ve).get(Ge), n = await new Promise((l, u) => {
|
|
3072
3072
|
t.onsuccess = () => l(t.result), t.onerror = () => u(t.error);
|
|
3073
3073
|
});
|
|
3074
3074
|
if (!n)
|
|
@@ -3081,7 +3081,7 @@ class Ut {
|
|
|
3081
3081
|
o.onsuccess = () => l(o.result), o.onerror = () => u(o.error);
|
|
3082
3082
|
})
|
|
3083
3083
|
]);
|
|
3084
|
-
e.close(), await this.idbPut(
|
|
3084
|
+
e.close(), await this.idbPut(ve, Ge, n);
|
|
3085
3085
|
for (let l = 0; l < c.length; l++)
|
|
3086
3086
|
await this.idbPut(ue, String(c[l]), a[l]);
|
|
3087
3087
|
return indexedDB.deleteDatabase(nt), d.log("[CROSSx] IndexedDB 레거시 DB 마이그레이션 완료"), n;
|
|
@@ -3090,7 +3090,7 @@ class Ut {
|
|
|
3090
3090
|
}
|
|
3091
3091
|
}
|
|
3092
3092
|
async encrypt(e) {
|
|
3093
|
-
const s = new Uint8Array(
|
|
3093
|
+
const s = new Uint8Array(Br);
|
|
3094
3094
|
crypto.getRandomValues(s);
|
|
3095
3095
|
const t = new TextEncoder().encode(e), n = await crypto.subtle.encrypt(
|
|
3096
3096
|
{ name: "AES-GCM", iv: s },
|
|
@@ -3166,7 +3166,7 @@ function V(r, e, s = "") {
|
|
|
3166
3166
|
}
|
|
3167
3167
|
return r;
|
|
3168
3168
|
}
|
|
3169
|
-
function
|
|
3169
|
+
function us(r) {
|
|
3170
3170
|
if (typeof r != "function" || typeof r.create != "function")
|
|
3171
3171
|
throw new Error("Hash must wrapped by utils.createHasher");
|
|
3172
3172
|
me(r.outputLen), me(r.blockLen);
|
|
@@ -3177,13 +3177,13 @@ function Le(r, e = !0) {
|
|
|
3177
3177
|
if (e && r.finished)
|
|
3178
3178
|
throw new Error("Hash#digest() has already been called");
|
|
3179
3179
|
}
|
|
3180
|
-
function
|
|
3180
|
+
function hs(r, e) {
|
|
3181
3181
|
V(r, void 0, "digestInto() output");
|
|
3182
3182
|
const s = e.outputLen;
|
|
3183
3183
|
if (r.length < s)
|
|
3184
3184
|
throw new Error('"digestInto() output" expected to be of length >=' + s);
|
|
3185
3185
|
}
|
|
3186
|
-
function
|
|
3186
|
+
function Ur(r) {
|
|
3187
3187
|
return new Uint32Array(r.buffer, r.byteOffset, Math.floor(r.byteLength / 4));
|
|
3188
3188
|
}
|
|
3189
3189
|
function De(...r) {
|
|
@@ -3196,26 +3196,26 @@ function it(r) {
|
|
|
3196
3196
|
function he(r, e) {
|
|
3197
3197
|
return r << 32 - e | r >>> e;
|
|
3198
3198
|
}
|
|
3199
|
-
const
|
|
3200
|
-
function
|
|
3199
|
+
const Hr = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
|
|
3200
|
+
function Fr(r) {
|
|
3201
3201
|
return r << 24 & 4278190080 | r << 8 & 16711680 | r >>> 8 & 65280 | r >>> 24 & 255;
|
|
3202
3202
|
}
|
|
3203
|
-
function
|
|
3203
|
+
function Wr(r) {
|
|
3204
3204
|
for (let e = 0; e < r.length; e++)
|
|
3205
|
-
r[e] =
|
|
3205
|
+
r[e] = Fr(r[e]);
|
|
3206
3206
|
return r;
|
|
3207
3207
|
}
|
|
3208
|
-
const
|
|
3208
|
+
const Ft = Hr ? (r) => r : Wr, ps = /* @ts-ignore */ typeof Uint8Array.from([]).toHex == "function" && typeof Uint8Array.fromHex == "function", Gr = /* @__PURE__ */ Array.from({ length: 256 }, (r, e) => e.toString(16).padStart(2, "0"));
|
|
3209
3209
|
function Fe(r) {
|
|
3210
|
-
if (V(r),
|
|
3210
|
+
if (V(r), ps)
|
|
3211
3211
|
return r.toHex();
|
|
3212
3212
|
let e = "";
|
|
3213
3213
|
for (let s = 0; s < r.length; s++)
|
|
3214
|
-
e +=
|
|
3214
|
+
e += Gr[r[s]];
|
|
3215
3215
|
return e;
|
|
3216
3216
|
}
|
|
3217
3217
|
const pe = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 };
|
|
3218
|
-
function
|
|
3218
|
+
function Wt(r) {
|
|
3219
3219
|
if (r >= pe._0 && r <= pe._9)
|
|
3220
3220
|
return r - pe._0;
|
|
3221
3221
|
if (r >= pe.A && r <= pe.F)
|
|
@@ -3226,14 +3226,14 @@ function Ft(r) {
|
|
|
3226
3226
|
function je(r) {
|
|
3227
3227
|
if (typeof r != "string")
|
|
3228
3228
|
throw new Error("hex string expected, got " + typeof r);
|
|
3229
|
-
if (
|
|
3229
|
+
if (ps)
|
|
3230
3230
|
return Uint8Array.fromHex(r);
|
|
3231
3231
|
const e = r.length, s = e / 2;
|
|
3232
3232
|
if (e % 2)
|
|
3233
3233
|
throw new Error("hex string expected, got unpadded hex of length " + e);
|
|
3234
3234
|
const t = new Uint8Array(s);
|
|
3235
3235
|
for (let n = 0, i = 0; n < s; n++, i += 2) {
|
|
3236
|
-
const o =
|
|
3236
|
+
const o = Wt(r.charCodeAt(i)), a = Wt(r.charCodeAt(i + 1));
|
|
3237
3237
|
if (o === void 0 || a === void 0) {
|
|
3238
3238
|
const c = r[i] + r[i + 1];
|
|
3239
3239
|
throw new Error('hex string expected, got non-hex character "' + c + '" at index ' + i);
|
|
@@ -3242,7 +3242,7 @@ function je(r) {
|
|
|
3242
3242
|
}
|
|
3243
3243
|
return t;
|
|
3244
3244
|
}
|
|
3245
|
-
function
|
|
3245
|
+
function Se(...r) {
|
|
3246
3246
|
let e = 0;
|
|
3247
3247
|
for (let t = 0; t < r.length; t++) {
|
|
3248
3248
|
const n = r[t];
|
|
@@ -3255,26 +3255,26 @@ function ve(...r) {
|
|
|
3255
3255
|
}
|
|
3256
3256
|
return s;
|
|
3257
3257
|
}
|
|
3258
|
-
function
|
|
3258
|
+
function fs(r, e = {}) {
|
|
3259
3259
|
const s = (n, i) => r(i).update(n).digest(), t = r(void 0);
|
|
3260
3260
|
return s.outputLen = t.outputLen, s.blockLen = t.blockLen, s.create = (n) => r(n), Object.assign(s, e), Object.freeze(s);
|
|
3261
3261
|
}
|
|
3262
|
-
function
|
|
3262
|
+
function _s(r = 32) {
|
|
3263
3263
|
const e = typeof globalThis == "object" ? globalThis.crypto : null;
|
|
3264
3264
|
if (typeof (e == null ? void 0 : e.getRandomValues) != "function")
|
|
3265
3265
|
throw new Error("crypto.getRandomValues must be defined");
|
|
3266
3266
|
return e.getRandomValues(new Uint8Array(r));
|
|
3267
3267
|
}
|
|
3268
|
-
const
|
|
3268
|
+
const qr = (r) => ({
|
|
3269
3269
|
oid: Uint8Array.from([6, 9, 96, 134, 72, 1, 101, 3, 4, 2, r])
|
|
3270
3270
|
});
|
|
3271
|
-
function
|
|
3271
|
+
function Kr(r, e, s) {
|
|
3272
3272
|
return r & e ^ ~r & s;
|
|
3273
3273
|
}
|
|
3274
|
-
function
|
|
3274
|
+
function Vr(r, e, s) {
|
|
3275
3275
|
return r & e ^ r & s ^ e & s;
|
|
3276
3276
|
}
|
|
3277
|
-
class
|
|
3277
|
+
class zr {
|
|
3278
3278
|
constructor(e, s, t, n) {
|
|
3279
3279
|
P(this, "blockLen");
|
|
3280
3280
|
P(this, "outputLen");
|
|
@@ -3305,7 +3305,7 @@ class Vr {
|
|
|
3305
3305
|
return this.length += e.length, this.roundClean(), this;
|
|
3306
3306
|
}
|
|
3307
3307
|
digestInto(e) {
|
|
3308
|
-
Le(this),
|
|
3308
|
+
Le(this), hs(e, this), this.finished = !0;
|
|
3309
3309
|
const { buffer: s, view: t, blockLen: n, isLE: i } = this;
|
|
3310
3310
|
let { pos: o } = this;
|
|
3311
3311
|
s[o++] = 128, De(this.buffer.subarray(o)), this.padOffset > n - o && (this.process(t, 0), o = 0);
|
|
@@ -3345,20 +3345,20 @@ const we = /* @__PURE__ */ Uint32Array.from([
|
|
|
3345
3345
|
2600822924,
|
|
3346
3346
|
528734635,
|
|
3347
3347
|
1541459225
|
|
3348
|
-
]), qe = /* @__PURE__ */ BigInt(2 ** 32 - 1),
|
|
3349
|
-
function zr(r, e = !1) {
|
|
3350
|
-
return e ? { h: Number(r & qe), l: Number(r >> Wt & qe) } : { h: Number(r >> Wt & qe) | 0, l: Number(r & qe) | 0 };
|
|
3351
|
-
}
|
|
3348
|
+
]), qe = /* @__PURE__ */ BigInt(2 ** 32 - 1), Gt = /* @__PURE__ */ BigInt(32);
|
|
3352
3349
|
function jr(r, e = !1) {
|
|
3350
|
+
return e ? { h: Number(r & qe), l: Number(r >> Gt & qe) } : { h: Number(r >> Gt & qe) | 0, l: Number(r & qe) | 0 };
|
|
3351
|
+
}
|
|
3352
|
+
function Yr(r, e = !1) {
|
|
3353
3353
|
const s = r.length;
|
|
3354
3354
|
let t = new Uint32Array(s), n = new Uint32Array(s);
|
|
3355
3355
|
for (let i = 0; i < s; i++) {
|
|
3356
|
-
const { h: o, l: a } =
|
|
3356
|
+
const { h: o, l: a } = jr(r[i], e);
|
|
3357
3357
|
[t[i], n[i]] = [o, a];
|
|
3358
3358
|
}
|
|
3359
3359
|
return [t, n];
|
|
3360
3360
|
}
|
|
3361
|
-
const
|
|
3361
|
+
const Xr = (r, e, s) => r << s | e >>> 32 - s, Jr = (r, e, s) => e << s | r >>> 32 - s, Zr = (r, e, s) => e << s - 32 | r >>> 64 - s, Qr = (r, e, s) => r << s - 32 | e >>> 64 - s, en = /* @__PURE__ */ Uint32Array.from([
|
|
3362
3362
|
1116352408,
|
|
3363
3363
|
1899447441,
|
|
3364
3364
|
3049323471,
|
|
@@ -3424,7 +3424,7 @@ const Yr = (r, e, s) => r << s | e >>> 32 - s, Xr = (r, e, s) => e << s | r >>>
|
|
|
3424
3424
|
3204031479,
|
|
3425
3425
|
3329325298
|
|
3426
3426
|
]), ye = /* @__PURE__ */ new Uint32Array(64);
|
|
3427
|
-
class
|
|
3427
|
+
class tn extends zr {
|
|
3428
3428
|
constructor(e) {
|
|
3429
3429
|
super(64, e, 8, !1);
|
|
3430
3430
|
}
|
|
@@ -3440,13 +3440,13 @@ class en extends Vr {
|
|
|
3440
3440
|
for (let f = 0; f < 16; f++, s += 4)
|
|
3441
3441
|
ye[f] = e.getUint32(s, !1);
|
|
3442
3442
|
for (let f = 16; f < 64; f++) {
|
|
3443
|
-
const x = ye[f - 15], _ = ye[f - 2], p = he(x, 7) ^ he(x, 18) ^ x >>> 3,
|
|
3444
|
-
ye[f] =
|
|
3443
|
+
const x = ye[f - 15], _ = ye[f - 2], p = he(x, 7) ^ he(x, 18) ^ x >>> 3, v = he(_, 17) ^ he(_, 19) ^ _ >>> 10;
|
|
3444
|
+
ye[f] = v + ye[f - 7] + p + ye[f - 16] | 0;
|
|
3445
3445
|
}
|
|
3446
3446
|
let { A: t, B: n, C: i, D: o, E: a, F: c, G: l, H: u } = this;
|
|
3447
3447
|
for (let f = 0; f < 64; f++) {
|
|
3448
|
-
const x = he(a, 6) ^ he(a, 11) ^ he(a, 25), _ = u + x +
|
|
3449
|
-
u = l, l = c, c = a, a = o + _ | 0, o = i, i = n, n = t, t = _ +
|
|
3448
|
+
const x = he(a, 6) ^ he(a, 11) ^ he(a, 25), _ = u + x + Kr(a, c, l) + en[f] + ye[f] | 0, v = (he(t, 2) ^ he(t, 13) ^ he(t, 22)) + Vr(t, n, i) | 0;
|
|
3449
|
+
u = l, l = c, c = a, a = o + _ | 0, o = i, i = n, n = t, t = _ + v | 0;
|
|
3450
3450
|
}
|
|
3451
3451
|
t = t + this.A | 0, n = n + this.B | 0, i = i + this.C | 0, o = o + this.D | 0, a = a + this.E | 0, c = c + this.F | 0, l = l + this.G | 0, u = u + this.H | 0, this.set(t, n, i, o, a, c, l, u);
|
|
3452
3452
|
}
|
|
@@ -3457,7 +3457,7 @@ class en extends Vr {
|
|
|
3457
3457
|
this.set(0, 0, 0, 0, 0, 0, 0, 0), De(this.buffer);
|
|
3458
3458
|
}
|
|
3459
3459
|
}
|
|
3460
|
-
class
|
|
3460
|
+
class sn extends tn {
|
|
3461
3461
|
constructor() {
|
|
3462
3462
|
super(32);
|
|
3463
3463
|
// We cannot use array here since array allows indexing by variable
|
|
@@ -3472,9 +3472,9 @@ class tn extends en {
|
|
|
3472
3472
|
P(this, "H", we[7] | 0);
|
|
3473
3473
|
}
|
|
3474
3474
|
}
|
|
3475
|
-
const
|
|
3476
|
-
() => new
|
|
3477
|
-
/* @__PURE__ */
|
|
3475
|
+
const rn = /* @__PURE__ */ fs(
|
|
3476
|
+
() => new sn(),
|
|
3477
|
+
/* @__PURE__ */ qr(1)
|
|
3478
3478
|
);
|
|
3479
3479
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
3480
3480
|
const yt = /* @__PURE__ */ BigInt(0), _t = /* @__PURE__ */ BigInt(1);
|
|
@@ -3485,7 +3485,7 @@ function Ye(r, e = "") {
|
|
|
3485
3485
|
}
|
|
3486
3486
|
return r;
|
|
3487
3487
|
}
|
|
3488
|
-
function
|
|
3488
|
+
function xs(r) {
|
|
3489
3489
|
if (typeof r == "bigint") {
|
|
3490
3490
|
if (!ze(r))
|
|
3491
3491
|
throw new Error("positive bigint expected, got " + r);
|
|
@@ -3494,78 +3494,78 @@ function _s(r) {
|
|
|
3494
3494
|
return r;
|
|
3495
3495
|
}
|
|
3496
3496
|
function Ke(r) {
|
|
3497
|
-
const e =
|
|
3497
|
+
const e = xs(r).toString(16);
|
|
3498
3498
|
return e.length & 1 ? "0" + e : e;
|
|
3499
3499
|
}
|
|
3500
|
-
function
|
|
3500
|
+
function gs(r) {
|
|
3501
3501
|
if (typeof r != "string")
|
|
3502
3502
|
throw new Error("hex string expected, got " + typeof r);
|
|
3503
3503
|
return r === "" ? yt : BigInt("0x" + r);
|
|
3504
3504
|
}
|
|
3505
3505
|
function Qe(r) {
|
|
3506
|
-
return
|
|
3506
|
+
return gs(Fe(r));
|
|
3507
3507
|
}
|
|
3508
|
-
function
|
|
3509
|
-
return
|
|
3508
|
+
function ms(r) {
|
|
3509
|
+
return gs(Fe(nn(V(r)).reverse()));
|
|
3510
3510
|
}
|
|
3511
3511
|
function bt(r, e) {
|
|
3512
|
-
me(e), r =
|
|
3512
|
+
me(e), r = xs(r);
|
|
3513
3513
|
const s = je(r.toString(16).padStart(e * 2, "0"));
|
|
3514
3514
|
if (s.length !== e)
|
|
3515
3515
|
throw new Error("number too large");
|
|
3516
3516
|
return s;
|
|
3517
3517
|
}
|
|
3518
|
-
function
|
|
3518
|
+
function ws(r, e) {
|
|
3519
3519
|
return bt(r, e).reverse();
|
|
3520
3520
|
}
|
|
3521
|
-
function
|
|
3521
|
+
function nn(r) {
|
|
3522
3522
|
return Uint8Array.from(r);
|
|
3523
3523
|
}
|
|
3524
3524
|
const ze = (r) => typeof r == "bigint" && yt <= r;
|
|
3525
|
-
function
|
|
3525
|
+
function on(r, e, s) {
|
|
3526
3526
|
return ze(r) && ze(e) && ze(s) && e <= r && r < s;
|
|
3527
3527
|
}
|
|
3528
|
-
function
|
|
3529
|
-
if (!
|
|
3528
|
+
function an(r, e, s, t) {
|
|
3529
|
+
if (!on(e, s, t))
|
|
3530
3530
|
throw new Error("expected valid " + r + ": " + s + " <= n < " + t + ", got " + e);
|
|
3531
3531
|
}
|
|
3532
|
-
function
|
|
3532
|
+
function cn(r) {
|
|
3533
3533
|
let e;
|
|
3534
3534
|
for (e = 0; r > yt; r >>= _t, e += 1)
|
|
3535
3535
|
;
|
|
3536
3536
|
return e;
|
|
3537
3537
|
}
|
|
3538
|
-
const
|
|
3539
|
-
function
|
|
3538
|
+
const St = (r) => (_t << BigInt(r)) - _t;
|
|
3539
|
+
function ln(r, e, s) {
|
|
3540
3540
|
if (me(r, "hashLen"), me(e, "qByteLen"), typeof s != "function")
|
|
3541
3541
|
throw new Error("hmacFn must be a function");
|
|
3542
|
-
const t = (
|
|
3542
|
+
const t = (S) => new Uint8Array(S), n = Uint8Array.of(), i = Uint8Array.of(0), o = Uint8Array.of(1), a = 1e3;
|
|
3543
3543
|
let c = t(r), l = t(r), u = 0;
|
|
3544
3544
|
const f = () => {
|
|
3545
3545
|
c.fill(1), l.fill(0), u = 0;
|
|
3546
|
-
}, x = (...
|
|
3547
|
-
l = x(i,
|
|
3546
|
+
}, x = (...S) => s(l, Se(c, ...S)), _ = (S = n) => {
|
|
3547
|
+
l = x(i, S), c = x(), S.length !== 0 && (l = x(o, S), c = x());
|
|
3548
3548
|
}, p = () => {
|
|
3549
3549
|
if (u++ >= a)
|
|
3550
3550
|
throw new Error("drbg: tried max amount of iterations");
|
|
3551
|
-
let
|
|
3551
|
+
let S = 0;
|
|
3552
3552
|
const I = [];
|
|
3553
|
-
for (;
|
|
3553
|
+
for (; S < e; ) {
|
|
3554
3554
|
c = x();
|
|
3555
3555
|
const T = c.slice();
|
|
3556
|
-
I.push(T),
|
|
3556
|
+
I.push(T), S += c.length;
|
|
3557
3557
|
}
|
|
3558
|
-
return
|
|
3558
|
+
return Se(...I);
|
|
3559
3559
|
};
|
|
3560
|
-
return (
|
|
3561
|
-
f(), _(
|
|
3560
|
+
return (S, I) => {
|
|
3561
|
+
f(), _(S);
|
|
3562
3562
|
let T;
|
|
3563
3563
|
for (; !(T = I(p())); )
|
|
3564
3564
|
_();
|
|
3565
3565
|
return f(), T;
|
|
3566
3566
|
};
|
|
3567
3567
|
}
|
|
3568
|
-
function
|
|
3568
|
+
function vt(r, e = {}, s = {}) {
|
|
3569
3569
|
if (!r || typeof r != "object")
|
|
3570
3570
|
throw new Error("expected valid options object");
|
|
3571
3571
|
function t(i, o, a) {
|
|
@@ -3579,7 +3579,7 @@ function St(r, e = {}, s = {}) {
|
|
|
3579
3579
|
const n = (i, o) => Object.entries(i).forEach(([a, c]) => t(a, c, o));
|
|
3580
3580
|
n(e, !1), n(s, !0);
|
|
3581
3581
|
}
|
|
3582
|
-
function
|
|
3582
|
+
function qt(r) {
|
|
3583
3583
|
const e = /* @__PURE__ */ new WeakMap();
|
|
3584
3584
|
return (s, ...t) => {
|
|
3585
3585
|
const n = e.get(s);
|
|
@@ -3590,7 +3590,7 @@ function Gt(r) {
|
|
|
3590
3590
|
};
|
|
3591
3591
|
}
|
|
3592
3592
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
3593
|
-
const re = /* @__PURE__ */ BigInt(0), te = /* @__PURE__ */ BigInt(1), ke = /* @__PURE__ */ BigInt(2),
|
|
3593
|
+
const re = /* @__PURE__ */ BigInt(0), te = /* @__PURE__ */ BigInt(1), ke = /* @__PURE__ */ BigInt(2), ys = /* @__PURE__ */ BigInt(3), bs = /* @__PURE__ */ BigInt(4), Ss = /* @__PURE__ */ BigInt(5), dn = /* @__PURE__ */ BigInt(7), vs = /* @__PURE__ */ BigInt(8), un = /* @__PURE__ */ BigInt(9), Es = /* @__PURE__ */ BigInt(16);
|
|
3594
3594
|
function de(r, e) {
|
|
3595
3595
|
const s = r % e;
|
|
3596
3596
|
return s >= re ? s : e + s;
|
|
@@ -3601,7 +3601,7 @@ function ae(r, e, s) {
|
|
|
3601
3601
|
t *= t, t %= s;
|
|
3602
3602
|
return t;
|
|
3603
3603
|
}
|
|
3604
|
-
function
|
|
3604
|
+
function Kt(r, e) {
|
|
3605
3605
|
if (r === re)
|
|
3606
3606
|
throw new Error("invert: expected non-zero number");
|
|
3607
3607
|
if (e <= re)
|
|
@@ -3619,62 +3619,62 @@ function Et(r, e, s) {
|
|
|
3619
3619
|
if (!r.eql(r.sqr(e), s))
|
|
3620
3620
|
throw new Error("Cannot find square root");
|
|
3621
3621
|
}
|
|
3622
|
-
function
|
|
3623
|
-
const s = (r.ORDER + te) /
|
|
3622
|
+
function As(r, e) {
|
|
3623
|
+
const s = (r.ORDER + te) / bs, t = r.pow(e, s);
|
|
3624
3624
|
return Et(r, t, e), t;
|
|
3625
3625
|
}
|
|
3626
|
-
function
|
|
3627
|
-
const s = (r.ORDER -
|
|
3626
|
+
function hn(r, e) {
|
|
3627
|
+
const s = (r.ORDER - Ss) / vs, t = r.mul(e, ke), n = r.pow(t, s), i = r.mul(e, n), o = r.mul(r.mul(i, ke), n), a = r.mul(i, r.sub(o, r.ONE));
|
|
3628
3628
|
return Et(r, a, e), a;
|
|
3629
3629
|
}
|
|
3630
|
-
function
|
|
3631
|
-
const e = et(r), s =
|
|
3630
|
+
function pn(r) {
|
|
3631
|
+
const e = et(r), s = Is(r), t = s(e, e.neg(e.ONE)), n = s(e, t), i = s(e, e.neg(t)), o = (r + dn) / Es;
|
|
3632
3632
|
return (a, c) => {
|
|
3633
3633
|
let l = a.pow(c, o), u = a.mul(l, t);
|
|
3634
3634
|
const f = a.mul(l, n), x = a.mul(l, i), _ = a.eql(a.sqr(u), c), p = a.eql(a.sqr(f), c);
|
|
3635
3635
|
l = a.cmov(l, u, _), u = a.cmov(x, f, p);
|
|
3636
|
-
const
|
|
3637
|
-
return Et(a,
|
|
3636
|
+
const v = a.eql(a.sqr(u), c), S = a.cmov(l, u, v);
|
|
3637
|
+
return Et(a, S, c), S;
|
|
3638
3638
|
};
|
|
3639
3639
|
}
|
|
3640
|
-
function
|
|
3641
|
-
if (r <
|
|
3640
|
+
function Is(r) {
|
|
3641
|
+
if (r < ys)
|
|
3642
3642
|
throw new Error("sqrt is not defined for small field");
|
|
3643
3643
|
let e = r - te, s = 0;
|
|
3644
3644
|
for (; e % ke === re; )
|
|
3645
3645
|
e /= ke, s++;
|
|
3646
3646
|
let t = ke;
|
|
3647
3647
|
const n = et(r);
|
|
3648
|
-
for (;
|
|
3648
|
+
for (; Vt(n, t) === 1; )
|
|
3649
3649
|
if (t++ > 1e3)
|
|
3650
3650
|
throw new Error("Cannot find square root: probably non-prime P");
|
|
3651
3651
|
if (s === 1)
|
|
3652
|
-
return
|
|
3652
|
+
return As;
|
|
3653
3653
|
let i = n.pow(t, e);
|
|
3654
3654
|
const o = (e + te) / ke;
|
|
3655
3655
|
return function(c, l) {
|
|
3656
3656
|
if (c.is0(l))
|
|
3657
3657
|
return l;
|
|
3658
|
-
if (
|
|
3658
|
+
if (Vt(c, l) !== 1)
|
|
3659
3659
|
throw new Error("Cannot find square root");
|
|
3660
3660
|
let u = s, f = c.mul(c.ONE, i), x = c.pow(l, e), _ = c.pow(l, o);
|
|
3661
3661
|
for (; !c.eql(x, c.ONE); ) {
|
|
3662
3662
|
if (c.is0(x))
|
|
3663
3663
|
return c.ZERO;
|
|
3664
|
-
let p = 1,
|
|
3665
|
-
for (; !c.eql(
|
|
3666
|
-
if (p++,
|
|
3664
|
+
let p = 1, v = c.sqr(x);
|
|
3665
|
+
for (; !c.eql(v, c.ONE); )
|
|
3666
|
+
if (p++, v = c.sqr(v), p === u)
|
|
3667
3667
|
throw new Error("Cannot find square root");
|
|
3668
|
-
const
|
|
3668
|
+
const S = te << BigInt(u - p - 1), I = c.pow(f, S);
|
|
3669
3669
|
u = p, f = c.sqr(I), x = c.mul(x, f), _ = c.mul(_, I);
|
|
3670
3670
|
}
|
|
3671
3671
|
return _;
|
|
3672
3672
|
};
|
|
3673
3673
|
}
|
|
3674
|
-
function
|
|
3675
|
-
return r %
|
|
3674
|
+
function fn(r) {
|
|
3675
|
+
return r % bs === ys ? As : r % vs === Ss ? hn : r % Es === un ? pn(r) : Is(r);
|
|
3676
3676
|
}
|
|
3677
|
-
const
|
|
3677
|
+
const _n = [
|
|
3678
3678
|
"create",
|
|
3679
3679
|
"isValid",
|
|
3680
3680
|
"is0",
|
|
@@ -3693,15 +3693,15 @@ const fn = [
|
|
|
3693
3693
|
"mulN",
|
|
3694
3694
|
"sqrN"
|
|
3695
3695
|
];
|
|
3696
|
-
function
|
|
3696
|
+
function xn(r) {
|
|
3697
3697
|
const e = {
|
|
3698
3698
|
ORDER: "bigint",
|
|
3699
3699
|
BYTES: "number",
|
|
3700
3700
|
BITS: "number"
|
|
3701
|
-
}, s =
|
|
3702
|
-
return
|
|
3701
|
+
}, s = _n.reduce((t, n) => (t[n] = "function", t), e);
|
|
3702
|
+
return vt(r, s), r;
|
|
3703
3703
|
}
|
|
3704
|
-
function
|
|
3704
|
+
function gn(r, e, s) {
|
|
3705
3705
|
if (s < re)
|
|
3706
3706
|
throw new Error("invalid exponent, negatives unsupported");
|
|
3707
3707
|
if (s === re)
|
|
@@ -3713,22 +3713,22 @@ function xn(r, e, s) {
|
|
|
3713
3713
|
s & te && (t = r.mul(t, n)), n = r.sqr(n), s >>= te;
|
|
3714
3714
|
return t;
|
|
3715
3715
|
}
|
|
3716
|
-
function
|
|
3716
|
+
function ks(r, e, s = !1) {
|
|
3717
3717
|
const t = new Array(e.length).fill(s ? r.ZERO : void 0), n = e.reduce((o, a, c) => r.is0(a) ? o : (t[c] = o, r.mul(o, a)), r.ONE), i = r.inv(n);
|
|
3718
3718
|
return e.reduceRight((o, a, c) => r.is0(a) ? o : (t[c] = r.mul(o, t[c]), r.mul(o, a)), i), t;
|
|
3719
3719
|
}
|
|
3720
|
-
function
|
|
3720
|
+
function Vt(r, e) {
|
|
3721
3721
|
const s = (r.ORDER - te) / ke, t = r.pow(e, s), n = r.eql(t, r.ONE), i = r.eql(t, r.ZERO), o = r.eql(t, r.neg(r.ONE));
|
|
3722
3722
|
if (!n && !i && !o)
|
|
3723
3723
|
throw new Error("invalid Legendre symbol result");
|
|
3724
3724
|
return n ? 1 : i ? 0 : -1;
|
|
3725
3725
|
}
|
|
3726
|
-
function
|
|
3726
|
+
function mn(r, e) {
|
|
3727
3727
|
e !== void 0 && me(e);
|
|
3728
3728
|
const s = e !== void 0 ? e : r.toString(2).length, t = Math.ceil(s / 8);
|
|
3729
3729
|
return { nBitLength: s, nByteLength: t };
|
|
3730
3730
|
}
|
|
3731
|
-
class
|
|
3731
|
+
class wn {
|
|
3732
3732
|
constructor(e, s = {}) {
|
|
3733
3733
|
P(this, "ORDER");
|
|
3734
3734
|
P(this, "BITS");
|
|
@@ -3745,7 +3745,7 @@ class mn {
|
|
|
3745
3745
|
throw new Error("invalid field: expected ORDER > 0, got " + e);
|
|
3746
3746
|
let t;
|
|
3747
3747
|
this.isLE = !1, s != null && typeof s == "object" && (typeof s.BITS == "number" && (t = s.BITS), typeof s.sqrt == "function" && (this.sqrt = s.sqrt), typeof s.isLE == "boolean" && (this.isLE = s.isLE), s.allowedLengths && (this._lengths = (o = s.allowedLengths) == null ? void 0 : o.slice()), typeof s.modFromBytes == "boolean" && (this._mod = s.modFromBytes));
|
|
3748
|
-
const { nBitLength: n, nByteLength: i } =
|
|
3748
|
+
const { nBitLength: n, nByteLength: i } = mn(e, t);
|
|
3749
3749
|
if (i > 2048)
|
|
3750
3750
|
throw new Error("invalid field: expected ORDER of <= 2048 bytes");
|
|
3751
3751
|
this.ORDER = e, this.BITS = n, this.BYTES = i, this._sqrt = void 0, Object.preventExtensions(this);
|
|
@@ -3787,10 +3787,10 @@ class mn {
|
|
|
3787
3787
|
return de(e * s, this.ORDER);
|
|
3788
3788
|
}
|
|
3789
3789
|
pow(e, s) {
|
|
3790
|
-
return
|
|
3790
|
+
return gn(this, e, s);
|
|
3791
3791
|
}
|
|
3792
3792
|
div(e, s) {
|
|
3793
|
-
return de(e *
|
|
3793
|
+
return de(e * Kt(s, this.ORDER), this.ORDER);
|
|
3794
3794
|
}
|
|
3795
3795
|
// Same as above, but doesn't normalize
|
|
3796
3796
|
sqrN(e) {
|
|
@@ -3806,13 +3806,13 @@ class mn {
|
|
|
3806
3806
|
return e * s;
|
|
3807
3807
|
}
|
|
3808
3808
|
inv(e) {
|
|
3809
|
-
return
|
|
3809
|
+
return Kt(e, this.ORDER);
|
|
3810
3810
|
}
|
|
3811
3811
|
sqrt(e) {
|
|
3812
|
-
return this._sqrt || (this._sqrt =
|
|
3812
|
+
return this._sqrt || (this._sqrt = fn(this.ORDER)), this._sqrt(this, e);
|
|
3813
3813
|
}
|
|
3814
3814
|
toBytes(e) {
|
|
3815
|
-
return this.isLE ?
|
|
3815
|
+
return this.isLE ? ws(e, this.BYTES) : bt(e, this.BYTES);
|
|
3816
3816
|
}
|
|
3817
3817
|
fromBytes(e, s = !1) {
|
|
3818
3818
|
V(e);
|
|
@@ -3825,14 +3825,14 @@ class mn {
|
|
|
3825
3825
|
}
|
|
3826
3826
|
if (e.length !== n)
|
|
3827
3827
|
throw new Error("Field.fromBytes: expected " + n + " bytes, got " + e.length);
|
|
3828
|
-
let c = i ?
|
|
3828
|
+
let c = i ? ms(e) : Qe(e);
|
|
3829
3829
|
if (a && (c = de(c, o)), !s && !this.isValid(c))
|
|
3830
3830
|
throw new Error("invalid field element: outside of range 0..ORDER");
|
|
3831
3831
|
return c;
|
|
3832
3832
|
}
|
|
3833
3833
|
// TODO: we don't need it here, move out to separate fn
|
|
3834
3834
|
invertBatch(e) {
|
|
3835
|
-
return
|
|
3835
|
+
return ks(this, e);
|
|
3836
3836
|
}
|
|
3837
3837
|
// We can't move this out because Fp6, Fp12 implement it
|
|
3838
3838
|
// and it's unclear what to return in there.
|
|
@@ -3841,61 +3841,61 @@ class mn {
|
|
|
3841
3841
|
}
|
|
3842
3842
|
}
|
|
3843
3843
|
function et(r, e = {}) {
|
|
3844
|
-
return new
|
|
3844
|
+
return new wn(r, e);
|
|
3845
3845
|
}
|
|
3846
|
-
function
|
|
3846
|
+
function Ts(r) {
|
|
3847
3847
|
if (typeof r != "bigint")
|
|
3848
3848
|
throw new Error("field order must be bigint");
|
|
3849
3849
|
const e = r.toString(2).length;
|
|
3850
3850
|
return Math.ceil(e / 8);
|
|
3851
3851
|
}
|
|
3852
|
-
function
|
|
3853
|
-
const e =
|
|
3852
|
+
function Rs(r) {
|
|
3853
|
+
const e = Ts(r);
|
|
3854
3854
|
return e + Math.ceil(e / 2);
|
|
3855
3855
|
}
|
|
3856
|
-
function
|
|
3856
|
+
function yn(r, e, s = !1) {
|
|
3857
3857
|
V(r);
|
|
3858
|
-
const t = r.length, n =
|
|
3858
|
+
const t = r.length, n = Ts(e), i = Rs(e);
|
|
3859
3859
|
if (t < 16 || t < i || t > 1024)
|
|
3860
3860
|
throw new Error("expected " + i + "-1024 bytes of input, got " + t);
|
|
3861
|
-
const o = s ?
|
|
3862
|
-
return s ?
|
|
3861
|
+
const o = s ? ms(r) : Qe(r), a = de(o, e - te) + te;
|
|
3862
|
+
return s ? ws(a, n) : bt(a, n);
|
|
3863
3863
|
}
|
|
3864
3864
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
3865
|
-
const
|
|
3865
|
+
const Me = /* @__PURE__ */ BigInt(0), Te = /* @__PURE__ */ BigInt(1);
|
|
3866
3866
|
function Xe(r, e) {
|
|
3867
3867
|
const s = e.negate();
|
|
3868
3868
|
return r ? s : e;
|
|
3869
3869
|
}
|
|
3870
|
-
function
|
|
3871
|
-
const s =
|
|
3870
|
+
function zt(r, e) {
|
|
3871
|
+
const s = ks(r.Fp, e.map((t) => t.Z));
|
|
3872
3872
|
return e.map((t, n) => r.fromAffine(t.toAffine(s[n])));
|
|
3873
3873
|
}
|
|
3874
|
-
function
|
|
3874
|
+
function Os(r, e) {
|
|
3875
3875
|
if (!Number.isSafeInteger(r) || r <= 0 || r > e)
|
|
3876
3876
|
throw new Error("invalid window size, expected [1.." + e + "], got W=" + r);
|
|
3877
3877
|
}
|
|
3878
3878
|
function ot(r, e) {
|
|
3879
|
-
|
|
3880
|
-
const s = Math.ceil(e / r) + 1, t = 2 ** (r - 1), n = 2 ** r, i =
|
|
3879
|
+
Os(r, e);
|
|
3880
|
+
const s = Math.ceil(e / r) + 1, t = 2 ** (r - 1), n = 2 ** r, i = St(r), o = BigInt(r);
|
|
3881
3881
|
return { windows: s, windowSize: t, mask: i, maxNumber: n, shiftBy: o };
|
|
3882
3882
|
}
|
|
3883
|
-
function
|
|
3883
|
+
function jt(r, e, s) {
|
|
3884
3884
|
const { windowSize: t, mask: n, maxNumber: i, shiftBy: o } = s;
|
|
3885
3885
|
let a = Number(r & n), c = r >> o;
|
|
3886
3886
|
a > t && (a -= i, c += Te);
|
|
3887
3887
|
const l = e * t, u = l + Math.abs(a) - 1, f = a === 0, x = a < 0, _ = e % 2 !== 0;
|
|
3888
3888
|
return { nextN: c, offset: u, isZero: f, isNeg: x, isNegF: _, offsetF: l };
|
|
3889
3889
|
}
|
|
3890
|
-
const at = /* @__PURE__ */ new WeakMap(),
|
|
3890
|
+
const at = /* @__PURE__ */ new WeakMap(), Ps = /* @__PURE__ */ new WeakMap();
|
|
3891
3891
|
function ct(r) {
|
|
3892
|
-
return
|
|
3892
|
+
return Ps.get(r) || 1;
|
|
3893
3893
|
}
|
|
3894
|
-
function
|
|
3895
|
-
if (r !==
|
|
3894
|
+
function Yt(r) {
|
|
3895
|
+
if (r !== Me)
|
|
3896
3896
|
throw new Error("invalid wNAF");
|
|
3897
3897
|
}
|
|
3898
|
-
class
|
|
3898
|
+
class bn {
|
|
3899
3899
|
// Parametrized with a given Point class (not individual point)
|
|
3900
3900
|
constructor(e, s) {
|
|
3901
3901
|
P(this, "BASE");
|
|
@@ -3907,7 +3907,7 @@ class yn {
|
|
|
3907
3907
|
// non-const time multiplication ladder
|
|
3908
3908
|
_unsafeLadder(e, s, t = this.ZERO) {
|
|
3909
3909
|
let n = e;
|
|
3910
|
-
for (; s >
|
|
3910
|
+
for (; s > Me; )
|
|
3911
3911
|
s & Te && (t = t.add(n)), n = n.double(), s >>= Te;
|
|
3912
3912
|
return t;
|
|
3913
3913
|
}
|
|
@@ -3946,10 +3946,10 @@ class yn {
|
|
|
3946
3946
|
let n = this.ZERO, i = this.BASE;
|
|
3947
3947
|
const o = ot(e, this.bits);
|
|
3948
3948
|
for (let a = 0; a < o.windows; a++) {
|
|
3949
|
-
const { nextN: c, offset: l, isZero: u, isNeg: f, isNegF: x, offsetF: _ } =
|
|
3949
|
+
const { nextN: c, offset: l, isZero: u, isNeg: f, isNegF: x, offsetF: _ } = jt(t, a, o);
|
|
3950
3950
|
t = c, u ? i = i.add(Xe(x, s[_])) : n = n.add(Xe(f, s[l]));
|
|
3951
3951
|
}
|
|
3952
|
-
return
|
|
3952
|
+
return Yt(t), { p: n, f: i };
|
|
3953
3953
|
}
|
|
3954
3954
|
/**
|
|
3955
3955
|
* Implements ec unsafe (non const-time) multiplication using precomputed tables and w-ary non-adjacent form.
|
|
@@ -3958,14 +3958,14 @@ class yn {
|
|
|
3958
3958
|
*/
|
|
3959
3959
|
wNAFUnsafe(e, s, t, n = this.ZERO) {
|
|
3960
3960
|
const i = ot(e, this.bits);
|
|
3961
|
-
for (let o = 0; o < i.windows && t !==
|
|
3962
|
-
const { nextN: a, offset: c, isZero: l, isNeg: u } =
|
|
3961
|
+
for (let o = 0; o < i.windows && t !== Me; o++) {
|
|
3962
|
+
const { nextN: a, offset: c, isZero: l, isNeg: u } = jt(t, o, i);
|
|
3963
3963
|
if (t = a, !l) {
|
|
3964
3964
|
const f = s[c];
|
|
3965
3965
|
n = n.add(u ? f.negate() : f);
|
|
3966
3966
|
}
|
|
3967
3967
|
}
|
|
3968
|
-
return
|
|
3968
|
+
return Yt(t), n;
|
|
3969
3969
|
}
|
|
3970
3970
|
getPrecomputes(e, s, t) {
|
|
3971
3971
|
let n = at.get(s);
|
|
@@ -3983,23 +3983,23 @@ class yn {
|
|
|
3983
3983
|
// using windowed method. This specifies window size and
|
|
3984
3984
|
// stores precomputed values. Usually only base point would be precomputed.
|
|
3985
3985
|
createCache(e, s) {
|
|
3986
|
-
|
|
3986
|
+
Os(s, this.bits), Ps.set(e, s), at.delete(e);
|
|
3987
3987
|
}
|
|
3988
3988
|
hasCache(e) {
|
|
3989
3989
|
return ct(e) !== 1;
|
|
3990
3990
|
}
|
|
3991
3991
|
}
|
|
3992
|
-
function
|
|
3992
|
+
function Sn(r, e, s, t) {
|
|
3993
3993
|
let n = e, i = r.ZERO, o = r.ZERO;
|
|
3994
|
-
for (; s >
|
|
3994
|
+
for (; s > Me || t > Me; )
|
|
3995
3995
|
s & Te && (i = i.add(n)), t & Te && (o = o.add(n)), n = n.double(), s >>= Te, t >>= Te;
|
|
3996
3996
|
return { p1: i, p2: o };
|
|
3997
3997
|
}
|
|
3998
|
-
function
|
|
3998
|
+
function Xt(r, e, s) {
|
|
3999
3999
|
if (e) {
|
|
4000
4000
|
if (e.ORDER !== r)
|
|
4001
4001
|
throw new Error("Field.ORDER must match order: Fp == p, Fn == n");
|
|
4002
|
-
return
|
|
4002
|
+
return xn(e), e;
|
|
4003
4003
|
} else
|
|
4004
4004
|
return et(r, { isLE: s });
|
|
4005
4005
|
}
|
|
@@ -4008,22 +4008,22 @@ function vn(r, e, s = {}, t) {
|
|
|
4008
4008
|
throw new Error(`expected valid ${r} CURVE object`);
|
|
4009
4009
|
for (const c of ["p", "n", "h"]) {
|
|
4010
4010
|
const l = e[c];
|
|
4011
|
-
if (!(typeof l == "bigint" && l >
|
|
4011
|
+
if (!(typeof l == "bigint" && l > Me))
|
|
4012
4012
|
throw new Error(`CURVE.${c} must be positive bigint`);
|
|
4013
4013
|
}
|
|
4014
|
-
const n =
|
|
4014
|
+
const n = Xt(e.p, s.Fp, t), i = Xt(e.n, s.Fn, t), a = ["Gx", "Gy", "a", "b"];
|
|
4015
4015
|
for (const c of a)
|
|
4016
4016
|
if (!n.isValid(e[c]))
|
|
4017
4017
|
throw new Error(`CURVE.${c} must be valid field element of CURVE.Fp`);
|
|
4018
4018
|
return e = Object.freeze(Object.assign({}, e)), { CURVE: e, Fp: n, Fn: i };
|
|
4019
4019
|
}
|
|
4020
|
-
function
|
|
4020
|
+
function En(r, e) {
|
|
4021
4021
|
return function(t) {
|
|
4022
4022
|
const n = r(t);
|
|
4023
4023
|
return { secretKey: n, publicKey: e(n) };
|
|
4024
4024
|
};
|
|
4025
4025
|
}
|
|
4026
|
-
class
|
|
4026
|
+
class Cs {
|
|
4027
4027
|
constructor(e, s) {
|
|
4028
4028
|
P(this, "oHash");
|
|
4029
4029
|
P(this, "iHash");
|
|
@@ -4031,7 +4031,7 @@ class Ps {
|
|
|
4031
4031
|
P(this, "outputLen");
|
|
4032
4032
|
P(this, "finished", !1);
|
|
4033
4033
|
P(this, "destroyed", !1);
|
|
4034
|
-
if (
|
|
4034
|
+
if (us(e), V(s, void 0, "key"), this.iHash = e.create(), typeof this.iHash.update != "function")
|
|
4035
4035
|
throw new Error("Expected instance of class which extends utils.Hash");
|
|
4036
4036
|
this.blockLen = this.iHash.blockLen, this.outputLen = this.iHash.outputLen;
|
|
4037
4037
|
const t = this.blockLen, n = new Uint8Array(t);
|
|
@@ -4065,16 +4065,16 @@ class Ps {
|
|
|
4065
4065
|
this.destroyed = !0, this.oHash.destroy(), this.iHash.destroy();
|
|
4066
4066
|
}
|
|
4067
4067
|
}
|
|
4068
|
-
const
|
|
4069
|
-
|
|
4068
|
+
const Ns = (r, e, s) => new Cs(r, e).update(s).digest();
|
|
4069
|
+
Ns.create = (r, e) => new Cs(r, e);
|
|
4070
4070
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
4071
|
-
const
|
|
4072
|
-
function
|
|
4073
|
-
const [[t, n], [i, o]] = e, a =
|
|
4071
|
+
const Jt = (r, e) => (r + (r >= 0 ? e : -e) / Ls) / e;
|
|
4072
|
+
function An(r, e, s) {
|
|
4073
|
+
const [[t, n], [i, o]] = e, a = Jt(o * r, s), c = Jt(-n * r, s);
|
|
4074
4074
|
let l = r - a * t - c * i, u = -a * n - c * o;
|
|
4075
4075
|
const f = l < _e, x = u < _e;
|
|
4076
4076
|
f && (l = -l), x && (u = -u);
|
|
4077
|
-
const _ =
|
|
4077
|
+
const _ = St(Math.ceil(cn(s) / 2)) + Ne;
|
|
4078
4078
|
if (l < _e || l >= _ || u < _e || u >= _)
|
|
4079
4079
|
throw new Error("splitScalar (endomorphism): failed, k=" + r);
|
|
4080
4080
|
return { k1neg: f, k1: l, k2neg: x, k2: u };
|
|
@@ -4090,14 +4090,14 @@ function lt(r, e) {
|
|
|
4090
4090
|
s[t] = r[t] === void 0 ? e[t] : r[t];
|
|
4091
4091
|
return Ye(s.lowS, "lowS"), Ye(s.prehash, "prehash"), s.format !== void 0 && xt(s.format), s;
|
|
4092
4092
|
}
|
|
4093
|
-
class
|
|
4093
|
+
class In extends Error {
|
|
4094
4094
|
constructor(e = "") {
|
|
4095
4095
|
super(e);
|
|
4096
4096
|
}
|
|
4097
4097
|
}
|
|
4098
4098
|
const be = {
|
|
4099
4099
|
// asn.1 DER encoding utils
|
|
4100
|
-
Err:
|
|
4100
|
+
Err: In,
|
|
4101
4101
|
// Basic building block is TLV (Tag-Length-Value)
|
|
4102
4102
|
_tlv: {
|
|
4103
4103
|
encode: (r, e) => {
|
|
@@ -4182,12 +4182,12 @@ const be = {
|
|
|
4182
4182
|
const { _tlv: e, _int: s } = be, t = e.encode(2, s.encode(r.r)), n = e.encode(2, s.encode(r.s)), i = t + n;
|
|
4183
4183
|
return e.encode(48, i);
|
|
4184
4184
|
}
|
|
4185
|
-
}, _e = BigInt(0), Ne = BigInt(1),
|
|
4186
|
-
function
|
|
4185
|
+
}, _e = BigInt(0), Ne = BigInt(1), Ls = BigInt(2), Ve = BigInt(3), kn = BigInt(4);
|
|
4186
|
+
function Tn(r, e = {}) {
|
|
4187
4187
|
const s = vn("weierstrass", r, e), { Fp: t, Fn: n } = s;
|
|
4188
4188
|
let i = s.CURVE;
|
|
4189
4189
|
const { h: o, n: a } = i;
|
|
4190
|
-
|
|
4190
|
+
vt(e, {}, {
|
|
4191
4191
|
allowInfinityPoint: "boolean",
|
|
4192
4192
|
clearCofactor: "function",
|
|
4193
4193
|
isTorsionFree: "function",
|
|
@@ -4198,103 +4198,103 @@ function kn(r, e = {}) {
|
|
|
4198
4198
|
const { endo: c } = e;
|
|
4199
4199
|
if (c && (!t.is0(i.a) || typeof c.beta != "bigint" || !Array.isArray(c.basises)))
|
|
4200
4200
|
throw new Error('invalid endo: expected "beta": bigint and "basises": array');
|
|
4201
|
-
const l =
|
|
4201
|
+
const l = Ms(t, n);
|
|
4202
4202
|
function u() {
|
|
4203
4203
|
if (!t.isOdd)
|
|
4204
4204
|
throw new Error("compression is not supported: Field does not have .isOdd()");
|
|
4205
4205
|
}
|
|
4206
|
-
function f(
|
|
4207
|
-
const { x: k, y: O } = m.toAffine(),
|
|
4206
|
+
function f($, m, w) {
|
|
4207
|
+
const { x: k, y: O } = m.toAffine(), M = t.toBytes(k);
|
|
4208
4208
|
if (Ye(w, "isCompressed"), w) {
|
|
4209
4209
|
u();
|
|
4210
4210
|
const y = !t.isOdd(O);
|
|
4211
|
-
return
|
|
4211
|
+
return Se(Ds(y), M);
|
|
4212
4212
|
} else
|
|
4213
|
-
return
|
|
4213
|
+
return Se(Uint8Array.of(4), M, t.toBytes(O));
|
|
4214
4214
|
}
|
|
4215
|
-
function x(
|
|
4216
|
-
V(
|
|
4217
|
-
const { publicKey: m, publicKeyUncompressed: w } = l, k =
|
|
4215
|
+
function x($) {
|
|
4216
|
+
V($, void 0, "Point");
|
|
4217
|
+
const { publicKey: m, publicKeyUncompressed: w } = l, k = $.length, O = $[0], M = $.subarray(1);
|
|
4218
4218
|
if (k === m && (O === 2 || O === 3)) {
|
|
4219
|
-
const y = t.fromBytes(
|
|
4219
|
+
const y = t.fromBytes(M);
|
|
4220
4220
|
if (!t.isValid(y))
|
|
4221
4221
|
throw new Error("bad point: is not on curve, wrong x");
|
|
4222
|
-
const b =
|
|
4222
|
+
const b = v(y);
|
|
4223
4223
|
let E;
|
|
4224
4224
|
try {
|
|
4225
4225
|
E = t.sqrt(b);
|
|
4226
4226
|
} catch (F) {
|
|
4227
|
-
const
|
|
4228
|
-
throw new Error("bad point: is not on curve, sqrt error" +
|
|
4227
|
+
const U = F instanceof Error ? ": " + F.message : "";
|
|
4228
|
+
throw new Error("bad point: is not on curve, sqrt error" + U);
|
|
4229
4229
|
}
|
|
4230
4230
|
u();
|
|
4231
4231
|
const A = t.isOdd(E);
|
|
4232
4232
|
return (O & 1) === 1 !== A && (E = t.neg(E)), { x: y, y: E };
|
|
4233
4233
|
} else if (k === w && O === 4) {
|
|
4234
|
-
const y = t.BYTES, b = t.fromBytes(
|
|
4235
|
-
if (!
|
|
4234
|
+
const y = t.BYTES, b = t.fromBytes(M.subarray(0, y)), E = t.fromBytes(M.subarray(y, y * 2));
|
|
4235
|
+
if (!S(b, E))
|
|
4236
4236
|
throw new Error("bad point: is not on curve");
|
|
4237
4237
|
return { x: b, y: E };
|
|
4238
4238
|
} else
|
|
4239
4239
|
throw new Error(`bad point: got length ${k}, expected compressed=${m} or uncompressed=${w}`);
|
|
4240
4240
|
}
|
|
4241
4241
|
const _ = e.toBytes || f, p = e.fromBytes || x;
|
|
4242
|
-
function
|
|
4243
|
-
const m = t.sqr(
|
|
4244
|
-
return t.add(t.add(w, t.mul(
|
|
4242
|
+
function v($) {
|
|
4243
|
+
const m = t.sqr($), w = t.mul(m, $);
|
|
4244
|
+
return t.add(t.add(w, t.mul($, i.a)), i.b);
|
|
4245
4245
|
}
|
|
4246
|
-
function
|
|
4247
|
-
const w = t.sqr(m), k =
|
|
4246
|
+
function S($, m) {
|
|
4247
|
+
const w = t.sqr(m), k = v($);
|
|
4248
4248
|
return t.eql(w, k);
|
|
4249
4249
|
}
|
|
4250
|
-
if (!
|
|
4250
|
+
if (!S(i.Gx, i.Gy))
|
|
4251
4251
|
throw new Error("bad curve params: generator point");
|
|
4252
|
-
const I = t.mul(t.pow(i.a, Ve),
|
|
4252
|
+
const I = t.mul(t.pow(i.a, Ve), kn), T = t.mul(t.sqr(i.b), BigInt(27));
|
|
4253
4253
|
if (t.is0(t.add(I, T)))
|
|
4254
4254
|
throw new Error("bad curve params: a or b");
|
|
4255
|
-
function
|
|
4255
|
+
function B($, m, w = !1) {
|
|
4256
4256
|
if (!t.isValid(m) || w && t.is0(m))
|
|
4257
|
-
throw new Error(`bad point coordinate ${
|
|
4257
|
+
throw new Error(`bad point coordinate ${$}`);
|
|
4258
4258
|
return m;
|
|
4259
4259
|
}
|
|
4260
|
-
function D(
|
|
4261
|
-
if (!(
|
|
4260
|
+
function D($) {
|
|
4261
|
+
if (!($ instanceof X))
|
|
4262
4262
|
throw new Error("Weierstrass Point expected");
|
|
4263
4263
|
}
|
|
4264
|
-
function K(
|
|
4264
|
+
function K($) {
|
|
4265
4265
|
if (!c || !c.basises)
|
|
4266
4266
|
throw new Error("no endo");
|
|
4267
|
-
return
|
|
4267
|
+
return An($, c.basises, n.ORDER);
|
|
4268
4268
|
}
|
|
4269
|
-
const q =
|
|
4270
|
-
const { X: w, Y: k, Z: O } =
|
|
4269
|
+
const q = qt(($, m) => {
|
|
4270
|
+
const { X: w, Y: k, Z: O } = $;
|
|
4271
4271
|
if (t.eql(O, t.ONE))
|
|
4272
4272
|
return { x: w, y: k };
|
|
4273
|
-
const
|
|
4274
|
-
m == null && (m =
|
|
4273
|
+
const M = $.is0();
|
|
4274
|
+
m == null && (m = M ? t.ONE : t.inv(O));
|
|
4275
4275
|
const y = t.mul(w, m), b = t.mul(k, m), E = t.mul(O, m);
|
|
4276
|
-
if (
|
|
4276
|
+
if (M)
|
|
4277
4277
|
return { x: t.ZERO, y: t.ZERO };
|
|
4278
4278
|
if (!t.eql(E, t.ONE))
|
|
4279
4279
|
throw new Error("invZ was invalid");
|
|
4280
4280
|
return { x: y, y: b };
|
|
4281
|
-
}), Z =
|
|
4282
|
-
if (
|
|
4283
|
-
if (e.allowInfinityPoint && !t.is0(
|
|
4281
|
+
}), Z = qt(($) => {
|
|
4282
|
+
if ($.is0()) {
|
|
4283
|
+
if (e.allowInfinityPoint && !t.is0($.Y))
|
|
4284
4284
|
return;
|
|
4285
4285
|
throw new Error("bad point: ZERO");
|
|
4286
4286
|
}
|
|
4287
|
-
const { x: m, y: w } =
|
|
4287
|
+
const { x: m, y: w } = $.toAffine();
|
|
4288
4288
|
if (!t.isValid(m) || !t.isValid(w))
|
|
4289
4289
|
throw new Error("bad point: x or y not field elements");
|
|
4290
|
-
if (!
|
|
4290
|
+
if (!S(m, w))
|
|
4291
4291
|
throw new Error("bad point: equation left != right");
|
|
4292
|
-
if (
|
|
4292
|
+
if (!$.isTorsionFree())
|
|
4293
4293
|
throw new Error("bad point: not in prime-order subgroup");
|
|
4294
4294
|
return !0;
|
|
4295
4295
|
});
|
|
4296
|
-
function W(
|
|
4297
|
-
return w = new X(t.mul(w.X,
|
|
4296
|
+
function W($, m, w, k, O) {
|
|
4297
|
+
return w = new X(t.mul(w.X, $), w.Y, w.Z), m = Xe(k, m), w = Xe(O, w), m.add(w);
|
|
4298
4298
|
}
|
|
4299
4299
|
const N = class N {
|
|
4300
4300
|
/** Does NOT validate if the point is valid. Use `.assertValidity()`. */
|
|
@@ -4302,7 +4302,7 @@ function kn(r, e = {}) {
|
|
|
4302
4302
|
P(this, "X");
|
|
4303
4303
|
P(this, "Y");
|
|
4304
4304
|
P(this, "Z");
|
|
4305
|
-
this.X =
|
|
4305
|
+
this.X = B("x", m), this.Y = B("y", w, !0), this.Z = B("z", k), Object.freeze(this);
|
|
4306
4306
|
}
|
|
4307
4307
|
static CURVE() {
|
|
4308
4308
|
return i;
|
|
@@ -4336,7 +4336,7 @@ function kn(r, e = {}) {
|
|
|
4336
4336
|
* @returns
|
|
4337
4337
|
*/
|
|
4338
4338
|
precompute(m = 8, w = !0) {
|
|
4339
|
-
return
|
|
4339
|
+
return H.createCache(this, m), w || this.multiply(Ve), this;
|
|
4340
4340
|
}
|
|
4341
4341
|
// TODO: return `this`
|
|
4342
4342
|
/** A point on curve is valid if it conforms to equation. */
|
|
@@ -4352,7 +4352,7 @@ function kn(r, e = {}) {
|
|
|
4352
4352
|
/** Compare one point to another. */
|
|
4353
4353
|
equals(m) {
|
|
4354
4354
|
D(m);
|
|
4355
|
-
const { X: w, Y: k, Z: O } = this, { X:
|
|
4355
|
+
const { X: w, Y: k, Z: O } = this, { X: M, Y: y, Z: b } = m, E = t.eql(t.mul(w, b), t.mul(M, O)), A = t.eql(t.mul(k, b), t.mul(y, O));
|
|
4356
4356
|
return E && A;
|
|
4357
4357
|
}
|
|
4358
4358
|
/** Flips point to one corresponding to (x, -y) in Affine coordinates. */
|
|
@@ -4364,9 +4364,9 @@ function kn(r, e = {}) {
|
|
|
4364
4364
|
// https://eprint.iacr.org/2015/1060, algorithm 3
|
|
4365
4365
|
// Cost: 8M + 3S + 3*a + 2*b3 + 15add.
|
|
4366
4366
|
double() {
|
|
4367
|
-
const { a: m, b: w } = i, k = t.mul(w, Ve), { X: O, Y:
|
|
4368
|
-
let b = t.ZERO, E = t.ZERO, A = t.ZERO, R = t.mul(O, O), F = t.mul(
|
|
4369
|
-
return L = t.add(L, L), A = t.mul(O, y), A = t.add(A, A), b = t.mul(m, A), E = t.mul(k,
|
|
4367
|
+
const { a: m, b: w } = i, k = t.mul(w, Ve), { X: O, Y: M, Z: y } = this;
|
|
4368
|
+
let b = t.ZERO, E = t.ZERO, A = t.ZERO, R = t.mul(O, O), F = t.mul(M, M), U = t.mul(y, y), L = t.mul(O, M);
|
|
4369
|
+
return L = t.add(L, L), A = t.mul(O, y), A = t.add(A, A), b = t.mul(m, A), E = t.mul(k, U), E = t.add(b, E), b = t.sub(F, E), E = t.add(F, E), E = t.mul(b, E), b = t.mul(L, b), A = t.mul(k, A), U = t.mul(m, U), L = t.sub(R, U), L = t.mul(m, L), L = t.add(L, A), A = t.add(R, R), R = t.add(A, R), R = t.add(R, U), R = t.mul(R, L), E = t.add(E, R), U = t.mul(M, y), U = t.add(U, U), R = t.mul(U, L), b = t.sub(b, R), A = t.mul(U, F), A = t.add(A, A), A = t.add(A, A), new N(b, E, A);
|
|
4370
4370
|
}
|
|
4371
4371
|
// Renes-Costello-Batina exception-free addition formula.
|
|
4372
4372
|
// There is 30% faster Jacobian formula, but it is not complete.
|
|
@@ -4374,13 +4374,13 @@ function kn(r, e = {}) {
|
|
|
4374
4374
|
// Cost: 12M + 0S + 3*a + 3*b3 + 23add.
|
|
4375
4375
|
add(m) {
|
|
4376
4376
|
D(m);
|
|
4377
|
-
const { X: w, Y: k, Z: O } = this, { X:
|
|
4377
|
+
const { X: w, Y: k, Z: O } = this, { X: M, Y: y, Z: b } = m;
|
|
4378
4378
|
let E = t.ZERO, A = t.ZERO, R = t.ZERO;
|
|
4379
|
-
const F = i.a,
|
|
4380
|
-
let L = t.mul(w,
|
|
4379
|
+
const F = i.a, U = t.mul(i.b, Ve);
|
|
4380
|
+
let L = t.mul(w, M), G = t.mul(k, y), Y = t.mul(O, b), ie = t.add(w, k), z = t.add(M, y);
|
|
4381
4381
|
ie = t.mul(ie, z), z = t.add(L, G), ie = t.sub(ie, z), z = t.add(w, O);
|
|
4382
|
-
let ee = t.add(
|
|
4383
|
-
return z = t.mul(z, ee), ee = t.add(L, Y), z = t.sub(z, ee), ee = t.add(k, O), E = t.add(y, b), ee = t.mul(ee, E), E = t.add(G, Y), ee = t.sub(ee, E), R = t.mul(F, z), E = t.mul(
|
|
4382
|
+
let ee = t.add(M, b);
|
|
4383
|
+
return z = t.mul(z, ee), ee = t.add(L, Y), z = t.sub(z, ee), ee = t.add(k, O), E = t.add(y, b), ee = t.mul(ee, E), E = t.add(G, Y), ee = t.sub(ee, E), R = t.mul(F, z), E = t.mul(U, Y), R = t.add(E, R), E = t.sub(G, R), R = t.add(G, R), A = t.mul(E, R), G = t.add(L, L), G = t.add(G, L), Y = t.mul(F, Y), z = t.mul(U, z), G = t.add(G, Y), Y = t.sub(L, Y), Y = t.mul(F, Y), z = t.add(z, Y), L = t.mul(G, z), A = t.add(A, L), L = t.mul(ee, z), E = t.mul(ie, E), E = t.sub(E, L), L = t.mul(ie, G), R = t.mul(ee, R), R = t.add(R, L), new N(E, A, R);
|
|
4384
4384
|
}
|
|
4385
4385
|
subtract(m) {
|
|
4386
4386
|
return this.add(m.negate());
|
|
@@ -4402,15 +4402,15 @@ function kn(r, e = {}) {
|
|
|
4402
4402
|
if (!n.isValidNot0(m))
|
|
4403
4403
|
throw new Error("invalid scalar: out of range");
|
|
4404
4404
|
let k, O;
|
|
4405
|
-
const
|
|
4405
|
+
const M = (y) => H.cached(this, y, (b) => zt(N, b));
|
|
4406
4406
|
if (w) {
|
|
4407
|
-
const { k1neg: y, k1: b, k2neg: E, k2: A } = K(m), { p: R, f: F } =
|
|
4408
|
-
O = F.add(L), k = W(w.beta, R,
|
|
4407
|
+
const { k1neg: y, k1: b, k2neg: E, k2: A } = K(m), { p: R, f: F } = M(b), { p: U, f: L } = M(A);
|
|
4408
|
+
O = F.add(L), k = W(w.beta, R, U, y, E);
|
|
4409
4409
|
} else {
|
|
4410
|
-
const { p: y, f: b } =
|
|
4410
|
+
const { p: y, f: b } = M(m);
|
|
4411
4411
|
k = y, O = b;
|
|
4412
4412
|
}
|
|
4413
|
-
return
|
|
4413
|
+
return zt(N, [k, O])[0];
|
|
4414
4414
|
}
|
|
4415
4415
|
/**
|
|
4416
4416
|
* Non-constant-time multiplication. Uses double-and-add algorithm.
|
|
@@ -4425,13 +4425,13 @@ function kn(r, e = {}) {
|
|
|
4425
4425
|
return N.ZERO;
|
|
4426
4426
|
if (m === Ne)
|
|
4427
4427
|
return k;
|
|
4428
|
-
if (
|
|
4428
|
+
if (H.hasCache(this))
|
|
4429
4429
|
return this.multiply(m);
|
|
4430
4430
|
if (w) {
|
|
4431
|
-
const { k1neg: O, k1:
|
|
4431
|
+
const { k1neg: O, k1: M, k2neg: y, k2: b } = K(m), { p1: E, p2: A } = Sn(N, k, M, b);
|
|
4432
4432
|
return W(w.beta, E, A, O, y);
|
|
4433
4433
|
} else
|
|
4434
|
-
return
|
|
4434
|
+
return H.unsafe(k, m);
|
|
4435
4435
|
}
|
|
4436
4436
|
/**
|
|
4437
4437
|
* Converts Projective point to affine (x, y) coordinates.
|
|
@@ -4446,7 +4446,7 @@ function kn(r, e = {}) {
|
|
|
4446
4446
|
*/
|
|
4447
4447
|
isTorsionFree() {
|
|
4448
4448
|
const { isTorsionFree: m } = e;
|
|
4449
|
-
return o === Ne ? !0 : m ? m(N, this) :
|
|
4449
|
+
return o === Ne ? !0 : m ? m(N, this) : H.unsafe(this, a).is0();
|
|
4450
4450
|
}
|
|
4451
4451
|
clearCofactor() {
|
|
4452
4452
|
const { clearCofactor: m } = e;
|
|
@@ -4472,13 +4472,13 @@ function kn(r, e = {}) {
|
|
|
4472
4472
|
P(N, "Fp", t), // scalar field
|
|
4473
4473
|
P(N, "Fn", n);
|
|
4474
4474
|
let X = N;
|
|
4475
|
-
const Q = n.BITS,
|
|
4475
|
+
const Q = n.BITS, H = new bn(X, e.endo ? Math.ceil(Q / 2) : Q);
|
|
4476
4476
|
return X.BASE.precompute(8), X;
|
|
4477
4477
|
}
|
|
4478
|
-
function
|
|
4478
|
+
function Ds(r) {
|
|
4479
4479
|
return Uint8Array.of(r ? 2 : 3);
|
|
4480
4480
|
}
|
|
4481
|
-
function
|
|
4481
|
+
function Ms(r, e) {
|
|
4482
4482
|
return {
|
|
4483
4483
|
secretKey: e.BYTES,
|
|
4484
4484
|
publicKey: 1 + r.BYTES,
|
|
@@ -4487,8 +4487,8 @@ function Ds(r, e) {
|
|
|
4487
4487
|
signature: 2 * e.BYTES
|
|
4488
4488
|
};
|
|
4489
4489
|
}
|
|
4490
|
-
function
|
|
4491
|
-
const { Fn: s } = r, t = e.randomBytes ||
|
|
4490
|
+
function Rn(r, e = {}) {
|
|
4491
|
+
const { Fn: s } = r, t = e.randomBytes || _s, n = Object.assign(Ms(r.Fp, s), { seed: Rs(s.ORDER) });
|
|
4492
4492
|
function i(_) {
|
|
4493
4493
|
try {
|
|
4494
4494
|
const p = s.fromBytes(_);
|
|
@@ -4498,57 +4498,57 @@ function Tn(r, e = {}) {
|
|
|
4498
4498
|
}
|
|
4499
4499
|
}
|
|
4500
4500
|
function o(_, p) {
|
|
4501
|
-
const { publicKey:
|
|
4501
|
+
const { publicKey: v, publicKeyUncompressed: S } = n;
|
|
4502
4502
|
try {
|
|
4503
4503
|
const I = _.length;
|
|
4504
|
-
return p === !0 && I !==
|
|
4504
|
+
return p === !0 && I !== v || p === !1 && I !== S ? !1 : !!r.fromBytes(_);
|
|
4505
4505
|
} catch {
|
|
4506
4506
|
return !1;
|
|
4507
4507
|
}
|
|
4508
4508
|
}
|
|
4509
4509
|
function a(_ = t(n.seed)) {
|
|
4510
|
-
return
|
|
4510
|
+
return yn(V(_, n.seed, "seed"), s.ORDER);
|
|
4511
4511
|
}
|
|
4512
4512
|
function c(_, p = !0) {
|
|
4513
4513
|
return r.BASE.multiply(s.fromBytes(_)).toBytes(p);
|
|
4514
4514
|
}
|
|
4515
4515
|
function l(_) {
|
|
4516
|
-
const { secretKey: p, publicKey:
|
|
4517
|
-
if (!wt(_) || "_lengths" in s && s._lengths || p ===
|
|
4516
|
+
const { secretKey: p, publicKey: v, publicKeyUncompressed: S } = n;
|
|
4517
|
+
if (!wt(_) || "_lengths" in s && s._lengths || p === v)
|
|
4518
4518
|
return;
|
|
4519
4519
|
const I = V(_, void 0, "key").length;
|
|
4520
|
-
return I ===
|
|
4520
|
+
return I === v || I === S;
|
|
4521
4521
|
}
|
|
4522
|
-
function u(_, p,
|
|
4522
|
+
function u(_, p, v = !0) {
|
|
4523
4523
|
if (l(_) === !0)
|
|
4524
4524
|
throw new Error("first arg must be private key");
|
|
4525
4525
|
if (l(p) === !1)
|
|
4526
4526
|
throw new Error("second arg must be public key");
|
|
4527
|
-
const
|
|
4528
|
-
return r.fromBytes(p).multiply(
|
|
4527
|
+
const S = s.fromBytes(_);
|
|
4528
|
+
return r.fromBytes(p).multiply(S).toBytes(v);
|
|
4529
4529
|
}
|
|
4530
4530
|
const f = {
|
|
4531
4531
|
isValidSecretKey: i,
|
|
4532
4532
|
isValidPublicKey: o,
|
|
4533
4533
|
randomSecretKey: a
|
|
4534
|
-
}, x =
|
|
4534
|
+
}, x = En(a, c);
|
|
4535
4535
|
return Object.freeze({ getPublicKey: c, getSharedSecret: u, keygen: x, Point: r, utils: f, lengths: n });
|
|
4536
4536
|
}
|
|
4537
|
-
function
|
|
4538
|
-
|
|
4537
|
+
function On(r, e, s = {}) {
|
|
4538
|
+
us(e), vt(s, {}, {
|
|
4539
4539
|
hmac: "function",
|
|
4540
4540
|
lowS: "boolean",
|
|
4541
4541
|
randomBytes: "function",
|
|
4542
4542
|
bits2int: "function",
|
|
4543
4543
|
bits2int_modN: "function"
|
|
4544
4544
|
}), s = Object.assign({}, s);
|
|
4545
|
-
const t = s.randomBytes ||
|
|
4545
|
+
const t = s.randomBytes || _s, n = s.hmac || ((m, w) => Ns(e, m, w)), { Fp: i, Fn: o } = r, { ORDER: a, BITS: c } = o, { keygen: l, getPublicKey: u, getSharedSecret: f, utils: x, lengths: _ } = Rn(r, s), p = {
|
|
4546
4546
|
prehash: !0,
|
|
4547
4547
|
lowS: typeof s.lowS == "boolean" ? s.lowS : !0,
|
|
4548
4548
|
format: "compact",
|
|
4549
4549
|
extraEntropy: !1
|
|
4550
|
-
},
|
|
4551
|
-
function
|
|
4550
|
+
}, v = a * Ls < i.ORDER;
|
|
4551
|
+
function S(m) {
|
|
4552
4552
|
const w = a >> Ne;
|
|
4553
4553
|
return m > w;
|
|
4554
4554
|
}
|
|
@@ -4558,10 +4558,10 @@ function Rn(r, e, s = {}) {
|
|
|
4558
4558
|
return w;
|
|
4559
4559
|
}
|
|
4560
4560
|
function T() {
|
|
4561
|
-
if (
|
|
4561
|
+
if (v)
|
|
4562
4562
|
throw new Error('"recovered" sig type is not supported for cofactor >2 curves');
|
|
4563
4563
|
}
|
|
4564
|
-
function
|
|
4564
|
+
function B(m, w) {
|
|
4565
4565
|
xt(w);
|
|
4566
4566
|
const k = _.signature, O = w === "compact" ? k : w === "recovered" ? k + 1 : void 0;
|
|
4567
4567
|
return V(m, O);
|
|
@@ -4579,14 +4579,14 @@ function Rn(r, e, s = {}) {
|
|
|
4579
4579
|
Object.freeze(this);
|
|
4580
4580
|
}
|
|
4581
4581
|
static fromBytes(w, k = p.format) {
|
|
4582
|
-
|
|
4582
|
+
B(w, k);
|
|
4583
4583
|
let O;
|
|
4584
4584
|
if (k === "der") {
|
|
4585
4585
|
const { r: E, s: A } = be.toSig(V(w));
|
|
4586
4586
|
return new D(E, A);
|
|
4587
4587
|
}
|
|
4588
4588
|
k === "recovered" && (O = w[0], k = "compact", w = w.subarray(1));
|
|
4589
|
-
const
|
|
4589
|
+
const M = _.signature / 2, y = w.subarray(0, M), b = w.subarray(M, M * 2);
|
|
4590
4590
|
return new D(o.fromBytes(y), o.fromBytes(b), O);
|
|
4591
4591
|
}
|
|
4592
4592
|
static fromHex(w, k) {
|
|
@@ -4602,23 +4602,23 @@ function Rn(r, e, s = {}) {
|
|
|
4602
4602
|
return new D(this.r, this.s, w);
|
|
4603
4603
|
}
|
|
4604
4604
|
recoverPublicKey(w) {
|
|
4605
|
-
const { r: k, s: O } = this,
|
|
4605
|
+
const { r: k, s: O } = this, M = this.assertRecovery(), y = M === 2 || M === 3 ? k + a : k;
|
|
4606
4606
|
if (!i.isValid(y))
|
|
4607
4607
|
throw new Error("invalid recovery id: sig.r+curve.n != R.x");
|
|
4608
|
-
const b = i.toBytes(y), E = r.fromBytes(
|
|
4608
|
+
const b = i.toBytes(y), E = r.fromBytes(Se(Ds((M & 1) === 0), b)), A = o.inv(y), R = q(V(w, void 0, "msgHash")), F = o.create(-R * A), U = o.create(O * A), L = r.BASE.multiplyUnsafe(F).add(E.multiplyUnsafe(U));
|
|
4609
4609
|
if (L.is0())
|
|
4610
4610
|
throw new Error("invalid recovery: point at infinify");
|
|
4611
4611
|
return L.assertValidity(), L;
|
|
4612
4612
|
}
|
|
4613
4613
|
// Signatures should be low-s, to prevent malleability.
|
|
4614
4614
|
hasHighS() {
|
|
4615
|
-
return
|
|
4615
|
+
return S(this.s);
|
|
4616
4616
|
}
|
|
4617
4617
|
toBytes(w = p.format) {
|
|
4618
4618
|
if (xt(w), w === "der")
|
|
4619
4619
|
return je(be.hexFromSig(this));
|
|
4620
|
-
const { r: k, s: O } = this,
|
|
4621
|
-
return w === "recovered" ? (T(),
|
|
4620
|
+
const { r: k, s: O } = this, M = o.toBytes(k), y = o.toBytes(O);
|
|
4621
|
+
return w === "recovered" ? (T(), Se(Uint8Array.of(this.assertRecovery()), M, y)) : Se(M, y);
|
|
4622
4622
|
}
|
|
4623
4623
|
toHex(w) {
|
|
4624
4624
|
return Fe(this.toBytes(w));
|
|
@@ -4631,16 +4631,16 @@ function Rn(r, e, s = {}) {
|
|
|
4631
4631
|
return O > 0 ? k >> BigInt(O) : k;
|
|
4632
4632
|
}, q = s.bits2int_modN || function(w) {
|
|
4633
4633
|
return o.create(K(w));
|
|
4634
|
-
}, Z =
|
|
4634
|
+
}, Z = St(c);
|
|
4635
4635
|
function W(m) {
|
|
4636
|
-
return
|
|
4636
|
+
return an("num < 2^" + c, m, _e, Z), o.toBytes(m);
|
|
4637
4637
|
}
|
|
4638
4638
|
function X(m, w) {
|
|
4639
4639
|
return V(m, void 0, "message"), w ? V(e(m), void 0, "prehashed message") : m;
|
|
4640
4640
|
}
|
|
4641
4641
|
function Q(m, w, k) {
|
|
4642
|
-
const { lowS: O, prehash:
|
|
4643
|
-
m = X(m,
|
|
4642
|
+
const { lowS: O, prehash: M, extraEntropy: y } = lt(k, p);
|
|
4643
|
+
m = X(m, M);
|
|
4644
4644
|
const b = q(m), E = o.fromBytes(w);
|
|
4645
4645
|
if (!o.isValidNot0(E))
|
|
4646
4646
|
throw new Error("invalid private key");
|
|
@@ -4649,8 +4649,8 @@ function Rn(r, e, s = {}) {
|
|
|
4649
4649
|
const L = y === !0 ? t(_.secretKey) : y;
|
|
4650
4650
|
A.push(V(L, void 0, "extraEntropy"));
|
|
4651
4651
|
}
|
|
4652
|
-
const R =
|
|
4653
|
-
function
|
|
4652
|
+
const R = Se(...A), F = b;
|
|
4653
|
+
function U(L) {
|
|
4654
4654
|
const G = K(L);
|
|
4655
4655
|
if (!o.isValidNot0(G))
|
|
4656
4656
|
return;
|
|
@@ -4661,32 +4661,32 @@ function Rn(r, e, s = {}) {
|
|
|
4661
4661
|
if (ee === _e)
|
|
4662
4662
|
return;
|
|
4663
4663
|
let Tt = (ie.x === z ? 0 : 2) | Number(ie.y & Ne), Rt = ee;
|
|
4664
|
-
return O &&
|
|
4664
|
+
return O && S(ee) && (Rt = o.neg(ee), Tt ^= 1), new D(z, Rt, v ? void 0 : Tt);
|
|
4665
4665
|
}
|
|
4666
|
-
return { seed: R, k2sig:
|
|
4666
|
+
return { seed: R, k2sig: U };
|
|
4667
4667
|
}
|
|
4668
|
-
function
|
|
4669
|
-
const { seed: O, k2sig:
|
|
4670
|
-
return
|
|
4668
|
+
function H(m, w, k = {}) {
|
|
4669
|
+
const { seed: O, k2sig: M } = Q(m, w, k);
|
|
4670
|
+
return ln(e.outputLen, o.BYTES, n)(O, M).toBytes(k.format);
|
|
4671
4671
|
}
|
|
4672
4672
|
function N(m, w, k, O = {}) {
|
|
4673
|
-
const { lowS:
|
|
4673
|
+
const { lowS: M, prehash: y, format: b } = lt(O, p);
|
|
4674
4674
|
if (k = V(k, void 0, "publicKey"), w = X(w, y), !wt(m)) {
|
|
4675
4675
|
const E = m instanceof D ? ", use sig.toBytes()" : "";
|
|
4676
4676
|
throw new Error("verify expects Uint8Array signature" + E);
|
|
4677
4677
|
}
|
|
4678
|
-
|
|
4678
|
+
B(m, b);
|
|
4679
4679
|
try {
|
|
4680
4680
|
const E = D.fromBytes(m, b), A = r.fromBytes(k);
|
|
4681
|
-
if (
|
|
4681
|
+
if (M && E.hasHighS())
|
|
4682
4682
|
return !1;
|
|
4683
|
-
const { r: R, s: F } = E,
|
|
4683
|
+
const { r: R, s: F } = E, U = q(w), L = o.inv(F), G = o.create(U * L), Y = o.create(R * L), ie = r.BASE.multiplyUnsafe(G).add(A.multiplyUnsafe(Y));
|
|
4684
4684
|
return ie.is0() ? !1 : o.create(ie.x) === R;
|
|
4685
4685
|
} catch {
|
|
4686
4686
|
return !1;
|
|
4687
4687
|
}
|
|
4688
4688
|
}
|
|
4689
|
-
function
|
|
4689
|
+
function $(m, w, k = {}) {
|
|
4690
4690
|
const { prehash: O } = lt(k, p);
|
|
4691
4691
|
return w = X(w, O), D.fromBytes(m, "recovered").recoverPublicKey(w).toBytes();
|
|
4692
4692
|
}
|
|
@@ -4697,9 +4697,9 @@ function Rn(r, e, s = {}) {
|
|
|
4697
4697
|
utils: x,
|
|
4698
4698
|
lengths: _,
|
|
4699
4699
|
Point: r,
|
|
4700
|
-
sign:
|
|
4700
|
+
sign: H,
|
|
4701
4701
|
verify: N,
|
|
4702
|
-
recoverPublicKey:
|
|
4702
|
+
recoverPublicKey: $,
|
|
4703
4703
|
Signature: D,
|
|
4704
4704
|
hash: e
|
|
4705
4705
|
});
|
|
@@ -4713,44 +4713,44 @@ const At = {
|
|
|
4713
4713
|
b: BigInt(7),
|
|
4714
4714
|
Gx: BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),
|
|
4715
4715
|
Gy: BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")
|
|
4716
|
-
},
|
|
4716
|
+
}, Pn = {
|
|
4717
4717
|
beta: BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),
|
|
4718
4718
|
basises: [
|
|
4719
4719
|
[BigInt("0x3086d221a7d46bcde86c90e49284eb15"), -BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],
|
|
4720
4720
|
[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"), BigInt("0x3086d221a7d46bcde86c90e49284eb15")]
|
|
4721
4721
|
]
|
|
4722
|
-
},
|
|
4723
|
-
function
|
|
4724
|
-
const e = At.p, s = BigInt(3), t = BigInt(6), n = BigInt(11), i = BigInt(22), o = BigInt(23), a = BigInt(44), c = BigInt(88), l = r * r * r % e, u = l * l * r % e, f = ae(u, s, e) * u % e, x = ae(f, s, e) * u % e, _ = ae(x,
|
|
4722
|
+
}, Zt = /* @__PURE__ */ BigInt(2);
|
|
4723
|
+
function Cn(r) {
|
|
4724
|
+
const e = At.p, s = BigInt(3), t = BigInt(6), n = BigInt(11), i = BigInt(22), o = BigInt(23), a = BigInt(44), c = BigInt(88), l = r * r * r % e, u = l * l * r % e, f = ae(u, s, e) * u % e, x = ae(f, s, e) * u % e, _ = ae(x, Zt, e) * l % e, p = ae(_, n, e) * _ % e, v = ae(p, i, e) * p % e, S = ae(v, a, e) * v % e, I = ae(S, c, e) * S % e, T = ae(I, a, e) * v % e, B = ae(T, s, e) * u % e, D = ae(B, o, e) * p % e, K = ae(D, t, e) * l % e, q = ae(K, Zt, e);
|
|
4725
4725
|
if (!gt.eql(gt.sqr(q), r))
|
|
4726
4726
|
throw new Error("Cannot find square root");
|
|
4727
4727
|
return q;
|
|
4728
4728
|
}
|
|
4729
|
-
const gt = et(At.p, { sqrt:
|
|
4729
|
+
const gt = et(At.p, { sqrt: Cn }), Nn = /* @__PURE__ */ Tn(At, {
|
|
4730
4730
|
Fp: gt,
|
|
4731
|
-
endo:
|
|
4732
|
-
}),
|
|
4733
|
-
for (let r = 0, e =
|
|
4734
|
-
[s, t] = [t, (2 * s + 3 * t) % 5], $s.push(2 * (5 * t + s)),
|
|
4735
|
-
let n =
|
|
4731
|
+
endo: Pn
|
|
4732
|
+
}), Ln = /* @__PURE__ */ On(Nn, rn), Dn = BigInt(0), $e = BigInt(1), Mn = BigInt(2), $n = BigInt(7), Bn = BigInt(256), Un = BigInt(113), $s = [], Bs = [], Us = [];
|
|
4733
|
+
for (let r = 0, e = $e, s = 1, t = 0; r < 24; r++) {
|
|
4734
|
+
[s, t] = [t, (2 * s + 3 * t) % 5], $s.push(2 * (5 * t + s)), Bs.push((r + 1) * (r + 2) / 2 % 64);
|
|
4735
|
+
let n = Dn;
|
|
4736
4736
|
for (let i = 0; i < 7; i++)
|
|
4737
|
-
e = (e <<
|
|
4738
|
-
|
|
4737
|
+
e = (e << $e ^ (e >> $n) * Un) % Bn, e & Mn && (n ^= $e << ($e << BigInt(i)) - $e);
|
|
4738
|
+
Us.push(n);
|
|
4739
4739
|
}
|
|
4740
|
-
const
|
|
4741
|
-
function
|
|
4740
|
+
const Hs = Yr(Us, !0), Hn = Hs[0], Fn = Hs[1], Qt = (r, e, s) => s > 32 ? Zr(r, e, s) : Xr(r, e, s), es = (r, e, s) => s > 32 ? Qr(r, e, s) : Jr(r, e, s);
|
|
4741
|
+
function Wn(r, e = 24) {
|
|
4742
4742
|
const s = new Uint32Array(10);
|
|
4743
4743
|
for (let t = 24 - e; t < 24; t++) {
|
|
4744
4744
|
for (let o = 0; o < 10; o++)
|
|
4745
4745
|
s[o] = r[o] ^ r[o + 10] ^ r[o + 20] ^ r[o + 30] ^ r[o + 40];
|
|
4746
4746
|
for (let o = 0; o < 10; o += 2) {
|
|
4747
|
-
const a = (o + 8) % 10, c = (o + 2) % 10, l = s[c], u = s[c + 1], f =
|
|
4747
|
+
const a = (o + 8) % 10, c = (o + 2) % 10, l = s[c], u = s[c + 1], f = Qt(l, u, 1) ^ s[a], x = es(l, u, 1) ^ s[a + 1];
|
|
4748
4748
|
for (let _ = 0; _ < 50; _ += 10)
|
|
4749
4749
|
r[o + _] ^= f, r[o + _ + 1] ^= x;
|
|
4750
4750
|
}
|
|
4751
4751
|
let n = r[2], i = r[3];
|
|
4752
4752
|
for (let o = 0; o < 24; o++) {
|
|
4753
|
-
const a =
|
|
4753
|
+
const a = Bs[o], c = Qt(n, i, a), l = es(n, i, a), u = $s[o];
|
|
4754
4754
|
n = r[u], i = r[u + 1], r[u] = c, r[u + 1] = l;
|
|
4755
4755
|
}
|
|
4756
4756
|
for (let o = 0; o < 50; o += 10) {
|
|
@@ -4759,7 +4759,7 @@ function Fn(r, e = 24) {
|
|
|
4759
4759
|
for (let a = 0; a < 10; a++)
|
|
4760
4760
|
r[o + a] ^= ~s[(a + 2) % 10] & s[(a + 4) % 10];
|
|
4761
4761
|
}
|
|
4762
|
-
r[0] ^=
|
|
4762
|
+
r[0] ^= Hn[t], r[1] ^= Fn[t];
|
|
4763
4763
|
}
|
|
4764
4764
|
De(s);
|
|
4765
4765
|
}
|
|
@@ -4779,13 +4779,13 @@ class It {
|
|
|
4779
4779
|
P(this, "rounds");
|
|
4780
4780
|
if (this.blockLen = e, this.suffix = s, this.outputLen = t, this.enableXOF = n, this.rounds = i, me(t, "outputLen"), !(0 < e && e < 200))
|
|
4781
4781
|
throw new Error("only keccak-f1600 function is supported");
|
|
4782
|
-
this.state = new Uint8Array(200), this.state32 =
|
|
4782
|
+
this.state = new Uint8Array(200), this.state32 = Ur(this.state);
|
|
4783
4783
|
}
|
|
4784
4784
|
clone() {
|
|
4785
4785
|
return this._cloneInto();
|
|
4786
4786
|
}
|
|
4787
4787
|
keccak() {
|
|
4788
|
-
|
|
4788
|
+
Ft(this.state32), Wn(this.state32, this.rounds), Ft(this.state32), this.posOut = 0, this.pos = 0;
|
|
4789
4789
|
}
|
|
4790
4790
|
update(e) {
|
|
4791
4791
|
Le(this), V(e);
|
|
@@ -4824,7 +4824,7 @@ class It {
|
|
|
4824
4824
|
return me(e), this.xofInto(new Uint8Array(e));
|
|
4825
4825
|
}
|
|
4826
4826
|
digestInto(e) {
|
|
4827
|
-
if (
|
|
4827
|
+
if (hs(e, this), this.finished)
|
|
4828
4828
|
throw new Error("digest() was already called");
|
|
4829
4829
|
return this.writeInto(e), this.destroy(), e;
|
|
4830
4830
|
}
|
|
@@ -4839,14 +4839,14 @@ class It {
|
|
|
4839
4839
|
return e || (e = new It(s, 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;
|
|
4840
4840
|
}
|
|
4841
4841
|
}
|
|
4842
|
-
const
|
|
4843
|
-
class
|
|
4842
|
+
const Gn = (r, e, s, t = {}) => fs(() => new It(e, r, s), t), ts = /* @__PURE__ */ Gn(1, 136, 32), qn = 60;
|
|
4843
|
+
class Kn {
|
|
4844
4844
|
constructor() {
|
|
4845
4845
|
this.jwks = null;
|
|
4846
4846
|
}
|
|
4847
4847
|
setJWKSEndpoint(e) {
|
|
4848
4848
|
try {
|
|
4849
|
-
this.jwks =
|
|
4849
|
+
this.jwks = Xs(new URL(e)), d.log("[CROSSx] JWKS 엔드포인트 설정:", e);
|
|
4850
4850
|
} catch (s) {
|
|
4851
4851
|
d.warn("[CROSSx] JWKS 엔드포인트 URL 파싱 실패:", s);
|
|
4852
4852
|
}
|
|
@@ -4860,7 +4860,7 @@ class qn {
|
|
|
4860
4860
|
iat: t.iat
|
|
4861
4861
|
});
|
|
4862
4862
|
const n = Math.floor(Date.now() / 1e3);
|
|
4863
|
-
if (t.exp && t.exp +
|
|
4863
|
+
if (t.exp && t.exp + qn < n)
|
|
4864
4864
|
return d.warn("[CROSSx] 토큰 만료:", {
|
|
4865
4865
|
exp: t.exp,
|
|
4866
4866
|
now: n,
|
|
@@ -4870,7 +4870,7 @@ class qn {
|
|
|
4870
4870
|
return d.warn("[CROSSx] JWT에 sub(사용자ID) 없음"), { payload: t, valid: !1, signatureVerified: !1 };
|
|
4871
4871
|
if (this.jwks)
|
|
4872
4872
|
try {
|
|
4873
|
-
const { payload: i } = await
|
|
4873
|
+
const { payload: i } = await Js(e, this.jwks, {
|
|
4874
4874
|
algorithms: ["RS256", "ES256"]
|
|
4875
4875
|
});
|
|
4876
4876
|
return d.log("[CROSSx] JWT 서명 검증 성공"), {
|
|
@@ -4889,7 +4889,7 @@ class qn {
|
|
|
4889
4889
|
}
|
|
4890
4890
|
}
|
|
4891
4891
|
decodeJWT(e) {
|
|
4892
|
-
return
|
|
4892
|
+
return Zs(e);
|
|
4893
4893
|
}
|
|
4894
4894
|
/**
|
|
4895
4895
|
* EIP-191 personal_sign 서명에서 서명자 Ethereum 주소를 복원합니다.
|
|
@@ -4904,29 +4904,29 @@ class qn {
|
|
|
4904
4904
|
${t.length}`
|
|
4905
4905
|
), i = new Uint8Array(n.length + t.length);
|
|
4906
4906
|
i.set(n, 0), i.set(t, n.length);
|
|
4907
|
-
const o =
|
|
4907
|
+
const o = ts(i), a = s.startsWith("0x") ? s.slice(2) : s;
|
|
4908
4908
|
if (a.length !== 130)
|
|
4909
4909
|
throw new Error(`서명 길이가 유효하지 않습니다: 130 hex 문자 예상, 현재 ${a.length}`);
|
|
4910
|
-
const c =
|
|
4911
|
-
|
|
4912
|
-
|
|
4913
|
-
).addRecoveryBit(x).recoverPublicKey(o).toBytes(!1).slice(1),
|
|
4914
|
-
return "0x" + Fe(
|
|
4910
|
+
const c = Vn(a), l = c.slice(0, 32), u = c.slice(32, 64), f = c[64], x = f >= 27 ? f - 27 : f, v = new Ln.Signature(
|
|
4911
|
+
ss(l),
|
|
4912
|
+
ss(u)
|
|
4913
|
+
).addRecoveryBit(x).recoverPublicKey(o).toBytes(!1).slice(1), S = ts(v);
|
|
4914
|
+
return "0x" + Fe(S.slice(12));
|
|
4915
4915
|
}
|
|
4916
4916
|
}
|
|
4917
|
-
function
|
|
4917
|
+
function Vn(r) {
|
|
4918
4918
|
const e = new Uint8Array(r.length / 2);
|
|
4919
4919
|
for (let s = 0; s < e.length; s++)
|
|
4920
4920
|
e[s] = parseInt(r.substring(s * 2, s * 2 + 2), 16);
|
|
4921
4921
|
return e;
|
|
4922
4922
|
}
|
|
4923
|
-
function
|
|
4923
|
+
function ss(r) {
|
|
4924
4924
|
let e = "0x";
|
|
4925
4925
|
for (const s of r) e += s.toString(16).padStart(2, "0");
|
|
4926
4926
|
return BigInt(e);
|
|
4927
4927
|
}
|
|
4928
|
-
const
|
|
4929
|
-
class
|
|
4928
|
+
const zn = 3e4, jn = 1e3;
|
|
4929
|
+
class Yn {
|
|
4930
4930
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4931
4931
|
async request(e) {
|
|
4932
4932
|
const s = e.retries ?? 0;
|
|
@@ -4937,7 +4937,7 @@ class jn {
|
|
|
4937
4937
|
} catch (n) {
|
|
4938
4938
|
if (t === s) throw n;
|
|
4939
4939
|
}
|
|
4940
|
-
await new Promise((n) => setTimeout(n,
|
|
4940
|
+
await new Promise((n) => setTimeout(n, jn * 2 ** t));
|
|
4941
4941
|
}
|
|
4942
4942
|
throw new Error("Unexpected: retry loop exited without result");
|
|
4943
4943
|
}
|
|
@@ -4945,7 +4945,7 @@ class jn {
|
|
|
4945
4945
|
async _doRequest(e) {
|
|
4946
4946
|
const s = new AbortController(), t = setTimeout(
|
|
4947
4947
|
() => s.abort(),
|
|
4948
|
-
e.timeoutMs ??
|
|
4948
|
+
e.timeoutMs ?? zn
|
|
4949
4949
|
);
|
|
4950
4950
|
try {
|
|
4951
4951
|
const n = await fetch(e.url, {
|
|
@@ -4972,7 +4972,7 @@ class jn {
|
|
|
4972
4972
|
}
|
|
4973
4973
|
}
|
|
4974
4974
|
}
|
|
4975
|
-
const
|
|
4975
|
+
const Xn = /* @__PURE__ */ new Set([
|
|
4976
4976
|
"https://cross-wallet-oauth.crosstoken.io",
|
|
4977
4977
|
"https://stg-cross-wallet-oauth.crosstoken.io",
|
|
4978
4978
|
"https://dev-cross-wallet-oauth.crosstoken.io"
|
|
@@ -5057,26 +5057,26 @@ class Ee {
|
|
|
5057
5057
|
}
|
|
5058
5058
|
const _ = setTimeout(() => {
|
|
5059
5059
|
d.warn("[CROSSx] OAuth 타임아웃 (5분) — postMessage를 수신하지 못했습니다"), D(), t(new Error("Authentication timeout"));
|
|
5060
|
-
}, 5 * 60 * 1e3), p = 10,
|
|
5061
|
-
let
|
|
5060
|
+
}, 5 * 60 * 1e3), p = 10, v = 30;
|
|
5061
|
+
let S = 0, I = null;
|
|
5062
5062
|
const T = () => {
|
|
5063
|
-
clearInterval(
|
|
5063
|
+
clearInterval(B), d.warn("[CROSSx] COOP 감지 — OAuth 서버 응답을 " + v + "초간 대기합니다"), I = setTimeout(() => {
|
|
5064
5064
|
D(), t(new Error(
|
|
5065
5065
|
"OAuth 서버로부터 응답을 받지 못했습니다. 브라우저 보안 정책(COOP)으로 인해 팝업 통신이 차단되었을 수 있습니다. 다시 시도해 주세요."
|
|
5066
5066
|
));
|
|
5067
|
-
},
|
|
5068
|
-
},
|
|
5069
|
-
|
|
5067
|
+
}, v * 1e3);
|
|
5068
|
+
}, B = setInterval(() => {
|
|
5069
|
+
S++;
|
|
5070
5070
|
try {
|
|
5071
|
-
x.closed && (
|
|
5071
|
+
x.closed && (S <= p ? T() : (D(), t(new Error("로그인이 취소되었습니다"))));
|
|
5072
5072
|
} catch {
|
|
5073
5073
|
T();
|
|
5074
5074
|
}
|
|
5075
5075
|
}, 1e3), D = () => {
|
|
5076
|
-
clearTimeout(_), clearInterval(
|
|
5076
|
+
clearTimeout(_), clearInterval(B), I && clearTimeout(I), window.removeEventListener("message", K);
|
|
5077
5077
|
}, K = (q) => {
|
|
5078
5078
|
if (q.origin !== e.expectedOrigin) return;
|
|
5079
|
-
if (!
|
|
5079
|
+
if (!Xn.has(q.origin)) {
|
|
5080
5080
|
d.error("[CROSSx] postMessage origin이 허용 목록에 없음:", q.origin), D(), t(new Error("Unauthorized OAuth origin"));
|
|
5081
5081
|
return;
|
|
5082
5082
|
}
|
|
@@ -5099,21 +5099,21 @@ class Ee {
|
|
|
5099
5099
|
d.error("[CROSSx] OAuth 실패:", W.error), t(new Error(W.error || "Authentication failed"));
|
|
5100
5100
|
return;
|
|
5101
5101
|
}
|
|
5102
|
-
const Q = W == null ? void 0 : W.idToken,
|
|
5102
|
+
const Q = W == null ? void 0 : W.idToken, H = W == null ? void 0 : W.accessToken, N = H ?? Q, $ = (W == null ? void 0 : W.email) || void 0;
|
|
5103
5103
|
if (d.log("[CROSSx] OAuth 토큰 수신:", {
|
|
5104
|
-
hasAccessToken: !!
|
|
5104
|
+
hasAccessToken: !!H,
|
|
5105
5105
|
hasIdToken: !!Q,
|
|
5106
|
-
hasEmail:
|
|
5106
|
+
hasEmail: !!$
|
|
5107
5107
|
}), !N) {
|
|
5108
5108
|
d.error("[CROSSx] 토큰을 찾을 수 없음:", q.data), t(new Error("Token not found in response"));
|
|
5109
5109
|
return;
|
|
5110
5110
|
}
|
|
5111
|
-
const m = { token: N, email:
|
|
5111
|
+
const m = { token: N, email: $ }, w = (k) => {
|
|
5112
5112
|
Ee.verifyIdTokenNonce(k, l).then(() => s(m)).catch((O) => {
|
|
5113
5113
|
d.error("[CROSSx] nonce 검증 실패:", O), t(O instanceof Error ? O : new Error("nonce verification failed"));
|
|
5114
5114
|
});
|
|
5115
5115
|
};
|
|
5116
|
-
|
|
5116
|
+
H ? H.split(".").length === 3 ? w(H) : Q ? w(Q) : (d.warn(
|
|
5117
5117
|
"[CROSSx] opaque accessToken만 수신 (idToken 없음) — nonce 검증 불가.",
|
|
5118
5118
|
"서버 측 nonce 검증이 필요합니다."
|
|
5119
5119
|
), s(m)) : Q ? w(Q) : t(new Error("Token not found in response"));
|
|
@@ -5123,7 +5123,7 @@ class Ee {
|
|
|
5123
5123
|
}
|
|
5124
5124
|
}
|
|
5125
5125
|
const Be = "crossx_wallet_data", Re = "crossx_mock_pin_hash";
|
|
5126
|
-
class
|
|
5126
|
+
class Jn {
|
|
5127
5127
|
constructor(e, s) {
|
|
5128
5128
|
this.storage = e, this.pinStore = s ?? null;
|
|
5129
5129
|
}
|
|
@@ -5345,19 +5345,20 @@ class Ae {
|
|
|
5345
5345
|
url: o,
|
|
5346
5346
|
method: e
|
|
5347
5347
|
});
|
|
5348
|
-
const
|
|
5349
|
-
if (
|
|
5348
|
+
const v = Ae.mapGatewayError(_.code, _.data);
|
|
5349
|
+
if (v === h.AUTH_NOT_AUTHENTICATED && !n && this._onTokenRefresh) {
|
|
5350
5350
|
if (d.warn("[CROSSx] Gateway -10002 감지 — 토큰 갱신 후 재시도"), await this.deduplicatedRefresh())
|
|
5351
5351
|
return this.request(e, s, t, !0);
|
|
5352
5352
|
throw new g(h.SESSION_EXPIRED, "인증 세션이 만료되었습니다. 다시 로그인해 주세요.");
|
|
5353
5353
|
}
|
|
5354
|
-
if (
|
|
5354
|
+
if (v === h.USER_NOT_FOUND)
|
|
5355
5355
|
throw d.warn("[CROSSx] Gateway -10033 감지 — 유저 미존재, 강제 로그아웃"), (c = this._onUnauthorized) == null || c.call(this), new g(
|
|
5356
5356
|
h.USER_NOT_FOUND,
|
|
5357
5357
|
Ae.getGatewayErrorMessage(_.code, p)
|
|
5358
5358
|
);
|
|
5359
|
-
const
|
|
5360
|
-
|
|
5359
|
+
const S = v === h.AUTH_NOT_AUTHENTICATED ? h.SESSION_EXPIRED : v, I = S === h.SESSION_EXPIRED ? "인증 세션이 만료되었습니다. 다시 로그인해 주세요." : Ae.getGatewayErrorMessage(_.code, p), T = _.data;
|
|
5360
|
+
let B;
|
|
5361
|
+
throw v === h.PIN_LOCKED ? B = Ae.extractLockDetails(T) : v === h.ADDRESS_LIMIT_EXCEEDED ? B = { limit: Ut, raw: T } : B = T ?? void 0, new g(S, I, B);
|
|
5361
5362
|
}
|
|
5362
5363
|
return d.log("[CROSSx] Wallet Gateway API 성공:", { code: _.code, url: o, method: e }), _.data ?? _;
|
|
5363
5364
|
}
|
|
@@ -5374,16 +5375,16 @@ class Ae {
|
|
|
5374
5375
|
);
|
|
5375
5376
|
}
|
|
5376
5377
|
if ((u = x.response) != null && u.data) {
|
|
5377
|
-
const p = x.response.data,
|
|
5378
|
+
const p = x.response.data, v = p.message || p.data || "API 요청에 실패했습니다", S = p.code || "UNKNOWN";
|
|
5378
5379
|
throw d.error("[CROSSx] Wallet Gateway API 에러 (HTTP 에러):", {
|
|
5379
|
-
code:
|
|
5380
|
-
message:
|
|
5380
|
+
code: S,
|
|
5381
|
+
message: v,
|
|
5381
5382
|
url: o,
|
|
5382
5383
|
method: e,
|
|
5383
5384
|
status: (f = x.response) == null ? void 0 : f.status
|
|
5384
5385
|
}), new g(
|
|
5385
5386
|
h.UNKNOWN_ERROR,
|
|
5386
|
-
`Wallet Gateway 오류 (${
|
|
5387
|
+
`Wallet Gateway 오류 (${S}): ${v}`
|
|
5387
5388
|
);
|
|
5388
5389
|
}
|
|
5389
5390
|
throw x;
|
|
@@ -5661,6 +5662,8 @@ class Ae {
|
|
|
5661
5662
|
return h.WITHDRAW_FAILED;
|
|
5662
5663
|
case -10033:
|
|
5663
5664
|
return h.USER_NOT_FOUND;
|
|
5665
|
+
case -10036:
|
|
5666
|
+
return h.ADDRESS_LIMIT_EXCEEDED;
|
|
5664
5667
|
case -10027:
|
|
5665
5668
|
return h.MIGRATION_PIN_LOCKED;
|
|
5666
5669
|
case -10022:
|
|
@@ -5742,6 +5745,8 @@ class Ae {
|
|
|
5742
5745
|
return "Repeated digit pattern is not allowed. Please choose a different PIN.";
|
|
5743
5746
|
case -10033:
|
|
5744
5747
|
return "User not found. You have been signed out.";
|
|
5748
|
+
case -10036:
|
|
5749
|
+
return `Account limit reached. Maximum ${Ut} accounts allowed.`;
|
|
5745
5750
|
case -10040:
|
|
5746
5751
|
return "HMAC signature header is required.";
|
|
5747
5752
|
case -10041:
|
|
@@ -5786,7 +5791,7 @@ class He {
|
|
|
5786
5791
|
}
|
|
5787
5792
|
isCacheValid() {
|
|
5788
5793
|
if (this.loadedAt === 0) return !1;
|
|
5789
|
-
const e = this.usingFallback ?
|
|
5794
|
+
const e = this.usingFallback ? mr : gr;
|
|
5790
5795
|
return e === 0 ? !0 : Date.now() - this.loadedAt < e;
|
|
5791
5796
|
}
|
|
5792
5797
|
populateCache(e, s) {
|
|
@@ -5848,7 +5853,7 @@ class He {
|
|
|
5848
5853
|
}
|
|
5849
5854
|
}
|
|
5850
5855
|
}
|
|
5851
|
-
const
|
|
5856
|
+
const rs = "__crossx-confirm-style", J = "__crossx-confirm-overlay", Zn = {
|
|
5852
5857
|
light: {
|
|
5853
5858
|
bg: "#FFFFFF",
|
|
5854
5859
|
border: "rgba(18,18,18,0.05)",
|
|
@@ -5904,8 +5909,8 @@ const ss = "__crossx-confirm-style", J = "__crossx-confirm-overlay", Jn = {
|
|
|
5904
5909
|
onPrimary: "#FFFFFF"
|
|
5905
5910
|
}
|
|
5906
5911
|
};
|
|
5907
|
-
function
|
|
5908
|
-
const s =
|
|
5912
|
+
function ns(r, e) {
|
|
5913
|
+
const s = Zn[r], t = e == null ? void 0 : e[r];
|
|
5909
5914
|
return t ? {
|
|
5910
5915
|
...s,
|
|
5911
5916
|
// ── Brand
|
|
@@ -5937,7 +5942,7 @@ function rs(r, e) {
|
|
|
5937
5942
|
...t.error !== void 0 && { errorColor: t.error }
|
|
5938
5943
|
} : s;
|
|
5939
5944
|
}
|
|
5940
|
-
const
|
|
5945
|
+
const Qn = `
|
|
5941
5946
|
@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;600&display=swap');
|
|
5942
5947
|
|
|
5943
5948
|
#${J} {
|
|
@@ -8013,10 +8018,10 @@ button.__crossx-connect-other-block:active {
|
|
|
8013
8018
|
}
|
|
8014
8019
|
`;
|
|
8015
8020
|
function ce() {
|
|
8016
|
-
let r = document.getElementById(
|
|
8017
|
-
r || (r = document.createElement("style"), r.id =
|
|
8021
|
+
let r = document.getElementById(rs);
|
|
8022
|
+
r || (r = document.createElement("style"), r.id = rs, document.head.appendChild(r)), r.textContent = Qn;
|
|
8018
8023
|
}
|
|
8019
|
-
function
|
|
8024
|
+
function ei() {
|
|
8020
8025
|
const r = `#${J}`, e = (t) => {
|
|
8021
8026
|
var n, i;
|
|
8022
8027
|
(i = (n = t.target) == null ? void 0 : n.closest) != null && i.call(n, r) && t.stopImmediatePropagation();
|
|
@@ -8056,14 +8061,14 @@ function le(r) {
|
|
|
8056
8061
|
}
|
|
8057
8062
|
i.preventDefault();
|
|
8058
8063
|
}, { passive: !1 });
|
|
8059
|
-
const t =
|
|
8064
|
+
const t = ei(), n = r.remove.bind(r);
|
|
8060
8065
|
r.remove = () => {
|
|
8061
8066
|
t(), n();
|
|
8062
8067
|
}, document.body.appendChild(r);
|
|
8063
8068
|
}
|
|
8064
|
-
const
|
|
8069
|
+
const ti = () => /iPad|iPhone|iPod/.test(navigator.userAgent) || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1;
|
|
8065
8070
|
function Oe() {
|
|
8066
|
-
if (
|
|
8071
|
+
if (ti()) {
|
|
8067
8072
|
const e = window.scrollY;
|
|
8068
8073
|
return document.body.style.position = "fixed", document.body.style.top = `-${e}px`, document.body.style.left = "0", document.body.style.right = "0", () => {
|
|
8069
8074
|
document.body.style.position = "", document.body.style.top = "", document.body.style.left = "", document.body.style.right = "", window.scrollTo(0, e);
|
|
@@ -8077,7 +8082,7 @@ function Oe() {
|
|
|
8077
8082
|
function se(r) {
|
|
8078
8083
|
return r ? r.length <= 13 ? r : `${r.slice(0, 6)}…${r.slice(-4)}` : "—";
|
|
8079
8084
|
}
|
|
8080
|
-
function
|
|
8085
|
+
function Fs(r, e = "CROSS", s = 18) {
|
|
8081
8086
|
if (!r || r === "0x" || r === "0x0") return null;
|
|
8082
8087
|
try {
|
|
8083
8088
|
const t = BigInt(r);
|
|
@@ -8088,7 +8093,7 @@ function Hs(r, e = "CROSS", s = 18) {
|
|
|
8088
8093
|
return null;
|
|
8089
8094
|
}
|
|
8090
8095
|
}
|
|
8091
|
-
const
|
|
8096
|
+
const is = {
|
|
8092
8097
|
1: "Ethereum Mainnet",
|
|
8093
8098
|
5: "Goerli Testnet",
|
|
8094
8099
|
11155111: "Ethereum Sepolia",
|
|
@@ -8111,9 +8116,9 @@ const ns = {
|
|
|
8111
8116
|
612044: "CROSS Testnet",
|
|
8112
8117
|
612055: "CROSS Mainnet"
|
|
8113
8118
|
};
|
|
8114
|
-
function
|
|
8119
|
+
function Ws(r) {
|
|
8115
8120
|
const e = parseInt(r.split(":")[1] ?? "", 10);
|
|
8116
|
-
return !isNaN(e) &&
|
|
8121
|
+
return !isNaN(e) && is[e] ? is[e] : r;
|
|
8117
8122
|
}
|
|
8118
8123
|
function mt(r, e) {
|
|
8119
8124
|
if (r === 0n) return "0";
|
|
@@ -8128,18 +8133,18 @@ function dt(r) {
|
|
|
8128
8133
|
return r;
|
|
8129
8134
|
}
|
|
8130
8135
|
}
|
|
8131
|
-
function
|
|
8136
|
+
function si(r) {
|
|
8132
8137
|
try {
|
|
8133
8138
|
return BigInt(r).toLocaleString();
|
|
8134
8139
|
} catch {
|
|
8135
8140
|
return r;
|
|
8136
8141
|
}
|
|
8137
8142
|
}
|
|
8138
|
-
function
|
|
8143
|
+
function ri(r) {
|
|
8139
8144
|
const { gasLimit: e, gasPrice: s, maxFeePerGas: t, maxPriorityFeePerGas: n, nativeSymbol: i = "ETH", nativeDecimals: o = 18 } = r;
|
|
8140
8145
|
if (!e) return null;
|
|
8141
8146
|
try {
|
|
8142
|
-
const a = BigInt(e), c =
|
|
8147
|
+
const a = BigInt(e), c = si(e);
|
|
8143
8148
|
if (t) {
|
|
8144
8149
|
const l = a * BigInt(t);
|
|
8145
8150
|
return {
|
|
@@ -8164,8 +8169,8 @@ function si(r) {
|
|
|
8164
8169
|
return null;
|
|
8165
8170
|
}
|
|
8166
8171
|
}
|
|
8167
|
-
function
|
|
8168
|
-
const e =
|
|
8172
|
+
function Gs(r) {
|
|
8173
|
+
const e = ri(r);
|
|
8169
8174
|
if (!e) return j("Estimated fee", "<span>—</span>");
|
|
8170
8175
|
let s = j("Est. Tx Fee", `<span>${e.estTxFee}</span>`);
|
|
8171
8176
|
return e.isDynamic ? (e.maxPriorityFeeGwei !== void 0 && (s += j("Max Priority Fee", `<span>${e.maxPriorityFeeGwei} Gwei</span>`)), e.maxFeeGwei !== void 0 && (s += j("Max Gas Fee", `<span>${e.maxFeeGwei} Gwei</span>`))) : e.gasPriceGwei !== void 0 && (s += j("Gas Price", `<span>${e.gasPriceGwei} Gwei</span>`)), e.gasLimitFormatted && (s += j("Gas Limit", `<span>${e.gasLimitFormatted}</span>`)), s;
|
|
@@ -8176,16 +8181,16 @@ const ge = `<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="
|
|
|
8176
8181
|
</svg>`, ne = `<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round">
|
|
8177
8182
|
<line x1="18" y1="6" x2="6" y2="18"/>
|
|
8178
8183
|
<line x1="6" y1="6" x2="18" y2="18"/>
|
|
8179
|
-
</svg>`,
|
|
8184
|
+
</svg>`, ni = `<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
8180
8185
|
<circle cx="20" cy="20" r="20" fill="#00D5AA"/>
|
|
8181
8186
|
<path fill-rule="evenodd" clip-rule="evenodd" d="M20.3225 2.85742L23.7249 6.25982V11.8301L28.1175 7.43757L32.9292 12.2493L28.5806 16.5979H20.3225C18.4435 16.5979 16.9201 18.1212 16.9201 20.0003C16.9201 21.8794 18.4434 23.4027 20.3225 23.4027H28.5372L32.9293 27.7948L28.1176 32.6066L23.7249 28.2139V33.7407L20.3225 37.1431L16.9201 33.7407V28.2584L12.5719 32.6066L7.76022 27.7948L12.1524 23.4027H6.58209L3.17969 20.0003L6.58209 16.5979H12.1089L7.76035 12.2493L12.5721 7.43757L16.9201 11.7857V6.25982L20.3225 2.85742Z" fill="#121212"/>
|
|
8182
|
-
</svg>`,
|
|
8183
|
-
[Ue.MetaMask]:
|
|
8184
|
-
[Ue.Binance]:
|
|
8185
|
-
[Ue.CROSSx]:
|
|
8186
|
-
},
|
|
8187
|
+
</svg>`, ii = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 318.6 318.6" aria-hidden="true"><style>.st1,.st6{fill:#e4761b;stroke:#e4761b;stroke-linecap:round;stroke-linejoin:round}.st6{fill:#f6851b;stroke:#f6851b}</style><path fill="#e2761b" stroke="#e2761b" stroke-linecap="round" stroke-linejoin="round" d="m274.1 35.5-99.5 73.9L193 65.8z"/><path d="m44.4 35.5 98.7 74.6-17.5-44.3zm193.9 171.3-26.5 40.6 56.7 15.6 16.3-55.3zm-204.4.9L50.1 263l56.7-15.6-26.5-40.6z" class="st1"/><path d="m103.6 138.2-15.8 23.9 56.3 2.5-2-60.5zm111.3 0-39-34.8-1.3 61.2 56.2-2.5zM106.8 247.4l33.8-16.5-29.2-22.8zm71.1-16.5 33.9 16.5-4.7-39.3z" class="st1"/><path fill="#d7c1b3" stroke="#d7c1b3" stroke-linecap="round" stroke-linejoin="round" d="m211.8 247.4-33.9-16.5 2.7 22.1-.3 9.3zm-105 0 31.5 14.9-.2-9.3 2.5-22.1z"/><path fill="#233447" stroke="#233447" stroke-linecap="round" stroke-linejoin="round" d="m138.8 193.5-28.2-8.3 19.9-9.1zm40.9 0 8.3-17.4 20 9.1z"/><path fill="#cd6116" stroke="#cd6116" stroke-linecap="round" stroke-linejoin="round" d="m106.8 247.4 4.8-40.6-31.3.9zM207 206.8l4.8 40.6 26.5-39.7zm23.8-44.7-56.2 2.5 5.2 28.9 8.3-17.4 20 9.1zm-120.2 23.1 20-9.1 8.2 17.4 5.3-28.9-56.3-2.5z"/><path fill="#e4751f" stroke="#e4751f" stroke-linecap="round" stroke-linejoin="round" d="m87.8 162.1 23.6 46-.8-22.9zm120.3 23.1-1 22.9 23.7-46zm-64-20.6-5.3 28.9 6.6 34.1 1.5-44.9zm30.5 0-2.7 18 1.2 45 6.7-34.1z"/><path d="m179.8 193.5-6.7 34.1 4.8 3.3 29.2-22.8 1-22.9zm-69.2-8.3.8 22.9 29.2 22.8 4.8-3.3-6.6-34.1z" class="st6"/><path fill="#c0ad9e" stroke="#c0ad9e" stroke-linecap="round" stroke-linejoin="round" d="m180.3 262.3.3-9.3-2.5-2.2h-37.7l-2.3 2.2.2 9.3-31.5-14.9 11 9 22.3 15.5h38.3l22.4-15.5 11-9z"/><path fill="#161616" stroke="#161616" stroke-linecap="round" stroke-linejoin="round" d="m177.9 230.9-4.8-3.3h-27.7l-4.8 3.3-2.5 22.1 2.3-2.2h37.7l2.5 2.2z"/><path fill="#763d16" stroke="#763d16" stroke-linecap="round" stroke-linejoin="round" d="m278.3 114.2 8.5-40.8-12.7-37.9-96.2 71.4 37 31.3 52.3 15.3 11.6-13.5-5-3.6 8-7.3-6.2-4.8 8-6.1zM31.8 73.4l8.5 40.8-5.4 4 8 6.1-6.1 4.8 8 7.3-5 3.6 11.5 13.5 52.3-15.3 37-31.3-96.2-71.4z"/><path d="m267.2 153.5-52.3-15.3 15.9 23.9-23.7 46 31.2-.4h46.5zm-163.6-15.3-52.3 15.3-17.4 54.2h46.4l31.1.4-23.6-46zm71 26.4 3.3-57.7 15.2-41.1h-67.5l15 41.1 3.5 57.7 1.2 18.2.1 44.8h27.7l.2-44.8z" class="st6"/></svg>', oi = '<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 126.611 126.611" aria-hidden="true"><polygon fill="#F3BA2F" points="38.171,53.203 62.759,28.616 87.36,53.216 101.667,38.909 62.759,0 23.864,38.896 "/><rect x="3.644" y="53.188" transform="matrix(0.7071 0.7071 -0.7071 0.7071 48.7933 8.8106)" fill="#F3BA2F" width="20.233" height="20.234"/><polygon fill="#F3BA2F" points="38.171,73.408 62.759,97.995 87.359,73.396 101.674,87.695 101.667,87.703 62.759,126.611 23.863,87.716 23.843,87.696 "/><rect x="101.64" y="53.189" transform="matrix(-0.7071 0.7071 -0.7071 -0.7071 235.5457 29.0503)" fill="#F3BA2F" width="20.234" height="20.233"/><polygon fill="#F3BA2F" points="77.271,63.298 77.277,63.298 62.759,48.78 52.03,59.509 52.029,59.509 50.797,60.742 48.254,63.285 48.254,63.285 48.234,63.305 48.254,63.326 62.759,77.831 77.277,63.313 77.284,63.305 "/></svg>', ai = '<svg width="16" height="16" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><circle cx="20" cy="20" r="20" fill="#00D5AA"/><path fill-rule="evenodd" clip-rule="evenodd" d="M20.3225 2.85742L23.7249 6.25982V11.8301L28.1175 7.43757L32.9292 12.2493L28.5806 16.5979H20.3225C18.4435 16.5979 16.9201 18.1212 16.9201 20.0003C16.9201 21.8794 18.4434 23.4027 20.3225 23.4027H28.5372L32.9293 27.7948L28.1176 32.6066L23.7249 28.2139V33.7407L20.3225 37.1431L16.9201 33.7407V28.2584L12.5719 32.6066L7.76022 27.7948L12.1524 23.4027H6.58209L3.17969 20.0003L6.58209 16.5979H12.1089L7.76035 12.2493L12.5721 7.43757L16.9201 11.7857V6.25982L20.3225 2.85742Z" fill="#121212"/></svg>', ci = {
|
|
8188
|
+
[Ue.MetaMask]: ii,
|
|
8189
|
+
[Ue.Binance]: oi,
|
|
8190
|
+
[Ue.CROSSx]: ai
|
|
8191
|
+
}, qs = '<path d="M22.6667 11.8333V10.1667C22.6667 9.2475 21.9192 8.5 21.0001 8.5H10.1667C8.78841 8.5 7.66675 9.62167 7.66675 11V21C7.66675 22.8342 9.16175 23.5 10.1667 23.5H22.6667C23.5859 23.5 24.3334 22.7525 24.3334 21.8333V13.5C24.3334 12.5808 23.5859 11.8333 22.6667 11.8333ZM21.0001 19.3333H19.3334V16H21.0001V19.3333ZM10.1667 11.8333C9.95218 11.8237 9.74959 11.7317 9.60114 11.5765C9.4527 11.4213 9.36986 11.2148 9.36986 11C9.36986 10.7852 9.4527 10.5787 9.60114 10.4235C9.74959 10.2683 9.95218 10.1763 10.1667 10.1667H21.0001V11.8333H10.1667Z"/>', kt = `<svg width="20" height="20" viewBox="0 0 32 32" fill="currentColor" xmlns="http://www.w3.org/2000/svg">${qs}</svg>`, li = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none">
|
|
8187
8192
|
<path d="M12 0C18.6274 0 24 5.37258 24 12C23.9999 18.6273 18.6274 24 12 24C5.37264 24 9.89594e-05 18.6273 0 12C0 5.37258 5.37258 0 12 0ZM10.875 15.127V17.377H13.125V15.127H10.875ZM10.875 6.62207V13.627H13.125V6.62207H10.875Z" fill="var(--cx-error)"/>
|
|
8188
|
-
</svg>`,
|
|
8193
|
+
</svg>`, di = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none">
|
|
8189
8194
|
<circle cx="12" cy="12" r="12" fill="var(--cx-error)"/>
|
|
8190
8195
|
<circle cx="12" cy="12" r="5.5" stroke="white" stroke-width="1.5"/>
|
|
8191
8196
|
<path d="M12 9.5v3l2 1.5" stroke="white" stroke-width="1.5" stroke-linecap="round"/>
|
|
@@ -8223,9 +8228,9 @@ function j(r, e) {
|
|
|
8223
8228
|
<div class="__crossx-row-value">${e}</div>
|
|
8224
8229
|
</div>`;
|
|
8225
8230
|
}
|
|
8226
|
-
function
|
|
8231
|
+
function ui(r, e) {
|
|
8227
8232
|
const s = e, t = r.nativeSymbol ?? "ETH", n = r.nativeDecimals ?? 18, i = tt(r.dappName), o = r.to ? `<span class="__crossx-addr-text">${se(r.to)}</span>
|
|
8228
|
-
<button class="__crossx-copy-btn" data-copy="${C(r.to)}" title="Copy address">${ge}</button>` : "<span>—</span>", a =
|
|
8233
|
+
<button class="__crossx-copy-btn" data-copy="${C(r.to)}" title="Copy address">${ge}</button>` : "<span>—</span>", a = Gs(r), c = Fs(r.value, t, n), l = c ? j("Value", `<span>${c}</span>`) : "", u = r.data ?? "0x", f = document.createElement("div");
|
|
8229
8234
|
return f.id = J, f.innerHTML = `
|
|
8230
8235
|
<div class="__crossx-card __crossx-card--migration __crossx-card--sign-tx" style="${oe(s)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
8231
8236
|
<div class="__crossx-header">
|
|
@@ -8249,7 +8254,7 @@ function di(r, e) {
|
|
|
8249
8254
|
<div class="__crossx-col-right-sign">
|
|
8250
8255
|
<div class="__crossx-rows">
|
|
8251
8256
|
${j("To", o)}
|
|
8252
|
-
${j("Network", `<span>${
|
|
8257
|
+
${j("Network", `<span>${Ws(r.chainId)}</span>`)}
|
|
8253
8258
|
${l}
|
|
8254
8259
|
${a}
|
|
8255
8260
|
</div>
|
|
@@ -8264,9 +8269,9 @@ function di(r, e) {
|
|
|
8264
8269
|
</div>
|
|
8265
8270
|
`, f;
|
|
8266
8271
|
}
|
|
8267
|
-
function
|
|
8272
|
+
function hi(r, e) {
|
|
8268
8273
|
const s = e, t = r.nativeSymbol ?? "ETH", n = r.nativeDecimals ?? 18, i = tt(r.dappName), o = r.to ? `<span class="__crossx-addr-text">${se(r.to)}</span>
|
|
8269
|
-
<button class="__crossx-copy-btn" data-copy="${C(r.to)}" title="Copy address">${ge}</button>` : "<span>—</span>", a =
|
|
8274
|
+
<button class="__crossx-copy-btn" data-copy="${C(r.to)}" title="Copy address">${ge}</button>` : "<span>—</span>", a = Gs(r), l = Fs(r.value, t, n) ?? "—", u = document.createElement("div");
|
|
8270
8275
|
return u.id = J, u.innerHTML = `
|
|
8271
8276
|
<div class="__crossx-card __crossx-card--migration __crossx-card--send-tx" style="${oe(s)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
8272
8277
|
<div class="__crossx-header">
|
|
@@ -8281,7 +8286,7 @@ function ui(r, e) {
|
|
|
8281
8286
|
<div class="__crossx-body-cols">
|
|
8282
8287
|
<div class="__crossx-rows">
|
|
8283
8288
|
${j("To", o)}
|
|
8284
|
-
${j("Network", `<span>${
|
|
8289
|
+
${j("Network", `<span>${Ws(r.chainId)}</span>`)}
|
|
8285
8290
|
${a}
|
|
8286
8291
|
</div>
|
|
8287
8292
|
<div class="__crossx-pill">
|
|
@@ -8306,10 +8311,10 @@ function tt(r) {
|
|
|
8306
8311
|
function C(r) {
|
|
8307
8312
|
return r.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
8308
8313
|
}
|
|
8309
|
-
function
|
|
8314
|
+
function pi(r) {
|
|
8310
8315
|
return typeof r == "string" && /^0x[0-9a-fA-F]{40}$/i.test(r);
|
|
8311
8316
|
}
|
|
8312
|
-
function
|
|
8317
|
+
function fi(r) {
|
|
8313
8318
|
if (typeof r == "string") return C(r);
|
|
8314
8319
|
if (typeof r == "number" || typeof r == "bigint" || typeof r == "boolean") return String(r);
|
|
8315
8320
|
try {
|
|
@@ -8318,7 +8323,7 @@ function pi(r) {
|
|
|
8318
8323
|
return String(r);
|
|
8319
8324
|
}
|
|
8320
8325
|
}
|
|
8321
|
-
function
|
|
8326
|
+
function _i(r, e) {
|
|
8322
8327
|
const s = j(
|
|
8323
8328
|
"From",
|
|
8324
8329
|
`<span class="__crossx-addr-text">${se(r.from)}</span>
|
|
@@ -8350,7 +8355,7 @@ function fi(r, e) {
|
|
|
8350
8355
|
</div>
|
|
8351
8356
|
`, c;
|
|
8352
8357
|
}
|
|
8353
|
-
function
|
|
8358
|
+
function xi(r, e) {
|
|
8354
8359
|
const s = document.createElement("div");
|
|
8355
8360
|
return s.id = J, s.innerHTML = `
|
|
8356
8361
|
<div class="__crossx-card __crossx-card--migration" style="${oe(e)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
@@ -8367,11 +8372,11 @@ function _i(r, e) {
|
|
|
8367
8372
|
</div>
|
|
8368
8373
|
`, s;
|
|
8369
8374
|
}
|
|
8370
|
-
function
|
|
8375
|
+
function gi(r, e, s) {
|
|
8371
8376
|
const t = e.status !== "reverted" && e.status !== "timeout", n = e.status === "timeout", i = r.querySelector("#__crossx-ttl"), o = r.querySelector(".__crossx-header");
|
|
8372
8377
|
if (i) {
|
|
8373
|
-
const p = n ?
|
|
8374
|
-
p ? (i.style.display = "flex", i.style.alignItems = "center", i.style.gap = "8px", i.innerHTML = `${p}<span>${
|
|
8378
|
+
const p = n ? di : t ? "" : li, v = n ? "Transaction timeout" : t ? "Transaction complete" : "Transaction failed";
|
|
8379
|
+
p ? (i.style.display = "flex", i.style.alignItems = "center", i.style.gap = "8px", i.innerHTML = `${p}<span>${v}</span>`) : i.textContent = v;
|
|
8375
8380
|
}
|
|
8376
8381
|
if (o && !r.querySelector("#__crossx-close-btn")) {
|
|
8377
8382
|
const p = document.createElement("button");
|
|
@@ -8397,16 +8402,16 @@ function xi(r, e, s) {
|
|
|
8397
8402
|
${_}
|
|
8398
8403
|
<button class="__crossx-approve-btn" id="__crossx-done-btn">${t ? "All Done" : "Done"}</button>
|
|
8399
8404
|
`, a.querySelectorAll(".__crossx-copy-btn").forEach((p) => {
|
|
8400
|
-
p.addEventListener("click", (
|
|
8405
|
+
p.addEventListener("click", (v) => {
|
|
8401
8406
|
var I;
|
|
8402
|
-
|
|
8403
|
-
const
|
|
8404
|
-
|
|
8407
|
+
v.stopPropagation();
|
|
8408
|
+
const S = p.dataset.copy;
|
|
8409
|
+
S && ((I = navigator.clipboard) == null || I.writeText(S).catch(() => {
|
|
8405
8410
|
}));
|
|
8406
8411
|
});
|
|
8407
8412
|
});
|
|
8408
8413
|
}
|
|
8409
|
-
function
|
|
8414
|
+
function mi(r, e) {
|
|
8410
8415
|
const s = e, t = tt(r.dappName), n = C(r.message), i = document.createElement("div");
|
|
8411
8416
|
return i.id = J, i.innerHTML = `
|
|
8412
8417
|
<div class="__crossx-card __crossx-card--migration __crossx-card--sign-msg" style="${oe(s)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
@@ -8438,7 +8443,7 @@ function gi(r, e) {
|
|
|
8438
8443
|
</div>
|
|
8439
8444
|
`, i;
|
|
8440
8445
|
}
|
|
8441
|
-
function
|
|
8446
|
+
function wi(r, e) {
|
|
8442
8447
|
const s = e, t = tt(r.dappName);
|
|
8443
8448
|
let n = {};
|
|
8444
8449
|
if (typeof r.typedData == "string")
|
|
@@ -8454,7 +8459,7 @@ function mi(r, e) {
|
|
|
8454
8459
|
<span class="__crossx-td-value">${C(i)}</span>
|
|
8455
8460
|
</div>`;
|
|
8456
8461
|
for (const [l, u] of Object.entries(o)) {
|
|
8457
|
-
const f =
|
|
8462
|
+
const f = fi(u), _ = pi(u) ? `<span class="__crossx-addr-text">${se(u)}</span>
|
|
8458
8463
|
<button class="__crossx-copy-btn" data-copy="${C(String(u))}" title="Copy">${ge}</button>` : `<span>${f}</span>`;
|
|
8459
8464
|
a += `
|
|
8460
8465
|
<div class="__crossx-td-row">
|
|
@@ -8493,29 +8498,29 @@ function mi(r, e) {
|
|
|
8493
8498
|
</div>
|
|
8494
8499
|
`, c;
|
|
8495
8500
|
}
|
|
8496
|
-
const
|
|
8501
|
+
const yi = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round">
|
|
8497
8502
|
<line x1="12" y1="5" x2="12" y2="19"/>
|
|
8498
8503
|
<line x1="5" y1="12" x2="19" y2="12"/>
|
|
8499
|
-
</svg>`,
|
|
8500
|
-
function
|
|
8504
|
+
</svg>`, bi = '<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg"><circle cx="12" cy="12" r="12" fill="var(--cx-primary, #019d92)"/><path d="M7.5 12.5L10.5 15.5L16.5 8.5" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/></svg>';
|
|
8505
|
+
function Ks(r) {
|
|
8501
8506
|
return r.name || `Account ${r.index + 1}`;
|
|
8502
8507
|
}
|
|
8503
|
-
function
|
|
8504
|
-
return `<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><rect width="32" height="32" rx="16" fill="#121212" fill-opacity="0.1"/><g fill="#121212" fill-opacity="0.5">${
|
|
8508
|
+
function Si() {
|
|
8509
|
+
return `<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><rect width="32" height="32" rx="16" fill="#121212" fill-opacity="0.1"/><g fill="#121212" fill-opacity="0.5">${qs}</g></svg>`;
|
|
8505
8510
|
}
|
|
8506
|
-
const vi =
|
|
8507
|
-
function
|
|
8511
|
+
const vi = ls().portraitBaseUrl;
|
|
8512
|
+
function Ei(r, e) {
|
|
8508
8513
|
return e.replace("#", ""), `${vi}/portrait/evm/${r}.png?size=56`;
|
|
8509
8514
|
}
|
|
8510
|
-
function
|
|
8511
|
-
const t =
|
|
8515
|
+
function Vs(r, e, s) {
|
|
8516
|
+
const t = Ei(r, s), i = Si().replace(/"/g, """);
|
|
8512
8517
|
return `<span class="__crossx-wallet-avatar"><img class="__crossx-wallet-avatar-img" src="${t}" alt="" onerror="this.style.display='none';this.nextElementSibling.innerHTML='${i}';this.nextElementSibling.style.display='flex';"><span class="__crossx-wallet-avatar-fallback"></span></span>`;
|
|
8513
8518
|
}
|
|
8514
|
-
function
|
|
8519
|
+
function Ai(r, e, s) {
|
|
8515
8520
|
const t = s == null ? void 0 : s.toLowerCase(), n = r.map((o) => {
|
|
8516
|
-
const a = t && o.address.toLowerCase() === t, c = a ? " __crossx-wallet-item--selected" : "", l = a ? `<span class="__crossx-wallet-selected">Selected</span><span class="__crossx-wallet-check">${
|
|
8521
|
+
const a = t && o.address.toLowerCase() === t, c = a ? " __crossx-wallet-item--selected" : "", l = a ? `<span class="__crossx-wallet-selected">Selected</span><span class="__crossx-wallet-check">${bi}</span>` : "";
|
|
8517
8522
|
return `<button class="__crossx-wallet-item${c}" data-wallet-index="${o.index}" data-wallet-address="${C(o.address)}">
|
|
8518
|
-
${
|
|
8523
|
+
${Vs(o.address, o.index, e.bg)}<span class="__crossx-wallet-info"><span class="__crossx-wallet-idx">${C(Ks(o))}</span><span class="__crossx-wallet-addr">${se(o.address)}</span></span>${l}
|
|
8519
8524
|
</button>`;
|
|
8520
8525
|
}).join(""), i = document.createElement("div");
|
|
8521
8526
|
return i.id = J, i.innerHTML = `
|
|
@@ -8542,7 +8547,7 @@ function Ei(r, e, s) {
|
|
|
8542
8547
|
${n}
|
|
8543
8548
|
</div>
|
|
8544
8549
|
<button class="__crossx-wallet-add" id="__crossx-add-wallet-btn" type="button">
|
|
8545
|
-
<span class="__crossx-wallet-add-icon">${
|
|
8550
|
+
<span class="__crossx-wallet-add-icon">${yi}</span>
|
|
8546
8551
|
<span class="__crossx-wallet-add-label">add a wallet</span>
|
|
8547
8552
|
</button>
|
|
8548
8553
|
</div>
|
|
@@ -8551,22 +8556,22 @@ function Ei(r, e, s) {
|
|
|
8551
8556
|
</div>
|
|
8552
8557
|
`, i;
|
|
8553
8558
|
}
|
|
8554
|
-
const
|
|
8559
|
+
const Ii = `<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
8555
8560
|
<path d="M26.693 21.193c-.028-3.168 2.587-4.712 2.706-4.786-1.477-2.16-3.77-2.454-4.58-2.484-1.944-.197-3.804 1.148-4.793 1.148-.992 0-2.52-1.12-4.147-1.09-2.13.032-4.1 1.239-5.198 3.133-2.222 3.855-.569 9.562 1.593 12.69 1.061 1.535 2.318 3.258 3.975 3.196 1.6-.064 2.2-1.03 4.133-1.03 1.928 0 2.48 1.03 4.172.997 1.72-.03 2.806-1.56 3.862-3.1 1.211-1.779 1.713-3.495 1.74-3.583-.037-.017-3.427-1.316-3.463-5.09z" fill="currentColor"/>
|
|
8556
8561
|
<path d="M23.527 11.876c.877-1.065 1.471-2.545 1.31-4.024-1.266.053-2.807.845-3.718 1.907-.813.946-1.53 2.468-1.34 3.915 1.41.107 2.852-.716 3.748-1.798z" fill="currentColor"/>
|
|
8557
|
-
</svg>`,
|
|
8562
|
+
</svg>`, ki = `<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
8558
8563
|
<path d="M38.06 20.44c0-1.34-.12-2.63-.34-3.87H20.5v7.32h9.84c-.42 2.28-1.71 4.21-3.65 5.51v4.57h5.91c3.46-3.19 5.46-7.88 5.46-13.53z" fill="#4285F4"/>
|
|
8559
8564
|
<path d="M20.5 38.5c4.94 0 9.09-1.64 12.12-4.44l-5.91-4.57c-1.64 1.1-3.73 1.75-6.21 1.75-4.77 0-8.82-3.22-10.26-7.55H4.16v4.72A18.49 18.49 0 0 0 20.5 38.5z" fill="#34A853"/>
|
|
8560
8565
|
<path d="M10.24 23.69A11.16 11.16 0 0 1 9.66 20c0-1.28.22-2.52.58-3.69v-4.72H4.16A18.49 18.49 0 0 0 2 20c0 2.97.71 5.78 1.97 8.28l6.27-4.59z" fill="#FBBC05"/>
|
|
8561
8566
|
<path d="M20.5 8.76c2.69 0 5.1.92 7 2.73l5.24-5.24C29.58 3.36 25.43 1.5 20.5 1.5A18.49 18.49 0 0 0 4.16 11.59l6.08 4.72C11.68 11.98 15.73 8.76 20.5 8.76z" fill="#EA4335"/>
|
|
8562
8567
|
</svg>`;
|
|
8563
|
-
function ki(r) {
|
|
8564
|
-
const e = er(r);
|
|
8565
|
-
return `<span class="__crossx-connect-other-wallet-desc-part"><span class="__crossx-connect-other-wallet-icon" aria-hidden="true">${ai[r] ?? ""}</span><span class="__crossx-connect-other-wallet-name">${C(e)}</span></span>`;
|
|
8566
|
-
}
|
|
8567
8568
|
function Ti(r) {
|
|
8569
|
+
const e = tr(r);
|
|
8570
|
+
return `<span class="__crossx-connect-other-wallet-desc-part"><span class="__crossx-connect-other-wallet-icon" aria-hidden="true">${ci[r] ?? ""}</span><span class="__crossx-connect-other-wallet-name">${C(e)}</span></span>`;
|
|
8571
|
+
}
|
|
8572
|
+
function Ri(r) {
|
|
8568
8573
|
if (r.length === 0) return "";
|
|
8569
|
-
const e = (n) =>
|
|
8574
|
+
const e = (n) => Ti(r[n]), s = "Supported wallets include ";
|
|
8570
8575
|
if (r.length === 1)
|
|
8571
8576
|
return `${s}${e(0)}.`;
|
|
8572
8577
|
if (r.length === 2)
|
|
@@ -8576,7 +8581,7 @@ function Ti(r) {
|
|
|
8576
8581
|
const t = r.length - 3;
|
|
8577
8582
|
return `${s}${e(0)}, ${e(1)}, ${e(2)}, and ${t} more.`;
|
|
8578
8583
|
}
|
|
8579
|
-
function
|
|
8584
|
+
function Oi(r, e = []) {
|
|
8580
8585
|
const s = r, t = C(String(e[0])), n = e.length > 0 ? `
|
|
8581
8586
|
<div class="__crossx-login-or-divider">
|
|
8582
8587
|
<hr><span>or</span><hr>
|
|
@@ -8584,7 +8589,7 @@ function Ri(r, e = []) {
|
|
|
8584
8589
|
<button type="button" class="__crossx-connect-other-block" id="__crossx-connect-other-wallet-btn" data-wallet-id="${t}" aria-labelledby="__crossx-connect-other-heading">
|
|
8585
8590
|
<span class="__crossx-connect-other-text">
|
|
8586
8591
|
<span class="__crossx-connect-other-title" id="__crossx-connect-other-heading">Connect with Other Wallets</span>
|
|
8587
|
-
<span class="__crossx-connect-other-desc __crossx-connect-other-summary">${
|
|
8592
|
+
<span class="__crossx-connect-other-desc __crossx-connect-other-summary">${Ri(e)}</span>
|
|
8588
8593
|
</span>
|
|
8589
8594
|
</button>` : "", i = document.createElement("div");
|
|
8590
8595
|
return i.id = J, i.innerHTML = `
|
|
@@ -8600,11 +8605,11 @@ function Ri(r, e = []) {
|
|
|
8600
8605
|
<div class="__crossx-body">
|
|
8601
8606
|
<div class="__crossx-login-btn-row">
|
|
8602
8607
|
<button class="__crossx-login-btn" id="__crossx-apple-btn" type="button">
|
|
8603
|
-
<span class="__crossx-login-icon" style="color:var(--cx-value);">${
|
|
8608
|
+
<span class="__crossx-login-icon" style="color:var(--cx-value);">${Ii}</span>
|
|
8604
8609
|
<span class="__crossx-login-btn-label">Sign in with Apple</span>
|
|
8605
8610
|
</button>
|
|
8606
8611
|
<button class="__crossx-login-btn" id="__crossx-google-btn" type="button">
|
|
8607
|
-
<span class="__crossx-login-icon">${
|
|
8612
|
+
<span class="__crossx-login-icon">${ki}</span>
|
|
8608
8613
|
<span class="__crossx-login-btn-label">Sign in with Google</span>
|
|
8609
8614
|
</button>
|
|
8610
8615
|
</div>${n}
|
|
@@ -8615,7 +8620,7 @@ function Ri(r, e = []) {
|
|
|
8615
8620
|
</div>
|
|
8616
8621
|
`, i;
|
|
8617
8622
|
}
|
|
8618
|
-
function
|
|
8623
|
+
function Pi(r, e) {
|
|
8619
8624
|
const s = r, t = document.createElement("div");
|
|
8620
8625
|
t.id = J;
|
|
8621
8626
|
const n = C(e.message).replace(/\n/g, "<br>"), i = e.email ? `<div class="__crossx-session-account-card">
|
|
@@ -8643,7 +8648,7 @@ function Oi(r, e) {
|
|
|
8643
8648
|
</div>
|
|
8644
8649
|
`, t;
|
|
8645
8650
|
}
|
|
8646
|
-
function
|
|
8651
|
+
function Ci(r, e = !0) {
|
|
8647
8652
|
const s = r, t = e ? `<button class="__crossx-close" id="__crossx-close-btn" aria-label="Close">${ne}</button>` : "", n = e ? '<button class="__crossx-skip-btn" id="__crossx-skip-btn">Skip for Now</button>' : "", i = document.createElement("div");
|
|
8648
8653
|
return i.id = J, i.innerHTML = `
|
|
8649
8654
|
<div class="__crossx-card __crossx-card--migration" style="${oe(s)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
@@ -8659,7 +8664,7 @@ function Pi(r, e = !0) {
|
|
|
8659
8664
|
<p class="__crossx-mig-info-desc">It safely restores and integrates all your previous assets. Simply verify your PIN to get started.</p>
|
|
8660
8665
|
</div>
|
|
8661
8666
|
<button class="__crossx-recover-btn" id="__crossx-recover-btn">
|
|
8662
|
-
<span class="__crossx-recover-icon">${
|
|
8667
|
+
<span class="__crossx-recover-icon">${ni}</span>
|
|
8663
8668
|
<span class="__crossx-recover-label">Import from Social Backup</span>
|
|
8664
8669
|
</button>
|
|
8665
8670
|
${n}
|
|
@@ -8667,7 +8672,7 @@ function Pi(r, e = !0) {
|
|
|
8667
8672
|
</div>
|
|
8668
8673
|
`, i;
|
|
8669
8674
|
}
|
|
8670
|
-
function
|
|
8675
|
+
function Ni(r, e) {
|
|
8671
8676
|
const s = r, { errorMessage: t, attemptCount: n, maxAttempts: i = 5 } = e ?? {}, o = !!t, a = o ? " --error" : "", c = n != null && n > 0 ? `<p class="__crossx-pin-attempt">${n}/${i}</p>` : "", l = n != null && n >= 3 ? '<p class="__crossx-pin-warning">Your account will be locked after further failures.</p>' : "", u = o ? `<p class="__crossx-pin-error-text">${t}</p>` : "", f = document.createElement("div");
|
|
8672
8677
|
return f.id = J, f.innerHTML = `
|
|
8673
8678
|
<div class="__crossx-card __crossx-card--migration" style="${oe(s)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
@@ -8691,12 +8696,12 @@ function Ci(r, e) {
|
|
|
8691
8696
|
</div>
|
|
8692
8697
|
`, f;
|
|
8693
8698
|
}
|
|
8694
|
-
function
|
|
8699
|
+
function Li(r) {
|
|
8695
8700
|
const e = new Date(r), s = ["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], t = ["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], n = s[e.getDay()], i = t[e.getMonth()], o = e.getDate(), a = String(e.getHours()).padStart(2, "0"), c = String(e.getMinutes()).padStart(2, "0");
|
|
8696
8701
|
return `${n}, ${i} ${o} ${a}:${c}`;
|
|
8697
8702
|
}
|
|
8698
|
-
function
|
|
8699
|
-
const t = r, n = e <= 0, i = n ? null : Date.now() + e * 1e3, o = i ?
|
|
8703
|
+
function Di(r, e, s) {
|
|
8704
|
+
const t = r, n = e <= 0, i = n ? null : Date.now() + e * 1e3, o = i ? Li(i) : null, a = document.createElement("div");
|
|
8700
8705
|
return a.id = J, a.innerHTML = `
|
|
8701
8706
|
<div class="__crossx-card __crossx-card--migration" style="${oe(t)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
8702
8707
|
<div class="__crossx-header">
|
|
@@ -8726,10 +8731,10 @@ function Li(r, e, s) {
|
|
|
8726
8731
|
return () => clearInterval(f);
|
|
8727
8732
|
} };
|
|
8728
8733
|
}
|
|
8729
|
-
function
|
|
8734
|
+
function Mi(r) {
|
|
8730
8735
|
const s = [r.check1, r.check2].map((t, n) => `
|
|
8731
8736
|
<div class="__crossx-pw-notice-item" data-check-index="${n}" role="checkbox" aria-checked="false" tabindex="0">
|
|
8732
|
-
<div class="__crossx-pw-notice-check" id="__crossx-notice-check-${n}">${
|
|
8737
|
+
<div class="__crossx-pw-notice-check" id="__crossx-notice-check-${n}">${Hi}</div>
|
|
8733
8738
|
<span class="__crossx-pw-notice-item-text">${C(t)}</span>
|
|
8734
8739
|
</div>
|
|
8735
8740
|
`).join("");
|
|
@@ -8744,7 +8749,7 @@ function Di(r) {
|
|
|
8744
8749
|
<div class="__crossx-pw-fields __crossx-pw-fields--notice">
|
|
8745
8750
|
<div class="__crossx-pw-notice-header">
|
|
8746
8751
|
<div class="__crossx-pw-notice-title-row">
|
|
8747
|
-
<span class="__crossx-pw-notice-icon">${
|
|
8752
|
+
<span class="__crossx-pw-notice-icon">${Fi}</span>
|
|
8748
8753
|
<p class="__crossx-pw-notice-title">${C(r.noticeTitle)}</p>
|
|
8749
8754
|
</div>
|
|
8750
8755
|
<p class="__crossx-pw-notice-desc">${C(r.noticeDesc)}</p>
|
|
@@ -8764,14 +8769,14 @@ function Di(r) {
|
|
|
8764
8769
|
}
|
|
8765
8770
|
function ut(r) {
|
|
8766
8771
|
const e = !!r.lockExpiresAt && r.lockExpiresAt > Date.now(), s = r.lockExpiresAt ? ` data-lock-expires="${r.lockExpiresAt}"` : "", t = r.headerSubtitle ? `<p class="__crossx-pin6-header-sub">${C(r.headerSubtitle)}</p>` : "", n = r.subtitle ? `<p class="__crossx-pin6-subtitle">${C(r.subtitle)}</p>` : "", i = r.errorMessage ? `<p class="__crossx-pin6-error" id="__crossx-pin6-error">${C(r.errorMessage)}</p>` : '<p class="__crossx-pin6-error" id="__crossx-pin6-error"></p>', o = e ? `<p class="__crossx-pin6-lock-msg" id="__crossx-pin6-lock-msg">
|
|
8767
|
-
${
|
|
8772
|
+
${zs}
|
|
8768
8773
|
<span id="__crossx-pin6-lock-countdown"></span>
|
|
8769
8774
|
</p>` : "", a = r.warningMessage && r.attemptCount != null && r.attemptCount > 0 ? `<p class="__crossx-pin6-warning" id="__crossx-pin6-warning">${C(r.warningMessage)}</p>` : '<p class="__crossx-pin6-warning" id="__crossx-pin6-warning"></p>', c = r.attemptCount != null && r.attemptCount > 0 ? `<p class="__crossx-pin6-attempt" id="__crossx-pin6-attempt">${r.attemptCount}/${r.maxAttempts ?? "?"}</p>` : '<p class="__crossx-pin6-attempt" id="__crossx-pin6-attempt"></p>', l = e ? " --locked" : "", u = Array.from(
|
|
8770
8775
|
{ length: 6 },
|
|
8771
|
-
(
|
|
8776
|
+
(v, S) => `<input class="__crossx-pin6-box${l}" type="password" maxlength="1" inputmode="numeric" pattern="[0-9]" autocomplete="off" aria-label="PIN digit ${S + 1}"${e ? " disabled" : ""}>`
|
|
8772
8777
|
).join(""), f = e ? " --locked" : "", x = Array.from(
|
|
8773
8778
|
{ length: 6 },
|
|
8774
|
-
(
|
|
8779
|
+
(v, S) => `<div class="__crossx-pin6-dot${f}" data-dot-index="${S}" aria-label="PIN digit ${S + 1}"></div>`
|
|
8775
8780
|
).join(""), _ = e ? " --disabled" : "", p = `
|
|
8776
8781
|
<div class="__crossx-pin6-numpad" id="__crossx-pin6-numpad">
|
|
8777
8782
|
<div class="__crossx-pin6-numpad-row">
|
|
@@ -8792,7 +8797,7 @@ function ut(r) {
|
|
|
8792
8797
|
<div class="__crossx-pin6-numpad-row">
|
|
8793
8798
|
<button type="button" class="__crossx-pin6-numpad-key --empty" aria-hidden="true"></button>
|
|
8794
8799
|
<button type="button" class="__crossx-pin6-numpad-key${_}" data-key="0">0</button>
|
|
8795
|
-
<button type="button" class="__crossx-pin6-numpad-key --delete${_}" data-key="backspace" aria-label="Delete">${
|
|
8800
|
+
<button type="button" class="__crossx-pin6-numpad-key --delete${_}" data-key="backspace" aria-label="Delete">${Ui}</button>
|
|
8796
8801
|
</div>
|
|
8797
8802
|
</div>`;
|
|
8798
8803
|
return `
|
|
@@ -8818,7 +8823,7 @@ function ut(r) {
|
|
|
8818
8823
|
${p}
|
|
8819
8824
|
`;
|
|
8820
8825
|
}
|
|
8821
|
-
function
|
|
8826
|
+
function os(r, e) {
|
|
8822
8827
|
const s = document.createElement("div");
|
|
8823
8828
|
return s.id = J, s.innerHTML = `
|
|
8824
8829
|
<div class="__crossx-card __crossx-card--pin6" style="${oe(r)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
@@ -8833,16 +8838,16 @@ function $i(r, e) {
|
|
|
8833
8838
|
const s = r.split("").map(Number), t = s.every((i, o) => o === 0 || i === (s[o - 1] + 1) % 10), n = s.every((i, o) => o === 0 || i === (s[o - 1] + 9) % 10);
|
|
8834
8839
|
return t || n ? e.sequential : r[0] !== r[1] && r === r.slice(0, 2).repeat(3) ? e.alternatingPattern : null;
|
|
8835
8840
|
}
|
|
8836
|
-
function
|
|
8841
|
+
function Bi(r) {
|
|
8837
8842
|
const e = Math.max(0, Math.ceil(r / 1e3)), s = Math.floor(e / 3600), t = Math.floor(e % 3600 / 60), n = e % 60;
|
|
8838
8843
|
return s > 0 ? `${s}h ${String(t).padStart(2, "0")}m` : `${String(t).padStart(2, "0")}:${String(n).padStart(2, "0")}`;
|
|
8839
8844
|
}
|
|
8840
8845
|
function ht(r, e, s, t, n, i, o) {
|
|
8841
|
-
var O,
|
|
8846
|
+
var O, M;
|
|
8842
8847
|
let a = !!(i && i > Date.now()), c = !1;
|
|
8843
|
-
const l = () => Array.from(r.querySelectorAll(".__crossx-pin6-box")), u = () => r.querySelector("#__crossx-pin6-boxes"), f = () => r.querySelector("#__crossx-pin6-error"), x = () => r.querySelector("#__crossx-pin6-lock-msg"), _ = () => r.querySelector("#__crossx-pin6-lock-countdown"), p = () => r.querySelector(".__crossx-pin6-body"),
|
|
8848
|
+
const l = () => Array.from(r.querySelectorAll(".__crossx-pin6-box")), u = () => r.querySelector("#__crossx-pin6-boxes"), f = () => r.querySelector("#__crossx-pin6-error"), x = () => r.querySelector("#__crossx-pin6-lock-msg"), _ = () => r.querySelector("#__crossx-pin6-lock-countdown"), p = () => r.querySelector(".__crossx-pin6-body"), v = () => l().map((y) => y.value).join(""), S = () => Array.from(r.querySelectorAll(".__crossx-pin6-dot")), I = () => {
|
|
8844
8849
|
var E;
|
|
8845
|
-
const y = l(), b =
|
|
8850
|
+
const y = l(), b = S();
|
|
8846
8851
|
if (b.length && (b.forEach((A, R) => {
|
|
8847
8852
|
const F = !!(y[R] && y[R].value);
|
|
8848
8853
|
A.classList.toggle("--filled", F), A.classList.toggle("--active", !1);
|
|
@@ -8851,8 +8856,8 @@ function ht(r, e, s, t, n, i, o) {
|
|
|
8851
8856
|
(E = b[A === -1 ? 5 : A]) == null || E.classList.add("--active");
|
|
8852
8857
|
}
|
|
8853
8858
|
}, T = () => {
|
|
8854
|
-
r.querySelectorAll(".__crossx-pin6-numpad-key[data-key]").forEach((b) => b.classList.toggle("--disabled", a)),
|
|
8855
|
-
},
|
|
8859
|
+
r.querySelectorAll(".__crossx-pin6-numpad-key[data-key]").forEach((b) => b.classList.toggle("--disabled", a)), S().forEach((b) => b.classList.toggle("--locked", a)), I();
|
|
8860
|
+
}, B = (y) => {
|
|
8856
8861
|
a = y, l().forEach((b) => {
|
|
8857
8862
|
b.disabled = y, b.classList.toggle("--locked", y);
|
|
8858
8863
|
});
|
|
@@ -8880,7 +8885,7 @@ function ht(r, e, s, t, n, i, o) {
|
|
|
8880
8885
|
R ? R.insertAdjacentElement("afterend", E) : (A = p()) == null || A.appendChild(E);
|
|
8881
8886
|
}
|
|
8882
8887
|
E.textContent = `${y}/${b}`;
|
|
8883
|
-
},
|
|
8888
|
+
}, H = () => {
|
|
8884
8889
|
const y = D();
|
|
8885
8890
|
y && (y.textContent = "");
|
|
8886
8891
|
}, N = (y) => {
|
|
@@ -8893,25 +8898,25 @@ function ht(r, e, s, t, n, i, o) {
|
|
|
8893
8898
|
var A;
|
|
8894
8899
|
(A = l()[0]) == null || A.focus(), I();
|
|
8895
8900
|
}, 50);
|
|
8896
|
-
},
|
|
8901
|
+
}, $ = (y) => {
|
|
8897
8902
|
var F;
|
|
8898
|
-
|
|
8899
|
-
|
|
8903
|
+
B(!0), l().forEach((U) => {
|
|
8904
|
+
U.value = "";
|
|
8900
8905
|
}), T();
|
|
8901
8906
|
const b = f();
|
|
8902
8907
|
if (b && (b.textContent = "Too many failed attempts. Please wait."), !x()) {
|
|
8903
|
-
const
|
|
8904
|
-
|
|
8908
|
+
const U = document.createElement("p");
|
|
8909
|
+
U.className = "__crossx-pin6-lock-msg", U.id = "__crossx-pin6-lock-msg", U.innerHTML = `${zs}<span id="__crossx-pin6-lock-countdown"></span>`;
|
|
8905
8910
|
const L = f();
|
|
8906
|
-
L ? L.insertAdjacentElement("afterend",
|
|
8911
|
+
L ? L.insertAdjacentElement("afterend", U) : (F = p()) == null || F.appendChild(U);
|
|
8907
8912
|
}
|
|
8908
8913
|
const E = () => {
|
|
8909
8914
|
var G;
|
|
8910
|
-
const
|
|
8911
|
-
|
|
8915
|
+
const U = y - Date.now(), L = _();
|
|
8916
|
+
U <= 0 ? (clearInterval(A), B(!1), (G = x()) == null || G.remove(), b && (b.textContent = ""), T(), setTimeout(() => {
|
|
8912
8917
|
var Y;
|
|
8913
8918
|
return (Y = l()[0]) == null ? void 0 : Y.focus();
|
|
8914
|
-
}, 50)) : L && (L.textContent = ` ${
|
|
8919
|
+
}, 50)) : L && (L.textContent = ` ${Bi(U)}`);
|
|
8915
8920
|
}, A = setInterval(E, 1e3);
|
|
8916
8921
|
E();
|
|
8917
8922
|
const R = new MutationObserver(() => {
|
|
@@ -8920,7 +8925,7 @@ function ht(r, e, s, t, n, i, o) {
|
|
|
8920
8925
|
R.observe(document.body, { childList: !0, subtree: !1 });
|
|
8921
8926
|
}, m = async () => {
|
|
8922
8927
|
if (a || c) return;
|
|
8923
|
-
const y =
|
|
8928
|
+
const y = v();
|
|
8924
8929
|
if (y.length === 6) {
|
|
8925
8930
|
c = !0, l().forEach((b) => {
|
|
8926
8931
|
b.disabled = !0;
|
|
@@ -8928,7 +8933,7 @@ function ht(r, e, s, t, n, i, o) {
|
|
|
8928
8933
|
try {
|
|
8929
8934
|
if (n) {
|
|
8930
8935
|
const b = await n(y);
|
|
8931
|
-
b.ok ? e(y) : b.lockExpiresAt ? (
|
|
8936
|
+
b.ok ? e(y) : b.lockExpiresAt ? (H(), $(b.lockExpiresAt)) : (N(b.error ?? "Incorrect PIN. Please try again."), b.attemptCount != null && b.maxAttempts != null ? (W(q()), Q(b.attemptCount, b.maxAttempts)) : (X(), H()));
|
|
8932
8937
|
} else
|
|
8933
8938
|
e(y);
|
|
8934
8939
|
} catch (b) {
|
|
@@ -8940,7 +8945,7 @@ function ht(r, e, s, t, n, i, o) {
|
|
|
8940
8945
|
}
|
|
8941
8946
|
}
|
|
8942
8947
|
};
|
|
8943
|
-
i && i > Date.now() ?
|
|
8948
|
+
i && i > Date.now() ? $(i) : setTimeout(() => {
|
|
8944
8949
|
var y;
|
|
8945
8950
|
return (y = l()[0]) == null ? void 0 : y.focus();
|
|
8946
8951
|
}, 100);
|
|
@@ -8951,14 +8956,14 @@ function ht(r, e, s, t, n, i, o) {
|
|
|
8951
8956
|
};
|
|
8952
8957
|
(O = u()) == null || O.addEventListener("click", (y) => {
|
|
8953
8958
|
y.target.classList.contains("__crossx-pin6-box") || w();
|
|
8954
|
-
}), (
|
|
8959
|
+
}), (M = p()) == null || M.addEventListener("click", (y) => {
|
|
8955
8960
|
const b = y.target;
|
|
8956
8961
|
b.classList.contains("__crossx-pin6-box") || b.closest("button") || w();
|
|
8957
8962
|
}), l().forEach((y, b) => {
|
|
8958
8963
|
y.addEventListener("input", () => {
|
|
8959
8964
|
var A;
|
|
8960
8965
|
const E = y.value.replace(/\D/g, "").slice(-1);
|
|
8961
|
-
y.value = E, K(), E && b < 5 && ((A = l()[b + 1]) == null || A.focus()), I(),
|
|
8966
|
+
y.value = E, K(), E && b < 5 && ((A = l()[b + 1]) == null || A.focus()), I(), v().length === 6 && setTimeout(m, 80);
|
|
8962
8967
|
}), y.addEventListener("keydown", (E) => {
|
|
8963
8968
|
var A, R;
|
|
8964
8969
|
if (E.key === "Backspace") {
|
|
@@ -8971,14 +8976,14 @@ function ht(r, e, s, t, n, i, o) {
|
|
|
8971
8976
|
I();
|
|
8972
8977
|
} else E.key === "ArrowLeft" && b > 0 ? (E.preventDefault(), (A = l()[b - 1]) == null || A.focus()) : E.key === "ArrowRight" && b < 5 ? (E.preventDefault(), (R = l()[b + 1]) == null || R.focus()) : E.key === "Escape" && s();
|
|
8973
8978
|
}), y.addEventListener("paste", (E) => {
|
|
8974
|
-
var F,
|
|
8979
|
+
var F, U;
|
|
8975
8980
|
E.preventDefault();
|
|
8976
8981
|
const A = (((F = E.clipboardData) == null ? void 0 : F.getData("text")) ?? "").replace(/\D/g, "").slice(0, 6);
|
|
8977
8982
|
if (!A) return;
|
|
8978
8983
|
const R = l();
|
|
8979
8984
|
A.split("").forEach((L, G) => {
|
|
8980
8985
|
R[G] && (R[G].value = L);
|
|
8981
|
-
}), (
|
|
8986
|
+
}), (U = R[Math.min(A.length - 1, 5)]) == null || U.focus(), K(), I(), v().length === 6 && setTimeout(m, 80);
|
|
8982
8987
|
}), y.addEventListener("focus", () => y.select());
|
|
8983
8988
|
});
|
|
8984
8989
|
const k = r.querySelector("#__crossx-pin6-numpad");
|
|
@@ -9000,8 +9005,8 @@ function ht(r, e, s, t, n, i, o) {
|
|
|
9000
9005
|
return;
|
|
9001
9006
|
}
|
|
9002
9007
|
if (!/^\d$/.test(R)) return;
|
|
9003
|
-
const
|
|
9004
|
-
|
|
9008
|
+
const U = l().find((L) => !L.value);
|
|
9009
|
+
U && (U.value = R, K(), I(), v().length === 6 && setTimeout(m, 80));
|
|
9005
9010
|
};
|
|
9006
9011
|
k.addEventListener("pointerup", (A) => {
|
|
9007
9012
|
if (!y) return;
|
|
@@ -9012,18 +9017,18 @@ function ht(r, e, s, t, n, i, o) {
|
|
|
9012
9017
|
}), k.addEventListener("pointercancel", b), k.addEventListener("pointerleave", b, !0), I(), i && i > Date.now() && T();
|
|
9013
9018
|
}
|
|
9014
9019
|
}
|
|
9015
|
-
const
|
|
9020
|
+
const Ui = `<svg width="22" height="17" viewBox="0 0 22 17" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
9016
9021
|
<path d="M7.36 0.5H19.5C20.6046 0.5 21.5 1.39543 21.5 2.5V14.5C21.5 15.6046 20.6046 16.5 19.5 16.5H7.36C6.76 16.5 6.19 16.24 5.8 15.79L0.94 10.02C0.35 9.32 0.35 8.3 0.94 7.6L5.8 1.71C6.19 1.26 6.76 0.5 7.36 0.5Z" stroke="currentColor" stroke-width="1.2" fill="none"/>
|
|
9017
9022
|
<line x1="10" y1="5.5" x2="16" y2="11.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
|
|
9018
9023
|
<line x1="16" y1="5.5" x2="10" y2="11.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
|
|
9019
|
-
</svg>`,
|
|
9024
|
+
</svg>`, zs = `<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
9020
9025
|
<path d="M14.5 8.5H14V6.5C14 4.015 11.985 2 9.5 2C7.015 2 5 4.015 5 6.5V8.5H4.5C3.672 8.5 3 9.172 3 10V16.5C3 17.328 3.672 18 4.5 18H14.5C15.328 18 16 17.328 16 16.5V10C16 9.172 15.328 8.5 14.5 8.5ZM10.5 13.415V15C10.5 15.276 10.276 15.5 10 15.5H9C8.724 15.5 8.5 15.276 8.5 15V13.415C8.187 13.196 8 12.847 8 12.5C8 11.672 8.672 11 9.5 11C10.328 11 11 11.672 11 12.5C11 12.847 10.813 13.196 10.5 13.415ZM12.5 8.5H6.5V6.5C6.5 4.843 7.843 3.5 9.5 3.5C11.157 3.5 12.5 4.843 12.5 6.5V8.5Z" fill="currentColor"/>
|
|
9021
|
-
</svg>`,
|
|
9026
|
+
</svg>`, Hi = `<svg width="11" height="9" viewBox="0 0 11 9" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
9022
9027
|
<path d="M1 4.5L4 7.5L10 1" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
9023
|
-
</svg>`,
|
|
9028
|
+
</svg>`, Fi = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
9024
9029
|
<path d="M12 0C18.6274 0 24 5.37258 24 12C23.9999 18.6273 18.6274 24 12 24C5.37264 24 9.89594e-05 18.6273 0 12C0 5.37258 5.37258 0 12 0ZM10.875 15.127V17.377H13.125V15.127H10.875ZM10.875 6.62207V13.627H13.125V6.62207H10.875Z" fill="currentColor"/>
|
|
9025
9030
|
</svg>`;
|
|
9026
|
-
function
|
|
9031
|
+
function Wi(r, e, s) {
|
|
9027
9032
|
var i;
|
|
9028
9033
|
const t = r.querySelectorAll(".__crossx-pin-input");
|
|
9029
9034
|
t.forEach((o, a) => {
|
|
@@ -9056,12 +9061,12 @@ function Fi(r, e, s) {
|
|
|
9056
9061
|
}
|
|
9057
9062
|
}), (i = t[0]) == null || i.focus();
|
|
9058
9063
|
}
|
|
9059
|
-
class
|
|
9064
|
+
class Gi {
|
|
9060
9065
|
constructor(e = "light", s) {
|
|
9061
|
-
this.theme = e, this.overrides = s, this.tokens =
|
|
9066
|
+
this.theme = e, this.overrides = s, this.tokens = ns(e, s);
|
|
9062
9067
|
}
|
|
9063
9068
|
setTheme(e, s) {
|
|
9064
|
-
this.theme = e, s !== void 0 && (this.overrides = s), this.tokens =
|
|
9069
|
+
this.theme = e, s !== void 0 && (this.overrides = s), this.tokens = ns(e, this.overrides);
|
|
9065
9070
|
}
|
|
9066
9071
|
setMessages(e) {
|
|
9067
9072
|
this.messages = e;
|
|
@@ -9076,23 +9081,23 @@ class Wi {
|
|
|
9076
9081
|
*/
|
|
9077
9082
|
showWalletSelector(e, s, t) {
|
|
9078
9083
|
return new Promise((n) => {
|
|
9079
|
-
var
|
|
9084
|
+
var v;
|
|
9080
9085
|
ce();
|
|
9081
|
-
const i = [...e], o =
|
|
9086
|
+
const i = [...e], o = Ai(i, this.tokens, t), a = Oe();
|
|
9082
9087
|
le(o);
|
|
9083
9088
|
let c = !1;
|
|
9084
9089
|
const l = () => {
|
|
9085
9090
|
c || (c = !0, o.remove(), a());
|
|
9086
|
-
}, u = (
|
|
9087
|
-
l(), n(
|
|
9091
|
+
}, u = (S) => {
|
|
9092
|
+
l(), n(S);
|
|
9088
9093
|
}, f = () => {
|
|
9089
9094
|
l(), n(null);
|
|
9090
9095
|
};
|
|
9091
9096
|
(() => {
|
|
9092
|
-
o.querySelectorAll(".__crossx-wallet-item").forEach((
|
|
9093
|
-
|
|
9094
|
-
const I =
|
|
9095
|
-
u({ address: I, index: T, name:
|
|
9097
|
+
o.querySelectorAll(".__crossx-wallet-item").forEach((S) => {
|
|
9098
|
+
S.addEventListener("click", () => {
|
|
9099
|
+
const I = S.dataset.walletAddress ?? "", T = parseInt(S.dataset.walletIndex ?? "0", 10), B = i.find((D) => D.index === T);
|
|
9100
|
+
u({ address: I, index: T, name: B == null ? void 0 : B.name });
|
|
9096
9101
|
});
|
|
9097
9102
|
});
|
|
9098
9103
|
})();
|
|
@@ -9100,22 +9105,22 @@ class Wi {
|
|
|
9100
9105
|
_ && _.addEventListener("click", async () => {
|
|
9101
9106
|
_.disabled = !0;
|
|
9102
9107
|
try {
|
|
9103
|
-
const
|
|
9104
|
-
i.push(
|
|
9108
|
+
const S = await s();
|
|
9109
|
+
i.push(S);
|
|
9105
9110
|
const I = o.querySelector("#__crossx-wallet-list");
|
|
9106
9111
|
if (I) {
|
|
9107
9112
|
const T = document.createElement("button");
|
|
9108
|
-
T.className = "__crossx-wallet-item", T.dataset.walletIndex = String(
|
|
9113
|
+
T.className = "__crossx-wallet-item", T.dataset.walletIndex = String(S.index), T.dataset.walletAddress = S.address, T.innerHTML = `${Vs(S.address, S.index, this.tokens.bg)}<span class="__crossx-wallet-info"><span class="__crossx-wallet-idx">${C(Ks(S))}</span><span class="__crossx-wallet-addr">${se(S.address)}</span></span>`, T.addEventListener("click", () => u(S)), I.appendChild(T), T.scrollIntoView({ behavior: "smooth", block: "nearest" });
|
|
9109
9114
|
}
|
|
9110
9115
|
} catch {
|
|
9111
9116
|
} finally {
|
|
9112
9117
|
_.disabled = !1;
|
|
9113
9118
|
}
|
|
9114
|
-
}), (
|
|
9115
|
-
|
|
9119
|
+
}), (v = o.querySelector("#__crossx-close-btn")) == null || v.addEventListener("click", f), o.addEventListener("click", (S) => {
|
|
9120
|
+
S.target === o && f();
|
|
9116
9121
|
});
|
|
9117
|
-
const p = (
|
|
9118
|
-
|
|
9122
|
+
const p = (S) => {
|
|
9123
|
+
S.key === "Escape" && (document.removeEventListener("keydown", p), f());
|
|
9119
9124
|
};
|
|
9120
9125
|
document.addEventListener("keydown", p);
|
|
9121
9126
|
});
|
|
@@ -9131,29 +9136,29 @@ class Wi {
|
|
|
9131
9136
|
(n) => Object.values(Ue).includes(n) && String(n).trim() !== ""
|
|
9132
9137
|
)) ?? [];
|
|
9133
9138
|
return new Promise((n) => {
|
|
9134
|
-
var x, _, p,
|
|
9139
|
+
var x, _, p, v;
|
|
9135
9140
|
ce();
|
|
9136
|
-
const i =
|
|
9141
|
+
const i = Oi(this.tokens, s), o = Oe();
|
|
9137
9142
|
le(i);
|
|
9138
9143
|
const a = () => {
|
|
9139
9144
|
i.remove(), o();
|
|
9140
|
-
}, c = (
|
|
9141
|
-
a(), n({ type: "oauth", provider:
|
|
9142
|
-
}, l = (
|
|
9143
|
-
a(), n({ type: "external", walletId:
|
|
9145
|
+
}, c = (S) => {
|
|
9146
|
+
a(), n({ type: "oauth", provider: S });
|
|
9147
|
+
}, l = (S) => {
|
|
9148
|
+
a(), n({ type: "external", walletId: S });
|
|
9144
9149
|
}, u = () => {
|
|
9145
9150
|
a(), n(null);
|
|
9146
9151
|
};
|
|
9147
|
-
(x = i.querySelector("#__crossx-apple-btn")) == null || x.addEventListener("click", () => c("apple")), (_ = i.querySelector("#__crossx-google-btn")) == null || _.addEventListener("click", () => c("google")), (p = i.querySelector("#__crossx-connect-other-wallet-btn")) == null || p.addEventListener("click", (
|
|
9148
|
-
const T =
|
|
9152
|
+
(x = i.querySelector("#__crossx-apple-btn")) == null || x.addEventListener("click", () => c("apple")), (_ = i.querySelector("#__crossx-google-btn")) == null || _.addEventListener("click", () => c("google")), (p = i.querySelector("#__crossx-connect-other-wallet-btn")) == null || p.addEventListener("click", (S) => {
|
|
9153
|
+
const T = S.currentTarget.dataset.walletId ?? "";
|
|
9149
9154
|
T && l(T);
|
|
9150
|
-
}), (
|
|
9151
|
-
|
|
9152
|
-
}), i.querySelectorAll(".__crossx-login-terms-link").forEach((
|
|
9153
|
-
|
|
9155
|
+
}), (v = i.querySelector("#__crossx-close-btn")) == null || v.addEventListener("click", u), i.addEventListener("click", (S) => {
|
|
9156
|
+
S.target === i && u();
|
|
9157
|
+
}), i.querySelectorAll(".__crossx-login-terms-link").forEach((S) => {
|
|
9158
|
+
S.addEventListener("click", (I) => I.stopPropagation());
|
|
9154
9159
|
});
|
|
9155
|
-
const f = (
|
|
9156
|
-
|
|
9160
|
+
const f = (S) => {
|
|
9161
|
+
S.key === "Escape" && (document.removeEventListener("keydown", f), u());
|
|
9157
9162
|
};
|
|
9158
9163
|
document.addEventListener("keydown", f);
|
|
9159
9164
|
});
|
|
@@ -9162,7 +9167,7 @@ class Wi {
|
|
|
9162
9167
|
return new Promise((s) => {
|
|
9163
9168
|
var u, f, x;
|
|
9164
9169
|
ce();
|
|
9165
|
-
const t = this.messages, n =
|
|
9170
|
+
const t = this.messages, n = Pi(this.tokens, {
|
|
9166
9171
|
title: e.title,
|
|
9167
9172
|
message: e.message,
|
|
9168
9173
|
email: e.email,
|
|
@@ -9192,7 +9197,7 @@ class Wi {
|
|
|
9192
9197
|
return new Promise((t) => {
|
|
9193
9198
|
var a, c, l;
|
|
9194
9199
|
ce();
|
|
9195
|
-
const n =
|
|
9200
|
+
const n = Ci(this.tokens, s);
|
|
9196
9201
|
le(n);
|
|
9197
9202
|
const i = () => n.remove(), o = () => {
|
|
9198
9203
|
i(), t("recover");
|
|
@@ -9238,7 +9243,7 @@ class Wi {
|
|
|
9238
9243
|
}, o = {
|
|
9239
9244
|
title: (t == null ? void 0 : t.pinSetup_confirmTitle) ?? "Confirm PIN",
|
|
9240
9245
|
headerSubtitle: (t == null ? void 0 : t.pinSetup_confirmSubtitle) ?? "Enter your PIN again to confirm."
|
|
9241
|
-
}, a =
|
|
9246
|
+
}, a = os(this.tokens, Mi(n)), c = Oe();
|
|
9242
9247
|
le(a);
|
|
9243
9248
|
let l = !1;
|
|
9244
9249
|
const u = () => {
|
|
@@ -9253,62 +9258,62 @@ class Wi {
|
|
|
9253
9258
|
repeatingDigit: (t == null ? void 0 : t.pinValidation_repeatingDigit) ?? "Cannot use the same number 3+ times in a row.",
|
|
9254
9259
|
sequential: (t == null ? void 0 : t.pinValidation_sequential) ?? "Sequential numbers (e.g., 123456) are not allowed.",
|
|
9255
9260
|
alternatingPattern: (t == null ? void 0 : t.pinValidation_alternatingPattern) ?? "Repeating patterns (e.g., 121212) are not allowed."
|
|
9256
|
-
},
|
|
9257
|
-
var
|
|
9261
|
+
}, v = (T) => {
|
|
9262
|
+
var B;
|
|
9258
9263
|
_.innerHTML = ut({
|
|
9259
9264
|
title: o.title,
|
|
9260
9265
|
headerSubtitle: o.headerSubtitle
|
|
9261
|
-
}), (
|
|
9262
|
-
D === T ? f(T) :
|
|
9266
|
+
}), (B = _.querySelector("#__crossx-close-btn")) == null || B.addEventListener("click", x), ht(_, (D) => {
|
|
9267
|
+
D === T ? f(T) : S(i.mismatchError);
|
|
9263
9268
|
}, x);
|
|
9264
|
-
},
|
|
9265
|
-
var
|
|
9269
|
+
}, S = (T) => {
|
|
9270
|
+
var B;
|
|
9266
9271
|
_.innerHTML = ut({
|
|
9267
9272
|
title: i.title,
|
|
9268
9273
|
headerSubtitle: i.headerSubtitle,
|
|
9269
9274
|
subtitle: i.subtitle,
|
|
9270
9275
|
errorMessage: T
|
|
9271
|
-
}), (
|
|
9276
|
+
}), (B = _.querySelector("#__crossx-close-btn")) == null || B.addEventListener("click", x), ht(_, (D) => {
|
|
9272
9277
|
const K = $i(D, p);
|
|
9273
|
-
K ?
|
|
9278
|
+
K ? S(K) : v(D);
|
|
9274
9279
|
}, x);
|
|
9275
9280
|
};
|
|
9276
9281
|
(() => {
|
|
9277
9282
|
var Q;
|
|
9278
|
-
const T = Array.from(_.querySelectorAll(".__crossx-pw-notice-item")),
|
|
9279
|
-
|
|
9280
|
-
const K =
|
|
9281
|
-
const
|
|
9282
|
-
|
|
9283
|
-
}, W = (
|
|
9283
|
+
const T = Array.from(_.querySelectorAll(".__crossx-pw-notice-item")), B = _.querySelector("#__crossx-pin-notice-next"), D = /* @__PURE__ */ new Set();
|
|
9284
|
+
B.removeAttribute("disabled");
|
|
9285
|
+
const K = B.dataset.nextLabel ?? "Next", q = B.dataset.submitLabel ?? "I Understand", Z = () => {
|
|
9286
|
+
const H = D.size === T.length;
|
|
9287
|
+
B.classList.toggle("--disabled", !H), B.textContent = H ? q : K;
|
|
9288
|
+
}, W = (H, N) => {
|
|
9284
9289
|
if (D.has(N)) return;
|
|
9285
|
-
const
|
|
9286
|
-
D.add(N),
|
|
9287
|
-
}, X = (
|
|
9290
|
+
const $ = H.querySelector(`#__crossx-notice-check-${N}`);
|
|
9291
|
+
D.add(N), $.classList.add("--checked"), H.setAttribute("aria-checked", "true"), Z();
|
|
9292
|
+
}, X = (H, N) => {
|
|
9288
9293
|
if (!D.has(N)) return;
|
|
9289
|
-
const
|
|
9290
|
-
D.delete(N),
|
|
9294
|
+
const $ = H.querySelector(`#__crossx-notice-check-${N}`);
|
|
9295
|
+
D.delete(N), $.classList.remove("--checked"), H.setAttribute("aria-checked", "false"), Z();
|
|
9291
9296
|
};
|
|
9292
|
-
T.forEach((
|
|
9293
|
-
const N = parseInt(
|
|
9294
|
-
|
|
9295
|
-
D.has(N) ? X(
|
|
9296
|
-
}),
|
|
9297
|
-
(
|
|
9297
|
+
T.forEach((H) => {
|
|
9298
|
+
const N = parseInt(H.dataset.checkIndex ?? "0", 10);
|
|
9299
|
+
H.addEventListener("click", () => {
|
|
9300
|
+
D.has(N) ? X(H, N) : W(H, N);
|
|
9301
|
+
}), H.addEventListener("keydown", ($) => {
|
|
9302
|
+
($.key === " " || $.key === "Enter") && ($.preventDefault(), D.has(N) ? X(H, N) : W(H, N));
|
|
9298
9303
|
});
|
|
9299
|
-
}),
|
|
9304
|
+
}), B.addEventListener("click", () => {
|
|
9300
9305
|
if (D.size === T.length) {
|
|
9301
|
-
|
|
9306
|
+
S(e == null ? void 0 : e.errorMessage);
|
|
9302
9307
|
return;
|
|
9303
9308
|
}
|
|
9304
|
-
const
|
|
9305
|
-
const m = parseInt(
|
|
9309
|
+
const H = T.find(($) => {
|
|
9310
|
+
const m = parseInt($.dataset.checkIndex ?? "0", 10);
|
|
9306
9311
|
return !D.has(m);
|
|
9307
9312
|
});
|
|
9308
|
-
if (!
|
|
9309
|
-
const N = parseInt(
|
|
9310
|
-
|
|
9311
|
-
|
|
9313
|
+
if (!H) return;
|
|
9314
|
+
const N = parseInt(H.dataset.checkIndex ?? "0", 10);
|
|
9315
|
+
H.scrollIntoView({ behavior: "smooth", block: "nearest" }), H.classList.add("--highlight"), setTimeout(() => {
|
|
9316
|
+
H.classList.remove("--highlight"), W(H, N);
|
|
9312
9317
|
}, 400);
|
|
9313
9318
|
}), (Q = _.querySelector("#__crossx-close-btn")) == null || Q.addEventListener("click", x);
|
|
9314
9319
|
})(), a.addEventListener("click", (T) => {
|
|
@@ -9325,7 +9330,7 @@ class Wi {
|
|
|
9325
9330
|
return new Promise((s, t) => {
|
|
9326
9331
|
var I;
|
|
9327
9332
|
ce();
|
|
9328
|
-
const n = this.messages, i = (e == null ? void 0 : e.verifyMode) === !0, o = i ? (n == null ? void 0 : n.verifyPin_title) ?? "Verify Your PIN" : (n == null ? void 0 : n.pinInput_title) ?? "Enter PIN", a = i ? (n == null ? void 0 : n.verifyPin_subtitle) ?? "Enter your PIN to authorize this transaction." : (n == null ? void 0 : n.pinInput_subtitle) ?? "Enter your 6-digit PIN to continue.", c = (n == null ? void 0 : n.pinLocked_failureWarning) ?? "Your account will be locked after further failures.", l =
|
|
9333
|
+
const n = this.messages, i = (e == null ? void 0 : e.verifyMode) === !0, o = i ? (n == null ? void 0 : n.verifyPin_title) ?? "Verify Your PIN" : (n == null ? void 0 : n.pinInput_title) ?? "Enter PIN", a = i ? (n == null ? void 0 : n.verifyPin_subtitle) ?? "Enter your PIN to authorize this transaction." : (n == null ? void 0 : n.pinInput_subtitle) ?? "Enter your 6-digit PIN to continue.", c = (n == null ? void 0 : n.pinLocked_failureWarning) ?? "Your account will be locked after further failures.", l = os(
|
|
9329
9334
|
this.tokens,
|
|
9330
9335
|
ut({
|
|
9331
9336
|
title: o,
|
|
@@ -9345,10 +9350,10 @@ class Wi {
|
|
|
9345
9350
|
x(), s(T);
|
|
9346
9351
|
}, p = () => {
|
|
9347
9352
|
x(), s(null);
|
|
9348
|
-
},
|
|
9353
|
+
}, v = (T) => {
|
|
9349
9354
|
x(), t(T);
|
|
9350
|
-
},
|
|
9351
|
-
(I =
|
|
9355
|
+
}, S = l.querySelector(".__crossx-card");
|
|
9356
|
+
(I = S.querySelector("#__crossx-close-btn")) == null || I.addEventListener("click", p), ht(S, _, p, v, e == null ? void 0 : e.onSubmit, e == null ? void 0 : e.lockExpiresAt, c), l.addEventListener("click", (T) => {
|
|
9352
9357
|
T.target === l && p();
|
|
9353
9358
|
});
|
|
9354
9359
|
});
|
|
@@ -9364,14 +9369,14 @@ class Wi {
|
|
|
9364
9369
|
return new Promise((s) => {
|
|
9365
9370
|
var a;
|
|
9366
9371
|
ce();
|
|
9367
|
-
const t =
|
|
9372
|
+
const t = Ni(this.tokens, e);
|
|
9368
9373
|
le(t);
|
|
9369
9374
|
const n = () => t.remove(), i = (c) => {
|
|
9370
9375
|
n(), s(c);
|
|
9371
9376
|
}, o = () => {
|
|
9372
9377
|
n(), s(null);
|
|
9373
9378
|
};
|
|
9374
|
-
|
|
9379
|
+
Wi(t, i, o), (a = t.querySelector("#__crossx-close-btn")) == null || a.addEventListener("click", o), t.addEventListener("click", (c) => {
|
|
9375
9380
|
c.target === t && o();
|
|
9376
9381
|
});
|
|
9377
9382
|
});
|
|
@@ -9386,7 +9391,7 @@ class Wi {
|
|
|
9386
9391
|
return new Promise((t) => {
|
|
9387
9392
|
var l;
|
|
9388
9393
|
ce();
|
|
9389
|
-
const { overlay: n, startCountdown: i } =
|
|
9394
|
+
const { overlay: n, startCountdown: i } = Di(this.tokens, e, s);
|
|
9390
9395
|
le(n);
|
|
9391
9396
|
const o = () => {
|
|
9392
9397
|
c(), n.remove();
|
|
@@ -9406,7 +9411,7 @@ class Wi {
|
|
|
9406
9411
|
return new Promise((s) => {
|
|
9407
9412
|
var a, c;
|
|
9408
9413
|
ce();
|
|
9409
|
-
const t =
|
|
9414
|
+
const t = _i(e, this.tokens);
|
|
9410
9415
|
le(t);
|
|
9411
9416
|
const n = () => t.remove(), i = () => {
|
|
9412
9417
|
n(), s();
|
|
@@ -9435,7 +9440,7 @@ class Wi {
|
|
|
9435
9440
|
showTransactionProgress(e, s) {
|
|
9436
9441
|
return new Promise((t) => {
|
|
9437
9442
|
ce();
|
|
9438
|
-
const n =
|
|
9443
|
+
const n = xi(e, this.tokens);
|
|
9439
9444
|
le(n);
|
|
9440
9445
|
const i = () => n.remove();
|
|
9441
9446
|
let o = !1;
|
|
@@ -9452,7 +9457,7 @@ class Wi {
|
|
|
9452
9457
|
document.addEventListener("keydown", l);
|
|
9453
9458
|
};
|
|
9454
9459
|
s.then((l) => {
|
|
9455
|
-
o || (
|
|
9460
|
+
o || (gi(n, l, this.tokens), c());
|
|
9456
9461
|
});
|
|
9457
9462
|
});
|
|
9458
9463
|
}
|
|
@@ -9461,7 +9466,7 @@ class Wi {
|
|
|
9461
9466
|
var l, u, f;
|
|
9462
9467
|
ce();
|
|
9463
9468
|
let t;
|
|
9464
|
-
e.type === "sign-message" ? t =
|
|
9469
|
+
e.type === "sign-message" ? t = mi(e, this.tokens) : e.type === "sign-typed-data" ? t = wi(e, this.tokens) : e.type === "sign" ? t = ui(e, this.tokens) : t = hi(e, this.tokens);
|
|
9465
9470
|
const n = Oe();
|
|
9466
9471
|
le(t);
|
|
9467
9472
|
const i = () => {
|
|
@@ -9473,10 +9478,10 @@ class Wi {
|
|
|
9473
9478
|
};
|
|
9474
9479
|
(l = t.querySelector("#__crossx-confirm-btn")) == null || l.addEventListener("click", o), (u = t.querySelector("#__crossx-cancel-btn")) == null || u.addEventListener("click", a), (f = t.querySelector("#__crossx-close-btn")) == null || f.addEventListener("click", a), t.querySelectorAll(".__crossx-copy-btn").forEach((x) => {
|
|
9475
9480
|
x.addEventListener("click", (_) => {
|
|
9476
|
-
var
|
|
9481
|
+
var v;
|
|
9477
9482
|
_.stopPropagation();
|
|
9478
9483
|
const p = x.dataset.copy;
|
|
9479
|
-
p && ((
|
|
9484
|
+
p && ((v = navigator.clipboard) == null || v.writeText(p).catch(() => {
|
|
9480
9485
|
}));
|
|
9481
9486
|
});
|
|
9482
9487
|
}), t.addEventListener("click", (x) => {
|
|
@@ -9489,7 +9494,7 @@ class Wi {
|
|
|
9489
9494
|
});
|
|
9490
9495
|
}
|
|
9491
9496
|
}
|
|
9492
|
-
class
|
|
9497
|
+
class qi {
|
|
9493
9498
|
constructor() {
|
|
9494
9499
|
this._accessToken = null, this._expiresAt = 0;
|
|
9495
9500
|
}
|
|
@@ -9521,7 +9526,7 @@ class Gi {
|
|
|
9521
9526
|
return !this._accessToken || this._expiresAt <= 0 ? !0 : Date.now() >= this._expiresAt - e;
|
|
9522
9527
|
}
|
|
9523
9528
|
}
|
|
9524
|
-
function
|
|
9529
|
+
function Zi(r, e) {
|
|
9525
9530
|
r.debug;
|
|
9526
9531
|
const s = Ce.production, t = {
|
|
9527
9532
|
...r,
|
|
@@ -9531,22 +9536,22 @@ function Ji(r, e) {
|
|
|
9531
9536
|
}, n = {
|
|
9532
9537
|
gatewayUrl: s.walletGatewayUrl,
|
|
9533
9538
|
projectId: r.projectId
|
|
9534
|
-
}, i = t.authMode !== "cookie" &&
|
|
9539
|
+
}, i = t.authMode !== "cookie" && Ht.isAvailable();
|
|
9535
9540
|
!i && t.authMode !== "cookie" && d.warn(
|
|
9536
9541
|
"[CROSSx] IndexedDB 사용 불가 — LocalStorage fallback 사용 중.",
|
|
9537
9542
|
"refresh_token이 평문 저장되지 않도록 세션 영속성이 제한됩니다.",
|
|
9538
9543
|
"IndexedDB를 지원하는 브라우저 사용을 권장합니다."
|
|
9539
9544
|
), t.secureStorageAvailable = i;
|
|
9540
|
-
const o = i ? new
|
|
9545
|
+
const o = i ? new Ht(r.projectId) : new Mr(), a = new Kn(), c = new Yn(), l = new Ee(), u = new qi(), f = new cs();
|
|
9541
9546
|
let x;
|
|
9542
|
-
r.useMockWallet ? (d.log("[CROSSx] Mock Wallet Provider 사용"), x = new
|
|
9547
|
+
r.useMockWallet ? (d.log("[CROSSx] Mock Wallet Provider 사용"), x = new Jn(o, f)) : (d.log("[CROSSx] Remote Wallet Provider 사용"), x = new Ae(
|
|
9543
9548
|
n,
|
|
9544
9549
|
o,
|
|
9545
9550
|
c,
|
|
9546
9551
|
u,
|
|
9547
9552
|
f
|
|
9548
9553
|
));
|
|
9549
|
-
const _ = new He(n, c), p = new
|
|
9554
|
+
const _ = new He(n, c), p = new Gi(r.theme ?? "light", r.themeTokens), v = e != null && e.wrapConfirmation ? e.wrapConfirmation(p) : p, S = new ft(
|
|
9550
9555
|
t,
|
|
9551
9556
|
n,
|
|
9552
9557
|
o,
|
|
@@ -9555,15 +9560,15 @@ function Ji(r, e) {
|
|
|
9555
9560
|
l,
|
|
9556
9561
|
x,
|
|
9557
9562
|
u,
|
|
9558
|
-
|
|
9563
|
+
v,
|
|
9559
9564
|
_,
|
|
9560
9565
|
f
|
|
9561
9566
|
);
|
|
9562
|
-
return typeof window < "u" && (window.__crossxSDK =
|
|
9567
|
+
return typeof window < "u" && (window.__crossxSDK = S), S;
|
|
9563
9568
|
}
|
|
9564
|
-
function
|
|
9565
|
-
const e =
|
|
9566
|
-
|
|
9569
|
+
function Qi(r) {
|
|
9570
|
+
const e = Ki(r), s = Vi(e), t = JSON.parse(s);
|
|
9571
|
+
ji(t);
|
|
9567
9572
|
const { data: n } = t;
|
|
9568
9573
|
return {
|
|
9569
9574
|
status: t.status,
|
|
@@ -9577,7 +9582,7 @@ function Zi(r) {
|
|
|
9577
9582
|
raw: t
|
|
9578
9583
|
};
|
|
9579
9584
|
}
|
|
9580
|
-
function
|
|
9585
|
+
function Ki(r) {
|
|
9581
9586
|
if (r.includes("://") && r.includes("?")) {
|
|
9582
9587
|
const e = new URL(r), s = e.searchParams.get("crossx_oauth_result");
|
|
9583
9588
|
if (s) return s;
|
|
@@ -9587,22 +9592,22 @@ function qi(r) {
|
|
|
9587
9592
|
}
|
|
9588
9593
|
return r;
|
|
9589
9594
|
}
|
|
9590
|
-
function
|
|
9595
|
+
function Vi(r) {
|
|
9591
9596
|
if (r.startsWith("{"))
|
|
9592
9597
|
return r;
|
|
9593
9598
|
if (r.startsWith("%7B") || r.startsWith("%7b"))
|
|
9594
9599
|
return decodeURIComponent(r);
|
|
9595
|
-
const e =
|
|
9600
|
+
const e = zi(r);
|
|
9596
9601
|
return decodeURIComponent(e);
|
|
9597
9602
|
}
|
|
9598
|
-
function
|
|
9603
|
+
function zi(r) {
|
|
9599
9604
|
if (typeof atob == "function")
|
|
9600
9605
|
return atob(r);
|
|
9601
9606
|
if (typeof Buffer < "u")
|
|
9602
9607
|
return Buffer.from(r, "base64").toString("utf-8");
|
|
9603
9608
|
throw new Error("Base64 디코딩을 지원하는 환경이 아닙니다");
|
|
9604
9609
|
}
|
|
9605
|
-
function
|
|
9610
|
+
function ji(r) {
|
|
9606
9611
|
if (typeof r != "object" || r === null)
|
|
9607
9612
|
throw new Error("Deeplink payload가 유효한 객체가 아닙니다");
|
|
9608
9613
|
const e = r;
|
|
@@ -9619,16 +9624,17 @@ function zi(r) {
|
|
|
9619
9624
|
throw new Error("Deeplink data에 accessToken 필드가 없습니다");
|
|
9620
9625
|
}
|
|
9621
9626
|
export {
|
|
9622
|
-
|
|
9627
|
+
er as CONNECT_OTHER_WALLET_DISPLAY_ORDER,
|
|
9623
9628
|
g as CROSSxError,
|
|
9624
|
-
|
|
9629
|
+
ir as CROSSxEthereumProvider,
|
|
9625
9630
|
ft as CROSSxSDK,
|
|
9626
|
-
|
|
9631
|
+
Ji as ChainId,
|
|
9627
9632
|
Ue as ConnectOtherWalletItem,
|
|
9628
9633
|
h as ErrorCode,
|
|
9629
|
-
|
|
9630
|
-
|
|
9631
|
-
|
|
9632
|
-
|
|
9633
|
-
|
|
9634
|
+
Ut as MNEMONIC_ADDRESS_LIMIT,
|
|
9635
|
+
cs as PinMemoryStore,
|
|
9636
|
+
qi as TokenMemoryStore,
|
|
9637
|
+
Zi as createCROSSxSDK,
|
|
9638
|
+
tr as getConnectOtherWalletLabel,
|
|
9639
|
+
Qi as parseOAuthDeeplink
|
|
9634
9640
|
};
|