@coinbase/cdp-core 0.0.23 → 0.0.25
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/README.md +12 -12
- package/dist/esm/index.js +17 -15
- package/dist/esm/index10.js +20 -14
- package/dist/esm/index100.js +6 -9
- package/dist/esm/index101.js +11 -13
- package/dist/esm/index102.js +11 -8
- package/dist/esm/index103.js +7 -14
- package/dist/esm/index104.js +16 -80
- package/dist/esm/index105.js +72 -70
- package/dist/esm/index106.js +81 -0
- package/dist/esm/index11.js +13 -117
- package/dist/esm/index12.js +116 -11
- package/dist/esm/index13.js +14 -22
- package/dist/esm/index14.js +42 -20
- package/dist/esm/index15.js +20 -172
- package/dist/esm/index16.js +170 -24
- package/dist/esm/index17.js +22 -156
- package/dist/esm/index18.js +157 -45
- package/dist/esm/index19.js +44 -149
- package/dist/esm/index2.js +10 -10
- package/dist/esm/index20.js +247 -53
- package/dist/esm/index21.js +56 -41
- package/dist/esm/index22.js +40 -16
- package/dist/esm/index23.js +16 -4
- package/dist/esm/index24.js +5 -5
- package/dist/esm/index25.js +5 -9
- package/dist/esm/index26.js +8 -17
- package/dist/esm/index27.js +16 -44
- package/dist/esm/index28.js +45 -13
- package/dist/esm/index29.js +13 -55
- package/dist/esm/index3.js +66 -60
- package/dist/esm/index30.js +55 -6
- package/dist/esm/index31.js +6 -21
- package/dist/esm/index32.js +21 -11
- package/dist/esm/index33.js +11 -3
- package/dist/esm/index34.js +3 -3
- package/dist/esm/index35.js +3 -34
- package/dist/esm/index36.js +32 -10
- package/dist/esm/index37.js +12 -4
- package/dist/esm/index38.js +4 -28
- package/dist/esm/index39.js +28 -6
- package/dist/esm/index4.js +48 -35
- package/dist/esm/index40.js +6 -24
- package/dist/esm/index41.js +24 -16
- package/dist/esm/index42.js +16 -54
- package/dist/esm/index43.js +53 -22
- package/dist/esm/index44.js +23 -11
- package/dist/esm/index45.js +10 -26
- package/dist/esm/index46.js +26 -41
- package/dist/esm/index47.js +41 -54
- package/dist/esm/index48.js +54 -126
- package/dist/esm/index49.js +126 -11
- package/dist/esm/index5.js +1 -1
- package/dist/esm/index50.js +9 -101
- package/dist/esm/index51.js +104 -6
- package/dist/esm/index52.js +7 -3
- package/dist/esm/index53.js +3 -15
- package/dist/esm/index54.js +14 -42
- package/dist/esm/index55.js +38 -74
- package/dist/esm/index56.js +79 -2
- package/dist/esm/index57.js +2 -2
- package/dist/esm/index58.js +2 -13
- package/dist/esm/index59.js +8 -33
- package/dist/esm/index6.js +13 -183
- package/dist/esm/index60.js +36 -5
- package/dist/esm/index61.js +5 -33
- package/dist/esm/index62.js +34 -8
- package/dist/esm/index63.js +8 -10
- package/dist/esm/index64.js +10 -11
- package/dist/esm/index65.js +11 -13
- package/dist/esm/index66.js +13 -18
- package/dist/esm/index67.js +18 -5
- package/dist/esm/index68.js +6 -5
- package/dist/esm/index69.js +5 -11
- package/dist/esm/index7.js +192 -15
- package/dist/esm/index70.js +10 -16
- package/dist/esm/index71.js +15 -21
- package/dist/esm/index72.js +21 -49
- package/dist/esm/index73.js +51 -2
- package/dist/esm/index74.js +1 -1
- package/dist/esm/index75.js +2 -20
- package/dist/esm/index76.js +20 -80
- package/dist/esm/index77.js +79 -103
- package/dist/esm/index78.js +101 -30
- package/dist/esm/index79.js +32 -6
- package/dist/esm/index8.js +14 -15
- package/dist/esm/index80.js +6 -78
- package/dist/esm/index81.js +79 -10
- package/dist/esm/index82.js +10 -55
- package/dist/esm/index83.js +54 -10
- package/dist/esm/index84.js +11 -2
- package/dist/esm/index85.js +2 -45
- package/dist/esm/index86.js +44 -13
- package/dist/esm/index87.js +14 -5
- package/dist/esm/index88.js +5 -13
- package/dist/esm/index89.js +12 -35
- package/dist/esm/index9.js +15 -20
- package/dist/esm/index90.js +35 -41
- package/dist/esm/index91.js +40 -19
- package/dist/esm/index92.js +21 -10
- package/dist/esm/index93.js +9 -19
- package/dist/esm/index94.js +15 -89
- package/dist/esm/index95.js +92 -19
- package/dist/esm/index96.js +18 -115
- package/dist/esm/index97.js +118 -18
- package/dist/esm/index98.js +18 -28
- package/dist/esm/index99.js +26 -6
- package/dist/types/index.d.ts +36 -1
- package/package.json +2 -2
package/dist/esm/index6.js
CHANGED
|
@@ -1,194 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
import { SignJWT as o } from "./index21.js";
|
|
3
|
-
import "viem";
|
|
4
|
-
import { toAuthState as u } from "./index7.js";
|
|
5
|
-
import { createKeyPair as S } from "./index22.js";
|
|
6
|
-
import { generateRandomId as i } from "./index23.js";
|
|
7
|
-
import { hash as w } from "./index24.js";
|
|
8
|
-
import { sortKeys as f } from "./index13.js";
|
|
9
|
-
const n = 60 * 1e3;
|
|
10
|
-
class C {
|
|
11
|
-
projectId;
|
|
12
|
-
authState = null;
|
|
13
|
-
walletSecret = null;
|
|
14
|
-
authStateChangeCallbacks = [];
|
|
15
|
-
initPromise = null;
|
|
1
|
+
class i extends Error {
|
|
16
2
|
/**
|
|
17
|
-
*
|
|
18
|
-
*
|
|
19
|
-
* @param projectId - The project ID.
|
|
20
|
-
*/
|
|
21
|
-
constructor(t) {
|
|
22
|
-
this.projectId = t, this.initPromise = this._doInitialize();
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Gets the current user, or null if there is no user signed in.
|
|
26
|
-
*
|
|
27
|
-
* @returns The current user.
|
|
28
|
-
*/
|
|
29
|
-
async getUser() {
|
|
30
|
-
return this.authState?.user ?? null;
|
|
31
|
-
}
|
|
32
|
-
/**
|
|
33
|
-
* Returns whether the user is signed in - i.e., whether there is an unexpired
|
|
34
|
-
* access token and user.
|
|
35
|
-
*
|
|
36
|
-
* @returns True if the user is signed in, false otherwise.
|
|
37
|
-
*/
|
|
38
|
-
async isSignedIn() {
|
|
39
|
-
return this.authState ? Promise.resolve(this.authState.expiresAt > Date.now()) : Promise.resolve(!1);
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* Signs out the user, clearing all authentication state.
|
|
43
|
-
*/
|
|
44
|
-
async signOut() {
|
|
45
|
-
try {
|
|
46
|
-
await h(this.projectId);
|
|
47
|
-
} catch {
|
|
48
|
-
} finally {
|
|
49
|
-
await this.clearAuthState();
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
/**
|
|
53
|
-
* Adds a callback to be called when the auth state changes.
|
|
54
|
-
*
|
|
55
|
-
* @param callback - The function to call when the auth state changes.
|
|
56
|
-
*/
|
|
57
|
-
addAuthStateChangeCallback(t) {
|
|
58
|
-
this.authStateChangeCallbacks.push(t), t(this.authState?.user ?? null);
|
|
59
|
-
}
|
|
60
|
-
/**
|
|
61
|
-
* Gets the access token, refreshing it if it is expired. Returns null if the user is not
|
|
62
|
-
* signed in.
|
|
63
|
-
*
|
|
64
|
-
* @returns The access token.
|
|
65
|
-
*/
|
|
66
|
-
async getToken() {
|
|
67
|
-
return this.shouldRefreshToken() && await this.refreshAccessToken(), this.authState?.accessToken ?? null;
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Gets the currently registered wallet secret ID. Rejects if the user is not signed in.
|
|
71
|
-
*
|
|
72
|
-
* @returns The wallet secret ID.
|
|
73
|
-
*/
|
|
74
|
-
async getWalletSecretId() {
|
|
75
|
-
if (!await this.isSignedIn())
|
|
76
|
-
throw new Error("Cannot get wallet secret ID if the user is not signed in");
|
|
77
|
-
return this.shouldRefreshWalletSecret() && await this.refreshWalletSecret(), this.walletSecret.walletSecretId;
|
|
78
|
-
}
|
|
79
|
-
/**
|
|
80
|
-
* Gets the X-Wallet-Auth header. Rejects if the user is not signed in.
|
|
81
|
-
*
|
|
82
|
-
* @param options - The options for the request.
|
|
83
|
-
* @param options.requestMethod - The HTTP method of the request.
|
|
84
|
-
* @param options.requestHost - The host of the request.
|
|
85
|
-
* @param options.requestPath - The path of the request.
|
|
86
|
-
* @param options.requestData - The data of the request.
|
|
87
|
-
* @returns The X-Wallet-Auth header.
|
|
88
|
-
*/
|
|
89
|
-
async getXWalletAuth(t) {
|
|
90
|
-
if (!await this.isSignedIn())
|
|
91
|
-
throw new Error("Cannot get X-Wallet-Auth header if the user is not signed in");
|
|
92
|
-
this.shouldRefreshWalletSecret() && await this.refreshWalletSecret();
|
|
93
|
-
const e = `${t.requestMethod} ${t.requestHost}${t.requestPath}`, a = Math.floor(Date.now() / 1e3), r = {
|
|
94
|
-
uris: [e]
|
|
95
|
-
};
|
|
96
|
-
if (t.requestData && Object.keys(t.requestData).length > 0) {
|
|
97
|
-
const s = f(t.requestData);
|
|
98
|
-
r.reqHash = await w(new TextEncoder().encode(JSON.stringify(s)));
|
|
99
|
-
}
|
|
100
|
-
return await new o(r).setProtectedHeader({ alg: "ES256", typ: "JWT" }).setIssuedAt(a).setNotBefore(a).setJti(await i()).sign(this.walletSecret.keyPair.privateKey);
|
|
101
|
-
}
|
|
102
|
-
/**
|
|
103
|
-
* Sets the authentication state.
|
|
104
|
-
*
|
|
105
|
-
* @param authState - The authentication state.
|
|
106
|
-
*/
|
|
107
|
-
async setAuthState(t) {
|
|
108
|
-
this.authState = t, this.authStateChangeCallbacks.forEach((e) => e(this.authState?.user ?? null));
|
|
109
|
-
}
|
|
110
|
-
/**
|
|
111
|
-
* Clears the authentication state.
|
|
112
|
-
*/
|
|
113
|
-
async clearAuthState() {
|
|
114
|
-
this.authState = null, this.walletSecret = null, this.authStateChangeCallbacks.forEach((t) => t(null));
|
|
115
|
-
}
|
|
116
|
-
/**
|
|
117
|
-
* Ensures the AuthManager is initialized before proceeding.
|
|
118
|
-
* If initialization is already in progress, waits for it to complete.
|
|
119
|
-
*/
|
|
120
|
-
async ensureInitialized() {
|
|
121
|
-
if (this.initPromise) {
|
|
122
|
-
await this.initPromise;
|
|
123
|
-
return;
|
|
124
|
-
}
|
|
125
|
-
throw new Error("AuthManager not initialized");
|
|
126
|
-
}
|
|
127
|
-
/**
|
|
128
|
-
* Internal async initialization logic.
|
|
3
|
+
* The name of the missing module.
|
|
129
4
|
*/
|
|
130
|
-
|
|
131
|
-
try {
|
|
132
|
-
await this.refreshAccessToken();
|
|
133
|
-
} catch (t) {
|
|
134
|
-
console.warn("Failed to refresh access token during initialization:", t);
|
|
135
|
-
}
|
|
136
|
-
}
|
|
5
|
+
moduleName;
|
|
137
6
|
/**
|
|
138
|
-
*
|
|
139
|
-
*
|
|
140
|
-
* @returns True if the token should be refreshed, false otherwise.
|
|
7
|
+
* The API or feature that requires the missing module.
|
|
141
8
|
*/
|
|
142
|
-
|
|
143
|
-
return !(this.authState && this.authState.expiresAt > Date.now() + n);
|
|
144
|
-
}
|
|
145
|
-
/**
|
|
146
|
-
* Refreshes the access token and transitions the auth state accordingly.
|
|
147
|
-
* If a refresh is already in progress, it will wait for that refresh to complete.
|
|
148
|
-
*
|
|
149
|
-
* @returns The new access token.
|
|
150
|
-
*/
|
|
151
|
-
async refreshAccessToken() {
|
|
152
|
-
try {
|
|
153
|
-
const t = await l(this.projectId, {
|
|
154
|
-
grantType: "refresh_token"
|
|
155
|
-
}), e = u(
|
|
156
|
-
t.accessToken,
|
|
157
|
-
t.validUntil,
|
|
158
|
-
t.endUser
|
|
159
|
-
);
|
|
160
|
-
await this.setAuthState(e);
|
|
161
|
-
} catch {
|
|
162
|
-
await this.signOut();
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
/**
|
|
166
|
-
* Returns whether the wallet secret should be refreshed.
|
|
167
|
-
*
|
|
168
|
-
* @returns True if the wallet secret should be refreshed, false otherwise.
|
|
169
|
-
*/
|
|
170
|
-
shouldRefreshWalletSecret() {
|
|
171
|
-
return !(this.walletSecret && this.walletSecret.expiresAt > Date.now() + n);
|
|
172
|
-
}
|
|
9
|
+
requiredFor;
|
|
173
10
|
/**
|
|
174
|
-
*
|
|
11
|
+
* Creates a new ModuleResolutionError.
|
|
175
12
|
*
|
|
176
|
-
* @
|
|
13
|
+
* @param moduleName - The name of the missing module.
|
|
14
|
+
* @param requiredFor - The API or feature that requires the module.
|
|
15
|
+
* @param message - Optional custom error message.
|
|
177
16
|
*/
|
|
178
|
-
|
|
179
|
-
const
|
|
180
|
-
this.
|
|
181
|
-
try {
|
|
182
|
-
await c(this.projectId, this.authState.user.userId, {
|
|
183
|
-
walletSecretId: t,
|
|
184
|
-
publicKey: e.publicKeyBase64,
|
|
185
|
-
validUntil: r
|
|
186
|
-
});
|
|
187
|
-
} catch (s) {
|
|
188
|
-
throw this.walletSecret = null, s;
|
|
189
|
-
}
|
|
17
|
+
constructor(e, s, r) {
|
|
18
|
+
const o = `${s} is not available in this React Native environment. Please ensure ${e} is installed.`;
|
|
19
|
+
super(r || o), this.name = "ModuleResolutionError", this.moduleName = e, this.requiredFor = s;
|
|
190
20
|
}
|
|
191
21
|
}
|
|
192
22
|
export {
|
|
193
|
-
|
|
23
|
+
i as ModuleResolutionError
|
|
194
24
|
};
|
package/dist/esm/index60.js
CHANGED
|
@@ -1,9 +1,40 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { versionedHashVersionKzg as a } from "./index57.js";
|
|
2
|
+
import { BaseError as s } from "./index48.js";
|
|
3
|
+
class t extends s {
|
|
4
|
+
constructor({ maxSize: e, size: r }) {
|
|
5
|
+
super("Blob size is too large.", {
|
|
6
|
+
metaMessages: [`Max: ${e} bytes`, `Given: ${r} bytes`],
|
|
7
|
+
name: "BlobSizeTooLargeError"
|
|
8
|
+
});
|
|
9
|
+
}
|
|
10
|
+
}
|
|
11
|
+
class d extends s {
|
|
12
|
+
constructor() {
|
|
13
|
+
super("Blob data must not be empty.", { name: "EmptyBlobError" });
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
class l extends s {
|
|
17
|
+
constructor({ hash: e, size: r }) {
|
|
18
|
+
super(`Versioned hash "${e}" size is invalid.`, {
|
|
19
|
+
metaMessages: ["Expected: 32", `Received: ${r}`],
|
|
20
|
+
name: "InvalidVersionedHashSizeError"
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
class c extends s {
|
|
25
|
+
constructor({ hash: e, version: r }) {
|
|
26
|
+
super(`Versioned hash "${e}" version is invalid.`, {
|
|
27
|
+
metaMessages: [
|
|
28
|
+
`Expected: ${a}`,
|
|
29
|
+
`Received: ${r}`
|
|
30
|
+
],
|
|
31
|
+
name: "InvalidVersionedHashVersionError"
|
|
32
|
+
});
|
|
5
33
|
}
|
|
6
34
|
}
|
|
7
35
|
export {
|
|
8
|
-
|
|
36
|
+
t as BlobSizeTooLargeError,
|
|
37
|
+
d as EmptyBlobError,
|
|
38
|
+
l as InvalidVersionedHashSizeError,
|
|
39
|
+
c as InvalidVersionedHashVersionError
|
|
9
40
|
};
|
package/dist/esm/index61.js
CHANGED
|
@@ -1,37 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
super(`The fee cap (\`maxFeePerGas\`${e ? ` = ${a(e)} gwei` : ""}) cannot be higher than the maximum allowed value (2^256-1).`, {
|
|
6
|
-
cause: r,
|
|
7
|
-
name: "FeeCapTooHighError"
|
|
8
|
-
});
|
|
1
|
+
import { BaseError as i } from "./index48.js";
|
|
2
|
+
class o extends i {
|
|
3
|
+
constructor({ chainId: r }) {
|
|
4
|
+
super(typeof r == "number" ? `Chain ID "${r}" is invalid.` : "Chain ID is invalid.", { name: "InvalidChainIdError" });
|
|
9
5
|
}
|
|
10
6
|
}
|
|
11
|
-
Object.defineProperty(n, "nodeMessage", {
|
|
12
|
-
enumerable: !0,
|
|
13
|
-
configurable: !0,
|
|
14
|
-
writable: !0,
|
|
15
|
-
value: /max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/
|
|
16
|
-
});
|
|
17
|
-
class h extends o {
|
|
18
|
-
constructor({ cause: r, maxPriorityFeePerGas: e, maxFeePerGas: t } = {}) {
|
|
19
|
-
super([
|
|
20
|
-
`The provided tip (\`maxPriorityFeePerGas\`${e ? ` = ${a(e)} gwei` : ""}) cannot be higher than the fee cap (\`maxFeePerGas\`${t ? ` = ${a(t)} gwei` : ""}).`
|
|
21
|
-
].join(`
|
|
22
|
-
`), {
|
|
23
|
-
cause: r,
|
|
24
|
-
name: "TipAboveFeeCapError"
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
Object.defineProperty(h, "nodeMessage", {
|
|
29
|
-
enumerable: !0,
|
|
30
|
-
configurable: !0,
|
|
31
|
-
writable: !0,
|
|
32
|
-
value: /max priority fee per gas higher than max fee per gas|tip higher than fee cap/
|
|
33
|
-
});
|
|
34
7
|
export {
|
|
35
|
-
|
|
36
|
-
h as TipAboveFeeCapError
|
|
8
|
+
o as InvalidChainIdError
|
|
37
9
|
};
|
package/dist/esm/index62.js
CHANGED
|
@@ -1,11 +1,37 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { formatGwei as a } from "./index68.js";
|
|
2
|
+
import { BaseError as o } from "./index48.js";
|
|
3
|
+
class n extends o {
|
|
4
|
+
constructor({ cause: r, maxFeePerGas: e } = {}) {
|
|
5
|
+
super(`The fee cap (\`maxFeePerGas\`${e ? ` = ${a(e)} gwei` : ""}) cannot be higher than the maximum allowed value (2^256-1).`, {
|
|
6
|
+
cause: r,
|
|
7
|
+
name: "FeeCapTooHighError"
|
|
8
|
+
});
|
|
9
|
+
}
|
|
8
10
|
}
|
|
11
|
+
Object.defineProperty(n, "nodeMessage", {
|
|
12
|
+
enumerable: !0,
|
|
13
|
+
configurable: !0,
|
|
14
|
+
writable: !0,
|
|
15
|
+
value: /max fee per gas higher than 2\^256-1|fee cap higher than 2\^256-1/
|
|
16
|
+
});
|
|
17
|
+
class h extends o {
|
|
18
|
+
constructor({ cause: r, maxPriorityFeePerGas: e, maxFeePerGas: t } = {}) {
|
|
19
|
+
super([
|
|
20
|
+
`The provided tip (\`maxPriorityFeePerGas\`${e ? ` = ${a(e)} gwei` : ""}) cannot be higher than the fee cap (\`maxFeePerGas\`${t ? ` = ${a(t)} gwei` : ""}).`
|
|
21
|
+
].join(`
|
|
22
|
+
`), {
|
|
23
|
+
cause: r,
|
|
24
|
+
name: "TipAboveFeeCapError"
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
Object.defineProperty(h, "nodeMessage", {
|
|
29
|
+
enumerable: !0,
|
|
30
|
+
configurable: !0,
|
|
31
|
+
writable: !0,
|
|
32
|
+
value: /max priority fee per gas higher than max fee per gas|tip higher than fee cap/
|
|
33
|
+
});
|
|
9
34
|
export {
|
|
10
|
-
|
|
35
|
+
n as FeeCapTooHighError,
|
|
36
|
+
h as TipAboveFeeCapError
|
|
11
37
|
};
|
package/dist/esm/index63.js
CHANGED
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import { hexToBytes as
|
|
2
|
-
import { bytesToHex as
|
|
3
|
-
function
|
|
4
|
-
const { kzg:
|
|
5
|
-
for (
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
return c === "bytes" ? n : n.map((o) => y(o));
|
|
1
|
+
import { hexToBytes as i } from "./index30.js";
|
|
2
|
+
import { bytesToHex as f } from "./index28.js";
|
|
3
|
+
function y(o) {
|
|
4
|
+
const { kzg: s } = o, n = o.to ?? (typeof o.blobs[0] == "string" ? "hex" : "bytes"), m = typeof o.blobs[0] == "string" ? o.blobs.map((t) => i(t)) : o.blobs, b = [];
|
|
5
|
+
for (const t of m)
|
|
6
|
+
b.push(Uint8Array.from(s.blobToKzgCommitment(t)));
|
|
7
|
+
return n === "bytes" ? b : b.map((t) => f(t));
|
|
10
8
|
}
|
|
11
9
|
export {
|
|
12
|
-
|
|
10
|
+
y as blobsToCommitments
|
|
13
11
|
};
|
package/dist/esm/index64.js
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
return s;
|
|
1
|
+
import { hexToBytes as b } from "./index30.js";
|
|
2
|
+
import { bytesToHex as y } from "./index28.js";
|
|
3
|
+
function h(t) {
|
|
4
|
+
const { kzg: m } = t, c = t.to ?? (typeof t.blobs[0] == "string" ? "hex" : "bytes"), s = typeof t.blobs[0] == "string" ? t.blobs.map((o) => b(o)) : t.blobs, i = typeof t.commitments[0] == "string" ? t.commitments.map((o) => b(o)) : t.commitments, n = [];
|
|
5
|
+
for (let o = 0; o < s.length; o++) {
|
|
6
|
+
const f = s[o], l = i[o];
|
|
7
|
+
n.push(Uint8Array.from(m.computeBlobKzgProof(f, l)));
|
|
8
|
+
}
|
|
9
|
+
return c === "bytes" ? n : n.map((o) => y(o));
|
|
11
10
|
}
|
|
12
11
|
export {
|
|
13
|
-
|
|
12
|
+
h as blobsToProofs
|
|
14
13
|
};
|
package/dist/esm/index65.js
CHANGED
|
@@ -1,16 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
});
|
|
12
|
-
return c;
|
|
1
|
+
import { commitmentToVersionedHash as i } from "./index80.js";
|
|
2
|
+
function r(o) {
|
|
3
|
+
const { commitments: t, version: n } = o, e = o.to ?? (typeof t[0] == "string" ? "hex" : "bytes"), s = [];
|
|
4
|
+
for (const m of t)
|
|
5
|
+
s.push(i({
|
|
6
|
+
commitment: m,
|
|
7
|
+
to: e,
|
|
8
|
+
version: n
|
|
9
|
+
}));
|
|
10
|
+
return s;
|
|
13
11
|
}
|
|
14
12
|
export {
|
|
15
|
-
|
|
13
|
+
r as commitmentsToVersionedHashes
|
|
16
14
|
};
|
package/dist/esm/index66.js
CHANGED
|
@@ -1,21 +1,16 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
function
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
if (!f(i, { strict: !1 }))
|
|
14
|
-
throw new s({ address: i });
|
|
15
|
-
n.push([i, e]);
|
|
16
|
-
}
|
|
17
|
-
return n;
|
|
1
|
+
import { blobsToCommitments as f } from "./index63.js";
|
|
2
|
+
import { blobsToProofs as l } from "./index64.js";
|
|
3
|
+
import { toBlobs as p } from "./index79.js";
|
|
4
|
+
function k(t) {
|
|
5
|
+
const { data: i, kzg: n, to: m } = t, s = t.blobs ?? p({ data: i, to: m }), b = t.commitments ?? f({ blobs: s, kzg: n, to: m }), r = t.proofs ?? l({ blobs: s, commitments: b, kzg: n, to: m }), c = [];
|
|
6
|
+
for (let o = 0; o < s.length; o++)
|
|
7
|
+
c.push({
|
|
8
|
+
blob: s[o],
|
|
9
|
+
commitment: b[o],
|
|
10
|
+
proof: r[o]
|
|
11
|
+
});
|
|
12
|
+
return c;
|
|
18
13
|
}
|
|
19
14
|
export {
|
|
20
|
-
|
|
15
|
+
k as toBlobSidecars
|
|
21
16
|
};
|
package/dist/esm/index67.js
CHANGED
|
@@ -1,8 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
import { InvalidAddressError as s } from "./index59.js";
|
|
2
|
+
import { InvalidStorageKeySizeError as l } from "./index55.js";
|
|
3
|
+
import { isAddress as f } from "./index33.js";
|
|
4
|
+
function a(r) {
|
|
5
|
+
if (!r || r.length === 0)
|
|
6
|
+
return [];
|
|
7
|
+
const n = [];
|
|
8
|
+
for (let o = 0; o < r.length; o++) {
|
|
9
|
+
const { address: i, storageKeys: e } = r[o];
|
|
10
|
+
for (let t = 0; t < e.length; t++)
|
|
11
|
+
if (e[t].length - 2 !== 64)
|
|
12
|
+
throw new l({ storageKey: e[t] });
|
|
13
|
+
if (!f(i, { strict: !1 }))
|
|
14
|
+
throw new s({ address: i });
|
|
15
|
+
n.push([i, e]);
|
|
16
|
+
}
|
|
17
|
+
return n;
|
|
5
18
|
}
|
|
6
19
|
export {
|
|
7
|
-
|
|
20
|
+
a as serializeAccessList
|
|
8
21
|
};
|
package/dist/esm/index68.js
CHANGED
package/dist/esm/index69.js
CHANGED
|
@@ -1,13 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
let [l, e] = [
|
|
6
|
-
t.slice(0, t.length - n),
|
|
7
|
-
t.slice(t.length - n)
|
|
8
|
-
];
|
|
9
|
-
return e = e.replace(/(0+)$/, ""), `${i ? "-" : ""}${l || "0"}${e ? `.${e}` : ""}`;
|
|
10
|
-
}
|
|
1
|
+
const e = {
|
|
2
|
+
ether: -9,
|
|
3
|
+
wei: 9
|
|
4
|
+
};
|
|
11
5
|
export {
|
|
12
|
-
|
|
6
|
+
e as gweiUnits
|
|
13
7
|
};
|