@nexus-cross/crossx-sdk-core 1.0.8 → 1.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core/config/environments.d.ts +7 -5
- package/dist/core/config/environments.d.ts.map +1 -1
- package/dist/crossx.global +1228 -0
- package/dist/index.cjs +28 -28
- package/dist/index.js +366 -374
- package/package.json +4 -2
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
3
|
-
var v = (r, e, s) =>
|
|
4
|
-
import { decodeJwt as
|
|
1
|
+
var Is = Object.defineProperty;
|
|
2
|
+
var As = (r, e, s) => e in r ? Is(r, e, { enumerable: !0, configurable: !0, writable: !0, value: s }) : r[e] = s;
|
|
3
|
+
var v = (r, e, s) => As(r, typeof e != "symbol" ? e + "" : e, s);
|
|
4
|
+
import { decodeJwt as Rs } from "jose";
|
|
5
5
|
var g = /* @__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.WALLET_NOT_FOUND = "WALLET_NOT_FOUND", r.WALLET_CREATION_FAILED = "WALLET_CREATION_FAILED", r.SIGN_FAILED = "SIGN_FAILED", r.SIGN_REJECTED = "SIGN_REJECTED", r.TX_FAILED = "TX_FAILED", r.TX_REJECTED = "TX_REJECTED", 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.GATEWAY_INTERNAL_ERROR = "GATEWAY_INTERNAL_ERROR", r.GATEWAY_LOCK_CONFLICT = "GATEWAY_LOCK_CONFLICT", 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.INVALID_CONFIG = "INVALID_CONFIG", r.UNKNOWN_ERROR = "UNKNOWN_ERROR", r))(g || {});
|
|
6
6
|
class x extends Error {
|
|
7
7
|
constructor(e, s, t) {
|
|
@@ -65,20 +65,20 @@ const We = {
|
|
|
65
65
|
rpcUrl: "https://saigon-testnet.roninchain.com/rpc",
|
|
66
66
|
testnet: !0
|
|
67
67
|
}
|
|
68
|
-
},
|
|
68
|
+
}, Fn = Object.fromEntries(
|
|
69
69
|
Object.entries(We).map(([r, e]) => [r, e.caipId])
|
|
70
|
-
),
|
|
70
|
+
), Os = new Map(
|
|
71
71
|
Object.values(We).map((r) => [r.caipId, r])
|
|
72
72
|
);
|
|
73
73
|
new Map(
|
|
74
74
|
Object.values(We).map((r) => [r.chainId, r])
|
|
75
75
|
);
|
|
76
|
-
const
|
|
76
|
+
const Cs = { symbol: "", decimals: 18 };
|
|
77
77
|
function ze(r) {
|
|
78
78
|
var e;
|
|
79
|
-
return ((e =
|
|
79
|
+
return ((e = Os.get(r)) == null ? void 0 : e.nativeCurrency) ?? Cs;
|
|
80
80
|
}
|
|
81
|
-
class
|
|
81
|
+
class ks {
|
|
82
82
|
constructor(e, s) {
|
|
83
83
|
this.sdk = e, this.chainId = s, this._listeners = /* @__PURE__ */ new Map();
|
|
84
84
|
}
|
|
@@ -187,7 +187,7 @@ const p = {
|
|
|
187
187
|
return;
|
|
188
188
|
}
|
|
189
189
|
}
|
|
190
|
-
},
|
|
190
|
+
}, Ns = {
|
|
191
191
|
// ── 공통 버튼 ────────────────────────────────────────────────
|
|
192
192
|
confirm: "확인",
|
|
193
193
|
cancel: "취소",
|
|
@@ -221,7 +221,7 @@ const p = {
|
|
|
221
221
|
walletSelector_title: "지갑 선택",
|
|
222
222
|
walletSelector_addButton: "지갑 추가",
|
|
223
223
|
walletSelector_selected: "선택됨"
|
|
224
|
-
},
|
|
224
|
+
}, Kt = {
|
|
225
225
|
// ── Common buttons ───────────────────────────────────────────
|
|
226
226
|
confirm: "Confirm",
|
|
227
227
|
cancel: "Cancel",
|
|
@@ -255,15 +255,15 @@ const p = {
|
|
|
255
255
|
walletSelector_title: "Select Wallet",
|
|
256
256
|
walletSelector_addButton: "Add Wallet",
|
|
257
257
|
walletSelector_selected: "Selected"
|
|
258
|
-
},
|
|
259
|
-
ko:
|
|
260
|
-
en:
|
|
258
|
+
}, Ps = {
|
|
259
|
+
ko: Ns,
|
|
260
|
+
en: Kt
|
|
261
261
|
};
|
|
262
262
|
function yt(r = "en", e) {
|
|
263
|
-
return
|
|
263
|
+
return Ps[r] ?? Kt;
|
|
264
264
|
}
|
|
265
265
|
const Ye = "crossx_access_token", Ne = "crossx_refresh_token", Pe = "crossx_user_info";
|
|
266
|
-
class
|
|
266
|
+
class Ls {
|
|
267
267
|
constructor(e, s, t, n, o, i, a) {
|
|
268
268
|
this.config = e, this.storage = s, this.crypto = t, this.oauth = n, this.transport = o, this.walletProvider = i, this.tokenStore = a, this._refreshPromise = null;
|
|
269
269
|
}
|
|
@@ -306,12 +306,12 @@ class Ds {
|
|
|
306
306
|
});
|
|
307
307
|
p.log("[CROSSx] OAuth Firebase 토큰 받음 (length:", _.length, ")");
|
|
308
308
|
const { accessToken: m, refreshToken: A } = await this.exchangeFirebaseToken(_, f);
|
|
309
|
-
let y,
|
|
309
|
+
let y, T;
|
|
310
310
|
try {
|
|
311
311
|
const F = this.crypto.decodeJWT(_);
|
|
312
|
-
|
|
312
|
+
T = (n = F.firebase) == null ? void 0 : n.sign_in_provider;
|
|
313
313
|
const $ = ((o = F.firebase) == null ? void 0 : o.identities) ?? {};
|
|
314
|
-
|
|
314
|
+
T === "google.com" ? y = (i = $["google.com"]) == null ? void 0 : i[0] : T === "apple.com" && (y = (a = $["apple.com"]) == null ? void 0 : a[0]), p.log("[CROSSx] OAuth provider sub 추출 — provider:", T, "hasProviderSub:", !!y);
|
|
315
315
|
} catch {
|
|
316
316
|
p.warn("[CROSSx] firebaseToken에서 providerSub 추출 실패");
|
|
317
317
|
}
|
|
@@ -325,7 +325,7 @@ class Ds {
|
|
|
325
325
|
s = {
|
|
326
326
|
id: B.sub,
|
|
327
327
|
email: B.email,
|
|
328
|
-
signInProvider:
|
|
328
|
+
signInProvider: T,
|
|
329
329
|
providerSub: y
|
|
330
330
|
}, this.tokenStore.set(m), this.useCookieAuth || (await this.storage.set(Ye, m), A && await this.storage.set(Ne, A));
|
|
331
331
|
} else {
|
|
@@ -333,7 +333,7 @@ class Ds {
|
|
|
333
333
|
s = {
|
|
334
334
|
id: F.sub,
|
|
335
335
|
email: F.email,
|
|
336
|
-
signInProvider:
|
|
336
|
+
signInProvider: T,
|
|
337
337
|
providerSub: y
|
|
338
338
|
}, p.log("[CROSSx] Cookie 모드 — Firebase 토큰에서 사용자 정보 추출 — id:", s.id);
|
|
339
339
|
}
|
|
@@ -526,16 +526,16 @@ class Ds {
|
|
|
526
526
|
return p.log("[CROSSx][Migration Phase 2] loadWallet 결과 — address:", t, "needsMigration:", n), { success: !0, address: t, user: e, needsMigration: n, tokenSignatureVerified: s };
|
|
527
527
|
}
|
|
528
528
|
}
|
|
529
|
-
const
|
|
530
|
-
class
|
|
529
|
+
const Ds = "crossx_access_token", $s = "crossx_refresh_token", Ms = "crossx_user_info";
|
|
530
|
+
class Bs {
|
|
531
531
|
constructor(e, s, t) {
|
|
532
532
|
this.config = e, this.storage = s, this.tokenStore = t;
|
|
533
533
|
}
|
|
534
534
|
async execute() {
|
|
535
|
-
this.tokenStore.clear(), this.config.authMode !== "cookie" && (await this.storage.remove(
|
|
535
|
+
this.tokenStore.clear(), this.config.authMode !== "cookie" && (await this.storage.remove(Ds), await this.storage.remove($s)), await this.storage.remove(Ms);
|
|
536
536
|
}
|
|
537
537
|
}
|
|
538
|
-
class
|
|
538
|
+
class Fs {
|
|
539
539
|
constructor(e, s) {
|
|
540
540
|
this.storage = e, this.walletProvider = s;
|
|
541
541
|
}
|
|
@@ -552,7 +552,7 @@ class Us {
|
|
|
552
552
|
};
|
|
553
553
|
}
|
|
554
554
|
}
|
|
555
|
-
class
|
|
555
|
+
class Us {
|
|
556
556
|
constructor(e, s) {
|
|
557
557
|
this.chainRegistry = e, this.transport = s;
|
|
558
558
|
}
|
|
@@ -584,7 +584,7 @@ class Hs {
|
|
|
584
584
|
return a == null ? void 0 : a.result;
|
|
585
585
|
}
|
|
586
586
|
}
|
|
587
|
-
class
|
|
587
|
+
class Hs {
|
|
588
588
|
constructor() {
|
|
589
589
|
this.listeners = /* @__PURE__ */ new Map();
|
|
590
590
|
}
|
|
@@ -629,32 +629,24 @@ const Fe = {
|
|
|
629
629
|
authApiUrl: "https://dev-cross-auth.crosstoken.io",
|
|
630
630
|
walletGatewayUrl: "https://dev-embedded-wallet-gateway.crosstoken.io/api/v1"
|
|
631
631
|
}
|
|
632
|
-
}
|
|
633
|
-
function
|
|
632
|
+
};
|
|
633
|
+
function Gs(r) {
|
|
634
634
|
const e = r.environment;
|
|
635
635
|
return e && e in Fe ? Fe[e] : null;
|
|
636
636
|
}
|
|
637
|
-
|
|
637
|
+
function qs() {
|
|
638
638
|
try {
|
|
639
639
|
if (typeof __CROSSX_CONFIG__ < "u") {
|
|
640
|
-
const r = typeof __CROSSX_CONFIG__ == "string" ? JSON.parse(__CROSSX_CONFIG__) : __CROSSX_CONFIG__, e =
|
|
640
|
+
const r = typeof __CROSSX_CONFIG__ == "string" ? JSON.parse(__CROSSX_CONFIG__) : __CROSSX_CONFIG__, e = Gs(r);
|
|
641
641
|
if (e) return e;
|
|
642
642
|
}
|
|
643
643
|
} catch {
|
|
644
644
|
}
|
|
645
|
-
try {
|
|
646
|
-
const r = await fetch(qs);
|
|
647
|
-
if (r.ok) {
|
|
648
|
-
const e = await r.json(), s = bt(e);
|
|
649
|
-
if (s) return s;
|
|
650
|
-
}
|
|
651
|
-
} catch {
|
|
652
|
-
}
|
|
653
645
|
return Fe.production;
|
|
654
646
|
}
|
|
655
|
-
const
|
|
647
|
+
const Ws = 2e3, bt = 6e4, js = 1e3, Vs = 1e4, Ks = "0x77359400", vt = "0x3B9ACA00", St = 130, Et = 6, Tt = 18, zs = 0, Ys = 30 * 1e3, X = class X extends Hs {
|
|
656
648
|
constructor(e, s, t, n, o, i, a, c, l, d) {
|
|
657
|
-
super(), this.storage = t, this.crypto = n, this.transport = o, this.oauth = i, this.walletProvider = a, this.tokenStore = c, this.initialized = !1, this.authenticated = !1, this.userId = null, this.address = null, this.userEmail = null, this.loginType = null, this.providerSub = null, this.tokenSignatureVerified = !1, this._config = Object.freeze({ ...e }), this.internalConfig = e, this.adapterConfig = s, e.logger && wt(e.logger), this.confirmation = l, this.chainRegistry = d, this.jsonRpc = new
|
|
649
|
+
super(), this.storage = t, this.crypto = n, this.transport = o, this.oauth = i, this.walletProvider = a, this.tokenStore = c, this.initialized = !1, this.authenticated = !1, this.userId = null, this.address = null, this.userEmail = null, this.loginType = null, this.providerSub = null, this.tokenSignatureVerified = !1, this._config = Object.freeze({ ...e }), this.internalConfig = e, this.adapterConfig = s, e.logger && wt(e.logger), this.confirmation = l, this.chainRegistry = d, this.jsonRpc = new Us(d, o), this.signInUseCase = new Ls(
|
|
658
650
|
this.internalConfig,
|
|
659
651
|
t,
|
|
660
652
|
n,
|
|
@@ -662,7 +654,7 @@ const js = 2e3, vt = 6e4, Vs = 1e3, Ks = 1e4, zs = "0x77359400", St = "0x3B9ACA0
|
|
|
662
654
|
o,
|
|
663
655
|
a,
|
|
664
656
|
c
|
|
665
|
-
), this.signOutUseCase = new
|
|
657
|
+
), this.signOutUseCase = new Bs(this.internalConfig, t, c), this.migrateWalletUseCase = new Fs(t, a);
|
|
666
658
|
}
|
|
667
659
|
get config() {
|
|
668
660
|
return this._config;
|
|
@@ -683,9 +675,9 @@ const js = 2e3, vt = 6e4, Vs = 1e3, Ks = 1e4, zs = "0x77359400", St = "0x3B9ACA0
|
|
|
683
675
|
*/
|
|
684
676
|
async initialize() {
|
|
685
677
|
if (this.initialized) return this.authenticated ? { success: !0, address: this.address ?? void 0 } : null;
|
|
686
|
-
console.log("[CROSSx SDK] v1.0.
|
|
678
|
+
console.log("[CROSSx SDK] v1.0.9 초기화 중..."), this.confirmation.setMessages(yt(this._config.locale));
|
|
687
679
|
try {
|
|
688
|
-
const e =
|
|
680
|
+
const e = qs();
|
|
689
681
|
this.internalConfig.oauthServiceUrl = e.oauthServiceUrl, this.internalConfig.authApiUrl = e.authApiUrl, this.internalConfig.walletGatewayUrl = e.walletGatewayUrl, this.adapterConfig.gatewayUrl = e.walletGatewayUrl;
|
|
690
682
|
const s = await this.signInUseCase.restoreSession();
|
|
691
683
|
return s != null && s.success && this.applyAuthResult(s), this.initialized = !0, this.emit("initialized", { restored: !!(s != null && s.success) }), s ?? null;
|
|
@@ -1251,7 +1243,7 @@ const js = 2e3, vt = 6e4, Vs = 1e3, Ks = 1e4, zs = "0x77359400", St = "0x3B9ACA0
|
|
|
1251
1243
|
* @param opts.timeoutMs 최대 대기 시간 (기본 60000ms)
|
|
1252
1244
|
*/
|
|
1253
1245
|
async waitForTxAndGetReceipt(e, s, t = {}) {
|
|
1254
|
-
const n = t.intervalMs ??
|
|
1246
|
+
const n = t.intervalMs ?? js, o = Vs, i = t.timeoutMs ?? bt, a = Date.now() + i;
|
|
1255
1247
|
let c = n;
|
|
1256
1248
|
for (; Date.now() < a; ) {
|
|
1257
1249
|
const l = await this.getTransactionReceipt(e, s);
|
|
@@ -1280,23 +1272,23 @@ const js = 2e3, vt = 6e4, Vs = 1e3, Ks = 1e4, zs = "0x77359400", St = "0x3B9ACA0
|
|
|
1280
1272
|
*/
|
|
1281
1273
|
async sendTransactionWithWaitForReceipt(e, s, t = {}) {
|
|
1282
1274
|
var A, y;
|
|
1283
|
-
const { intervalMs: n, timeoutMs: o, ...i } = t, { txHash: a } = await this.sendTransaction(e, s, i), c = n ?? ((A = this._config.receiptPolling) == null ? void 0 : A.intervalMs) ??
|
|
1275
|
+
const { intervalMs: n, timeoutMs: o, ...i } = t, { txHash: a } = await this.sendTransaction(e, s, i), c = n ?? ((A = this._config.receiptPolling) == null ? void 0 : A.intervalMs) ?? Ws, l = o ?? ((y = this._config.receiptPolling) == null ? void 0 : y.timeoutMs) ?? bt, d = ze(e), f = s.from ?? "";
|
|
1284
1276
|
let w, _;
|
|
1285
|
-
const m = this.waitForTxAndGetReceipt(a, e, { intervalMs: c, timeoutMs: l }).then((
|
|
1286
|
-
w =
|
|
1287
|
-
const L = BigInt(
|
|
1277
|
+
const m = this.waitForTxAndGetReceipt(a, e, { intervalMs: c, timeoutMs: l }).then((T) => {
|
|
1278
|
+
w = T;
|
|
1279
|
+
const L = BigInt(T.gasUsed) * BigInt(T.effectiveGasPrice), F = s.value ? BigInt(s.value) : 0n, $ = X.formatTxAmount(s.value, d.symbol, d.decimals), B = X.formatTxAmount("0x" + L.toString(16), d.symbol, d.decimals), Q = X.formatTxAmount("0x" + (F + L).toString(16), d.symbol, d.decimals);
|
|
1288
1280
|
return {
|
|
1289
1281
|
chainId: e,
|
|
1290
1282
|
txHash: a,
|
|
1291
|
-
from:
|
|
1292
|
-
to:
|
|
1283
|
+
from: T.from,
|
|
1284
|
+
to: T.to ?? s.to,
|
|
1293
1285
|
amount: $,
|
|
1294
1286
|
fees: B,
|
|
1295
1287
|
total: Q,
|
|
1296
1288
|
nativeSymbol: d.symbol,
|
|
1297
|
-
status:
|
|
1289
|
+
status: T.status === "0x1" ? "success" : "reverted"
|
|
1298
1290
|
};
|
|
1299
|
-
}).catch((
|
|
1291
|
+
}).catch((T) => (_ = T instanceof Error ? T : new Error(String(T)), {
|
|
1300
1292
|
chainId: e,
|
|
1301
1293
|
txHash: a,
|
|
1302
1294
|
from: f,
|
|
@@ -1437,7 +1429,7 @@ const js = 2e3, vt = 6e4, Vs = 1e3, Ks = 1e4, zs = "0x77359400", St = "0x3B9ACA0
|
|
|
1437
1429
|
try {
|
|
1438
1430
|
const s = BigInt(e);
|
|
1439
1431
|
if (s === 0n) return "0";
|
|
1440
|
-
const t = 10n ** BigInt(Tt), n = s / t, i = (s % t).toString().padStart(Tt, "0").replace(/0+$/, "").slice(0,
|
|
1432
|
+
const t = 10n ** BigInt(Tt), n = s / t, i = (s % t).toString().padStart(Tt, "0").replace(/0+$/, "").slice(0, Et);
|
|
1441
1433
|
return i ? `${n}.${i}` : `${n}`;
|
|
1442
1434
|
} catch {
|
|
1443
1435
|
return "?";
|
|
@@ -1462,7 +1454,7 @@ const js = 2e3, vt = 6e4, Vs = 1e3, Ks = 1e4, zs = "0x77359400", St = "0x3B9ACA0
|
|
|
1462
1454
|
* const client = createWalletClient({ transport: custom(provider) });
|
|
1463
1455
|
*/
|
|
1464
1456
|
getProvider(e) {
|
|
1465
|
-
return this.ensureAuthenticated(), new
|
|
1457
|
+
return this.ensureAuthenticated(), new ks(this, e);
|
|
1466
1458
|
}
|
|
1467
1459
|
/**
|
|
1468
1460
|
* 범용 JSON-RPC 요청 — 노드에 직접 연결.
|
|
@@ -1495,7 +1487,7 @@ const js = 2e3, vt = 6e4, Vs = 1e3, Ks = 1e4, zs = "0x77359400", St = "0x3B9ACA0
|
|
|
1495
1487
|
try {
|
|
1496
1488
|
const n = BigInt(e);
|
|
1497
1489
|
if (n === 0n) return;
|
|
1498
|
-
const o = 10n ** BigInt(t), i = n / o, c = (n % o).toString().padStart(t, "0").slice(0,
|
|
1490
|
+
const o = 10n ** BigInt(t), i = n / o, c = (n % o).toString().padStart(t, "0").slice(0, Et).replace(/0+$/, "");
|
|
1499
1491
|
return `${c ? `${i}.${c}` : `${i}`} ${s}`;
|
|
1500
1492
|
} catch {
|
|
1501
1493
|
return;
|
|
@@ -1559,12 +1551,12 @@ const js = 2e3, vt = 6e4, Vs = 1e3, Ks = 1e4, zs = "0x77359400", St = "0x3B9ACA0
|
|
|
1559
1551
|
p.log("[CROSSx] gasPrice & maxFeePerGas 비어있음 → baseFee 조회로 Dynamic/Legacy 판별");
|
|
1560
1552
|
const l = await this.getBaseFeePerGas(s);
|
|
1561
1553
|
if (l) {
|
|
1562
|
-
const d =
|
|
1554
|
+
const d = vt;
|
|
1563
1555
|
c.maxFeePerGas = "0x" + (BigInt(l) + BigInt(d)).toString(16), c.maxPriorityFeePerGas = d, p.log("[CROSSx] Dynamic 체인 감지 — baseFee:", l, "maxFeePerGas:", c.maxFeePerGas, "maxPriorityFeePerGas: 1 Gwei");
|
|
1564
1556
|
} else
|
|
1565
|
-
c.gasPrice =
|
|
1557
|
+
c.gasPrice = Ks, p.log("[CROSSx] Legacy 체인 감지 — gasPrice: 2 Gwei");
|
|
1566
1558
|
}
|
|
1567
|
-
return !i && a && (c.maxPriorityFeePerGas =
|
|
1559
|
+
return !i && a && (c.maxPriorityFeePerGas = vt, p.log("[CROSSx] maxPriorityFeePerGas 비어있음 → 1 Gwei 기본값 적용")), c;
|
|
1568
1560
|
}
|
|
1569
1561
|
/**
|
|
1570
1562
|
* EIP-712 signTypedData 호출 시 chainId와 typedData.domain.chainId 정합성 검증.
|
|
@@ -1611,10 +1603,10 @@ const js = 2e3, vt = 6e4, Vs = 1e3, Ks = 1e4, zs = "0x77359400", St = "0x3B9ACA0
|
|
|
1611
1603
|
const s = e.startsWith("0x") ? e.slice(2) : e;
|
|
1612
1604
|
if (!/^[0-9a-fA-F]+$/.test(s))
|
|
1613
1605
|
throw new x(g.SIGNATURE_FAILED, "유효하지 않은 서명: 올바른 hex 문자열이 아닙니다");
|
|
1614
|
-
if (s.length !==
|
|
1606
|
+
if (s.length !== St)
|
|
1615
1607
|
throw new x(
|
|
1616
1608
|
g.SIGNATURE_FAILED,
|
|
1617
|
-
`서명 길이가 유효하지 않습니다: ${
|
|
1609
|
+
`서명 길이가 유효하지 않습니다: ${St} hex 문자(65 바이트) 예상, 현재 ${s.length}`
|
|
1618
1610
|
);
|
|
1619
1611
|
}
|
|
1620
1612
|
/** RLP-encoded signed transaction 형식 검증 */
|
|
@@ -1699,7 +1691,7 @@ const js = 2e3, vt = 6e4, Vs = 1e3, Ks = 1e4, zs = "0x77359400", St = "0x3B9ACA0
|
|
|
1699
1691
|
};
|
|
1700
1692
|
X.OFFCHAIN_CHAIN_ID = "0";
|
|
1701
1693
|
let st = X;
|
|
1702
|
-
class
|
|
1694
|
+
class Zs {
|
|
1703
1695
|
constructor() {
|
|
1704
1696
|
this.prefix = "crossx_";
|
|
1705
1697
|
}
|
|
@@ -1736,8 +1728,8 @@ class Xs {
|
|
|
1736
1728
|
}
|
|
1737
1729
|
}
|
|
1738
1730
|
}
|
|
1739
|
-
const
|
|
1740
|
-
class
|
|
1731
|
+
const Xs = "crossx-sdk", Js = 1, Se = "data", Le = "keys", It = "aes-primary", Qs = 12;
|
|
1732
|
+
class At {
|
|
1741
1733
|
constructor() {
|
|
1742
1734
|
this.db = null, this.cryptoKey = null, this.initPromise = null;
|
|
1743
1735
|
}
|
|
@@ -1746,7 +1738,7 @@ class Rt {
|
|
|
1746
1738
|
}
|
|
1747
1739
|
openDB() {
|
|
1748
1740
|
return new Promise((e, s) => {
|
|
1749
|
-
const t = indexedDB.open(
|
|
1741
|
+
const t = indexedDB.open(Xs, Js);
|
|
1750
1742
|
t.onupgradeneeded = () => {
|
|
1751
1743
|
const n = t.result;
|
|
1752
1744
|
n.objectStoreNames.contains(Se) || n.createObjectStore(Se), n.objectStoreNames.contains(Le) || n.createObjectStore(Le);
|
|
@@ -1779,7 +1771,7 @@ class Rt {
|
|
|
1779
1771
|
}
|
|
1780
1772
|
async init() {
|
|
1781
1773
|
this.db = await this.openDB();
|
|
1782
|
-
const e = await this.idbGet(Le,
|
|
1774
|
+
const e = await this.idbGet(Le, It);
|
|
1783
1775
|
if (e) {
|
|
1784
1776
|
this.cryptoKey = e;
|
|
1785
1777
|
return;
|
|
@@ -1788,10 +1780,10 @@ class Rt {
|
|
|
1788
1780
|
{ name: "AES-GCM", length: 256 },
|
|
1789
1781
|
!1,
|
|
1790
1782
|
["encrypt", "decrypt"]
|
|
1791
|
-
), await this.idbPut(Le,
|
|
1783
|
+
), await this.idbPut(Le, It, this.cryptoKey);
|
|
1792
1784
|
}
|
|
1793
1785
|
async encrypt(e) {
|
|
1794
|
-
const s = new Uint8Array(
|
|
1786
|
+
const s = new Uint8Array(Qs);
|
|
1795
1787
|
crypto.getRandomValues(s);
|
|
1796
1788
|
const t = new TextEncoder().encode(e), n = await crypto.subtle.encrypt(
|
|
1797
1789
|
{ name: "AES-GCM", iv: s },
|
|
@@ -1867,27 +1859,27 @@ function H(r, e, s = "") {
|
|
|
1867
1859
|
}
|
|
1868
1860
|
return r;
|
|
1869
1861
|
}
|
|
1870
|
-
function
|
|
1862
|
+
function zt(r) {
|
|
1871
1863
|
if (typeof r != "function" || typeof r.create != "function")
|
|
1872
1864
|
throw new Error("Hash must wrapped by utils.createHasher");
|
|
1873
1865
|
ue(r.outputLen), ue(r.blockLen);
|
|
1874
1866
|
}
|
|
1875
|
-
function
|
|
1867
|
+
function Te(r, e = !0) {
|
|
1876
1868
|
if (r.destroyed)
|
|
1877
1869
|
throw new Error("Hash instance has been destroyed");
|
|
1878
1870
|
if (e && r.finished)
|
|
1879
1871
|
throw new Error("Hash#digest() has already been called");
|
|
1880
1872
|
}
|
|
1881
|
-
function
|
|
1873
|
+
function Yt(r, e) {
|
|
1882
1874
|
H(r, void 0, "digestInto() output");
|
|
1883
1875
|
const s = e.outputLen;
|
|
1884
1876
|
if (r.length < s)
|
|
1885
1877
|
throw new Error('"digestInto() output" expected to be of length >=' + s);
|
|
1886
1878
|
}
|
|
1887
|
-
function
|
|
1879
|
+
function er(r) {
|
|
1888
1880
|
return new Uint32Array(r.buffer, r.byteOffset, Math.floor(r.byteLength / 4));
|
|
1889
1881
|
}
|
|
1890
|
-
function
|
|
1882
|
+
function Ie(...r) {
|
|
1891
1883
|
for (let e = 0; e < r.length; e++)
|
|
1892
1884
|
r[e].fill(0);
|
|
1893
1885
|
}
|
|
@@ -1897,26 +1889,26 @@ function Ze(r) {
|
|
|
1897
1889
|
function oe(r, e) {
|
|
1898
1890
|
return r << 32 - e | r >>> e;
|
|
1899
1891
|
}
|
|
1900
|
-
const
|
|
1901
|
-
function
|
|
1892
|
+
const tr = new Uint8Array(new Uint32Array([287454020]).buffer)[0] === 68;
|
|
1893
|
+
function sr(r) {
|
|
1902
1894
|
return r << 24 & 4278190080 | r << 8 & 16711680 | r >>> 8 & 65280 | r >>> 24 & 255;
|
|
1903
1895
|
}
|
|
1904
|
-
function
|
|
1896
|
+
function rr(r) {
|
|
1905
1897
|
for (let e = 0; e < r.length; e++)
|
|
1906
|
-
r[e] =
|
|
1898
|
+
r[e] = sr(r[e]);
|
|
1907
1899
|
return r;
|
|
1908
1900
|
}
|
|
1909
|
-
const
|
|
1901
|
+
const Rt = tr ? (r) => r : rr, Zt = /* @ts-ignore */ typeof Uint8Array.from([]).toHex == "function" && typeof Uint8Array.fromHex == "function", nr = /* @__PURE__ */ Array.from({ length: 256 }, (r, e) => e.toString(16).padStart(2, "0"));
|
|
1910
1902
|
function ke(r) {
|
|
1911
|
-
if (H(r),
|
|
1903
|
+
if (H(r), Zt)
|
|
1912
1904
|
return r.toHex();
|
|
1913
1905
|
let e = "";
|
|
1914
1906
|
for (let s = 0; s < r.length; s++)
|
|
1915
|
-
e +=
|
|
1907
|
+
e += nr[r[s]];
|
|
1916
1908
|
return e;
|
|
1917
1909
|
}
|
|
1918
1910
|
const ce = { _0: 48, _9: 57, A: 65, F: 70, a: 97, f: 102 };
|
|
1919
|
-
function
|
|
1911
|
+
function Ot(r) {
|
|
1920
1912
|
if (r >= ce._0 && r <= ce._9)
|
|
1921
1913
|
return r - ce._0;
|
|
1922
1914
|
if (r >= ce.A && r <= ce.F)
|
|
@@ -1927,14 +1919,14 @@ function Ct(r) {
|
|
|
1927
1919
|
function Ue(r) {
|
|
1928
1920
|
if (typeof r != "string")
|
|
1929
1921
|
throw new Error("hex string expected, got " + typeof r);
|
|
1930
|
-
if (
|
|
1922
|
+
if (Zt)
|
|
1931
1923
|
return Uint8Array.fromHex(r);
|
|
1932
1924
|
const e = r.length, s = e / 2;
|
|
1933
1925
|
if (e % 2)
|
|
1934
1926
|
throw new Error("hex string expected, got unpadded hex of length " + e);
|
|
1935
1927
|
const t = new Uint8Array(s);
|
|
1936
1928
|
for (let n = 0, o = 0; n < s; n++, o += 2) {
|
|
1937
|
-
const i =
|
|
1929
|
+
const i = Ot(r.charCodeAt(o)), a = Ot(r.charCodeAt(o + 1));
|
|
1938
1930
|
if (i === void 0 || a === void 0) {
|
|
1939
1931
|
const c = r[o] + r[o + 1];
|
|
1940
1932
|
throw new Error('hex string expected, got non-hex character "' + c + '" at index ' + o);
|
|
@@ -1956,26 +1948,26 @@ function _e(...r) {
|
|
|
1956
1948
|
}
|
|
1957
1949
|
return s;
|
|
1958
1950
|
}
|
|
1959
|
-
function
|
|
1951
|
+
function Xt(r, e = {}) {
|
|
1960
1952
|
const s = (n, o) => r(o).update(n).digest(), t = r(void 0);
|
|
1961
1953
|
return s.outputLen = t.outputLen, s.blockLen = t.blockLen, s.create = (n) => r(n), Object.assign(s, e), Object.freeze(s);
|
|
1962
1954
|
}
|
|
1963
|
-
function
|
|
1955
|
+
function Jt(r = 32) {
|
|
1964
1956
|
const e = typeof globalThis == "object" ? globalThis.crypto : null;
|
|
1965
1957
|
if (typeof (e == null ? void 0 : e.getRandomValues) != "function")
|
|
1966
1958
|
throw new Error("crypto.getRandomValues must be defined");
|
|
1967
1959
|
return e.getRandomValues(new Uint8Array(r));
|
|
1968
1960
|
}
|
|
1969
|
-
const
|
|
1961
|
+
const or = (r) => ({
|
|
1970
1962
|
oid: Uint8Array.from([6, 9, 96, 134, 72, 1, 101, 3, 4, 2, r])
|
|
1971
1963
|
});
|
|
1972
|
-
function
|
|
1964
|
+
function ir(r, e, s) {
|
|
1973
1965
|
return r & e ^ ~r & s;
|
|
1974
1966
|
}
|
|
1975
|
-
function
|
|
1967
|
+
function ar(r, e, s) {
|
|
1976
1968
|
return r & e ^ r & s ^ e & s;
|
|
1977
1969
|
}
|
|
1978
|
-
class
|
|
1970
|
+
class cr {
|
|
1979
1971
|
constructor(e, s, t, n) {
|
|
1980
1972
|
v(this, "blockLen");
|
|
1981
1973
|
v(this, "outputLen");
|
|
@@ -1991,7 +1983,7 @@ class lr {
|
|
|
1991
1983
|
this.blockLen = e, this.outputLen = s, this.padOffset = t, this.isLE = n, this.buffer = new Uint8Array(e), this.view = Ze(this.buffer);
|
|
1992
1984
|
}
|
|
1993
1985
|
update(e) {
|
|
1994
|
-
|
|
1986
|
+
Te(this), H(e);
|
|
1995
1987
|
const { view: s, buffer: t, blockLen: n } = this, o = e.length;
|
|
1996
1988
|
for (let i = 0; i < o; ) {
|
|
1997
1989
|
const a = Math.min(n - this.pos, o - i);
|
|
@@ -2006,10 +1998,10 @@ class lr {
|
|
|
2006
1998
|
return this.length += e.length, this.roundClean(), this;
|
|
2007
1999
|
}
|
|
2008
2000
|
digestInto(e) {
|
|
2009
|
-
|
|
2001
|
+
Te(this), Yt(e, this), this.finished = !0;
|
|
2010
2002
|
const { buffer: s, view: t, blockLen: n, isLE: o } = this;
|
|
2011
2003
|
let { pos: i } = this;
|
|
2012
|
-
s[i++] = 128,
|
|
2004
|
+
s[i++] = 128, Ie(this.buffer.subarray(i)), this.padOffset > n - i && (this.process(t, 0), i = 0);
|
|
2013
2005
|
for (let f = i; f < n; f++)
|
|
2014
2006
|
s[f] = 0;
|
|
2015
2007
|
t.setBigUint64(n - 8, BigInt(this.length * 8), o), this.process(t, 0);
|
|
@@ -2046,20 +2038,20 @@ const fe = /* @__PURE__ */ Uint32Array.from([
|
|
|
2046
2038
|
2600822924,
|
|
2047
2039
|
528734635,
|
|
2048
2040
|
1541459225
|
|
2049
|
-
]), De = /* @__PURE__ */ BigInt(2 ** 32 - 1),
|
|
2050
|
-
function
|
|
2051
|
-
return e ? { h: Number(r & De), l: Number(r >>
|
|
2041
|
+
]), De = /* @__PURE__ */ BigInt(2 ** 32 - 1), Ct = /* @__PURE__ */ BigInt(32);
|
|
2042
|
+
function lr(r, e = !1) {
|
|
2043
|
+
return e ? { h: Number(r & De), l: Number(r >> Ct & De) } : { h: Number(r >> Ct & De) | 0, l: Number(r & De) | 0 };
|
|
2052
2044
|
}
|
|
2053
|
-
function
|
|
2045
|
+
function dr(r, e = !1) {
|
|
2054
2046
|
const s = r.length;
|
|
2055
2047
|
let t = new Uint32Array(s), n = new Uint32Array(s);
|
|
2056
2048
|
for (let o = 0; o < s; o++) {
|
|
2057
|
-
const { h: i, l: a } =
|
|
2049
|
+
const { h: i, l: a } = lr(r[o], e);
|
|
2058
2050
|
[t[o], n[o]] = [i, a];
|
|
2059
2051
|
}
|
|
2060
2052
|
return [t, n];
|
|
2061
2053
|
}
|
|
2062
|
-
const
|
|
2054
|
+
const ur = (r, e, s) => r << s | e >>> 32 - s, hr = (r, e, s) => e << s | r >>> 32 - s, fr = (r, e, s) => e << s - 32 | r >>> 64 - s, pr = (r, e, s) => r << s - 32 | e >>> 64 - s, gr = /* @__PURE__ */ Uint32Array.from([
|
|
2063
2055
|
1116352408,
|
|
2064
2056
|
1899447441,
|
|
2065
2057
|
3049323471,
|
|
@@ -2125,7 +2117,7 @@ const hr = (r, e, s) => r << s | e >>> 32 - s, fr = (r, e, s) => e << s | r >>>
|
|
|
2125
2117
|
3204031479,
|
|
2126
2118
|
3329325298
|
|
2127
2119
|
]), pe = /* @__PURE__ */ new Uint32Array(64);
|
|
2128
|
-
class
|
|
2120
|
+
class _r extends cr {
|
|
2129
2121
|
constructor(e) {
|
|
2130
2122
|
super(64, e, 8, !1);
|
|
2131
2123
|
}
|
|
@@ -2146,19 +2138,19 @@ class xr extends lr {
|
|
|
2146
2138
|
}
|
|
2147
2139
|
let { A: t, B: n, C: o, D: i, E: a, F: c, G: l, H: d } = this;
|
|
2148
2140
|
for (let f = 0; f < 64; f++) {
|
|
2149
|
-
const w = oe(a, 6) ^ oe(a, 11) ^ oe(a, 25), _ = d + w +
|
|
2141
|
+
const w = oe(a, 6) ^ oe(a, 11) ^ oe(a, 25), _ = d + w + ir(a, c, l) + gr[f] + pe[f] | 0, A = (oe(t, 2) ^ oe(t, 13) ^ oe(t, 22)) + ar(t, n, o) | 0;
|
|
2150
2142
|
d = l, l = c, c = a, a = i + _ | 0, i = o, o = n, n = t, t = _ + A | 0;
|
|
2151
2143
|
}
|
|
2152
2144
|
t = t + this.A | 0, n = n + this.B | 0, o = o + this.C | 0, i = i + this.D | 0, a = a + this.E | 0, c = c + this.F | 0, l = l + this.G | 0, d = d + this.H | 0, this.set(t, n, o, i, a, c, l, d);
|
|
2153
2145
|
}
|
|
2154
2146
|
roundClean() {
|
|
2155
|
-
|
|
2147
|
+
Ie(pe);
|
|
2156
2148
|
}
|
|
2157
2149
|
destroy() {
|
|
2158
|
-
this.set(0, 0, 0, 0, 0, 0, 0, 0),
|
|
2150
|
+
this.set(0, 0, 0, 0, 0, 0, 0, 0), Ie(this.buffer);
|
|
2159
2151
|
}
|
|
2160
2152
|
}
|
|
2161
|
-
class
|
|
2153
|
+
class xr extends _r {
|
|
2162
2154
|
constructor() {
|
|
2163
2155
|
super(32);
|
|
2164
2156
|
// We cannot use array here since array allows indexing by variable
|
|
@@ -2173,9 +2165,9 @@ class mr extends xr {
|
|
|
2173
2165
|
v(this, "H", fe[7] | 0);
|
|
2174
2166
|
}
|
|
2175
2167
|
}
|
|
2176
|
-
const
|
|
2177
|
-
() => new
|
|
2178
|
-
/* @__PURE__ */
|
|
2168
|
+
const mr = /* @__PURE__ */ Xt(
|
|
2169
|
+
() => new xr(),
|
|
2170
|
+
/* @__PURE__ */ or(1)
|
|
2179
2171
|
);
|
|
2180
2172
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
2181
2173
|
const ct = /* @__PURE__ */ BigInt(0), rt = /* @__PURE__ */ BigInt(1);
|
|
@@ -2186,7 +2178,7 @@ function He(r, e = "") {
|
|
|
2186
2178
|
}
|
|
2187
2179
|
return r;
|
|
2188
2180
|
}
|
|
2189
|
-
function
|
|
2181
|
+
function Qt(r) {
|
|
2190
2182
|
if (typeof r == "bigint") {
|
|
2191
2183
|
if (!Be(r))
|
|
2192
2184
|
throw new Error("positive bigint expected, got " + r);
|
|
@@ -2195,49 +2187,49 @@ function es(r) {
|
|
|
2195
2187
|
return r;
|
|
2196
2188
|
}
|
|
2197
2189
|
function $e(r) {
|
|
2198
|
-
const e =
|
|
2190
|
+
const e = Qt(r).toString(16);
|
|
2199
2191
|
return e.length & 1 ? "0" + e : e;
|
|
2200
2192
|
}
|
|
2201
|
-
function
|
|
2193
|
+
function es(r) {
|
|
2202
2194
|
if (typeof r != "string")
|
|
2203
2195
|
throw new Error("hex string expected, got " + typeof r);
|
|
2204
2196
|
return r === "" ? ct : BigInt("0x" + r);
|
|
2205
2197
|
}
|
|
2206
2198
|
function je(r) {
|
|
2207
|
-
return
|
|
2199
|
+
return es(ke(r));
|
|
2208
2200
|
}
|
|
2209
|
-
function
|
|
2210
|
-
return
|
|
2201
|
+
function ts(r) {
|
|
2202
|
+
return es(ke(wr(H(r)).reverse()));
|
|
2211
2203
|
}
|
|
2212
2204
|
function lt(r, e) {
|
|
2213
|
-
ue(e), r =
|
|
2205
|
+
ue(e), r = Qt(r);
|
|
2214
2206
|
const s = Ue(r.toString(16).padStart(e * 2, "0"));
|
|
2215
2207
|
if (s.length !== e)
|
|
2216
2208
|
throw new Error("number too large");
|
|
2217
2209
|
return s;
|
|
2218
2210
|
}
|
|
2219
|
-
function
|
|
2211
|
+
function ss(r, e) {
|
|
2220
2212
|
return lt(r, e).reverse();
|
|
2221
2213
|
}
|
|
2222
|
-
function
|
|
2214
|
+
function wr(r) {
|
|
2223
2215
|
return Uint8Array.from(r);
|
|
2224
2216
|
}
|
|
2225
2217
|
const Be = (r) => typeof r == "bigint" && ct <= r;
|
|
2226
|
-
function
|
|
2218
|
+
function yr(r, e, s) {
|
|
2227
2219
|
return Be(r) && Be(e) && Be(s) && e <= r && r < s;
|
|
2228
2220
|
}
|
|
2229
|
-
function
|
|
2230
|
-
if (!
|
|
2221
|
+
function br(r, e, s, t) {
|
|
2222
|
+
if (!yr(e, s, t))
|
|
2231
2223
|
throw new Error("expected valid " + r + ": " + s + " <= n < " + t + ", got " + e);
|
|
2232
2224
|
}
|
|
2233
|
-
function
|
|
2225
|
+
function vr(r) {
|
|
2234
2226
|
let e;
|
|
2235
2227
|
for (e = 0; r > ct; r >>= rt, e += 1)
|
|
2236
2228
|
;
|
|
2237
2229
|
return e;
|
|
2238
2230
|
}
|
|
2239
2231
|
const dt = (r) => (rt << BigInt(r)) - rt;
|
|
2240
|
-
function
|
|
2232
|
+
function Sr(r, e, s) {
|
|
2241
2233
|
if (ue(r, "hashLen"), ue(e, "qByteLen"), typeof s != "function")
|
|
2242
2234
|
throw new Error("hmacFn must be a function");
|
|
2243
2235
|
const t = (y) => new Uint8Array(y), n = Uint8Array.of(), o = Uint8Array.of(0), i = Uint8Array.of(1), a = 1e3;
|
|
@@ -2250,18 +2242,18 @@ function Er(r, e, s) {
|
|
|
2250
2242
|
if (d++ >= a)
|
|
2251
2243
|
throw new Error("drbg: tried max amount of iterations");
|
|
2252
2244
|
let y = 0;
|
|
2253
|
-
const
|
|
2245
|
+
const T = [];
|
|
2254
2246
|
for (; y < e; ) {
|
|
2255
2247
|
c = w();
|
|
2256
2248
|
const L = c.slice();
|
|
2257
|
-
|
|
2249
|
+
T.push(L), y += c.length;
|
|
2258
2250
|
}
|
|
2259
|
-
return _e(...
|
|
2251
|
+
return _e(...T);
|
|
2260
2252
|
};
|
|
2261
|
-
return (y,
|
|
2253
|
+
return (y, T) => {
|
|
2262
2254
|
f(), _(y);
|
|
2263
2255
|
let L;
|
|
2264
|
-
for (; !(L =
|
|
2256
|
+
for (; !(L = T(m())); )
|
|
2265
2257
|
_();
|
|
2266
2258
|
return f(), L;
|
|
2267
2259
|
};
|
|
@@ -2280,7 +2272,7 @@ function ut(r, e = {}, s = {}) {
|
|
|
2280
2272
|
const n = (o, i) => Object.entries(o).forEach(([a, c]) => t(a, c, i));
|
|
2281
2273
|
n(e, !1), n(s, !0);
|
|
2282
2274
|
}
|
|
2283
|
-
function
|
|
2275
|
+
function kt(r) {
|
|
2284
2276
|
const e = /* @__PURE__ */ new WeakMap();
|
|
2285
2277
|
return (s, ...t) => {
|
|
2286
2278
|
const n = e.get(s);
|
|
@@ -2291,7 +2283,7 @@ function Nt(r) {
|
|
|
2291
2283
|
};
|
|
2292
2284
|
}
|
|
2293
2285
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
2294
|
-
const J = /* @__PURE__ */ BigInt(0), z = /* @__PURE__ */ BigInt(1), ye = /* @__PURE__ */ BigInt(2),
|
|
2286
|
+
const J = /* @__PURE__ */ BigInt(0), z = /* @__PURE__ */ BigInt(1), ye = /* @__PURE__ */ BigInt(2), rs = /* @__PURE__ */ BigInt(3), ns = /* @__PURE__ */ BigInt(4), os = /* @__PURE__ */ BigInt(5), Er = /* @__PURE__ */ BigInt(7), is = /* @__PURE__ */ BigInt(8), Tr = /* @__PURE__ */ BigInt(9), as = /* @__PURE__ */ BigInt(16);
|
|
2295
2287
|
function re(r, e) {
|
|
2296
2288
|
const s = r % e;
|
|
2297
2289
|
return s >= J ? s : e + s;
|
|
@@ -2302,7 +2294,7 @@ function se(r, e, s) {
|
|
|
2302
2294
|
t *= t, t %= s;
|
|
2303
2295
|
return t;
|
|
2304
2296
|
}
|
|
2305
|
-
function
|
|
2297
|
+
function Nt(r, e) {
|
|
2306
2298
|
if (r === J)
|
|
2307
2299
|
throw new Error("invert: expected non-zero number");
|
|
2308
2300
|
if (e <= J)
|
|
@@ -2320,16 +2312,16 @@ function ht(r, e, s) {
|
|
|
2320
2312
|
if (!r.eql(r.sqr(e), s))
|
|
2321
2313
|
throw new Error("Cannot find square root");
|
|
2322
2314
|
}
|
|
2323
|
-
function
|
|
2324
|
-
const s = (r.ORDER + z) /
|
|
2315
|
+
function cs(r, e) {
|
|
2316
|
+
const s = (r.ORDER + z) / ns, t = r.pow(e, s);
|
|
2325
2317
|
return ht(r, t, e), t;
|
|
2326
2318
|
}
|
|
2327
|
-
function
|
|
2328
|
-
const s = (r.ORDER -
|
|
2319
|
+
function Ir(r, e) {
|
|
2320
|
+
const s = (r.ORDER - os) / is, t = r.mul(e, ye), n = r.pow(t, s), o = r.mul(e, n), i = r.mul(r.mul(o, ye), n), a = r.mul(o, r.sub(i, r.ONE));
|
|
2329
2321
|
return ht(r, a, e), a;
|
|
2330
2322
|
}
|
|
2331
|
-
function
|
|
2332
|
-
const e = Ve(r), s =
|
|
2323
|
+
function Ar(r) {
|
|
2324
|
+
const e = Ve(r), s = ls(r), t = s(e, e.neg(e.ONE)), n = s(e, t), o = s(e, e.neg(t)), i = (r + Er) / as;
|
|
2333
2325
|
return (a, c) => {
|
|
2334
2326
|
let l = a.pow(c, i), d = a.mul(l, t);
|
|
2335
2327
|
const f = a.mul(l, n), w = a.mul(l, o), _ = a.eql(a.sqr(d), c), m = a.eql(a.sqr(f), c);
|
|
@@ -2338,25 +2330,25 @@ function Rr(r) {
|
|
|
2338
2330
|
return ht(a, y, c), y;
|
|
2339
2331
|
};
|
|
2340
2332
|
}
|
|
2341
|
-
function
|
|
2342
|
-
if (r <
|
|
2333
|
+
function ls(r) {
|
|
2334
|
+
if (r < rs)
|
|
2343
2335
|
throw new Error("sqrt is not defined for small field");
|
|
2344
2336
|
let e = r - z, s = 0;
|
|
2345
2337
|
for (; e % ye === J; )
|
|
2346
2338
|
e /= ye, s++;
|
|
2347
2339
|
let t = ye;
|
|
2348
2340
|
const n = Ve(r);
|
|
2349
|
-
for (;
|
|
2341
|
+
for (; Pt(n, t) === 1; )
|
|
2350
2342
|
if (t++ > 1e3)
|
|
2351
2343
|
throw new Error("Cannot find square root: probably non-prime P");
|
|
2352
2344
|
if (s === 1)
|
|
2353
|
-
return
|
|
2345
|
+
return cs;
|
|
2354
2346
|
let o = n.pow(t, e);
|
|
2355
2347
|
const i = (e + z) / ye;
|
|
2356
2348
|
return function(c, l) {
|
|
2357
2349
|
if (c.is0(l))
|
|
2358
2350
|
return l;
|
|
2359
|
-
if (
|
|
2351
|
+
if (Pt(c, l) !== 1)
|
|
2360
2352
|
throw new Error("Cannot find square root");
|
|
2361
2353
|
let d = s, f = c.mul(c.ONE, o), w = c.pow(l, e), _ = c.pow(l, i);
|
|
2362
2354
|
for (; !c.eql(w, c.ONE); ) {
|
|
@@ -2366,16 +2358,16 @@ function ds(r) {
|
|
|
2366
2358
|
for (; !c.eql(A, c.ONE); )
|
|
2367
2359
|
if (m++, A = c.sqr(A), m === d)
|
|
2368
2360
|
throw new Error("Cannot find square root");
|
|
2369
|
-
const y = z << BigInt(d - m - 1),
|
|
2370
|
-
d = m, f = c.sqr(
|
|
2361
|
+
const y = z << BigInt(d - m - 1), T = c.pow(f, y);
|
|
2362
|
+
d = m, f = c.sqr(T), w = c.mul(w, f), _ = c.mul(_, T);
|
|
2371
2363
|
}
|
|
2372
2364
|
return _;
|
|
2373
2365
|
};
|
|
2374
2366
|
}
|
|
2375
|
-
function
|
|
2376
|
-
return r %
|
|
2367
|
+
function Rr(r) {
|
|
2368
|
+
return r % ns === rs ? cs : r % is === os ? Ir : r % as === Tr ? Ar(r) : ls(r);
|
|
2377
2369
|
}
|
|
2378
|
-
const
|
|
2370
|
+
const Or = [
|
|
2379
2371
|
"create",
|
|
2380
2372
|
"isValid",
|
|
2381
2373
|
"is0",
|
|
@@ -2394,15 +2386,15 @@ const Cr = [
|
|
|
2394
2386
|
"mulN",
|
|
2395
2387
|
"sqrN"
|
|
2396
2388
|
];
|
|
2397
|
-
function
|
|
2389
|
+
function Cr(r) {
|
|
2398
2390
|
const e = {
|
|
2399
2391
|
ORDER: "bigint",
|
|
2400
2392
|
BYTES: "number",
|
|
2401
2393
|
BITS: "number"
|
|
2402
|
-
}, s =
|
|
2394
|
+
}, s = Or.reduce((t, n) => (t[n] = "function", t), e);
|
|
2403
2395
|
return ut(r, s), r;
|
|
2404
2396
|
}
|
|
2405
|
-
function
|
|
2397
|
+
function kr(r, e, s) {
|
|
2406
2398
|
if (s < J)
|
|
2407
2399
|
throw new Error("invalid exponent, negatives unsupported");
|
|
2408
2400
|
if (s === J)
|
|
@@ -2414,22 +2406,22 @@ function Nr(r, e, s) {
|
|
|
2414
2406
|
s & z && (t = r.mul(t, n)), n = r.sqr(n), s >>= z;
|
|
2415
2407
|
return t;
|
|
2416
2408
|
}
|
|
2417
|
-
function
|
|
2409
|
+
function ds(r, e, s = !1) {
|
|
2418
2410
|
const t = new Array(e.length).fill(s ? r.ZERO : void 0), n = e.reduce((i, a, c) => r.is0(a) ? i : (t[c] = i, r.mul(i, a)), r.ONE), o = r.inv(n);
|
|
2419
2411
|
return e.reduceRight((i, a, c) => r.is0(a) ? i : (t[c] = r.mul(i, t[c]), r.mul(i, a)), o), t;
|
|
2420
2412
|
}
|
|
2421
|
-
function
|
|
2413
|
+
function Pt(r, e) {
|
|
2422
2414
|
const s = (r.ORDER - z) / ye, t = r.pow(e, s), n = r.eql(t, r.ONE), o = r.eql(t, r.ZERO), i = r.eql(t, r.neg(r.ONE));
|
|
2423
2415
|
if (!n && !o && !i)
|
|
2424
2416
|
throw new Error("invalid Legendre symbol result");
|
|
2425
2417
|
return n ? 1 : o ? 0 : -1;
|
|
2426
2418
|
}
|
|
2427
|
-
function
|
|
2419
|
+
function Nr(r, e) {
|
|
2428
2420
|
e !== void 0 && ue(e);
|
|
2429
2421
|
const s = e !== void 0 ? e : r.toString(2).length, t = Math.ceil(s / 8);
|
|
2430
2422
|
return { nBitLength: s, nByteLength: t };
|
|
2431
2423
|
}
|
|
2432
|
-
class
|
|
2424
|
+
class Pr {
|
|
2433
2425
|
constructor(e, s = {}) {
|
|
2434
2426
|
v(this, "ORDER");
|
|
2435
2427
|
v(this, "BITS");
|
|
@@ -2446,7 +2438,7 @@ class Lr {
|
|
|
2446
2438
|
throw new Error("invalid field: expected ORDER > 0, got " + e);
|
|
2447
2439
|
let t;
|
|
2448
2440
|
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 = (i = s.allowedLengths) == null ? void 0 : i.slice()), typeof s.modFromBytes == "boolean" && (this._mod = s.modFromBytes));
|
|
2449
|
-
const { nBitLength: n, nByteLength: o } =
|
|
2441
|
+
const { nBitLength: n, nByteLength: o } = Nr(e, t);
|
|
2450
2442
|
if (o > 2048)
|
|
2451
2443
|
throw new Error("invalid field: expected ORDER of <= 2048 bytes");
|
|
2452
2444
|
this.ORDER = e, this.BITS = n, this.BYTES = o, this._sqrt = void 0, Object.preventExtensions(this);
|
|
@@ -2488,10 +2480,10 @@ class Lr {
|
|
|
2488
2480
|
return re(e * s, this.ORDER);
|
|
2489
2481
|
}
|
|
2490
2482
|
pow(e, s) {
|
|
2491
|
-
return
|
|
2483
|
+
return kr(this, e, s);
|
|
2492
2484
|
}
|
|
2493
2485
|
div(e, s) {
|
|
2494
|
-
return re(e *
|
|
2486
|
+
return re(e * Nt(s, this.ORDER), this.ORDER);
|
|
2495
2487
|
}
|
|
2496
2488
|
// Same as above, but doesn't normalize
|
|
2497
2489
|
sqrN(e) {
|
|
@@ -2507,13 +2499,13 @@ class Lr {
|
|
|
2507
2499
|
return e * s;
|
|
2508
2500
|
}
|
|
2509
2501
|
inv(e) {
|
|
2510
|
-
return
|
|
2502
|
+
return Nt(e, this.ORDER);
|
|
2511
2503
|
}
|
|
2512
2504
|
sqrt(e) {
|
|
2513
|
-
return this._sqrt || (this._sqrt =
|
|
2505
|
+
return this._sqrt || (this._sqrt = Rr(this.ORDER)), this._sqrt(this, e);
|
|
2514
2506
|
}
|
|
2515
2507
|
toBytes(e) {
|
|
2516
|
-
return this.isLE ?
|
|
2508
|
+
return this.isLE ? ss(e, this.BYTES) : lt(e, this.BYTES);
|
|
2517
2509
|
}
|
|
2518
2510
|
fromBytes(e, s = !1) {
|
|
2519
2511
|
H(e);
|
|
@@ -2526,14 +2518,14 @@ class Lr {
|
|
|
2526
2518
|
}
|
|
2527
2519
|
if (e.length !== n)
|
|
2528
2520
|
throw new Error("Field.fromBytes: expected " + n + " bytes, got " + e.length);
|
|
2529
|
-
let c = o ?
|
|
2521
|
+
let c = o ? ts(e) : je(e);
|
|
2530
2522
|
if (a && (c = re(c, i)), !s && !this.isValid(c))
|
|
2531
2523
|
throw new Error("invalid field element: outside of range 0..ORDER");
|
|
2532
2524
|
return c;
|
|
2533
2525
|
}
|
|
2534
2526
|
// TODO: we don't need it here, move out to separate fn
|
|
2535
2527
|
invertBatch(e) {
|
|
2536
|
-
return
|
|
2528
|
+
return ds(this, e);
|
|
2537
2529
|
}
|
|
2538
2530
|
// We can't move this out because Fp6, Fp12 implement it
|
|
2539
2531
|
// and it's unclear what to return in there.
|
|
@@ -2542,25 +2534,25 @@ class Lr {
|
|
|
2542
2534
|
}
|
|
2543
2535
|
}
|
|
2544
2536
|
function Ve(r, e = {}) {
|
|
2545
|
-
return new
|
|
2537
|
+
return new Pr(r, e);
|
|
2546
2538
|
}
|
|
2547
|
-
function
|
|
2539
|
+
function us(r) {
|
|
2548
2540
|
if (typeof r != "bigint")
|
|
2549
2541
|
throw new Error("field order must be bigint");
|
|
2550
2542
|
const e = r.toString(2).length;
|
|
2551
2543
|
return Math.ceil(e / 8);
|
|
2552
2544
|
}
|
|
2553
|
-
function
|
|
2554
|
-
const e =
|
|
2545
|
+
function hs(r) {
|
|
2546
|
+
const e = us(r);
|
|
2555
2547
|
return e + Math.ceil(e / 2);
|
|
2556
2548
|
}
|
|
2557
|
-
function
|
|
2549
|
+
function Lr(r, e, s = !1) {
|
|
2558
2550
|
H(r);
|
|
2559
|
-
const t = r.length, n =
|
|
2551
|
+
const t = r.length, n = us(e), o = hs(e);
|
|
2560
2552
|
if (t < 16 || t < o || t > 1024)
|
|
2561
2553
|
throw new Error("expected " + o + "-1024 bytes of input, got " + t);
|
|
2562
|
-
const i = s ?
|
|
2563
|
-
return s ?
|
|
2554
|
+
const i = s ? ts(r) : je(r), a = re(i, e - z) + z;
|
|
2555
|
+
return s ? ss(a, n) : lt(a, n);
|
|
2564
2556
|
}
|
|
2565
2557
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
2566
2558
|
const Ae = /* @__PURE__ */ BigInt(0), be = /* @__PURE__ */ BigInt(1);
|
|
@@ -2568,35 +2560,35 @@ function Ge(r, e) {
|
|
|
2568
2560
|
const s = e.negate();
|
|
2569
2561
|
return r ? s : e;
|
|
2570
2562
|
}
|
|
2571
|
-
function
|
|
2572
|
-
const s =
|
|
2563
|
+
function Lt(r, e) {
|
|
2564
|
+
const s = ds(r.Fp, e.map((t) => t.Z));
|
|
2573
2565
|
return e.map((t, n) => r.fromAffine(t.toAffine(s[n])));
|
|
2574
2566
|
}
|
|
2575
|
-
function
|
|
2567
|
+
function fs(r, e) {
|
|
2576
2568
|
if (!Number.isSafeInteger(r) || r <= 0 || r > e)
|
|
2577
2569
|
throw new Error("invalid window size, expected [1.." + e + "], got W=" + r);
|
|
2578
2570
|
}
|
|
2579
2571
|
function Xe(r, e) {
|
|
2580
|
-
|
|
2572
|
+
fs(r, e);
|
|
2581
2573
|
const s = Math.ceil(e / r) + 1, t = 2 ** (r - 1), n = 2 ** r, o = dt(r), i = BigInt(r);
|
|
2582
2574
|
return { windows: s, windowSize: t, mask: o, maxNumber: n, shiftBy: i };
|
|
2583
2575
|
}
|
|
2584
|
-
function
|
|
2576
|
+
function Dt(r, e, s) {
|
|
2585
2577
|
const { windowSize: t, mask: n, maxNumber: o, shiftBy: i } = s;
|
|
2586
2578
|
let a = Number(r & n), c = r >> i;
|
|
2587
2579
|
a > t && (a -= o, c += be);
|
|
2588
2580
|
const l = e * t, d = l + Math.abs(a) - 1, f = a === 0, w = a < 0, _ = e % 2 !== 0;
|
|
2589
2581
|
return { nextN: c, offset: d, isZero: f, isNeg: w, isNegF: _, offsetF: l };
|
|
2590
2582
|
}
|
|
2591
|
-
const Je = /* @__PURE__ */ new WeakMap(),
|
|
2583
|
+
const Je = /* @__PURE__ */ new WeakMap(), ps = /* @__PURE__ */ new WeakMap();
|
|
2592
2584
|
function Qe(r) {
|
|
2593
|
-
return
|
|
2585
|
+
return ps.get(r) || 1;
|
|
2594
2586
|
}
|
|
2595
|
-
function
|
|
2587
|
+
function $t(r) {
|
|
2596
2588
|
if (r !== Ae)
|
|
2597
2589
|
throw new Error("invalid wNAF");
|
|
2598
2590
|
}
|
|
2599
|
-
class
|
|
2591
|
+
class Dr {
|
|
2600
2592
|
// Parametrized with a given Point class (not individual point)
|
|
2601
2593
|
constructor(e, s) {
|
|
2602
2594
|
v(this, "BASE");
|
|
@@ -2647,10 +2639,10 @@ class $r {
|
|
|
2647
2639
|
let n = this.ZERO, o = this.BASE;
|
|
2648
2640
|
const i = Xe(e, this.bits);
|
|
2649
2641
|
for (let a = 0; a < i.windows; a++) {
|
|
2650
|
-
const { nextN: c, offset: l, isZero: d, isNeg: f, isNegF: w, offsetF: _ } =
|
|
2642
|
+
const { nextN: c, offset: l, isZero: d, isNeg: f, isNegF: w, offsetF: _ } = Dt(t, a, i);
|
|
2651
2643
|
t = c, d ? o = o.add(Ge(w, s[_])) : n = n.add(Ge(f, s[l]));
|
|
2652
2644
|
}
|
|
2653
|
-
return
|
|
2645
|
+
return $t(t), { p: n, f: o };
|
|
2654
2646
|
}
|
|
2655
2647
|
/**
|
|
2656
2648
|
* Implements ec unsafe (non const-time) multiplication using precomputed tables and w-ary non-adjacent form.
|
|
@@ -2660,13 +2652,13 @@ class $r {
|
|
|
2660
2652
|
wNAFUnsafe(e, s, t, n = this.ZERO) {
|
|
2661
2653
|
const o = Xe(e, this.bits);
|
|
2662
2654
|
for (let i = 0; i < o.windows && t !== Ae; i++) {
|
|
2663
|
-
const { nextN: a, offset: c, isZero: l, isNeg: d } =
|
|
2655
|
+
const { nextN: a, offset: c, isZero: l, isNeg: d } = Dt(t, i, o);
|
|
2664
2656
|
if (t = a, !l) {
|
|
2665
2657
|
const f = s[c];
|
|
2666
2658
|
n = n.add(d ? f.negate() : f);
|
|
2667
2659
|
}
|
|
2668
2660
|
}
|
|
2669
|
-
return
|
|
2661
|
+
return $t(t), n;
|
|
2670
2662
|
}
|
|
2671
2663
|
getPrecomputes(e, s, t) {
|
|
2672
2664
|
let n = Je.get(s);
|
|
@@ -2684,27 +2676,27 @@ class $r {
|
|
|
2684
2676
|
// using windowed method. This specifies window size and
|
|
2685
2677
|
// stores precomputed values. Usually only base point would be precomputed.
|
|
2686
2678
|
createCache(e, s) {
|
|
2687
|
-
|
|
2679
|
+
fs(s, this.bits), ps.set(e, s), Je.delete(e);
|
|
2688
2680
|
}
|
|
2689
2681
|
hasCache(e) {
|
|
2690
2682
|
return Qe(e) !== 1;
|
|
2691
2683
|
}
|
|
2692
2684
|
}
|
|
2693
|
-
function
|
|
2685
|
+
function $r(r, e, s, t) {
|
|
2694
2686
|
let n = e, o = r.ZERO, i = r.ZERO;
|
|
2695
2687
|
for (; s > Ae || t > Ae; )
|
|
2696
2688
|
s & be && (o = o.add(n)), t & be && (i = i.add(n)), n = n.double(), s >>= be, t >>= be;
|
|
2697
2689
|
return { p1: o, p2: i };
|
|
2698
2690
|
}
|
|
2699
|
-
function
|
|
2691
|
+
function Mt(r, e, s) {
|
|
2700
2692
|
if (e) {
|
|
2701
2693
|
if (e.ORDER !== r)
|
|
2702
2694
|
throw new Error("Field.ORDER must match order: Fp == p, Fn == n");
|
|
2703
|
-
return
|
|
2695
|
+
return Cr(e), e;
|
|
2704
2696
|
} else
|
|
2705
2697
|
return Ve(r, { isLE: s });
|
|
2706
2698
|
}
|
|
2707
|
-
function
|
|
2699
|
+
function Mr(r, e, s = {}, t) {
|
|
2708
2700
|
if (t === void 0 && (t = r === "edwards"), !e || typeof e != "object")
|
|
2709
2701
|
throw new Error(`expected valid ${r} CURVE object`);
|
|
2710
2702
|
for (const c of ["p", "n", "h"]) {
|
|
@@ -2712,19 +2704,19 @@ function Br(r, e, s = {}, t) {
|
|
|
2712
2704
|
if (!(typeof l == "bigint" && l > Ae))
|
|
2713
2705
|
throw new Error(`CURVE.${c} must be positive bigint`);
|
|
2714
2706
|
}
|
|
2715
|
-
const n =
|
|
2707
|
+
const n = Mt(e.p, s.Fp, t), o = Mt(e.n, s.Fn, t), a = ["Gx", "Gy", "a", "b"];
|
|
2716
2708
|
for (const c of a)
|
|
2717
2709
|
if (!n.isValid(e[c]))
|
|
2718
2710
|
throw new Error(`CURVE.${c} must be valid field element of CURVE.Fp`);
|
|
2719
2711
|
return e = Object.freeze(Object.assign({}, e)), { CURVE: e, Fp: n, Fn: o };
|
|
2720
2712
|
}
|
|
2721
|
-
function
|
|
2713
|
+
function Br(r, e) {
|
|
2722
2714
|
return function(t) {
|
|
2723
2715
|
const n = r(t);
|
|
2724
2716
|
return { secretKey: n, publicKey: e(n) };
|
|
2725
2717
|
};
|
|
2726
2718
|
}
|
|
2727
|
-
class
|
|
2719
|
+
class gs {
|
|
2728
2720
|
constructor(e, s) {
|
|
2729
2721
|
v(this, "oHash");
|
|
2730
2722
|
v(this, "iHash");
|
|
@@ -2732,7 +2724,7 @@ class _s {
|
|
|
2732
2724
|
v(this, "outputLen");
|
|
2733
2725
|
v(this, "finished", !1);
|
|
2734
2726
|
v(this, "destroyed", !1);
|
|
2735
|
-
if (
|
|
2727
|
+
if (zt(e), H(s, void 0, "key"), this.iHash = e.create(), typeof this.iHash.update != "function")
|
|
2736
2728
|
throw new Error("Expected instance of class which extends utils.Hash");
|
|
2737
2729
|
this.blockLen = this.iHash.blockLen, this.outputLen = this.iHash.outputLen;
|
|
2738
2730
|
const t = this.blockLen, n = new Uint8Array(t);
|
|
@@ -2742,13 +2734,13 @@ class _s {
|
|
|
2742
2734
|
this.iHash.update(n), this.oHash = e.create();
|
|
2743
2735
|
for (let o = 0; o < n.length; o++)
|
|
2744
2736
|
n[o] ^= 106;
|
|
2745
|
-
this.oHash.update(n),
|
|
2737
|
+
this.oHash.update(n), Ie(n);
|
|
2746
2738
|
}
|
|
2747
2739
|
update(e) {
|
|
2748
|
-
return
|
|
2740
|
+
return Te(this), this.iHash.update(e), this;
|
|
2749
2741
|
}
|
|
2750
2742
|
digestInto(e) {
|
|
2751
|
-
|
|
2743
|
+
Te(this), H(e, this.outputLen, "output"), this.finished = !0, this.iHash.digestInto(e), this.oHash.update(e), this.oHash.digestInto(e), this.destroy();
|
|
2752
2744
|
}
|
|
2753
2745
|
digest() {
|
|
2754
2746
|
const e = new Uint8Array(this.oHash.outputLen);
|
|
@@ -2766,16 +2758,16 @@ class _s {
|
|
|
2766
2758
|
this.destroyed = !0, this.oHash.destroy(), this.iHash.destroy();
|
|
2767
2759
|
}
|
|
2768
2760
|
}
|
|
2769
|
-
const
|
|
2770
|
-
|
|
2761
|
+
const _s = (r, e, s) => new gs(r, e).update(s).digest();
|
|
2762
|
+
_s.create = (r, e) => new gs(r, e);
|
|
2771
2763
|
/*! noble-curves - MIT License (c) 2022 Paul Miller (paulmillr.com) */
|
|
2772
|
-
const
|
|
2773
|
-
function
|
|
2774
|
-
const [[t, n], [o, i]] = e, a =
|
|
2764
|
+
const Bt = (r, e) => (r + (r >= 0 ? e : -e) / xs) / e;
|
|
2765
|
+
function Fr(r, e, s) {
|
|
2766
|
+
const [[t, n], [o, i]] = e, a = Bt(i * r, s), c = Bt(-n * r, s);
|
|
2775
2767
|
let l = r - a * t - c * o, d = -a * n - c * i;
|
|
2776
2768
|
const f = l < le, w = d < le;
|
|
2777
2769
|
f && (l = -l), w && (d = -d);
|
|
2778
|
-
const _ = dt(Math.ceil(
|
|
2770
|
+
const _ = dt(Math.ceil(vr(s) / 2)) + Ee;
|
|
2779
2771
|
if (l < le || l >= _ || d < le || d >= _)
|
|
2780
2772
|
throw new Error("splitScalar (endomorphism): failed, k=" + r);
|
|
2781
2773
|
return { k1neg: f, k1: l, k2neg: w, k2: d };
|
|
@@ -2791,14 +2783,14 @@ function et(r, e) {
|
|
|
2791
2783
|
s[t] = r[t] === void 0 ? e[t] : r[t];
|
|
2792
2784
|
return He(s.lowS, "lowS"), He(s.prehash, "prehash"), s.format !== void 0 && nt(s.format), s;
|
|
2793
2785
|
}
|
|
2794
|
-
class
|
|
2786
|
+
class Ur extends Error {
|
|
2795
2787
|
constructor(e = "") {
|
|
2796
2788
|
super(e);
|
|
2797
2789
|
}
|
|
2798
2790
|
}
|
|
2799
2791
|
const ge = {
|
|
2800
2792
|
// asn.1 DER encoding utils
|
|
2801
|
-
Err:
|
|
2793
|
+
Err: Ur,
|
|
2802
2794
|
// Basic building block is TLV (Tag-Length-Value)
|
|
2803
2795
|
_tlv: {
|
|
2804
2796
|
encode: (r, e) => {
|
|
@@ -2883,9 +2875,9 @@ const ge = {
|
|
|
2883
2875
|
const { _tlv: e, _int: s } = ge, t = e.encode(2, s.encode(r.r)), n = e.encode(2, s.encode(r.s)), o = t + n;
|
|
2884
2876
|
return e.encode(48, o);
|
|
2885
2877
|
}
|
|
2886
|
-
}, le = BigInt(0), Ee = BigInt(1),
|
|
2887
|
-
function
|
|
2888
|
-
const s =
|
|
2878
|
+
}, le = BigInt(0), Ee = BigInt(1), xs = BigInt(2), Me = BigInt(3), Hr = BigInt(4);
|
|
2879
|
+
function Gr(r, e = {}) {
|
|
2880
|
+
const s = Mr("weierstrass", r, e), { Fp: t, Fn: n } = s;
|
|
2889
2881
|
let o = s.CURVE;
|
|
2890
2882
|
const { h: i, n: a } = o;
|
|
2891
2883
|
ut(e, {}, {
|
|
@@ -2899,7 +2891,7 @@ function qr(r, e = {}) {
|
|
|
2899
2891
|
const { endo: c } = e;
|
|
2900
2892
|
if (c && (!t.is0(o.a) || typeof c.beta != "bigint" || !Array.isArray(c.basises)))
|
|
2901
2893
|
throw new Error('invalid endo: expected "beta": bigint and "basises": array');
|
|
2902
|
-
const l =
|
|
2894
|
+
const l = ws(t, n);
|
|
2903
2895
|
function d() {
|
|
2904
2896
|
if (!t.isOdd)
|
|
2905
2897
|
throw new Error("compression is not supported: Field does not have .isOdd()");
|
|
@@ -2908,8 +2900,8 @@ function qr(r, e = {}) {
|
|
|
2908
2900
|
const { x: b, y: E } = u.toAffine(), R = t.toBytes(b);
|
|
2909
2901
|
if (He(h, "isCompressed"), h) {
|
|
2910
2902
|
d();
|
|
2911
|
-
const
|
|
2912
|
-
return _e(
|
|
2903
|
+
const I = !t.isOdd(E);
|
|
2904
|
+
return _e(ms(I), R);
|
|
2913
2905
|
} else
|
|
2914
2906
|
return _e(Uint8Array.of(4), R, t.toBytes(E));
|
|
2915
2907
|
}
|
|
@@ -2917,10 +2909,10 @@ function qr(r, e = {}) {
|
|
|
2917
2909
|
H(P, void 0, "Point");
|
|
2918
2910
|
const { publicKey: u, publicKeyUncompressed: h } = l, b = P.length, E = P[0], R = P.subarray(1);
|
|
2919
2911
|
if (b === u && (E === 2 || E === 3)) {
|
|
2920
|
-
const
|
|
2921
|
-
if (!t.isValid(
|
|
2912
|
+
const I = t.fromBytes(R);
|
|
2913
|
+
if (!t.isValid(I))
|
|
2922
2914
|
throw new Error("bad point: is not on curve, wrong x");
|
|
2923
|
-
const O = A(
|
|
2915
|
+
const O = A(I);
|
|
2924
2916
|
let S;
|
|
2925
2917
|
try {
|
|
2926
2918
|
S = t.sqrt(O);
|
|
@@ -2930,9 +2922,9 @@ function qr(r, e = {}) {
|
|
|
2930
2922
|
}
|
|
2931
2923
|
d();
|
|
2932
2924
|
const C = t.isOdd(S);
|
|
2933
|
-
return (E & 1) === 1 !== C && (S = t.neg(S)), { x:
|
|
2925
|
+
return (E & 1) === 1 !== C && (S = t.neg(S)), { x: I, y: S };
|
|
2934
2926
|
} else if (b === h && E === 4) {
|
|
2935
|
-
const
|
|
2927
|
+
const I = t.BYTES, O = t.fromBytes(R.subarray(0, I)), S = t.fromBytes(R.subarray(I, I * 2));
|
|
2936
2928
|
if (!y(O, S))
|
|
2937
2929
|
throw new Error("bad point: is not on curve");
|
|
2938
2930
|
return { x: O, y: S };
|
|
@@ -2950,8 +2942,8 @@ function qr(r, e = {}) {
|
|
|
2950
2942
|
}
|
|
2951
2943
|
if (!y(o.Gx, o.Gy))
|
|
2952
2944
|
throw new Error("bad curve params: generator point");
|
|
2953
|
-
const
|
|
2954
|
-
if (t.is0(t.add(
|
|
2945
|
+
const T = t.mul(t.pow(o.a, Me), Hr), L = t.mul(t.sqr(o.b), BigInt(27));
|
|
2946
|
+
if (t.is0(t.add(T, L)))
|
|
2955
2947
|
throw new Error("bad curve params: a or b");
|
|
2956
2948
|
function F(P, u, h = !1) {
|
|
2957
2949
|
if (!t.isValid(u) || h && t.is0(u))
|
|
@@ -2965,21 +2957,21 @@ function qr(r, e = {}) {
|
|
|
2965
2957
|
function B(P) {
|
|
2966
2958
|
if (!c || !c.basises)
|
|
2967
2959
|
throw new Error("no endo");
|
|
2968
|
-
return
|
|
2960
|
+
return Fr(P, c.basises, n.ORDER);
|
|
2969
2961
|
}
|
|
2970
|
-
const Q =
|
|
2962
|
+
const Q = kt((P, u) => {
|
|
2971
2963
|
const { X: h, Y: b, Z: E } = P;
|
|
2972
2964
|
if (t.eql(E, t.ONE))
|
|
2973
2965
|
return { x: h, y: b };
|
|
2974
2966
|
const R = P.is0();
|
|
2975
2967
|
u == null && (u = R ? t.ONE : t.inv(E));
|
|
2976
|
-
const
|
|
2968
|
+
const I = t.mul(h, u), O = t.mul(b, u), S = t.mul(E, u);
|
|
2977
2969
|
if (R)
|
|
2978
2970
|
return { x: t.ZERO, y: t.ZERO };
|
|
2979
2971
|
if (!t.eql(S, t.ONE))
|
|
2980
2972
|
throw new Error("invZ was invalid");
|
|
2981
|
-
return { x:
|
|
2982
|
-
}), ve =
|
|
2973
|
+
return { x: I, y: O };
|
|
2974
|
+
}), ve = kt((P) => {
|
|
2983
2975
|
if (P.is0()) {
|
|
2984
2976
|
if (e.allowInfinityPoint && !t.is0(P.Y))
|
|
2985
2977
|
return;
|
|
@@ -3053,7 +3045,7 @@ function qr(r, e = {}) {
|
|
|
3053
3045
|
/** Compare one point to another. */
|
|
3054
3046
|
equals(u) {
|
|
3055
3047
|
$(u);
|
|
3056
|
-
const { X: h, Y: b, Z: E } = this, { X: R, Y:
|
|
3048
|
+
const { X: h, Y: b, Z: E } = this, { X: R, Y: I, Z: O } = u, S = t.eql(t.mul(h, O), t.mul(R, E)), C = t.eql(t.mul(b, O), t.mul(I, E));
|
|
3057
3049
|
return S && C;
|
|
3058
3050
|
}
|
|
3059
3051
|
/** Flips point to one corresponding to (x, -y) in Affine coordinates. */
|
|
@@ -3065,9 +3057,9 @@ function qr(r, e = {}) {
|
|
|
3065
3057
|
// https://eprint.iacr.org/2015/1060, algorithm 3
|
|
3066
3058
|
// Cost: 8M + 3S + 3*a + 2*b3 + 15add.
|
|
3067
3059
|
double() {
|
|
3068
|
-
const { a: u, b: h } = o, b = t.mul(h, Me), { X: E, Y: R, Z:
|
|
3069
|
-
let O = t.ZERO, S = t.ZERO, C = t.ZERO, N = t.mul(E, E), W = t.mul(R, R), U = t.mul(
|
|
3070
|
-
return k = t.add(k, k), C = t.mul(E,
|
|
3060
|
+
const { a: u, b: h } = o, b = t.mul(h, Me), { X: E, Y: R, Z: I } = this;
|
|
3061
|
+
let O = t.ZERO, S = t.ZERO, C = t.ZERO, N = t.mul(E, E), W = t.mul(R, R), U = t.mul(I, I), k = t.mul(E, R);
|
|
3062
|
+
return k = t.add(k, k), C = t.mul(E, I), C = t.add(C, C), O = t.mul(u, C), S = t.mul(b, U), S = t.add(O, S), O = t.sub(W, S), S = t.add(W, S), S = t.mul(O, S), O = t.mul(k, O), C = t.mul(b, C), U = t.mul(u, U), k = t.sub(N, U), k = t.mul(u, k), k = t.add(k, C), C = t.add(N, N), N = t.add(C, N), N = t.add(N, U), N = t.mul(N, k), S = t.add(S, N), U = t.mul(R, I), U = t.add(U, U), N = t.mul(U, k), O = t.sub(O, N), C = t.mul(U, W), C = t.add(C, C), C = t.add(C, C), new D(O, S, C);
|
|
3071
3063
|
}
|
|
3072
3064
|
// Renes-Costello-Batina exception-free addition formula.
|
|
3073
3065
|
// There is 30% faster Jacobian formula, but it is not complete.
|
|
@@ -3075,13 +3067,13 @@ function qr(r, e = {}) {
|
|
|
3075
3067
|
// Cost: 12M + 0S + 3*a + 3*b3 + 23add.
|
|
3076
3068
|
add(u) {
|
|
3077
3069
|
$(u);
|
|
3078
|
-
const { X: h, Y: b, Z: E } = this, { X: R, Y:
|
|
3070
|
+
const { X: h, Y: b, Z: E } = this, { X: R, Y: I, Z: O } = u;
|
|
3079
3071
|
let S = t.ZERO, C = t.ZERO, N = t.ZERO;
|
|
3080
3072
|
const W = o.a, U = t.mul(o.b, Me);
|
|
3081
|
-
let k = t.mul(h, R), j = t.mul(b,
|
|
3073
|
+
let k = t.mul(h, R), j = t.mul(b, I), V = t.mul(E, O), ee = t.add(h, b), G = t.add(R, I);
|
|
3082
3074
|
ee = t.mul(ee, G), G = t.add(k, j), ee = t.sub(ee, G), G = t.add(h, E);
|
|
3083
3075
|
let K = t.add(R, O);
|
|
3084
|
-
return G = t.mul(G, K), K = t.add(k, V), G = t.sub(G, K), K = t.add(b, E), S = t.add(
|
|
3076
|
+
return G = t.mul(G, K), K = t.add(k, V), G = t.sub(G, K), K = t.add(b, E), S = t.add(I, O), K = t.mul(K, S), S = t.add(j, V), K = t.sub(K, S), N = t.mul(W, G), S = t.mul(U, V), N = t.add(S, N), S = t.sub(j, N), N = t.add(j, N), C = t.mul(S, N), j = t.add(k, k), j = t.add(j, k), V = t.mul(W, V), G = t.mul(U, G), j = t.add(j, V), V = t.sub(k, V), V = t.mul(W, V), G = t.add(G, V), k = t.mul(j, G), C = t.add(C, k), k = t.mul(K, G), S = t.mul(ee, S), S = t.sub(S, k), k = t.mul(ee, j), N = t.mul(K, N), N = t.add(N, k), new D(S, C, N);
|
|
3085
3077
|
}
|
|
3086
3078
|
subtract(u) {
|
|
3087
3079
|
return this.add(u.negate());
|
|
@@ -3103,15 +3095,15 @@ function qr(r, e = {}) {
|
|
|
3103
3095
|
if (!n.isValidNot0(u))
|
|
3104
3096
|
throw new Error("invalid scalar: out of range");
|
|
3105
3097
|
let b, E;
|
|
3106
|
-
const R = (
|
|
3098
|
+
const R = (I) => ne.cached(this, I, (O) => Lt(D, O));
|
|
3107
3099
|
if (h) {
|
|
3108
|
-
const { k1neg:
|
|
3109
|
-
E = W.add(k), b = he(h.beta, N, U,
|
|
3100
|
+
const { k1neg: I, k1: O, k2neg: S, k2: C } = B(u), { p: N, f: W } = R(O), { p: U, f: k } = R(C);
|
|
3101
|
+
E = W.add(k), b = he(h.beta, N, U, I, S);
|
|
3110
3102
|
} else {
|
|
3111
|
-
const { p:
|
|
3112
|
-
b =
|
|
3103
|
+
const { p: I, f: O } = R(u);
|
|
3104
|
+
b = I, E = O;
|
|
3113
3105
|
}
|
|
3114
|
-
return
|
|
3106
|
+
return Lt(D, [b, E])[0];
|
|
3115
3107
|
}
|
|
3116
3108
|
/**
|
|
3117
3109
|
* Non-constant-time multiplication. Uses double-and-add algorithm.
|
|
@@ -3129,8 +3121,8 @@ function qr(r, e = {}) {
|
|
|
3129
3121
|
if (ne.hasCache(this))
|
|
3130
3122
|
return this.multiply(u);
|
|
3131
3123
|
if (h) {
|
|
3132
|
-
const { k1neg: E, k1: R, k2neg:
|
|
3133
|
-
return he(h.beta, S, C, E,
|
|
3124
|
+
const { k1neg: E, k1: R, k2neg: I, k2: O } = B(u), { p1: S, p2: C } = $r(D, b, R, O);
|
|
3125
|
+
return he(h.beta, S, C, E, I);
|
|
3134
3126
|
} else
|
|
3135
3127
|
return ne.unsafe(b, u);
|
|
3136
3128
|
}
|
|
@@ -3173,13 +3165,13 @@ function qr(r, e = {}) {
|
|
|
3173
3165
|
v(D, "Fp", t), // scalar field
|
|
3174
3166
|
v(D, "Fn", n);
|
|
3175
3167
|
let Z = D;
|
|
3176
|
-
const xe = n.BITS, ne = new
|
|
3168
|
+
const xe = n.BITS, ne = new Dr(Z, e.endo ? Math.ceil(xe / 2) : xe);
|
|
3177
3169
|
return Z.BASE.precompute(8), Z;
|
|
3178
3170
|
}
|
|
3179
|
-
function
|
|
3171
|
+
function ms(r) {
|
|
3180
3172
|
return Uint8Array.of(r ? 2 : 3);
|
|
3181
3173
|
}
|
|
3182
|
-
function
|
|
3174
|
+
function ws(r, e) {
|
|
3183
3175
|
return {
|
|
3184
3176
|
secretKey: e.BYTES,
|
|
3185
3177
|
publicKey: 1 + r.BYTES,
|
|
@@ -3188,8 +3180,8 @@ function ys(r, e) {
|
|
|
3188
3180
|
signature: 2 * e.BYTES
|
|
3189
3181
|
};
|
|
3190
3182
|
}
|
|
3191
|
-
function
|
|
3192
|
-
const { Fn: s } = r, t = e.randomBytes ||
|
|
3183
|
+
function qr(r, e = {}) {
|
|
3184
|
+
const { Fn: s } = r, t = e.randomBytes || Jt, n = Object.assign(ws(r.Fp, s), { seed: hs(s.ORDER) });
|
|
3193
3185
|
function o(_) {
|
|
3194
3186
|
try {
|
|
3195
3187
|
const m = s.fromBytes(_);
|
|
@@ -3201,14 +3193,14 @@ function Wr(r, e = {}) {
|
|
|
3201
3193
|
function i(_, m) {
|
|
3202
3194
|
const { publicKey: A, publicKeyUncompressed: y } = n;
|
|
3203
3195
|
try {
|
|
3204
|
-
const
|
|
3205
|
-
return m === !0 &&
|
|
3196
|
+
const T = _.length;
|
|
3197
|
+
return m === !0 && T !== A || m === !1 && T !== y ? !1 : !!r.fromBytes(_);
|
|
3206
3198
|
} catch {
|
|
3207
3199
|
return !1;
|
|
3208
3200
|
}
|
|
3209
3201
|
}
|
|
3210
3202
|
function a(_ = t(n.seed)) {
|
|
3211
|
-
return
|
|
3203
|
+
return Lr(H(_, n.seed, "seed"), s.ORDER);
|
|
3212
3204
|
}
|
|
3213
3205
|
function c(_, m = !0) {
|
|
3214
3206
|
return r.BASE.multiply(s.fromBytes(_)).toBytes(m);
|
|
@@ -3217,8 +3209,8 @@ function Wr(r, e = {}) {
|
|
|
3217
3209
|
const { secretKey: m, publicKey: A, publicKeyUncompressed: y } = n;
|
|
3218
3210
|
if (!at(_) || "_lengths" in s && s._lengths || m === A)
|
|
3219
3211
|
return;
|
|
3220
|
-
const
|
|
3221
|
-
return
|
|
3212
|
+
const T = H(_, void 0, "key").length;
|
|
3213
|
+
return T === A || T === y;
|
|
3222
3214
|
}
|
|
3223
3215
|
function d(_, m, A = !0) {
|
|
3224
3216
|
if (l(_) === !0)
|
|
@@ -3232,28 +3224,28 @@ function Wr(r, e = {}) {
|
|
|
3232
3224
|
isValidSecretKey: o,
|
|
3233
3225
|
isValidPublicKey: i,
|
|
3234
3226
|
randomSecretKey: a
|
|
3235
|
-
}, w =
|
|
3227
|
+
}, w = Br(a, c);
|
|
3236
3228
|
return Object.freeze({ getPublicKey: c, getSharedSecret: d, keygen: w, Point: r, utils: f, lengths: n });
|
|
3237
3229
|
}
|
|
3238
|
-
function
|
|
3239
|
-
|
|
3230
|
+
function Wr(r, e, s = {}) {
|
|
3231
|
+
zt(e), ut(s, {}, {
|
|
3240
3232
|
hmac: "function",
|
|
3241
3233
|
lowS: "boolean",
|
|
3242
3234
|
randomBytes: "function",
|
|
3243
3235
|
bits2int: "function",
|
|
3244
3236
|
bits2int_modN: "function"
|
|
3245
3237
|
}), s = Object.assign({}, s);
|
|
3246
|
-
const t = s.randomBytes ||
|
|
3238
|
+
const t = s.randomBytes || Jt, n = s.hmac || ((u, h) => _s(e, u, h)), { Fp: o, Fn: i } = r, { ORDER: a, BITS: c } = i, { keygen: l, getPublicKey: d, getSharedSecret: f, utils: w, lengths: _ } = qr(r, s), m = {
|
|
3247
3239
|
prehash: !0,
|
|
3248
3240
|
lowS: typeof s.lowS == "boolean" ? s.lowS : !0,
|
|
3249
3241
|
format: "compact",
|
|
3250
3242
|
extraEntropy: !1
|
|
3251
|
-
}, A = a *
|
|
3243
|
+
}, A = a * xs < o.ORDER;
|
|
3252
3244
|
function y(u) {
|
|
3253
3245
|
const h = a >> Ee;
|
|
3254
3246
|
return u > h;
|
|
3255
3247
|
}
|
|
3256
|
-
function
|
|
3248
|
+
function T(u, h) {
|
|
3257
3249
|
if (!i.isValidNot0(h))
|
|
3258
3250
|
throw new Error(`invalid signature ${u}: out of range 1..Point.Fn.ORDER`);
|
|
3259
3251
|
return h;
|
|
@@ -3272,7 +3264,7 @@ function jr(r, e, s = {}) {
|
|
|
3272
3264
|
v(this, "r");
|
|
3273
3265
|
v(this, "s");
|
|
3274
3266
|
v(this, "recovery");
|
|
3275
|
-
if (this.r =
|
|
3267
|
+
if (this.r = T("r", h), this.s = T("s", b), E != null) {
|
|
3276
3268
|
if (L(), ![0, 1, 2, 3].includes(E))
|
|
3277
3269
|
throw new Error("invalid recovery id");
|
|
3278
3270
|
this.recovery = E;
|
|
@@ -3287,8 +3279,8 @@ function jr(r, e, s = {}) {
|
|
|
3287
3279
|
return new $(S, C);
|
|
3288
3280
|
}
|
|
3289
3281
|
b === "recovered" && (E = h[0], b = "compact", h = h.subarray(1));
|
|
3290
|
-
const R = _.signature / 2,
|
|
3291
|
-
return new $(i.fromBytes(
|
|
3282
|
+
const R = _.signature / 2, I = h.subarray(0, R), O = h.subarray(R, R * 2);
|
|
3283
|
+
return new $(i.fromBytes(I), i.fromBytes(O), E);
|
|
3292
3284
|
}
|
|
3293
3285
|
static fromHex(h, b) {
|
|
3294
3286
|
return this.fromBytes(Ue(h), b);
|
|
@@ -3303,10 +3295,10 @@ function jr(r, e, s = {}) {
|
|
|
3303
3295
|
return new $(this.r, this.s, h);
|
|
3304
3296
|
}
|
|
3305
3297
|
recoverPublicKey(h) {
|
|
3306
|
-
const { r: b, s: E } = this, R = this.assertRecovery(),
|
|
3307
|
-
if (!o.isValid(
|
|
3298
|
+
const { r: b, s: E } = this, R = this.assertRecovery(), I = R === 2 || R === 3 ? b + a : b;
|
|
3299
|
+
if (!o.isValid(I))
|
|
3308
3300
|
throw new Error("invalid recovery id: sig.r+curve.n != R.x");
|
|
3309
|
-
const O = o.toBytes(
|
|
3301
|
+
const O = o.toBytes(I), S = r.fromBytes(_e(ms((R & 1) === 0), O)), C = i.inv(I), N = Q(H(h, void 0, "msgHash")), W = i.create(-N * C), U = i.create(E * C), k = r.BASE.multiplyUnsafe(W).add(S.multiplyUnsafe(U));
|
|
3310
3302
|
if (k.is0())
|
|
3311
3303
|
throw new Error("invalid recovery: point at infinify");
|
|
3312
3304
|
return k.assertValidity(), k;
|
|
@@ -3318,8 +3310,8 @@ function jr(r, e, s = {}) {
|
|
|
3318
3310
|
toBytes(h = m.format) {
|
|
3319
3311
|
if (nt(h), h === "der")
|
|
3320
3312
|
return Ue(ge.hexFromSig(this));
|
|
3321
|
-
const { r: b, s: E } = this, R = i.toBytes(b),
|
|
3322
|
-
return h === "recovered" ? (L(), _e(Uint8Array.of(this.assertRecovery()), R,
|
|
3313
|
+
const { r: b, s: E } = this, R = i.toBytes(b), I = i.toBytes(E);
|
|
3314
|
+
return h === "recovered" ? (L(), _e(Uint8Array.of(this.assertRecovery()), R, I)) : _e(R, I);
|
|
3323
3315
|
}
|
|
3324
3316
|
toHex(h) {
|
|
3325
3317
|
return ke(this.toBytes(h));
|
|
@@ -3334,20 +3326,20 @@ function jr(r, e, s = {}) {
|
|
|
3334
3326
|
return i.create(B(h));
|
|
3335
3327
|
}, ve = dt(c);
|
|
3336
3328
|
function he(u) {
|
|
3337
|
-
return
|
|
3329
|
+
return br("num < 2^" + c, u, le, ve), i.toBytes(u);
|
|
3338
3330
|
}
|
|
3339
3331
|
function Z(u, h) {
|
|
3340
3332
|
return H(u, void 0, "message"), h ? H(e(u), void 0, "prehashed message") : u;
|
|
3341
3333
|
}
|
|
3342
3334
|
function xe(u, h, b) {
|
|
3343
|
-
const { lowS: E, prehash: R, extraEntropy:
|
|
3335
|
+
const { lowS: E, prehash: R, extraEntropy: I } = et(b, m);
|
|
3344
3336
|
u = Z(u, R);
|
|
3345
3337
|
const O = Q(u), S = i.fromBytes(h);
|
|
3346
3338
|
if (!i.isValidNot0(S))
|
|
3347
3339
|
throw new Error("invalid private key");
|
|
3348
3340
|
const C = [he(S), he(O)];
|
|
3349
|
-
if (
|
|
3350
|
-
const k =
|
|
3341
|
+
if (I != null && I !== !1) {
|
|
3342
|
+
const k = I === !0 ? t(_.secretKey) : I;
|
|
3351
3343
|
C.push(H(k, void 0, "extraEntropy"));
|
|
3352
3344
|
}
|
|
3353
3345
|
const N = _e(...C), W = O;
|
|
@@ -3368,11 +3360,11 @@ function jr(r, e, s = {}) {
|
|
|
3368
3360
|
}
|
|
3369
3361
|
function ne(u, h, b = {}) {
|
|
3370
3362
|
const { seed: E, k2sig: R } = xe(u, h, b);
|
|
3371
|
-
return
|
|
3363
|
+
return Sr(e.outputLen, i.BYTES, n)(E, R).toBytes(b.format);
|
|
3372
3364
|
}
|
|
3373
3365
|
function D(u, h, b, E = {}) {
|
|
3374
|
-
const { lowS: R, prehash:
|
|
3375
|
-
if (b = H(b, void 0, "publicKey"), h = Z(h,
|
|
3366
|
+
const { lowS: R, prehash: I, format: O } = et(E, m);
|
|
3367
|
+
if (b = H(b, void 0, "publicKey"), h = Z(h, I), !at(u)) {
|
|
3376
3368
|
const S = u instanceof $ ? ", use sig.toBytes()" : "";
|
|
3377
3369
|
throw new Error("verify expects Uint8Array signature" + S);
|
|
3378
3370
|
}
|
|
@@ -3414,44 +3406,44 @@ const ft = {
|
|
|
3414
3406
|
b: BigInt(7),
|
|
3415
3407
|
Gx: BigInt("0x79be667ef9dcbbac55a06295ce870b07029bfcdb2dce28d959f2815b16f81798"),
|
|
3416
3408
|
Gy: BigInt("0x483ada7726a3c4655da4fbfc0e1108a8fd17b448a68554199c47d08ffb10d4b8")
|
|
3417
|
-
},
|
|
3409
|
+
}, jr = {
|
|
3418
3410
|
beta: BigInt("0x7ae96a2b657c07106e64479eac3434e99cf0497512f58995c1396c28719501ee"),
|
|
3419
3411
|
basises: [
|
|
3420
3412
|
[BigInt("0x3086d221a7d46bcde86c90e49284eb15"), -BigInt("0xe4437ed6010e88286f547fa90abfe4c3")],
|
|
3421
3413
|
[BigInt("0x114ca50f7a8e2f3f657c1108d9d44cfd8"), BigInt("0x3086d221a7d46bcde86c90e49284eb15")]
|
|
3422
3414
|
]
|
|
3423
|
-
},
|
|
3424
|
-
function
|
|
3425
|
-
const e = ft.p, s = BigInt(3), t = BigInt(6), n = BigInt(11), o = BigInt(22), i = BigInt(23), a = BigInt(44), c = BigInt(88), l = r * r * r % e, d = l * l * r % e, f = se(d, s, e) * d % e, w = se(f, s, e) * d % e, _ = se(w,
|
|
3415
|
+
}, Ft = /* @__PURE__ */ BigInt(2);
|
|
3416
|
+
function Vr(r) {
|
|
3417
|
+
const e = ft.p, s = BigInt(3), t = BigInt(6), n = BigInt(11), o = BigInt(22), i = BigInt(23), a = BigInt(44), c = BigInt(88), l = r * r * r % e, d = l * l * r % e, f = se(d, s, e) * d % e, w = se(f, s, e) * d % e, _ = se(w, Ft, e) * l % e, m = se(_, n, e) * _ % e, A = se(m, o, e) * m % e, y = se(A, a, e) * A % e, T = se(y, c, e) * y % e, L = se(T, a, e) * A % e, F = se(L, s, e) * d % e, $ = se(F, i, e) * m % e, B = se($, t, e) * l % e, Q = se(B, Ft, e);
|
|
3426
3418
|
if (!ot.eql(ot.sqr(Q), r))
|
|
3427
3419
|
throw new Error("Cannot find square root");
|
|
3428
3420
|
return Q;
|
|
3429
3421
|
}
|
|
3430
|
-
const ot = Ve(ft.p, { sqrt:
|
|
3422
|
+
const ot = Ve(ft.p, { sqrt: Vr }), Kr = /* @__PURE__ */ Gr(ft, {
|
|
3431
3423
|
Fp: ot,
|
|
3432
|
-
endo:
|
|
3433
|
-
}),
|
|
3424
|
+
endo: jr
|
|
3425
|
+
}), zr = /* @__PURE__ */ Wr(Kr, mr), Yr = BigInt(0), Re = BigInt(1), Zr = BigInt(2), Xr = BigInt(7), Jr = BigInt(256), Qr = BigInt(113), ys = [], bs = [], vs = [];
|
|
3434
3426
|
for (let r = 0, e = Re, s = 1, t = 0; r < 24; r++) {
|
|
3435
|
-
[s, t] = [t, (2 * s + 3 * t) % 5],
|
|
3436
|
-
let n =
|
|
3427
|
+
[s, t] = [t, (2 * s + 3 * t) % 5], ys.push(2 * (5 * t + s)), bs.push((r + 1) * (r + 2) / 2 % 64);
|
|
3428
|
+
let n = Yr;
|
|
3437
3429
|
for (let o = 0; o < 7; o++)
|
|
3438
|
-
e = (e << Re ^ (e >>
|
|
3439
|
-
|
|
3430
|
+
e = (e << Re ^ (e >> Xr) * Qr) % Jr, e & Zr && (n ^= Re << (Re << BigInt(o)) - Re);
|
|
3431
|
+
vs.push(n);
|
|
3440
3432
|
}
|
|
3441
|
-
const
|
|
3442
|
-
function
|
|
3433
|
+
const Ss = dr(vs, !0), en = Ss[0], tn = Ss[1], Ut = (r, e, s) => s > 32 ? fr(r, e, s) : ur(r, e, s), Ht = (r, e, s) => s > 32 ? pr(r, e, s) : hr(r, e, s);
|
|
3434
|
+
function sn(r, e = 24) {
|
|
3443
3435
|
const s = new Uint32Array(10);
|
|
3444
3436
|
for (let t = 24 - e; t < 24; t++) {
|
|
3445
3437
|
for (let i = 0; i < 10; i++)
|
|
3446
3438
|
s[i] = r[i] ^ r[i + 10] ^ r[i + 20] ^ r[i + 30] ^ r[i + 40];
|
|
3447
3439
|
for (let i = 0; i < 10; i += 2) {
|
|
3448
|
-
const a = (i + 8) % 10, c = (i + 2) % 10, l = s[c], d = s[c + 1], f =
|
|
3440
|
+
const a = (i + 8) % 10, c = (i + 2) % 10, l = s[c], d = s[c + 1], f = Ut(l, d, 1) ^ s[a], w = Ht(l, d, 1) ^ s[a + 1];
|
|
3449
3441
|
for (let _ = 0; _ < 50; _ += 10)
|
|
3450
3442
|
r[i + _] ^= f, r[i + _ + 1] ^= w;
|
|
3451
3443
|
}
|
|
3452
3444
|
let n = r[2], o = r[3];
|
|
3453
3445
|
for (let i = 0; i < 24; i++) {
|
|
3454
|
-
const a =
|
|
3446
|
+
const a = bs[i], c = Ut(n, o, a), l = Ht(n, o, a), d = ys[i];
|
|
3455
3447
|
n = r[d], o = r[d + 1], r[d] = c, r[d + 1] = l;
|
|
3456
3448
|
}
|
|
3457
3449
|
for (let i = 0; i < 50; i += 10) {
|
|
@@ -3460,9 +3452,9 @@ function rn(r, e = 24) {
|
|
|
3460
3452
|
for (let a = 0; a < 10; a++)
|
|
3461
3453
|
r[i + a] ^= ~s[(a + 2) % 10] & s[(a + 4) % 10];
|
|
3462
3454
|
}
|
|
3463
|
-
r[0] ^=
|
|
3455
|
+
r[0] ^= en[t], r[1] ^= tn[t];
|
|
3464
3456
|
}
|
|
3465
|
-
|
|
3457
|
+
Ie(s);
|
|
3466
3458
|
}
|
|
3467
3459
|
class pt {
|
|
3468
3460
|
// NOTE: we accept arguments in bytes instead of bits here.
|
|
@@ -3480,16 +3472,16 @@ class pt {
|
|
|
3480
3472
|
v(this, "rounds");
|
|
3481
3473
|
if (this.blockLen = e, this.suffix = s, this.outputLen = t, this.enableXOF = n, this.rounds = o, ue(t, "outputLen"), !(0 < e && e < 200))
|
|
3482
3474
|
throw new Error("only keccak-f1600 function is supported");
|
|
3483
|
-
this.state = new Uint8Array(200), this.state32 =
|
|
3475
|
+
this.state = new Uint8Array(200), this.state32 = er(this.state);
|
|
3484
3476
|
}
|
|
3485
3477
|
clone() {
|
|
3486
3478
|
return this._cloneInto();
|
|
3487
3479
|
}
|
|
3488
3480
|
keccak() {
|
|
3489
|
-
|
|
3481
|
+
Rt(this.state32), sn(this.state32, this.rounds), Rt(this.state32), this.posOut = 0, this.pos = 0;
|
|
3490
3482
|
}
|
|
3491
3483
|
update(e) {
|
|
3492
|
-
|
|
3484
|
+
Te(this), H(e);
|
|
3493
3485
|
const { blockLen: s, state: t } = this, n = e.length;
|
|
3494
3486
|
for (let o = 0; o < n; ) {
|
|
3495
3487
|
const i = Math.min(s - this.pos, n - o);
|
|
@@ -3507,7 +3499,7 @@ class pt {
|
|
|
3507
3499
|
e[t] ^= s, s & 128 && t === n - 1 && this.keccak(), e[n - 1] ^= 128, this.keccak();
|
|
3508
3500
|
}
|
|
3509
3501
|
writeInto(e) {
|
|
3510
|
-
|
|
3502
|
+
Te(this, !1), H(e), this.finish();
|
|
3511
3503
|
const s = this.state, { blockLen: t } = this;
|
|
3512
3504
|
for (let n = 0, o = e.length; n < o; ) {
|
|
3513
3505
|
this.posOut >= t && this.keccak();
|
|
@@ -3525,7 +3517,7 @@ class pt {
|
|
|
3525
3517
|
return ue(e), this.xofInto(new Uint8Array(e));
|
|
3526
3518
|
}
|
|
3527
3519
|
digestInto(e) {
|
|
3528
|
-
if (
|
|
3520
|
+
if (Yt(e, this), this.finished)
|
|
3529
3521
|
throw new Error("digest() was already called");
|
|
3530
3522
|
return this.writeInto(e), this.destroy(), e;
|
|
3531
3523
|
}
|
|
@@ -3533,15 +3525,15 @@ class pt {
|
|
|
3533
3525
|
return this.digestInto(new Uint8Array(this.outputLen));
|
|
3534
3526
|
}
|
|
3535
3527
|
destroy() {
|
|
3536
|
-
this.destroyed = !0,
|
|
3528
|
+
this.destroyed = !0, Ie(this.state);
|
|
3537
3529
|
}
|
|
3538
3530
|
_cloneInto(e) {
|
|
3539
3531
|
const { blockLen: s, suffix: t, outputLen: n, rounds: o, enableXOF: i } = this;
|
|
3540
3532
|
return e || (e = new pt(s, t, n, i, o)), e.state32.set(this.state32), e.pos = this.pos, e.posOut = this.posOut, e.finished = this.finished, e.rounds = o, e.suffix = t, e.outputLen = n, e.enableXOF = i, e.destroyed = this.destroyed, e;
|
|
3541
3533
|
}
|
|
3542
3534
|
}
|
|
3543
|
-
const
|
|
3544
|
-
class
|
|
3535
|
+
const rn = (r, e, s, t = {}) => Xt(() => new pt(e, r, s), t), Gt = /* @__PURE__ */ rn(1, 136, 32);
|
|
3536
|
+
class nn {
|
|
3545
3537
|
async verifyJWT(e, s) {
|
|
3546
3538
|
try {
|
|
3547
3539
|
const t = this.decodeJWT(e);
|
|
@@ -3562,7 +3554,7 @@ class on {
|
|
|
3562
3554
|
}
|
|
3563
3555
|
}
|
|
3564
3556
|
decodeJWT(e) {
|
|
3565
|
-
return
|
|
3557
|
+
return Rs(e);
|
|
3566
3558
|
}
|
|
3567
3559
|
/**
|
|
3568
3560
|
* EIP-191 personal_sign 서명에서 서명자 Ethereum 주소를 복원합니다.
|
|
@@ -3577,33 +3569,33 @@ class on {
|
|
|
3577
3569
|
${t.length}`
|
|
3578
3570
|
), o = new Uint8Array(n.length + t.length);
|
|
3579
3571
|
o.set(n, 0), o.set(t, n.length);
|
|
3580
|
-
const i =
|
|
3572
|
+
const i = Gt(o), a = s.startsWith("0x") ? s.slice(2) : s;
|
|
3581
3573
|
if (a.length !== 130)
|
|
3582
3574
|
throw new Error(`서명 길이가 유효하지 않습니다: 130 hex 문자 예상, 현재 ${a.length}`);
|
|
3583
|
-
const c =
|
|
3584
|
-
|
|
3585
|
-
|
|
3586
|
-
).addRecoveryBit(w).recoverPublicKey(i).toBytes(!1).slice(1), y =
|
|
3575
|
+
const c = on(a), l = c.slice(0, 32), d = c.slice(32, 64), f = c[64], w = f >= 27 ? f - 27 : f, A = new zr.Signature(
|
|
3576
|
+
qt(l),
|
|
3577
|
+
qt(d)
|
|
3578
|
+
).addRecoveryBit(w).recoverPublicKey(i).toBytes(!1).slice(1), y = Gt(A);
|
|
3587
3579
|
return "0x" + ke(y.slice(12));
|
|
3588
3580
|
}
|
|
3589
3581
|
}
|
|
3590
|
-
function
|
|
3582
|
+
function on(r) {
|
|
3591
3583
|
const e = new Uint8Array(r.length / 2);
|
|
3592
3584
|
for (let s = 0; s < e.length; s++)
|
|
3593
3585
|
e[s] = parseInt(r.substring(s * 2, s * 2 + 2), 16);
|
|
3594
3586
|
return e;
|
|
3595
3587
|
}
|
|
3596
|
-
function
|
|
3588
|
+
function qt(r) {
|
|
3597
3589
|
let e = "0x";
|
|
3598
3590
|
for (const s of r) e += s.toString(16).padStart(2, "0");
|
|
3599
3591
|
return BigInt(e);
|
|
3600
3592
|
}
|
|
3601
|
-
const
|
|
3602
|
-
class
|
|
3593
|
+
const an = 3e4;
|
|
3594
|
+
class cn {
|
|
3603
3595
|
async request(e) {
|
|
3604
3596
|
const s = new AbortController(), t = setTimeout(
|
|
3605
3597
|
() => s.abort(),
|
|
3606
|
-
e.timeoutMs ??
|
|
3598
|
+
e.timeoutMs ?? an
|
|
3607
3599
|
);
|
|
3608
3600
|
try {
|
|
3609
3601
|
const n = await fetch(e.url, {
|
|
@@ -3650,7 +3642,7 @@ class gt {
|
|
|
3650
3642
|
p.warn("[CROSSx] OAuth 타임아웃 (5분) — postMessage를 수신하지 못했습니다"), F(), t(new Error("Authentication timeout"));
|
|
3651
3643
|
}, 5 * 60 * 1e3), _ = 10, m = 30;
|
|
3652
3644
|
let A = 0, y = null;
|
|
3653
|
-
const
|
|
3645
|
+
const T = () => {
|
|
3654
3646
|
clearInterval(L), p.warn("[CROSSx] COOP 감지 — OAuth 서버 응답을 " + m + "초간 대기합니다"), y = setTimeout(() => {
|
|
3655
3647
|
F(), t(new Error(
|
|
3656
3648
|
"OAuth 서버로부터 응답을 받지 못했습니다. 브라우저 보안 정책(COOP)으로 인해 팝업 통신이 차단되었을 수 있습니다. 다시 시도해 주세요."
|
|
@@ -3659,9 +3651,9 @@ class gt {
|
|
|
3659
3651
|
}, L = setInterval(() => {
|
|
3660
3652
|
A++;
|
|
3661
3653
|
try {
|
|
3662
|
-
f.closed && (A <= _ ?
|
|
3654
|
+
f.closed && (A <= _ ? T() : (F(), t(new Error("로그인이 취소되었습니다"))));
|
|
3663
3655
|
} catch {
|
|
3664
|
-
|
|
3656
|
+
T();
|
|
3665
3657
|
}
|
|
3666
3658
|
}, 1e3), F = () => {
|
|
3667
3659
|
clearTimeout(w), clearInterval(L), y && clearTimeout(y), window.removeEventListener("message", $);
|
|
@@ -3688,7 +3680,7 @@ class gt {
|
|
|
3688
3680
|
}
|
|
3689
3681
|
}
|
|
3690
3682
|
const Oe = "crossx_wallet_data";
|
|
3691
|
-
class
|
|
3683
|
+
class ln {
|
|
3692
3684
|
constructor(e) {
|
|
3693
3685
|
this.storage = e;
|
|
3694
3686
|
}
|
|
@@ -4080,7 +4072,7 @@ class Ce {
|
|
|
4080
4072
|
}
|
|
4081
4073
|
isCacheValid() {
|
|
4082
4074
|
if (this.loadedAt === 0) return !1;
|
|
4083
|
-
const e = this.usingFallback ?
|
|
4075
|
+
const e = this.usingFallback ? Ys : zs;
|
|
4084
4076
|
return e === 0 ? !0 : Date.now() - this.loadedAt < e;
|
|
4085
4077
|
}
|
|
4086
4078
|
populateCache(e, s) {
|
|
@@ -4142,7 +4134,7 @@ class Ce {
|
|
|
4142
4134
|
}
|
|
4143
4135
|
}
|
|
4144
4136
|
}
|
|
4145
|
-
const
|
|
4137
|
+
const Wt = "__crossx-confirm-style", te = "__crossx-confirm-overlay", dn = {
|
|
4146
4138
|
light: {
|
|
4147
4139
|
bg: "#FFFFFF",
|
|
4148
4140
|
border: "rgba(18,18,18,0.05)",
|
|
@@ -4188,8 +4180,8 @@ const jt = "__crossx-confirm-style", te = "__crossx-confirm-overlay", un = {
|
|
|
4188
4180
|
onPrimary: "#FFFFFF"
|
|
4189
4181
|
}
|
|
4190
4182
|
};
|
|
4191
|
-
function
|
|
4192
|
-
const s =
|
|
4183
|
+
function jt(r, e) {
|
|
4184
|
+
const s = dn[r], t = e == null ? void 0 : e[r];
|
|
4193
4185
|
return t ? {
|
|
4194
4186
|
...s,
|
|
4195
4187
|
// ── Brand
|
|
@@ -4218,7 +4210,7 @@ function Vt(r, e) {
|
|
|
4218
4210
|
...t.bg !== void 0 && { bg: t.bg, inputBg: t.bg }
|
|
4219
4211
|
} : s;
|
|
4220
4212
|
}
|
|
4221
|
-
const
|
|
4213
|
+
const un = `
|
|
4222
4214
|
@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;600&display=swap');
|
|
4223
4215
|
|
|
4224
4216
|
#${te} {
|
|
@@ -5135,13 +5127,13 @@ const hn = `
|
|
|
5135
5127
|
}
|
|
5136
5128
|
`;
|
|
5137
5129
|
function me() {
|
|
5138
|
-
let r = document.getElementById(
|
|
5139
|
-
r || (r = document.createElement("style"), r.id =
|
|
5130
|
+
let r = document.getElementById(Wt);
|
|
5131
|
+
r || (r = document.createElement("style"), r.id = Wt, document.head.appendChild(r)), r.textContent = un;
|
|
5140
5132
|
}
|
|
5141
5133
|
function Y(r) {
|
|
5142
5134
|
return r ? r.length <= 13 ? r : `${r.slice(0, 6)}…${r.slice(-4)}` : "—";
|
|
5143
5135
|
}
|
|
5144
|
-
function
|
|
5136
|
+
function hn(r, e = "CROSS", s = 18) {
|
|
5145
5137
|
if (!r || r === "0x" || r === "0x0") return null;
|
|
5146
5138
|
try {
|
|
5147
5139
|
const t = BigInt(r);
|
|
@@ -5152,7 +5144,7 @@ function fn(r, e = "CROSS", s = 18) {
|
|
|
5152
5144
|
return null;
|
|
5153
5145
|
}
|
|
5154
5146
|
}
|
|
5155
|
-
const
|
|
5147
|
+
const Vt = {
|
|
5156
5148
|
1: "Ethereum Mainnet",
|
|
5157
5149
|
5: "Goerli Testnet",
|
|
5158
5150
|
11155111: "Ethereum Sepolia",
|
|
@@ -5175,9 +5167,9 @@ const Kt = {
|
|
|
5175
5167
|
612044: "CROSS Testnet",
|
|
5176
5168
|
612055: "CROSS Mainnet"
|
|
5177
5169
|
};
|
|
5178
|
-
function
|
|
5170
|
+
function Es(r) {
|
|
5179
5171
|
const e = parseInt(r.split(":")[1] ?? "", 10);
|
|
5180
|
-
return !isNaN(e) &&
|
|
5172
|
+
return !isNaN(e) && Vt[e] ? Vt[e] : r;
|
|
5181
5173
|
}
|
|
5182
5174
|
function it(r, e) {
|
|
5183
5175
|
if (r === 0n) return "0";
|
|
@@ -5192,18 +5184,18 @@ function tt(r) {
|
|
|
5192
5184
|
return r;
|
|
5193
5185
|
}
|
|
5194
5186
|
}
|
|
5195
|
-
function
|
|
5187
|
+
function fn(r) {
|
|
5196
5188
|
try {
|
|
5197
5189
|
return BigInt(r).toLocaleString();
|
|
5198
5190
|
} catch {
|
|
5199
5191
|
return r;
|
|
5200
5192
|
}
|
|
5201
5193
|
}
|
|
5202
|
-
function
|
|
5194
|
+
function pn(r) {
|
|
5203
5195
|
const { gasLimit: e, gasPrice: s, maxFeePerGas: t, maxPriorityFeePerGas: n, nativeSymbol: o = "ETH", nativeDecimals: i = 18 } = r;
|
|
5204
5196
|
if (!e) return null;
|
|
5205
5197
|
try {
|
|
5206
|
-
const a = BigInt(e), c =
|
|
5198
|
+
const a = BigInt(e), c = fn(e);
|
|
5207
5199
|
if (t) {
|
|
5208
5200
|
const l = a * BigInt(t);
|
|
5209
5201
|
return {
|
|
@@ -5229,7 +5221,7 @@ function gn(r) {
|
|
|
5229
5221
|
}
|
|
5230
5222
|
}
|
|
5231
5223
|
function Ts(r) {
|
|
5232
|
-
const e =
|
|
5224
|
+
const e = pn(r);
|
|
5233
5225
|
if (!e) return q("Estimated fee", "<span>—</span>");
|
|
5234
5226
|
let s = q("Est. Tx Fee", `<span>${e.estTxFee}</span>`);
|
|
5235
5227
|
return e.isDynamic ? (e.maxPriorityFeeGwei !== void 0 && (s += q("Max Priority Fee", `<span>${e.maxPriorityFeeGwei} Gwei</span>`)), e.maxFeeGwei !== void 0 && (s += q("Max Gas Fee", `<span>${e.maxFeeGwei} Gwei</span>`))) : e.gasPriceGwei !== void 0 && (s += q("Gas Price", `<span>${e.gasPriceGwei} Gwei</span>`)), e.gasLimitFormatted && (s += q("Gas Limit", `<span>${e.gasLimitFormatted}</span>`)), s;
|
|
@@ -5241,7 +5233,7 @@ const de = `<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="
|
|
|
5241
5233
|
<line x1="18" y1="6" x2="6" y2="18"/>
|
|
5242
5234
|
<line x1="6" y1="6" x2="18" y2="18"/>
|
|
5243
5235
|
</svg>`;
|
|
5244
|
-
function
|
|
5236
|
+
function gn(r) {
|
|
5245
5237
|
return `<svg width="28" height="28" viewBox="0 0 28 28" fill="none">
|
|
5246
5238
|
<circle cx="14" cy="14" r="14" fill="${r}"/>
|
|
5247
5239
|
<path d="M14 7.5L19.2 10.5V16.5L14 19.5L8.8 16.5V10.5L14 7.5Z" fill="white" opacity="0.9"/>
|
|
@@ -5251,9 +5243,9 @@ const _t = `<svg width="20" height="20" viewBox="0 0 20 20" fill="none">
|
|
|
5251
5243
|
<rect x="2" y="5" width="16" height="12" rx="2" stroke="currentColor" stroke-width="1.5"/>
|
|
5252
5244
|
<path d="M2 9h16" stroke="currentColor" stroke-width="1.5"/>
|
|
5253
5245
|
<rect x="12.5" y="11.5" width="3.5" height="2.5" rx="0.75" fill="currentColor"/>
|
|
5254
|
-
</svg>`,
|
|
5246
|
+
</svg>`, _n = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none">
|
|
5255
5247
|
<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-secondary)"/>
|
|
5256
|
-
</svg>`,
|
|
5248
|
+
</svg>`, xn = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none">
|
|
5257
5249
|
<circle cx="12" cy="12" r="12" fill="var(--cx-secondary)"/>
|
|
5258
5250
|
<circle cx="12" cy="12" r="5.5" stroke="white" stroke-width="1.5"/>
|
|
5259
5251
|
<path d="M12 9.5v3l2 1.5" stroke="white" stroke-width="1.5" stroke-linecap="round"/>
|
|
@@ -5289,7 +5281,7 @@ function q(r, e) {
|
|
|
5289
5281
|
<div class="__crossx-row-value">${e}</div>
|
|
5290
5282
|
</div>`;
|
|
5291
5283
|
}
|
|
5292
|
-
function
|
|
5284
|
+
function mn(r, e) {
|
|
5293
5285
|
const s = e, t = Ke(), n = r.to ? `<span class="__crossx-addr-text">${Y(r.to)}</span>
|
|
5294
5286
|
<button class="__crossx-copy-btn" data-copy="${M(r.to)}" title="Copy address">${de}</button>` : "<span>—</span>", o = Ts(r), i = r.data && r.data !== "0x" ? r.data : "0x", a = document.createElement("div");
|
|
5295
5287
|
return a.id = te, a.innerHTML = `
|
|
@@ -5313,7 +5305,7 @@ function wn(r, e) {
|
|
|
5313
5305
|
<hr class="__crossx-divider">
|
|
5314
5306
|
<div class="__crossx-rows">
|
|
5315
5307
|
${q("To", n)}
|
|
5316
|
-
${q("Network", `<span>${
|
|
5308
|
+
${q("Network", `<span>${Es(r.chainId)}</span>`)}
|
|
5317
5309
|
${o}
|
|
5318
5310
|
</div>
|
|
5319
5311
|
</div>
|
|
@@ -5327,9 +5319,9 @@ function wn(r, e) {
|
|
|
5327
5319
|
</div>
|
|
5328
5320
|
`, a;
|
|
5329
5321
|
}
|
|
5330
|
-
function
|
|
5322
|
+
function wn(r, e) {
|
|
5331
5323
|
const s = e, t = r.nativeSymbol ?? "ETH", n = r.nativeDecimals ?? 18, o = Ke(), i = r.to ? `<span class="__crossx-addr-text">${Y(r.to)}</span>
|
|
5332
|
-
<button class="__crossx-copy-btn" data-copy="${M(r.to)}" title="Copy address">${de}</button>` : "<span>—</span>", a = Ts(r), l =
|
|
5324
|
+
<button class="__crossx-copy-btn" data-copy="${M(r.to)}" title="Copy address">${de}</button>` : "<span>—</span>", a = Ts(r), l = hn(r.value, t, n) ?? "—", d = document.createElement("div");
|
|
5333
5325
|
return d.id = te, d.innerHTML = `
|
|
5334
5326
|
<div class="__crossx-card __crossx-card--migration __crossx-card--send-tx" style="${ae(s)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
5335
5327
|
<div class="__crossx-header">
|
|
@@ -5344,7 +5336,7 @@ function yn(r, e) {
|
|
|
5344
5336
|
<div class="__crossx-body-cols">
|
|
5345
5337
|
<div class="__crossx-rows">
|
|
5346
5338
|
${q("To", i)}
|
|
5347
|
-
${q("Network", `<span>${
|
|
5339
|
+
${q("Network", `<span>${Es(r.chainId)}</span>`)}
|
|
5348
5340
|
${a}
|
|
5349
5341
|
</div>
|
|
5350
5342
|
<div class="__crossx-pill">
|
|
@@ -5368,10 +5360,10 @@ function Ke() {
|
|
|
5368
5360
|
function M(r) {
|
|
5369
5361
|
return r.replace(/&/g, "&").replace(/</g, "<").replace(/>/g, ">").replace(/"/g, """).replace(/'/g, "'");
|
|
5370
5362
|
}
|
|
5371
|
-
function
|
|
5363
|
+
function yn(r) {
|
|
5372
5364
|
return typeof r == "string" && /^0x[0-9a-fA-F]{40}$/i.test(r);
|
|
5373
5365
|
}
|
|
5374
|
-
function
|
|
5366
|
+
function bn(r) {
|
|
5375
5367
|
if (typeof r == "string") return M(r);
|
|
5376
5368
|
if (typeof r == "number" || typeof r == "bigint" || typeof r == "boolean") return String(r);
|
|
5377
5369
|
try {
|
|
@@ -5380,7 +5372,7 @@ function vn(r) {
|
|
|
5380
5372
|
return String(r);
|
|
5381
5373
|
}
|
|
5382
5374
|
}
|
|
5383
|
-
function
|
|
5375
|
+
function vn(r, e) {
|
|
5384
5376
|
const s = q(
|
|
5385
5377
|
"From",
|
|
5386
5378
|
`<span class="__crossx-addr-text">${Y(r.from)}</span>
|
|
@@ -5412,7 +5404,7 @@ function Sn(r, e) {
|
|
|
5412
5404
|
</div>
|
|
5413
5405
|
`, c;
|
|
5414
5406
|
}
|
|
5415
|
-
function
|
|
5407
|
+
function Sn(r, e) {
|
|
5416
5408
|
const s = document.createElement("div");
|
|
5417
5409
|
return s.id = te, s.innerHTML = `
|
|
5418
5410
|
<div class="__crossx-card __crossx-card--migration" style="${ae(e)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
@@ -5429,10 +5421,10 @@ function En(r, e) {
|
|
|
5429
5421
|
</div>
|
|
5430
5422
|
`, s;
|
|
5431
5423
|
}
|
|
5432
|
-
function
|
|
5424
|
+
function En(r, e, s) {
|
|
5433
5425
|
const t = e.status !== "reverted" && e.status !== "timeout", n = e.status === "timeout", o = r.querySelector("#__crossx-ttl"), i = r.querySelector(".__crossx-header");
|
|
5434
5426
|
if (o) {
|
|
5435
|
-
const m = n ?
|
|
5427
|
+
const m = n ? xn : t ? "" : _n, A = n ? "Transaction timeout" : t ? "Transaction complete" : "Transaction failed";
|
|
5436
5428
|
m ? (o.style.display = "flex", o.style.alignItems = "center", o.style.gap = "8px", o.innerHTML = `${m}<span>${A}</span>`) : o.textContent = A;
|
|
5437
5429
|
}
|
|
5438
5430
|
if (i && !r.querySelector("#__crossx-close-btn")) {
|
|
@@ -5460,10 +5452,10 @@ function In(r, e, s) {
|
|
|
5460
5452
|
<button class="__crossx-approve-btn" id="__crossx-done-btn">${t ? "All Done" : "Done"}</button>
|
|
5461
5453
|
`, a.querySelectorAll(".__crossx-copy-btn").forEach((m) => {
|
|
5462
5454
|
m.addEventListener("click", (A) => {
|
|
5463
|
-
var
|
|
5455
|
+
var T;
|
|
5464
5456
|
A.stopPropagation();
|
|
5465
5457
|
const y = m.dataset.copy;
|
|
5466
|
-
y && ((
|
|
5458
|
+
y && ((T = navigator.clipboard) == null || T.writeText(y).catch(() => {
|
|
5467
5459
|
}));
|
|
5468
5460
|
});
|
|
5469
5461
|
});
|
|
@@ -5500,7 +5492,7 @@ function Tn(r, e) {
|
|
|
5500
5492
|
</div>
|
|
5501
5493
|
`, o;
|
|
5502
5494
|
}
|
|
5503
|
-
function
|
|
5495
|
+
function In(r, e) {
|
|
5504
5496
|
const s = e, t = Ke();
|
|
5505
5497
|
let n = {};
|
|
5506
5498
|
if (typeof r.typedData == "string")
|
|
@@ -5516,7 +5508,7 @@ function An(r, e) {
|
|
|
5516
5508
|
<span class="__crossx-td-value">${M(o)}</span>
|
|
5517
5509
|
</div>`;
|
|
5518
5510
|
for (const [l, d] of Object.entries(i)) {
|
|
5519
|
-
const f =
|
|
5511
|
+
const f = bn(d), _ = yn(d) ? `<span class="__crossx-addr-text">${Y(d)}</span>
|
|
5520
5512
|
<button class="__crossx-copy-btn" data-copy="${M(String(d))}" title="Copy">${de}</button>` : `<span>${f}</span>`;
|
|
5521
5513
|
a += `
|
|
5522
5514
|
<div class="__crossx-td-row">
|
|
@@ -5555,11 +5547,11 @@ function An(r, e) {
|
|
|
5555
5547
|
</div>
|
|
5556
5548
|
`, c;
|
|
5557
5549
|
}
|
|
5558
|
-
const
|
|
5550
|
+
const An = `<svg width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round">
|
|
5559
5551
|
<line x1="12" y1="5" x2="12" y2="19"/>
|
|
5560
5552
|
<line x1="5" y1="12" x2="19" y2="12"/>
|
|
5561
5553
|
</svg>`;
|
|
5562
|
-
function
|
|
5554
|
+
function Rn(r, e, s) {
|
|
5563
5555
|
const t = s == null ? void 0 : s.toLowerCase(), n = r.map((i) => {
|
|
5564
5556
|
const a = t && i.address.toLowerCase() === t;
|
|
5565
5557
|
return `<button class="__crossx-wallet-item" data-wallet-index="${i.index}" data-wallet-address="${M(i.address)}">
|
|
@@ -5590,7 +5582,7 @@ function On(r, e, s) {
|
|
|
5590
5582
|
${n}
|
|
5591
5583
|
</div>
|
|
5592
5584
|
<button class="__crossx-wallet-add" id="__crossx-add-wallet-btn" type="button">
|
|
5593
|
-
<span class="__crossx-wallet-add-icon">${
|
|
5585
|
+
<span class="__crossx-wallet-add-icon">${An}</span>
|
|
5594
5586
|
<span class="__crossx-wallet-add-label">add a wallet</span>
|
|
5595
5587
|
</button>
|
|
5596
5588
|
</div>
|
|
@@ -5599,16 +5591,16 @@ function On(r, e, s) {
|
|
|
5599
5591
|
</div>
|
|
5600
5592
|
`, o;
|
|
5601
5593
|
}
|
|
5602
|
-
const
|
|
5594
|
+
const On = `<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
5603
5595
|
<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"/>
|
|
5604
5596
|
<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"/>
|
|
5605
|
-
</svg>`,
|
|
5597
|
+
</svg>`, Cn = `<svg width="40" height="40" viewBox="0 0 40 40" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
5606
5598
|
<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"/>
|
|
5607
5599
|
<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"/>
|
|
5608
5600
|
<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"/>
|
|
5609
5601
|
<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"/>
|
|
5610
5602
|
</svg>`;
|
|
5611
|
-
function
|
|
5603
|
+
function kn(r) {
|
|
5612
5604
|
const e = r, s = document.createElement("div");
|
|
5613
5605
|
return s.id = te, s.innerHTML = `
|
|
5614
5606
|
<div class="__crossx-card __crossx-card--migration" style="${ae(e)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
@@ -5623,11 +5615,11 @@ function Nn(r) {
|
|
|
5623
5615
|
<div class="__crossx-body">
|
|
5624
5616
|
<div class="__crossx-login-btn-row">
|
|
5625
5617
|
<button class="__crossx-login-btn" id="__crossx-apple-btn" type="button">
|
|
5626
|
-
<span class="__crossx-login-icon" style="color:var(--cx-value);">${
|
|
5618
|
+
<span class="__crossx-login-icon" style="color:var(--cx-value);">${On}</span>
|
|
5627
5619
|
<span class="__crossx-login-btn-label">Sign in with Apple</span>
|
|
5628
5620
|
</button>
|
|
5629
5621
|
<button class="__crossx-login-btn" id="__crossx-google-btn" type="button">
|
|
5630
|
-
<span class="__crossx-login-icon">${
|
|
5622
|
+
<span class="__crossx-login-icon">${Cn}</span>
|
|
5631
5623
|
<span class="__crossx-login-btn-label">Sign in with Google</span>
|
|
5632
5624
|
</button>
|
|
5633
5625
|
</div>
|
|
@@ -5639,7 +5631,7 @@ function Nn(r) {
|
|
|
5639
5631
|
</div>
|
|
5640
5632
|
`, s;
|
|
5641
5633
|
}
|
|
5642
|
-
function
|
|
5634
|
+
function Nn(r) {
|
|
5643
5635
|
const e = r, s = document.createElement("div");
|
|
5644
5636
|
return s.id = te, s.innerHTML = `
|
|
5645
5637
|
<div class="__crossx-card __crossx-card--migration" style="${ae(e)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
@@ -5655,7 +5647,7 @@ function Pn(r) {
|
|
|
5655
5647
|
<p class="__crossx-mig-info-desc">It safely restores and integrates all your previous assets. Simply verify your PIN to get started.</p>
|
|
5656
5648
|
</div>
|
|
5657
5649
|
<button class="__crossx-recover-btn" id="__crossx-recover-btn">
|
|
5658
|
-
<span>${
|
|
5650
|
+
<span>${gn(e.primary)}</span>
|
|
5659
5651
|
<span class="__crossx-recover-label">Recover My Wallet</span>
|
|
5660
5652
|
</button>
|
|
5661
5653
|
<button class="__crossx-skip-btn" id="__crossx-skip-btn">Skip for Now</button>
|
|
@@ -5663,7 +5655,7 @@ function Pn(r) {
|
|
|
5663
5655
|
</div>
|
|
5664
5656
|
`, s;
|
|
5665
5657
|
}
|
|
5666
|
-
function
|
|
5658
|
+
function Pn(r, e) {
|
|
5667
5659
|
const s = r, t = e ? `<p class="__crossx-pin-error-text">${e}</p>` : "", n = document.createElement("div");
|
|
5668
5660
|
return n.id = te, n.innerHTML = `
|
|
5669
5661
|
<div class="__crossx-card __crossx-card--migration" style="${ae(s)}" role="dialog" aria-modal="true" aria-labelledby="__crossx-ttl">
|
|
@@ -5685,7 +5677,7 @@ function Ln(r, e) {
|
|
|
5685
5677
|
</div>
|
|
5686
5678
|
`, n;
|
|
5687
5679
|
}
|
|
5688
|
-
function
|
|
5680
|
+
function Ln(r, e, s) {
|
|
5689
5681
|
var n;
|
|
5690
5682
|
const t = r.querySelectorAll(".__crossx-pin-input");
|
|
5691
5683
|
t.forEach((o, i) => {
|
|
@@ -5711,12 +5703,12 @@ function Dn(r, e, s) {
|
|
|
5711
5703
|
});
|
|
5712
5704
|
}), (n = t[0]) == null || n.focus();
|
|
5713
5705
|
}
|
|
5714
|
-
class
|
|
5706
|
+
class Dn {
|
|
5715
5707
|
constructor(e = "light", s) {
|
|
5716
|
-
this.theme = e, this.overrides = s, this.tokens =
|
|
5708
|
+
this.theme = e, this.overrides = s, this.tokens = jt(e, s);
|
|
5717
5709
|
}
|
|
5718
5710
|
setTheme(e, s) {
|
|
5719
|
-
this.theme = e, s !== void 0 && (this.overrides = s), this.tokens =
|
|
5711
|
+
this.theme = e, s !== void 0 && (this.overrides = s), this.tokens = jt(e, this.overrides);
|
|
5720
5712
|
}
|
|
5721
5713
|
setMessages(e) {
|
|
5722
5714
|
this.messages = e;
|
|
@@ -5733,7 +5725,7 @@ class $n {
|
|
|
5733
5725
|
return new Promise((n) => {
|
|
5734
5726
|
var A;
|
|
5735
5727
|
me();
|
|
5736
|
-
const o = [...e], i =
|
|
5728
|
+
const o = [...e], i = Rn(o, this.tokens, t), a = document.body.style.overflow;
|
|
5737
5729
|
document.body.style.overflow = "hidden", document.body.appendChild(i);
|
|
5738
5730
|
let c = !1;
|
|
5739
5731
|
const l = () => {
|
|
@@ -5746,8 +5738,8 @@ class $n {
|
|
|
5746
5738
|
(() => {
|
|
5747
5739
|
i.querySelectorAll(".__crossx-wallet-item").forEach((y) => {
|
|
5748
5740
|
y.addEventListener("click", () => {
|
|
5749
|
-
const
|
|
5750
|
-
d({ address:
|
|
5741
|
+
const T = y.dataset.walletAddress ?? "", L = parseInt(y.dataset.walletIndex ?? "0", 10);
|
|
5742
|
+
d({ address: T, index: L });
|
|
5751
5743
|
});
|
|
5752
5744
|
});
|
|
5753
5745
|
})();
|
|
@@ -5757,10 +5749,10 @@ class $n {
|
|
|
5757
5749
|
try {
|
|
5758
5750
|
const y = await s();
|
|
5759
5751
|
o.push(y);
|
|
5760
|
-
const
|
|
5761
|
-
if (
|
|
5752
|
+
const T = i.querySelector("#__crossx-wallet-list");
|
|
5753
|
+
if (T) {
|
|
5762
5754
|
const L = document.createElement("button");
|
|
5763
|
-
L.className = "__crossx-wallet-item", L.dataset.walletIndex = String(y.index), L.dataset.walletAddress = y.address, L.innerHTML = `<span class="__crossx-wallet-addr">${Y(y.address)}</span>`, L.addEventListener("click", () => d(y)),
|
|
5755
|
+
L.className = "__crossx-wallet-item", L.dataset.walletIndex = String(y.index), L.dataset.walletAddress = y.address, L.innerHTML = `<span class="__crossx-wallet-addr">${Y(y.address)}</span>`, L.addEventListener("click", () => d(y)), T.appendChild(L), L.scrollIntoView({ behavior: "smooth", block: "nearest" });
|
|
5764
5756
|
}
|
|
5765
5757
|
} catch {
|
|
5766
5758
|
} finally {
|
|
@@ -5784,7 +5776,7 @@ class $n {
|
|
|
5784
5776
|
return new Promise((e) => {
|
|
5785
5777
|
var a, c, l;
|
|
5786
5778
|
me();
|
|
5787
|
-
const s =
|
|
5779
|
+
const s = kn(this.tokens);
|
|
5788
5780
|
document.body.appendChild(s);
|
|
5789
5781
|
const t = () => s.remove(), n = (d) => {
|
|
5790
5782
|
t(), e(d);
|
|
@@ -5810,7 +5802,7 @@ class $n {
|
|
|
5810
5802
|
return new Promise((e) => {
|
|
5811
5803
|
var a, c, l;
|
|
5812
5804
|
me();
|
|
5813
|
-
const s =
|
|
5805
|
+
const s = Nn(this.tokens);
|
|
5814
5806
|
document.body.appendChild(s);
|
|
5815
5807
|
const t = () => s.remove(), n = () => {
|
|
5816
5808
|
t(), e("recover");
|
|
@@ -5835,14 +5827,14 @@ class $n {
|
|
|
5835
5827
|
return new Promise((s) => {
|
|
5836
5828
|
var a;
|
|
5837
5829
|
me();
|
|
5838
|
-
const t =
|
|
5830
|
+
const t = Pn(this.tokens, e);
|
|
5839
5831
|
document.body.appendChild(t);
|
|
5840
5832
|
const n = () => t.remove(), o = (c) => {
|
|
5841
5833
|
n(), s(c);
|
|
5842
5834
|
}, i = () => {
|
|
5843
5835
|
n(), s(null);
|
|
5844
5836
|
};
|
|
5845
|
-
|
|
5837
|
+
Ln(t, o, i), (a = t.querySelector("#__crossx-close-btn")) == null || a.addEventListener("click", i), t.addEventListener("click", (c) => {
|
|
5846
5838
|
c.target === t && i();
|
|
5847
5839
|
});
|
|
5848
5840
|
});
|
|
@@ -5855,7 +5847,7 @@ class $n {
|
|
|
5855
5847
|
return new Promise((s) => {
|
|
5856
5848
|
var a, c;
|
|
5857
5849
|
me();
|
|
5858
|
-
const t =
|
|
5850
|
+
const t = vn(e, this.tokens);
|
|
5859
5851
|
document.body.appendChild(t);
|
|
5860
5852
|
const n = () => t.remove(), o = () => {
|
|
5861
5853
|
n(), s();
|
|
@@ -5884,7 +5876,7 @@ class $n {
|
|
|
5884
5876
|
showTransactionProgress(e, s) {
|
|
5885
5877
|
return new Promise((t) => {
|
|
5886
5878
|
me();
|
|
5887
|
-
const n =
|
|
5879
|
+
const n = Sn(e, this.tokens);
|
|
5888
5880
|
document.body.appendChild(n);
|
|
5889
5881
|
const o = () => n.remove();
|
|
5890
5882
|
let i = !1;
|
|
@@ -5901,7 +5893,7 @@ class $n {
|
|
|
5901
5893
|
document.addEventListener("keydown", l);
|
|
5902
5894
|
};
|
|
5903
5895
|
s.then((l) => {
|
|
5904
|
-
i || (
|
|
5896
|
+
i || (En(n, l, this.tokens), c());
|
|
5905
5897
|
});
|
|
5906
5898
|
});
|
|
5907
5899
|
}
|
|
@@ -5910,7 +5902,7 @@ class $n {
|
|
|
5910
5902
|
var c, l, d;
|
|
5911
5903
|
me();
|
|
5912
5904
|
let t;
|
|
5913
|
-
e.type === "sign-message" ? t = Tn(e, this.tokens) : e.type === "sign-typed-data" ? t =
|
|
5905
|
+
e.type === "sign-message" ? t = Tn(e, this.tokens) : e.type === "sign-typed-data" ? t = In(e, this.tokens) : e.type === "sign" ? t = mn(e, this.tokens) : t = wn(e, this.tokens), document.body.appendChild(t);
|
|
5914
5906
|
const n = () => t.remove(), o = () => {
|
|
5915
5907
|
n(), s(!0);
|
|
5916
5908
|
}, i = () => {
|
|
@@ -5934,7 +5926,7 @@ class $n {
|
|
|
5934
5926
|
});
|
|
5935
5927
|
}
|
|
5936
5928
|
}
|
|
5937
|
-
class
|
|
5929
|
+
class $n {
|
|
5938
5930
|
constructor() {
|
|
5939
5931
|
this._accessToken = null;
|
|
5940
5932
|
}
|
|
@@ -5951,7 +5943,7 @@ class Mn {
|
|
|
5951
5943
|
return this._accessToken !== null;
|
|
5952
5944
|
}
|
|
5953
5945
|
}
|
|
5954
|
-
function
|
|
5946
|
+
function Un(r) {
|
|
5955
5947
|
r.debug;
|
|
5956
5948
|
const e = Fe.production, s = {
|
|
5957
5949
|
...r,
|
|
@@ -5961,15 +5953,15 @@ function Hn(r) {
|
|
|
5961
5953
|
}, t = {
|
|
5962
5954
|
gatewayUrl: e.walletGatewayUrl,
|
|
5963
5955
|
projectId: r.projectId
|
|
5964
|
-
}, o = s.authMode !== "cookie" &&
|
|
5956
|
+
}, o = s.authMode !== "cookie" && At.isAvailable() ? new At() : new Zs(), i = new nn(), a = new cn(), c = new gt(), l = new $n();
|
|
5965
5957
|
let d;
|
|
5966
|
-
r.useMockWallet ? (p.log("[CROSSx] Mock Wallet Provider 사용"), d = new
|
|
5958
|
+
r.useMockWallet ? (p.log("[CROSSx] Mock Wallet Provider 사용"), d = new ln(o)) : (p.log("[CROSSx] Remote Wallet Provider 사용"), d = new qe(
|
|
5967
5959
|
t,
|
|
5968
5960
|
o,
|
|
5969
5961
|
a,
|
|
5970
5962
|
l
|
|
5971
5963
|
));
|
|
5972
|
-
const f = new Ce(t, a), w = new
|
|
5964
|
+
const f = new Ce(t, a), w = new Dn(r.theme ?? "light", r.themeTokens);
|
|
5973
5965
|
return new st(
|
|
5974
5966
|
s,
|
|
5975
5967
|
t,
|
|
@@ -5985,9 +5977,9 @@ function Hn(r) {
|
|
|
5985
5977
|
}
|
|
5986
5978
|
export {
|
|
5987
5979
|
x as CROSSxError,
|
|
5988
|
-
|
|
5980
|
+
ks as CROSSxEthereumProvider,
|
|
5989
5981
|
st as CROSSxSDK,
|
|
5990
|
-
|
|
5982
|
+
Fn as ChainId,
|
|
5991
5983
|
g as ErrorCode,
|
|
5992
|
-
|
|
5984
|
+
Un as createCROSSxSDK
|
|
5993
5985
|
};
|