@nexus-cross/crossx-sdk-core 2.1.0-beta.2 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/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 +673 -662
- package/dist/sdk/utils/amount.d.ts.map +1 -1
- 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 Ys = Object.defineProperty;
|
|
2
|
+
var Xs = (r, e, s) => e in r ? Ys(r, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : r[e] = s;
|
|
3
|
+
var P = (r, e, s) => Xs(r, typeof e != "symbol" ? e + "" : e, s);
|
|
4
|
+
import { createRemoteJWKSet as Js, jwtVerify as Zs, decodeJwt as Qs } 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 er = {
|
|
21
21
|
"io.metamask": "MetaMask",
|
|
22
22
|
"com.binance.wallet": "Binance Wallet",
|
|
23
23
|
crossx: "CROSSx"
|
|
24
|
-
},
|
|
24
|
+
}, tr = [
|
|
25
25
|
"crossx",
|
|
26
26
|
"io.metamask",
|
|
27
27
|
"com.binance.wallet"
|
|
28
28
|
/* Binance */
|
|
29
29
|
];
|
|
30
|
-
function
|
|
31
|
-
return
|
|
30
|
+
function sr(r) {
|
|
31
|
+
return er[r] ?? r;
|
|
32
32
|
}
|
|
33
|
-
function
|
|
34
|
-
return Array.isArray(r.connectOtherWallets) && r.connectOtherWallets.length > 0 ? [...r.connectOtherWallets] : r.showConnectOtherWallets === !0 ? [...
|
|
33
|
+
function rr(r) {
|
|
34
|
+
return Array.isArray(r.connectOtherWallets) && r.connectOtherWallets.length > 0 ? [...r.connectOtherWallets] : r.showConnectOtherWallets === !0 ? [...tr] : [];
|
|
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
|
+
}, Zi = Object.fromEntries(
|
|
86
86
|
Object.entries(Ze).map(([r, e]) => [r, e.caipId])
|
|
87
|
-
),
|
|
87
|
+
), nr = 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 ir = { symbol: "", decimals: 18 };
|
|
94
94
|
function st(r) {
|
|
95
95
|
var e;
|
|
96
|
-
return ((e =
|
|
96
|
+
return ((e = nr.get(r)) == null ? void 0 : e.nativeCurrency) ?? ir;
|
|
97
97
|
}
|
|
98
|
-
class
|
|
98
|
+
class or {
|
|
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
|
+
}, ar = {
|
|
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
|
+
}, cr = {
|
|
381
|
+
ko: ar,
|
|
382
|
+
en: as
|
|
383
383
|
};
|
|
384
384
|
function xe(r = "en", e) {
|
|
385
|
-
return
|
|
385
|
+
return cr[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 lr {
|
|
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 dr {
|
|
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 ur {
|
|
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 hr {
|
|
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 pr(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 = pr(r);
|
|
944
944
|
if (e) return e;
|
|
945
945
|
}
|
|
946
946
|
} catch {
|
|
@@ -953,14 +953,19 @@ function cs() {
|
|
|
953
953
|
}
|
|
954
954
|
return Ce.production;
|
|
955
955
|
}
|
|
956
|
-
const
|
|
957
|
-
function
|
|
956
|
+
const fr = 2e3, Lt = 6e4, _r = 1e3, xr = 1e4, gr = "0x77359400", Dt = "0x3B9ACA00", Mt = 130, ds = 6, $t = 18, Bt = 3e4, mr = 5 * 60 * 1e3, wr = 30 * 1e3, Ut = 100;
|
|
957
|
+
function us(r) {
|
|
958
|
+
let e = r.length;
|
|
959
|
+
for (; e > 0 && r.charCodeAt(e - 1) === 48; ) e--;
|
|
960
|
+
return r.slice(0, e);
|
|
961
|
+
}
|
|
962
|
+
function yr(r) {
|
|
958
963
|
if (!r || r === "0x0" || r === "0x") return "0";
|
|
959
964
|
try {
|
|
960
965
|
const e = BigInt(r);
|
|
961
966
|
if (e === 0n) return "0";
|
|
962
|
-
const s = 10n ** BigInt(
|
|
963
|
-
return
|
|
967
|
+
const s = 10n ** BigInt($t), t = e / s, i = (e % s).toString().padStart($t, "0"), o = us(i).slice(0, ds);
|
|
968
|
+
return o ? `${t}.${o}` : `${t}`;
|
|
964
969
|
} catch {
|
|
965
970
|
return "?";
|
|
966
971
|
}
|
|
@@ -970,26 +975,26 @@ function We(r, e, s) {
|
|
|
970
975
|
try {
|
|
971
976
|
const t = BigInt(r);
|
|
972
977
|
if (t === 0n) return;
|
|
973
|
-
const n = 10n ** BigInt(s), i = t / n, a = (t % n).toString().padStart(s, "0").slice(0,
|
|
974
|
-
return `${
|
|
978
|
+
const n = 10n ** BigInt(s), i = t / n, a = (t % n).toString().padStart(s, "0"), c = us(a.slice(0, ds));
|
|
979
|
+
return `${c ? `${i}.${c}` : `${i}`} ${e}`;
|
|
975
980
|
} catch {
|
|
976
981
|
return;
|
|
977
982
|
}
|
|
978
983
|
}
|
|
979
|
-
function
|
|
984
|
+
function br(r) {
|
|
980
985
|
const e = r.startsWith("0x") ? r.slice(2) : r;
|
|
981
986
|
if (!/^[0-9a-fA-F]+$/.test(e))
|
|
982
987
|
throw new g(
|
|
983
988
|
h.SIGNATURE_FAILED,
|
|
984
989
|
"유효하지 않은 서명: 올바른 hex 문자열이 아닙니다"
|
|
985
990
|
);
|
|
986
|
-
if (e.length !==
|
|
991
|
+
if (e.length !== Mt)
|
|
987
992
|
throw new g(
|
|
988
993
|
h.SIGNATURE_FAILED,
|
|
989
|
-
`서명 길이가 유효하지 않습니다: ${
|
|
994
|
+
`서명 길이가 유효하지 않습니다: ${Mt} hex 문자(65 바이트) 예상, 현재 ${e.length}`
|
|
990
995
|
);
|
|
991
996
|
}
|
|
992
|
-
function
|
|
997
|
+
function Sr(r) {
|
|
993
998
|
const e = r.startsWith("0x") ? r.slice(2) : r;
|
|
994
999
|
if (!/^[0-9a-fA-F]+$/.test(e))
|
|
995
1000
|
throw new g(
|
|
@@ -1002,8 +1007,8 @@ function yr(r) {
|
|
|
1002
1007
|
"유효하지 않은 서명된 트랜잭션: 너무 짧습니다"
|
|
1003
1008
|
);
|
|
1004
1009
|
}
|
|
1005
|
-
function
|
|
1006
|
-
const s =
|
|
1010
|
+
function vr(r, e) {
|
|
1011
|
+
const s = Er(e);
|
|
1007
1012
|
if (r === "0") {
|
|
1008
1013
|
if (s !== void 0 && s !== 0)
|
|
1009
1014
|
throw new g(
|
|
@@ -1027,7 +1032,7 @@ function br(r, e) {
|
|
|
1027
1032
|
);
|
|
1028
1033
|
}
|
|
1029
1034
|
}
|
|
1030
|
-
function
|
|
1035
|
+
function Er(r) {
|
|
1031
1036
|
if (r == null || typeof r != "object") return;
|
|
1032
1037
|
const e = r.domain;
|
|
1033
1038
|
if (e == null || typeof e != "object") return;
|
|
@@ -1188,7 +1193,7 @@ class Pe {
|
|
|
1188
1193
|
return { ok: !1, error: n, ...i };
|
|
1189
1194
|
}
|
|
1190
1195
|
}
|
|
1191
|
-
class
|
|
1196
|
+
class Ar {
|
|
1192
1197
|
constructor(e) {
|
|
1193
1198
|
this.deps = e;
|
|
1194
1199
|
}
|
|
@@ -1206,10 +1211,10 @@ class Sr {
|
|
|
1206
1211
|
});
|
|
1207
1212
|
}
|
|
1208
1213
|
}
|
|
1209
|
-
function
|
|
1214
|
+
function Ir(r) {
|
|
1210
1215
|
return r === "google" || r === "apple";
|
|
1211
1216
|
}
|
|
1212
|
-
class
|
|
1217
|
+
class kr {
|
|
1213
1218
|
constructor(e) {
|
|
1214
1219
|
this.deps = e;
|
|
1215
1220
|
}
|
|
@@ -1220,7 +1225,7 @@ class Ar {
|
|
|
1220
1225
|
this.deps.setRecoveringSession(!0);
|
|
1221
1226
|
try {
|
|
1222
1227
|
this.deps.setAuthenticated(!1), this.deps.clearTokenStore();
|
|
1223
|
-
const n =
|
|
1228
|
+
const n = Ir(e.loginType) ? { provider: e.loginType } : void 0;
|
|
1224
1229
|
let i;
|
|
1225
1230
|
try {
|
|
1226
1231
|
i = await this.deps.executeSignIn(n);
|
|
@@ -1300,7 +1305,7 @@ class Ar {
|
|
|
1300
1305
|
}
|
|
1301
1306
|
}
|
|
1302
1307
|
}
|
|
1303
|
-
class
|
|
1308
|
+
class Tr {
|
|
1304
1309
|
constructor(e) {
|
|
1305
1310
|
this.deps = e;
|
|
1306
1311
|
}
|
|
@@ -1334,7 +1339,7 @@ class Ir {
|
|
|
1334
1339
|
d.log("[CROSSx] 세션 복원 후 지갑 주소 로드 완료:", o.address), this.deps.setActiveWallet(o.address, 0);
|
|
1335
1340
|
}
|
|
1336
1341
|
}
|
|
1337
|
-
class
|
|
1342
|
+
class Rr {
|
|
1338
1343
|
constructor(e) {
|
|
1339
1344
|
this.deps = e;
|
|
1340
1345
|
}
|
|
@@ -1385,12 +1390,12 @@ class kr {
|
|
|
1385
1390
|
const _ = x.lockExpiresAt * 1e3, p = Math.max(
|
|
1386
1391
|
1,
|
|
1387
1392
|
Math.round((_ - Date.now()) / 1e3)
|
|
1388
|
-
),
|
|
1393
|
+
), v = p <= 1800 ? "Too many failed attempts. Please try again in 30 minutes." : "Too many failed attempts. Please try again in 24 hours.";
|
|
1389
1394
|
d.warn(
|
|
1390
|
-
`[CROSSx][Migration Phase 4] verify-recovery-pin 잠금 — ${p}초, 메시지: ${
|
|
1395
|
+
`[CROSSx][Migration Phase 4] verify-recovery-pin 잠금 — ${p}초, 메시지: ${v}`
|
|
1391
1396
|
), await this.deps.confirmation.showRecoveryPinLockedPrompt(
|
|
1392
1397
|
p,
|
|
1393
|
-
|
|
1398
|
+
v
|
|
1394
1399
|
), i = 0, n = "Your account lock has been lifted. You may try again.";
|
|
1395
1400
|
} else
|
|
1396
1401
|
d.warn(
|
|
@@ -1427,12 +1432,12 @@ class kr {
|
|
|
1427
1432
|
const _ = ((x == null ? void 0 : x.lockExpiresAt) ?? 0) * 1e3, p = Math.max(
|
|
1428
1433
|
1,
|
|
1429
1434
|
Math.round((_ - Date.now()) / 1e3)
|
|
1430
|
-
),
|
|
1435
|
+
), v = p <= 1800 ? "Too many failed attempts. Please try again in 30 minutes." : "Too many failed attempts. Please try again in 24 hours.";
|
|
1431
1436
|
d.warn(
|
|
1432
1437
|
`[CROSSx][Migration Phase 4] verify-recovery-pin 이미 잠금 — ${p}초`
|
|
1433
1438
|
), await this.deps.confirmation.showRecoveryPinLockedPrompt(
|
|
1434
1439
|
p,
|
|
1435
|
-
|
|
1440
|
+
v
|
|
1436
1441
|
), i = 0, n = "Your account lock has been lifted. You may try again.";
|
|
1437
1442
|
} else
|
|
1438
1443
|
throw d.error(
|
|
@@ -1470,19 +1475,19 @@ class kr {
|
|
|
1470
1475
|
"[CROSSx][Migration Phase 5] 재로그인 성공 — 마이그레이션 재시도 (검증된 PIN 유지)"
|
|
1471
1476
|
);
|
|
1472
1477
|
try {
|
|
1473
|
-
const
|
|
1478
|
+
const v = await this.deps.executeMigrate(
|
|
1474
1479
|
a,
|
|
1475
1480
|
e
|
|
1476
1481
|
);
|
|
1477
1482
|
return d.log(
|
|
1478
1483
|
"[CROSSx][Migration Phase 5] 마이그레이션 재시도 성공 — address:",
|
|
1479
|
-
|
|
1480
|
-
),
|
|
1481
|
-
} catch (
|
|
1484
|
+
v.address
|
|
1485
|
+
), v;
|
|
1486
|
+
} catch (v) {
|
|
1482
1487
|
throw d.error(
|
|
1483
1488
|
"[CROSSx][Migration Phase 5] 마이그레이션 재시도 실패:",
|
|
1484
|
-
|
|
1485
|
-
),
|
|
1489
|
+
v
|
|
1490
|
+
), v;
|
|
1486
1491
|
}
|
|
1487
1492
|
}
|
|
1488
1493
|
throw this.deps.clearAuthState(), u;
|
|
@@ -1491,7 +1496,7 @@ class kr {
|
|
|
1491
1496
|
}
|
|
1492
1497
|
}
|
|
1493
1498
|
}
|
|
1494
|
-
class
|
|
1499
|
+
class Or {
|
|
1495
1500
|
constructor(e) {
|
|
1496
1501
|
this.deps = e;
|
|
1497
1502
|
}
|
|
@@ -1527,12 +1532,12 @@ class Tr {
|
|
|
1527
1532
|
"maxPriorityFeePerGas: 1 Gwei"
|
|
1528
1533
|
);
|
|
1529
1534
|
} else
|
|
1530
|
-
c.gasPrice =
|
|
1535
|
+
c.gasPrice = gr, d.log("[CROSSx] Legacy 체인 감지 — gasPrice: 2 Gwei");
|
|
1531
1536
|
}
|
|
1532
1537
|
return !o && a && (c.maxPriorityFeePerGas = Dt, d.log("[CROSSx] maxPriorityFeePerGas 비어있음 → 1 Gwei 기본값 적용")), c;
|
|
1533
1538
|
}
|
|
1534
1539
|
}
|
|
1535
|
-
class
|
|
1540
|
+
class Pr {
|
|
1536
1541
|
constructor(e) {
|
|
1537
1542
|
this.crypto = e;
|
|
1538
1543
|
}
|
|
@@ -1558,10 +1563,10 @@ class Rr {
|
|
|
1558
1563
|
}
|
|
1559
1564
|
}
|
|
1560
1565
|
}
|
|
1561
|
-
function
|
|
1566
|
+
function Cr(r) {
|
|
1562
1567
|
return r ? r.includes("google") ? "google" : r.includes("apple") ? "apple" : r : null;
|
|
1563
1568
|
}
|
|
1564
|
-
class
|
|
1569
|
+
class Nr {
|
|
1565
1570
|
constructor(e) {
|
|
1566
1571
|
this.deps = e;
|
|
1567
1572
|
}
|
|
@@ -1581,7 +1586,7 @@ class Pr {
|
|
|
1581
1586
|
activeWalletIndex: 0,
|
|
1582
1587
|
userEmail: ((n = e.user) == null ? void 0 : n.email) ?? null,
|
|
1583
1588
|
providerSub: ((i = e.user) == null ? void 0 : i.providerSub) ?? null,
|
|
1584
|
-
loginType:
|
|
1589
|
+
loginType: Cr(
|
|
1585
1590
|
(o = e.user) == null ? void 0 : o.signInProvider
|
|
1586
1591
|
),
|
|
1587
1592
|
tokenSignatureVerified: e.tokenSignatureVerified ?? !1
|
|
@@ -1610,7 +1615,7 @@ class Pr {
|
|
|
1610
1615
|
});
|
|
1611
1616
|
}
|
|
1612
1617
|
}
|
|
1613
|
-
class
|
|
1618
|
+
class Lr {
|
|
1614
1619
|
constructor(e) {
|
|
1615
1620
|
this.deps = e;
|
|
1616
1621
|
}
|
|
@@ -1629,7 +1634,7 @@ class Cr {
|
|
|
1629
1634
|
)).address, index: e };
|
|
1630
1635
|
}
|
|
1631
1636
|
}
|
|
1632
|
-
class
|
|
1637
|
+
class Dr {
|
|
1633
1638
|
constructor(e) {
|
|
1634
1639
|
this.deps = e;
|
|
1635
1640
|
}
|
|
@@ -1648,7 +1653,7 @@ class Nr {
|
|
|
1648
1653
|
);
|
|
1649
1654
|
}
|
|
1650
1655
|
}
|
|
1651
|
-
class
|
|
1656
|
+
class Mr {
|
|
1652
1657
|
constructor(e) {
|
|
1653
1658
|
this.deps = e;
|
|
1654
1659
|
}
|
|
@@ -1710,19 +1715,19 @@ function rt(r, e = "Apple account") {
|
|
|
1710
1715
|
const t = r.substring(0, s), n = r.substring(s);
|
|
1711
1716
|
return t.length <= 1 ? `${t}${"*".repeat(Math.max(t.length, 1))}${n}` : `${t[0]}${"*".repeat(t.length - 1)}${n}`;
|
|
1712
1717
|
}
|
|
1713
|
-
const Ie = class Ie extends
|
|
1718
|
+
const Ie = class Ie extends hr {
|
|
1714
1719
|
constructor(e, s, t, n, i, o, a, c, l, u, f) {
|
|
1715
1720
|
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
|
|
1721
|
+
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 Nr({
|
|
1717
1722
|
setState: (p) => {
|
|
1718
1723
|
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
1724
|
},
|
|
1720
1725
|
getIsRecoveringSession: () => this._isRecoveringSession,
|
|
1721
|
-
emitAddressChanged: ({ address: p, index:
|
|
1722
|
-
this.emit("addressChanged", { address: p, index:
|
|
1726
|
+
emitAddressChanged: ({ address: p, index: v }) => {
|
|
1727
|
+
this.emit("addressChanged", { address: p, index: v });
|
|
1723
1728
|
},
|
|
1724
|
-
emitAuthChanged: ({ isAuthenticated: p, address:
|
|
1725
|
-
this.emit("authChanged", { isAuthenticated: p, address:
|
|
1729
|
+
emitAuthChanged: ({ isAuthenticated: p, address: v, userId: S }) => {
|
|
1730
|
+
this.emit("authChanged", { isAuthenticated: p, address: v, userId: S });
|
|
1726
1731
|
},
|
|
1727
1732
|
shouldPersistWalletPreference: () => this._config.persistWalletPreference !== !1,
|
|
1728
1733
|
walletPreferenceKey: Ie.WALLET_PREF_KEY,
|
|
@@ -1736,20 +1741,20 @@ const Ie = class Ie extends dr {
|
|
|
1736
1741
|
getUserEmail: () => this.userEmail,
|
|
1737
1742
|
maskEmail: rt,
|
|
1738
1743
|
signInAgain: () => this.signInAgain()
|
|
1739
|
-
}), this.signingOrchestrator = new
|
|
1744
|
+
}), this.signingOrchestrator = new Ar({
|
|
1740
1745
|
confirmation: this.confirmation,
|
|
1741
1746
|
walletProvider: this.walletProvider,
|
|
1742
1747
|
pinOrchestrator: this.pinOrchestrator
|
|
1743
|
-
}), this.walletLifecycleService = new
|
|
1748
|
+
}), this.walletLifecycleService = new Tr({
|
|
1744
1749
|
walletProvider: this.walletProvider,
|
|
1745
1750
|
pinOrchestrator: this.pinOrchestrator,
|
|
1746
1751
|
getUserId: () => this.userId,
|
|
1747
|
-
setActiveWallet: (p,
|
|
1748
|
-
}), this.migrationOrchestrator = new
|
|
1752
|
+
setActiveWallet: (p, v) => this.setActiveWallet(p, v)
|
|
1753
|
+
}), this.migrationOrchestrator = new Rr({
|
|
1749
1754
|
confirmation: this.confirmation,
|
|
1750
1755
|
walletProvider: this.walletProvider,
|
|
1751
1756
|
pinOrchestrator: this.pinOrchestrator,
|
|
1752
|
-
executeMigrate: (p,
|
|
1757
|
+
executeMigrate: (p, v) => this.migrateWalletUseCase.execute(p, v),
|
|
1753
1758
|
getLocale: () => this._config.locale,
|
|
1754
1759
|
getUserEmail: () => this.userEmail,
|
|
1755
1760
|
maskEmail: rt,
|
|
@@ -1759,29 +1764,29 @@ const Ie = class Ie extends dr {
|
|
|
1759
1764
|
var p;
|
|
1760
1765
|
return ((p = this._config.migration) == null ? void 0 : p.allowSkip) ?? !0;
|
|
1761
1766
|
}
|
|
1762
|
-
}), this.transactionLifecycleService = new
|
|
1767
|
+
}), this.transactionLifecycleService = new Or({
|
|
1763
1768
|
getActiveAddress: () => this.address,
|
|
1764
|
-
estimateGas: (p,
|
|
1769
|
+
estimateGas: (p, v) => this.estimateGas(p, v),
|
|
1765
1770
|
getBaseFeePerGas: (p) => this.getBaseFeePerGas(p),
|
|
1766
|
-
jsonRpcCall: (p,
|
|
1767
|
-
}), this.signatureVerifier = new
|
|
1771
|
+
jsonRpcCall: (p, v, S) => this.jsonRpc.call(p, v, S)
|
|
1772
|
+
}), this.signatureVerifier = new Pr(this.crypto), this.addressResolverService = new Lr({
|
|
1768
1773
|
walletProvider: this.walletProvider,
|
|
1769
1774
|
pinOrchestrator: this.pinOrchestrator,
|
|
1770
1775
|
getActiveAddress: () => this.address,
|
|
1771
1776
|
getActiveWalletIndex: () => this.activeWalletIndex,
|
|
1772
1777
|
getUserId: () => this.userId
|
|
1773
|
-
}), this.authGuardService = new
|
|
1778
|
+
}), this.authGuardService = new Dr({
|
|
1774
1779
|
isInitialized: () => this.initialized,
|
|
1775
1780
|
isAuthenticated: () => this.authenticated
|
|
1776
|
-
}), this.walletCreationService = new
|
|
1781
|
+
}), this.walletCreationService = new Mr({
|
|
1777
1782
|
walletProvider: this.walletProvider,
|
|
1778
1783
|
pinOrchestrator: this.pinOrchestrator,
|
|
1779
1784
|
migrationOrchestrator: this.migrationOrchestrator,
|
|
1780
1785
|
walletLifecycleService: this.walletLifecycleService,
|
|
1781
1786
|
getUserId: () => this.userId,
|
|
1782
1787
|
getProviderSub: () => this.providerSub,
|
|
1783
|
-
setActiveWallet: (p,
|
|
1784
|
-
}), this.sessionOrchestrator = new
|
|
1788
|
+
setActiveWallet: (p, v) => this.setActiveWallet(p, v)
|
|
1789
|
+
}), this.sessionOrchestrator = new kr({
|
|
1785
1790
|
ensureInitialized: () => this.ensureInitialized(),
|
|
1786
1791
|
getSessionSnapshot: () => ({
|
|
1787
1792
|
providerSub: this.providerSub,
|
|
@@ -1804,7 +1809,7 @@ const Ie = class Ie extends dr {
|
|
|
1804
1809
|
loadWalletAfterAuth: () => this.walletLifecycleService.loadWalletAfterAuth(),
|
|
1805
1810
|
getLocale: () => this._config.locale,
|
|
1806
1811
|
maskEmail: rt
|
|
1807
|
-
}), this.chainRegistry = u, this.jsonRpc = new
|
|
1812
|
+
}), this.chainRegistry = u, this.jsonRpc = new ur(u, i), this.signInUseCase = new pt(
|
|
1808
1813
|
this.internalConfig,
|
|
1809
1814
|
t,
|
|
1810
1815
|
n,
|
|
@@ -1812,7 +1817,7 @@ const Ie = class Ie extends dr {
|
|
|
1812
1817
|
i,
|
|
1813
1818
|
a,
|
|
1814
1819
|
c
|
|
1815
|
-
), this.signOutUseCase = new
|
|
1820
|
+
), this.signOutUseCase = new lr(this.internalConfig, t, c), this.migrateWalletUseCase = new dr(t, a), (x = a.setOnUnauthorized) == null || x.call(a, () => this.forceLogout()), (_ = a.setTokenRefresher) == null || _.call(
|
|
1816
1821
|
a,
|
|
1817
1822
|
() => this.signInUseCase.refreshAccessToken()
|
|
1818
1823
|
), e.autoDetectTheme && this._setupAutoDetectTheme();
|
|
@@ -1843,7 +1848,7 @@ const Ie = class Ie extends dr {
|
|
|
1843
1848
|
var s, t;
|
|
1844
1849
|
d.log("[CROSSx SDK] v2.0.2 초기화 중..."), this.confirmation.setMessages(xe(this._config.locale));
|
|
1845
1850
|
try {
|
|
1846
|
-
const n =
|
|
1851
|
+
const n = ls();
|
|
1847
1852
|
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
1853
|
const i = this._config.persistWalletPreference !== !1 ? await this.storage.get(
|
|
1849
1854
|
Ie.WALLET_PREF_KEY
|
|
@@ -1872,7 +1877,7 @@ const Ie = class Ie extends dr {
|
|
|
1872
1877
|
let s = e;
|
|
1873
1878
|
if (!(e != null && e.provider)) {
|
|
1874
1879
|
const t = await this.confirmation.showLoginSelector({
|
|
1875
|
-
connectOtherWallets:
|
|
1880
|
+
connectOtherWallets: rr(this._config)
|
|
1876
1881
|
});
|
|
1877
1882
|
if (t === null)
|
|
1878
1883
|
return { success: !1, error: "User cancelled login" };
|
|
@@ -2379,7 +2384,7 @@ const Ie = class Ie extends dr {
|
|
|
2379
2384
|
throw new g(h.AUTH_NOT_AUTHENTICATED, "사용자 ID를 찾을 수 없습니다");
|
|
2380
2385
|
if (!this.walletProvider.signTypedData)
|
|
2381
2386
|
throw new g(h.NOT_IMPLEMENTED, "signTypedData가 구현되어 있지 않습니다");
|
|
2382
|
-
|
|
2387
|
+
vr(e, s);
|
|
2383
2388
|
const n = await this.resolveAddress(t == null ? void 0 : t.index);
|
|
2384
2389
|
try {
|
|
2385
2390
|
const i = await this.signingOrchestrator.confirmAndExecuteWithPreparedPin({
|
|
@@ -2403,7 +2408,7 @@ const Ie = class Ie extends dr {
|
|
|
2403
2408
|
n.address
|
|
2404
2409
|
)
|
|
2405
2410
|
});
|
|
2406
|
-
return
|
|
2411
|
+
return br(i.signature), {
|
|
2407
2412
|
chainId: e,
|
|
2408
2413
|
signature: i.signature,
|
|
2409
2414
|
address: n.address
|
|
@@ -2481,7 +2486,7 @@ const Ie = class Ie extends dr {
|
|
|
2481
2486
|
a
|
|
2482
2487
|
)
|
|
2483
2488
|
});
|
|
2484
|
-
return
|
|
2489
|
+
return Sr(o.signature), {
|
|
2485
2490
|
chainId: e,
|
|
2486
2491
|
signedTx: o.signature,
|
|
2487
2492
|
txHash: o.txHash ?? ""
|
|
@@ -2580,7 +2585,7 @@ const Ie = class Ie extends dr {
|
|
|
2580
2585
|
* @param opts.timeoutMs 최대 대기 시간 (기본 60000ms)
|
|
2581
2586
|
*/
|
|
2582
2587
|
async waitForTxAndGetReceipt(e, s, t = {}) {
|
|
2583
|
-
const n = t.intervalMs ??
|
|
2588
|
+
const n = t.intervalMs ?? _r, i = xr, o = t.timeoutMs ?? Lt, a = Date.now() + o;
|
|
2584
2589
|
let c = n;
|
|
2585
2590
|
for (; Date.now() < a; ) {
|
|
2586
2591
|
const l = await this.getTransactionReceipt(e, s);
|
|
@@ -2608,12 +2613,12 @@ const Ie = class Ie extends dr {
|
|
|
2608
2613
|
* logger.log(receipt.status); // '0x1' | '0x0'
|
|
2609
2614
|
*/
|
|
2610
2615
|
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 ?? ((
|
|
2616
|
+
var v, S;
|
|
2617
|
+
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) ?? fr, l = i ?? ((S = this._config.receiptPolling) == null ? void 0 : S.timeoutMs) ?? Lt, u = st(e), f = s.from ?? "";
|
|
2613
2618
|
let x, _;
|
|
2614
2619
|
const p = this.waitForTxAndGetReceipt(a, e, { intervalMs: c, timeoutMs: l }).then((I) => {
|
|
2615
2620
|
x = I;
|
|
2616
|
-
const T = BigInt(I.gasUsed) * BigInt(I.effectiveGasPrice),
|
|
2621
|
+
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
2622
|
return {
|
|
2618
2623
|
chainId: e,
|
|
2619
2624
|
txHash: a,
|
|
@@ -2808,7 +2813,7 @@ const Ie = class Ie extends dr {
|
|
|
2808
2813
|
return { wei: "0x0", formatted: "0", chainId: e };
|
|
2809
2814
|
try {
|
|
2810
2815
|
const n = await this.jsonRpc.call("eth_getBalance", [s, "latest"], e) ?? "0x0";
|
|
2811
|
-
return { wei: n, formatted:
|
|
2816
|
+
return { wei: n, formatted: yr(n), chainId: e };
|
|
2812
2817
|
} catch (t) {
|
|
2813
2818
|
if (t instanceof g) throw t;
|
|
2814
2819
|
const n = t instanceof Error ? t.message : String(t);
|
|
@@ -2834,7 +2839,7 @@ const Ie = class Ie extends dr {
|
|
|
2834
2839
|
* const client = createWalletClient({ transport: custom(provider) });
|
|
2835
2840
|
*/
|
|
2836
2841
|
getProvider(e) {
|
|
2837
|
-
return this.ensureAuthenticated(), new
|
|
2842
|
+
return this.ensureAuthenticated(), new or(this, e);
|
|
2838
2843
|
}
|
|
2839
2844
|
/**
|
|
2840
2845
|
* 범용 JSON-RPC 요청 — 노드에 직접 연결.
|
|
@@ -2965,7 +2970,7 @@ const Ie = class Ie extends dr {
|
|
|
2965
2970
|
};
|
|
2966
2971
|
Ie.WALLET_PREF_KEY = "wallet_preference", Ie.OFFCHAIN_CHAIN_ID = "0";
|
|
2967
2972
|
let ft = Ie;
|
|
2968
|
-
class
|
|
2973
|
+
class $r {
|
|
2969
2974
|
constructor() {
|
|
2970
2975
|
this.prefix = "crossx_";
|
|
2971
2976
|
}
|
|
@@ -3002,8 +3007,8 @@ class Dr {
|
|
|
3002
3007
|
}
|
|
3003
3008
|
}
|
|
3004
3009
|
}
|
|
3005
|
-
const nt = "crossx-sdk",
|
|
3006
|
-
class
|
|
3010
|
+
const nt = "crossx-sdk", Br = 1, ue = "data", ve = "keys", Ge = "aes-primary", Ur = 12;
|
|
3011
|
+
class Ht {
|
|
3007
3012
|
constructor(e) {
|
|
3008
3013
|
this.db = null, this.cryptoKey = null, this.initPromise = null, this.dbName = `crossx-sdk-${e}`;
|
|
3009
3014
|
}
|
|
@@ -3012,10 +3017,10 @@ class Ut {
|
|
|
3012
3017
|
}
|
|
3013
3018
|
openDB(e = this.dbName) {
|
|
3014
3019
|
return new Promise((s, t) => {
|
|
3015
|
-
const n = indexedDB.open(e,
|
|
3020
|
+
const n = indexedDB.open(e, Br);
|
|
3016
3021
|
n.onupgradeneeded = () => {
|
|
3017
3022
|
const i = n.result;
|
|
3018
|
-
i.objectStoreNames.contains(ue) || i.createObjectStore(ue), i.objectStoreNames.contains(
|
|
3023
|
+
i.objectStoreNames.contains(ue) || i.createObjectStore(ue), i.objectStoreNames.contains(ve) || i.createObjectStore(ve);
|
|
3019
3024
|
}, n.onsuccess = () => s(n.result), n.onerror = () => t(n.error);
|
|
3020
3025
|
});
|
|
3021
3026
|
}
|
|
@@ -3045,7 +3050,7 @@ class Ut {
|
|
|
3045
3050
|
}
|
|
3046
3051
|
async init() {
|
|
3047
3052
|
this.db = await this.openDB();
|
|
3048
|
-
const e = await this.idbGet(
|
|
3053
|
+
const e = await this.idbGet(ve, Ge);
|
|
3049
3054
|
if (e) {
|
|
3050
3055
|
this.cryptoKey = e;
|
|
3051
3056
|
return;
|
|
@@ -3059,7 +3064,7 @@ class Ut {
|
|
|
3059
3064
|
{ name: "AES-GCM", length: 256 },
|
|
3060
3065
|
!1,
|
|
3061
3066
|
["encrypt", "decrypt"]
|
|
3062
|
-
), await this.idbPut(
|
|
3067
|
+
), await this.idbPut(ve, Ge, this.cryptoKey);
|
|
3063
3068
|
}
|
|
3064
3069
|
/**
|
|
3065
3070
|
* 레거시 DB('crossx-sdk')에서 projectId 스코프 DB로 암호키·데이터 마이그레이션.
|
|
@@ -3068,7 +3073,7 @@ class Ut {
|
|
|
3068
3073
|
async migrateFromLegacyDB() {
|
|
3069
3074
|
if (this.dbName === nt) return null;
|
|
3070
3075
|
try {
|
|
3071
|
-
const e = await this.openDB(nt), s = e.transaction([
|
|
3076
|
+
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
3077
|
t.onsuccess = () => l(t.result), t.onerror = () => u(t.error);
|
|
3073
3078
|
});
|
|
3074
3079
|
if (!n)
|
|
@@ -3081,7 +3086,7 @@ class Ut {
|
|
|
3081
3086
|
o.onsuccess = () => l(o.result), o.onerror = () => u(o.error);
|
|
3082
3087
|
})
|
|
3083
3088
|
]);
|
|
3084
|
-
e.close(), await this.idbPut(
|
|
3089
|
+
e.close(), await this.idbPut(ve, Ge, n);
|
|
3085
3090
|
for (let l = 0; l < c.length; l++)
|
|
3086
3091
|
await this.idbPut(ue, String(c[l]), a[l]);
|
|
3087
3092
|
return indexedDB.deleteDatabase(nt), d.log("[CROSSx] IndexedDB 레거시 DB 마이그레이션 완료"), n;
|
|
@@ -3090,7 +3095,7 @@ class Ut {
|
|
|
3090
3095
|
}
|
|
3091
3096
|
}
|
|
3092
3097
|
async encrypt(e) {
|
|
3093
|
-
const s = new Uint8Array(
|
|
3098
|
+
const s = new Uint8Array(Ur);
|
|
3094
3099
|
crypto.getRandomValues(s);
|
|
3095
3100
|
const t = new TextEncoder().encode(e), n = await crypto.subtle.encrypt(
|
|
3096
3101
|
{ name: "AES-GCM", iv: s },
|
|
@@ -3166,7 +3171,7 @@ function V(r, e, s = "") {
|
|
|
3166
3171
|
}
|
|
3167
3172
|
return r;
|
|
3168
3173
|
}
|
|
3169
|
-
function
|
|
3174
|
+
function hs(r) {
|
|
3170
3175
|
if (typeof r != "function" || typeof r.create != "function")
|
|
3171
3176
|
throw new Error("Hash must wrapped by utils.createHasher");
|
|
3172
3177
|
me(r.outputLen), me(r.blockLen);
|
|
@@ -3177,13 +3182,13 @@ function Le(r, e = !0) {
|
|
|
3177
3182
|
if (e && r.finished)
|
|
3178
3183
|
throw new Error("Hash#digest() has already been called");
|
|
3179
3184
|
}
|
|
3180
|
-
function
|
|
3185
|
+
function ps(r, e) {
|
|
3181
3186
|
V(r, void 0, "digestInto() output");
|
|
3182
3187
|
const s = e.outputLen;
|
|
3183
3188
|
if (r.length < s)
|
|
3184
3189
|
throw new Error('"digestInto() output" expected to be of length >=' + s);
|
|
3185
3190
|
}
|
|
3186
|
-
function
|
|
3191
|
+
function Hr(r) {
|
|
3187
3192
|
return new Uint32Array(r.buffer, r.byteOffset, Math.floor(r.byteLength / 4));
|
|
3188
3193
|
}
|
|
3189
3194
|
function De(...r) {
|
|
@@ -3196,26 +3201,26 @@ function it(r) {
|
|
|
3196
3201
|
function he(r, e) {
|
|
3197
3202
|
return r << 32 - e | r >>> e;
|
|
3198
3203
|
}
|
|
3199
|
-
const
|
|
3200
|
-
function
|
|
3204
|
+
const Fr = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
|
|
3205
|
+
function Wr(r) {
|
|
3201
3206
|
return r << 24 & 4278190080 | r << 8 & 16711680 | r >>> 8 & 65280 | r >>> 24 & 255;
|
|
3202
3207
|
}
|
|
3203
|
-
function
|
|
3208
|
+
function Gr(r) {
|
|
3204
3209
|
for (let e = 0; e < r.length; e++)
|
|
3205
|
-
r[e] =
|
|
3210
|
+
r[e] = Wr(r[e]);
|
|
3206
3211
|
return r;
|
|
3207
3212
|
}
|
|
3208
|
-
const
|
|
3213
|
+
const Ft = Fr ? (r) => r : Gr, fs = /* @ts-ignore */ typeof Uint8Array.from([]).toHex == "function" && typeof Uint8Array.fromHex == "function", qr = /* @__PURE__ */ Array.from({ length: 256 }, (r, e) => e.toString(16).padStart(2, "0"));
|
|
3209
3214
|
function Fe(r) {
|
|
3210
|
-
if (V(r),
|
|
3215
|
+
if (V(r), fs)
|
|
3211
3216
|
return r.toHex();
|
|
3212
3217
|
let e = "";
|
|
3213
3218
|
for (let s = 0; s < r.length; s++)
|
|
3214
|
-
e +=
|
|
3219
|
+
e += qr[r[s]];
|
|
3215
3220
|
return e;
|
|
3216
3221
|
}
|
|
3217
3222
|
const pe = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 };
|
|
3218
|
-
function
|
|
3223
|
+
function Wt(r) {
|
|
3219
3224
|
if (r >= pe._0 && r <= pe._9)
|
|
3220
3225
|
return r - pe._0;
|
|
3221
3226
|
if (r >= pe.A && r <= pe.F)
|
|
@@ -3226,14 +3231,14 @@ function Ft(r) {
|
|
|
3226
3231
|
function je(r) {
|
|
3227
3232
|
if (typeof r != "string")
|
|
3228
3233
|
throw new Error("hex string expected, got " + typeof r);
|
|
3229
|
-
if (
|
|
3234
|
+
if (fs)
|
|
3230
3235
|
return Uint8Array.fromHex(r);
|
|
3231
3236
|
const e = r.length, s = e / 2;
|
|
3232
3237
|
if (e % 2)
|
|
3233
3238
|
throw new Error("hex string expected, got unpadded hex of length " + e);
|
|
3234
3239
|
const t = new Uint8Array(s);
|
|
3235
3240
|
for (let n = 0, i = 0; n < s; n++, i += 2) {
|
|
3236
|
-
const o =
|
|
3241
|
+
const o = Wt(r.charCodeAt(i)), a = Wt(r.charCodeAt(i + 1));
|
|
3237
3242
|
if (o === void 0 || a === void 0) {
|
|
3238
3243
|
const c = r[i] + r[i + 1];
|
|
3239
3244
|
throw new Error('hex string expected, got non-hex character "' + c + '" at index ' + i);
|
|
@@ -3242,7 +3247,7 @@ function je(r) {
|
|
|
3242
3247
|
}
|
|
3243
3248
|
return t;
|
|
3244
3249
|
}
|
|
3245
|
-
function
|
|
3250
|
+
function Se(...r) {
|
|
3246
3251
|
let e = 0;
|
|
3247
3252
|
for (let t = 0; t < r.length; t++) {
|
|
3248
3253
|
const n = r[t];
|
|
@@ -3255,26 +3260,26 @@ function ve(...r) {
|
|
|
3255
3260
|
}
|
|
3256
3261
|
return s;
|
|
3257
3262
|
}
|
|
3258
|
-
function
|
|
3263
|
+
function _s(r, e = {}) {
|
|
3259
3264
|
const s = (n, i) => r(i).update(n).digest(), t = r(void 0);
|
|
3260
3265
|
return s.outputLen = t.outputLen, s.blockLen = t.blockLen, s.create = (n) => r(n), Object.assign(s, e), Object.freeze(s);
|
|
3261
3266
|
}
|
|
3262
|
-
function
|
|
3267
|
+
function xs(r = 32) {
|
|
3263
3268
|
const e = typeof globalThis == "object" ? globalThis.crypto : null;
|
|
3264
3269
|
if (typeof (e == null ? void 0 : e.getRandomValues) != "function")
|
|
3265
3270
|
throw new Error("crypto.getRandomValues must be defined");
|
|
3266
3271
|
return e.getRandomValues(new Uint8Array(r));
|
|
3267
3272
|
}
|
|
3268
|
-
const
|
|
3273
|
+
const Kr = (r) => ({
|
|
3269
3274
|
oid: Uint8Array.from([6, 9, 96, 134, 72, 1, 101, 3, 4, 2, r])
|
|
3270
3275
|
});
|
|
3271
|
-
function
|
|
3276
|
+
function Vr(r, e, s) {
|
|
3272
3277
|
return r & e ^ ~r & s;
|
|
3273
3278
|
}
|
|
3274
|
-
function
|
|
3279
|
+
function zr(r, e, s) {
|
|
3275
3280
|
return r & e ^ r & s ^ e & s;
|
|
3276
3281
|
}
|
|
3277
|
-
class
|
|
3282
|
+
class jr {
|
|
3278
3283
|
constructor(e, s, t, n) {
|
|
3279
3284
|
P(this, "blockLen");
|
|
3280
3285
|
P(this, "outputLen");
|
|
@@ -3305,7 +3310,7 @@ class Vr {
|
|
|
3305
3310
|
return this.length += e.length, this.roundClean(), this;
|
|
3306
3311
|
}
|
|
3307
3312
|
digestInto(e) {
|
|
3308
|
-
Le(this),
|
|
3313
|
+
Le(this), ps(e, this), this.finished = !0;
|
|
3309
3314
|
const { buffer: s, view: t, blockLen: n, isLE: i } = this;
|
|
3310
3315
|
let { pos: o } = this;
|
|
3311
3316
|
s[o++] = 128, De(this.buffer.subarray(o)), this.padOffset > n - o && (this.process(t, 0), o = 0);
|
|
@@ -3345,20 +3350,20 @@ const we = /* @__PURE__ */ Uint32Array.from([
|
|
|
3345
3350
|
2600822924,
|
|
3346
3351
|
528734635,
|
|
3347
3352
|
1541459225
|
|
3348
|
-
]), qe = /* @__PURE__ */ BigInt(2 ** 32 - 1),
|
|
3349
|
-
function
|
|
3350
|
-
return e ? { h: Number(r & qe), l: Number(r >>
|
|
3353
|
+
]), qe = /* @__PURE__ */ BigInt(2 ** 32 - 1), Gt = /* @__PURE__ */ BigInt(32);
|
|
3354
|
+
function Yr(r, e = !1) {
|
|
3355
|
+
return e ? { h: Number(r & qe), l: Number(r >> Gt & qe) } : { h: Number(r >> Gt & qe) | 0, l: Number(r & qe) | 0 };
|
|
3351
3356
|
}
|
|
3352
|
-
function
|
|
3357
|
+
function Xr(r, e = !1) {
|
|
3353
3358
|
const s = r.length;
|
|
3354
3359
|
let t = new Uint32Array(s), n = new Uint32Array(s);
|
|
3355
3360
|
for (let i = 0; i < s; i++) {
|
|
3356
|
-
const { h: o, l: a } =
|
|
3361
|
+
const { h: o, l: a } = Yr(r[i], e);
|
|
3357
3362
|
[t[i], n[i]] = [o, a];
|
|
3358
3363
|
}
|
|
3359
3364
|
return [t, n];
|
|
3360
3365
|
}
|
|
3361
|
-
const
|
|
3366
|
+
const Jr = (r, e, s) => r << s | e >>> 32 - s, Zr = (r, e, s) => e << s | r >>> 32 - s, Qr = (r, e, s) => e << s - 32 | r >>> 64 - s, en = (r, e, s) => r << s - 32 | e >>> 64 - s, tn = /* @__PURE__ */ Uint32Array.from([
|
|
3362
3367
|
1116352408,
|
|
3363
3368
|
1899447441,
|
|
3364
3369
|
3049323471,
|
|
@@ -3424,7 +3429,7 @@ const Yr = (r, e, s) => r << s | e >>> 32 - s, Xr = (r, e, s) => e << s | r >>>
|
|
|
3424
3429
|
3204031479,
|
|
3425
3430
|
3329325298
|
|
3426
3431
|
]), ye = /* @__PURE__ */ new Uint32Array(64);
|
|
3427
|
-
class
|
|
3432
|
+
class sn extends jr {
|
|
3428
3433
|
constructor(e) {
|
|
3429
3434
|
super(64, e, 8, !1);
|
|
3430
3435
|
}
|
|
@@ -3440,13 +3445,13 @@ class en extends Vr {
|
|
|
3440
3445
|
for (let f = 0; f < 16; f++, s += 4)
|
|
3441
3446
|
ye[f] = e.getUint32(s, !1);
|
|
3442
3447
|
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] =
|
|
3448
|
+
const x = ye[f - 15], _ = ye[f - 2], p = he(x, 7) ^ he(x, 18) ^ x >>> 3, v = he(_, 17) ^ he(_, 19) ^ _ >>> 10;
|
|
3449
|
+
ye[f] = v + ye[f - 7] + p + ye[f - 16] | 0;
|
|
3445
3450
|
}
|
|
3446
3451
|
let { A: t, B: n, C: i, D: o, E: a, F: c, G: l, H: u } = this;
|
|
3447
3452
|
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 = _ +
|
|
3453
|
+
const x = he(a, 6) ^ he(a, 11) ^ he(a, 25), _ = u + x + Vr(a, c, l) + tn[f] + ye[f] | 0, v = (he(t, 2) ^ he(t, 13) ^ he(t, 22)) + zr(t, n, i) | 0;
|
|
3454
|
+
u = l, l = c, c = a, a = o + _ | 0, o = i, i = n, n = t, t = _ + v | 0;
|
|
3450
3455
|
}
|
|
3451
3456
|
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
3457
|
}
|
|
@@ -3457,7 +3462,7 @@ class en extends Vr {
|
|
|
3457
3462
|
this.set(0, 0, 0, 0, 0, 0, 0, 0), De(this.buffer);
|
|
3458
3463
|
}
|
|
3459
3464
|
}
|
|
3460
|
-
class
|
|
3465
|
+
class rn extends sn {
|
|
3461
3466
|
constructor() {
|
|
3462
3467
|
super(32);
|
|
3463
3468
|
// We cannot use array here since array allows indexing by variable
|
|
@@ -3472,9 +3477,9 @@ class tn extends en {
|
|
|
3472
3477
|
P(this, "H", we[7] | 0);
|
|
3473
3478
|
}
|
|
3474
3479
|
}
|
|
3475
|
-
const
|
|
3476
|
-
() => new
|
|
3477
|
-
/* @__PURE__ */
|
|
3480
|
+
const nn = /* @__PURE__ */ _s(
|
|
3481
|
+
() => new rn(),
|
|
3482
|
+
/* @__PURE__ */ Kr(1)
|
|
3478
3483
|
);
|
|
3479
3484
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
3480
3485
|
const yt = /* @__PURE__ */ BigInt(0), _t = /* @__PURE__ */ BigInt(1);
|
|
@@ -3485,7 +3490,7 @@ function Ye(r, e = "") {
|
|
|
3485
3490
|
}
|
|
3486
3491
|
return r;
|
|
3487
3492
|
}
|
|
3488
|
-
function
|
|
3493
|
+
function gs(r) {
|
|
3489
3494
|
if (typeof r == "bigint") {
|
|
3490
3495
|
if (!ze(r))
|
|
3491
3496
|
throw new Error("positive bigint expected, got " + r);
|
|
@@ -3494,78 +3499,78 @@ function _s(r) {
|
|
|
3494
3499
|
return r;
|
|
3495
3500
|
}
|
|
3496
3501
|
function Ke(r) {
|
|
3497
|
-
const e =
|
|
3502
|
+
const e = gs(r).toString(16);
|
|
3498
3503
|
return e.length & 1 ? "0" + e : e;
|
|
3499
3504
|
}
|
|
3500
|
-
function
|
|
3505
|
+
function ms(r) {
|
|
3501
3506
|
if (typeof r != "string")
|
|
3502
3507
|
throw new Error("hex string expected, got " + typeof r);
|
|
3503
3508
|
return r === "" ? yt : BigInt("0x" + r);
|
|
3504
3509
|
}
|
|
3505
3510
|
function Qe(r) {
|
|
3506
|
-
return
|
|
3511
|
+
return ms(Fe(r));
|
|
3507
3512
|
}
|
|
3508
|
-
function
|
|
3509
|
-
return
|
|
3513
|
+
function ws(r) {
|
|
3514
|
+
return ms(Fe(on(V(r)).reverse()));
|
|
3510
3515
|
}
|
|
3511
3516
|
function bt(r, e) {
|
|
3512
|
-
me(e), r =
|
|
3517
|
+
me(e), r = gs(r);
|
|
3513
3518
|
const s = je(r.toString(16).padStart(e * 2, "0"));
|
|
3514
3519
|
if (s.length !== e)
|
|
3515
3520
|
throw new Error("number too large");
|
|
3516
3521
|
return s;
|
|
3517
3522
|
}
|
|
3518
|
-
function
|
|
3523
|
+
function ys(r, e) {
|
|
3519
3524
|
return bt(r, e).reverse();
|
|
3520
3525
|
}
|
|
3521
|
-
function
|
|
3526
|
+
function on(r) {
|
|
3522
3527
|
return Uint8Array.from(r);
|
|
3523
3528
|
}
|
|
3524
3529
|
const ze = (r) => typeof r == "bigint" && yt <= r;
|
|
3525
|
-
function
|
|
3530
|
+
function an(r, e, s) {
|
|
3526
3531
|
return ze(r) && ze(e) && ze(s) && e <= r && r < s;
|
|
3527
3532
|
}
|
|
3528
|
-
function
|
|
3529
|
-
if (!
|
|
3533
|
+
function cn(r, e, s, t) {
|
|
3534
|
+
if (!an(e, s, t))
|
|
3530
3535
|
throw new Error("expected valid " + r + ": " + s + " <= n < " + t + ", got " + e);
|
|
3531
3536
|
}
|
|
3532
|
-
function
|
|
3537
|
+
function ln(r) {
|
|
3533
3538
|
let e;
|
|
3534
3539
|
for (e = 0; r > yt; r >>= _t, e += 1)
|
|
3535
3540
|
;
|
|
3536
3541
|
return e;
|
|
3537
3542
|
}
|
|
3538
|
-
const
|
|
3539
|
-
function
|
|
3543
|
+
const St = (r) => (_t << BigInt(r)) - _t;
|
|
3544
|
+
function dn(r, e, s) {
|
|
3540
3545
|
if (me(r, "hashLen"), me(e, "qByteLen"), typeof s != "function")
|
|
3541
3546
|
throw new Error("hmacFn must be a function");
|
|
3542
|
-
const t = (
|
|
3547
|
+
const t = (S) => new Uint8Array(S), n = Uint8Array.of(), i = Uint8Array.of(0), o = Uint8Array.of(1), a = 1e3;
|
|
3543
3548
|
let c = t(r), l = t(r), u = 0;
|
|
3544
3549
|
const f = () => {
|
|
3545
3550
|
c.fill(1), l.fill(0), u = 0;
|
|
3546
|
-
}, x = (...
|
|
3547
|
-
l = x(i,
|
|
3551
|
+
}, x = (...S) => s(l, Se(c, ...S)), _ = (S = n) => {
|
|
3552
|
+
l = x(i, S), c = x(), S.length !== 0 && (l = x(o, S), c = x());
|
|
3548
3553
|
}, p = () => {
|
|
3549
3554
|
if (u++ >= a)
|
|
3550
3555
|
throw new Error("drbg: tried max amount of iterations");
|
|
3551
|
-
let
|
|
3556
|
+
let S = 0;
|
|
3552
3557
|
const I = [];
|
|
3553
|
-
for (;
|
|
3558
|
+
for (; S < e; ) {
|
|
3554
3559
|
c = x();
|
|
3555
3560
|
const T = c.slice();
|
|
3556
|
-
I.push(T),
|
|
3561
|
+
I.push(T), S += c.length;
|
|
3557
3562
|
}
|
|
3558
|
-
return
|
|
3563
|
+
return Se(...I);
|
|
3559
3564
|
};
|
|
3560
|
-
return (
|
|
3561
|
-
f(), _(
|
|
3565
|
+
return (S, I) => {
|
|
3566
|
+
f(), _(S);
|
|
3562
3567
|
let T;
|
|
3563
3568
|
for (; !(T = I(p())); )
|
|
3564
3569
|
_();
|
|
3565
3570
|
return f(), T;
|
|
3566
3571
|
};
|
|
3567
3572
|
}
|
|
3568
|
-
function
|
|
3573
|
+
function vt(r, e = {}, s = {}) {
|
|
3569
3574
|
if (!r || typeof r != "object")
|
|
3570
3575
|
throw new Error("expected valid options object");
|
|
3571
3576
|
function t(i, o, a) {
|
|
@@ -3579,7 +3584,7 @@ function St(r, e = {}, s = {}) {
|
|
|
3579
3584
|
const n = (i, o) => Object.entries(i).forEach(([a, c]) => t(a, c, o));
|
|
3580
3585
|
n(e, !1), n(s, !0);
|
|
3581
3586
|
}
|
|
3582
|
-
function
|
|
3587
|
+
function qt(r) {
|
|
3583
3588
|
const e = /* @__PURE__ */ new WeakMap();
|
|
3584
3589
|
return (s, ...t) => {
|
|
3585
3590
|
const n = e.get(s);
|
|
@@ -3590,7 +3595,7 @@ function Gt(r) {
|
|
|
3590
3595
|
};
|
|
3591
3596
|
}
|
|
3592
3597
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
3593
|
-
const re = /* @__PURE__ */ BigInt(0), te = /* @__PURE__ */ BigInt(1), ke = /* @__PURE__ */ BigInt(2),
|
|
3598
|
+
const re = /* @__PURE__ */ BigInt(0), te = /* @__PURE__ */ BigInt(1), ke = /* @__PURE__ */ BigInt(2), bs = /* @__PURE__ */ BigInt(3), Ss = /* @__PURE__ */ BigInt(4), vs = /* @__PURE__ */ BigInt(5), un = /* @__PURE__ */ BigInt(7), Es = /* @__PURE__ */ BigInt(8), hn = /* @__PURE__ */ BigInt(9), As = /* @__PURE__ */ BigInt(16);
|
|
3594
3599
|
function de(r, e) {
|
|
3595
3600
|
const s = r % e;
|
|
3596
3601
|
return s >= re ? s : e + s;
|
|
@@ -3601,7 +3606,7 @@ function ae(r, e, s) {
|
|
|
3601
3606
|
t *= t, t %= s;
|
|
3602
3607
|
return t;
|
|
3603
3608
|
}
|
|
3604
|
-
function
|
|
3609
|
+
function Kt(r, e) {
|
|
3605
3610
|
if (r === re)
|
|
3606
3611
|
throw new Error("invert: expected non-zero number");
|
|
3607
3612
|
if (e <= re)
|
|
@@ -3619,62 +3624,62 @@ function Et(r, e, s) {
|
|
|
3619
3624
|
if (!r.eql(r.sqr(e), s))
|
|
3620
3625
|
throw new Error("Cannot find square root");
|
|
3621
3626
|
}
|
|
3622
|
-
function
|
|
3623
|
-
const s = (r.ORDER + te) /
|
|
3627
|
+
function Is(r, e) {
|
|
3628
|
+
const s = (r.ORDER + te) / Ss, t = r.pow(e, s);
|
|
3624
3629
|
return Et(r, t, e), t;
|
|
3625
3630
|
}
|
|
3626
|
-
function
|
|
3627
|
-
const s = (r.ORDER -
|
|
3631
|
+
function pn(r, e) {
|
|
3632
|
+
const s = (r.ORDER - vs) / Es, 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
3633
|
return Et(r, a, e), a;
|
|
3629
3634
|
}
|
|
3630
|
-
function
|
|
3631
|
-
const e = et(r), s =
|
|
3635
|
+
function fn(r) {
|
|
3636
|
+
const e = et(r), s = ks(r), t = s(e, e.neg(e.ONE)), n = s(e, t), i = s(e, e.neg(t)), o = (r + un) / As;
|
|
3632
3637
|
return (a, c) => {
|
|
3633
3638
|
let l = a.pow(c, o), u = a.mul(l, t);
|
|
3634
3639
|
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
3640
|
l = a.cmov(l, u, _), u = a.cmov(x, f, p);
|
|
3636
|
-
const
|
|
3637
|
-
return Et(a,
|
|
3641
|
+
const v = a.eql(a.sqr(u), c), S = a.cmov(l, u, v);
|
|
3642
|
+
return Et(a, S, c), S;
|
|
3638
3643
|
};
|
|
3639
3644
|
}
|
|
3640
|
-
function
|
|
3641
|
-
if (r <
|
|
3645
|
+
function ks(r) {
|
|
3646
|
+
if (r < bs)
|
|
3642
3647
|
throw new Error("sqrt is not defined for small field");
|
|
3643
3648
|
let e = r - te, s = 0;
|
|
3644
3649
|
for (; e % ke === re; )
|
|
3645
3650
|
e /= ke, s++;
|
|
3646
3651
|
let t = ke;
|
|
3647
3652
|
const n = et(r);
|
|
3648
|
-
for (;
|
|
3653
|
+
for (; Vt(n, t) === 1; )
|
|
3649
3654
|
if (t++ > 1e3)
|
|
3650
3655
|
throw new Error("Cannot find square root: probably non-prime P");
|
|
3651
3656
|
if (s === 1)
|
|
3652
|
-
return
|
|
3657
|
+
return Is;
|
|
3653
3658
|
let i = n.pow(t, e);
|
|
3654
3659
|
const o = (e + te) / ke;
|
|
3655
3660
|
return function(c, l) {
|
|
3656
3661
|
if (c.is0(l))
|
|
3657
3662
|
return l;
|
|
3658
|
-
if (
|
|
3663
|
+
if (Vt(c, l) !== 1)
|
|
3659
3664
|
throw new Error("Cannot find square root");
|
|
3660
3665
|
let u = s, f = c.mul(c.ONE, i), x = c.pow(l, e), _ = c.pow(l, o);
|
|
3661
3666
|
for (; !c.eql(x, c.ONE); ) {
|
|
3662
3667
|
if (c.is0(x))
|
|
3663
3668
|
return c.ZERO;
|
|
3664
|
-
let p = 1,
|
|
3665
|
-
for (; !c.eql(
|
|
3666
|
-
if (p++,
|
|
3669
|
+
let p = 1, v = c.sqr(x);
|
|
3670
|
+
for (; !c.eql(v, c.ONE); )
|
|
3671
|
+
if (p++, v = c.sqr(v), p === u)
|
|
3667
3672
|
throw new Error("Cannot find square root");
|
|
3668
|
-
const
|
|
3673
|
+
const S = te << BigInt(u - p - 1), I = c.pow(f, S);
|
|
3669
3674
|
u = p, f = c.sqr(I), x = c.mul(x, f), _ = c.mul(_, I);
|
|
3670
3675
|
}
|
|
3671
3676
|
return _;
|
|
3672
3677
|
};
|
|
3673
3678
|
}
|
|
3674
|
-
function
|
|
3675
|
-
return r %
|
|
3679
|
+
function _n(r) {
|
|
3680
|
+
return r % Ss === bs ? Is : r % Es === vs ? pn : r % As === hn ? fn(r) : ks(r);
|
|
3676
3681
|
}
|
|
3677
|
-
const
|
|
3682
|
+
const xn = [
|
|
3678
3683
|
"create",
|
|
3679
3684
|
"isValid",
|
|
3680
3685
|
"is0",
|
|
@@ -3693,15 +3698,15 @@ const fn = [
|
|
|
3693
3698
|
"mulN",
|
|
3694
3699
|
"sqrN"
|
|
3695
3700
|
];
|
|
3696
|
-
function
|
|
3701
|
+
function gn(r) {
|
|
3697
3702
|
const e = {
|
|
3698
3703
|
ORDER: "bigint",
|
|
3699
3704
|
BYTES: "number",
|
|
3700
3705
|
BITS: "number"
|
|
3701
|
-
}, s =
|
|
3702
|
-
return
|
|
3706
|
+
}, s = xn.reduce((t, n) => (t[n] = "function", t), e);
|
|
3707
|
+
return vt(r, s), r;
|
|
3703
3708
|
}
|
|
3704
|
-
function
|
|
3709
|
+
function mn(r, e, s) {
|
|
3705
3710
|
if (s < re)
|
|
3706
3711
|
throw new Error("invalid exponent, negatives unsupported");
|
|
3707
3712
|
if (s === re)
|
|
@@ -3713,22 +3718,22 @@ function xn(r, e, s) {
|
|
|
3713
3718
|
s & te && (t = r.mul(t, n)), n = r.sqr(n), s >>= te;
|
|
3714
3719
|
return t;
|
|
3715
3720
|
}
|
|
3716
|
-
function
|
|
3721
|
+
function Ts(r, e, s = !1) {
|
|
3717
3722
|
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
3723
|
return e.reduceRight((o, a, c) => r.is0(a) ? o : (t[c] = r.mul(o, t[c]), r.mul(o, a)), i), t;
|
|
3719
3724
|
}
|
|
3720
|
-
function
|
|
3725
|
+
function Vt(r, e) {
|
|
3721
3726
|
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
3727
|
if (!n && !i && !o)
|
|
3723
3728
|
throw new Error("invalid Legendre symbol result");
|
|
3724
3729
|
return n ? 1 : i ? 0 : -1;
|
|
3725
3730
|
}
|
|
3726
|
-
function
|
|
3731
|
+
function wn(r, e) {
|
|
3727
3732
|
e !== void 0 && me(e);
|
|
3728
3733
|
const s = e !== void 0 ? e : r.toString(2).length, t = Math.ceil(s / 8);
|
|
3729
3734
|
return { nBitLength: s, nByteLength: t };
|
|
3730
3735
|
}
|
|
3731
|
-
class
|
|
3736
|
+
class yn {
|
|
3732
3737
|
constructor(e, s = {}) {
|
|
3733
3738
|
P(this, "ORDER");
|
|
3734
3739
|
P(this, "BITS");
|
|
@@ -3745,7 +3750,7 @@ class mn {
|
|
|
3745
3750
|
throw new Error("invalid field: expected ORDER > 0, got " + e);
|
|
3746
3751
|
let t;
|
|
3747
3752
|
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 } =
|
|
3753
|
+
const { nBitLength: n, nByteLength: i } = wn(e, t);
|
|
3749
3754
|
if (i > 2048)
|
|
3750
3755
|
throw new Error("invalid field: expected ORDER of <= 2048 bytes");
|
|
3751
3756
|
this.ORDER = e, this.BITS = n, this.BYTES = i, this._sqrt = void 0, Object.preventExtensions(this);
|
|
@@ -3787,10 +3792,10 @@ class mn {
|
|
|
3787
3792
|
return de(e * s, this.ORDER);
|
|
3788
3793
|
}
|
|
3789
3794
|
pow(e, s) {
|
|
3790
|
-
return
|
|
3795
|
+
return mn(this, e, s);
|
|
3791
3796
|
}
|
|
3792
3797
|
div(e, s) {
|
|
3793
|
-
return de(e *
|
|
3798
|
+
return de(e * Kt(s, this.ORDER), this.ORDER);
|
|
3794
3799
|
}
|
|
3795
3800
|
// Same as above, but doesn't normalize
|
|
3796
3801
|
sqrN(e) {
|
|
@@ -3806,13 +3811,13 @@ class mn {
|
|
|
3806
3811
|
return e * s;
|
|
3807
3812
|
}
|
|
3808
3813
|
inv(e) {
|
|
3809
|
-
return
|
|
3814
|
+
return Kt(e, this.ORDER);
|
|
3810
3815
|
}
|
|
3811
3816
|
sqrt(e) {
|
|
3812
|
-
return this._sqrt || (this._sqrt =
|
|
3817
|
+
return this._sqrt || (this._sqrt = _n(this.ORDER)), this._sqrt(this, e);
|
|
3813
3818
|
}
|
|
3814
3819
|
toBytes(e) {
|
|
3815
|
-
return this.isLE ?
|
|
3820
|
+
return this.isLE ? ys(e, this.BYTES) : bt(e, this.BYTES);
|
|
3816
3821
|
}
|
|
3817
3822
|
fromBytes(e, s = !1) {
|
|
3818
3823
|
V(e);
|
|
@@ -3825,14 +3830,14 @@ class mn {
|
|
|
3825
3830
|
}
|
|
3826
3831
|
if (e.length !== n)
|
|
3827
3832
|
throw new Error("Field.fromBytes: expected " + n + " bytes, got " + e.length);
|
|
3828
|
-
let c = i ?
|
|
3833
|
+
let c = i ? ws(e) : Qe(e);
|
|
3829
3834
|
if (a && (c = de(c, o)), !s && !this.isValid(c))
|
|
3830
3835
|
throw new Error("invalid field element: outside of range 0..ORDER");
|
|
3831
3836
|
return c;
|
|
3832
3837
|
}
|
|
3833
3838
|
// TODO: we don't need it here, move out to separate fn
|
|
3834
3839
|
invertBatch(e) {
|
|
3835
|
-
return
|
|
3840
|
+
return Ts(this, e);
|
|
3836
3841
|
}
|
|
3837
3842
|
// We can't move this out because Fp6, Fp12 implement it
|
|
3838
3843
|
// and it's unclear what to return in there.
|
|
@@ -3841,61 +3846,61 @@ class mn {
|
|
|
3841
3846
|
}
|
|
3842
3847
|
}
|
|
3843
3848
|
function et(r, e = {}) {
|
|
3844
|
-
return new
|
|
3849
|
+
return new yn(r, e);
|
|
3845
3850
|
}
|
|
3846
|
-
function
|
|
3851
|
+
function Rs(r) {
|
|
3847
3852
|
if (typeof r != "bigint")
|
|
3848
3853
|
throw new Error("field order must be bigint");
|
|
3849
3854
|
const e = r.toString(2).length;
|
|
3850
3855
|
return Math.ceil(e / 8);
|
|
3851
3856
|
}
|
|
3852
|
-
function
|
|
3853
|
-
const e =
|
|
3857
|
+
function Os(r) {
|
|
3858
|
+
const e = Rs(r);
|
|
3854
3859
|
return e + Math.ceil(e / 2);
|
|
3855
3860
|
}
|
|
3856
|
-
function
|
|
3861
|
+
function bn(r, e, s = !1) {
|
|
3857
3862
|
V(r);
|
|
3858
|
-
const t = r.length, n =
|
|
3863
|
+
const t = r.length, n = Rs(e), i = Os(e);
|
|
3859
3864
|
if (t < 16 || t < i || t > 1024)
|
|
3860
3865
|
throw new Error("expected " + i + "-1024 bytes of input, got " + t);
|
|
3861
|
-
const o = s ?
|
|
3862
|
-
return s ?
|
|
3866
|
+
const o = s ? ws(r) : Qe(r), a = de(o, e - te) + te;
|
|
3867
|
+
return s ? ys(a, n) : bt(a, n);
|
|
3863
3868
|
}
|
|
3864
3869
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
3865
|
-
const
|
|
3870
|
+
const Me = /* @__PURE__ */ BigInt(0), Te = /* @__PURE__ */ BigInt(1);
|
|
3866
3871
|
function Xe(r, e) {
|
|
3867
3872
|
const s = e.negate();
|
|
3868
3873
|
return r ? s : e;
|
|
3869
3874
|
}
|
|
3870
|
-
function
|
|
3871
|
-
const s =
|
|
3875
|
+
function zt(r, e) {
|
|
3876
|
+
const s = Ts(r.Fp, e.map((t) => t.Z));
|
|
3872
3877
|
return e.map((t, n) => r.fromAffine(t.toAffine(s[n])));
|
|
3873
3878
|
}
|
|
3874
|
-
function
|
|
3879
|
+
function Ps(r, e) {
|
|
3875
3880
|
if (!Number.isSafeInteger(r) || r <= 0 || r > e)
|
|
3876
3881
|
throw new Error("invalid window size, expected [1.." + e + "], got W=" + r);
|
|
3877
3882
|
}
|
|
3878
3883
|
function ot(r, e) {
|
|
3879
|
-
|
|
3880
|
-
const s = Math.ceil(e / r) + 1, t = 2 ** (r - 1), n = 2 ** r, i =
|
|
3884
|
+
Ps(r, e);
|
|
3885
|
+
const s = Math.ceil(e / r) + 1, t = 2 ** (r - 1), n = 2 ** r, i = St(r), o = BigInt(r);
|
|
3881
3886
|
return { windows: s, windowSize: t, mask: i, maxNumber: n, shiftBy: o };
|
|
3882
3887
|
}
|
|
3883
|
-
function
|
|
3888
|
+
function jt(r, e, s) {
|
|
3884
3889
|
const { windowSize: t, mask: n, maxNumber: i, shiftBy: o } = s;
|
|
3885
3890
|
let a = Number(r & n), c = r >> o;
|
|
3886
3891
|
a > t && (a -= i, c += Te);
|
|
3887
3892
|
const l = e * t, u = l + Math.abs(a) - 1, f = a === 0, x = a < 0, _ = e % 2 !== 0;
|
|
3888
3893
|
return { nextN: c, offset: u, isZero: f, isNeg: x, isNegF: _, offsetF: l };
|
|
3889
3894
|
}
|
|
3890
|
-
const at = /* @__PURE__ */ new WeakMap(),
|
|
3895
|
+
const at = /* @__PURE__ */ new WeakMap(), Cs = /* @__PURE__ */ new WeakMap();
|
|
3891
3896
|
function ct(r) {
|
|
3892
|
-
return
|
|
3897
|
+
return Cs.get(r) || 1;
|
|
3893
3898
|
}
|
|
3894
|
-
function
|
|
3895
|
-
if (r !==
|
|
3899
|
+
function Yt(r) {
|
|
3900
|
+
if (r !== Me)
|
|
3896
3901
|
throw new Error("invalid wNAF");
|
|
3897
3902
|
}
|
|
3898
|
-
class
|
|
3903
|
+
class Sn {
|
|
3899
3904
|
// Parametrized with a given Point class (not individual point)
|
|
3900
3905
|
constructor(e, s) {
|
|
3901
3906
|
P(this, "BASE");
|
|
@@ -3907,7 +3912,7 @@ class yn {
|
|
|
3907
3912
|
// non-const time multiplication ladder
|
|
3908
3913
|
_unsafeLadder(e, s, t = this.ZERO) {
|
|
3909
3914
|
let n = e;
|
|
3910
|
-
for (; s >
|
|
3915
|
+
for (; s > Me; )
|
|
3911
3916
|
s & Te && (t = t.add(n)), n = n.double(), s >>= Te;
|
|
3912
3917
|
return t;
|
|
3913
3918
|
}
|
|
@@ -3946,10 +3951,10 @@ class yn {
|
|
|
3946
3951
|
let n = this.ZERO, i = this.BASE;
|
|
3947
3952
|
const o = ot(e, this.bits);
|
|
3948
3953
|
for (let a = 0; a < o.windows; a++) {
|
|
3949
|
-
const { nextN: c, offset: l, isZero: u, isNeg: f, isNegF: x, offsetF: _ } =
|
|
3954
|
+
const { nextN: c, offset: l, isZero: u, isNeg: f, isNegF: x, offsetF: _ } = jt(t, a, o);
|
|
3950
3955
|
t = c, u ? i = i.add(Xe(x, s[_])) : n = n.add(Xe(f, s[l]));
|
|
3951
3956
|
}
|
|
3952
|
-
return
|
|
3957
|
+
return Yt(t), { p: n, f: i };
|
|
3953
3958
|
}
|
|
3954
3959
|
/**
|
|
3955
3960
|
* Implements ec unsafe (non const-time) multiplication using precomputed tables and w-ary non-adjacent form.
|
|
@@ -3958,14 +3963,14 @@ class yn {
|
|
|
3958
3963
|
*/
|
|
3959
3964
|
wNAFUnsafe(e, s, t, n = this.ZERO) {
|
|
3960
3965
|
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 } =
|
|
3966
|
+
for (let o = 0; o < i.windows && t !== Me; o++) {
|
|
3967
|
+
const { nextN: a, offset: c, isZero: l, isNeg: u } = jt(t, o, i);
|
|
3963
3968
|
if (t = a, !l) {
|
|
3964
3969
|
const f = s[c];
|
|
3965
3970
|
n = n.add(u ? f.negate() : f);
|
|
3966
3971
|
}
|
|
3967
3972
|
}
|
|
3968
|
-
return
|
|
3973
|
+
return Yt(t), n;
|
|
3969
3974
|
}
|
|
3970
3975
|
getPrecomputes(e, s, t) {
|
|
3971
3976
|
let n = at.get(s);
|
|
@@ -3983,47 +3988,47 @@ class yn {
|
|
|
3983
3988
|
// using windowed method. This specifies window size and
|
|
3984
3989
|
// stores precomputed values. Usually only base point would be precomputed.
|
|
3985
3990
|
createCache(e, s) {
|
|
3986
|
-
|
|
3991
|
+
Ps(s, this.bits), Cs.set(e, s), at.delete(e);
|
|
3987
3992
|
}
|
|
3988
3993
|
hasCache(e) {
|
|
3989
3994
|
return ct(e) !== 1;
|
|
3990
3995
|
}
|
|
3991
3996
|
}
|
|
3992
|
-
function
|
|
3997
|
+
function vn(r, e, s, t) {
|
|
3993
3998
|
let n = e, i = r.ZERO, o = r.ZERO;
|
|
3994
|
-
for (; s >
|
|
3999
|
+
for (; s > Me || t > Me; )
|
|
3995
4000
|
s & Te && (i = i.add(n)), t & Te && (o = o.add(n)), n = n.double(), s >>= Te, t >>= Te;
|
|
3996
4001
|
return { p1: i, p2: o };
|
|
3997
4002
|
}
|
|
3998
|
-
function
|
|
4003
|
+
function Xt(r, e, s) {
|
|
3999
4004
|
if (e) {
|
|
4000
4005
|
if (e.ORDER !== r)
|
|
4001
4006
|
throw new Error("Field.ORDER must match order: Fp == p, Fn == n");
|
|
4002
|
-
return
|
|
4007
|
+
return gn(e), e;
|
|
4003
4008
|
} else
|
|
4004
4009
|
return et(r, { isLE: s });
|
|
4005
4010
|
}
|
|
4006
|
-
function
|
|
4011
|
+
function En(r, e, s = {}, t) {
|
|
4007
4012
|
if (t === void 0 && (t = r === "edwards"), !e || typeof e != "object")
|
|
4008
4013
|
throw new Error(`expected valid ${r} CURVE object`);
|
|
4009
4014
|
for (const c of ["p", "n", "h"]) {
|
|
4010
4015
|
const l = e[c];
|
|
4011
|
-
if (!(typeof l == "bigint" && l >
|
|
4016
|
+
if (!(typeof l == "bigint" && l > Me))
|
|
4012
4017
|
throw new Error(`CURVE.${c} must be positive bigint`);
|
|
4013
4018
|
}
|
|
4014
|
-
const n =
|
|
4019
|
+
const n = Xt(e.p, s.Fp, t), i = Xt(e.n, s.Fn, t), a = ["Gx", "Gy", "a", "b"];
|
|
4015
4020
|
for (const c of a)
|
|
4016
4021
|
if (!n.isValid(e[c]))
|
|
4017
4022
|
throw new Error(`CURVE.${c} must be valid field element of CURVE.Fp`);
|
|
4018
4023
|
return e = Object.freeze(Object.assign({}, e)), { CURVE: e, Fp: n, Fn: i };
|
|
4019
4024
|
}
|
|
4020
|
-
function
|
|
4025
|
+
function An(r, e) {
|
|
4021
4026
|
return function(t) {
|
|
4022
4027
|
const n = r(t);
|
|
4023
4028
|
return { secretKey: n, publicKey: e(n) };
|
|
4024
4029
|
};
|
|
4025
4030
|
}
|
|
4026
|
-
class
|
|
4031
|
+
class Ns {
|
|
4027
4032
|
constructor(e, s) {
|
|
4028
4033
|
P(this, "oHash");
|
|
4029
4034
|
P(this, "iHash");
|
|
@@ -4031,7 +4036,7 @@ class Ps {
|
|
|
4031
4036
|
P(this, "outputLen");
|
|
4032
4037
|
P(this, "finished", !1);
|
|
4033
4038
|
P(this, "destroyed", !1);
|
|
4034
|
-
if (
|
|
4039
|
+
if (hs(e), V(s, void 0, "key"), this.iHash = e.create(), typeof this.iHash.update != "function")
|
|
4035
4040
|
throw new Error("Expected instance of class which extends utils.Hash");
|
|
4036
4041
|
this.blockLen = this.iHash.blockLen, this.outputLen = this.iHash.outputLen;
|
|
4037
4042
|
const t = this.blockLen, n = new Uint8Array(t);
|
|
@@ -4065,16 +4070,16 @@ class Ps {
|
|
|
4065
4070
|
this.destroyed = !0, this.oHash.destroy(), this.iHash.destroy();
|
|
4066
4071
|
}
|
|
4067
4072
|
}
|
|
4068
|
-
const
|
|
4069
|
-
|
|
4073
|
+
const Ls = (r, e, s) => new Ns(r, e).update(s).digest();
|
|
4074
|
+
Ls.create = (r, e) => new Ns(r, e);
|
|
4070
4075
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
4071
|
-
const
|
|
4072
|
-
function
|
|
4073
|
-
const [[t, n], [i, o]] = e, a =
|
|
4076
|
+
const Jt = (r, e) => (r + (r >= 0 ? e : -e) / Ds) / e;
|
|
4077
|
+
function In(r, e, s) {
|
|
4078
|
+
const [[t, n], [i, o]] = e, a = Jt(o * r, s), c = Jt(-n * r, s);
|
|
4074
4079
|
let l = r - a * t - c * i, u = -a * n - c * o;
|
|
4075
4080
|
const f = l < _e, x = u < _e;
|
|
4076
4081
|
f && (l = -l), x && (u = -u);
|
|
4077
|
-
const _ =
|
|
4082
|
+
const _ = St(Math.ceil(ln(s) / 2)) + Ne;
|
|
4078
4083
|
if (l < _e || l >= _ || u < _e || u >= _)
|
|
4079
4084
|
throw new Error("splitScalar (endomorphism): failed, k=" + r);
|
|
4080
4085
|
return { k1neg: f, k1: l, k2neg: x, k2: u };
|
|
@@ -4090,14 +4095,14 @@ function lt(r, e) {
|
|
|
4090
4095
|
s[t] = r[t] === void 0 ? e[t] : r[t];
|
|
4091
4096
|
return Ye(s.lowS, "lowS"), Ye(s.prehash, "prehash"), s.format !== void 0 && xt(s.format), s;
|
|
4092
4097
|
}
|
|
4093
|
-
class
|
|
4098
|
+
class kn extends Error {
|
|
4094
4099
|
constructor(e = "") {
|
|
4095
4100
|
super(e);
|
|
4096
4101
|
}
|
|
4097
4102
|
}
|
|
4098
4103
|
const be = {
|
|
4099
4104
|
// asn.1 DER encoding utils
|
|
4100
|
-
Err:
|
|
4105
|
+
Err: kn,
|
|
4101
4106
|
// Basic building block is TLV (Tag-Length-Value)
|
|
4102
4107
|
_tlv: {
|
|
4103
4108
|
encode: (r, e) => {
|
|
@@ -4182,12 +4187,12 @@ const be = {
|
|
|
4182
4187
|
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
4188
|
return e.encode(48, i);
|
|
4184
4189
|
}
|
|
4185
|
-
}, _e = BigInt(0), Ne = BigInt(1),
|
|
4186
|
-
function
|
|
4187
|
-
const s =
|
|
4190
|
+
}, _e = BigInt(0), Ne = BigInt(1), Ds = BigInt(2), Ve = BigInt(3), Tn = BigInt(4);
|
|
4191
|
+
function Rn(r, e = {}) {
|
|
4192
|
+
const s = En("weierstrass", r, e), { Fp: t, Fn: n } = s;
|
|
4188
4193
|
let i = s.CURVE;
|
|
4189
4194
|
const { h: o, n: a } = i;
|
|
4190
|
-
|
|
4195
|
+
vt(e, {}, {
|
|
4191
4196
|
allowInfinityPoint: "boolean",
|
|
4192
4197
|
clearCofactor: "function",
|
|
4193
4198
|
isTorsionFree: "function",
|
|
@@ -4198,103 +4203,103 @@ function kn(r, e = {}) {
|
|
|
4198
4203
|
const { endo: c } = e;
|
|
4199
4204
|
if (c && (!t.is0(i.a) || typeof c.beta != "bigint" || !Array.isArray(c.basises)))
|
|
4200
4205
|
throw new Error('invalid endo: expected "beta": bigint and "basises": array');
|
|
4201
|
-
const l =
|
|
4206
|
+
const l = $s(t, n);
|
|
4202
4207
|
function u() {
|
|
4203
4208
|
if (!t.isOdd)
|
|
4204
4209
|
throw new Error("compression is not supported: Field does not have .isOdd()");
|
|
4205
4210
|
}
|
|
4206
|
-
function f(
|
|
4207
|
-
const { x: k, y: O } = m.toAffine(),
|
|
4211
|
+
function f($, m, w) {
|
|
4212
|
+
const { x: k, y: O } = m.toAffine(), M = t.toBytes(k);
|
|
4208
4213
|
if (Ye(w, "isCompressed"), w) {
|
|
4209
4214
|
u();
|
|
4210
4215
|
const y = !t.isOdd(O);
|
|
4211
|
-
return
|
|
4216
|
+
return Se(Ms(y), M);
|
|
4212
4217
|
} else
|
|
4213
|
-
return
|
|
4218
|
+
return Se(Uint8Array.of(4), M, t.toBytes(O));
|
|
4214
4219
|
}
|
|
4215
|
-
function x(
|
|
4216
|
-
V(
|
|
4217
|
-
const { publicKey: m, publicKeyUncompressed: w } = l, k =
|
|
4220
|
+
function x($) {
|
|
4221
|
+
V($, void 0, "Point");
|
|
4222
|
+
const { publicKey: m, publicKeyUncompressed: w } = l, k = $.length, O = $[0], M = $.subarray(1);
|
|
4218
4223
|
if (k === m && (O === 2 || O === 3)) {
|
|
4219
|
-
const y = t.fromBytes(
|
|
4224
|
+
const y = t.fromBytes(M);
|
|
4220
4225
|
if (!t.isValid(y))
|
|
4221
4226
|
throw new Error("bad point: is not on curve, wrong x");
|
|
4222
|
-
const b =
|
|
4227
|
+
const b = v(y);
|
|
4223
4228
|
let E;
|
|
4224
4229
|
try {
|
|
4225
4230
|
E = t.sqrt(b);
|
|
4226
4231
|
} catch (F) {
|
|
4227
|
-
const
|
|
4228
|
-
throw new Error("bad point: is not on curve, sqrt error" +
|
|
4232
|
+
const U = F instanceof Error ? ": " + F.message : "";
|
|
4233
|
+
throw new Error("bad point: is not on curve, sqrt error" + U);
|
|
4229
4234
|
}
|
|
4230
4235
|
u();
|
|
4231
4236
|
const A = t.isOdd(E);
|
|
4232
4237
|
return (O & 1) === 1 !== A && (E = t.neg(E)), { x: y, y: E };
|
|
4233
4238
|
} else if (k === w && O === 4) {
|
|
4234
|
-
const y = t.BYTES, b = t.fromBytes(
|
|
4235
|
-
if (!
|
|
4239
|
+
const y = t.BYTES, b = t.fromBytes(M.subarray(0, y)), E = t.fromBytes(M.subarray(y, y * 2));
|
|
4240
|
+
if (!S(b, E))
|
|
4236
4241
|
throw new Error("bad point: is not on curve");
|
|
4237
4242
|
return { x: b, y: E };
|
|
4238
4243
|
} else
|
|
4239
4244
|
throw new Error(`bad point: got length ${k}, expected compressed=${m} or uncompressed=${w}`);
|
|
4240
4245
|
}
|
|
4241
4246
|
const _ = e.toBytes || f, p = e.fromBytes || x;
|
|
4242
|
-
function
|
|
4243
|
-
const m = t.sqr(
|
|
4244
|
-
return t.add(t.add(w, t.mul(
|
|
4247
|
+
function v($) {
|
|
4248
|
+
const m = t.sqr($), w = t.mul(m, $);
|
|
4249
|
+
return t.add(t.add(w, t.mul($, i.a)), i.b);
|
|
4245
4250
|
}
|
|
4246
|
-
function
|
|
4247
|
-
const w = t.sqr(m), k =
|
|
4251
|
+
function S($, m) {
|
|
4252
|
+
const w = t.sqr(m), k = v($);
|
|
4248
4253
|
return t.eql(w, k);
|
|
4249
4254
|
}
|
|
4250
|
-
if (!
|
|
4255
|
+
if (!S(i.Gx, i.Gy))
|
|
4251
4256
|
throw new Error("bad curve params: generator point");
|
|
4252
|
-
const I = t.mul(t.pow(i.a, Ve),
|
|
4257
|
+
const I = t.mul(t.pow(i.a, Ve), Tn), T = t.mul(t.sqr(i.b), BigInt(27));
|
|
4253
4258
|
if (t.is0(t.add(I, T)))
|
|
4254
4259
|
throw new Error("bad curve params: a or b");
|
|
4255
|
-
function
|
|
4260
|
+
function B($, m, w = !1) {
|
|
4256
4261
|
if (!t.isValid(m) || w && t.is0(m))
|
|
4257
|
-
throw new Error(`bad point coordinate ${
|
|
4262
|
+
throw new Error(`bad point coordinate ${$}`);
|
|
4258
4263
|
return m;
|
|
4259
4264
|
}
|
|
4260
|
-
function D(
|
|
4261
|
-
if (!(
|
|
4265
|
+
function D($) {
|
|
4266
|
+
if (!($ instanceof X))
|
|
4262
4267
|
throw new Error("Weierstrass Point expected");
|
|
4263
4268
|
}
|
|
4264
|
-
function K(
|
|
4269
|
+
function K($) {
|
|
4265
4270
|
if (!c || !c.basises)
|
|
4266
4271
|
throw new Error("no endo");
|
|
4267
|
-
return
|
|
4272
|
+
return In($, c.basises, n.ORDER);
|
|
4268
4273
|
}
|
|
4269
|
-
const q =
|
|
4270
|
-
const { X: w, Y: k, Z: O } =
|
|
4274
|
+
const q = qt(($, m) => {
|
|
4275
|
+
const { X: w, Y: k, Z: O } = $;
|
|
4271
4276
|
if (t.eql(O, t.ONE))
|
|
4272
4277
|
return { x: w, y: k };
|
|
4273
|
-
const
|
|
4274
|
-
m == null && (m =
|
|
4278
|
+
const M = $.is0();
|
|
4279
|
+
m == null && (m = M ? t.ONE : t.inv(O));
|
|
4275
4280
|
const y = t.mul(w, m), b = t.mul(k, m), E = t.mul(O, m);
|
|
4276
|
-
if (
|
|
4281
|
+
if (M)
|
|
4277
4282
|
return { x: t.ZERO, y: t.ZERO };
|
|
4278
4283
|
if (!t.eql(E, t.ONE))
|
|
4279
4284
|
throw new Error("invZ was invalid");
|
|
4280
4285
|
return { x: y, y: b };
|
|
4281
|
-
}), Z =
|
|
4282
|
-
if (
|
|
4283
|
-
if (e.allowInfinityPoint && !t.is0(
|
|
4286
|
+
}), Z = qt(($) => {
|
|
4287
|
+
if ($.is0()) {
|
|
4288
|
+
if (e.allowInfinityPoint && !t.is0($.Y))
|
|
4284
4289
|
return;
|
|
4285
4290
|
throw new Error("bad point: ZERO");
|
|
4286
4291
|
}
|
|
4287
|
-
const { x: m, y: w } =
|
|
4292
|
+
const { x: m, y: w } = $.toAffine();
|
|
4288
4293
|
if (!t.isValid(m) || !t.isValid(w))
|
|
4289
4294
|
throw new Error("bad point: x or y not field elements");
|
|
4290
|
-
if (!
|
|
4295
|
+
if (!S(m, w))
|
|
4291
4296
|
throw new Error("bad point: equation left != right");
|
|
4292
|
-
if (
|
|
4297
|
+
if (!$.isTorsionFree())
|
|
4293
4298
|
throw new Error("bad point: not in prime-order subgroup");
|
|
4294
4299
|
return !0;
|
|
4295
4300
|
});
|
|
4296
|
-
function W(
|
|
4297
|
-
return w = new X(t.mul(w.X,
|
|
4301
|
+
function W($, m, w, k, O) {
|
|
4302
|
+
return w = new X(t.mul(w.X, $), w.Y, w.Z), m = Xe(k, m), w = Xe(O, w), m.add(w);
|
|
4298
4303
|
}
|
|
4299
4304
|
const N = class N {
|
|
4300
4305
|
/** Does NOT validate if the point is valid. Use `.assertValidity()`. */
|
|
@@ -4302,7 +4307,7 @@ function kn(r, e = {}) {
|
|
|
4302
4307
|
P(this, "X");
|
|
4303
4308
|
P(this, "Y");
|
|
4304
4309
|
P(this, "Z");
|
|
4305
|
-
this.X =
|
|
4310
|
+
this.X = B("x", m), this.Y = B("y", w, !0), this.Z = B("z", k), Object.freeze(this);
|
|
4306
4311
|
}
|
|
4307
4312
|
static CURVE() {
|
|
4308
4313
|
return i;
|
|
@@ -4336,7 +4341,7 @@ function kn(r, e = {}) {
|
|
|
4336
4341
|
* @returns
|
|
4337
4342
|
*/
|
|
4338
4343
|
precompute(m = 8, w = !0) {
|
|
4339
|
-
return
|
|
4344
|
+
return H.createCache(this, m), w || this.multiply(Ve), this;
|
|
4340
4345
|
}
|
|
4341
4346
|
// TODO: return `this`
|
|
4342
4347
|
/** A point on curve is valid if it conforms to equation. */
|
|
@@ -4352,7 +4357,7 @@ function kn(r, e = {}) {
|
|
|
4352
4357
|
/** Compare one point to another. */
|
|
4353
4358
|
equals(m) {
|
|
4354
4359
|
D(m);
|
|
4355
|
-
const { X: w, Y: k, Z: O } = this, { X:
|
|
4360
|
+
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
4361
|
return E && A;
|
|
4357
4362
|
}
|
|
4358
4363
|
/** Flips point to one corresponding to (x, -y) in Affine coordinates. */
|
|
@@ -4364,9 +4369,9 @@ function kn(r, e = {}) {
|
|
|
4364
4369
|
// https://eprint.iacr.org/2015/1060, algorithm 3
|
|
4365
4370
|
// Cost: 8M + 3S + 3*a + 2*b3 + 15add.
|
|
4366
4371
|
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,
|
|
4372
|
+
const { a: m, b: w } = i, k = t.mul(w, Ve), { X: O, Y: M, Z: y } = this;
|
|
4373
|
+
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);
|
|
4374
|
+
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
4375
|
}
|
|
4371
4376
|
// Renes-Costello-Batina exception-free addition formula.
|
|
4372
4377
|
// There is 30% faster Jacobian formula, but it is not complete.
|
|
@@ -4374,13 +4379,13 @@ function kn(r, e = {}) {
|
|
|
4374
4379
|
// Cost: 12M + 0S + 3*a + 3*b3 + 23add.
|
|
4375
4380
|
add(m) {
|
|
4376
4381
|
D(m);
|
|
4377
|
-
const { X: w, Y: k, Z: O } = this, { X:
|
|
4382
|
+
const { X: w, Y: k, Z: O } = this, { X: M, Y: y, Z: b } = m;
|
|
4378
4383
|
let E = t.ZERO, A = t.ZERO, R = t.ZERO;
|
|
4379
|
-
const F = i.a,
|
|
4380
|
-
let L = t.mul(w,
|
|
4384
|
+
const F = i.a, U = t.mul(i.b, Ve);
|
|
4385
|
+
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
4386
|
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(
|
|
4387
|
+
let ee = t.add(M, b);
|
|
4388
|
+
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
4389
|
}
|
|
4385
4390
|
subtract(m) {
|
|
4386
4391
|
return this.add(m.negate());
|
|
@@ -4402,15 +4407,15 @@ function kn(r, e = {}) {
|
|
|
4402
4407
|
if (!n.isValidNot0(m))
|
|
4403
4408
|
throw new Error("invalid scalar: out of range");
|
|
4404
4409
|
let k, O;
|
|
4405
|
-
const
|
|
4410
|
+
const M = (y) => H.cached(this, y, (b) => zt(N, b));
|
|
4406
4411
|
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,
|
|
4412
|
+
const { k1neg: y, k1: b, k2neg: E, k2: A } = K(m), { p: R, f: F } = M(b), { p: U, f: L } = M(A);
|
|
4413
|
+
O = F.add(L), k = W(w.beta, R, U, y, E);
|
|
4409
4414
|
} else {
|
|
4410
|
-
const { p: y, f: b } =
|
|
4415
|
+
const { p: y, f: b } = M(m);
|
|
4411
4416
|
k = y, O = b;
|
|
4412
4417
|
}
|
|
4413
|
-
return
|
|
4418
|
+
return zt(N, [k, O])[0];
|
|
4414
4419
|
}
|
|
4415
4420
|
/**
|
|
4416
4421
|
* Non-constant-time multiplication. Uses double-and-add algorithm.
|
|
@@ -4425,13 +4430,13 @@ function kn(r, e = {}) {
|
|
|
4425
4430
|
return N.ZERO;
|
|
4426
4431
|
if (m === Ne)
|
|
4427
4432
|
return k;
|
|
4428
|
-
if (
|
|
4433
|
+
if (H.hasCache(this))
|
|
4429
4434
|
return this.multiply(m);
|
|
4430
4435
|
if (w) {
|
|
4431
|
-
const { k1neg: O, k1:
|
|
4436
|
+
const { k1neg: O, k1: M, k2neg: y, k2: b } = K(m), { p1: E, p2: A } = vn(N, k, M, b);
|
|
4432
4437
|
return W(w.beta, E, A, O, y);
|
|
4433
4438
|
} else
|
|
4434
|
-
return
|
|
4439
|
+
return H.unsafe(k, m);
|
|
4435
4440
|
}
|
|
4436
4441
|
/**
|
|
4437
4442
|
* Converts Projective point to affine (x, y) coordinates.
|
|
@@ -4446,7 +4451,7 @@ function kn(r, e = {}) {
|
|
|
4446
4451
|
*/
|
|
4447
4452
|
isTorsionFree() {
|
|
4448
4453
|
const { isTorsionFree: m } = e;
|
|
4449
|
-
return o === Ne ? !0 : m ? m(N, this) :
|
|
4454
|
+
return o === Ne ? !0 : m ? m(N, this) : H.unsafe(this, a).is0();
|
|
4450
4455
|
}
|
|
4451
4456
|
clearCofactor() {
|
|
4452
4457
|
const { clearCofactor: m } = e;
|
|
@@ -4472,13 +4477,13 @@ function kn(r, e = {}) {
|
|
|
4472
4477
|
P(N, "Fp", t), // scalar field
|
|
4473
4478
|
P(N, "Fn", n);
|
|
4474
4479
|
let X = N;
|
|
4475
|
-
const Q = n.BITS,
|
|
4480
|
+
const Q = n.BITS, H = new Sn(X, e.endo ? Math.ceil(Q / 2) : Q);
|
|
4476
4481
|
return X.BASE.precompute(8), X;
|
|
4477
4482
|
}
|
|
4478
|
-
function
|
|
4483
|
+
function Ms(r) {
|
|
4479
4484
|
return Uint8Array.of(r ? 2 : 3);
|
|
4480
4485
|
}
|
|
4481
|
-
function
|
|
4486
|
+
function $s(r, e) {
|
|
4482
4487
|
return {
|
|
4483
4488
|
secretKey: e.BYTES,
|
|
4484
4489
|
publicKey: 1 + r.BYTES,
|
|
@@ -4487,8 +4492,8 @@ function Ds(r, e) {
|
|
|
4487
4492
|
signature: 2 * e.BYTES
|
|
4488
4493
|
};
|
|
4489
4494
|
}
|
|
4490
|
-
function
|
|
4491
|
-
const { Fn: s } = r, t = e.randomBytes ||
|
|
4495
|
+
function On(r, e = {}) {
|
|
4496
|
+
const { Fn: s } = r, t = e.randomBytes || xs, n = Object.assign($s(r.Fp, s), { seed: Os(s.ORDER) });
|
|
4492
4497
|
function i(_) {
|
|
4493
4498
|
try {
|
|
4494
4499
|
const p = s.fromBytes(_);
|
|
@@ -4498,57 +4503,57 @@ function Tn(r, e = {}) {
|
|
|
4498
4503
|
}
|
|
4499
4504
|
}
|
|
4500
4505
|
function o(_, p) {
|
|
4501
|
-
const { publicKey:
|
|
4506
|
+
const { publicKey: v, publicKeyUncompressed: S } = n;
|
|
4502
4507
|
try {
|
|
4503
4508
|
const I = _.length;
|
|
4504
|
-
return p === !0 && I !==
|
|
4509
|
+
return p === !0 && I !== v || p === !1 && I !== S ? !1 : !!r.fromBytes(_);
|
|
4505
4510
|
} catch {
|
|
4506
4511
|
return !1;
|
|
4507
4512
|
}
|
|
4508
4513
|
}
|
|
4509
4514
|
function a(_ = t(n.seed)) {
|
|
4510
|
-
return
|
|
4515
|
+
return bn(V(_, n.seed, "seed"), s.ORDER);
|
|
4511
4516
|
}
|
|
4512
4517
|
function c(_, p = !0) {
|
|
4513
4518
|
return r.BASE.multiply(s.fromBytes(_)).toBytes(p);
|
|
4514
4519
|
}
|
|
4515
4520
|
function l(_) {
|
|
4516
|
-
const { secretKey: p, publicKey:
|
|
4517
|
-
if (!wt(_) || "_lengths" in s && s._lengths || p ===
|
|
4521
|
+
const { secretKey: p, publicKey: v, publicKeyUncompressed: S } = n;
|
|
4522
|
+
if (!wt(_) || "_lengths" in s && s._lengths || p === v)
|
|
4518
4523
|
return;
|
|
4519
4524
|
const I = V(_, void 0, "key").length;
|
|
4520
|
-
return I ===
|
|
4525
|
+
return I === v || I === S;
|
|
4521
4526
|
}
|
|
4522
|
-
function u(_, p,
|
|
4527
|
+
function u(_, p, v = !0) {
|
|
4523
4528
|
if (l(_) === !0)
|
|
4524
4529
|
throw new Error("first arg must be private key");
|
|
4525
4530
|
if (l(p) === !1)
|
|
4526
4531
|
throw new Error("second arg must be public key");
|
|
4527
|
-
const
|
|
4528
|
-
return r.fromBytes(p).multiply(
|
|
4532
|
+
const S = s.fromBytes(_);
|
|
4533
|
+
return r.fromBytes(p).multiply(S).toBytes(v);
|
|
4529
4534
|
}
|
|
4530
4535
|
const f = {
|
|
4531
4536
|
isValidSecretKey: i,
|
|
4532
4537
|
isValidPublicKey: o,
|
|
4533
4538
|
randomSecretKey: a
|
|
4534
|
-
}, x =
|
|
4539
|
+
}, x = An(a, c);
|
|
4535
4540
|
return Object.freeze({ getPublicKey: c, getSharedSecret: u, keygen: x, Point: r, utils: f, lengths: n });
|
|
4536
4541
|
}
|
|
4537
|
-
function
|
|
4538
|
-
|
|
4542
|
+
function Pn(r, e, s = {}) {
|
|
4543
|
+
hs(e), vt(s, {}, {
|
|
4539
4544
|
hmac: "function",
|
|
4540
4545
|
lowS: "boolean",
|
|
4541
4546
|
randomBytes: "function",
|
|
4542
4547
|
bits2int: "function",
|
|
4543
4548
|
bits2int_modN: "function"
|
|
4544
4549
|
}), s = Object.assign({}, s);
|
|
4545
|
-
const t = s.randomBytes ||
|
|
4550
|
+
const t = s.randomBytes || xs, n = s.hmac || ((m, w) => Ls(e, m, w)), { Fp: i, Fn: o } = r, { ORDER: a, BITS: c } = o, { keygen: l, getPublicKey: u, getSharedSecret: f, utils: x, lengths: _ } = On(r, s), p = {
|
|
4546
4551
|
prehash: !0,
|
|
4547
4552
|
lowS: typeof s.lowS == "boolean" ? s.lowS : !0,
|
|
4548
4553
|
format: "compact",
|
|
4549
4554
|
extraEntropy: !1
|
|
4550
|
-
},
|
|
4551
|
-
function
|
|
4555
|
+
}, v = a * Ds < i.ORDER;
|
|
4556
|
+
function S(m) {
|
|
4552
4557
|
const w = a >> Ne;
|
|
4553
4558
|
return m > w;
|
|
4554
4559
|
}
|
|
@@ -4558,10 +4563,10 @@ function Rn(r, e, s = {}) {
|
|
|
4558
4563
|
return w;
|
|
4559
4564
|
}
|
|
4560
4565
|
function T() {
|
|
4561
|
-
if (
|
|
4566
|
+
if (v)
|
|
4562
4567
|
throw new Error('"recovered" sig type is not supported for cofactor >2 curves');
|
|
4563
4568
|
}
|
|
4564
|
-
function
|
|
4569
|
+
function B(m, w) {
|
|
4565
4570
|
xt(w);
|
|
4566
4571
|
const k = _.signature, O = w === "compact" ? k : w === "recovered" ? k + 1 : void 0;
|
|
4567
4572
|
return V(m, O);
|
|
@@ -4579,14 +4584,14 @@ function Rn(r, e, s = {}) {
|
|
|
4579
4584
|
Object.freeze(this);
|
|
4580
4585
|
}
|
|
4581
4586
|
static fromBytes(w, k = p.format) {
|
|
4582
|
-
|
|
4587
|
+
B(w, k);
|
|
4583
4588
|
let O;
|
|
4584
4589
|
if (k === "der") {
|
|
4585
4590
|
const { r: E, s: A } = be.toSig(V(w));
|
|
4586
4591
|
return new D(E, A);
|
|
4587
4592
|
}
|
|
4588
4593
|
k === "recovered" && (O = w[0], k = "compact", w = w.subarray(1));
|
|
4589
|
-
const
|
|
4594
|
+
const M = _.signature / 2, y = w.subarray(0, M), b = w.subarray(M, M * 2);
|
|
4590
4595
|
return new D(o.fromBytes(y), o.fromBytes(b), O);
|
|
4591
4596
|
}
|
|
4592
4597
|
static fromHex(w, k) {
|
|
@@ -4602,23 +4607,23 @@ function Rn(r, e, s = {}) {
|
|
|
4602
4607
|
return new D(this.r, this.s, w);
|
|
4603
4608
|
}
|
|
4604
4609
|
recoverPublicKey(w) {
|
|
4605
|
-
const { r: k, s: O } = this,
|
|
4610
|
+
const { r: k, s: O } = this, M = this.assertRecovery(), y = M === 2 || M === 3 ? k + a : k;
|
|
4606
4611
|
if (!i.isValid(y))
|
|
4607
4612
|
throw new Error("invalid recovery id: sig.r+curve.n != R.x");
|
|
4608
|
-
const b = i.toBytes(y), E = r.fromBytes(
|
|
4613
|
+
const b = i.toBytes(y), E = r.fromBytes(Se(Ms((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
4614
|
if (L.is0())
|
|
4610
4615
|
throw new Error("invalid recovery: point at infinify");
|
|
4611
4616
|
return L.assertValidity(), L;
|
|
4612
4617
|
}
|
|
4613
4618
|
// Signatures should be low-s, to prevent malleability.
|
|
4614
4619
|
hasHighS() {
|
|
4615
|
-
return
|
|
4620
|
+
return S(this.s);
|
|
4616
4621
|
}
|
|
4617
4622
|
toBytes(w = p.format) {
|
|
4618
4623
|
if (xt(w), w === "der")
|
|
4619
4624
|
return je(be.hexFromSig(this));
|
|
4620
|
-
const { r: k, s: O } = this,
|
|
4621
|
-
return w === "recovered" ? (T(),
|
|
4625
|
+
const { r: k, s: O } = this, M = o.toBytes(k), y = o.toBytes(O);
|
|
4626
|
+
return w === "recovered" ? (T(), Se(Uint8Array.of(this.assertRecovery()), M, y)) : Se(M, y);
|
|
4622
4627
|
}
|
|
4623
4628
|
toHex(w) {
|
|
4624
4629
|
return Fe(this.toBytes(w));
|
|
@@ -4631,16 +4636,16 @@ function Rn(r, e, s = {}) {
|
|
|
4631
4636
|
return O > 0 ? k >> BigInt(O) : k;
|
|
4632
4637
|
}, q = s.bits2int_modN || function(w) {
|
|
4633
4638
|
return o.create(K(w));
|
|
4634
|
-
}, Z =
|
|
4639
|
+
}, Z = St(c);
|
|
4635
4640
|
function W(m) {
|
|
4636
|
-
return
|
|
4641
|
+
return cn("num < 2^" + c, m, _e, Z), o.toBytes(m);
|
|
4637
4642
|
}
|
|
4638
4643
|
function X(m, w) {
|
|
4639
4644
|
return V(m, void 0, "message"), w ? V(e(m), void 0, "prehashed message") : m;
|
|
4640
4645
|
}
|
|
4641
4646
|
function Q(m, w, k) {
|
|
4642
|
-
const { lowS: O, prehash:
|
|
4643
|
-
m = X(m,
|
|
4647
|
+
const { lowS: O, prehash: M, extraEntropy: y } = lt(k, p);
|
|
4648
|
+
m = X(m, M);
|
|
4644
4649
|
const b = q(m), E = o.fromBytes(w);
|
|
4645
4650
|
if (!o.isValidNot0(E))
|
|
4646
4651
|
throw new Error("invalid private key");
|
|
@@ -4649,8 +4654,8 @@ function Rn(r, e, s = {}) {
|
|
|
4649
4654
|
const L = y === !0 ? t(_.secretKey) : y;
|
|
4650
4655
|
A.push(V(L, void 0, "extraEntropy"));
|
|
4651
4656
|
}
|
|
4652
|
-
const R =
|
|
4653
|
-
function
|
|
4657
|
+
const R = Se(...A), F = b;
|
|
4658
|
+
function U(L) {
|
|
4654
4659
|
const G = K(L);
|
|
4655
4660
|
if (!o.isValidNot0(G))
|
|
4656
4661
|
return;
|
|
@@ -4661,32 +4666,32 @@ function Rn(r, e, s = {}) {
|
|
|
4661
4666
|
if (ee === _e)
|
|
4662
4667
|
return;
|
|
4663
4668
|
let Tt = (ie.x === z ? 0 : 2) | Number(ie.y & Ne), Rt = ee;
|
|
4664
|
-
return O &&
|
|
4669
|
+
return O && S(ee) && (Rt = o.neg(ee), Tt ^= 1), new D(z, Rt, v ? void 0 : Tt);
|
|
4665
4670
|
}
|
|
4666
|
-
return { seed: R, k2sig:
|
|
4671
|
+
return { seed: R, k2sig: U };
|
|
4667
4672
|
}
|
|
4668
|
-
function
|
|
4669
|
-
const { seed: O, k2sig:
|
|
4670
|
-
return
|
|
4673
|
+
function H(m, w, k = {}) {
|
|
4674
|
+
const { seed: O, k2sig: M } = Q(m, w, k);
|
|
4675
|
+
return dn(e.outputLen, o.BYTES, n)(O, M).toBytes(k.format);
|
|
4671
4676
|
}
|
|
4672
4677
|
function N(m, w, k, O = {}) {
|
|
4673
|
-
const { lowS:
|
|
4678
|
+
const { lowS: M, prehash: y, format: b } = lt(O, p);
|
|
4674
4679
|
if (k = V(k, void 0, "publicKey"), w = X(w, y), !wt(m)) {
|
|
4675
4680
|
const E = m instanceof D ? ", use sig.toBytes()" : "";
|
|
4676
4681
|
throw new Error("verify expects Uint8Array signature" + E);
|
|
4677
4682
|
}
|
|
4678
|
-
|
|
4683
|
+
B(m, b);
|
|
4679
4684
|
try {
|
|
4680
4685
|
const E = D.fromBytes(m, b), A = r.fromBytes(k);
|
|
4681
|
-
if (
|
|
4686
|
+
if (M && E.hasHighS())
|
|
4682
4687
|
return !1;
|
|
4683
|
-
const { r: R, s: F } = E,
|
|
4688
|
+
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
4689
|
return ie.is0() ? !1 : o.create(ie.x) === R;
|
|
4685
4690
|
} catch {
|
|
4686
4691
|
return !1;
|
|
4687
4692
|
}
|
|
4688
4693
|
}
|
|
4689
|
-
function
|
|
4694
|
+
function $(m, w, k = {}) {
|
|
4690
4695
|
const { prehash: O } = lt(k, p);
|
|
4691
4696
|
return w = X(w, O), D.fromBytes(m, "recovered").recoverPublicKey(w).toBytes();
|
|
4692
4697
|
}
|
|
@@ -4697,9 +4702,9 @@ function Rn(r, e, s = {}) {
|
|
|
4697
4702
|
utils: x,
|
|
4698
4703
|
lengths: _,
|
|
4699
4704
|
Point: r,
|
|
4700
|
-
sign:
|
|
4705
|
+
sign: H,
|
|
4701
4706
|
verify: N,
|
|
4702
|
-
recoverPublicKey:
|
|
4707
|
+
recoverPublicKey: $,
|
|
4703
4708
|
Signature: D,
|
|
4704
4709
|
hash: e
|
|
4705
4710
|
});
|
|
@@ -4713,44 +4718,44 @@ const At = {
|
|
|
4713
4718
|
b: BigInt(7),
|
|
4714
4719
|
Gx: BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),
|
|
4715
4720
|
Gy: BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")
|
|
4716
|
-
},
|
|
4721
|
+
}, Cn = {
|
|
4717
4722
|
beta: BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),
|
|
4718
4723
|
basises: [
|
|
4719
4724
|
[BigInt("0x3086d221a7d46bcde86c90e49284eb15"), -BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],
|
|
4720
4725
|
[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"), BigInt("0x3086d221a7d46bcde86c90e49284eb15")]
|
|
4721
4726
|
]
|
|
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,
|
|
4727
|
+
}, Zt = /* @__PURE__ */ BigInt(2);
|
|
4728
|
+
function Nn(r) {
|
|
4729
|
+
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
4730
|
if (!gt.eql(gt.sqr(q), r))
|
|
4726
4731
|
throw new Error("Cannot find square root");
|
|
4727
4732
|
return q;
|
|
4728
4733
|
}
|
|
4729
|
-
const gt = et(At.p, { sqrt:
|
|
4734
|
+
const gt = et(At.p, { sqrt: Nn }), Ln = /* @__PURE__ */ Rn(At, {
|
|
4730
4735
|
Fp: gt,
|
|
4731
|
-
endo:
|
|
4732
|
-
}),
|
|
4733
|
-
for (let r = 0, e =
|
|
4734
|
-
[s, t] = [t, (2 * s + 3 * t) % 5],
|
|
4735
|
-
let n =
|
|
4736
|
+
endo: Cn
|
|
4737
|
+
}), Dn = /* @__PURE__ */ Pn(Ln, nn), Mn = BigInt(0), $e = BigInt(1), $n = BigInt(2), Bn = BigInt(7), Un = BigInt(256), Hn = BigInt(113), Bs = [], Us = [], Hs = [];
|
|
4738
|
+
for (let r = 0, e = $e, s = 1, t = 0; r < 24; r++) {
|
|
4739
|
+
[s, t] = [t, (2 * s + 3 * t) % 5], Bs.push(2 * (5 * t + s)), Us.push((r + 1) * (r + 2) / 2 % 64);
|
|
4740
|
+
let n = Mn;
|
|
4736
4741
|
for (let i = 0; i < 7; i++)
|
|
4737
|
-
e = (e <<
|
|
4738
|
-
|
|
4742
|
+
e = (e << $e ^ (e >> Bn) * Hn) % Un, e & $n && (n ^= $e << ($e << BigInt(i)) - $e);
|
|
4743
|
+
Hs.push(n);
|
|
4739
4744
|
}
|
|
4740
|
-
const
|
|
4741
|
-
function
|
|
4745
|
+
const Fs = Xr(Hs, !0), Fn = Fs[0], Wn = Fs[1], Qt = (r, e, s) => s > 32 ? Qr(r, e, s) : Jr(r, e, s), es = (r, e, s) => s > 32 ? en(r, e, s) : Zr(r, e, s);
|
|
4746
|
+
function Gn(r, e = 24) {
|
|
4742
4747
|
const s = new Uint32Array(10);
|
|
4743
4748
|
for (let t = 24 - e; t < 24; t++) {
|
|
4744
4749
|
for (let o = 0; o < 10; o++)
|
|
4745
4750
|
s[o] = r[o] ^ r[o + 10] ^ r[o + 20] ^ r[o + 30] ^ r[o + 40];
|
|
4746
4751
|
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 =
|
|
4752
|
+
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
4753
|
for (let _ = 0; _ < 50; _ += 10)
|
|
4749
4754
|
r[o + _] ^= f, r[o + _ + 1] ^= x;
|
|
4750
4755
|
}
|
|
4751
4756
|
let n = r[2], i = r[3];
|
|
4752
4757
|
for (let o = 0; o < 24; o++) {
|
|
4753
|
-
const a =
|
|
4758
|
+
const a = Us[o], c = Qt(n, i, a), l = es(n, i, a), u = Bs[o];
|
|
4754
4759
|
n = r[u], i = r[u + 1], r[u] = c, r[u + 1] = l;
|
|
4755
4760
|
}
|
|
4756
4761
|
for (let o = 0; o < 50; o += 10) {
|
|
@@ -4759,7 +4764,7 @@ function Fn(r, e = 24) {
|
|
|
4759
4764
|
for (let a = 0; a < 10; a++)
|
|
4760
4765
|
r[o + a] ^= ~s[(a + 2) % 10] & s[(a + 4) % 10];
|
|
4761
4766
|
}
|
|
4762
|
-
r[0] ^=
|
|
4767
|
+
r[0] ^= Fn[t], r[1] ^= Wn[t];
|
|
4763
4768
|
}
|
|
4764
4769
|
De(s);
|
|
4765
4770
|
}
|
|
@@ -4779,13 +4784,13 @@ class It {
|
|
|
4779
4784
|
P(this, "rounds");
|
|
4780
4785
|
if (this.blockLen = e, this.suffix = s, this.outputLen = t, this.enableXOF = n, this.rounds = i, me(t, "outputLen"), !(0 < e && e < 200))
|
|
4781
4786
|
throw new Error("only keccak-f1600 function is supported");
|
|
4782
|
-
this.state = new Uint8Array(200), this.state32 =
|
|
4787
|
+
this.state = new Uint8Array(200), this.state32 = Hr(this.state);
|
|
4783
4788
|
}
|
|
4784
4789
|
clone() {
|
|
4785
4790
|
return this._cloneInto();
|
|
4786
4791
|
}
|
|
4787
4792
|
keccak() {
|
|
4788
|
-
|
|
4793
|
+
Ft(this.state32), Gn(this.state32, this.rounds), Ft(this.state32), this.posOut = 0, this.pos = 0;
|
|
4789
4794
|
}
|
|
4790
4795
|
update(e) {
|
|
4791
4796
|
Le(this), V(e);
|
|
@@ -4824,7 +4829,7 @@ class It {
|
|
|
4824
4829
|
return me(e), this.xofInto(new Uint8Array(e));
|
|
4825
4830
|
}
|
|
4826
4831
|
digestInto(e) {
|
|
4827
|
-
if (
|
|
4832
|
+
if (ps(e, this), this.finished)
|
|
4828
4833
|
throw new Error("digest() was already called");
|
|
4829
4834
|
return this.writeInto(e), this.destroy(), e;
|
|
4830
4835
|
}
|
|
@@ -4839,14 +4844,14 @@ class It {
|
|
|
4839
4844
|
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
4845
|
}
|
|
4841
4846
|
}
|
|
4842
|
-
const
|
|
4843
|
-
class
|
|
4847
|
+
const qn = (r, e, s, t = {}) => _s(() => new It(e, r, s), t), ts = /* @__PURE__ */ qn(1, 136, 32), Kn = 60;
|
|
4848
|
+
class Vn {
|
|
4844
4849
|
constructor() {
|
|
4845
4850
|
this.jwks = null;
|
|
4846
4851
|
}
|
|
4847
4852
|
setJWKSEndpoint(e) {
|
|
4848
4853
|
try {
|
|
4849
|
-
this.jwks =
|
|
4854
|
+
this.jwks = Js(new URL(e)), d.log("[CROSSx] JWKS 엔드포인트 설정:", e);
|
|
4850
4855
|
} catch (s) {
|
|
4851
4856
|
d.warn("[CROSSx] JWKS 엔드포인트 URL 파싱 실패:", s);
|
|
4852
4857
|
}
|
|
@@ -4860,7 +4865,7 @@ class qn {
|
|
|
4860
4865
|
iat: t.iat
|
|
4861
4866
|
});
|
|
4862
4867
|
const n = Math.floor(Date.now() / 1e3);
|
|
4863
|
-
if (t.exp && t.exp +
|
|
4868
|
+
if (t.exp && t.exp + Kn < n)
|
|
4864
4869
|
return d.warn("[CROSSx] 토큰 만료:", {
|
|
4865
4870
|
exp: t.exp,
|
|
4866
4871
|
now: n,
|
|
@@ -4870,7 +4875,7 @@ class qn {
|
|
|
4870
4875
|
return d.warn("[CROSSx] JWT에 sub(사용자ID) 없음"), { payload: t, valid: !1, signatureVerified: !1 };
|
|
4871
4876
|
if (this.jwks)
|
|
4872
4877
|
try {
|
|
4873
|
-
const { payload: i } = await
|
|
4878
|
+
const { payload: i } = await Zs(e, this.jwks, {
|
|
4874
4879
|
algorithms: ["RS256", "ES256"]
|
|
4875
4880
|
});
|
|
4876
4881
|
return d.log("[CROSSx] JWT 서명 검증 성공"), {
|
|
@@ -4889,7 +4894,7 @@ class qn {
|
|
|
4889
4894
|
}
|
|
4890
4895
|
}
|
|
4891
4896
|
decodeJWT(e) {
|
|
4892
|
-
return
|
|
4897
|
+
return Qs(e);
|
|
4893
4898
|
}
|
|
4894
4899
|
/**
|
|
4895
4900
|
* EIP-191 personal_sign 서명에서 서명자 Ethereum 주소를 복원합니다.
|
|
@@ -4904,29 +4909,29 @@ class qn {
|
|
|
4904
4909
|
${t.length}`
|
|
4905
4910
|
), i = new Uint8Array(n.length + t.length);
|
|
4906
4911
|
i.set(n, 0), i.set(t, n.length);
|
|
4907
|
-
const o =
|
|
4912
|
+
const o = ts(i), a = s.startsWith("0x") ? s.slice(2) : s;
|
|
4908
4913
|
if (a.length !== 130)
|
|
4909
4914
|
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(
|
|
4915
|
+
const c = zn(a), l = c.slice(0, 32), u = c.slice(32, 64), f = c[64], x = f >= 27 ? f - 27 : f, v = new Dn.Signature(
|
|
4916
|
+
ss(l),
|
|
4917
|
+
ss(u)
|
|
4918
|
+
).addRecoveryBit(x).recoverPublicKey(o).toBytes(!1).slice(1), S = ts(v);
|
|
4919
|
+
return "0x" + Fe(S.slice(12));
|
|
4915
4920
|
}
|
|
4916
4921
|
}
|
|
4917
|
-
function
|
|
4922
|
+
function zn(r) {
|
|
4918
4923
|
const e = new Uint8Array(r.length / 2);
|
|
4919
4924
|
for (let s = 0; s < e.length; s++)
|
|
4920
4925
|
e[s] = parseInt(r.substring(s * 2, s * 2 + 2), 16);
|
|
4921
4926
|
return e;
|
|
4922
4927
|
}
|
|
4923
|
-
function
|
|
4928
|
+
function ss(r) {
|
|
4924
4929
|
let e = "0x";
|
|
4925
4930
|
for (const s of r) e += s.toString(16).padStart(2, "0");
|
|
4926
4931
|
return BigInt(e);
|
|
4927
4932
|
}
|
|
4928
|
-
const
|
|
4929
|
-
class
|
|
4933
|
+
const jn = 3e4, Yn = 1e3;
|
|
4934
|
+
class Xn {
|
|
4930
4935
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
4931
4936
|
async request(e) {
|
|
4932
4937
|
const s = e.retries ?? 0;
|
|
@@ -4937,7 +4942,7 @@ class jn {
|
|
|
4937
4942
|
} catch (n) {
|
|
4938
4943
|
if (t === s) throw n;
|
|
4939
4944
|
}
|
|
4940
|
-
await new Promise((n) => setTimeout(n,
|
|
4945
|
+
await new Promise((n) => setTimeout(n, Yn * 2 ** t));
|
|
4941
4946
|
}
|
|
4942
4947
|
throw new Error("Unexpected: retry loop exited without result");
|
|
4943
4948
|
}
|
|
@@ -4945,7 +4950,7 @@ class jn {
|
|
|
4945
4950
|
async _doRequest(e) {
|
|
4946
4951
|
const s = new AbortController(), t = setTimeout(
|
|
4947
4952
|
() => s.abort(),
|
|
4948
|
-
e.timeoutMs ??
|
|
4953
|
+
e.timeoutMs ?? jn
|
|
4949
4954
|
);
|
|
4950
4955
|
try {
|
|
4951
4956
|
const n = await fetch(e.url, {
|
|
@@ -4972,7 +4977,7 @@ class jn {
|
|
|
4972
4977
|
}
|
|
4973
4978
|
}
|
|
4974
4979
|
}
|
|
4975
|
-
const
|
|
4980
|
+
const Jn = /* @__PURE__ */ new Set([
|
|
4976
4981
|
"https://cross-wallet-oauth.crosstoken.io",
|
|
4977
4982
|
"https://stg-cross-wallet-oauth.crosstoken.io",
|
|
4978
4983
|
"https://dev-cross-wallet-oauth.crosstoken.io"
|
|
@@ -5057,26 +5062,26 @@ class Ee {
|
|
|
5057
5062
|
}
|
|
5058
5063
|
const _ = setTimeout(() => {
|
|
5059
5064
|
d.warn("[CROSSx] OAuth 타임아웃 (5분) — postMessage를 수신하지 못했습니다"), D(), t(new Error("Authentication timeout"));
|
|
5060
|
-
}, 5 * 60 * 1e3), p = 10,
|
|
5061
|
-
let
|
|
5065
|
+
}, 5 * 60 * 1e3), p = 10, v = 30;
|
|
5066
|
+
let S = 0, I = null;
|
|
5062
5067
|
const T = () => {
|
|
5063
|
-
clearInterval(
|
|
5068
|
+
clearInterval(B), d.warn("[CROSSx] COOP 감지 — OAuth 서버 응답을 " + v + "초간 대기합니다"), I = setTimeout(() => {
|
|
5064
5069
|
D(), t(new Error(
|
|
5065
5070
|
"OAuth 서버로부터 응답을 받지 못했습니다. 브라우저 보안 정책(COOP)으로 인해 팝업 통신이 차단되었을 수 있습니다. 다시 시도해 주세요."
|
|
5066
5071
|
));
|
|
5067
|
-
},
|
|
5068
|
-
},
|
|
5069
|
-
|
|
5072
|
+
}, v * 1e3);
|
|
5073
|
+
}, B = setInterval(() => {
|
|
5074
|
+
S++;
|
|
5070
5075
|
try {
|
|
5071
|
-
x.closed && (
|
|
5076
|
+
x.closed && (S <= p ? T() : (D(), t(new Error("로그인이 취소되었습니다"))));
|
|
5072
5077
|
} catch {
|
|
5073
5078
|
T();
|
|
5074
5079
|
}
|
|
5075
5080
|
}, 1e3), D = () => {
|
|
5076
|
-
clearTimeout(_), clearInterval(
|
|
5081
|
+
clearTimeout(_), clearInterval(B), I && clearTimeout(I), window.removeEventListener("message", K);
|
|
5077
5082
|
}, K = (q) => {
|
|
5078
5083
|
if (q.origin !== e.expectedOrigin) return;
|
|
5079
|
-
if (!
|
|
5084
|
+
if (!Jn.has(q.origin)) {
|
|
5080
5085
|
d.error("[CROSSx] postMessage origin이 허용 목록에 없음:", q.origin), D(), t(new Error("Unauthorized OAuth origin"));
|
|
5081
5086
|
return;
|
|
5082
5087
|
}
|
|
@@ -5099,21 +5104,21 @@ class Ee {
|
|
|
5099
5104
|
d.error("[CROSSx] OAuth 실패:", W.error), t(new Error(W.error || "Authentication failed"));
|
|
5100
5105
|
return;
|
|
5101
5106
|
}
|
|
5102
|
-
const Q = W == null ? void 0 : W.idToken,
|
|
5107
|
+
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
5108
|
if (d.log("[CROSSx] OAuth 토큰 수신:", {
|
|
5104
|
-
hasAccessToken: !!
|
|
5109
|
+
hasAccessToken: !!H,
|
|
5105
5110
|
hasIdToken: !!Q,
|
|
5106
|
-
hasEmail:
|
|
5111
|
+
hasEmail: !!$
|
|
5107
5112
|
}), !N) {
|
|
5108
5113
|
d.error("[CROSSx] 토큰을 찾을 수 없음:", q.data), t(new Error("Token not found in response"));
|
|
5109
5114
|
return;
|
|
5110
5115
|
}
|
|
5111
|
-
const m = { token: N, email:
|
|
5116
|
+
const m = { token: N, email: $ }, w = (k) => {
|
|
5112
5117
|
Ee.verifyIdTokenNonce(k, l).then(() => s(m)).catch((O) => {
|
|
5113
5118
|
d.error("[CROSSx] nonce 검증 실패:", O), t(O instanceof Error ? O : new Error("nonce verification failed"));
|
|
5114
5119
|
});
|
|
5115
5120
|
};
|
|
5116
|
-
|
|
5121
|
+
H ? H.split(".").length === 3 ? w(H) : Q ? w(Q) : (d.warn(
|
|
5117
5122
|
"[CROSSx] opaque accessToken만 수신 (idToken 없음) — nonce 검증 불가.",
|
|
5118
5123
|
"서버 측 nonce 검증이 필요합니다."
|
|
5119
5124
|
), s(m)) : Q ? w(Q) : t(new Error("Token not found in response"));
|
|
@@ -5123,7 +5128,7 @@ class Ee {
|
|
|
5123
5128
|
}
|
|
5124
5129
|
}
|
|
5125
5130
|
const Be = "crossx_wallet_data", Re = "crossx_mock_pin_hash";
|
|
5126
|
-
class
|
|
5131
|
+
class Zn {
|
|
5127
5132
|
constructor(e, s) {
|
|
5128
5133
|
this.storage = e, this.pinStore = s ?? null;
|
|
5129
5134
|
}
|
|
@@ -5345,19 +5350,20 @@ class Ae {
|
|
|
5345
5350
|
url: o,
|
|
5346
5351
|
method: e
|
|
5347
5352
|
});
|
|
5348
|
-
const
|
|
5349
|
-
if (
|
|
5353
|
+
const v = Ae.mapGatewayError(_.code, _.data);
|
|
5354
|
+
if (v === h.AUTH_NOT_AUTHENTICATED && !n && this._onTokenRefresh) {
|
|
5350
5355
|
if (d.warn("[CROSSx] Gateway -10002 감지 — 토큰 갱신 후 재시도"), await this.deduplicatedRefresh())
|
|
5351
5356
|
return this.request(e, s, t, !0);
|
|
5352
5357
|
throw new g(h.SESSION_EXPIRED, "인증 세션이 만료되었습니다. 다시 로그인해 주세요.");
|
|
5353
5358
|
}
|
|
5354
|
-
if (
|
|
5359
|
+
if (v === h.USER_NOT_FOUND)
|
|
5355
5360
|
throw d.warn("[CROSSx] Gateway -10033 감지 — 유저 미존재, 강제 로그아웃"), (c = this._onUnauthorized) == null || c.call(this), new g(
|
|
5356
5361
|
h.USER_NOT_FOUND,
|
|
5357
5362
|
Ae.getGatewayErrorMessage(_.code, p)
|
|
5358
5363
|
);
|
|
5359
|
-
const
|
|
5360
|
-
|
|
5364
|
+
const S = v === h.AUTH_NOT_AUTHENTICATED ? h.SESSION_EXPIRED : v, I = S === h.SESSION_EXPIRED ? "인증 세션이 만료되었습니다. 다시 로그인해 주세요." : Ae.getGatewayErrorMessage(_.code, p), T = _.data;
|
|
5365
|
+
let B;
|
|
5366
|
+
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
5367
|
}
|
|
5362
5368
|
return d.log("[CROSSx] Wallet Gateway API 성공:", { code: _.code, url: o, method: e }), _.data ?? _;
|
|
5363
5369
|
}
|
|
@@ -5374,16 +5380,16 @@ class Ae {
|
|
|
5374
5380
|
);
|
|
5375
5381
|
}
|
|
5376
5382
|
if ((u = x.response) != null && u.data) {
|
|
5377
|
-
const p = x.response.data,
|
|
5383
|
+
const p = x.response.data, v = p.message || p.data || "API 요청에 실패했습니다", S = p.code || "UNKNOWN";
|
|
5378
5384
|
throw d.error("[CROSSx] Wallet Gateway API 에러 (HTTP 에러):", {
|
|
5379
|
-
code:
|
|
5380
|
-
message:
|
|
5385
|
+
code: S,
|
|
5386
|
+
message: v,
|
|
5381
5387
|
url: o,
|
|
5382
5388
|
method: e,
|
|
5383
5389
|
status: (f = x.response) == null ? void 0 : f.status
|
|
5384
5390
|
}), new g(
|
|
5385
5391
|
h.UNKNOWN_ERROR,
|
|
5386
|
-
`Wallet Gateway 오류 (${
|
|
5392
|
+
`Wallet Gateway 오류 (${S}): ${v}`
|
|
5387
5393
|
);
|
|
5388
5394
|
}
|
|
5389
5395
|
throw x;
|
|
@@ -5661,6 +5667,8 @@ class Ae {
|
|
|
5661
5667
|
return h.WITHDRAW_FAILED;
|
|
5662
5668
|
case -10033:
|
|
5663
5669
|
return h.USER_NOT_FOUND;
|
|
5670
|
+
case -10036:
|
|
5671
|
+
return h.ADDRESS_LIMIT_EXCEEDED;
|
|
5664
5672
|
case -10027:
|
|
5665
5673
|
return h.MIGRATION_PIN_LOCKED;
|
|
5666
5674
|
case -10022:
|
|
@@ -5742,6 +5750,8 @@ class Ae {
|
|
|
5742
5750
|
return "Repeated digit pattern is not allowed. Please choose a different PIN.";
|
|
5743
5751
|
case -10033:
|
|
5744
5752
|
return "User not found. You have been signed out.";
|
|
5753
|
+
case -10036:
|
|
5754
|
+
return `Account limit reached. Maximum ${Ut} accounts allowed.`;
|
|
5745
5755
|
case -10040:
|
|
5746
5756
|
return "HMAC signature header is required.";
|
|
5747
5757
|
case -10041:
|
|
@@ -5786,7 +5796,7 @@ class He {
|
|
|
5786
5796
|
}
|
|
5787
5797
|
isCacheValid() {
|
|
5788
5798
|
if (this.loadedAt === 0) return !1;
|
|
5789
|
-
const e = this.usingFallback ?
|
|
5799
|
+
const e = this.usingFallback ? wr : mr;
|
|
5790
5800
|
return e === 0 ? !0 : Date.now() - this.loadedAt < e;
|
|
5791
5801
|
}
|
|
5792
5802
|
populateCache(e, s) {
|
|
@@ -5848,7 +5858,7 @@ class He {
|
|
|
5848
5858
|
}
|
|
5849
5859
|
}
|
|
5850
5860
|
}
|
|
5851
|
-
const
|
|
5861
|
+
const rs = "__crossx-confirm-style", J = "__crossx-confirm-overlay", Qn = {
|
|
5852
5862
|
light: {
|
|
5853
5863
|
bg: "#FFFFFF",
|
|
5854
5864
|
border: "rgba(18,18,18,0.05)",
|
|
@@ -5904,8 +5914,8 @@ const ss = "__crossx-confirm-style", J = "__crossx-confirm-overlay", Jn = {
|
|
|
5904
5914
|
onPrimary: "#FFFFFF"
|
|
5905
5915
|
}
|
|
5906
5916
|
};
|
|
5907
|
-
function
|
|
5908
|
-
const s =
|
|
5917
|
+
function ns(r, e) {
|
|
5918
|
+
const s = Qn[r], t = e == null ? void 0 : e[r];
|
|
5909
5919
|
return t ? {
|
|
5910
5920
|
...s,
|
|
5911
5921
|
// ── Brand
|
|
@@ -5937,7 +5947,7 @@ function rs(r, e) {
|
|
|
5937
5947
|
...t.error !== void 0 && { errorColor: t.error }
|
|
5938
5948
|
} : s;
|
|
5939
5949
|
}
|
|
5940
|
-
const
|
|
5950
|
+
const ei = `
|
|
5941
5951
|
@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;600&display=swap');
|
|
5942
5952
|
|
|
5943
5953
|
#${J} {
|
|
@@ -8013,10 +8023,10 @@ button.__crossx-connect-other-block:active {
|
|
|
8013
8023
|
}
|
|
8014
8024
|
`;
|
|
8015
8025
|
function ce() {
|
|
8016
|
-
let r = document.getElementById(
|
|
8017
|
-
r || (r = document.createElement("style"), r.id =
|
|
8026
|
+
let r = document.getElementById(rs);
|
|
8027
|
+
r || (r = document.createElement("style"), r.id = rs, document.head.appendChild(r)), r.textContent = ei;
|
|
8018
8028
|
}
|
|
8019
|
-
function
|
|
8029
|
+
function ti() {
|
|
8020
8030
|
const r = `#${J}`, e = (t) => {
|
|
8021
8031
|
var n, i;
|
|
8022
8032
|
(i = (n = t.target) == null ? void 0 : n.closest) != null && i.call(n, r) && t.stopImmediatePropagation();
|
|
@@ -8056,14 +8066,14 @@ function le(r) {
|
|
|
8056
8066
|
}
|
|
8057
8067
|
i.preventDefault();
|
|
8058
8068
|
}, { passive: !1 });
|
|
8059
|
-
const t =
|
|
8069
|
+
const t = ti(), n = r.remove.bind(r);
|
|
8060
8070
|
r.remove = () => {
|
|
8061
8071
|
t(), n();
|
|
8062
8072
|
}, document.body.appendChild(r);
|
|
8063
8073
|
}
|
|
8064
|
-
const
|
|
8074
|
+
const si = () => /iPad|iPhone|iPod/.test(navigator.userAgent) || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1;
|
|
8065
8075
|
function Oe() {
|
|
8066
|
-
if (
|
|
8076
|
+
if (si()) {
|
|
8067
8077
|
const e = window.scrollY;
|
|
8068
8078
|
return document.body.style.position = "fixed", document.body.style.top = `-${e}px`, document.body.style.left = "0", document.body.style.right = "0", () => {
|
|
8069
8079
|
document.body.style.position = "", document.body.style.top = "", document.body.style.left = "", document.body.style.right = "", window.scrollTo(0, e);
|
|
@@ -8077,7 +8087,7 @@ function Oe() {
|
|
|
8077
8087
|
function se(r) {
|
|
8078
8088
|
return r ? r.length <= 13 ? r : `${r.slice(0, 6)}…${r.slice(-4)}` : "—";
|
|
8079
8089
|
}
|
|
8080
|
-
function
|
|
8090
|
+
function Ws(r, e = "CROSS", s = 18) {
|
|
8081
8091
|
if (!r || r === "0x" || r === "0x0") return null;
|
|
8082
8092
|
try {
|
|
8083
8093
|
const t = BigInt(r);
|
|
@@ -8088,7 +8098,7 @@ function Hs(r, e = "CROSS", s = 18) {
|
|
|
8088
8098
|
return null;
|
|
8089
8099
|
}
|
|
8090
8100
|
}
|
|
8091
|
-
const
|
|
8101
|
+
const is = {
|
|
8092
8102
|
1: "Ethereum Mainnet",
|
|
8093
8103
|
5: "Goerli Testnet",
|
|
8094
8104
|
11155111: "Ethereum Sepolia",
|
|
@@ -8111,9 +8121,9 @@ const ns = {
|
|
|
8111
8121
|
612044: "CROSS Testnet",
|
|
8112
8122
|
612055: "CROSS Mainnet"
|
|
8113
8123
|
};
|
|
8114
|
-
function
|
|
8124
|
+
function Gs(r) {
|
|
8115
8125
|
const e = parseInt(r.split(":")[1] ?? "", 10);
|
|
8116
|
-
return !isNaN(e) &&
|
|
8126
|
+
return !isNaN(e) && is[e] ? is[e] : r;
|
|
8117
8127
|
}
|
|
8118
8128
|
function mt(r, e) {
|
|
8119
8129
|
if (r === 0n) return "0";
|
|
@@ -8128,18 +8138,18 @@ function dt(r) {
|
|
|
8128
8138
|
return r;
|
|
8129
8139
|
}
|
|
8130
8140
|
}
|
|
8131
|
-
function
|
|
8141
|
+
function ri(r) {
|
|
8132
8142
|
try {
|
|
8133
8143
|
return BigInt(r).toLocaleString();
|
|
8134
8144
|
} catch {
|
|
8135
8145
|
return r;
|
|
8136
8146
|
}
|
|
8137
8147
|
}
|
|
8138
|
-
function
|
|
8148
|
+
function ni(r) {
|
|
8139
8149
|
const { gasLimit: e, gasPrice: s, maxFeePerGas: t, maxPriorityFeePerGas: n, nativeSymbol: i = "ETH", nativeDecimals: o = 18 } = r;
|
|
8140
8150
|
if (!e) return null;
|
|
8141
8151
|
try {
|
|
8142
|
-
const a = BigInt(e), c =
|
|
8152
|
+
const a = BigInt(e), c = ri(e);
|
|
8143
8153
|
if (t) {
|
|
8144
8154
|
const l = a * BigInt(t);
|
|
8145
8155
|
return {
|
|
@@ -8164,8 +8174,8 @@ function si(r) {
|
|
|
8164
8174
|
return null;
|
|
8165
8175
|
}
|
|
8166
8176
|
}
|
|
8167
|
-
function
|
|
8168
|
-
const e =
|
|
8177
|
+
function qs(r) {
|
|
8178
|
+
const e = ni(r);
|
|
8169
8179
|
if (!e) return j("Estimated fee", "<span>—</span>");
|
|
8170
8180
|
let s = j("Est. Tx Fee", `<span>${e.estTxFee}</span>`);
|
|
8171
8181
|
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 +8186,16 @@ const ge = `<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="
|
|
|
8176
8186
|
</svg>`, ne = `<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round">
|
|
8177
8187
|
<line x1="18" y1="6" x2="6" y2="18"/>
|
|
8178
8188
|
<line x1="6" y1="6" x2="18" y2="18"/>
|
|
8179
|
-
</svg>`,
|
|
8189
|
+
</svg>`, ii = `<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
8180
8190
|
<circle cx="20" cy="20" r="20" fill="#00D5AA"/>
|
|
8181
8191
|
<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
|
-
},
|
|
8192
|
+
</svg>`, oi = '<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>', ai = '<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>', ci = '<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>', li = {
|
|
8193
|
+
[Ue.MetaMask]: oi,
|
|
8194
|
+
[Ue.Binance]: ai,
|
|
8195
|
+
[Ue.CROSSx]: ci
|
|
8196
|
+
}, Ks = '<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">${Ks}</svg>`, di = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none">
|
|
8187
8197
|
<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>`,
|
|
8198
|
+
</svg>`, ui = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none">
|
|
8189
8199
|
<circle cx="12" cy="12" r="12" fill="var(--cx-error)"/>
|
|
8190
8200
|
<circle cx="12" cy="12" r="5.5" stroke="white" stroke-width="1.5"/>
|
|
8191
8201
|
<path d="M12 9.5v3l2 1.5" stroke="white" stroke-width="1.5" stroke-linecap="round"/>
|
|
@@ -8223,9 +8233,9 @@ function j(r, e) {
|
|
|
8223
8233
|
<div class="__crossx-row-value">${e}</div>
|
|
8224
8234
|
</div>`;
|
|
8225
8235
|
}
|
|
8226
|
-
function
|
|
8236
|
+
function hi(r, e) {
|
|
8227
8237
|
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 =
|
|
8238
|
+
<button class="__crossx-copy-btn" data-copy="${C(r.to)}" title="Copy address">${ge}</button>` : "<span>—</span>", a = qs(r), c = Ws(r.value, t, n), l = c ? j("Value", `<span>${c}</span>`) : "", u = r.data ?? "0x", f = document.createElement("div");
|
|
8229
8239
|
return f.id = J, f.innerHTML = `
|
|
8230
8240
|
<div class="__crossx-card __crossx-card--migration __crossx-card--sign-tx" style="${oe(s)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
8231
8241
|
<div class="__crossx-header">
|
|
@@ -8249,7 +8259,7 @@ function di(r, e) {
|
|
|
8249
8259
|
<div class="__crossx-col-right-sign">
|
|
8250
8260
|
<div class="__crossx-rows">
|
|
8251
8261
|
${j("To", o)}
|
|
8252
|
-
${j("Network", `<span>${
|
|
8262
|
+
${j("Network", `<span>${Gs(r.chainId)}</span>`)}
|
|
8253
8263
|
${l}
|
|
8254
8264
|
${a}
|
|
8255
8265
|
</div>
|
|
@@ -8264,9 +8274,9 @@ function di(r, e) {
|
|
|
8264
8274
|
</div>
|
|
8265
8275
|
`, f;
|
|
8266
8276
|
}
|
|
8267
|
-
function
|
|
8277
|
+
function pi(r, e) {
|
|
8268
8278
|
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 =
|
|
8279
|
+
<button class="__crossx-copy-btn" data-copy="${C(r.to)}" title="Copy address">${ge}</button>` : "<span>—</span>", a = qs(r), l = Ws(r.value, t, n) ?? "—", u = document.createElement("div");
|
|
8270
8280
|
return u.id = J, u.innerHTML = `
|
|
8271
8281
|
<div class="__crossx-card __crossx-card--migration __crossx-card--send-tx" style="${oe(s)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
8272
8282
|
<div class="__crossx-header">
|
|
@@ -8281,7 +8291,7 @@ function ui(r, e) {
|
|
|
8281
8291
|
<div class="__crossx-body-cols">
|
|
8282
8292
|
<div class="__crossx-rows">
|
|
8283
8293
|
${j("To", o)}
|
|
8284
|
-
${j("Network", `<span>${
|
|
8294
|
+
${j("Network", `<span>${Gs(r.chainId)}</span>`)}
|
|
8285
8295
|
${a}
|
|
8286
8296
|
</div>
|
|
8287
8297
|
<div class="__crossx-pill">
|
|
@@ -8306,10 +8316,10 @@ function tt(r) {
|
|
|
8306
8316
|
function C(r) {
|
|
8307
8317
|
return r.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
8308
8318
|
}
|
|
8309
|
-
function
|
|
8319
|
+
function fi(r) {
|
|
8310
8320
|
return typeof r == "string" && /^0x[0-9a-fA-F]{40}$/i.test(r);
|
|
8311
8321
|
}
|
|
8312
|
-
function
|
|
8322
|
+
function _i(r) {
|
|
8313
8323
|
if (typeof r == "string") return C(r);
|
|
8314
8324
|
if (typeof r == "number" || typeof r == "bigint" || typeof r == "boolean") return String(r);
|
|
8315
8325
|
try {
|
|
@@ -8318,7 +8328,7 @@ function pi(r) {
|
|
|
8318
8328
|
return String(r);
|
|
8319
8329
|
}
|
|
8320
8330
|
}
|
|
8321
|
-
function
|
|
8331
|
+
function xi(r, e) {
|
|
8322
8332
|
const s = j(
|
|
8323
8333
|
"From",
|
|
8324
8334
|
`<span class="__crossx-addr-text">${se(r.from)}</span>
|
|
@@ -8350,7 +8360,7 @@ function fi(r, e) {
|
|
|
8350
8360
|
</div>
|
|
8351
8361
|
`, c;
|
|
8352
8362
|
}
|
|
8353
|
-
function
|
|
8363
|
+
function gi(r, e) {
|
|
8354
8364
|
const s = document.createElement("div");
|
|
8355
8365
|
return s.id = J, s.innerHTML = `
|
|
8356
8366
|
<div class="__crossx-card __crossx-card--migration" style="${oe(e)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
@@ -8367,11 +8377,11 @@ function _i(r, e) {
|
|
|
8367
8377
|
</div>
|
|
8368
8378
|
`, s;
|
|
8369
8379
|
}
|
|
8370
|
-
function
|
|
8380
|
+
function mi(r, e, s) {
|
|
8371
8381
|
const t = e.status !== "reverted" && e.status !== "timeout", n = e.status === "timeout", i = r.querySelector("#__crossx-ttl"), o = r.querySelector(".__crossx-header");
|
|
8372
8382
|
if (i) {
|
|
8373
|
-
const p = n ?
|
|
8374
|
-
p ? (i.style.display = "flex", i.style.alignItems = "center", i.style.gap = "8px", i.innerHTML = `${p}<span>${
|
|
8383
|
+
const p = n ? ui : t ? "" : di, v = n ? "Transaction timeout" : t ? "Transaction complete" : "Transaction failed";
|
|
8384
|
+
p ? (i.style.display = "flex", i.style.alignItems = "center", i.style.gap = "8px", i.innerHTML = `${p}<span>${v}</span>`) : i.textContent = v;
|
|
8375
8385
|
}
|
|
8376
8386
|
if (o && !r.querySelector("#__crossx-close-btn")) {
|
|
8377
8387
|
const p = document.createElement("button");
|
|
@@ -8397,16 +8407,16 @@ function xi(r, e, s) {
|
|
|
8397
8407
|
${_}
|
|
8398
8408
|
<button class="__crossx-approve-btn" id="__crossx-done-btn">${t ? "All Done" : "Done"}</button>
|
|
8399
8409
|
`, a.querySelectorAll(".__crossx-copy-btn").forEach((p) => {
|
|
8400
|
-
p.addEventListener("click", (
|
|
8410
|
+
p.addEventListener("click", (v) => {
|
|
8401
8411
|
var I;
|
|
8402
|
-
|
|
8403
|
-
const
|
|
8404
|
-
|
|
8412
|
+
v.stopPropagation();
|
|
8413
|
+
const S = p.dataset.copy;
|
|
8414
|
+
S && ((I = navigator.clipboard) == null || I.writeText(S).catch(() => {
|
|
8405
8415
|
}));
|
|
8406
8416
|
});
|
|
8407
8417
|
});
|
|
8408
8418
|
}
|
|
8409
|
-
function
|
|
8419
|
+
function wi(r, e) {
|
|
8410
8420
|
const s = e, t = tt(r.dappName), n = C(r.message), i = document.createElement("div");
|
|
8411
8421
|
return i.id = J, i.innerHTML = `
|
|
8412
8422
|
<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 +8448,7 @@ function gi(r, e) {
|
|
|
8438
8448
|
</div>
|
|
8439
8449
|
`, i;
|
|
8440
8450
|
}
|
|
8441
|
-
function
|
|
8451
|
+
function yi(r, e) {
|
|
8442
8452
|
const s = e, t = tt(r.dappName);
|
|
8443
8453
|
let n = {};
|
|
8444
8454
|
if (typeof r.typedData == "string")
|
|
@@ -8454,7 +8464,7 @@ function mi(r, e) {
|
|
|
8454
8464
|
<span class="__crossx-td-value">${C(i)}</span>
|
|
8455
8465
|
</div>`;
|
|
8456
8466
|
for (const [l, u] of Object.entries(o)) {
|
|
8457
|
-
const f =
|
|
8467
|
+
const f = _i(u), _ = fi(u) ? `<span class="__crossx-addr-text">${se(u)}</span>
|
|
8458
8468
|
<button class="__crossx-copy-btn" data-copy="${C(String(u))}" title="Copy">${ge}</button>` : `<span>${f}</span>`;
|
|
8459
8469
|
a += `
|
|
8460
8470
|
<div class="__crossx-td-row">
|
|
@@ -8493,29 +8503,29 @@ function mi(r, e) {
|
|
|
8493
8503
|
</div>
|
|
8494
8504
|
`, c;
|
|
8495
8505
|
}
|
|
8496
|
-
const
|
|
8506
|
+
const bi = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round">
|
|
8497
8507
|
<line x1="12" y1="5" x2="12" y2="19"/>
|
|
8498
8508
|
<line x1="5" y1="12" x2="19" y2="12"/>
|
|
8499
|
-
</svg>`,
|
|
8500
|
-
function
|
|
8509
|
+
</svg>`, Si = '<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>';
|
|
8510
|
+
function Vs(r) {
|
|
8501
8511
|
return r.name || `Account ${r.index + 1}`;
|
|
8502
8512
|
}
|
|
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">${
|
|
8513
|
+
function vi() {
|
|
8514
|
+
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">${Ks}</g></svg>`;
|
|
8505
8515
|
}
|
|
8506
|
-
const
|
|
8507
|
-
function
|
|
8508
|
-
return e.replace("#", ""), `${
|
|
8516
|
+
const Ei = ls().portraitBaseUrl;
|
|
8517
|
+
function Ai(r, e) {
|
|
8518
|
+
return e.replace("#", ""), `${Ei}/portrait/evm/${r}.png?size=56`;
|
|
8509
8519
|
}
|
|
8510
|
-
function
|
|
8511
|
-
const t =
|
|
8520
|
+
function zs(r, e, s) {
|
|
8521
|
+
const t = Ai(r, s), i = vi().replace(/"/g, """);
|
|
8512
8522
|
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
8523
|
}
|
|
8514
|
-
function
|
|
8524
|
+
function Ii(r, e, s) {
|
|
8515
8525
|
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">${
|
|
8526
|
+
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">${Si}</span>` : "";
|
|
8517
8527
|
return `<button class="__crossx-wallet-item${c}" data-wallet-index="${o.index}" data-wallet-address="${C(o.address)}">
|
|
8518
|
-
${
|
|
8528
|
+
${zs(o.address, o.index, e.bg)}<span class="__crossx-wallet-info"><span class="__crossx-wallet-idx">${C(Vs(o))}</span><span class="__crossx-wallet-addr">${se(o.address)}</span></span>${l}
|
|
8519
8529
|
</button>`;
|
|
8520
8530
|
}).join(""), i = document.createElement("div");
|
|
8521
8531
|
return i.id = J, i.innerHTML = `
|
|
@@ -8542,7 +8552,7 @@ function Ei(r, e, s) {
|
|
|
8542
8552
|
${n}
|
|
8543
8553
|
</div>
|
|
8544
8554
|
<button class="__crossx-wallet-add" id="__crossx-add-wallet-btn" type="button">
|
|
8545
|
-
<span class="__crossx-wallet-add-icon">${
|
|
8555
|
+
<span class="__crossx-wallet-add-icon">${bi}</span>
|
|
8546
8556
|
<span class="__crossx-wallet-add-label">add a wallet</span>
|
|
8547
8557
|
</button>
|
|
8548
8558
|
</div>
|
|
@@ -8551,22 +8561,22 @@ function Ei(r, e, s) {
|
|
|
8551
8561
|
</div>
|
|
8552
8562
|
`, i;
|
|
8553
8563
|
}
|
|
8554
|
-
const
|
|
8564
|
+
const ki = `<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
8555
8565
|
<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
8566
|
<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>`,
|
|
8567
|
+
</svg>`, Ti = `<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
8558
8568
|
<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
8569
|
<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
8570
|
<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
8571
|
<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
8572
|
</svg>`;
|
|
8563
|
-
function
|
|
8564
|
-
const e =
|
|
8565
|
-
return `<span class="__crossx-connect-other-wallet-desc-part"><span class="__crossx-connect-other-wallet-icon" aria-hidden="true">${
|
|
8573
|
+
function Ri(r) {
|
|
8574
|
+
const e = sr(r);
|
|
8575
|
+
return `<span class="__crossx-connect-other-wallet-desc-part"><span class="__crossx-connect-other-wallet-icon" aria-hidden="true">${li[r] ?? ""}</span><span class="__crossx-connect-other-wallet-name">${C(e)}</span></span>`;
|
|
8566
8576
|
}
|
|
8567
|
-
function
|
|
8577
|
+
function Oi(r) {
|
|
8568
8578
|
if (r.length === 0) return "";
|
|
8569
|
-
const e = (n) =>
|
|
8579
|
+
const e = (n) => Ri(r[n]), s = "Supported wallets include ";
|
|
8570
8580
|
if (r.length === 1)
|
|
8571
8581
|
return `${s}${e(0)}.`;
|
|
8572
8582
|
if (r.length === 2)
|
|
@@ -8576,7 +8586,7 @@ function Ti(r) {
|
|
|
8576
8586
|
const t = r.length - 3;
|
|
8577
8587
|
return `${s}${e(0)}, ${e(1)}, ${e(2)}, and ${t} more.`;
|
|
8578
8588
|
}
|
|
8579
|
-
function
|
|
8589
|
+
function Pi(r, e = []) {
|
|
8580
8590
|
const s = r, t = C(String(e[0])), n = e.length > 0 ? `
|
|
8581
8591
|
<div class="__crossx-login-or-divider">
|
|
8582
8592
|
<hr><span>or</span><hr>
|
|
@@ -8584,7 +8594,7 @@ function Ri(r, e = []) {
|
|
|
8584
8594
|
<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
8595
|
<span class="__crossx-connect-other-text">
|
|
8586
8596
|
<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">${
|
|
8597
|
+
<span class="__crossx-connect-other-desc __crossx-connect-other-summary">${Oi(e)}</span>
|
|
8588
8598
|
</span>
|
|
8589
8599
|
</button>` : "", i = document.createElement("div");
|
|
8590
8600
|
return i.id = J, i.innerHTML = `
|
|
@@ -8600,11 +8610,11 @@ function Ri(r, e = []) {
|
|
|
8600
8610
|
<div class="__crossx-body">
|
|
8601
8611
|
<div class="__crossx-login-btn-row">
|
|
8602
8612
|
<button class="__crossx-login-btn" id="__crossx-apple-btn" type="button">
|
|
8603
|
-
<span class="__crossx-login-icon" style="color:var(--cx-value);">${
|
|
8613
|
+
<span class="__crossx-login-icon" style="color:var(--cx-value);">${ki}</span>
|
|
8604
8614
|
<span class="__crossx-login-btn-label">Sign in with Apple</span>
|
|
8605
8615
|
</button>
|
|
8606
8616
|
<button class="__crossx-login-btn" id="__crossx-google-btn" type="button">
|
|
8607
|
-
<span class="__crossx-login-icon">${
|
|
8617
|
+
<span class="__crossx-login-icon">${Ti}</span>
|
|
8608
8618
|
<span class="__crossx-login-btn-label">Sign in with Google</span>
|
|
8609
8619
|
</button>
|
|
8610
8620
|
</div>${n}
|
|
@@ -8615,7 +8625,7 @@ function Ri(r, e = []) {
|
|
|
8615
8625
|
</div>
|
|
8616
8626
|
`, i;
|
|
8617
8627
|
}
|
|
8618
|
-
function
|
|
8628
|
+
function Ci(r, e) {
|
|
8619
8629
|
const s = r, t = document.createElement("div");
|
|
8620
8630
|
t.id = J;
|
|
8621
8631
|
const n = C(e.message).replace(/\n/g, "<br>"), i = e.email ? `<div class="__crossx-session-account-card">
|
|
@@ -8643,7 +8653,7 @@ function Oi(r, e) {
|
|
|
8643
8653
|
</div>
|
|
8644
8654
|
`, t;
|
|
8645
8655
|
}
|
|
8646
|
-
function
|
|
8656
|
+
function Ni(r, e = !0) {
|
|
8647
8657
|
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
8658
|
return i.id = J, i.innerHTML = `
|
|
8649
8659
|
<div class="__crossx-card __crossx-card--migration" style="${oe(s)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
@@ -8659,7 +8669,7 @@ function Pi(r, e = !0) {
|
|
|
8659
8669
|
<p class="__crossx-mig-info-desc">It safely restores and integrates all your previous assets. Simply verify your PIN to get started.</p>
|
|
8660
8670
|
</div>
|
|
8661
8671
|
<button class="__crossx-recover-btn" id="__crossx-recover-btn">
|
|
8662
|
-
<span class="__crossx-recover-icon">${
|
|
8672
|
+
<span class="__crossx-recover-icon">${ii}</span>
|
|
8663
8673
|
<span class="__crossx-recover-label">Import from Social Backup</span>
|
|
8664
8674
|
</button>
|
|
8665
8675
|
${n}
|
|
@@ -8667,7 +8677,7 @@ function Pi(r, e = !0) {
|
|
|
8667
8677
|
</div>
|
|
8668
8678
|
`, i;
|
|
8669
8679
|
}
|
|
8670
|
-
function
|
|
8680
|
+
function Li(r, e) {
|
|
8671
8681
|
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
8682
|
return f.id = J, f.innerHTML = `
|
|
8673
8683
|
<div class="__crossx-card __crossx-card--migration" style="${oe(s)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
@@ -8691,12 +8701,12 @@ function Ci(r, e) {
|
|
|
8691
8701
|
</div>
|
|
8692
8702
|
`, f;
|
|
8693
8703
|
}
|
|
8694
|
-
function
|
|
8704
|
+
function Di(r) {
|
|
8695
8705
|
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
8706
|
return `${n}, ${i} ${o} ${a}:${c}`;
|
|
8697
8707
|
}
|
|
8698
|
-
function
|
|
8699
|
-
const t = r, n = e <= 0, i = n ? null : Date.now() + e * 1e3, o = i ?
|
|
8708
|
+
function Mi(r, e, s) {
|
|
8709
|
+
const t = r, n = e <= 0, i = n ? null : Date.now() + e * 1e3, o = i ? Di(i) : null, a = document.createElement("div");
|
|
8700
8710
|
return a.id = J, a.innerHTML = `
|
|
8701
8711
|
<div class="__crossx-card __crossx-card--migration" style="${oe(t)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
8702
8712
|
<div class="__crossx-header">
|
|
@@ -8726,10 +8736,10 @@ function Li(r, e, s) {
|
|
|
8726
8736
|
return () => clearInterval(f);
|
|
8727
8737
|
} };
|
|
8728
8738
|
}
|
|
8729
|
-
function
|
|
8739
|
+
function $i(r) {
|
|
8730
8740
|
const s = [r.check1, r.check2].map((t, n) => `
|
|
8731
8741
|
<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}">${
|
|
8742
|
+
<div class="__crossx-pw-notice-check" id="__crossx-notice-check-${n}">${Fi}</div>
|
|
8733
8743
|
<span class="__crossx-pw-notice-item-text">${C(t)}</span>
|
|
8734
8744
|
</div>
|
|
8735
8745
|
`).join("");
|
|
@@ -8744,7 +8754,7 @@ function Di(r) {
|
|
|
8744
8754
|
<div class="__crossx-pw-fields __crossx-pw-fields--notice">
|
|
8745
8755
|
<div class="__crossx-pw-notice-header">
|
|
8746
8756
|
<div class="__crossx-pw-notice-title-row">
|
|
8747
|
-
<span class="__crossx-pw-notice-icon">${
|
|
8757
|
+
<span class="__crossx-pw-notice-icon">${Wi}</span>
|
|
8748
8758
|
<p class="__crossx-pw-notice-title">${C(r.noticeTitle)}</p>
|
|
8749
8759
|
</div>
|
|
8750
8760
|
<p class="__crossx-pw-notice-desc">${C(r.noticeDesc)}</p>
|
|
@@ -8764,14 +8774,14 @@ function Di(r) {
|
|
|
8764
8774
|
}
|
|
8765
8775
|
function ut(r) {
|
|
8766
8776
|
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
|
-
${
|
|
8777
|
+
${js}
|
|
8768
8778
|
<span id="__crossx-pin6-lock-countdown"></span>
|
|
8769
8779
|
</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
8780
|
{ length: 6 },
|
|
8771
|
-
(
|
|
8781
|
+
(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
8782
|
).join(""), f = e ? " --locked" : "", x = Array.from(
|
|
8773
8783
|
{ length: 6 },
|
|
8774
|
-
(
|
|
8784
|
+
(v, S) => `<div class="__crossx-pin6-dot${f}" data-dot-index="${S}" aria-label="PIN digit ${S + 1}"></div>`
|
|
8775
8785
|
).join(""), _ = e ? " --disabled" : "", p = `
|
|
8776
8786
|
<div class="__crossx-pin6-numpad" id="__crossx-pin6-numpad">
|
|
8777
8787
|
<div class="__crossx-pin6-numpad-row">
|
|
@@ -8792,7 +8802,7 @@ function ut(r) {
|
|
|
8792
8802
|
<div class="__crossx-pin6-numpad-row">
|
|
8793
8803
|
<button type="button" class="__crossx-pin6-numpad-key --empty" aria-hidden="true"></button>
|
|
8794
8804
|
<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">${
|
|
8805
|
+
<button type="button" class="__crossx-pin6-numpad-key --delete${_}" data-key="backspace" aria-label="Delete">${Hi}</button>
|
|
8796
8806
|
</div>
|
|
8797
8807
|
</div>`;
|
|
8798
8808
|
return `
|
|
@@ -8818,7 +8828,7 @@ function ut(r) {
|
|
|
8818
8828
|
${p}
|
|
8819
8829
|
`;
|
|
8820
8830
|
}
|
|
8821
|
-
function
|
|
8831
|
+
function os(r, e) {
|
|
8822
8832
|
const s = document.createElement("div");
|
|
8823
8833
|
return s.id = J, s.innerHTML = `
|
|
8824
8834
|
<div class="__crossx-card __crossx-card--pin6" style="${oe(r)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
@@ -8826,23 +8836,23 @@ function is(r, e) {
|
|
|
8826
8836
|
</div>
|
|
8827
8837
|
`, s;
|
|
8828
8838
|
}
|
|
8829
|
-
function
|
|
8839
|
+
function Bi(r, e) {
|
|
8830
8840
|
if (r.length !== 6) return e.tooShort;
|
|
8831
8841
|
if (!/^\d+$/.test(r)) return e.numbersOnly;
|
|
8832
8842
|
if (/(.)\1{2}/.test(r)) return e.repeatingDigit;
|
|
8833
8843
|
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
8844
|
return t || n ? e.sequential : r[0] !== r[1] && r === r.slice(0, 2).repeat(3) ? e.alternatingPattern : null;
|
|
8835
8845
|
}
|
|
8836
|
-
function
|
|
8846
|
+
function Ui(r) {
|
|
8837
8847
|
const e = Math.max(0, Math.ceil(r / 1e3)), s = Math.floor(e / 3600), t = Math.floor(e % 3600 / 60), n = e % 60;
|
|
8838
8848
|
return s > 0 ? `${s}h ${String(t).padStart(2, "0")}m` : `${String(t).padStart(2, "0")}:${String(n).padStart(2, "0")}`;
|
|
8839
8849
|
}
|
|
8840
8850
|
function ht(r, e, s, t, n, i, o) {
|
|
8841
|
-
var O,
|
|
8851
|
+
var O, M;
|
|
8842
8852
|
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"),
|
|
8853
|
+
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
8854
|
var E;
|
|
8845
|
-
const y = l(), b =
|
|
8855
|
+
const y = l(), b = S();
|
|
8846
8856
|
if (b.length && (b.forEach((A, R) => {
|
|
8847
8857
|
const F = !!(y[R] && y[R].value);
|
|
8848
8858
|
A.classList.toggle("--filled", F), A.classList.toggle("--active", !1);
|
|
@@ -8851,8 +8861,8 @@ function ht(r, e, s, t, n, i, o) {
|
|
|
8851
8861
|
(E = b[A === -1 ? 5 : A]) == null || E.classList.add("--active");
|
|
8852
8862
|
}
|
|
8853
8863
|
}, T = () => {
|
|
8854
|
-
r.querySelectorAll(".__crossx-pin6-numpad-key[data-key]").forEach((b) => b.classList.toggle("--disabled", a)),
|
|
8855
|
-
},
|
|
8864
|
+
r.querySelectorAll(".__crossx-pin6-numpad-key[data-key]").forEach((b) => b.classList.toggle("--disabled", a)), S().forEach((b) => b.classList.toggle("--locked", a)), I();
|
|
8865
|
+
}, B = (y) => {
|
|
8856
8866
|
a = y, l().forEach((b) => {
|
|
8857
8867
|
b.disabled = y, b.classList.toggle("--locked", y);
|
|
8858
8868
|
});
|
|
@@ -8880,7 +8890,7 @@ function ht(r, e, s, t, n, i, o) {
|
|
|
8880
8890
|
R ? R.insertAdjacentElement("afterend", E) : (A = p()) == null || A.appendChild(E);
|
|
8881
8891
|
}
|
|
8882
8892
|
E.textContent = `${y}/${b}`;
|
|
8883
|
-
},
|
|
8893
|
+
}, H = () => {
|
|
8884
8894
|
const y = D();
|
|
8885
8895
|
y && (y.textContent = "");
|
|
8886
8896
|
}, N = (y) => {
|
|
@@ -8893,25 +8903,25 @@ function ht(r, e, s, t, n, i, o) {
|
|
|
8893
8903
|
var A;
|
|
8894
8904
|
(A = l()[0]) == null || A.focus(), I();
|
|
8895
8905
|
}, 50);
|
|
8896
|
-
},
|
|
8906
|
+
}, $ = (y) => {
|
|
8897
8907
|
var F;
|
|
8898
|
-
|
|
8899
|
-
|
|
8908
|
+
B(!0), l().forEach((U) => {
|
|
8909
|
+
U.value = "";
|
|
8900
8910
|
}), T();
|
|
8901
8911
|
const b = f();
|
|
8902
8912
|
if (b && (b.textContent = "Too many failed attempts. Please wait."), !x()) {
|
|
8903
|
-
const
|
|
8904
|
-
|
|
8913
|
+
const U = document.createElement("p");
|
|
8914
|
+
U.className = "__crossx-pin6-lock-msg", U.id = "__crossx-pin6-lock-msg", U.innerHTML = `${js}<span id="__crossx-pin6-lock-countdown"></span>`;
|
|
8905
8915
|
const L = f();
|
|
8906
|
-
L ? L.insertAdjacentElement("afterend",
|
|
8916
|
+
L ? L.insertAdjacentElement("afterend", U) : (F = p()) == null || F.appendChild(U);
|
|
8907
8917
|
}
|
|
8908
8918
|
const E = () => {
|
|
8909
8919
|
var G;
|
|
8910
|
-
const
|
|
8911
|
-
|
|
8920
|
+
const U = y - Date.now(), L = _();
|
|
8921
|
+
U <= 0 ? (clearInterval(A), B(!1), (G = x()) == null || G.remove(), b && (b.textContent = ""), T(), setTimeout(() => {
|
|
8912
8922
|
var Y;
|
|
8913
8923
|
return (Y = l()[0]) == null ? void 0 : Y.focus();
|
|
8914
|
-
}, 50)) : L && (L.textContent = ` ${
|
|
8924
|
+
}, 50)) : L && (L.textContent = ` ${Ui(U)}`);
|
|
8915
8925
|
}, A = setInterval(E, 1e3);
|
|
8916
8926
|
E();
|
|
8917
8927
|
const R = new MutationObserver(() => {
|
|
@@ -8920,7 +8930,7 @@ function ht(r, e, s, t, n, i, o) {
|
|
|
8920
8930
|
R.observe(document.body, { childList: !0, subtree: !1 });
|
|
8921
8931
|
}, m = async () => {
|
|
8922
8932
|
if (a || c) return;
|
|
8923
|
-
const y =
|
|
8933
|
+
const y = v();
|
|
8924
8934
|
if (y.length === 6) {
|
|
8925
8935
|
c = !0, l().forEach((b) => {
|
|
8926
8936
|
b.disabled = !0;
|
|
@@ -8928,7 +8938,7 @@ function ht(r, e, s, t, n, i, o) {
|
|
|
8928
8938
|
try {
|
|
8929
8939
|
if (n) {
|
|
8930
8940
|
const b = await n(y);
|
|
8931
|
-
b.ok ? e(y) : b.lockExpiresAt ? (
|
|
8941
|
+
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
8942
|
} else
|
|
8933
8943
|
e(y);
|
|
8934
8944
|
} catch (b) {
|
|
@@ -8940,7 +8950,7 @@ function ht(r, e, s, t, n, i, o) {
|
|
|
8940
8950
|
}
|
|
8941
8951
|
}
|
|
8942
8952
|
};
|
|
8943
|
-
i && i > Date.now() ?
|
|
8953
|
+
i && i > Date.now() ? $(i) : setTimeout(() => {
|
|
8944
8954
|
var y;
|
|
8945
8955
|
return (y = l()[0]) == null ? void 0 : y.focus();
|
|
8946
8956
|
}, 100);
|
|
@@ -8951,14 +8961,14 @@ function ht(r, e, s, t, n, i, o) {
|
|
|
8951
8961
|
};
|
|
8952
8962
|
(O = u()) == null || O.addEventListener("click", (y) => {
|
|
8953
8963
|
y.target.classList.contains("__crossx-pin6-box") || w();
|
|
8954
|
-
}), (
|
|
8964
|
+
}), (M = p()) == null || M.addEventListener("click", (y) => {
|
|
8955
8965
|
const b = y.target;
|
|
8956
8966
|
b.classList.contains("__crossx-pin6-box") || b.closest("button") || w();
|
|
8957
8967
|
}), l().forEach((y, b) => {
|
|
8958
8968
|
y.addEventListener("input", () => {
|
|
8959
8969
|
var A;
|
|
8960
8970
|
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(),
|
|
8971
|
+
y.value = E, K(), E && b < 5 && ((A = l()[b + 1]) == null || A.focus()), I(), v().length === 6 && setTimeout(m, 80);
|
|
8962
8972
|
}), y.addEventListener("keydown", (E) => {
|
|
8963
8973
|
var A, R;
|
|
8964
8974
|
if (E.key === "Backspace") {
|
|
@@ -8971,14 +8981,14 @@ function ht(r, e, s, t, n, i, o) {
|
|
|
8971
8981
|
I();
|
|
8972
8982
|
} 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
8983
|
}), y.addEventListener("paste", (E) => {
|
|
8974
|
-
var F,
|
|
8984
|
+
var F, U;
|
|
8975
8985
|
E.preventDefault();
|
|
8976
8986
|
const A = (((F = E.clipboardData) == null ? void 0 : F.getData("text")) ?? "").replace(/\D/g, "").slice(0, 6);
|
|
8977
8987
|
if (!A) return;
|
|
8978
8988
|
const R = l();
|
|
8979
8989
|
A.split("").forEach((L, G) => {
|
|
8980
8990
|
R[G] && (R[G].value = L);
|
|
8981
|
-
}), (
|
|
8991
|
+
}), (U = R[Math.min(A.length - 1, 5)]) == null || U.focus(), K(), I(), v().length === 6 && setTimeout(m, 80);
|
|
8982
8992
|
}), y.addEventListener("focus", () => y.select());
|
|
8983
8993
|
});
|
|
8984
8994
|
const k = r.querySelector("#__crossx-pin6-numpad");
|
|
@@ -9000,8 +9010,8 @@ function ht(r, e, s, t, n, i, o) {
|
|
|
9000
9010
|
return;
|
|
9001
9011
|
}
|
|
9002
9012
|
if (!/^\d$/.test(R)) return;
|
|
9003
|
-
const
|
|
9004
|
-
|
|
9013
|
+
const U = l().find((L) => !L.value);
|
|
9014
|
+
U && (U.value = R, K(), I(), v().length === 6 && setTimeout(m, 80));
|
|
9005
9015
|
};
|
|
9006
9016
|
k.addEventListener("pointerup", (A) => {
|
|
9007
9017
|
if (!y) return;
|
|
@@ -9012,18 +9022,18 @@ function ht(r, e, s, t, n, i, o) {
|
|
|
9012
9022
|
}), k.addEventListener("pointercancel", b), k.addEventListener("pointerleave", b, !0), I(), i && i > Date.now() && T();
|
|
9013
9023
|
}
|
|
9014
9024
|
}
|
|
9015
|
-
const
|
|
9025
|
+
const Hi = `<svg width="22" height="17" viewBox="0 0 22 17" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
9016
9026
|
<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
9027
|
<line x1="10" y1="5.5" x2="16" y2="11.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
|
|
9018
9028
|
<line x1="16" y1="5.5" x2="10" y2="11.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
|
|
9019
|
-
</svg>`,
|
|
9029
|
+
</svg>`, js = `<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
9020
9030
|
<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>`,
|
|
9031
|
+
</svg>`, Fi = `<svg width="11" height="9" viewBox="0 0 11 9" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
9022
9032
|
<path d="M1 4.5L4 7.5L10 1" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
9023
|
-
</svg>`,
|
|
9033
|
+
</svg>`, Wi = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
9024
9034
|
<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
9035
|
</svg>`;
|
|
9026
|
-
function
|
|
9036
|
+
function Gi(r, e, s) {
|
|
9027
9037
|
var i;
|
|
9028
9038
|
const t = r.querySelectorAll(".__crossx-pin-input");
|
|
9029
9039
|
t.forEach((o, a) => {
|
|
@@ -9056,12 +9066,12 @@ function Fi(r, e, s) {
|
|
|
9056
9066
|
}
|
|
9057
9067
|
}), (i = t[0]) == null || i.focus();
|
|
9058
9068
|
}
|
|
9059
|
-
class
|
|
9069
|
+
class qi {
|
|
9060
9070
|
constructor(e = "light", s) {
|
|
9061
|
-
this.theme = e, this.overrides = s, this.tokens =
|
|
9071
|
+
this.theme = e, this.overrides = s, this.tokens = ns(e, s);
|
|
9062
9072
|
}
|
|
9063
9073
|
setTheme(e, s) {
|
|
9064
|
-
this.theme = e, s !== void 0 && (this.overrides = s), this.tokens =
|
|
9074
|
+
this.theme = e, s !== void 0 && (this.overrides = s), this.tokens = ns(e, this.overrides);
|
|
9065
9075
|
}
|
|
9066
9076
|
setMessages(e) {
|
|
9067
9077
|
this.messages = e;
|
|
@@ -9076,23 +9086,23 @@ class Wi {
|
|
|
9076
9086
|
*/
|
|
9077
9087
|
showWalletSelector(e, s, t) {
|
|
9078
9088
|
return new Promise((n) => {
|
|
9079
|
-
var
|
|
9089
|
+
var v;
|
|
9080
9090
|
ce();
|
|
9081
|
-
const i = [...e], o =
|
|
9091
|
+
const i = [...e], o = Ii(i, this.tokens, t), a = Oe();
|
|
9082
9092
|
le(o);
|
|
9083
9093
|
let c = !1;
|
|
9084
9094
|
const l = () => {
|
|
9085
9095
|
c || (c = !0, o.remove(), a());
|
|
9086
|
-
}, u = (
|
|
9087
|
-
l(), n(
|
|
9096
|
+
}, u = (S) => {
|
|
9097
|
+
l(), n(S);
|
|
9088
9098
|
}, f = () => {
|
|
9089
9099
|
l(), n(null);
|
|
9090
9100
|
};
|
|
9091
9101
|
(() => {
|
|
9092
|
-
o.querySelectorAll(".__crossx-wallet-item").forEach((
|
|
9093
|
-
|
|
9094
|
-
const I =
|
|
9095
|
-
u({ address: I, index: T, name:
|
|
9102
|
+
o.querySelectorAll(".__crossx-wallet-item").forEach((S) => {
|
|
9103
|
+
S.addEventListener("click", () => {
|
|
9104
|
+
const I = S.dataset.walletAddress ?? "", T = parseInt(S.dataset.walletIndex ?? "0", 10), B = i.find((D) => D.index === T);
|
|
9105
|
+
u({ address: I, index: T, name: B == null ? void 0 : B.name });
|
|
9096
9106
|
});
|
|
9097
9107
|
});
|
|
9098
9108
|
})();
|
|
@@ -9100,22 +9110,22 @@ class Wi {
|
|
|
9100
9110
|
_ && _.addEventListener("click", async () => {
|
|
9101
9111
|
_.disabled = !0;
|
|
9102
9112
|
try {
|
|
9103
|
-
const
|
|
9104
|
-
i.push(
|
|
9113
|
+
const S = await s();
|
|
9114
|
+
i.push(S);
|
|
9105
9115
|
const I = o.querySelector("#__crossx-wallet-list");
|
|
9106
9116
|
if (I) {
|
|
9107
9117
|
const T = document.createElement("button");
|
|
9108
|
-
T.className = "__crossx-wallet-item", T.dataset.walletIndex = String(
|
|
9118
|
+
T.className = "__crossx-wallet-item", T.dataset.walletIndex = String(S.index), T.dataset.walletAddress = S.address, T.innerHTML = `${zs(S.address, S.index, this.tokens.bg)}<span class="__crossx-wallet-info"><span class="__crossx-wallet-idx">${C(Vs(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
9119
|
}
|
|
9110
9120
|
} catch {
|
|
9111
9121
|
} finally {
|
|
9112
9122
|
_.disabled = !1;
|
|
9113
9123
|
}
|
|
9114
|
-
}), (
|
|
9115
|
-
|
|
9124
|
+
}), (v = o.querySelector("#__crossx-close-btn")) == null || v.addEventListener("click", f), o.addEventListener("click", (S) => {
|
|
9125
|
+
S.target === o && f();
|
|
9116
9126
|
});
|
|
9117
|
-
const p = (
|
|
9118
|
-
|
|
9127
|
+
const p = (S) => {
|
|
9128
|
+
S.key === "Escape" && (document.removeEventListener("keydown", p), f());
|
|
9119
9129
|
};
|
|
9120
9130
|
document.addEventListener("keydown", p);
|
|
9121
9131
|
});
|
|
@@ -9131,29 +9141,29 @@ class Wi {
|
|
|
9131
9141
|
(n) => Object.values(Ue).includes(n) && String(n).trim() !== ""
|
|
9132
9142
|
)) ?? [];
|
|
9133
9143
|
return new Promise((n) => {
|
|
9134
|
-
var x, _, p,
|
|
9144
|
+
var x, _, p, v;
|
|
9135
9145
|
ce();
|
|
9136
|
-
const i =
|
|
9146
|
+
const i = Pi(this.tokens, s), o = Oe();
|
|
9137
9147
|
le(i);
|
|
9138
9148
|
const a = () => {
|
|
9139
9149
|
i.remove(), o();
|
|
9140
|
-
}, c = (
|
|
9141
|
-
a(), n({ type: "oauth", provider:
|
|
9142
|
-
}, l = (
|
|
9143
|
-
a(), n({ type: "external", walletId:
|
|
9150
|
+
}, c = (S) => {
|
|
9151
|
+
a(), n({ type: "oauth", provider: S });
|
|
9152
|
+
}, l = (S) => {
|
|
9153
|
+
a(), n({ type: "external", walletId: S });
|
|
9144
9154
|
}, u = () => {
|
|
9145
9155
|
a(), n(null);
|
|
9146
9156
|
};
|
|
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 =
|
|
9157
|
+
(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) => {
|
|
9158
|
+
const T = S.currentTarget.dataset.walletId ?? "";
|
|
9149
9159
|
T && l(T);
|
|
9150
|
-
}), (
|
|
9151
|
-
|
|
9152
|
-
}), i.querySelectorAll(".__crossx-login-terms-link").forEach((
|
|
9153
|
-
|
|
9160
|
+
}), (v = i.querySelector("#__crossx-close-btn")) == null || v.addEventListener("click", u), i.addEventListener("click", (S) => {
|
|
9161
|
+
S.target === i && u();
|
|
9162
|
+
}), i.querySelectorAll(".__crossx-login-terms-link").forEach((S) => {
|
|
9163
|
+
S.addEventListener("click", (I) => I.stopPropagation());
|
|
9154
9164
|
});
|
|
9155
|
-
const f = (
|
|
9156
|
-
|
|
9165
|
+
const f = (S) => {
|
|
9166
|
+
S.key === "Escape" && (document.removeEventListener("keydown", f), u());
|
|
9157
9167
|
};
|
|
9158
9168
|
document.addEventListener("keydown", f);
|
|
9159
9169
|
});
|
|
@@ -9162,7 +9172,7 @@ class Wi {
|
|
|
9162
9172
|
return new Promise((s) => {
|
|
9163
9173
|
var u, f, x;
|
|
9164
9174
|
ce();
|
|
9165
|
-
const t = this.messages, n =
|
|
9175
|
+
const t = this.messages, n = Ci(this.tokens, {
|
|
9166
9176
|
title: e.title,
|
|
9167
9177
|
message: e.message,
|
|
9168
9178
|
email: e.email,
|
|
@@ -9192,7 +9202,7 @@ class Wi {
|
|
|
9192
9202
|
return new Promise((t) => {
|
|
9193
9203
|
var a, c, l;
|
|
9194
9204
|
ce();
|
|
9195
|
-
const n =
|
|
9205
|
+
const n = Ni(this.tokens, s);
|
|
9196
9206
|
le(n);
|
|
9197
9207
|
const i = () => n.remove(), o = () => {
|
|
9198
9208
|
i(), t("recover");
|
|
@@ -9238,7 +9248,7 @@ class Wi {
|
|
|
9238
9248
|
}, o = {
|
|
9239
9249
|
title: (t == null ? void 0 : t.pinSetup_confirmTitle) ?? "Confirm PIN",
|
|
9240
9250
|
headerSubtitle: (t == null ? void 0 : t.pinSetup_confirmSubtitle) ?? "Enter your PIN again to confirm."
|
|
9241
|
-
}, a =
|
|
9251
|
+
}, a = os(this.tokens, $i(n)), c = Oe();
|
|
9242
9252
|
le(a);
|
|
9243
9253
|
let l = !1;
|
|
9244
9254
|
const u = () => {
|
|
@@ -9253,62 +9263,62 @@ class Wi {
|
|
|
9253
9263
|
repeatingDigit: (t == null ? void 0 : t.pinValidation_repeatingDigit) ?? "Cannot use the same number 3+ times in a row.",
|
|
9254
9264
|
sequential: (t == null ? void 0 : t.pinValidation_sequential) ?? "Sequential numbers (e.g., 123456) are not allowed.",
|
|
9255
9265
|
alternatingPattern: (t == null ? void 0 : t.pinValidation_alternatingPattern) ?? "Repeating patterns (e.g., 121212) are not allowed."
|
|
9256
|
-
},
|
|
9257
|
-
var
|
|
9266
|
+
}, v = (T) => {
|
|
9267
|
+
var B;
|
|
9258
9268
|
_.innerHTML = ut({
|
|
9259
9269
|
title: o.title,
|
|
9260
9270
|
headerSubtitle: o.headerSubtitle
|
|
9261
|
-
}), (
|
|
9262
|
-
D === T ? f(T) :
|
|
9271
|
+
}), (B = _.querySelector("#__crossx-close-btn")) == null || B.addEventListener("click", x), ht(_, (D) => {
|
|
9272
|
+
D === T ? f(T) : S(i.mismatchError);
|
|
9263
9273
|
}, x);
|
|
9264
|
-
},
|
|
9265
|
-
var
|
|
9274
|
+
}, S = (T) => {
|
|
9275
|
+
var B;
|
|
9266
9276
|
_.innerHTML = ut({
|
|
9267
9277
|
title: i.title,
|
|
9268
9278
|
headerSubtitle: i.headerSubtitle,
|
|
9269
9279
|
subtitle: i.subtitle,
|
|
9270
9280
|
errorMessage: T
|
|
9271
|
-
}), (
|
|
9272
|
-
const K =
|
|
9273
|
-
K ?
|
|
9281
|
+
}), (B = _.querySelector("#__crossx-close-btn")) == null || B.addEventListener("click", x), ht(_, (D) => {
|
|
9282
|
+
const K = Bi(D, p);
|
|
9283
|
+
K ? S(K) : v(D);
|
|
9274
9284
|
}, x);
|
|
9275
9285
|
};
|
|
9276
9286
|
(() => {
|
|
9277
9287
|
var Q;
|
|
9278
|
-
const T = Array.from(_.querySelectorAll(".__crossx-pw-notice-item")),
|
|
9279
|
-
|
|
9280
|
-
const K =
|
|
9281
|
-
const
|
|
9282
|
-
|
|
9283
|
-
}, W = (
|
|
9288
|
+
const T = Array.from(_.querySelectorAll(".__crossx-pw-notice-item")), B = _.querySelector("#__crossx-pin-notice-next"), D = /* @__PURE__ */ new Set();
|
|
9289
|
+
B.removeAttribute("disabled");
|
|
9290
|
+
const K = B.dataset.nextLabel ?? "Next", q = B.dataset.submitLabel ?? "I Understand", Z = () => {
|
|
9291
|
+
const H = D.size === T.length;
|
|
9292
|
+
B.classList.toggle("--disabled", !H), B.textContent = H ? q : K;
|
|
9293
|
+
}, W = (H, N) => {
|
|
9284
9294
|
if (D.has(N)) return;
|
|
9285
|
-
const
|
|
9286
|
-
D.add(N),
|
|
9287
|
-
}, X = (
|
|
9295
|
+
const $ = H.querySelector(`#__crossx-notice-check-${N}`);
|
|
9296
|
+
D.add(N), $.classList.add("--checked"), H.setAttribute("aria-checked", "true"), Z();
|
|
9297
|
+
}, X = (H, N) => {
|
|
9288
9298
|
if (!D.has(N)) return;
|
|
9289
|
-
const
|
|
9290
|
-
D.delete(N),
|
|
9299
|
+
const $ = H.querySelector(`#__crossx-notice-check-${N}`);
|
|
9300
|
+
D.delete(N), $.classList.remove("--checked"), H.setAttribute("aria-checked", "false"), Z();
|
|
9291
9301
|
};
|
|
9292
|
-
T.forEach((
|
|
9293
|
-
const N = parseInt(
|
|
9294
|
-
|
|
9295
|
-
D.has(N) ? X(
|
|
9296
|
-
}),
|
|
9297
|
-
(
|
|
9302
|
+
T.forEach((H) => {
|
|
9303
|
+
const N = parseInt(H.dataset.checkIndex ?? "0", 10);
|
|
9304
|
+
H.addEventListener("click", () => {
|
|
9305
|
+
D.has(N) ? X(H, N) : W(H, N);
|
|
9306
|
+
}), H.addEventListener("keydown", ($) => {
|
|
9307
|
+
($.key === " " || $.key === "Enter") && ($.preventDefault(), D.has(N) ? X(H, N) : W(H, N));
|
|
9298
9308
|
});
|
|
9299
|
-
}),
|
|
9309
|
+
}), B.addEventListener("click", () => {
|
|
9300
9310
|
if (D.size === T.length) {
|
|
9301
|
-
|
|
9311
|
+
S(e == null ? void 0 : e.errorMessage);
|
|
9302
9312
|
return;
|
|
9303
9313
|
}
|
|
9304
|
-
const
|
|
9305
|
-
const m = parseInt(
|
|
9314
|
+
const H = T.find(($) => {
|
|
9315
|
+
const m = parseInt($.dataset.checkIndex ?? "0", 10);
|
|
9306
9316
|
return !D.has(m);
|
|
9307
9317
|
});
|
|
9308
|
-
if (!
|
|
9309
|
-
const N = parseInt(
|
|
9310
|
-
|
|
9311
|
-
|
|
9318
|
+
if (!H) return;
|
|
9319
|
+
const N = parseInt(H.dataset.checkIndex ?? "0", 10);
|
|
9320
|
+
H.scrollIntoView({ behavior: "smooth", block: "nearest" }), H.classList.add("--highlight"), setTimeout(() => {
|
|
9321
|
+
H.classList.remove("--highlight"), W(H, N);
|
|
9312
9322
|
}, 400);
|
|
9313
9323
|
}), (Q = _.querySelector("#__crossx-close-btn")) == null || Q.addEventListener("click", x);
|
|
9314
9324
|
})(), a.addEventListener("click", (T) => {
|
|
@@ -9325,7 +9335,7 @@ class Wi {
|
|
|
9325
9335
|
return new Promise((s, t) => {
|
|
9326
9336
|
var I;
|
|
9327
9337
|
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 =
|
|
9338
|
+
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
9339
|
this.tokens,
|
|
9330
9340
|
ut({
|
|
9331
9341
|
title: o,
|
|
@@ -9345,10 +9355,10 @@ class Wi {
|
|
|
9345
9355
|
x(), s(T);
|
|
9346
9356
|
}, p = () => {
|
|
9347
9357
|
x(), s(null);
|
|
9348
|
-
},
|
|
9358
|
+
}, v = (T) => {
|
|
9349
9359
|
x(), t(T);
|
|
9350
|
-
},
|
|
9351
|
-
(I =
|
|
9360
|
+
}, S = l.querySelector(".__crossx-card");
|
|
9361
|
+
(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
9362
|
T.target === l && p();
|
|
9353
9363
|
});
|
|
9354
9364
|
});
|
|
@@ -9364,14 +9374,14 @@ class Wi {
|
|
|
9364
9374
|
return new Promise((s) => {
|
|
9365
9375
|
var a;
|
|
9366
9376
|
ce();
|
|
9367
|
-
const t =
|
|
9377
|
+
const t = Li(this.tokens, e);
|
|
9368
9378
|
le(t);
|
|
9369
9379
|
const n = () => t.remove(), i = (c) => {
|
|
9370
9380
|
n(), s(c);
|
|
9371
9381
|
}, o = () => {
|
|
9372
9382
|
n(), s(null);
|
|
9373
9383
|
};
|
|
9374
|
-
|
|
9384
|
+
Gi(t, i, o), (a = t.querySelector("#__crossx-close-btn")) == null || a.addEventListener("click", o), t.addEventListener("click", (c) => {
|
|
9375
9385
|
c.target === t && o();
|
|
9376
9386
|
});
|
|
9377
9387
|
});
|
|
@@ -9386,7 +9396,7 @@ class Wi {
|
|
|
9386
9396
|
return new Promise((t) => {
|
|
9387
9397
|
var l;
|
|
9388
9398
|
ce();
|
|
9389
|
-
const { overlay: n, startCountdown: i } =
|
|
9399
|
+
const { overlay: n, startCountdown: i } = Mi(this.tokens, e, s);
|
|
9390
9400
|
le(n);
|
|
9391
9401
|
const o = () => {
|
|
9392
9402
|
c(), n.remove();
|
|
@@ -9406,7 +9416,7 @@ class Wi {
|
|
|
9406
9416
|
return new Promise((s) => {
|
|
9407
9417
|
var a, c;
|
|
9408
9418
|
ce();
|
|
9409
|
-
const t =
|
|
9419
|
+
const t = xi(e, this.tokens);
|
|
9410
9420
|
le(t);
|
|
9411
9421
|
const n = () => t.remove(), i = () => {
|
|
9412
9422
|
n(), s();
|
|
@@ -9435,7 +9445,7 @@ class Wi {
|
|
|
9435
9445
|
showTransactionProgress(e, s) {
|
|
9436
9446
|
return new Promise((t) => {
|
|
9437
9447
|
ce();
|
|
9438
|
-
const n =
|
|
9448
|
+
const n = gi(e, this.tokens);
|
|
9439
9449
|
le(n);
|
|
9440
9450
|
const i = () => n.remove();
|
|
9441
9451
|
let o = !1;
|
|
@@ -9452,7 +9462,7 @@ class Wi {
|
|
|
9452
9462
|
document.addEventListener("keydown", l);
|
|
9453
9463
|
};
|
|
9454
9464
|
s.then((l) => {
|
|
9455
|
-
o || (
|
|
9465
|
+
o || (mi(n, l, this.tokens), c());
|
|
9456
9466
|
});
|
|
9457
9467
|
});
|
|
9458
9468
|
}
|
|
@@ -9461,7 +9471,7 @@ class Wi {
|
|
|
9461
9471
|
var l, u, f;
|
|
9462
9472
|
ce();
|
|
9463
9473
|
let t;
|
|
9464
|
-
e.type === "sign-message" ? t =
|
|
9474
|
+
e.type === "sign-message" ? t = wi(e, this.tokens) : e.type === "sign-typed-data" ? t = yi(e, this.tokens) : e.type === "sign" ? t = hi(e, this.tokens) : t = pi(e, this.tokens);
|
|
9465
9475
|
const n = Oe();
|
|
9466
9476
|
le(t);
|
|
9467
9477
|
const i = () => {
|
|
@@ -9473,10 +9483,10 @@ class Wi {
|
|
|
9473
9483
|
};
|
|
9474
9484
|
(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
9485
|
x.addEventListener("click", (_) => {
|
|
9476
|
-
var
|
|
9486
|
+
var v;
|
|
9477
9487
|
_.stopPropagation();
|
|
9478
9488
|
const p = x.dataset.copy;
|
|
9479
|
-
p && ((
|
|
9489
|
+
p && ((v = navigator.clipboard) == null || v.writeText(p).catch(() => {
|
|
9480
9490
|
}));
|
|
9481
9491
|
});
|
|
9482
9492
|
}), t.addEventListener("click", (x) => {
|
|
@@ -9489,7 +9499,7 @@ class Wi {
|
|
|
9489
9499
|
});
|
|
9490
9500
|
}
|
|
9491
9501
|
}
|
|
9492
|
-
class
|
|
9502
|
+
class Ki {
|
|
9493
9503
|
constructor() {
|
|
9494
9504
|
this._accessToken = null, this._expiresAt = 0;
|
|
9495
9505
|
}
|
|
@@ -9521,7 +9531,7 @@ class Gi {
|
|
|
9521
9531
|
return !this._accessToken || this._expiresAt <= 0 ? !0 : Date.now() >= this._expiresAt - e;
|
|
9522
9532
|
}
|
|
9523
9533
|
}
|
|
9524
|
-
function
|
|
9534
|
+
function Qi(r, e) {
|
|
9525
9535
|
r.debug;
|
|
9526
9536
|
const s = Ce.production, t = {
|
|
9527
9537
|
...r,
|
|
@@ -9531,22 +9541,22 @@ function Ji(r, e) {
|
|
|
9531
9541
|
}, n = {
|
|
9532
9542
|
gatewayUrl: s.walletGatewayUrl,
|
|
9533
9543
|
projectId: r.projectId
|
|
9534
|
-
}, i = t.authMode !== "cookie" &&
|
|
9544
|
+
}, i = t.authMode !== "cookie" && Ht.isAvailable();
|
|
9535
9545
|
!i && t.authMode !== "cookie" && d.warn(
|
|
9536
9546
|
"[CROSSx] IndexedDB 사용 불가 — LocalStorage fallback 사용 중.",
|
|
9537
9547
|
"refresh_token이 평문 저장되지 않도록 세션 영속성이 제한됩니다.",
|
|
9538
9548
|
"IndexedDB를 지원하는 브라우저 사용을 권장합니다."
|
|
9539
9549
|
), t.secureStorageAvailable = i;
|
|
9540
|
-
const o = i ? new
|
|
9550
|
+
const o = i ? new Ht(r.projectId) : new $r(), a = new Vn(), c = new Xn(), l = new Ee(), u = new Ki(), f = new cs();
|
|
9541
9551
|
let x;
|
|
9542
|
-
r.useMockWallet ? (d.log("[CROSSx] Mock Wallet Provider 사용"), x = new
|
|
9552
|
+
r.useMockWallet ? (d.log("[CROSSx] Mock Wallet Provider 사용"), x = new Zn(o, f)) : (d.log("[CROSSx] Remote Wallet Provider 사용"), x = new Ae(
|
|
9543
9553
|
n,
|
|
9544
9554
|
o,
|
|
9545
9555
|
c,
|
|
9546
9556
|
u,
|
|
9547
9557
|
f
|
|
9548
9558
|
));
|
|
9549
|
-
const _ = new He(n, c), p = new
|
|
9559
|
+
const _ = new He(n, c), p = new qi(r.theme ?? "light", r.themeTokens), v = e != null && e.wrapConfirmation ? e.wrapConfirmation(p) : p, S = new ft(
|
|
9550
9560
|
t,
|
|
9551
9561
|
n,
|
|
9552
9562
|
o,
|
|
@@ -9555,15 +9565,15 @@ function Ji(r, e) {
|
|
|
9555
9565
|
l,
|
|
9556
9566
|
x,
|
|
9557
9567
|
u,
|
|
9558
|
-
|
|
9568
|
+
v,
|
|
9559
9569
|
_,
|
|
9560
9570
|
f
|
|
9561
9571
|
);
|
|
9562
|
-
return typeof window < "u" && (window.__crossxSDK =
|
|
9572
|
+
return typeof window < "u" && (window.__crossxSDK = S), S;
|
|
9563
9573
|
}
|
|
9564
|
-
function
|
|
9565
|
-
const e =
|
|
9566
|
-
|
|
9574
|
+
function eo(r) {
|
|
9575
|
+
const e = Vi(r), s = zi(e), t = JSON.parse(s);
|
|
9576
|
+
Yi(t);
|
|
9567
9577
|
const { data: n } = t;
|
|
9568
9578
|
return {
|
|
9569
9579
|
status: t.status,
|
|
@@ -9577,7 +9587,7 @@ function Zi(r) {
|
|
|
9577
9587
|
raw: t
|
|
9578
9588
|
};
|
|
9579
9589
|
}
|
|
9580
|
-
function
|
|
9590
|
+
function Vi(r) {
|
|
9581
9591
|
if (r.includes("://") && r.includes("?")) {
|
|
9582
9592
|
const e = new URL(r), s = e.searchParams.get("crossx_oauth_result");
|
|
9583
9593
|
if (s) return s;
|
|
@@ -9587,22 +9597,22 @@ function qi(r) {
|
|
|
9587
9597
|
}
|
|
9588
9598
|
return r;
|
|
9589
9599
|
}
|
|
9590
|
-
function
|
|
9600
|
+
function zi(r) {
|
|
9591
9601
|
if (r.startsWith("{"))
|
|
9592
9602
|
return r;
|
|
9593
9603
|
if (r.startsWith("%7B") || r.startsWith("%7b"))
|
|
9594
9604
|
return decodeURIComponent(r);
|
|
9595
|
-
const e =
|
|
9605
|
+
const e = ji(r);
|
|
9596
9606
|
return decodeURIComponent(e);
|
|
9597
9607
|
}
|
|
9598
|
-
function
|
|
9608
|
+
function ji(r) {
|
|
9599
9609
|
if (typeof atob == "function")
|
|
9600
9610
|
return atob(r);
|
|
9601
9611
|
if (typeof Buffer < "u")
|
|
9602
9612
|
return Buffer.from(r, "base64").toString("utf-8");
|
|
9603
9613
|
throw new Error("Base64 디코딩을 지원하는 환경이 아닙니다");
|
|
9604
9614
|
}
|
|
9605
|
-
function
|
|
9615
|
+
function Yi(r) {
|
|
9606
9616
|
if (typeof r != "object" || r === null)
|
|
9607
9617
|
throw new Error("Deeplink payload가 유효한 객체가 아닙니다");
|
|
9608
9618
|
const e = r;
|
|
@@ -9619,16 +9629,17 @@ function zi(r) {
|
|
|
9619
9629
|
throw new Error("Deeplink data에 accessToken 필드가 없습니다");
|
|
9620
9630
|
}
|
|
9621
9631
|
export {
|
|
9622
|
-
|
|
9632
|
+
tr as CONNECT_OTHER_WALLET_DISPLAY_ORDER,
|
|
9623
9633
|
g as CROSSxError,
|
|
9624
|
-
|
|
9634
|
+
or as CROSSxEthereumProvider,
|
|
9625
9635
|
ft as CROSSxSDK,
|
|
9626
|
-
|
|
9636
|
+
Zi as ChainId,
|
|
9627
9637
|
Ue as ConnectOtherWalletItem,
|
|
9628
9638
|
h as ErrorCode,
|
|
9629
|
-
|
|
9630
|
-
|
|
9631
|
-
|
|
9632
|
-
|
|
9633
|
-
|
|
9639
|
+
Ut as MNEMONIC_ADDRESS_LIMIT,
|
|
9640
|
+
cs as PinMemoryStore,
|
|
9641
|
+
Ki as TokenMemoryStore,
|
|
9642
|
+
Qi as createCROSSxSDK,
|
|
9643
|
+
sr as getConnectOtherWalletLabel,
|
|
9644
|
+
eo as parseOAuthDeeplink
|
|
9634
9645
|
};
|