@nexus-cross/crossx-sdk-core 2.1.0-beta.3 → 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/crossx.global +45 -45
- package/dist/index.cjs +44 -44
- package/dist/index.js +347 -342
- package/dist/sdk/utils/amount.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var P = (r, e, s) =>
|
|
4
|
-
import { createRemoteJWKSet as
|
|
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
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) {
|
|
@@ -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 tr(r) {
|
|
31
|
-
return Qs[r] ?? r;
|
|
32
|
-
}
|
|
33
30
|
function sr(r) {
|
|
34
|
-
return
|
|
31
|
+
return er[r] ?? r;
|
|
32
|
+
}
|
|
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: "취소",
|
|
@@ -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:
|
|
380
|
+
}, cr = {
|
|
381
|
+
ko: ar,
|
|
382
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) {
|
|
@@ -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 cr {
|
|
|
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
|
}
|
|
@@ -858,7 +858,7 @@ class cs {
|
|
|
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 dr {
|
|
|
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
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 ls() {
|
|
|
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($t), t = e / s, i = (e % s).toString().padStart($t, "0")
|
|
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,13 +975,13 @@ 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, ds)
|
|
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(
|
|
@@ -989,7 +994,7 @@ function yr(r) {
|
|
|
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 br(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 Sr(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 Er {
|
|
|
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 Ir {
|
|
|
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 Ir {
|
|
|
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 kr {
|
|
|
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
|
}
|
|
@@ -1491,7 +1496,7 @@ class Tr {
|
|
|
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 Rr {
|
|
|
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 Or {
|
|
|
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 Cr {
|
|
|
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 Cr {
|
|
|
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 Nr {
|
|
|
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 Lr {
|
|
|
1648
1653
|
);
|
|
1649
1654
|
}
|
|
1650
1655
|
}
|
|
1651
|
-
class
|
|
1656
|
+
class Mr {
|
|
1652
1657
|
constructor(e) {
|
|
1653
1658
|
this.deps = e;
|
|
1654
1659
|
}
|
|
@@ -1710,10 +1715,10 @@ 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 cs(), this.stateManager = 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
|
},
|
|
@@ -1736,16 +1741,16 @@ const Ie = class Ie extends ur {
|
|
|
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
1752
|
setActiveWallet: (p, v) => this.setActiveWallet(p, v)
|
|
1748
|
-
}), this.migrationOrchestrator = new
|
|
1753
|
+
}), this.migrationOrchestrator = new Rr({
|
|
1749
1754
|
confirmation: this.confirmation,
|
|
1750
1755
|
walletProvider: this.walletProvider,
|
|
1751
1756
|
pinOrchestrator: this.pinOrchestrator,
|
|
@@ -1759,21 +1764,21 @@ const Ie = class Ie extends ur {
|
|
|
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
1769
|
estimateGas: (p, v) => this.estimateGas(p, v),
|
|
1765
1770
|
getBaseFeePerGas: (p) => this.getBaseFeePerGas(p),
|
|
1766
1771
|
jsonRpcCall: (p, v, S) => this.jsonRpc.call(p, v, S)
|
|
1767
|
-
}), this.signatureVerifier = new
|
|
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,
|
|
@@ -1781,7 +1786,7 @@ const Ie = class Ie extends ur {
|
|
|
1781
1786
|
getUserId: () => this.userId,
|
|
1782
1787
|
getProviderSub: () => this.providerSub,
|
|
1783
1788
|
setActiveWallet: (p, v) => this.setActiveWallet(p, v)
|
|
1784
|
-
}), this.sessionOrchestrator = new
|
|
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 ur {
|
|
|
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 ur {
|
|
|
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();
|
|
@@ -1872,7 +1877,7 @@ const Ie = class Ie extends ur {
|
|
|
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 ur {
|
|
|
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 ur {
|
|
|
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 ur {
|
|
|
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 ur {
|
|
|
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);
|
|
@@ -2609,7 +2614,7 @@ const Ie = class Ie extends ur {
|
|
|
2609
2614
|
*/
|
|
2610
2615
|
async sendTransactionWithWaitForReceipt(e, s, t = {}) {
|
|
2611
2616
|
var v, S;
|
|
2612
|
-
const { intervalMs: n, timeoutMs: i, ...o } = t, { txHash: a } = await this.sendTransaction(e, s, o), c = n ?? ((v = this._config.receiptPolling) == null ? void 0 : v.intervalMs) ??
|
|
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;
|
|
@@ -2808,7 +2813,7 @@ const Ie = class Ie extends ur {
|
|
|
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 ur {
|
|
|
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 ur {
|
|
|
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,7 +3007,7 @@ class Mr {
|
|
|
3002
3007
|
}
|
|
3003
3008
|
}
|
|
3004
3009
|
}
|
|
3005
|
-
const nt = "crossx-sdk",
|
|
3010
|
+
const nt = "crossx-sdk", Br = 1, ue = "data", ve = "keys", Ge = "aes-primary", Ur = 12;
|
|
3006
3011
|
class Ht {
|
|
3007
3012
|
constructor(e) {
|
|
3008
3013
|
this.db = null, this.cryptoKey = null, this.initPromise = null, this.dbName = `crossx-sdk-${e}`;
|
|
@@ -3012,7 +3017,7 @@ class Ht {
|
|
|
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
3023
|
i.objectStoreNames.contains(ue) || i.createObjectStore(ue), i.objectStoreNames.contains(ve) || i.createObjectStore(ve);
|
|
@@ -3090,7 +3095,7 @@ class Ht {
|
|
|
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,22 +3201,22 @@ 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 Ft =
|
|
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 };
|
|
@@ -3226,7 +3231,7 @@ function Wt(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)
|
|
@@ -3255,26 +3260,26 @@ function Se(...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 zr {
|
|
|
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);
|
|
@@ -3346,19 +3351,19 @@ const we = /* @__PURE__ */ Uint32Array.from([
|
|
|
3346
3351
|
528734635,
|
|
3347
3352
|
1541459225
|
|
3348
3353
|
]), qe = /* @__PURE__ */ BigInt(2 ** 32 - 1), Gt = /* @__PURE__ */ BigInt(32);
|
|
3349
|
-
function
|
|
3354
|
+
function Yr(r, e = !1) {
|
|
3350
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 Xr = (r, e, s) => r << s | e >>> 32 - s, Jr = (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
|
}
|
|
@@ -3445,7 +3450,7 @@ class tn extends zr {
|
|
|
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 +
|
|
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;
|
|
3449
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);
|
|
@@ -3457,7 +3462,7 @@ class tn extends zr {
|
|
|
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 sn extends tn {
|
|
|
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,49 +3499,49 @@ function xs(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
3543
|
const St = (r) => (_t << BigInt(r)) - _t;
|
|
3539
|
-
function
|
|
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
3547
|
const t = (S) => new Uint8Array(S), n = Uint8Array.of(), i = Uint8Array.of(0), o = Uint8Array.of(1), a = 1e3;
|
|
@@ -3590,7 +3595,7 @@ function qt(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;
|
|
@@ -3619,16 +3624,16 @@ 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);
|
|
@@ -3637,8 +3642,8 @@ function pn(r) {
|
|
|
3637
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; )
|
|
@@ -3649,7 +3654,7 @@ function Is(r) {
|
|
|
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) {
|
|
@@ -3671,10 +3676,10 @@ function Is(r) {
|
|
|
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 _n = [
|
|
|
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 =
|
|
3706
|
+
}, s = xn.reduce((t, n) => (t[n] = "function", t), e);
|
|
3702
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,7 +3718,7 @@ function gn(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
|
}
|
|
@@ -3723,12 +3728,12 @@ function Vt(r, e) {
|
|
|
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 wn {
|
|
|
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,7 +3792,7 @@ class wn {
|
|
|
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
3798
|
return de(e * Kt(s, this.ORDER), this.ORDER);
|
|
@@ -3809,10 +3814,10 @@ class wn {
|
|
|
3809
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 wn {
|
|
|
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,25 +3846,25 @@ class wn {
|
|
|
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
3870
|
const Me = /* @__PURE__ */ BigInt(0), Te = /* @__PURE__ */ BigInt(1);
|
|
@@ -3868,15 +3873,15 @@ function Xe(r, e) {
|
|
|
3868
3873
|
return r ? s : e;
|
|
3869
3874
|
}
|
|
3870
3875
|
function zt(r, e) {
|
|
3871
|
-
const s =
|
|
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
|
-
|
|
3884
|
+
Ps(r, e);
|
|
3880
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
|
}
|
|
@@ -3887,15 +3892,15 @@ function jt(r, e, s) {
|
|
|
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
3899
|
function Yt(r) {
|
|
3895
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");
|
|
@@ -3983,13 +3988,13 @@ class bn {
|
|
|
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
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;
|
|
@@ -3999,11 +4004,11 @@ 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"]) {
|
|
@@ -4017,13 +4022,13 @@ function vn(r, e, s = {}, t) {
|
|
|
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 Cs {
|
|
|
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 Cs {
|
|
|
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 Jt = (r, e) => (r + (r >= 0 ? e : -e) /
|
|
4072
|
-
function
|
|
4076
|
+
const Jt = (r, e) => (r + (r >= 0 ? e : -e) / Ds) / e;
|
|
4077
|
+
function In(r, e, s) {
|
|
4073
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 _ = St(Math.ceil(
|
|
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,9 +4187,9 @@ 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, {}, {
|
|
@@ -4198,7 +4203,7 @@ function Tn(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()");
|
|
@@ -4208,7 +4213,7 @@ function Tn(r, e = {}) {
|
|
|
4208
4213
|
if (Ye(w, "isCompressed"), w) {
|
|
4209
4214
|
u();
|
|
4210
4215
|
const y = !t.isOdd(O);
|
|
4211
|
-
return Se(
|
|
4216
|
+
return Se(Ms(y), M);
|
|
4212
4217
|
} else
|
|
4213
4218
|
return Se(Uint8Array.of(4), M, t.toBytes(O));
|
|
4214
4219
|
}
|
|
@@ -4249,7 +4254,7 @@ function Tn(r, e = {}) {
|
|
|
4249
4254
|
}
|
|
4250
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
4260
|
function B($, m, w = !1) {
|
|
@@ -4264,7 +4269,7 @@ function Tn(r, e = {}) {
|
|
|
4264
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
4274
|
const q = qt(($, m) => {
|
|
4270
4275
|
const { X: w, Y: k, Z: O } = $;
|
|
@@ -4428,7 +4433,7 @@ function Tn(r, e = {}) {
|
|
|
4428
4433
|
if (H.hasCache(this))
|
|
4429
4434
|
return this.multiply(m);
|
|
4430
4435
|
if (w) {
|
|
4431
|
-
const { k1neg: O, k1: M, k2neg: y, k2: b } = K(m), { p1: E, p2: A } =
|
|
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
4439
|
return H.unsafe(k, m);
|
|
@@ -4472,13 +4477,13 @@ function Tn(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, H = new
|
|
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 Ms(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(_);
|
|
@@ -4507,7 +4512,7 @@ function Rn(r, e = {}) {
|
|
|
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);
|
|
@@ -4531,23 +4536,23 @@ function Rn(r, e = {}) {
|
|
|
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
|
-
}, v = a *
|
|
4555
|
+
}, v = a * Ds < i.ORDER;
|
|
4551
4556
|
function S(m) {
|
|
4552
4557
|
const w = a >> Ne;
|
|
4553
4558
|
return m > w;
|
|
@@ -4605,7 +4610,7 @@ function On(r, e, s = {}) {
|
|
|
4605
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(Se(
|
|
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;
|
|
@@ -4633,7 +4638,7 @@ function On(r, e, s = {}) {
|
|
|
4633
4638
|
return o.create(K(w));
|
|
4634
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;
|
|
@@ -4667,7 +4672,7 @@ function On(r, e, s = {}) {
|
|
|
4667
4672
|
}
|
|
4668
4673
|
function H(m, w, k = {}) {
|
|
4669
4674
|
const { seed: O, k2sig: M } = Q(m, w, k);
|
|
4670
|
-
return
|
|
4675
|
+
return dn(e.outputLen, o.BYTES, n)(O, M).toBytes(k.format);
|
|
4671
4676
|
}
|
|
4672
4677
|
function N(m, w, k, O = {}) {
|
|
4673
4678
|
const { lowS: M, prehash: y, format: b } = lt(O, p);
|
|
@@ -4713,32 +4718,32 @@ 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
4727
|
}, Zt = /* @__PURE__ */ BigInt(2);
|
|
4723
|
-
function
|
|
4728
|
+
function Nn(r) {
|
|
4724
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
|
-
}),
|
|
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 = [];
|
|
4733
4738
|
for (let r = 0, e = $e, s = 1, t = 0; r < 24; r++) {
|
|
4734
|
-
[s, t] = [t, (2 * s + 3 * t) % 5],
|
|
4735
|
-
let n =
|
|
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 << $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++)
|
|
@@ -4750,7 +4755,7 @@ function Wn(r, e = 24) {
|
|
|
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 Wn(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
|
-
Ft(this.state32),
|
|
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 Kn {
|
|
|
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 Kn {
|
|
|
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 Kn {
|
|
|
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 주소를 복원합니다.
|
|
@@ -4907,14 +4912,14 @@ ${t.length}`
|
|
|
4907
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 =
|
|
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(
|
|
4911
4916
|
ss(l),
|
|
4912
4917
|
ss(u)
|
|
4913
4918
|
).addRecoveryBit(x).recoverPublicKey(o).toBytes(!1).slice(1), S = ts(v);
|
|
4914
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);
|
|
@@ -4925,8 +4930,8 @@ function ss(r) {
|
|
|
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 Yn {
|
|
|
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 Yn {
|
|
|
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 Yn {
|
|
|
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"
|
|
@@ -5076,7 +5081,7 @@ class Ee {
|
|
|
5076
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
|
}
|
|
@@ -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
|
}
|
|
@@ -5791,7 +5796,7 @@ class He {
|
|
|
5791
5796
|
}
|
|
5792
5797
|
isCacheValid() {
|
|
5793
5798
|
if (this.loadedAt === 0) return !1;
|
|
5794
|
-
const e = this.usingFallback ?
|
|
5799
|
+
const e = this.usingFallback ? wr : mr;
|
|
5795
5800
|
return e === 0 ? !0 : Date.now() - this.loadedAt < e;
|
|
5796
5801
|
}
|
|
5797
5802
|
populateCache(e, s) {
|
|
@@ -5853,7 +5858,7 @@ class He {
|
|
|
5853
5858
|
}
|
|
5854
5859
|
}
|
|
5855
5860
|
}
|
|
5856
|
-
const rs = "__crossx-confirm-style", J = "__crossx-confirm-overlay",
|
|
5861
|
+
const rs = "__crossx-confirm-style", J = "__crossx-confirm-overlay", Qn = {
|
|
5857
5862
|
light: {
|
|
5858
5863
|
bg: "#FFFFFF",
|
|
5859
5864
|
border: "rgba(18,18,18,0.05)",
|
|
@@ -5910,7 +5915,7 @@ const rs = "__crossx-confirm-style", J = "__crossx-confirm-overlay", Zn = {
|
|
|
5910
5915
|
}
|
|
5911
5916
|
};
|
|
5912
5917
|
function ns(r, e) {
|
|
5913
|
-
const s =
|
|
5918
|
+
const s = Qn[r], t = e == null ? void 0 : e[r];
|
|
5914
5919
|
return t ? {
|
|
5915
5920
|
...s,
|
|
5916
5921
|
// ── Brand
|
|
@@ -5942,7 +5947,7 @@ function ns(r, e) {
|
|
|
5942
5947
|
...t.error !== void 0 && { errorColor: t.error }
|
|
5943
5948
|
} : s;
|
|
5944
5949
|
}
|
|
5945
|
-
const
|
|
5950
|
+
const ei = `
|
|
5946
5951
|
@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;600&display=swap');
|
|
5947
5952
|
|
|
5948
5953
|
#${J} {
|
|
@@ -8019,9 +8024,9 @@ button.__crossx-connect-other-block:active {
|
|
|
8019
8024
|
`;
|
|
8020
8025
|
function ce() {
|
|
8021
8026
|
let r = document.getElementById(rs);
|
|
8022
|
-
r || (r = document.createElement("style"), r.id = rs, document.head.appendChild(r)), r.textContent =
|
|
8027
|
+
r || (r = document.createElement("style"), r.id = rs, document.head.appendChild(r)), r.textContent = ei;
|
|
8023
8028
|
}
|
|
8024
|
-
function
|
|
8029
|
+
function ti() {
|
|
8025
8030
|
const r = `#${J}`, e = (t) => {
|
|
8026
8031
|
var n, i;
|
|
8027
8032
|
(i = (n = t.target) == null ? void 0 : n.closest) != null && i.call(n, r) && t.stopImmediatePropagation();
|
|
@@ -8061,14 +8066,14 @@ function le(r) {
|
|
|
8061
8066
|
}
|
|
8062
8067
|
i.preventDefault();
|
|
8063
8068
|
}, { passive: !1 });
|
|
8064
|
-
const t =
|
|
8069
|
+
const t = ti(), n = r.remove.bind(r);
|
|
8065
8070
|
r.remove = () => {
|
|
8066
8071
|
t(), n();
|
|
8067
8072
|
}, document.body.appendChild(r);
|
|
8068
8073
|
}
|
|
8069
|
-
const
|
|
8074
|
+
const si = () => /iPad|iPhone|iPod/.test(navigator.userAgent) || navigator.platform === "MacIntel" && navigator.maxTouchPoints > 1;
|
|
8070
8075
|
function Oe() {
|
|
8071
|
-
if (
|
|
8076
|
+
if (si()) {
|
|
8072
8077
|
const e = window.scrollY;
|
|
8073
8078
|
return document.body.style.position = "fixed", document.body.style.top = `-${e}px`, document.body.style.left = "0", document.body.style.right = "0", () => {
|
|
8074
8079
|
document.body.style.position = "", document.body.style.top = "", document.body.style.left = "", document.body.style.right = "", window.scrollTo(0, e);
|
|
@@ -8082,7 +8087,7 @@ function Oe() {
|
|
|
8082
8087
|
function se(r) {
|
|
8083
8088
|
return r ? r.length <= 13 ? r : `${r.slice(0, 6)}…${r.slice(-4)}` : "—";
|
|
8084
8089
|
}
|
|
8085
|
-
function
|
|
8090
|
+
function Ws(r, e = "CROSS", s = 18) {
|
|
8086
8091
|
if (!r || r === "0x" || r === "0x0") return null;
|
|
8087
8092
|
try {
|
|
8088
8093
|
const t = BigInt(r);
|
|
@@ -8116,7 +8121,7 @@ const is = {
|
|
|
8116
8121
|
612044: "CROSS Testnet",
|
|
8117
8122
|
612055: "CROSS Mainnet"
|
|
8118
8123
|
};
|
|
8119
|
-
function
|
|
8124
|
+
function Gs(r) {
|
|
8120
8125
|
const e = parseInt(r.split(":")[1] ?? "", 10);
|
|
8121
8126
|
return !isNaN(e) && is[e] ? is[e] : r;
|
|
8122
8127
|
}
|
|
@@ -8133,18 +8138,18 @@ function dt(r) {
|
|
|
8133
8138
|
return r;
|
|
8134
8139
|
}
|
|
8135
8140
|
}
|
|
8136
|
-
function
|
|
8141
|
+
function ri(r) {
|
|
8137
8142
|
try {
|
|
8138
8143
|
return BigInt(r).toLocaleString();
|
|
8139
8144
|
} catch {
|
|
8140
8145
|
return r;
|
|
8141
8146
|
}
|
|
8142
8147
|
}
|
|
8143
|
-
function
|
|
8148
|
+
function ni(r) {
|
|
8144
8149
|
const { gasLimit: e, gasPrice: s, maxFeePerGas: t, maxPriorityFeePerGas: n, nativeSymbol: i = "ETH", nativeDecimals: o = 18 } = r;
|
|
8145
8150
|
if (!e) return null;
|
|
8146
8151
|
try {
|
|
8147
|
-
const a = BigInt(e), c =
|
|
8152
|
+
const a = BigInt(e), c = ri(e);
|
|
8148
8153
|
if (t) {
|
|
8149
8154
|
const l = a * BigInt(t);
|
|
8150
8155
|
return {
|
|
@@ -8169,8 +8174,8 @@ function ri(r) {
|
|
|
8169
8174
|
return null;
|
|
8170
8175
|
}
|
|
8171
8176
|
}
|
|
8172
|
-
function
|
|
8173
|
-
const e =
|
|
8177
|
+
function qs(r) {
|
|
8178
|
+
const e = ni(r);
|
|
8174
8179
|
if (!e) return j("Estimated fee", "<span>—</span>");
|
|
8175
8180
|
let s = j("Est. Tx Fee", `<span>${e.estTxFee}</span>`);
|
|
8176
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;
|
|
@@ -8181,16 +8186,16 @@ const ge = `<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="
|
|
|
8181
8186
|
</svg>`, ne = `<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2.5" stroke-linecap="round">
|
|
8182
8187
|
<line x1="18" y1="6" x2="6" y2="18"/>
|
|
8183
8188
|
<line x1="6" y1="6" x2="18" y2="18"/>
|
|
8184
|
-
</svg>`,
|
|
8189
|
+
</svg>`, ii = `<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
8185
8190
|
<circle cx="20" cy="20" r="20" fill="#00D5AA"/>
|
|
8186
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"/>
|
|
8187
|
-
</svg>`,
|
|
8188
|
-
[Ue.MetaMask]:
|
|
8189
|
-
[Ue.Binance]:
|
|
8190
|
-
[Ue.CROSSx]:
|
|
8191
|
-
},
|
|
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">
|
|
8192
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)"/>
|
|
8193
|
-
</svg>`,
|
|
8198
|
+
</svg>`, ui = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none">
|
|
8194
8199
|
<circle cx="12" cy="12" r="12" fill="var(--cx-error)"/>
|
|
8195
8200
|
<circle cx="12" cy="12" r="5.5" stroke="white" stroke-width="1.5"/>
|
|
8196
8201
|
<path d="M12 9.5v3l2 1.5" stroke="white" stroke-width="1.5" stroke-linecap="round"/>
|
|
@@ -8228,9 +8233,9 @@ function j(r, e) {
|
|
|
8228
8233
|
<div class="__crossx-row-value">${e}</div>
|
|
8229
8234
|
</div>`;
|
|
8230
8235
|
}
|
|
8231
|
-
function
|
|
8236
|
+
function hi(r, e) {
|
|
8232
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>
|
|
8233
|
-
<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");
|
|
8234
8239
|
return f.id = J, f.innerHTML = `
|
|
8235
8240
|
<div class="__crossx-card __crossx-card--migration __crossx-card--sign-tx" style="${oe(s)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
8236
8241
|
<div class="__crossx-header">
|
|
@@ -8254,7 +8259,7 @@ function ui(r, e) {
|
|
|
8254
8259
|
<div class="__crossx-col-right-sign">
|
|
8255
8260
|
<div class="__crossx-rows">
|
|
8256
8261
|
${j("To", o)}
|
|
8257
|
-
${j("Network", `<span>${
|
|
8262
|
+
${j("Network", `<span>${Gs(r.chainId)}</span>`)}
|
|
8258
8263
|
${l}
|
|
8259
8264
|
${a}
|
|
8260
8265
|
</div>
|
|
@@ -8269,9 +8274,9 @@ function ui(r, e) {
|
|
|
8269
8274
|
</div>
|
|
8270
8275
|
`, f;
|
|
8271
8276
|
}
|
|
8272
|
-
function
|
|
8277
|
+
function pi(r, e) {
|
|
8273
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>
|
|
8274
|
-
<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");
|
|
8275
8280
|
return u.id = J, u.innerHTML = `
|
|
8276
8281
|
<div class="__crossx-card __crossx-card--migration __crossx-card--send-tx" style="${oe(s)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
8277
8282
|
<div class="__crossx-header">
|
|
@@ -8286,7 +8291,7 @@ function hi(r, e) {
|
|
|
8286
8291
|
<div class="__crossx-body-cols">
|
|
8287
8292
|
<div class="__crossx-rows">
|
|
8288
8293
|
${j("To", o)}
|
|
8289
|
-
${j("Network", `<span>${
|
|
8294
|
+
${j("Network", `<span>${Gs(r.chainId)}</span>`)}
|
|
8290
8295
|
${a}
|
|
8291
8296
|
</div>
|
|
8292
8297
|
<div class="__crossx-pill">
|
|
@@ -8311,10 +8316,10 @@ function tt(r) {
|
|
|
8311
8316
|
function C(r) {
|
|
8312
8317
|
return r.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
8313
8318
|
}
|
|
8314
|
-
function
|
|
8319
|
+
function fi(r) {
|
|
8315
8320
|
return typeof r == "string" && /^0x[0-9a-fA-F]{40}$/i.test(r);
|
|
8316
8321
|
}
|
|
8317
|
-
function
|
|
8322
|
+
function _i(r) {
|
|
8318
8323
|
if (typeof r == "string") return C(r);
|
|
8319
8324
|
if (typeof r == "number" || typeof r == "bigint" || typeof r == "boolean") return String(r);
|
|
8320
8325
|
try {
|
|
@@ -8323,7 +8328,7 @@ function fi(r) {
|
|
|
8323
8328
|
return String(r);
|
|
8324
8329
|
}
|
|
8325
8330
|
}
|
|
8326
|
-
function
|
|
8331
|
+
function xi(r, e) {
|
|
8327
8332
|
const s = j(
|
|
8328
8333
|
"From",
|
|
8329
8334
|
`<span class="__crossx-addr-text">${se(r.from)}</span>
|
|
@@ -8355,7 +8360,7 @@ function _i(r, e) {
|
|
|
8355
8360
|
</div>
|
|
8356
8361
|
`, c;
|
|
8357
8362
|
}
|
|
8358
|
-
function
|
|
8363
|
+
function gi(r, e) {
|
|
8359
8364
|
const s = document.createElement("div");
|
|
8360
8365
|
return s.id = J, s.innerHTML = `
|
|
8361
8366
|
<div class="__crossx-card __crossx-card--migration" style="${oe(e)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
@@ -8372,10 +8377,10 @@ function xi(r, e) {
|
|
|
8372
8377
|
</div>
|
|
8373
8378
|
`, s;
|
|
8374
8379
|
}
|
|
8375
|
-
function
|
|
8380
|
+
function mi(r, e, s) {
|
|
8376
8381
|
const t = e.status !== "reverted" && e.status !== "timeout", n = e.status === "timeout", i = r.querySelector("#__crossx-ttl"), o = r.querySelector(".__crossx-header");
|
|
8377
8382
|
if (i) {
|
|
8378
|
-
const p = n ?
|
|
8383
|
+
const p = n ? ui : t ? "" : di, v = n ? "Transaction timeout" : t ? "Transaction complete" : "Transaction failed";
|
|
8379
8384
|
p ? (i.style.display = "flex", i.style.alignItems = "center", i.style.gap = "8px", i.innerHTML = `${p}<span>${v}</span>`) : i.textContent = v;
|
|
8380
8385
|
}
|
|
8381
8386
|
if (o && !r.querySelector("#__crossx-close-btn")) {
|
|
@@ -8411,7 +8416,7 @@ function gi(r, e, s) {
|
|
|
8411
8416
|
});
|
|
8412
8417
|
});
|
|
8413
8418
|
}
|
|
8414
|
-
function
|
|
8419
|
+
function wi(r, e) {
|
|
8415
8420
|
const s = e, t = tt(r.dappName), n = C(r.message), i = document.createElement("div");
|
|
8416
8421
|
return i.id = J, i.innerHTML = `
|
|
8417
8422
|
<div class="__crossx-card __crossx-card--migration __crossx-card--sign-msg" style="${oe(s)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
@@ -8443,7 +8448,7 @@ function mi(r, e) {
|
|
|
8443
8448
|
</div>
|
|
8444
8449
|
`, i;
|
|
8445
8450
|
}
|
|
8446
|
-
function
|
|
8451
|
+
function yi(r, e) {
|
|
8447
8452
|
const s = e, t = tt(r.dappName);
|
|
8448
8453
|
let n = {};
|
|
8449
8454
|
if (typeof r.typedData == "string")
|
|
@@ -8459,7 +8464,7 @@ function wi(r, e) {
|
|
|
8459
8464
|
<span class="__crossx-td-value">${C(i)}</span>
|
|
8460
8465
|
</div>`;
|
|
8461
8466
|
for (const [l, u] of Object.entries(o)) {
|
|
8462
|
-
const f =
|
|
8467
|
+
const f = _i(u), _ = fi(u) ? `<span class="__crossx-addr-text">${se(u)}</span>
|
|
8463
8468
|
<button class="__crossx-copy-btn" data-copy="${C(String(u))}" title="Copy">${ge}</button>` : `<span>${f}</span>`;
|
|
8464
8469
|
a += `
|
|
8465
8470
|
<div class="__crossx-td-row">
|
|
@@ -8498,29 +8503,29 @@ function wi(r, e) {
|
|
|
8498
8503
|
</div>
|
|
8499
8504
|
`, c;
|
|
8500
8505
|
}
|
|
8501
|
-
const
|
|
8506
|
+
const bi = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round">
|
|
8502
8507
|
<line x1="12" y1="5" x2="12" y2="19"/>
|
|
8503
8508
|
<line x1="5" y1="12" x2="19" y2="12"/>
|
|
8504
|
-
</svg>`,
|
|
8505
|
-
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) {
|
|
8506
8511
|
return r.name || `Account ${r.index + 1}`;
|
|
8507
8512
|
}
|
|
8508
|
-
function
|
|
8509
|
-
return `<svg width="32" height="32" viewBox="0 0 32 32" fill="none" xmlns="http://www.w3.org/2000/svg" aria-hidden="true"><rect width="32" height="32" rx="16" fill="#121212" fill-opacity="0.1"/><g fill="#121212" fill-opacity="0.5">${
|
|
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>`;
|
|
8510
8515
|
}
|
|
8511
|
-
const
|
|
8512
|
-
function
|
|
8513
|
-
return e.replace("#", ""), `${
|
|
8516
|
+
const Ei = ls().portraitBaseUrl;
|
|
8517
|
+
function Ai(r, e) {
|
|
8518
|
+
return e.replace("#", ""), `${Ei}/portrait/evm/${r}.png?size=56`;
|
|
8514
8519
|
}
|
|
8515
|
-
function
|
|
8516
|
-
const t =
|
|
8520
|
+
function zs(r, e, s) {
|
|
8521
|
+
const t = Ai(r, s), i = vi().replace(/"/g, """);
|
|
8517
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>`;
|
|
8518
8523
|
}
|
|
8519
|
-
function
|
|
8524
|
+
function Ii(r, e, s) {
|
|
8520
8525
|
const t = s == null ? void 0 : s.toLowerCase(), n = r.map((o) => {
|
|
8521
|
-
const a = t && o.address.toLowerCase() === t, c = a ? " __crossx-wallet-item--selected" : "", l = a ? `<span class="__crossx-wallet-selected">Selected</span><span class="__crossx-wallet-check">${
|
|
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>` : "";
|
|
8522
8527
|
return `<button class="__crossx-wallet-item${c}" data-wallet-index="${o.index}" data-wallet-address="${C(o.address)}">
|
|
8523
|
-
${
|
|
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}
|
|
8524
8529
|
</button>`;
|
|
8525
8530
|
}).join(""), i = document.createElement("div");
|
|
8526
8531
|
return i.id = J, i.innerHTML = `
|
|
@@ -8547,7 +8552,7 @@ function Ai(r, e, s) {
|
|
|
8547
8552
|
${n}
|
|
8548
8553
|
</div>
|
|
8549
8554
|
<button class="__crossx-wallet-add" id="__crossx-add-wallet-btn" type="button">
|
|
8550
|
-
<span class="__crossx-wallet-add-icon">${
|
|
8555
|
+
<span class="__crossx-wallet-add-icon">${bi}</span>
|
|
8551
8556
|
<span class="__crossx-wallet-add-label">add a wallet</span>
|
|
8552
8557
|
</button>
|
|
8553
8558
|
</div>
|
|
@@ -8556,22 +8561,22 @@ function Ai(r, e, s) {
|
|
|
8556
8561
|
</div>
|
|
8557
8562
|
`, i;
|
|
8558
8563
|
}
|
|
8559
|
-
const
|
|
8564
|
+
const ki = `<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
8560
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"/>
|
|
8561
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"/>
|
|
8562
|
-
</svg>`,
|
|
8567
|
+
</svg>`, Ti = `<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
8563
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"/>
|
|
8564
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"/>
|
|
8565
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"/>
|
|
8566
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"/>
|
|
8567
8572
|
</svg>`;
|
|
8568
|
-
function Ti(r) {
|
|
8569
|
-
const e = tr(r);
|
|
8570
|
-
return `<span class="__crossx-connect-other-wallet-desc-part"><span class="__crossx-connect-other-wallet-icon" aria-hidden="true">${ci[r] ?? ""}</span><span class="__crossx-connect-other-wallet-name">${C(e)}</span></span>`;
|
|
8571
|
-
}
|
|
8572
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>`;
|
|
8576
|
+
}
|
|
8577
|
+
function Oi(r) {
|
|
8573
8578
|
if (r.length === 0) return "";
|
|
8574
|
-
const e = (n) =>
|
|
8579
|
+
const e = (n) => Ri(r[n]), s = "Supported wallets include ";
|
|
8575
8580
|
if (r.length === 1)
|
|
8576
8581
|
return `${s}${e(0)}.`;
|
|
8577
8582
|
if (r.length === 2)
|
|
@@ -8581,7 +8586,7 @@ function Ri(r) {
|
|
|
8581
8586
|
const t = r.length - 3;
|
|
8582
8587
|
return `${s}${e(0)}, ${e(1)}, ${e(2)}, and ${t} more.`;
|
|
8583
8588
|
}
|
|
8584
|
-
function
|
|
8589
|
+
function Pi(r, e = []) {
|
|
8585
8590
|
const s = r, t = C(String(e[0])), n = e.length > 0 ? `
|
|
8586
8591
|
<div class="__crossx-login-or-divider">
|
|
8587
8592
|
<hr><span>or</span><hr>
|
|
@@ -8589,7 +8594,7 @@ function Oi(r, e = []) {
|
|
|
8589
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">
|
|
8590
8595
|
<span class="__crossx-connect-other-text">
|
|
8591
8596
|
<span class="__crossx-connect-other-title" id="__crossx-connect-other-heading">Connect with Other Wallets</span>
|
|
8592
|
-
<span class="__crossx-connect-other-desc __crossx-connect-other-summary">${
|
|
8597
|
+
<span class="__crossx-connect-other-desc __crossx-connect-other-summary">${Oi(e)}</span>
|
|
8593
8598
|
</span>
|
|
8594
8599
|
</button>` : "", i = document.createElement("div");
|
|
8595
8600
|
return i.id = J, i.innerHTML = `
|
|
@@ -8605,11 +8610,11 @@ function Oi(r, e = []) {
|
|
|
8605
8610
|
<div class="__crossx-body">
|
|
8606
8611
|
<div class="__crossx-login-btn-row">
|
|
8607
8612
|
<button class="__crossx-login-btn" id="__crossx-apple-btn" type="button">
|
|
8608
|
-
<span class="__crossx-login-icon" style="color:var(--cx-value);">${
|
|
8613
|
+
<span class="__crossx-login-icon" style="color:var(--cx-value);">${ki}</span>
|
|
8609
8614
|
<span class="__crossx-login-btn-label">Sign in with Apple</span>
|
|
8610
8615
|
</button>
|
|
8611
8616
|
<button class="__crossx-login-btn" id="__crossx-google-btn" type="button">
|
|
8612
|
-
<span class="__crossx-login-icon">${
|
|
8617
|
+
<span class="__crossx-login-icon">${Ti}</span>
|
|
8613
8618
|
<span class="__crossx-login-btn-label">Sign in with Google</span>
|
|
8614
8619
|
</button>
|
|
8615
8620
|
</div>${n}
|
|
@@ -8620,7 +8625,7 @@ function Oi(r, e = []) {
|
|
|
8620
8625
|
</div>
|
|
8621
8626
|
`, i;
|
|
8622
8627
|
}
|
|
8623
|
-
function
|
|
8628
|
+
function Ci(r, e) {
|
|
8624
8629
|
const s = r, t = document.createElement("div");
|
|
8625
8630
|
t.id = J;
|
|
8626
8631
|
const n = C(e.message).replace(/\n/g, "<br>"), i = e.email ? `<div class="__crossx-session-account-card">
|
|
@@ -8648,7 +8653,7 @@ function Pi(r, e) {
|
|
|
8648
8653
|
</div>
|
|
8649
8654
|
`, t;
|
|
8650
8655
|
}
|
|
8651
|
-
function
|
|
8656
|
+
function Ni(r, e = !0) {
|
|
8652
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");
|
|
8653
8658
|
return i.id = J, i.innerHTML = `
|
|
8654
8659
|
<div class="__crossx-card __crossx-card--migration" style="${oe(s)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
@@ -8664,7 +8669,7 @@ function Ci(r, e = !0) {
|
|
|
8664
8669
|
<p class="__crossx-mig-info-desc">It safely restores and integrates all your previous assets. Simply verify your PIN to get started.</p>
|
|
8665
8670
|
</div>
|
|
8666
8671
|
<button class="__crossx-recover-btn" id="__crossx-recover-btn">
|
|
8667
|
-
<span class="__crossx-recover-icon">${
|
|
8672
|
+
<span class="__crossx-recover-icon">${ii}</span>
|
|
8668
8673
|
<span class="__crossx-recover-label">Import from Social Backup</span>
|
|
8669
8674
|
</button>
|
|
8670
8675
|
${n}
|
|
@@ -8672,7 +8677,7 @@ function Ci(r, e = !0) {
|
|
|
8672
8677
|
</div>
|
|
8673
8678
|
`, i;
|
|
8674
8679
|
}
|
|
8675
|
-
function
|
|
8680
|
+
function Li(r, e) {
|
|
8676
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");
|
|
8677
8682
|
return f.id = J, f.innerHTML = `
|
|
8678
8683
|
<div class="__crossx-card __crossx-card--migration" style="${oe(s)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
@@ -8696,12 +8701,12 @@ function Ni(r, e) {
|
|
|
8696
8701
|
</div>
|
|
8697
8702
|
`, f;
|
|
8698
8703
|
}
|
|
8699
|
-
function
|
|
8704
|
+
function Di(r) {
|
|
8700
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");
|
|
8701
8706
|
return `${n}, ${i} ${o} ${a}:${c}`;
|
|
8702
8707
|
}
|
|
8703
|
-
function
|
|
8704
|
-
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");
|
|
8705
8710
|
return a.id = J, a.innerHTML = `
|
|
8706
8711
|
<div class="__crossx-card __crossx-card--migration" style="${oe(t)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
8707
8712
|
<div class="__crossx-header">
|
|
@@ -8731,10 +8736,10 @@ function Di(r, e, s) {
|
|
|
8731
8736
|
return () => clearInterval(f);
|
|
8732
8737
|
} };
|
|
8733
8738
|
}
|
|
8734
|
-
function
|
|
8739
|
+
function $i(r) {
|
|
8735
8740
|
const s = [r.check1, r.check2].map((t, n) => `
|
|
8736
8741
|
<div class="__crossx-pw-notice-item" data-check-index="${n}" role="checkbox" aria-checked="false" tabindex="0">
|
|
8737
|
-
<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>
|
|
8738
8743
|
<span class="__crossx-pw-notice-item-text">${C(t)}</span>
|
|
8739
8744
|
</div>
|
|
8740
8745
|
`).join("");
|
|
@@ -8749,7 +8754,7 @@ function Mi(r) {
|
|
|
8749
8754
|
<div class="__crossx-pw-fields __crossx-pw-fields--notice">
|
|
8750
8755
|
<div class="__crossx-pw-notice-header">
|
|
8751
8756
|
<div class="__crossx-pw-notice-title-row">
|
|
8752
|
-
<span class="__crossx-pw-notice-icon">${
|
|
8757
|
+
<span class="__crossx-pw-notice-icon">${Wi}</span>
|
|
8753
8758
|
<p class="__crossx-pw-notice-title">${C(r.noticeTitle)}</p>
|
|
8754
8759
|
</div>
|
|
8755
8760
|
<p class="__crossx-pw-notice-desc">${C(r.noticeDesc)}</p>
|
|
@@ -8769,7 +8774,7 @@ function Mi(r) {
|
|
|
8769
8774
|
}
|
|
8770
8775
|
function ut(r) {
|
|
8771
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">
|
|
8772
|
-
${
|
|
8777
|
+
${js}
|
|
8773
8778
|
<span id="__crossx-pin6-lock-countdown"></span>
|
|
8774
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(
|
|
8775
8780
|
{ length: 6 },
|
|
@@ -8797,7 +8802,7 @@ function ut(r) {
|
|
|
8797
8802
|
<div class="__crossx-pin6-numpad-row">
|
|
8798
8803
|
<button type="button" class="__crossx-pin6-numpad-key --empty" aria-hidden="true"></button>
|
|
8799
8804
|
<button type="button" class="__crossx-pin6-numpad-key${_}" data-key="0">0</button>
|
|
8800
|
-
<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>
|
|
8801
8806
|
</div>
|
|
8802
8807
|
</div>`;
|
|
8803
8808
|
return `
|
|
@@ -8831,14 +8836,14 @@ function os(r, e) {
|
|
|
8831
8836
|
</div>
|
|
8832
8837
|
`, s;
|
|
8833
8838
|
}
|
|
8834
|
-
function
|
|
8839
|
+
function Bi(r, e) {
|
|
8835
8840
|
if (r.length !== 6) return e.tooShort;
|
|
8836
8841
|
if (!/^\d+$/.test(r)) return e.numbersOnly;
|
|
8837
8842
|
if (/(.)\1{2}/.test(r)) return e.repeatingDigit;
|
|
8838
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);
|
|
8839
8844
|
return t || n ? e.sequential : r[0] !== r[1] && r === r.slice(0, 2).repeat(3) ? e.alternatingPattern : null;
|
|
8840
8845
|
}
|
|
8841
|
-
function
|
|
8846
|
+
function Ui(r) {
|
|
8842
8847
|
const e = Math.max(0, Math.ceil(r / 1e3)), s = Math.floor(e / 3600), t = Math.floor(e % 3600 / 60), n = e % 60;
|
|
8843
8848
|
return s > 0 ? `${s}h ${String(t).padStart(2, "0")}m` : `${String(t).padStart(2, "0")}:${String(n).padStart(2, "0")}`;
|
|
8844
8849
|
}
|
|
@@ -8906,7 +8911,7 @@ function ht(r, e, s, t, n, i, o) {
|
|
|
8906
8911
|
const b = f();
|
|
8907
8912
|
if (b && (b.textContent = "Too many failed attempts. Please wait."), !x()) {
|
|
8908
8913
|
const U = document.createElement("p");
|
|
8909
|
-
U.className = "__crossx-pin6-lock-msg", U.id = "__crossx-pin6-lock-msg", U.innerHTML = `${
|
|
8914
|
+
U.className = "__crossx-pin6-lock-msg", U.id = "__crossx-pin6-lock-msg", U.innerHTML = `${js}<span id="__crossx-pin6-lock-countdown"></span>`;
|
|
8910
8915
|
const L = f();
|
|
8911
8916
|
L ? L.insertAdjacentElement("afterend", U) : (F = p()) == null || F.appendChild(U);
|
|
8912
8917
|
}
|
|
@@ -8916,7 +8921,7 @@ function ht(r, e, s, t, n, i, o) {
|
|
|
8916
8921
|
U <= 0 ? (clearInterval(A), B(!1), (G = x()) == null || G.remove(), b && (b.textContent = ""), T(), setTimeout(() => {
|
|
8917
8922
|
var Y;
|
|
8918
8923
|
return (Y = l()[0]) == null ? void 0 : Y.focus();
|
|
8919
|
-
}, 50)) : L && (L.textContent = ` ${
|
|
8924
|
+
}, 50)) : L && (L.textContent = ` ${Ui(U)}`);
|
|
8920
8925
|
}, A = setInterval(E, 1e3);
|
|
8921
8926
|
E();
|
|
8922
8927
|
const R = new MutationObserver(() => {
|
|
@@ -9017,18 +9022,18 @@ function ht(r, e, s, t, n, i, o) {
|
|
|
9017
9022
|
}), k.addEventListener("pointercancel", b), k.addEventListener("pointerleave", b, !0), I(), i && i > Date.now() && T();
|
|
9018
9023
|
}
|
|
9019
9024
|
}
|
|
9020
|
-
const
|
|
9025
|
+
const Hi = `<svg width="22" height="17" viewBox="0 0 22 17" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
9021
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"/>
|
|
9022
9027
|
<line x1="10" y1="5.5" x2="16" y2="11.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
|
|
9023
9028
|
<line x1="16" y1="5.5" x2="10" y2="11.5" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"/>
|
|
9024
|
-
</svg>`,
|
|
9029
|
+
</svg>`, js = `<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
9025
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"/>
|
|
9026
|
-
</svg>`,
|
|
9031
|
+
</svg>`, Fi = `<svg width="11" height="9" viewBox="0 0 11 9" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
9027
9032
|
<path d="M1 4.5L4 7.5L10 1" stroke="white" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"/>
|
|
9028
|
-
</svg>`,
|
|
9033
|
+
</svg>`, Wi = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
9029
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"/>
|
|
9030
9035
|
</svg>`;
|
|
9031
|
-
function
|
|
9036
|
+
function Gi(r, e, s) {
|
|
9032
9037
|
var i;
|
|
9033
9038
|
const t = r.querySelectorAll(".__crossx-pin-input");
|
|
9034
9039
|
t.forEach((o, a) => {
|
|
@@ -9061,7 +9066,7 @@ function Wi(r, e, s) {
|
|
|
9061
9066
|
}
|
|
9062
9067
|
}), (i = t[0]) == null || i.focus();
|
|
9063
9068
|
}
|
|
9064
|
-
class
|
|
9069
|
+
class qi {
|
|
9065
9070
|
constructor(e = "light", s) {
|
|
9066
9071
|
this.theme = e, this.overrides = s, this.tokens = ns(e, s);
|
|
9067
9072
|
}
|
|
@@ -9083,7 +9088,7 @@ class Gi {
|
|
|
9083
9088
|
return new Promise((n) => {
|
|
9084
9089
|
var v;
|
|
9085
9090
|
ce();
|
|
9086
|
-
const i = [...e], o =
|
|
9091
|
+
const i = [...e], o = Ii(i, this.tokens, t), a = Oe();
|
|
9087
9092
|
le(o);
|
|
9088
9093
|
let c = !1;
|
|
9089
9094
|
const l = () => {
|
|
@@ -9110,7 +9115,7 @@ class Gi {
|
|
|
9110
9115
|
const I = o.querySelector("#__crossx-wallet-list");
|
|
9111
9116
|
if (I) {
|
|
9112
9117
|
const T = document.createElement("button");
|
|
9113
|
-
T.className = "__crossx-wallet-item", T.dataset.walletIndex = String(S.index), T.dataset.walletAddress = S.address, T.innerHTML = `${
|
|
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" });
|
|
9114
9119
|
}
|
|
9115
9120
|
} catch {
|
|
9116
9121
|
} finally {
|
|
@@ -9138,7 +9143,7 @@ class Gi {
|
|
|
9138
9143
|
return new Promise((n) => {
|
|
9139
9144
|
var x, _, p, v;
|
|
9140
9145
|
ce();
|
|
9141
|
-
const i =
|
|
9146
|
+
const i = Pi(this.tokens, s), o = Oe();
|
|
9142
9147
|
le(i);
|
|
9143
9148
|
const a = () => {
|
|
9144
9149
|
i.remove(), o();
|
|
@@ -9167,7 +9172,7 @@ class Gi {
|
|
|
9167
9172
|
return new Promise((s) => {
|
|
9168
9173
|
var u, f, x;
|
|
9169
9174
|
ce();
|
|
9170
|
-
const t = this.messages, n =
|
|
9175
|
+
const t = this.messages, n = Ci(this.tokens, {
|
|
9171
9176
|
title: e.title,
|
|
9172
9177
|
message: e.message,
|
|
9173
9178
|
email: e.email,
|
|
@@ -9197,7 +9202,7 @@ class Gi {
|
|
|
9197
9202
|
return new Promise((t) => {
|
|
9198
9203
|
var a, c, l;
|
|
9199
9204
|
ce();
|
|
9200
|
-
const n =
|
|
9205
|
+
const n = Ni(this.tokens, s);
|
|
9201
9206
|
le(n);
|
|
9202
9207
|
const i = () => n.remove(), o = () => {
|
|
9203
9208
|
i(), t("recover");
|
|
@@ -9243,7 +9248,7 @@ class Gi {
|
|
|
9243
9248
|
}, o = {
|
|
9244
9249
|
title: (t == null ? void 0 : t.pinSetup_confirmTitle) ?? "Confirm PIN",
|
|
9245
9250
|
headerSubtitle: (t == null ? void 0 : t.pinSetup_confirmSubtitle) ?? "Enter your PIN again to confirm."
|
|
9246
|
-
}, a = os(this.tokens,
|
|
9251
|
+
}, a = os(this.tokens, $i(n)), c = Oe();
|
|
9247
9252
|
le(a);
|
|
9248
9253
|
let l = !1;
|
|
9249
9254
|
const u = () => {
|
|
@@ -9274,7 +9279,7 @@ class Gi {
|
|
|
9274
9279
|
subtitle: i.subtitle,
|
|
9275
9280
|
errorMessage: T
|
|
9276
9281
|
}), (B = _.querySelector("#__crossx-close-btn")) == null || B.addEventListener("click", x), ht(_, (D) => {
|
|
9277
|
-
const K =
|
|
9282
|
+
const K = Bi(D, p);
|
|
9278
9283
|
K ? S(K) : v(D);
|
|
9279
9284
|
}, x);
|
|
9280
9285
|
};
|
|
@@ -9369,14 +9374,14 @@ class Gi {
|
|
|
9369
9374
|
return new Promise((s) => {
|
|
9370
9375
|
var a;
|
|
9371
9376
|
ce();
|
|
9372
|
-
const t =
|
|
9377
|
+
const t = Li(this.tokens, e);
|
|
9373
9378
|
le(t);
|
|
9374
9379
|
const n = () => t.remove(), i = (c) => {
|
|
9375
9380
|
n(), s(c);
|
|
9376
9381
|
}, o = () => {
|
|
9377
9382
|
n(), s(null);
|
|
9378
9383
|
};
|
|
9379
|
-
|
|
9384
|
+
Gi(t, i, o), (a = t.querySelector("#__crossx-close-btn")) == null || a.addEventListener("click", o), t.addEventListener("click", (c) => {
|
|
9380
9385
|
c.target === t && o();
|
|
9381
9386
|
});
|
|
9382
9387
|
});
|
|
@@ -9391,7 +9396,7 @@ class Gi {
|
|
|
9391
9396
|
return new Promise((t) => {
|
|
9392
9397
|
var l;
|
|
9393
9398
|
ce();
|
|
9394
|
-
const { overlay: n, startCountdown: i } =
|
|
9399
|
+
const { overlay: n, startCountdown: i } = Mi(this.tokens, e, s);
|
|
9395
9400
|
le(n);
|
|
9396
9401
|
const o = () => {
|
|
9397
9402
|
c(), n.remove();
|
|
@@ -9411,7 +9416,7 @@ class Gi {
|
|
|
9411
9416
|
return new Promise((s) => {
|
|
9412
9417
|
var a, c;
|
|
9413
9418
|
ce();
|
|
9414
|
-
const t =
|
|
9419
|
+
const t = xi(e, this.tokens);
|
|
9415
9420
|
le(t);
|
|
9416
9421
|
const n = () => t.remove(), i = () => {
|
|
9417
9422
|
n(), s();
|
|
@@ -9440,7 +9445,7 @@ class Gi {
|
|
|
9440
9445
|
showTransactionProgress(e, s) {
|
|
9441
9446
|
return new Promise((t) => {
|
|
9442
9447
|
ce();
|
|
9443
|
-
const n =
|
|
9448
|
+
const n = gi(e, this.tokens);
|
|
9444
9449
|
le(n);
|
|
9445
9450
|
const i = () => n.remove();
|
|
9446
9451
|
let o = !1;
|
|
@@ -9457,7 +9462,7 @@ class Gi {
|
|
|
9457
9462
|
document.addEventListener("keydown", l);
|
|
9458
9463
|
};
|
|
9459
9464
|
s.then((l) => {
|
|
9460
|
-
o || (
|
|
9465
|
+
o || (mi(n, l, this.tokens), c());
|
|
9461
9466
|
});
|
|
9462
9467
|
});
|
|
9463
9468
|
}
|
|
@@ -9466,7 +9471,7 @@ class Gi {
|
|
|
9466
9471
|
var l, u, f;
|
|
9467
9472
|
ce();
|
|
9468
9473
|
let t;
|
|
9469
|
-
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);
|
|
9470
9475
|
const n = Oe();
|
|
9471
9476
|
le(t);
|
|
9472
9477
|
const i = () => {
|
|
@@ -9494,7 +9499,7 @@ class Gi {
|
|
|
9494
9499
|
});
|
|
9495
9500
|
}
|
|
9496
9501
|
}
|
|
9497
|
-
class
|
|
9502
|
+
class Ki {
|
|
9498
9503
|
constructor() {
|
|
9499
9504
|
this._accessToken = null, this._expiresAt = 0;
|
|
9500
9505
|
}
|
|
@@ -9526,7 +9531,7 @@ class qi {
|
|
|
9526
9531
|
return !this._accessToken || this._expiresAt <= 0 ? !0 : Date.now() >= this._expiresAt - e;
|
|
9527
9532
|
}
|
|
9528
9533
|
}
|
|
9529
|
-
function
|
|
9534
|
+
function Qi(r, e) {
|
|
9530
9535
|
r.debug;
|
|
9531
9536
|
const s = Ce.production, t = {
|
|
9532
9537
|
...r,
|
|
@@ -9542,16 +9547,16 @@ function Zi(r, e) {
|
|
|
9542
9547
|
"refresh_token이 평문 저장되지 않도록 세션 영속성이 제한됩니다.",
|
|
9543
9548
|
"IndexedDB를 지원하는 브라우저 사용을 권장합니다."
|
|
9544
9549
|
), t.secureStorageAvailable = i;
|
|
9545
|
-
const o = i ? new Ht(r.projectId) : 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();
|
|
9546
9551
|
let x;
|
|
9547
|
-
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(
|
|
9548
9553
|
n,
|
|
9549
9554
|
o,
|
|
9550
9555
|
c,
|
|
9551
9556
|
u,
|
|
9552
9557
|
f
|
|
9553
9558
|
));
|
|
9554
|
-
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(
|
|
9555
9560
|
t,
|
|
9556
9561
|
n,
|
|
9557
9562
|
o,
|
|
@@ -9566,9 +9571,9 @@ function Zi(r, e) {
|
|
|
9566
9571
|
);
|
|
9567
9572
|
return typeof window < "u" && (window.__crossxSDK = S), S;
|
|
9568
9573
|
}
|
|
9569
|
-
function
|
|
9570
|
-
const e =
|
|
9571
|
-
|
|
9574
|
+
function eo(r) {
|
|
9575
|
+
const e = Vi(r), s = zi(e), t = JSON.parse(s);
|
|
9576
|
+
Yi(t);
|
|
9572
9577
|
const { data: n } = t;
|
|
9573
9578
|
return {
|
|
9574
9579
|
status: t.status,
|
|
@@ -9582,7 +9587,7 @@ function Qi(r) {
|
|
|
9582
9587
|
raw: t
|
|
9583
9588
|
};
|
|
9584
9589
|
}
|
|
9585
|
-
function
|
|
9590
|
+
function Vi(r) {
|
|
9586
9591
|
if (r.includes("://") && r.includes("?")) {
|
|
9587
9592
|
const e = new URL(r), s = e.searchParams.get("crossx_oauth_result");
|
|
9588
9593
|
if (s) return s;
|
|
@@ -9592,22 +9597,22 @@ function Ki(r) {
|
|
|
9592
9597
|
}
|
|
9593
9598
|
return r;
|
|
9594
9599
|
}
|
|
9595
|
-
function
|
|
9600
|
+
function zi(r) {
|
|
9596
9601
|
if (r.startsWith("{"))
|
|
9597
9602
|
return r;
|
|
9598
9603
|
if (r.startsWith("%7B") || r.startsWith("%7b"))
|
|
9599
9604
|
return decodeURIComponent(r);
|
|
9600
|
-
const e =
|
|
9605
|
+
const e = ji(r);
|
|
9601
9606
|
return decodeURIComponent(e);
|
|
9602
9607
|
}
|
|
9603
|
-
function
|
|
9608
|
+
function ji(r) {
|
|
9604
9609
|
if (typeof atob == "function")
|
|
9605
9610
|
return atob(r);
|
|
9606
9611
|
if (typeof Buffer < "u")
|
|
9607
9612
|
return Buffer.from(r, "base64").toString("utf-8");
|
|
9608
9613
|
throw new Error("Base64 디코딩을 지원하는 환경이 아닙니다");
|
|
9609
9614
|
}
|
|
9610
|
-
function
|
|
9615
|
+
function Yi(r) {
|
|
9611
9616
|
if (typeof r != "object" || r === null)
|
|
9612
9617
|
throw new Error("Deeplink payload가 유효한 객체가 아닙니다");
|
|
9613
9618
|
const e = r;
|
|
@@ -9624,17 +9629,17 @@ function ji(r) {
|
|
|
9624
9629
|
throw new Error("Deeplink data에 accessToken 필드가 없습니다");
|
|
9625
9630
|
}
|
|
9626
9631
|
export {
|
|
9627
|
-
|
|
9632
|
+
tr as CONNECT_OTHER_WALLET_DISPLAY_ORDER,
|
|
9628
9633
|
g as CROSSxError,
|
|
9629
|
-
|
|
9634
|
+
or as CROSSxEthereumProvider,
|
|
9630
9635
|
ft as CROSSxSDK,
|
|
9631
|
-
|
|
9636
|
+
Zi as ChainId,
|
|
9632
9637
|
Ue as ConnectOtherWalletItem,
|
|
9633
9638
|
h as ErrorCode,
|
|
9634
9639
|
Ut as MNEMONIC_ADDRESS_LIMIT,
|
|
9635
9640
|
cs as PinMemoryStore,
|
|
9636
|
-
|
|
9637
|
-
|
|
9638
|
-
|
|
9639
|
-
|
|
9641
|
+
Ki as TokenMemoryStore,
|
|
9642
|
+
Qi as createCROSSxSDK,
|
|
9643
|
+
sr as getConnectOtherWalletLabel,
|
|
9644
|
+
eo as parseOAuthDeeplink
|
|
9640
9645
|
};
|