@alchemy/common 0.0.0-alpha.9 → 5.0.0-beta.2
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/LICENSE +1 -1
- package/README.md +36 -0
- package/dist/esm/chains.d.ts +54 -0
- package/dist/esm/index.d.ts +0 -11
- package/dist/esm/index.js +4 -9
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/internal.d.ts +6 -0
- package/dist/esm/internal.js +6 -0
- package/dist/esm/internal.js.map +1 -0
- package/dist/esm/tracing/traceHeader.d.ts +8 -4
- package/dist/esm/tracing/traceHeader.js +8 -4
- package/dist/esm/tracing/traceHeader.js.map +1 -1
- package/dist/esm/transport/chainRegistry.d.ts +2 -1
- package/dist/esm/transport/chainRegistry.js +85 -49
- package/dist/esm/transport/chainRegistry.js.map +1 -1
- package/dist/esm/utils/bigint.js +3 -2
- package/dist/esm/utils/bigint.js.map +1 -1
- package/dist/esm/version.d.ts +1 -1
- package/dist/esm/version.js +1 -1
- package/dist/esm/version.js.map +1 -1
- package/dist/types/chains.d.ts +54 -0
- package/dist/types/chains.d.ts.map +1 -1
- package/dist/types/index.d.ts +0 -11
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/internal.d.ts +7 -0
- package/dist/types/internal.d.ts.map +1 -0
- package/dist/types/tracing/traceHeader.d.ts +8 -4
- package/dist/types/tracing/traceHeader.d.ts.map +1 -1
- package/dist/types/transport/chainRegistry.d.ts +2 -1
- package/dist/types/transport/chainRegistry.d.ts.map +1 -1
- package/dist/types/utils/bigint.d.ts.map +1 -1
- package/dist/types/version.d.ts +1 -1
- package/dist/types/version.d.ts.map +1 -1
- package/package.json +11 -5
- package/src/index.ts +4 -24
- package/src/internal.ts +15 -0
- package/src/tracing/traceHeader.ts +8 -4
- package/src/transport/chainRegistry.ts +103 -52
- package/src/utils/bigint.ts +4 -2
- package/src/version.ts +1 -1
- package/dist/esm/transport/connection.d.ts +0 -20
- package/dist/esm/transport/connection.js +0 -2
- package/dist/esm/transport/connection.js.map +0 -1
- package/dist/esm/utils/createEip1193HandlerFactory.d.ts +0 -18
- package/dist/esm/utils/createEip1193HandlerFactory.js +0 -11
- package/dist/esm/utils/createEip1193HandlerFactory.js.map +0 -1
- package/dist/types/transport/connection.d.ts +0 -21
- package/dist/types/transport/connection.d.ts.map +0 -1
- package/dist/types/utils/createEip1193HandlerFactory.d.ts +0 -19
- package/dist/types/utils/createEip1193HandlerFactory.d.ts.map +0 -1
- package/src/transport/connection.ts +0 -19
- package/src/utils/createEip1193HandlerFactory.ts +0 -25
package/dist/esm/utils/bigint.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { BaseError } from "../errors/BaseError.js";
|
|
1
2
|
export var RoundingMode;
|
|
2
3
|
(function (RoundingMode) {
|
|
3
4
|
RoundingMode[RoundingMode["ROUND_DOWN"] = 0] = "ROUND_DOWN";
|
|
@@ -24,7 +25,7 @@ function isValidMultiplier(multiplier) {
|
|
|
24
25
|
*/
|
|
25
26
|
export const bigIntMultiply = (base, multiplier, roundingMode = RoundingMode.ROUND_UP) => {
|
|
26
27
|
if (!isValidMultiplier({ multiplier })) {
|
|
27
|
-
throw new
|
|
28
|
+
throw new BaseError("bigIntMultiply requires a multiplier validated number as the second argument (max 4 decimal places)");
|
|
28
29
|
}
|
|
29
30
|
// Get decimal places of b. Max decimal places is defined by the validation above.
|
|
30
31
|
const decimalPlaces = multiplier.toString().split(".")[1]?.length ?? 0;
|
|
@@ -42,7 +43,7 @@ export const bigIntMultiply = (base, multiplier, roundingMode = RoundingMode.ROU
|
|
|
42
43
|
*/
|
|
43
44
|
export const bigIntMax = (...args) => {
|
|
44
45
|
if (!args.length) {
|
|
45
|
-
throw new
|
|
46
|
+
throw new BaseError("bigIntMax requires at least one argument");
|
|
46
47
|
}
|
|
47
48
|
return args.reduce((m, c) => (m > c ? m : c));
|
|
48
49
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bigint.js","sourceRoot":"","sources":["../../../src/utils/bigint.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bigint.js","sourceRoot":"","sources":["../../../src/utils/bigint.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAcnD,MAAM,CAAN,IAAY,YAGX;AAHD,WAAY,YAAY;IACtB,2DAAc,CAAA;IACd,uDAAY,CAAA;AACd,CAAC,EAHW,YAAY,KAAZ,YAAY,QAGvB;AAED;;;;;GAKG;AACH,SAAS,iBAAiB,CAAC,UAAsB;IAC/C,MAAM,aAAa,GACjB,UAAU,CAAC,UAAU,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,IAAI,CAAC,CAAC;IAC9D,OAAO,aAAa,IAAI,CAAC,CAAC;AAC5B,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,cAAc,GAAG,CAC5B,IAAkB,EAClB,UAAoC,EACpC,eAA6B,YAAY,CAAC,QAAQ,EAClD,EAAE;IACF,IAAI,CAAC,iBAAiB,CAAC,EAAE,UAAU,EAAE,CAAC,EAAE,CAAC;QACvC,MAAM,IAAI,SAAS,CACjB,qGAAqG,CACtG,CAAC;IACJ,CAAC;IAED,kFAAkF;IAClF,MAAM,aAAa,GAAG,UAAU,CAAC,QAAQ,EAAE,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,MAAM,IAAI,CAAC,CAAC;IACvE,MAAM,MAAM,GACV,MAAM,CAAC,IAAI,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,GAAG,EAAE,IAAI,aAAa,CAAC,CAAC,CAAC;IACtE,OAAO,YAAY,KAAK,YAAY,CAAC,QAAQ;QAC3C,MAAM,GAAG,MAAM,CAAC,EAAE,IAAI,aAAa,CAAC,GAAG,CAAC;QACxC,CAAC,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,IAAI,aAAa,CAAC,GAAG,EAAE;QAC3C,CAAC,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,IAAI,aAAa,CAAC,CAAC;AAC3C,CAAC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,SAAS,GAAG,CAAC,GAAG,IAAc,EAAU,EAAE;IACrD,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;QACjB,MAAM,IAAI,SAAS,CAAC,0CAA0C,CAAC,CAAC;IAClE,CAAC;IAED,OAAO,IAAI,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;AAChD,CAAC,CAAC","sourcesContent":["import { BaseError } from \"../errors/BaseError.js\";\n\n/**\n * BigNumberish represents values that can be converted to BigInt\n */\nexport type BigNumberish = string | number | bigint;\n\n/**\n * Multiplier configuration for bigint multiplication\n */\nexport type Multiplier = {\n multiplier: number;\n};\n\nexport enum RoundingMode {\n ROUND_DOWN = 0,\n ROUND_UP = 1,\n}\n\n/**\n * Validates if a multiplier has acceptable precision (max 4 decimal places)\n *\n * @param {Multiplier} multiplier - the multiplier to validate\n * @returns {boolean} true if valid, false otherwise\n */\nfunction isValidMultiplier(multiplier: Multiplier): boolean {\n const decimalPlaces =\n multiplier.multiplier.toString().split(\".\")[1]?.length ?? 0;\n return decimalPlaces <= 4;\n}\n\n/**\n * Given a bigint and a number (which can be a float), returns the bigint value.\n * Note: this function has loss and will round down to the nearest integer.\n *\n * @param {BigNumberish} base - the number to be multiplied\n * @param {number} multiplier - the amount to multiply by\n * @param {RoundingMode} roundingMode - the rounding mode to use when calculating the percent. defaults to ROUND_UP\n * @returns {bigint} the bigint value of the multiplication with the number rounded by the rounding mode\n */\nexport const bigIntMultiply = (\n base: BigNumberish,\n multiplier: Multiplier[\"multiplier\"],\n roundingMode: RoundingMode = RoundingMode.ROUND_UP,\n) => {\n if (!isValidMultiplier({ multiplier })) {\n throw new BaseError(\n \"bigIntMultiply requires a multiplier validated number as the second argument (max 4 decimal places)\",\n );\n }\n\n // Get decimal places of b. Max decimal places is defined by the validation above.\n const decimalPlaces = multiplier.toString().split(\".\")[1]?.length ?? 0;\n const result =\n BigInt(base) * BigInt(Math.round(multiplier * 10 ** decimalPlaces));\n return roundingMode === RoundingMode.ROUND_UP &&\n result % BigInt(10 ** decimalPlaces) > 0\n ? result / BigInt(10 ** decimalPlaces) + 1n\n : result / BigInt(10 ** decimalPlaces);\n};\n\n/**\n * Returns the max bigint in a list of bigints\n *\n * @param {bigint[]} args a list of bigints to get the max of\n * @returns {bigint} the max bigint in the list\n */\nexport const bigIntMax = (...args: bigint[]): bigint => {\n if (!args.length) {\n throw new BaseError(\"bigIntMax requires at least one argument\");\n }\n\n return args.reduce((m, c) => (m > c ? m : c));\n};\n"]}
|
package/dist/esm/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "
|
|
1
|
+
export declare const VERSION = "5.0.0-beta.1";
|
package/dist/esm/version.js
CHANGED
package/dist/esm/version.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,yBAAyB;AACzB,MAAM,CAAC,MAAM,OAAO,GAAG,
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,yBAAyB;AACzB,MAAM,CAAC,MAAM,OAAO,GAAG,cAAc,CAAC","sourcesContent":["// This file is autogenerated by inject-version.ts. Any changes will be\n// overwritten on commit!\nexport const VERSION = \"5.0.0-beta.1\";\n"]}
|
package/dist/types/chains.d.ts
CHANGED
|
@@ -38,9 +38,18 @@ export declare const fraxtalSepolia: {
|
|
|
38
38
|
sourceId?: number | undefined | undefined;
|
|
39
39
|
testnet: true;
|
|
40
40
|
custom?: Record<string, unknown> | undefined;
|
|
41
|
+
extendSchema?: Record<string, unknown> | undefined;
|
|
41
42
|
fees?: import("viem").ChainFees<undefined> | undefined;
|
|
42
43
|
formatters?: undefined;
|
|
44
|
+
prepareTransactionRequest?: ((args: import("viem").PrepareTransactionRequestParameters, options: {
|
|
45
|
+
phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
|
|
46
|
+
}) => Promise<import("viem").PrepareTransactionRequestParameters>) | [fn: ((args: import("viem").PrepareTransactionRequestParameters, options: {
|
|
47
|
+
phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
|
|
48
|
+
}) => Promise<import("viem").PrepareTransactionRequestParameters>) | undefined, options: {
|
|
49
|
+
runAt: readonly ("beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters")[];
|
|
50
|
+
}] | undefined;
|
|
43
51
|
serializers?: import("viem").ChainSerializers<undefined, import("viem").TransactionSerializable> | undefined;
|
|
52
|
+
verifyHash?: ((client: import("viem").Client, parameters: import("viem").VerifyHashActionParameters) => Promise<import("viem").VerifyHashActionReturnType>) | undefined;
|
|
44
53
|
};
|
|
45
54
|
export declare const openlootSepolia: {
|
|
46
55
|
blockExplorers: {
|
|
@@ -76,9 +85,18 @@ export declare const openlootSepolia: {
|
|
|
76
85
|
sourceId?: number | undefined | undefined;
|
|
77
86
|
testnet: true;
|
|
78
87
|
custom?: Record<string, unknown> | undefined;
|
|
88
|
+
extendSchema?: Record<string, unknown> | undefined;
|
|
79
89
|
fees?: import("viem").ChainFees<undefined> | undefined;
|
|
80
90
|
formatters?: undefined;
|
|
91
|
+
prepareTransactionRequest?: ((args: import("viem").PrepareTransactionRequestParameters, options: {
|
|
92
|
+
phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
|
|
93
|
+
}) => Promise<import("viem").PrepareTransactionRequestParameters>) | [fn: ((args: import("viem").PrepareTransactionRequestParameters, options: {
|
|
94
|
+
phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
|
|
95
|
+
}) => Promise<import("viem").PrepareTransactionRequestParameters>) | undefined, options: {
|
|
96
|
+
runAt: readonly ("beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters")[];
|
|
97
|
+
}] | undefined;
|
|
81
98
|
serializers?: import("viem").ChainSerializers<undefined, import("viem").TransactionSerializable> | undefined;
|
|
99
|
+
verifyHash?: ((client: import("viem").Client, parameters: import("viem").VerifyHashActionParameters) => Promise<import("viem").VerifyHashActionReturnType>) | undefined;
|
|
82
100
|
};
|
|
83
101
|
export declare const gensynTestnet: {
|
|
84
102
|
blockExplorers: {
|
|
@@ -114,9 +132,18 @@ export declare const gensynTestnet: {
|
|
|
114
132
|
sourceId?: number | undefined | undefined;
|
|
115
133
|
testnet: true;
|
|
116
134
|
custom?: Record<string, unknown> | undefined;
|
|
135
|
+
extendSchema?: Record<string, unknown> | undefined;
|
|
117
136
|
fees?: import("viem").ChainFees<undefined> | undefined;
|
|
118
137
|
formatters?: undefined;
|
|
138
|
+
prepareTransactionRequest?: ((args: import("viem").PrepareTransactionRequestParameters, options: {
|
|
139
|
+
phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
|
|
140
|
+
}) => Promise<import("viem").PrepareTransactionRequestParameters>) | [fn: ((args: import("viem").PrepareTransactionRequestParameters, options: {
|
|
141
|
+
phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
|
|
142
|
+
}) => Promise<import("viem").PrepareTransactionRequestParameters>) | undefined, options: {
|
|
143
|
+
runAt: readonly ("beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters")[];
|
|
144
|
+
}] | undefined;
|
|
119
145
|
serializers?: import("viem").ChainSerializers<undefined, import("viem").TransactionSerializable> | undefined;
|
|
146
|
+
verifyHash?: ((client: import("viem").Client, parameters: import("viem").VerifyHashActionParameters) => Promise<import("viem").VerifyHashActionReturnType>) | undefined;
|
|
120
147
|
};
|
|
121
148
|
export declare const riseTestnet: {
|
|
122
149
|
blockExplorers: {
|
|
@@ -152,9 +179,18 @@ export declare const riseTestnet: {
|
|
|
152
179
|
sourceId?: number | undefined | undefined;
|
|
153
180
|
testnet: true;
|
|
154
181
|
custom?: Record<string, unknown> | undefined;
|
|
182
|
+
extendSchema?: Record<string, unknown> | undefined;
|
|
155
183
|
fees?: import("viem").ChainFees<undefined> | undefined;
|
|
156
184
|
formatters?: undefined;
|
|
185
|
+
prepareTransactionRequest?: ((args: import("viem").PrepareTransactionRequestParameters, options: {
|
|
186
|
+
phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
|
|
187
|
+
}) => Promise<import("viem").PrepareTransactionRequestParameters>) | [fn: ((args: import("viem").PrepareTransactionRequestParameters, options: {
|
|
188
|
+
phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
|
|
189
|
+
}) => Promise<import("viem").PrepareTransactionRequestParameters>) | undefined, options: {
|
|
190
|
+
runAt: readonly ("beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters")[];
|
|
191
|
+
}] | undefined;
|
|
157
192
|
serializers?: import("viem").ChainSerializers<undefined, import("viem").TransactionSerializable> | undefined;
|
|
193
|
+
verifyHash?: ((client: import("viem").Client, parameters: import("viem").VerifyHashActionParameters) => Promise<import("viem").VerifyHashActionReturnType>) | undefined;
|
|
158
194
|
};
|
|
159
195
|
export declare const storyMainnet: {
|
|
160
196
|
blockExplorers: {
|
|
@@ -190,9 +226,18 @@ export declare const storyMainnet: {
|
|
|
190
226
|
sourceId?: number | undefined | undefined;
|
|
191
227
|
testnet?: boolean | undefined | undefined;
|
|
192
228
|
custom?: Record<string, unknown> | undefined;
|
|
229
|
+
extendSchema?: Record<string, unknown> | undefined;
|
|
193
230
|
fees?: import("viem").ChainFees<undefined> | undefined;
|
|
194
231
|
formatters?: undefined;
|
|
232
|
+
prepareTransactionRequest?: ((args: import("viem").PrepareTransactionRequestParameters, options: {
|
|
233
|
+
phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
|
|
234
|
+
}) => Promise<import("viem").PrepareTransactionRequestParameters>) | [fn: ((args: import("viem").PrepareTransactionRequestParameters, options: {
|
|
235
|
+
phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
|
|
236
|
+
}) => Promise<import("viem").PrepareTransactionRequestParameters>) | undefined, options: {
|
|
237
|
+
runAt: readonly ("beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters")[];
|
|
238
|
+
}] | undefined;
|
|
195
239
|
serializers?: import("viem").ChainSerializers<undefined, import("viem").TransactionSerializable> | undefined;
|
|
240
|
+
verifyHash?: ((client: import("viem").Client, parameters: import("viem").VerifyHashActionParameters) => Promise<import("viem").VerifyHashActionReturnType>) | undefined;
|
|
196
241
|
};
|
|
197
242
|
export declare const teaSepolia: {
|
|
198
243
|
blockExplorers: {
|
|
@@ -228,8 +273,17 @@ export declare const teaSepolia: {
|
|
|
228
273
|
sourceId?: number | undefined | undefined;
|
|
229
274
|
testnet: true;
|
|
230
275
|
custom?: Record<string, unknown> | undefined;
|
|
276
|
+
extendSchema?: Record<string, unknown> | undefined;
|
|
231
277
|
fees?: import("viem").ChainFees<undefined> | undefined;
|
|
232
278
|
formatters?: undefined;
|
|
279
|
+
prepareTransactionRequest?: ((args: import("viem").PrepareTransactionRequestParameters, options: {
|
|
280
|
+
phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
|
|
281
|
+
}) => Promise<import("viem").PrepareTransactionRequestParameters>) | [fn: ((args: import("viem").PrepareTransactionRequestParameters, options: {
|
|
282
|
+
phase: "beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters";
|
|
283
|
+
}) => Promise<import("viem").PrepareTransactionRequestParameters>) | undefined, options: {
|
|
284
|
+
runAt: readonly ("beforeFillTransaction" | "beforeFillParameters" | "afterFillParameters")[];
|
|
285
|
+
}] | undefined;
|
|
233
286
|
serializers?: import("viem").ChainSerializers<undefined, import("viem").TransactionSerializable> | undefined;
|
|
287
|
+
verifyHash?: ((client: import("viem").Client, parameters: import("viem").VerifyHashActionParameters) => Promise<import("viem").VerifyHashActionReturnType>) | undefined;
|
|
234
288
|
};
|
|
235
289
|
//# sourceMappingURL=chains.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chains.d.ts","sourceRoot":"","sources":["../../src/chains.ts"],"names":[],"mappings":"AAkBA,eAAO,MAAM,cAAc
|
|
1
|
+
{"version":3,"file":"chains.d.ts","sourceRoot":"","sources":["../../src/chains.ts"],"names":[],"mappings":"AAkBA,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAUzB,CAAC;AAEH,eAAO,MAAM,eAAe;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgB1B,CAAC;AAEH,eAAO,MAAM,aAAa;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgBxB,CAAC;AAEH,eAAO,MAAM,WAAW;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgBtB,CAAC;AAEH,eAAO,MAAM,YAAY;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAevB,CAAC;AAEH,eAAO,MAAM,UAAU;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgBrB,CAAC"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
export type * from "./rest/restClient.js";
|
|
2
|
-
export type * from "./rest/types.js";
|
|
3
|
-
export { AlchemyRestClient } from "./rest/restClient.js";
|
|
4
1
|
export type * from "./transport/alchemy.js";
|
|
5
2
|
export { alchemyTransport, isAlchemyTransport } from "./transport/alchemy.js";
|
|
6
3
|
export { getAlchemyRpcUrl, isChainSupported, getSupportedChainIds, } from "./transport/chainRegistry.js";
|
|
@@ -9,7 +6,6 @@ export { assertNever } from "./utils/assertNever.js";
|
|
|
9
6
|
export { raise } from "./utils/raise.js";
|
|
10
7
|
export { bigIntMultiply, bigIntMax } from "./utils/bigint.js";
|
|
11
8
|
export { lowerAddress } from "./utils/lowerAddress.js";
|
|
12
|
-
export { createEip1193HandlerFactory } from "./utils/createEip1193HandlerFactory.js";
|
|
13
9
|
export type { AlchemyConnectionConfig } from "./transport/connectionSchema.js";
|
|
14
10
|
export { AlchemyConnectionConfigSchema, validateAlchemyConnectionConfig, isAlchemyConnectionConfig, } from "./transport/connectionSchema.js";
|
|
15
11
|
export { BaseError } from "./errors/BaseError.js";
|
|
@@ -20,11 +16,4 @@ export { FetchError } from "./errors/FetchError.js";
|
|
|
20
16
|
export { ServerError } from "./errors/ServerError.js";
|
|
21
17
|
export { InvalidRequestError } from "./errors/InvalidRequestError.js";
|
|
22
18
|
export { MethodUnsupportedError } from "./errors/MethodUnsupportedError.js";
|
|
23
|
-
export type * from "./actions/addBreadCrumb.js";
|
|
24
|
-
export { addBreadCrumb } from "./actions/addBreadCrumb.js";
|
|
25
|
-
export * from "./chains.js";
|
|
26
|
-
export { createLogger } from "./logging/logger.js";
|
|
27
|
-
export { setGlobalLoggerConfig, getGlobalLoggerConfig, LogLevel, isLevelEnabled, isNamespaceEnabled, } from "./logging/config.js";
|
|
28
|
-
export type { DiagnosticsLogger } from "./logging/logger.js";
|
|
29
|
-
export { InMemorySink } from "./logging/sinks.js";
|
|
30
19
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAMA,mBAAmB,wBAAwB,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,kBAAkB,EAAE,MAAM,wBAAwB,CAAC;AAG9E,OAAO,EACL,gBAAgB,EAChB,gBAAgB,EAChB,oBAAoB,GACrB,MAAM,8BAA8B,CAAC;AAGtC,mBAAmB,kBAAkB,CAAC;AACtC,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAC;AACrD,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAC9D,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAGvD,YAAY,EAAE,uBAAuB,EAAE,MAAM,iCAAiC,CAAC;AAC/E,OAAO,EACL,6BAA6B,EAC7B,+BAA+B,EAC/B,yBAAyB,GAC1B,MAAM,iCAAiC,CAAC;AAGzC,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAClD,OAAO,EAAE,kBAAkB,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,EAAE,oBAAoB,EAAE,MAAM,kCAAkC,CAAC;AACxE,OAAO,EAAE,qBAAqB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,EAAE,UAAU,EAAE,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,yBAAyB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,iCAAiC,CAAC;AACtE,OAAO,EAAE,sBAAsB,EAAE,MAAM,oCAAoC,CAAC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export type * from "./actions/addBreadCrumb.js";
|
|
2
|
+
export { addBreadCrumb } from "./actions/addBreadCrumb.js";
|
|
3
|
+
export { createLogger } from "./logging/logger.js";
|
|
4
|
+
export { setGlobalLoggerConfig, getGlobalLoggerConfig, LogLevel, isLevelEnabled, isNamespaceEnabled, } from "./logging/config.js";
|
|
5
|
+
export type { DiagnosticsLogger } from "./logging/logger.js";
|
|
6
|
+
export { InMemorySink } from "./logging/sinks.js";
|
|
7
|
+
//# sourceMappingURL=internal.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../../src/internal.ts"],"names":[],"mappings":"AACA,mBAAmB,4BAA4B,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAG3D,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EACL,qBAAqB,EACrB,qBAAqB,EACrB,QAAQ,EACR,cAAc,EACd,kBAAkB,GACnB,MAAM,qBAAqB,CAAC;AAC7B,YAAY,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AAC7D,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC"}
|
|
@@ -33,7 +33,8 @@ export declare class TraceHeader {
|
|
|
33
33
|
/**
|
|
34
34
|
* Creating a default trace id that is a random setup for both trace id and parent id
|
|
35
35
|
*
|
|
36
|
-
* @example
|
|
36
|
+
* @example
|
|
37
|
+
* ```ts
|
|
37
38
|
* const traceHeader = TraceHeader.fromTraceHeader(headers) || TraceHeader.default();
|
|
38
39
|
* ```
|
|
39
40
|
*
|
|
@@ -43,7 +44,8 @@ export declare class TraceHeader {
|
|
|
43
44
|
/**
|
|
44
45
|
* Should be able to consume a trace header from the headers of an http request
|
|
45
46
|
*
|
|
46
|
-
* @example
|
|
47
|
+
* @example
|
|
48
|
+
* ```ts
|
|
47
49
|
* const traceHeader = TraceHeader.fromTraceHeader(headers);
|
|
48
50
|
* ```
|
|
49
51
|
*
|
|
@@ -54,7 +56,8 @@ export declare class TraceHeader {
|
|
|
54
56
|
/**
|
|
55
57
|
* Should be able to convert the trace header to the format that is used in the headers of an http request
|
|
56
58
|
*
|
|
57
|
-
* @example
|
|
59
|
+
* @example
|
|
60
|
+
* ```ts
|
|
58
61
|
* const traceHeader = TraceHeader.fromTraceHeader(headers) || TraceHeader.default();
|
|
59
62
|
* const headers = traceHeader.toTraceHeader();
|
|
60
63
|
* ```
|
|
@@ -70,7 +73,8 @@ export declare class TraceHeader {
|
|
|
70
73
|
* as the key of the eventName as breadcrumbs appending onto previous breadcrumbs with the - infix if exists. And the
|
|
71
74
|
* trace parent gets updated as according to the docs
|
|
72
75
|
*
|
|
73
|
-
* @example
|
|
76
|
+
* @example
|
|
77
|
+
* ```ts
|
|
74
78
|
* const traceHeader = TraceHeader.fromTraceHeader(headers) || TraceHeader.default();
|
|
75
79
|
* const newTraceHeader = traceHeader.withEvent("newEvent");
|
|
76
80
|
* ```
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"traceHeader.d.ts","sourceRoot":"","sources":["../../../src/tracing/traceHeader.ts"],"names":[],"mappings":"AASA;;;;GAIG;AAEH,eAAO,MAAM,iBAAiB,gBAAgB,CAAC;AAC/C;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,eAAe,CAAC;AAG/C;;;;;GAKG;AACH,qBAAa,WAAW;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAE5C;;;;;;;OAOG;gBAED,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,WAAW,CAAC,YAAY,CAAC;IAQvC
|
|
1
|
+
{"version":3,"file":"traceHeader.d.ts","sourceRoot":"","sources":["../../../src/tracing/traceHeader.ts"],"names":[],"mappings":"AASA;;;;GAIG;AAEH,eAAO,MAAM,iBAAiB,gBAAgB,CAAC;AAC/C;;;;GAIG;AACH,eAAO,MAAM,kBAAkB,eAAe,CAAC;AAG/C;;;;;GAKG;AACH,qBAAa,WAAW;IACtB,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,QAAQ,EAAE,MAAM,CAAC;IAC1B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAE5C;;;;;;;OAOG;gBAED,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,EAClB,UAAU,EAAE,WAAW,CAAC,YAAY,CAAC;IAQvC;;;;;;;;;OASG;IACH,MAAM,CAAC,OAAO;IAQd;;;;;;;;;;OAUG;IACH,MAAM,CAAC,eAAe,CACpB,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAC9B,WAAW,GAAG,SAAS;IA2B1B;;;;;;;;;;OAUG;IACH,aAAa;;;;IASb;;;;;;;;;;;;;OAaG;IACH,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,WAAW;CAS1C"}
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Internal registry mapping chain IDs to Alchemy RPC base URLs.
|
|
3
3
|
* This replaces the need for custom chain exports with embedded Alchemy URLs.
|
|
4
|
+
*
|
|
5
|
+
* Auto-generated by the ws-tools CLI — do not manually edit.
|
|
4
6
|
*/
|
|
5
7
|
export declare const ALCHEMY_RPC_MAPPING: Record<number, string>;
|
|
6
8
|
/**
|
|
@@ -12,7 +14,6 @@ export declare const ALCHEMY_RPC_MAPPING: Record<number, string>;
|
|
|
12
14
|
* @example
|
|
13
15
|
* ```ts
|
|
14
16
|
* const rpcUrl = getAlchemyRpcUrl(1); // "https://eth-mainnet.g.alchemy.com/v2"
|
|
15
|
-
* const customUrl = getAlchemyRpcUrl(999); // undefined
|
|
16
17
|
* ```
|
|
17
18
|
*/
|
|
18
19
|
export declare function getAlchemyRpcUrl(chainId: number): string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chainRegistry.d.ts","sourceRoot":"","sources":["../../../src/transport/chainRegistry.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"chainRegistry.d.ts","sourceRoot":"","sources":["../../../src/transport/chainRegistry.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CA6HtD,CAAC;AAEF;;;;;;;;;;GAUG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAEpE;AAED;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAEzD;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,IAAI,MAAM,EAAE,CAE/C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bigint.d.ts","sourceRoot":"","sources":["../../../src/utils/bigint.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bigint.d.ts","sourceRoot":"","sources":["../../../src/utils/bigint.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;AAEpD;;GAEG;AACH,MAAM,MAAM,UAAU,GAAG;IACvB,UAAU,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,oBAAY,YAAY;IACtB,UAAU,IAAI;IACd,QAAQ,IAAI;CACb;AAcD;;;;;;;;GAQG;AACH,eAAO,MAAM,cAAc,GACzB,MAAM,YAAY,EAClB,YAAY,UAAU,CAAC,YAAY,CAAC,EACpC,eAAc,YAAoC,WAgBnD,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,SAAS,GAAI,GAAG,MAAM,MAAM,EAAE,KAAG,MAM7C,CAAC"}
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "
|
|
1
|
+
export declare const VERSION = "5.0.0-beta.1";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO,
|
|
1
|
+
{"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO,iBAAiB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@alchemy/common",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "5.0.0-beta.2",
|
|
4
4
|
"description": "A collection of interfaces and utilities to be used by other Alchemy packages",
|
|
5
5
|
"author": "Alchemy",
|
|
6
6
|
"license": "MIT",
|
|
@@ -32,6 +32,11 @@
|
|
|
32
32
|
"import": "./dist/esm/chains.js",
|
|
33
33
|
"default": "./dist/esm/chains.js"
|
|
34
34
|
},
|
|
35
|
+
"./internal": {
|
|
36
|
+
"types": "./dist/types/internal.d.ts",
|
|
37
|
+
"import": "./dist/esm/internal.js",
|
|
38
|
+
"default": "./dist/esm/internal.js"
|
|
39
|
+
},
|
|
35
40
|
"./package.json": "./package.json"
|
|
36
41
|
},
|
|
37
42
|
"scripts": {
|
|
@@ -44,10 +49,11 @@
|
|
|
44
49
|
"test:run": "vitest run"
|
|
45
50
|
},
|
|
46
51
|
"devDependencies": {
|
|
47
|
-
"typescript-template": "*"
|
|
52
|
+
"typescript-template": "*",
|
|
53
|
+
"viem": "^2.45.0"
|
|
48
54
|
},
|
|
49
|
-
"
|
|
50
|
-
"viem": "^2.
|
|
55
|
+
"peerDependencies": {
|
|
56
|
+
"viem": "^2.45.0"
|
|
51
57
|
},
|
|
52
58
|
"publishConfig": {
|
|
53
59
|
"access": "public",
|
|
@@ -61,5 +67,5 @@
|
|
|
61
67
|
"url": "https://github.com/alchemyplatform/aa-sdk/issues"
|
|
62
68
|
},
|
|
63
69
|
"homepage": "https://github.com/alchemyplatform/aa-sdk#readme",
|
|
64
|
-
"gitHead": "
|
|
70
|
+
"gitHead": "9042002b7414ac2ae8a6251ee4cf96555b091eca"
|
|
65
71
|
}
|
package/src/index.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
// http
|
|
2
|
-
export type * from "./rest/restClient.js";
|
|
3
|
-
export type * from "./rest/types.js";
|
|
4
|
-
export { AlchemyRestClient } from "./rest/restClient.js";
|
|
1
|
+
// http -- TODO(v5): not currently exported
|
|
2
|
+
// export type * from "./rest/restClient.js";
|
|
3
|
+
// export type * from "./rest/types.js";
|
|
4
|
+
// export { AlchemyRestClient } from "./rest/restClient.js";
|
|
5
5
|
|
|
6
6
|
// transport
|
|
7
7
|
export type * from "./transport/alchemy.js";
|
|
@@ -20,7 +20,6 @@ export { assertNever } from "./utils/assertNever.js";
|
|
|
20
20
|
export { raise } from "./utils/raise.js";
|
|
21
21
|
export { bigIntMultiply, bigIntMax } from "./utils/bigint.js";
|
|
22
22
|
export { lowerAddress } from "./utils/lowerAddress.js";
|
|
23
|
-
export { createEip1193HandlerFactory } from "./utils/createEip1193HandlerFactory.js";
|
|
24
23
|
|
|
25
24
|
// config
|
|
26
25
|
export type { AlchemyConnectionConfig } from "./transport/connectionSchema.js";
|
|
@@ -39,22 +38,3 @@ export { FetchError } from "./errors/FetchError.js";
|
|
|
39
38
|
export { ServerError } from "./errors/ServerError.js";
|
|
40
39
|
export { InvalidRequestError } from "./errors/InvalidRequestError.js";
|
|
41
40
|
export { MethodUnsupportedError } from "./errors/MethodUnsupportedError.js";
|
|
42
|
-
|
|
43
|
-
// actions
|
|
44
|
-
export type * from "./actions/addBreadCrumb.js";
|
|
45
|
-
export { addBreadCrumb } from "./actions/addBreadCrumb.js";
|
|
46
|
-
|
|
47
|
-
// chains (convenience exports for Alchemy-supported chains)
|
|
48
|
-
export * from "./chains.js";
|
|
49
|
-
|
|
50
|
-
// diagnostics logging
|
|
51
|
-
export { createLogger } from "./logging/logger.js";
|
|
52
|
-
export {
|
|
53
|
-
setGlobalLoggerConfig,
|
|
54
|
-
getGlobalLoggerConfig,
|
|
55
|
-
LogLevel,
|
|
56
|
-
isLevelEnabled,
|
|
57
|
-
isNamespaceEnabled,
|
|
58
|
-
} from "./logging/config.js";
|
|
59
|
-
export type { DiagnosticsLogger } from "./logging/logger.js";
|
|
60
|
-
export { InMemorySink } from "./logging/sinks.js";
|
package/src/internal.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// actions
|
|
2
|
+
export type * from "./actions/addBreadCrumb.js";
|
|
3
|
+
export { addBreadCrumb } from "./actions/addBreadCrumb.js";
|
|
4
|
+
|
|
5
|
+
// diagnostics logging
|
|
6
|
+
export { createLogger } from "./logging/logger.js";
|
|
7
|
+
export {
|
|
8
|
+
setGlobalLoggerConfig,
|
|
9
|
+
getGlobalLoggerConfig,
|
|
10
|
+
LogLevel,
|
|
11
|
+
isLevelEnabled,
|
|
12
|
+
isNamespaceEnabled,
|
|
13
|
+
} from "./logging/config.js";
|
|
14
|
+
export type { DiagnosticsLogger } from "./logging/logger.js";
|
|
15
|
+
export { InMemorySink } from "./logging/sinks.js";
|
|
@@ -57,7 +57,8 @@ export class TraceHeader {
|
|
|
57
57
|
/**
|
|
58
58
|
* Creating a default trace id that is a random setup for both trace id and parent id
|
|
59
59
|
*
|
|
60
|
-
* @example
|
|
60
|
+
* @example
|
|
61
|
+
* ```ts
|
|
61
62
|
* const traceHeader = TraceHeader.fromTraceHeader(headers) || TraceHeader.default();
|
|
62
63
|
* ```
|
|
63
64
|
*
|
|
@@ -74,7 +75,8 @@ export class TraceHeader {
|
|
|
74
75
|
/**
|
|
75
76
|
* Should be able to consume a trace header from the headers of an http request
|
|
76
77
|
*
|
|
77
|
-
* @example
|
|
78
|
+
* @example
|
|
79
|
+
* ```ts
|
|
78
80
|
* const traceHeader = TraceHeader.fromTraceHeader(headers);
|
|
79
81
|
* ```
|
|
80
82
|
*
|
|
@@ -113,7 +115,8 @@ export class TraceHeader {
|
|
|
113
115
|
/**
|
|
114
116
|
* Should be able to convert the trace header to the format that is used in the headers of an http request
|
|
115
117
|
*
|
|
116
|
-
* @example
|
|
118
|
+
* @example
|
|
119
|
+
* ```ts
|
|
117
120
|
* const traceHeader = TraceHeader.fromTraceHeader(headers) || TraceHeader.default();
|
|
118
121
|
* const headers = traceHeader.toTraceHeader();
|
|
119
122
|
* ```
|
|
@@ -134,7 +137,8 @@ export class TraceHeader {
|
|
|
134
137
|
* as the key of the eventName as breadcrumbs appending onto previous breadcrumbs with the - infix if exists. And the
|
|
135
138
|
* trace parent gets updated as according to the docs
|
|
136
139
|
*
|
|
137
|
-
* @example
|
|
140
|
+
* @example
|
|
141
|
+
* ```ts
|
|
138
142
|
* const traceHeader = TraceHeader.fromTraceHeader(headers) || TraceHeader.default();
|
|
139
143
|
* const newTraceHeader = traceHeader.withEvent("newEvent");
|
|
140
144
|
* ```
|