-
Notifications
You must be signed in to change notification settings - Fork 68
/
Types.ts
128 lines (115 loc) · 3.55 KB
/
Types.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
export type Hex = `0x${string}`
import type { BigNumberish } from "../../account"
import type { JsonRpcError } from "../../bundler/utils/Types"
export type PaymasterServiceErrorResponse = {
jsonrpc: string
id: number
error: JsonRpcError
}
export type JsonRpcResponse = {
jsonrpc: string
id: number
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
result?: any
error?: JsonRpcError
}
export type PaymasterConfig = {
paymasterUrl: string
strictMode?: boolean
}
export type SponsorUserOperationDto = {
/** mode: sponsored or erc20 */
mode: PaymasterMode
/** Always recommended, especially when using token paymaster */
calculateGasLimits?: boolean
/** Expiry duration in seconds */
expiryDuration?: number
/** Webhooks to be fired after user op is sent */
webhookData?: Record<string, any>
/** Smart account meta data */
smartAccountInfo?: SmartAccountData
/** the fee-paying token address */
feeTokenAddress?: string
}
export type FeeQuotesOrDataDto = {
/** mode: sponsored or erc20 */
mode?: PaymasterMode
/** Expiry duration in seconds */
expiryDuration?: number
/** Always recommended, especially when using token paymaster */
calculateGasLimits?: boolean
/** List of tokens to be used for fee quotes, if ommitted fees for all supported will be returned */
tokenList?: string[]
/** preferredToken: Can be ommitted to return all quotes */
preferredToken?: string
/** Webhooks to be fired after user op is sent */
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
webhookData?: Record<string, any>
/** Smart account meta data */
smartAccountInfo?: SmartAccountData
}
export type FeeQuoteParams = {
tokenList?: string[]
preferredToken?: string
}
export type FeeTokenInfo = {
feeTokenAddress: string
}
export type SponsorpshipInfo = {
/** Webhooks to be fired after user op is sent */
// biome-ignore lint/suspicious/noExplicitAny: <explanation>
webhookData?: Record<string, any>
/** Smart account meta data */
smartAccountInfo: SmartAccountData
}
export type SmartAccountData = {
/** name: Name of the smart account */
name: string
/** version: Version of the smart account */
version: string
}
export type PaymasterFeeQuote = {
/** symbol: Token symbol */
symbol: string
/** tokenAddress: Token address */
tokenAddress: string
/** decimal: Token decimal */
decimal: number
logoUrl?: string
/** maxGasFee: in wei */
maxGasFee: number
/** maxGasFee: in dollars */
maxGasFeeUSD?: number
usdPayment?: number
/** The premium paid on the token */
premiumPercentage: number
/** validUntil: Unix timestamp */
validUntil?: number
}
export type FeeQuotesOrDataResponse = {
/** Array of results from the paymaster */
feeQuotes?: PaymasterFeeQuote[]
/** Normally set to the spender in the proceeding call to send the tx */
tokenPaymasterAddress?: Hex
/** Relevant Data returned from the paymaster */
paymasterAndData?: Uint8Array | Hex
/* Gas overhead of this UserOperation */
preVerificationGas?: BigNumberish
/* Actual gas used by the validation of this UserOperation */
verificationGasLimit?: BigNumberish
/* Value used by inner account execution */
callGasLimit?: BigNumberish
}
export type PaymasterAndDataResponse = {
paymasterAndData: Hex
/* Gas overhead of this UserOperation */
preVerificationGas: number
/* Actual gas used by the validation of this UserOperation */
verificationGasLimit: number
/* Value used by inner account execution */
callGasLimit: number
}
export enum PaymasterMode {
ERC20 = "ERC20",
SPONSORED = "SPONSORED"
}