@dynamic-labs-sdk/zerodev 0.10.0 → 0.12.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/core.cjs.js +1 -1
- package/dist/core.esm.js +1 -1
- package/dist/exports/index.d.ts +2 -0
- package/dist/exports/index.d.ts.map +1 -1
- package/dist/{getZerodevRpc-ClxQynlm.cjs.js → getZerodevRpc-BCqSQiOZ.cjs.js} +2 -2
- package/dist/{getZerodevRpc-ClxQynlm.cjs.js.map → getZerodevRpc-BCqSQiOZ.cjs.js.map} +1 -1
- package/dist/{getZerodevRpc-7hzrCA8q.esm.js → getZerodevRpc-D-aUai4X.esm.js} +2 -2
- package/dist/{getZerodevRpc-7hzrCA8q.esm.js.map → getZerodevRpc-D-aUai4X.esm.js.map} +1 -1
- package/dist/index.cjs.js +177 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +179 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/simulateZerodevUserOperation/index.d.ts +2 -0
- package/dist/simulateZerodevUserOperation/index.d.ts.map +1 -0
- package/dist/simulateZerodevUserOperation/simulateZerodevUserOperation.d.ts +35 -0
- package/dist/simulateZerodevUserOperation/simulateZerodevUserOperation.d.ts.map +1 -0
- package/dist/tsconfig.lib.tsbuildinfo +1 -1
- package/dist/utils/calculateFeeForUserOperation/calculateFeeForUserOperation.d.ts +24 -0
- package/dist/utils/calculateFeeForUserOperation/calculateFeeForUserOperation.d.ts.map +1 -0
- package/dist/utils/calculateFeeForUserOperation/index.d.ts +2 -0
- package/dist/utils/calculateFeeForUserOperation/index.d.ts.map +1 -0
- package/dist/utils/hasRequiredGasFields/hasRequiredGasFields.d.ts +28 -0
- package/dist/utils/hasRequiredGasFields/hasRequiredGasFields.d.ts.map +1 -0
- package/dist/utils/hasRequiredGasFields/index.d.ts +2 -0
- package/dist/utils/hasRequiredGasFields/index.d.ts.map +1 -0
- package/package.json +5 -5
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { NetworkData } from '@dynamic-labs-sdk/client';
|
|
2
|
+
import type { EvmTransactionFeeData } from '@dynamic-labs-sdk/evm';
|
|
3
|
+
import type { UserOperation } from 'viem/account-abstraction';
|
|
4
|
+
type CalculateFeeForUserOperationParams = {
|
|
5
|
+
nativeTokenPriceUsd?: number;
|
|
6
|
+
networkData: NetworkData;
|
|
7
|
+
userOperationData: Pick<UserOperation, 'callGasLimit' | 'verificationGasLimit' | 'preVerificationGas' | 'maxFeePerGas'>;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Calculates the estimated fee for a ZeroDev user operation.
|
|
11
|
+
*
|
|
12
|
+
* This function estimates the total gas cost for a user operation by summing
|
|
13
|
+
* all gas components (call, verification, pre-verification) and multiplying
|
|
14
|
+
* by the maximum fee per gas unit.
|
|
15
|
+
*
|
|
16
|
+
* @param params.userOperationData - The user operation data containing gas limits and fees.
|
|
17
|
+
* @param params.networkData - Network configuration (not currently used but kept for consistency).
|
|
18
|
+
* @param params.nativeTokenPriceUsd - Optional USD price of the native token for fee conversion.
|
|
19
|
+
* @returns Fee data including gas estimates and human-readable amounts.
|
|
20
|
+
* @throws {FeeEstimationFailedError} If fee calculation fails.
|
|
21
|
+
*/
|
|
22
|
+
export declare const calculateFeeForUserOperation: ({ userOperationData, networkData: _networkData, nativeTokenPriceUsd, }: CalculateFeeForUserOperationParams) => EvmTransactionFeeData;
|
|
23
|
+
export {};
|
|
24
|
+
//# sourceMappingURL=calculateFeeForUserOperation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"calculateFeeForUserOperation.d.ts","sourceRoot":"","sources":["../../../src/utils/calculateFeeForUserOperation/calculateFeeForUserOperation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAE5D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAEnE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAI9D,KAAK,kCAAkC,GAAG;IACxC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,WAAW,EAAE,WAAW,CAAC;IACzB,iBAAiB,EAAE,IAAI,CACrB,aAAa,EACX,cAAc,GACd,sBAAsB,GACtB,oBAAoB,GACpB,cAAc,CACjB,CAAC;CACH,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,eAAO,MAAM,4BAA4B,2EAItC,kCAAkC,KAAG,qBAgCvC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/calculateFeeForUserOperation/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import type { UserOperation } from 'viem/account-abstraction';
|
|
2
|
+
type UserOperationWithGasFields = Pick<UserOperation, 'callGasLimit' | 'verificationGasLimit' | 'preVerificationGas' | 'maxFeePerGas'>;
|
|
3
|
+
/**
|
|
4
|
+
* Type guard to check if a partial user operation has all required gas fields.
|
|
5
|
+
*
|
|
6
|
+
* This function narrows the type of a Partial<UserOperation> to ensure it has
|
|
7
|
+
* the required gas fields needed for fee calculation. Use this when you need to
|
|
8
|
+
* validate that gas fields are present before performing fee calculations.
|
|
9
|
+
*
|
|
10
|
+
* @param userOperation - The partial user operation to check.
|
|
11
|
+
* @returns True if all required gas fields are present, false otherwise.
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```typescript
|
|
15
|
+
* if (hasRequiredGasFields(userOperation)) {
|
|
16
|
+
* // TypeScript now knows these fields are defined
|
|
17
|
+
* const fee = calculateFee({
|
|
18
|
+
* callGasLimit: userOperation.callGasLimit,
|
|
19
|
+
* maxFeePerGas: userOperation.maxFeePerGas,
|
|
20
|
+
* preVerificationGas: userOperation.preVerificationGas,
|
|
21
|
+
* verificationGasLimit: userOperation.verificationGasLimit,
|
|
22
|
+
* });
|
|
23
|
+
* }
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare const hasRequiredGasFields: (userOperation: Partial<UserOperation>) => userOperation is Partial<UserOperation> & UserOperationWithGasFields;
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=hasRequiredGasFields.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hasRequiredGasFields.d.ts","sourceRoot":"","sources":["../../../src/utils/hasRequiredGasFields/hasRequiredGasFields.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAE9D,KAAK,0BAA0B,GAAG,IAAI,CACpC,aAAa,EACX,cAAc,GACd,sBAAsB,GACtB,oBAAoB,GACpB,cAAc,CACjB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,eAAO,MAAM,oBAAoB,kBAChB,OAAO,CAAC,aAAa,CAAC,KACpC,aAAa,IAAI,OAAO,CAAC,aAAa,CAAC,GAAG,0BAM1C,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/utils/hasRequiredGasFields/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dynamic-labs-sdk/zerodev",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "./dist/index.cjs.js",
|
|
6
6
|
"module": "./dist/index.esm.js",
|
|
@@ -22,13 +22,13 @@
|
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
|
-
"@dynamic-labs/sdk-api-core": "0.0.
|
|
25
|
+
"@dynamic-labs/sdk-api-core": "0.0.873",
|
|
26
26
|
"@zerodev/ecdsa-validator": "5.4.9",
|
|
27
27
|
"@zerodev/multi-chain-ecdsa-validator": "5.4.5",
|
|
28
28
|
"@zerodev/sdk": "5.4.37",
|
|
29
|
-
"@dynamic-labs-sdk/
|
|
30
|
-
"@dynamic-labs-sdk/client": "0.
|
|
31
|
-
"@dynamic-labs-sdk/
|
|
29
|
+
"@dynamic-labs-sdk/assert-package-version": "0.12.0",
|
|
30
|
+
"@dynamic-labs-sdk/client": "0.12.0",
|
|
31
|
+
"@dynamic-labs-sdk/evm": "0.12.0"
|
|
32
32
|
},
|
|
33
33
|
"peerDependencies": {
|
|
34
34
|
"viem": "^2.28.4"
|