@safe-global/relay-kit 3.4.2 → 4.0.0-alpha.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.
Files changed (93) hide show
  1. package/dist/cjs/src/index.cjs +1497 -0
  2. package/dist/cjs/test-utils/index.cjs +1360 -0
  3. package/dist/esm/src/index.mjs +1487 -0
  4. package/dist/esm/test-utils/index.mjs +1348 -0
  5. package/dist/src/RelayKitBasePack.d.ts +1 -0
  6. package/dist/src/RelayKitBasePack.d.ts.map +1 -0
  7. package/dist/src/constants.d.ts +1 -0
  8. package/dist/src/constants.d.ts.map +1 -0
  9. package/dist/src/deprecated.d.ts +1 -0
  10. package/dist/src/deprecated.d.ts.map +1 -0
  11. package/dist/src/index.d.ts +6 -1
  12. package/dist/src/index.d.ts.map +1 -0
  13. package/dist/src/packs/gelato/GelatoRelayPack.d.ts +1 -0
  14. package/dist/src/packs/gelato/GelatoRelayPack.d.ts.map +1 -0
  15. package/dist/src/packs/gelato/types.d.ts +1 -0
  16. package/dist/src/packs/gelato/types.d.ts.map +1 -0
  17. package/dist/src/packs/safe-4337/BaseSafeOperation.d.ts +18 -0
  18. package/dist/src/packs/safe-4337/BaseSafeOperation.d.ts.map +1 -0
  19. package/dist/src/packs/safe-4337/Safe4337Pack.d.ts +17 -17
  20. package/dist/src/packs/safe-4337/Safe4337Pack.d.ts.map +1 -0
  21. package/dist/src/packs/safe-4337/SafeOperationFactory.d.ts +13 -0
  22. package/dist/src/packs/safe-4337/SafeOperationFactory.d.ts.map +1 -0
  23. package/dist/src/packs/safe-4337/SafeOperationV06.d.ts +16 -0
  24. package/dist/src/packs/safe-4337/SafeOperationV06.d.ts.map +1 -0
  25. package/dist/src/packs/safe-4337/SafeOperationV07.d.ts +16 -0
  26. package/dist/src/packs/safe-4337/SafeOperationV07.d.ts.map +1 -0
  27. package/dist/src/packs/safe-4337/constants.d.ts +11 -3
  28. package/dist/src/packs/safe-4337/constants.d.ts.map +1 -0
  29. package/dist/src/packs/safe-4337/estimators/index.d.ts +2 -1
  30. package/dist/src/packs/safe-4337/estimators/index.d.ts.map +1 -0
  31. package/dist/src/packs/safe-4337/estimators/pimlico/PimlicoFeeEstimator.d.ts +13 -0
  32. package/dist/src/packs/safe-4337/estimators/pimlico/PimlicoFeeEstimator.d.ts.map +1 -0
  33. package/dist/src/packs/safe-4337/estimators/pimlico/types.d.ts +48 -0
  34. package/dist/src/packs/safe-4337/estimators/pimlico/types.d.ts.map +1 -0
  35. package/dist/src/packs/safe-4337/types.d.ts +50 -44
  36. package/dist/src/packs/safe-4337/types.d.ts.map +1 -0
  37. package/dist/src/packs/safe-4337/utils/encodeNonce.d.ts +5 -0
  38. package/dist/src/packs/safe-4337/utils/encodeNonce.d.ts.map +1 -0
  39. package/dist/src/packs/safe-4337/utils/entrypoint.d.ts +4 -0
  40. package/dist/src/packs/safe-4337/utils/entrypoint.d.ts.map +1 -0
  41. package/dist/src/packs/safe-4337/utils/getRelayKitVersion.d.ts +1 -0
  42. package/dist/src/packs/safe-4337/utils/getRelayKitVersion.d.ts.map +1 -0
  43. package/dist/src/packs/safe-4337/utils/index.d.ts +22 -0
  44. package/dist/src/packs/safe-4337/utils/index.d.ts.map +1 -0
  45. package/dist/src/packs/safe-4337/utils/signing.d.ts +37 -0
  46. package/dist/src/packs/safe-4337/utils/signing.d.ts.map +1 -0
  47. package/dist/src/packs/safe-4337/utils/userOperations.d.ts +27 -0
  48. package/dist/src/packs/safe-4337/utils/userOperations.d.ts.map +1 -0
  49. package/dist/{src/packs/safe-4337/testing-utils → test-utils}/fixtures.d.ts +28 -5
  50. package/dist/test-utils/fixtures.d.ts.map +1 -0
  51. package/dist/{src/packs/safe-4337/testing-utils → test-utils}/helpers.d.ts +3 -2
  52. package/dist/test-utils/helpers.d.ts.map +1 -0
  53. package/dist/test-utils/index.d.ts +4 -0
  54. package/dist/test-utils/index.d.ts.map +1 -0
  55. package/dist/tsconfig.build.tsbuildinfo +1 -1
  56. package/package.json +22 -6
  57. package/dist/src/RelayKitBasePack.js +0 -26
  58. package/dist/src/RelayKitBasePack.js.map +0 -1
  59. package/dist/src/constants.js +0 -12
  60. package/dist/src/constants.js.map +0 -1
  61. package/dist/src/deprecated.js +0 -3
  62. package/dist/src/deprecated.js.map +0 -1
  63. package/dist/src/index.js +0 -30
  64. package/dist/src/index.js.map +0 -1
  65. package/dist/src/packs/gelato/GelatoRelayPack.js +0 -327
  66. package/dist/src/packs/gelato/GelatoRelayPack.js.map +0 -1
  67. package/dist/src/packs/gelato/types.js +0 -3
  68. package/dist/src/packs/gelato/types.js.map +0 -1
  69. package/dist/src/packs/safe-4337/Safe4337Pack.js +0 -644
  70. package/dist/src/packs/safe-4337/Safe4337Pack.js.map +0 -1
  71. package/dist/src/packs/safe-4337/SafeOperation.d.ts +0 -22
  72. package/dist/src/packs/safe-4337/SafeOperation.js +0 -68
  73. package/dist/src/packs/safe-4337/SafeOperation.js.map +0 -1
  74. package/dist/src/packs/safe-4337/constants.js +0 -55
  75. package/dist/src/packs/safe-4337/constants.js.map +0 -1
  76. package/dist/src/packs/safe-4337/estimators/PimlicoFeeEstimator.d.ts +0 -8
  77. package/dist/src/packs/safe-4337/estimators/PimlicoFeeEstimator.js +0 -49
  78. package/dist/src/packs/safe-4337/estimators/PimlicoFeeEstimator.js.map +0 -1
  79. package/dist/src/packs/safe-4337/estimators/index.js +0 -6
  80. package/dist/src/packs/safe-4337/estimators/index.js.map +0 -1
  81. package/dist/src/packs/safe-4337/testing-utils/fixtures.js +0 -128
  82. package/dist/src/packs/safe-4337/testing-utils/fixtures.js.map +0 -1
  83. package/dist/src/packs/safe-4337/testing-utils/helpers.js +0 -58
  84. package/dist/src/packs/safe-4337/testing-utils/helpers.js.map +0 -1
  85. package/dist/src/packs/safe-4337/types.js +0 -3
  86. package/dist/src/packs/safe-4337/types.js.map +0 -1
  87. package/dist/src/packs/safe-4337/utils/entrypoint.js +0 -23
  88. package/dist/src/packs/safe-4337/utils/entrypoint.js.map +0 -1
  89. package/dist/src/packs/safe-4337/utils/getRelayKitVersion.js +0 -6
  90. package/dist/src/packs/safe-4337/utils/getRelayKitVersion.js.map +0 -1
  91. package/dist/src/packs/safe-4337/utils.d.ts +0 -91
  92. package/dist/src/packs/safe-4337/utils.js +0 -190
  93. package/dist/src/packs/safe-4337/utils.js.map +0 -1
@@ -0,0 +1,37 @@
1
+ /**
2
+ * Passkey Dummy client data JSON fields. This can be used for gas estimations, as it pads the fields enough
3
+ * to account for variations in WebAuthn implementations.
4
+ */
5
+ export declare const DUMMY_CLIENT_DATA_FIELDS: string;
6
+ /**
7
+ * Dummy authenticator data. This can be used for gas estimations, as it ensures that the correct
8
+ * authenticator flags are set.
9
+ */
10
+ export declare const DUMMY_AUTHENTICATOR_DATA: Uint8Array;
11
+ /**
12
+ * This method creates a dummy signature for the SafeOperation based on the Safe threshold. We assume that all owners are passkeys
13
+ * This is useful for gas estimations
14
+ * @param signer - The signer
15
+ * @param threshold - The Safe threshold
16
+ * @returns The user operation with the dummy passkey signature
17
+ */
18
+ export declare function getDummySignature(signer: string, threshold: number): string;
19
+ /**
20
+ * Encodes the given WebAuthn signature into a string. This computes the ABI-encoded signature parameters:
21
+ * ```solidity
22
+ * abi.encode(authenticatorData, clientDataFields, r, s);
23
+ * ```
24
+ *
25
+ * @param authenticatorData - The authenticator data as a Uint8Array.
26
+ * @param clientDataFields - The client data fields as a string.
27
+ * @param r - The value of r as a bigint.
28
+ * @param s - The value of s as a bigint.
29
+ * @returns The encoded string.
30
+ */
31
+ export declare function getSignatureBytes({ authenticatorData, clientDataFields, r, s }: {
32
+ authenticatorData: Uint8Array;
33
+ clientDataFields: string;
34
+ r: bigint;
35
+ s: bigint;
36
+ }): string;
37
+ //# sourceMappingURL=signing.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"signing.d.ts","sourceRoot":"","sources":["../../../../../src/packs/safe-4337/utils/signing.ts"],"names":[],"mappings":"AAGA;;;GAGG;AACH,eAAO,MAAM,wBAAwB,QAG1B,CAAA;AAEX;;;GAGG;AACH,eAAO,MAAM,wBAAwB,YAAqB,CAAA;AAS1D;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM,CAgB3E;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,iBAAiB,CAAC,EAChC,iBAAiB,EACjB,gBAAgB,EAChB,CAAC,EACD,CAAC,EACF,EAAE;IACD,iBAAiB,EAAE,UAAU,CAAA;IAC7B,gBAAgB,EAAE,MAAM,CAAA;IACxB,CAAC,EAAE,MAAM,CAAA;IACT,CAAC,EAAE,MAAM,CAAA;CACV,GAAG,MAAM,CAwBT"}
@@ -0,0 +1,27 @@
1
+ import Safe from '@safe-global/protocol-kit';
2
+ import { MetaTransactionData, UserOperation } from '@safe-global/types-kit';
3
+ import { PaymasterOptions, UserOperationStringValues } from '../../../packs/safe-4337/types';
4
+ /**
5
+ * Creates an initial UserOperation before adding all the estimation values
6
+ * @param {Safe} protocolKit - The Safe instance
7
+ * @param {MetaTransactionData[]} transactions - The transactions to batch
8
+ * @param {{ entryPoint: string; amountToApprove?: bigint; paymasterOptions: PaymasterOptions }} options
9
+ * @param {bigint} options.amountToApprove - The amount to approve. Useful for ERC20 paymasters to include an approve transaction for the ERC20 token ruling the paymaster
10
+ * @param {string} options.entryPoint - The entry point for the UserOperation
11
+ * @param {PaymasterOptions} options.paymasterOptions - The options for the paymaster
12
+ * @returns {Promise<UserOperation>} The initialized UserOperation
13
+ */
14
+ export declare function createUserOperation(protocolKit: Safe, transactions: MetaTransactionData[], { amountToApprove, entryPoint, paymasterOptions, customNonce }: {
15
+ entryPoint: string;
16
+ amountToApprove?: bigint;
17
+ paymasterOptions: PaymasterOptions;
18
+ customNonce?: bigint;
19
+ }): Promise<UserOperation>;
20
+ /**
21
+ * Converts various bigint values from a UserOperation to their hexadecimal representation.
22
+ *
23
+ * @param {UserOperation} userOperation - The UserOperation object whose values are to be converted.
24
+ * @returns {UserOperation} A new UserOperation object with the values converted to hexadecimal.
25
+ */
26
+ export declare function userOperationToHexValues(userOperation: UserOperation, entryPointAddress: string): UserOperationStringValues;
27
+ //# sourceMappingURL=userOperations.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"userOperations.d.ts","sourceRoot":"","sources":["../../../../../src/packs/safe-4337/utils/userOperations.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,2BAA2B,CAAA;AAE5C,OAAO,EACL,mBAAmB,EAEnB,aAAa,EAEd,MAAM,wBAAwB,CAAA;AAQ/B,OAAO,EAEL,gBAAgB,EAChB,yBAAyB,EAC1B,MAAM,8CAA8C,CAAA;AAiFrD;;;;;;;;;GASG;AACH,wBAAsB,mBAAmB,CACvC,WAAW,EAAE,IAAI,EACjB,YAAY,EAAE,mBAAmB,EAAE,EACnC,EACE,eAAe,EACf,UAAU,EACV,gBAAgB,EAChB,WAAW,EACZ,EAAE;IACD,UAAU,EAAE,MAAM,CAAA;IAClB,eAAe,CAAC,EAAE,MAAM,CAAA;IACxB,gBAAgB,EAAE,gBAAgB,CAAA;IAClC,WAAW,CAAC,EAAE,MAAM,CAAA;CACrB,GACA,OAAO,CAAC,aAAa,CAAC,CAiDxB;AAED;;;;;GAKG;AACH,wBAAgB,wBAAwB,CACtC,aAAa,EAAE,aAAa,EAC5B,iBAAiB,EAAE,MAAM,GACxB,yBAAyB,CA0B3B"}
@@ -1,7 +1,8 @@
1
1
  export declare const OWNER_1 = "0xFfAC5578BE8AC1B2B9D13b34cAf4A074B96B8A1b";
2
2
  export declare const OWNER_2 = "0x3059EfD1BCe33be41eeEfd5fb6D520d7fEd54E43";
3
- export declare const PREDICTED_SAFE_ADDRESS = "0x65e0d294F2d17CB9fB0f65111E9Ac8a00C4049dA";
4
- export declare const SAFE_ADDRESS_v1_4_1 = "0x717f4BB83D8DF2e5a3Cc603Ee27263ac9EFB6c12";
3
+ export declare const PREDICTED_SAFE_ADDRESS = "0xB71d0a777A692870163FFfd777094217a52DD9e4";
4
+ export declare const SAFE_ADDRESS_v1_4_1_WITH_0_3_0_MODULE = "0x5f92e52CD555539a0D30c81FcF6703c04E11dA48";
5
+ export declare const SAFE_ADDRESS_v1_4_1_WITH_0_2_0_MODULE = "0x717f4BB83D8DF2e5a3Cc603Ee27263ac9EFB6c12";
5
6
  export declare const SAFE_ADDRESS_v1_3_0 = "0x8C35a08Af278518B59D04ddDe3F1b370aD766D22";
6
7
  export declare const SAFE_ADDRESS_4337_MODULE_NOT_ENABLED = "0xfC82a1e4A045a44527e8b45FC70332C8F66fc32B";
7
8
  export declare const SAFE_ADDRESS_4337_FALLBACKHANDLER_NOT_ENABLED = "0xA6FDc4e18404E1715D1bC51B07266c91393C6622";
@@ -10,12 +11,15 @@ export declare const SAFE_MODULES_V0_3_0 = "0.3.0";
10
11
  export declare const PAYMASTER_ADDRESS = "0x0000000000325602a77416A16136FDafd04b299f";
11
12
  export declare const PAYMASTER_TOKEN_ADDRESS = "0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238";
12
13
  export declare const CHAIN_ID = "0xaa36a7";
13
- export declare const MODULE_ADDRESS = "0xa581c4A4DB7175302464fF3C06380BC3270b4037";
14
+ export declare const SAFE_4337_MODULE_ADDRESS_V0_2_0 = "0xa581c4A4DB7175302464fF3C06380BC3270b4037";
15
+ export declare const SAFE_4337_MODULE_ADDRESS_V0_3_0 = "0x75cf11467937ce3F2f357CE24ffc3DBF8fD5c226";
16
+ export declare const SHARED_SIGNER = "0x";
14
17
  export declare const RPC_URL = "https://sepolia.gateway.tenderly.co";
15
18
  export declare const BUNDLER_URL = "https://bundler.url";
16
19
  export declare const PAYMASTER_URL = "https://paymaster.url";
17
20
  export declare const USER_OPERATION_HASH = "0x3cb881d1969036174f38d636d22108d1d032145518b53104fc0b1e1296d2cc9c";
18
- export declare const ENTRYPOINTS: string[];
21
+ export declare const ENTRYPOINT_ADDRESS_V06 = "0x5FF137D4b0FDCD49DcA30c7CF57E578a026d2789";
22
+ export declare const ENTRYPOINT_ADDRESS_V07 = "0x0000000071727De22E5E9d8BAf0edAc6f37da032";
19
23
  export declare const USER_OPERATION_RECEIPT: {
20
24
  userOpHash: string;
21
25
  sender: string;
@@ -40,7 +44,7 @@ export declare const USER_OPERATION_RECEIPT: {
40
44
  effectiveGasPrice: string;
41
45
  };
42
46
  };
43
- export declare const USER_OPERATION: {
47
+ export declare const USER_OPERATION_V06: {
44
48
  sender: string;
45
49
  nonce: string;
46
50
  initCode: string;
@@ -53,6 +57,24 @@ export declare const USER_OPERATION: {
53
57
  paymasterAndData: string;
54
58
  signature: string;
55
59
  };
60
+ export declare const USER_OPERATION_V07: {
61
+ sender: string;
62
+ nonce: string;
63
+ factory: string;
64
+ factoryData: string;
65
+ callData: string;
66
+ callGasLimit: bigint;
67
+ verificationGasLimit: bigint;
68
+ preVerificationGas: bigint;
69
+ maxFeePerGas: bigint;
70
+ maxPriorityFeePerGas: bigint;
71
+ paymaster: undefined;
72
+ paymasterVerificationGasLimit: undefined;
73
+ paymasterPostOpGasLimit: undefined;
74
+ paymasterData: undefined;
75
+ signature: string;
76
+ };
77
+ export declare const USER_OPERATION_V07_HASH = "0xea46190691c27950a9c4246be1e4550fa1bd85bcf1ad9fe7329b51666722b285";
56
78
  export declare const USER_OPERATION_HEX_VALUES: {
57
79
  sender: string;
58
80
  nonce: string;
@@ -135,3 +157,4 @@ export declare const USER_OPERATION_GAS_PRICE: {
135
157
  maxPriorityFeePerGas: string;
136
158
  };
137
159
  };
160
+ //# sourceMappingURL=fixtures.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fixtures.d.ts","sourceRoot":"","sources":["../../test-utils/fixtures.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,OAAO,+CAA+C,CAAA;AACnE,eAAO,MAAM,OAAO,+CAA+C,CAAA;AACnE,eAAO,MAAM,sBAAsB,+CAA+C,CAAA;AAClF,eAAO,MAAM,qCAAqC,+CAA+C,CAAA;A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BAAwB;;;;;CAEpC,CAAA"}
@@ -1,4 +1,5 @@
1
- import { Safe4337InitOptions } from '../types';
2
- import { Safe4337Pack } from '../Safe4337Pack';
1
+ import { Safe4337InitOptions } from '../src/packs/safe-4337/types';
2
+ import { Safe4337Pack } from '../src/packs/safe-4337/Safe4337Pack';
3
3
  export declare const generateTransferCallData: (to: string, value: bigint) => `0x${string}`;
4
4
  export declare const createSafe4337Pack: (initOptions: Partial<Safe4337InitOptions>) => Promise<Safe4337Pack>;
5
+ //# sourceMappingURL=helpers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../test-utils/helpers.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,mBAAmB,EAAE,MAAM,8BAA8B,CAAA;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,qCAAqC,CAAA;AAGlE,eAAO,MAAM,wBAAwB,OAAQ,MAAM,SAAS,MAAM,kBAQjE,CAAA;AAID,eAAO,MAAM,kBAAkB,gBAChB,OAAO,CAAC,mBAAmB,CAAC,KACxC,OAAO,CAAC,YAAY,CAqBtB,CAAA"}
@@ -0,0 +1,4 @@
1
+ export * as fixtures from './fixtures';
2
+ export * from './helpers';
3
+ export { ENTRYPOINT_ABI, ENTRYPOINT_ADDRESS_V06, RPC_4337_CALLS } from '../src/packs/safe-4337/constants';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../test-utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAA;AACtC,cAAc,WAAW,CAAA;AACzB,OAAO,EACL,cAAc,EACd,sBAAsB,EACtB,cAAc,EACf,MAAM,kCAAkC,CAAA"}