@account-kit/infra 4.0.1 → 4.1.1
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/esm/middleware/feeEstimator.js +2 -2
- package/dist/esm/middleware/feeEstimator.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/version.d.ts +1 -1
- package/package.json +4 -4
- package/src/middleware/feeEstimator.ts +2 -2
- package/src/version.ts +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { applyUserOpOverrideOrFeeOption } from "@aa-sdk/core";
|
|
1
|
+
import { applyUserOpOverrideOrFeeOption, bigIntMultiply } from "@aa-sdk/core";
|
|
2
2
|
/**
|
|
3
3
|
* Function that estimates the transaction fees using Alchemy methods for a given client.
|
|
4
4
|
* It fetches the latest block and estimates the max priority fee per gas, applying any overrides or fee options provided.
|
|
@@ -37,7 +37,7 @@ export const alchemyFeeEstimator = (transport) => async (struct, { overrides, fe
|
|
|
37
37
|
throw new Error("baseFeePerGas is null");
|
|
38
38
|
}
|
|
39
39
|
const maxPriorityFeePerGas = applyUserOpOverrideOrFeeOption(maxPriorityFeePerGasEstimate, overrides?.maxPriorityFeePerGas, feeOptions?.maxPriorityFeePerGas);
|
|
40
|
-
const maxFeePerGas = applyUserOpOverrideOrFeeOption(baseFeePerGas + BigInt(maxPriorityFeePerGas), overrides?.maxFeePerGas, feeOptions?.maxFeePerGas);
|
|
40
|
+
const maxFeePerGas = applyUserOpOverrideOrFeeOption(bigIntMultiply(baseFeePerGas, 1.5) + BigInt(maxPriorityFeePerGas), overrides?.maxFeePerGas, feeOptions?.maxFeePerGas);
|
|
41
41
|
return {
|
|
42
42
|
...struct,
|
|
43
43
|
maxPriorityFeePerGas,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"feeEstimator.js","sourceRoot":"","sources":["../../../src/middleware/feeEstimator.ts"],"names":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oBAAoB;QACpB,YAAY;KACb,CAAC;AACJ,CAAC,CAAC","sourcesContent":["import type { ClientMiddlewareFn } from \"@aa-sdk/core\";\nimport { applyUserOpOverrideOrFeeOption, bigIntMultiply } from \"@aa-sdk/core\";\nimport type { AlchemyTransport } from \"../alchemyTransport\";\n\n/**\n * Function that estimates the transaction fees using Alchemy methods for a given client.\n * It fetches the latest block and estimates the max priority fee per gas, applying any overrides or fee options provided.\n *\n * @example\n * ```ts\n * import { alchemyFeeEstimator, alchemy } from \"@account-kit/infra\";\n * import { createSmartAccountClient } from \"@aa-sdk/core\";\n *\n * const alchemyTransport = alchemy({\n * chain: sepolia,\n * apiKey: \"your-api-key\"\n * });\n *\n * const client = createSmartAccountClient({\n * feeEstimator: alchemyFeeEstimator(alchemyTransport),\n * ...otherParams\n * });\n * ```\n *\n * @param {AlchemyTransport} transport An alchemy transport for making Alchemy specific RPC calls\n * @returns {ClientMiddlewareFn} A middleware function that takes a transaction structure and fee options, and returns the augmented structure with estimated fees\n */\nexport const alchemyFeeEstimator: (\n transport: AlchemyTransport\n) => ClientMiddlewareFn =\n (transport) =>\n async (struct, { overrides, feeOptions, client }) => {\n const transport_ = transport({ chain: client.chain });\n let [block, maxPriorityFeePerGasEstimate] = await Promise.all([\n client.getBlock({ blockTag: \"latest\" }),\n // it is a fair assumption that if someone is using this Alchemy Middleware, then they are using Alchemy RPC\n transport_.request({\n method: \"rundler_maxPriorityFeePerGas\",\n params: [],\n }),\n ]);\n\n const baseFeePerGas = block.baseFeePerGas;\n if (baseFeePerGas == null) {\n throw new Error(\"baseFeePerGas is null\");\n }\n\n const maxPriorityFeePerGas = applyUserOpOverrideOrFeeOption(\n maxPriorityFeePerGasEstimate,\n overrides?.maxPriorityFeePerGas,\n feeOptions?.maxPriorityFeePerGas\n );\n const maxFeePerGas = applyUserOpOverrideOrFeeOption(\n bigIntMultiply(baseFeePerGas, 1.5) + BigInt(maxPriorityFeePerGas),\n overrides?.maxFeePerGas,\n feeOptions?.maxFeePerGas\n );\n\n return {\n ...struct,\n maxPriorityFeePerGas,\n maxFeePerGas,\n };\n };\n"]}
|
package/dist/esm/version.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "4.
|
|
1
|
+
export declare const VERSION = "4.1.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,OAAO,CAAC","sourcesContent":["// This file is autogenerated by inject-version.ts. Any changes will be\n// overwritten on commit!\nexport const VERSION = \"4.
|
|
1
|
+
{"version":3,"file":"version.js","sourceRoot":"","sources":["../../src/version.ts"],"names":[],"mappings":"AAAA,uEAAuE;AACvE,yBAAyB;AACzB,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC","sourcesContent":["// This file is autogenerated by inject-version.ts. Any changes will be\n// overwritten on commit!\nexport const VERSION = \"4.1.1\";\n"]}
|
package/dist/types/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "4.
|
|
1
|
+
export declare const VERSION = "4.1.1";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@account-kit/infra",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.1.1",
|
|
4
4
|
"description": "adapters for @aa-sdk/core for interacting with alchemy services",
|
|
5
5
|
"author": "Alchemy",
|
|
6
6
|
"license": "MIT",
|
|
@@ -44,8 +44,8 @@
|
|
|
44
44
|
"vitest": "^2.0.4"
|
|
45
45
|
},
|
|
46
46
|
"dependencies": {
|
|
47
|
-
"@aa-sdk/core": "^4.
|
|
48
|
-
"@account-kit/logging": "^4.
|
|
47
|
+
"@aa-sdk/core": "^4.1.1",
|
|
48
|
+
"@account-kit/logging": "^4.1.1",
|
|
49
49
|
"eventemitter3": "^5.0.1",
|
|
50
50
|
"zod": "^3.22.4"
|
|
51
51
|
},
|
|
@@ -64,7 +64,7 @@
|
|
|
64
64
|
"url": "https://github.com/alchemyplatform/aa-sdk/issues"
|
|
65
65
|
},
|
|
66
66
|
"homepage": "https://github.com/alchemyplatform/aa-sdk#readme",
|
|
67
|
-
"gitHead": "
|
|
67
|
+
"gitHead": "36eb306e10b5d476a993316bafdbff17755ff8f3",
|
|
68
68
|
"optionalDependencies": {
|
|
69
69
|
"alchemy-sdk": "^3.0.0"
|
|
70
70
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ClientMiddlewareFn } from "@aa-sdk/core";
|
|
2
|
-
import { applyUserOpOverrideOrFeeOption } from "@aa-sdk/core";
|
|
2
|
+
import { applyUserOpOverrideOrFeeOption, bigIntMultiply } from "@aa-sdk/core";
|
|
3
3
|
import type { AlchemyTransport } from "../alchemyTransport";
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -51,7 +51,7 @@ export const alchemyFeeEstimator: (
|
|
|
51
51
|
feeOptions?.maxPriorityFeePerGas
|
|
52
52
|
);
|
|
53
53
|
const maxFeePerGas = applyUserOpOverrideOrFeeOption(
|
|
54
|
-
baseFeePerGas + BigInt(maxPriorityFeePerGas),
|
|
54
|
+
bigIntMultiply(baseFeePerGas, 1.5) + BigInt(maxPriorityFeePerGas),
|
|
55
55
|
overrides?.maxFeePerGas,
|
|
56
56
|
feeOptions?.maxFeePerGas
|
|
57
57
|
);
|
package/src/version.ts
CHANGED