@appliedblockchain/silentdatarollup-core 1.0.7 → 1.0.9
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 +21 -0
- package/README.md +1 -1
- package/dist/{chunk-5VQIOQAW.mjs → chunk-53A5RGL2.mjs} +242 -95
- package/dist/index.d.mts +96 -9
- package/dist/index.d.ts +96 -9
- package/dist/index.js +243 -90
- package/dist/index.mjs +15 -1
- package/dist/tests.js +15 -9
- package/dist/tests.mjs +1 -1
- package/package.json +8 -9
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Signer, Contract, JsonRpcPayload, InterfaceAbi, ContractRunner,
|
|
1
|
+
import { Signer, Contract, JsonRpcPayload, InterfaceAbi, ContractRunner, TypedDataDomain, TypedDataField } from 'ethers';
|
|
2
2
|
|
|
3
3
|
declare const SIGN_RPC_METHODS: string[];
|
|
4
4
|
declare const eip721Domain: {
|
|
@@ -15,10 +15,39 @@ declare const DEBUG_NAMESPACE = "silentdata:core";
|
|
|
15
15
|
declare const DEBUG_NAMESPACE_SILENTDATA_INTERCEPTOR = "silentdata:interceptor";
|
|
16
16
|
declare const HEADER_SIGNATURE = "x-signature";
|
|
17
17
|
declare const HEADER_TIMESTAMP = "x-timestamp";
|
|
18
|
+
declare const HEADER_SIGNATURE_TYPE = "x-signature-type";
|
|
18
19
|
declare const HEADER_EIP712_SIGNATURE = "x-eip712-signature";
|
|
19
20
|
declare const HEADER_DELEGATE = "x-delegate";
|
|
20
21
|
declare const HEADER_DELEGATE_SIGNATURE = "x-delegate-signature";
|
|
21
22
|
declare const HEADER_EIP712_DELEGATE_SIGNATURE = "x-eip712-delegate-signature";
|
|
23
|
+
declare const HEADER_SIGNER_SWC = "x-signer-swc";
|
|
24
|
+
/**
|
|
25
|
+
* Header used when signing a user operation receipt call to the bundler (eth_getUserOperationReceipt)
|
|
26
|
+
*/
|
|
27
|
+
declare const HEADER_FROM_BLOCK = "x-from-block";
|
|
28
|
+
/**
|
|
29
|
+
* Entrypoint address used when building eth_getLogs payload for signing eth_getUserOperationReceipt calls.
|
|
30
|
+
* This is hardcoded for now as we are just starting and will have support for only one version anyway.
|
|
31
|
+
* We are not worrying about different versions for now.
|
|
32
|
+
* In the future, if we do support other versions, this should be made a config while initializing the provider.
|
|
33
|
+
*/
|
|
34
|
+
declare const ENTRYPOINT_ADDRESS = "0x34F5Bda45f2Ce00B646BD6B19D0F9817b5D8D398";
|
|
35
|
+
/**
|
|
36
|
+
* Default number of blocks to look back when fetching user operation receipts.
|
|
37
|
+
* This is used to calculate the fromBlock parameter in eth_getUserOperationReceipt requests.
|
|
38
|
+
*/
|
|
39
|
+
declare const DEFAULT_USER_OPERATION_RECEIPT_LOOKUP_RANGE = 1024;
|
|
40
|
+
/**
|
|
41
|
+
* The signature for the UserOperationEvent from ERC-4337
|
|
42
|
+
* This is the event emitted by the EntryPoint contract and wrapped in PrivateEvent
|
|
43
|
+
*/
|
|
44
|
+
declare const USER_OPERATION_EVENT_SIGNATURE = "UserOperationEvent(bytes32,address,address,uint256,bool,uint256,uint256)";
|
|
45
|
+
/**
|
|
46
|
+
* The keccak256 hash of the UserOperationEvent signature
|
|
47
|
+
* Used as the eventType filter when querying for user operation receipts via eth_getLogs
|
|
48
|
+
* Value: 0x49628fd1471006c1482da88028e9ce4dbb080b815c9b0344d39e5a8e6ec1419f
|
|
49
|
+
*/
|
|
50
|
+
declare const USER_OPERATION_EVENT_HASH: string;
|
|
22
51
|
declare const DEFAULT_DELEGATE_EXPIRES: number;
|
|
23
52
|
/**
|
|
24
53
|
* A buffer time (in seconds) added to the current time when verifying the validity of a delegate.
|
|
@@ -72,6 +101,17 @@ type BaseConfig = {
|
|
|
72
101
|
expires?: number;
|
|
73
102
|
};
|
|
74
103
|
authSignatureType?: SignatureType;
|
|
104
|
+
/**
|
|
105
|
+
* Smart wallet contract address.
|
|
106
|
+
* When provided, signing will be done on the hashed message for EIP-1271 verification.
|
|
107
|
+
*/
|
|
108
|
+
smartWalletAddress?: string;
|
|
109
|
+
/**
|
|
110
|
+
* The block range to look back when fetching user operation receipts.
|
|
111
|
+
* This value is used to calculate the fromBlock parameter when querying for receipts.
|
|
112
|
+
* If not provided, defaults to DEFAULT_USER_OPERATION_RECEIPT_LOOKUP_RANGE (1024 blocks).
|
|
113
|
+
*/
|
|
114
|
+
userOperationReceiptLookupRange?: number;
|
|
75
115
|
};
|
|
76
116
|
type DelegateSignerMessage = {
|
|
77
117
|
expires: string;
|
|
@@ -88,6 +128,8 @@ type AuthHeaders = {
|
|
|
88
128
|
[HEADER_TIMESTAMP]: string;
|
|
89
129
|
[HEADER_SIGNATURE]?: string;
|
|
90
130
|
[HEADER_EIP712_SIGNATURE]?: string;
|
|
131
|
+
[HEADER_SIGNATURE_TYPE]?: string;
|
|
132
|
+
[HEADER_FROM_BLOCK]?: string;
|
|
91
133
|
};
|
|
92
134
|
type DelegateHeaders = {
|
|
93
135
|
[HEADER_DELEGATE]: string;
|
|
@@ -99,7 +141,6 @@ type SilentDataRollupContractConfig = {
|
|
|
99
141
|
abi: InterfaceAbi;
|
|
100
142
|
runner: ContractRunner;
|
|
101
143
|
contractMethodsToSign: string[];
|
|
102
|
-
provider?: Provider;
|
|
103
144
|
};
|
|
104
145
|
type ContractInfo = {
|
|
105
146
|
contract: Contract;
|
|
@@ -129,24 +170,39 @@ declare class SilentDataRollupBase {
|
|
|
129
170
|
/**
|
|
130
171
|
* Signs a raw delegate header message.
|
|
131
172
|
* This method can be overridden by extending classes to customize the signing process.
|
|
173
|
+
* The signer implementation decides whether to add EIP-191 prefix or not.
|
|
132
174
|
* @param provider - The provider used for signing
|
|
133
175
|
* @param message - The delegate signer message to be signed
|
|
176
|
+
* @param isSWC - Whether signing for smart wallet contract (EIP-1271)
|
|
134
177
|
* @returns A promise that resolves to the signature string
|
|
135
178
|
*/
|
|
136
|
-
protected
|
|
179
|
+
protected signDelegateHeader(provider: any, message: string, isSWC?: boolean): Promise<string>;
|
|
137
180
|
/**
|
|
138
181
|
* Signs a typed delegate header message.
|
|
139
182
|
* This method can be overridden by extending classes to customize the signing process.
|
|
140
183
|
* @param provider - The provider used for signing
|
|
184
|
+
* @param chainId - The chain ID
|
|
141
185
|
* @param message - The delegate signer message to be signed
|
|
186
|
+
* @param isSWC - Whether signing for smart wallet contract (EIP-1271)
|
|
142
187
|
* @returns A promise that resolves to the signature string
|
|
143
188
|
*/
|
|
144
|
-
protected signTypedDelegateHeader(provider: any, chainId: string, message: DelegateSignerMessage): Promise<string>;
|
|
189
|
+
protected signTypedDelegateHeader(provider: any, chainId: string, message: DelegateSignerMessage, isSWC?: boolean): Promise<string>;
|
|
190
|
+
/**
|
|
191
|
+
* IMPORTANT: Return the cached promise (currentPromise), not the resolved value.
|
|
192
|
+
* This ensures multiple concurrent callers share the same in-flight request,
|
|
193
|
+
* preventing redundant API calls.
|
|
194
|
+
*/
|
|
145
195
|
getDelegateHeaders(provider: any): Promise<DelegateHeaders>;
|
|
146
196
|
generateDelegateHeaders(provider: any): Promise<DelegateHeaders>;
|
|
147
197
|
getAuthHeaders(provider: any, payload: JsonRpcPayload | JsonRpcPayload[]): Promise<AuthHeaders>;
|
|
148
|
-
|
|
149
|
-
|
|
198
|
+
/**
|
|
199
|
+
* Signs auth header.
|
|
200
|
+
*/
|
|
201
|
+
signAuthHeader(provider: any, payload: JsonRpcPayload | JsonRpcPayload[], timestamp: string, chainId: string, isSWC?: boolean): Promise<string>;
|
|
202
|
+
/**
|
|
203
|
+
* Signs auth header using typed data signature.
|
|
204
|
+
*/
|
|
205
|
+
signTypedAuthHeader(provider: any, payload: JsonRpcPayload | JsonRpcPayload[], timestamp: string, chainId: string, isSWC?: boolean): Promise<string>;
|
|
150
206
|
/**
|
|
151
207
|
* Signs a message using the provided signer.
|
|
152
208
|
* This method can be overridden to customize the signing process.
|
|
@@ -166,14 +222,45 @@ declare class SilentDataRollupBase {
|
|
|
166
222
|
*/
|
|
167
223
|
protected signTypedData(signer: any, domain: TypedDataDomain, types: Record<string, Array<TypedDataField>>, message: Record<string, any>): Promise<string>;
|
|
168
224
|
setContract(contract: Contract, contractMethodsToSign: string[]): void;
|
|
225
|
+
/**
|
|
226
|
+
* Calculates the fromBlock value for eth_getUserOperationReceipt requests.
|
|
227
|
+
* Gets the current block number and subtracts the configured userOperationReceiptLookupRange.
|
|
228
|
+
*
|
|
229
|
+
* IMPORTANT: The bundler strictly validates this value and will reject the request if:
|
|
230
|
+
* - The header is missing
|
|
231
|
+
* - The value is < 0
|
|
232
|
+
* - The value is > current block number
|
|
233
|
+
* - The value is too far back (< currentBlock - userOperationReceiptLookupRange)
|
|
234
|
+
*
|
|
235
|
+
* This method ensures the returned value is always within the valid range:
|
|
236
|
+
* max(0, currentBlock - userOperationReceiptLookupRange) <= fromBlock <= currentBlock
|
|
237
|
+
*
|
|
238
|
+
* @param provider - The provider to use for fetching the current block number
|
|
239
|
+
* @returns A promise that resolves to the fromBlock value as a bigint
|
|
240
|
+
* @throws Error if unable to fetch the current block number
|
|
241
|
+
*/
|
|
242
|
+
protected getFromBlockForUserOperationReceipt(provider: any): Promise<bigint>;
|
|
243
|
+
/**
|
|
244
|
+
* Builds a custom eth_getLogs payload for signing when the original request is eth_getUserOperationReceipt.
|
|
245
|
+
* This method can be overridden to customize the payload construction.
|
|
246
|
+
*
|
|
247
|
+
* IMPORTANT: The bundler must reconstruct this exact payload to verify the signature.
|
|
248
|
+
* The bundler should use the same `id` from the original eth_getUserOperationReceipt request
|
|
249
|
+
* when constructing the eth_getLogs request to send to the RPC node.
|
|
250
|
+
*
|
|
251
|
+
* @param payload - The original eth_getUserOperationReceipt payload
|
|
252
|
+
* @param fromBlock - The fromBlock value to use in the eth_getLogs filter
|
|
253
|
+
* @returns A JsonRpcPayload with method 'eth_getLogs' to be used for signing
|
|
254
|
+
*/
|
|
255
|
+
protected buildGetUserOperationReceiptSigningPayload(payload: JsonRpcPayload, fromBlock: bigint): JsonRpcPayload;
|
|
169
256
|
/**
|
|
170
257
|
* Prepares the message to be signed for the x-signature header.
|
|
171
258
|
*/
|
|
172
|
-
|
|
259
|
+
prepareMessage(chainId: string, payload: JsonRpcPayload | JsonRpcPayload[], timestamp: string): string;
|
|
173
260
|
/**
|
|
174
261
|
* Prepares the message to be signed for the x-eip712-signature header.
|
|
175
262
|
*/
|
|
176
|
-
|
|
263
|
+
prepareTypedData(payload: JsonRpcPayload | JsonRpcPayload[], timestamp: string): AuthSignatureMessage;
|
|
177
264
|
}
|
|
178
265
|
|
|
179
266
|
declare class SilentDataRollupContract extends Contract {
|
|
@@ -241,4 +328,4 @@ interface PrivateEvent {
|
|
|
241
328
|
*/
|
|
242
329
|
declare function calculateEventTypeHash(eventSignature: string): string;
|
|
243
330
|
|
|
244
|
-
export { type AuthHeaders, type AuthSignatureMessage, type AuthSignatureMessageRequest, type BaseConfig, ChainId, type ContractInfo, DEBUG_NAMESPACE, DEBUG_NAMESPACE_SILENTDATA_INTERCEPTOR, DEFAULT_DELEGATE_EXPIRES, DELEGATE_EXPIRATION_THRESHOLD_BUFFER, type DelegateConfig, type DelegateHeaders, type DelegateSignerMessage, HEADER_DELEGATE, HEADER_DELEGATE_SIGNATURE, HEADER_EIP712_DELEGATE_SIGNATURE, HEADER_EIP712_SIGNATURE, HEADER_SIGNATURE, HEADER_TIMESTAMP, NetworkName, PRIVATE_EVENT_SIGNATURE, PRIVATE_EVENT_SIGNATURE_HASH, type PrivateEvent, SIGN_RPC_METHODS, SignatureType, type SilentDataProviderOptions, SilentDataRollupBase, SilentDataRollupContract, type SilentDataRollupContractConfig, type SilentdataNetworkConfig, WHITELISTED_METHODS, calculateEventTypeHash, defaultGetDelegate, delegateEIP721Types, eip721Domain, getAuthEIP721Types, getAuthHeaders, isSignableContractCall, prepareTypedDataPayload };
|
|
331
|
+
export { type AuthHeaders, type AuthSignatureMessage, type AuthSignatureMessageRequest, type BaseConfig, ChainId, type ContractInfo, DEBUG_NAMESPACE, DEBUG_NAMESPACE_SILENTDATA_INTERCEPTOR, DEFAULT_DELEGATE_EXPIRES, DEFAULT_USER_OPERATION_RECEIPT_LOOKUP_RANGE, DELEGATE_EXPIRATION_THRESHOLD_BUFFER, type DelegateConfig, type DelegateHeaders, type DelegateSignerMessage, ENTRYPOINT_ADDRESS, HEADER_DELEGATE, HEADER_DELEGATE_SIGNATURE, HEADER_EIP712_DELEGATE_SIGNATURE, HEADER_EIP712_SIGNATURE, HEADER_FROM_BLOCK, HEADER_SIGNATURE, HEADER_SIGNATURE_TYPE, HEADER_SIGNER_SWC, HEADER_TIMESTAMP, NetworkName, PRIVATE_EVENT_SIGNATURE, PRIVATE_EVENT_SIGNATURE_HASH, type PrivateEvent, SIGN_RPC_METHODS, SignatureType, type SilentDataProviderOptions, SilentDataRollupBase, SilentDataRollupContract, type SilentDataRollupContractConfig, type SilentdataNetworkConfig, USER_OPERATION_EVENT_HASH, USER_OPERATION_EVENT_SIGNATURE, WHITELISTED_METHODS, calculateEventTypeHash, defaultGetDelegate, delegateEIP721Types, eip721Domain, getAuthEIP721Types, getAuthHeaders, isSignableContractCall, prepareTypedDataPayload };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Signer, Contract, JsonRpcPayload, InterfaceAbi, ContractRunner,
|
|
1
|
+
import { Signer, Contract, JsonRpcPayload, InterfaceAbi, ContractRunner, TypedDataDomain, TypedDataField } from 'ethers';
|
|
2
2
|
|
|
3
3
|
declare const SIGN_RPC_METHODS: string[];
|
|
4
4
|
declare const eip721Domain: {
|
|
@@ -15,10 +15,39 @@ declare const DEBUG_NAMESPACE = "silentdata:core";
|
|
|
15
15
|
declare const DEBUG_NAMESPACE_SILENTDATA_INTERCEPTOR = "silentdata:interceptor";
|
|
16
16
|
declare const HEADER_SIGNATURE = "x-signature";
|
|
17
17
|
declare const HEADER_TIMESTAMP = "x-timestamp";
|
|
18
|
+
declare const HEADER_SIGNATURE_TYPE = "x-signature-type";
|
|
18
19
|
declare const HEADER_EIP712_SIGNATURE = "x-eip712-signature";
|
|
19
20
|
declare const HEADER_DELEGATE = "x-delegate";
|
|
20
21
|
declare const HEADER_DELEGATE_SIGNATURE = "x-delegate-signature";
|
|
21
22
|
declare const HEADER_EIP712_DELEGATE_SIGNATURE = "x-eip712-delegate-signature";
|
|
23
|
+
declare const HEADER_SIGNER_SWC = "x-signer-swc";
|
|
24
|
+
/**
|
|
25
|
+
* Header used when signing a user operation receipt call to the bundler (eth_getUserOperationReceipt)
|
|
26
|
+
*/
|
|
27
|
+
declare const HEADER_FROM_BLOCK = "x-from-block";
|
|
28
|
+
/**
|
|
29
|
+
* Entrypoint address used when building eth_getLogs payload for signing eth_getUserOperationReceipt calls.
|
|
30
|
+
* This is hardcoded for now as we are just starting and will have support for only one version anyway.
|
|
31
|
+
* We are not worrying about different versions for now.
|
|
32
|
+
* In the future, if we do support other versions, this should be made a config while initializing the provider.
|
|
33
|
+
*/
|
|
34
|
+
declare const ENTRYPOINT_ADDRESS = "0x34F5Bda45f2Ce00B646BD6B19D0F9817b5D8D398";
|
|
35
|
+
/**
|
|
36
|
+
* Default number of blocks to look back when fetching user operation receipts.
|
|
37
|
+
* This is used to calculate the fromBlock parameter in eth_getUserOperationReceipt requests.
|
|
38
|
+
*/
|
|
39
|
+
declare const DEFAULT_USER_OPERATION_RECEIPT_LOOKUP_RANGE = 1024;
|
|
40
|
+
/**
|
|
41
|
+
* The signature for the UserOperationEvent from ERC-4337
|
|
42
|
+
* This is the event emitted by the EntryPoint contract and wrapped in PrivateEvent
|
|
43
|
+
*/
|
|
44
|
+
declare const USER_OPERATION_EVENT_SIGNATURE = "UserOperationEvent(bytes32,address,address,uint256,bool,uint256,uint256)";
|
|
45
|
+
/**
|
|
46
|
+
* The keccak256 hash of the UserOperationEvent signature
|
|
47
|
+
* Used as the eventType filter when querying for user operation receipts via eth_getLogs
|
|
48
|
+
* Value: 0x49628fd1471006c1482da88028e9ce4dbb080b815c9b0344d39e5a8e6ec1419f
|
|
49
|
+
*/
|
|
50
|
+
declare const USER_OPERATION_EVENT_HASH: string;
|
|
22
51
|
declare const DEFAULT_DELEGATE_EXPIRES: number;
|
|
23
52
|
/**
|
|
24
53
|
* A buffer time (in seconds) added to the current time when verifying the validity of a delegate.
|
|
@@ -72,6 +101,17 @@ type BaseConfig = {
|
|
|
72
101
|
expires?: number;
|
|
73
102
|
};
|
|
74
103
|
authSignatureType?: SignatureType;
|
|
104
|
+
/**
|
|
105
|
+
* Smart wallet contract address.
|
|
106
|
+
* When provided, signing will be done on the hashed message for EIP-1271 verification.
|
|
107
|
+
*/
|
|
108
|
+
smartWalletAddress?: string;
|
|
109
|
+
/**
|
|
110
|
+
* The block range to look back when fetching user operation receipts.
|
|
111
|
+
* This value is used to calculate the fromBlock parameter when querying for receipts.
|
|
112
|
+
* If not provided, defaults to DEFAULT_USER_OPERATION_RECEIPT_LOOKUP_RANGE (1024 blocks).
|
|
113
|
+
*/
|
|
114
|
+
userOperationReceiptLookupRange?: number;
|
|
75
115
|
};
|
|
76
116
|
type DelegateSignerMessage = {
|
|
77
117
|
expires: string;
|
|
@@ -88,6 +128,8 @@ type AuthHeaders = {
|
|
|
88
128
|
[HEADER_TIMESTAMP]: string;
|
|
89
129
|
[HEADER_SIGNATURE]?: string;
|
|
90
130
|
[HEADER_EIP712_SIGNATURE]?: string;
|
|
131
|
+
[HEADER_SIGNATURE_TYPE]?: string;
|
|
132
|
+
[HEADER_FROM_BLOCK]?: string;
|
|
91
133
|
};
|
|
92
134
|
type DelegateHeaders = {
|
|
93
135
|
[HEADER_DELEGATE]: string;
|
|
@@ -99,7 +141,6 @@ type SilentDataRollupContractConfig = {
|
|
|
99
141
|
abi: InterfaceAbi;
|
|
100
142
|
runner: ContractRunner;
|
|
101
143
|
contractMethodsToSign: string[];
|
|
102
|
-
provider?: Provider;
|
|
103
144
|
};
|
|
104
145
|
type ContractInfo = {
|
|
105
146
|
contract: Contract;
|
|
@@ -129,24 +170,39 @@ declare class SilentDataRollupBase {
|
|
|
129
170
|
/**
|
|
130
171
|
* Signs a raw delegate header message.
|
|
131
172
|
* This method can be overridden by extending classes to customize the signing process.
|
|
173
|
+
* The signer implementation decides whether to add EIP-191 prefix or not.
|
|
132
174
|
* @param provider - The provider used for signing
|
|
133
175
|
* @param message - The delegate signer message to be signed
|
|
176
|
+
* @param isSWC - Whether signing for smart wallet contract (EIP-1271)
|
|
134
177
|
* @returns A promise that resolves to the signature string
|
|
135
178
|
*/
|
|
136
|
-
protected
|
|
179
|
+
protected signDelegateHeader(provider: any, message: string, isSWC?: boolean): Promise<string>;
|
|
137
180
|
/**
|
|
138
181
|
* Signs a typed delegate header message.
|
|
139
182
|
* This method can be overridden by extending classes to customize the signing process.
|
|
140
183
|
* @param provider - The provider used for signing
|
|
184
|
+
* @param chainId - The chain ID
|
|
141
185
|
* @param message - The delegate signer message to be signed
|
|
186
|
+
* @param isSWC - Whether signing for smart wallet contract (EIP-1271)
|
|
142
187
|
* @returns A promise that resolves to the signature string
|
|
143
188
|
*/
|
|
144
|
-
protected signTypedDelegateHeader(provider: any, chainId: string, message: DelegateSignerMessage): Promise<string>;
|
|
189
|
+
protected signTypedDelegateHeader(provider: any, chainId: string, message: DelegateSignerMessage, isSWC?: boolean): Promise<string>;
|
|
190
|
+
/**
|
|
191
|
+
* IMPORTANT: Return the cached promise (currentPromise), not the resolved value.
|
|
192
|
+
* This ensures multiple concurrent callers share the same in-flight request,
|
|
193
|
+
* preventing redundant API calls.
|
|
194
|
+
*/
|
|
145
195
|
getDelegateHeaders(provider: any): Promise<DelegateHeaders>;
|
|
146
196
|
generateDelegateHeaders(provider: any): Promise<DelegateHeaders>;
|
|
147
197
|
getAuthHeaders(provider: any, payload: JsonRpcPayload | JsonRpcPayload[]): Promise<AuthHeaders>;
|
|
148
|
-
|
|
149
|
-
|
|
198
|
+
/**
|
|
199
|
+
* Signs auth header.
|
|
200
|
+
*/
|
|
201
|
+
signAuthHeader(provider: any, payload: JsonRpcPayload | JsonRpcPayload[], timestamp: string, chainId: string, isSWC?: boolean): Promise<string>;
|
|
202
|
+
/**
|
|
203
|
+
* Signs auth header using typed data signature.
|
|
204
|
+
*/
|
|
205
|
+
signTypedAuthHeader(provider: any, payload: JsonRpcPayload | JsonRpcPayload[], timestamp: string, chainId: string, isSWC?: boolean): Promise<string>;
|
|
150
206
|
/**
|
|
151
207
|
* Signs a message using the provided signer.
|
|
152
208
|
* This method can be overridden to customize the signing process.
|
|
@@ -166,14 +222,45 @@ declare class SilentDataRollupBase {
|
|
|
166
222
|
*/
|
|
167
223
|
protected signTypedData(signer: any, domain: TypedDataDomain, types: Record<string, Array<TypedDataField>>, message: Record<string, any>): Promise<string>;
|
|
168
224
|
setContract(contract: Contract, contractMethodsToSign: string[]): void;
|
|
225
|
+
/**
|
|
226
|
+
* Calculates the fromBlock value for eth_getUserOperationReceipt requests.
|
|
227
|
+
* Gets the current block number and subtracts the configured userOperationReceiptLookupRange.
|
|
228
|
+
*
|
|
229
|
+
* IMPORTANT: The bundler strictly validates this value and will reject the request if:
|
|
230
|
+
* - The header is missing
|
|
231
|
+
* - The value is < 0
|
|
232
|
+
* - The value is > current block number
|
|
233
|
+
* - The value is too far back (< currentBlock - userOperationReceiptLookupRange)
|
|
234
|
+
*
|
|
235
|
+
* This method ensures the returned value is always within the valid range:
|
|
236
|
+
* max(0, currentBlock - userOperationReceiptLookupRange) <= fromBlock <= currentBlock
|
|
237
|
+
*
|
|
238
|
+
* @param provider - The provider to use for fetching the current block number
|
|
239
|
+
* @returns A promise that resolves to the fromBlock value as a bigint
|
|
240
|
+
* @throws Error if unable to fetch the current block number
|
|
241
|
+
*/
|
|
242
|
+
protected getFromBlockForUserOperationReceipt(provider: any): Promise<bigint>;
|
|
243
|
+
/**
|
|
244
|
+
* Builds a custom eth_getLogs payload for signing when the original request is eth_getUserOperationReceipt.
|
|
245
|
+
* This method can be overridden to customize the payload construction.
|
|
246
|
+
*
|
|
247
|
+
* IMPORTANT: The bundler must reconstruct this exact payload to verify the signature.
|
|
248
|
+
* The bundler should use the same `id` from the original eth_getUserOperationReceipt request
|
|
249
|
+
* when constructing the eth_getLogs request to send to the RPC node.
|
|
250
|
+
*
|
|
251
|
+
* @param payload - The original eth_getUserOperationReceipt payload
|
|
252
|
+
* @param fromBlock - The fromBlock value to use in the eth_getLogs filter
|
|
253
|
+
* @returns A JsonRpcPayload with method 'eth_getLogs' to be used for signing
|
|
254
|
+
*/
|
|
255
|
+
protected buildGetUserOperationReceiptSigningPayload(payload: JsonRpcPayload, fromBlock: bigint): JsonRpcPayload;
|
|
169
256
|
/**
|
|
170
257
|
* Prepares the message to be signed for the x-signature header.
|
|
171
258
|
*/
|
|
172
|
-
|
|
259
|
+
prepareMessage(chainId: string, payload: JsonRpcPayload | JsonRpcPayload[], timestamp: string): string;
|
|
173
260
|
/**
|
|
174
261
|
* Prepares the message to be signed for the x-eip712-signature header.
|
|
175
262
|
*/
|
|
176
|
-
|
|
263
|
+
prepareTypedData(payload: JsonRpcPayload | JsonRpcPayload[], timestamp: string): AuthSignatureMessage;
|
|
177
264
|
}
|
|
178
265
|
|
|
179
266
|
declare class SilentDataRollupContract extends Contract {
|
|
@@ -241,4 +328,4 @@ interface PrivateEvent {
|
|
|
241
328
|
*/
|
|
242
329
|
declare function calculateEventTypeHash(eventSignature: string): string;
|
|
243
330
|
|
|
244
|
-
export { type AuthHeaders, type AuthSignatureMessage, type AuthSignatureMessageRequest, type BaseConfig, ChainId, type ContractInfo, DEBUG_NAMESPACE, DEBUG_NAMESPACE_SILENTDATA_INTERCEPTOR, DEFAULT_DELEGATE_EXPIRES, DELEGATE_EXPIRATION_THRESHOLD_BUFFER, type DelegateConfig, type DelegateHeaders, type DelegateSignerMessage, HEADER_DELEGATE, HEADER_DELEGATE_SIGNATURE, HEADER_EIP712_DELEGATE_SIGNATURE, HEADER_EIP712_SIGNATURE, HEADER_SIGNATURE, HEADER_TIMESTAMP, NetworkName, PRIVATE_EVENT_SIGNATURE, PRIVATE_EVENT_SIGNATURE_HASH, type PrivateEvent, SIGN_RPC_METHODS, SignatureType, type SilentDataProviderOptions, SilentDataRollupBase, SilentDataRollupContract, type SilentDataRollupContractConfig, type SilentdataNetworkConfig, WHITELISTED_METHODS, calculateEventTypeHash, defaultGetDelegate, delegateEIP721Types, eip721Domain, getAuthEIP721Types, getAuthHeaders, isSignableContractCall, prepareTypedDataPayload };
|
|
331
|
+
export { type AuthHeaders, type AuthSignatureMessage, type AuthSignatureMessageRequest, type BaseConfig, ChainId, type ContractInfo, DEBUG_NAMESPACE, DEBUG_NAMESPACE_SILENTDATA_INTERCEPTOR, DEFAULT_DELEGATE_EXPIRES, DEFAULT_USER_OPERATION_RECEIPT_LOOKUP_RANGE, DELEGATE_EXPIRATION_THRESHOLD_BUFFER, type DelegateConfig, type DelegateHeaders, type DelegateSignerMessage, ENTRYPOINT_ADDRESS, HEADER_DELEGATE, HEADER_DELEGATE_SIGNATURE, HEADER_EIP712_DELEGATE_SIGNATURE, HEADER_EIP712_SIGNATURE, HEADER_FROM_BLOCK, HEADER_SIGNATURE, HEADER_SIGNATURE_TYPE, HEADER_SIGNER_SWC, HEADER_TIMESTAMP, NetworkName, PRIVATE_EVENT_SIGNATURE, PRIVATE_EVENT_SIGNATURE_HASH, type PrivateEvent, SIGN_RPC_METHODS, SignatureType, type SilentDataProviderOptions, SilentDataRollupBase, SilentDataRollupContract, type SilentDataRollupContractConfig, type SilentdataNetworkConfig, USER_OPERATION_EVENT_HASH, USER_OPERATION_EVENT_SIGNATURE, WHITELISTED_METHODS, calculateEventTypeHash, defaultGetDelegate, delegateEIP721Types, eip721Domain, getAuthEIP721Types, getAuthHeaders, isSignableContractCall, prepareTypedDataPayload };
|