@aastar/paymaster 0.16.7
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/dist/core/src/abis/BLSAggregator.json +686 -0
- package/dist/core/src/abis/BLSValidator.json +42 -0
- package/dist/core/src/abis/DVTValidator.json +368 -0
- package/dist/core/src/abis/EntryPoint.json +1382 -0
- package/dist/core/src/abis/GToken.json +513 -0
- package/dist/core/src/abis/GTokenStaking.json +949 -0
- package/dist/core/src/abis/MySBT.json +1518 -0
- package/dist/core/src/abis/Paymaster.json +1143 -0
- package/dist/core/src/abis/PaymasterFactory.json +640 -0
- package/dist/core/src/abis/Registry.json +1942 -0
- package/dist/core/src/abis/ReputationSystem.json +699 -0
- package/dist/core/src/abis/SimpleAccount.json +560 -0
- package/dist/core/src/abis/SimpleAccountFactory.json +111 -0
- package/dist/core/src/abis/SuperPaymaster.json +1781 -0
- package/dist/core/src/abis/index.d.ts +1126 -0
- package/dist/core/src/abis/index.js +91 -0
- package/dist/core/src/abis/xPNTsFactory.json +718 -0
- package/dist/core/src/abis/xPNTsToken.json +1280 -0
- package/dist/core/src/actions/StateValidator.d.ts +68 -0
- package/dist/core/src/actions/StateValidator.js +187 -0
- package/dist/core/src/actions/account.d.ts +55 -0
- package/dist/core/src/actions/account.js +133 -0
- package/dist/core/src/actions/aggregator.d.ts +17 -0
- package/dist/core/src/actions/aggregator.js +31 -0
- package/dist/core/src/actions/dvt.d.ts +30 -0
- package/dist/core/src/actions/dvt.js +41 -0
- package/dist/core/src/actions/entryPoint.d.ts +90 -0
- package/dist/core/src/actions/entryPoint.js +211 -0
- package/dist/core/src/actions/factory.d.ts +215 -0
- package/dist/core/src/actions/factory.js +442 -0
- package/dist/core/src/actions/faucet.d.ts +48 -0
- package/dist/core/src/actions/faucet.js +337 -0
- package/dist/core/src/actions/gtokenExtended.d.ts +39 -0
- package/dist/core/src/actions/gtokenExtended.js +115 -0
- package/dist/core/src/actions/index.d.ts +15 -0
- package/dist/core/src/actions/index.js +17 -0
- package/dist/core/src/actions/paymasterV4.d.ts +170 -0
- package/dist/core/src/actions/paymasterV4.js +334 -0
- package/dist/core/src/actions/registry.d.ts +246 -0
- package/dist/core/src/actions/registry.js +667 -0
- package/dist/core/src/actions/reputation.d.ts +129 -0
- package/dist/core/src/actions/reputation.js +281 -0
- package/dist/core/src/actions/sbt.d.ts +191 -0
- package/dist/core/src/actions/sbt.js +533 -0
- package/dist/core/src/actions/staking.d.ts +132 -0
- package/dist/core/src/actions/staking.js +330 -0
- package/dist/core/src/actions/superPaymaster.d.ts +237 -0
- package/dist/core/src/actions/superPaymaster.js +644 -0
- package/dist/core/src/actions/tokens.d.ts +229 -0
- package/dist/core/src/actions/tokens.js +415 -0
- package/dist/core/src/branding.d.ts +30 -0
- package/dist/core/src/branding.js +30 -0
- package/dist/core/src/clients/BaseClient.d.ts +25 -0
- package/dist/core/src/clients/BaseClient.js +66 -0
- package/dist/core/src/clients/types.d.ts +60 -0
- package/dist/core/src/clients/types.js +1 -0
- package/dist/core/src/clients.d.ts +5 -0
- package/dist/core/src/clients.js +11 -0
- package/dist/core/src/communities.d.ts +52 -0
- package/dist/core/src/communities.js +73 -0
- package/dist/core/src/config/ContractConfigManager.d.ts +20 -0
- package/dist/core/src/config/ContractConfigManager.js +48 -0
- package/dist/core/src/constants.d.ts +88 -0
- package/dist/core/src/constants.js +125 -0
- package/dist/core/src/contract-addresses.d.ts +110 -0
- package/dist/core/src/contract-addresses.js +99 -0
- package/dist/core/src/contracts.d.ts +424 -0
- package/dist/core/src/contracts.js +343 -0
- package/dist/core/src/crypto/blsSigner.d.ts +64 -0
- package/dist/core/src/crypto/blsSigner.js +98 -0
- package/dist/core/src/crypto/index.d.ts +1 -0
- package/dist/core/src/crypto/index.js +1 -0
- package/dist/core/src/index.d.ts +21 -0
- package/dist/core/src/index.js +21 -0
- package/dist/core/src/networks.d.ts +127 -0
- package/dist/core/src/networks.js +118 -0
- package/dist/core/src/requirementChecker.d.ts +38 -0
- package/dist/core/src/requirementChecker.js +139 -0
- package/dist/core/src/roles.d.ts +204 -0
- package/dist/core/src/roles.js +211 -0
- package/dist/core/src/utils/validation.d.ts +24 -0
- package/dist/core/src/utils/validation.js +56 -0
- package/dist/paymaster/src/SuperPaymaster/index.d.ts +44 -0
- package/dist/paymaster/src/SuperPaymaster/index.js +133 -0
- package/dist/paymaster/src/V4/PaymasterClient.d.ts +79 -0
- package/dist/paymaster/src/V4/PaymasterClient.js +315 -0
- package/dist/paymaster/src/V4/PaymasterClient.test.d.ts +1 -0
- package/dist/paymaster/src/V4/PaymasterClient.test.js +80 -0
- package/dist/paymaster/src/V4/PaymasterOperator.d.ts +41 -0
- package/dist/paymaster/src/V4/PaymasterOperator.js +241 -0
- package/dist/paymaster/src/V4/PaymasterOperator.test.d.ts +1 -0
- package/dist/paymaster/src/V4/PaymasterOperator.test.js +66 -0
- package/dist/paymaster/src/V4/PaymasterUtils.d.ts +55 -0
- package/dist/paymaster/src/V4/PaymasterUtils.js +124 -0
- package/dist/paymaster/src/V4/PaymasterUtils.test.d.ts +1 -0
- package/dist/paymaster/src/V4/PaymasterUtils.test.js +43 -0
- package/dist/paymaster/src/V4/SuperPaymasterClient.d.ts +21 -0
- package/dist/paymaster/src/V4/SuperPaymasterClient.js +73 -0
- package/dist/paymaster/src/V4/SuperPaymasterClient.test.d.ts +1 -0
- package/dist/paymaster/src/V4/SuperPaymasterClient.test.js +53 -0
- package/dist/paymaster/src/V4/index.d.ts +4 -0
- package/dist/paymaster/src/V4/index.js +4 -0
- package/dist/paymaster/src/index.d.ts +2 -0
- package/dist/paymaster/src/index.js +4 -0
- package/package.json +26 -0
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { type Address, type PublicClient, type WalletClient, type Hex, type Hash, type Account } from 'viem';
|
|
2
|
+
export type PaymasterV4Actions = {
|
|
3
|
+
paymasterV4DepositFor: (args: {
|
|
4
|
+
user: Address;
|
|
5
|
+
token: Address;
|
|
6
|
+
amount: bigint;
|
|
7
|
+
account?: Account | Address;
|
|
8
|
+
}) => Promise<Hash>;
|
|
9
|
+
paymasterV4Withdraw: (args: {
|
|
10
|
+
token: Address;
|
|
11
|
+
amount: bigint;
|
|
12
|
+
account?: Account | Address;
|
|
13
|
+
}) => Promise<Hash>;
|
|
14
|
+
paymasterV4Balances: (args: {
|
|
15
|
+
user: Address;
|
|
16
|
+
token: Address;
|
|
17
|
+
}) => Promise<bigint>;
|
|
18
|
+
paymasterV4SetTokenPrice: (args: {
|
|
19
|
+
token: Address;
|
|
20
|
+
price: bigint;
|
|
21
|
+
account?: Account | Address;
|
|
22
|
+
}) => Promise<Hash>;
|
|
23
|
+
paymasterV4TokenPrices: (args: {
|
|
24
|
+
token: Address;
|
|
25
|
+
}) => Promise<bigint>;
|
|
26
|
+
/** @deprecated V4 uses depositFor + tokenPrices instead */
|
|
27
|
+
paymasterV4AddGasToken: (args: {
|
|
28
|
+
token: Address;
|
|
29
|
+
priceFeed: Address;
|
|
30
|
+
account?: Account | Address;
|
|
31
|
+
}) => Promise<Hash>;
|
|
32
|
+
/** @deprecated V4 uses depositFor + tokenPrices instead */
|
|
33
|
+
paymasterV4RemoveGasToken: (args: {
|
|
34
|
+
token: Address;
|
|
35
|
+
account?: Account | Address;
|
|
36
|
+
}) => Promise<Hash>;
|
|
37
|
+
/** @deprecated V4 uses depositFor + tokenPrices instead */
|
|
38
|
+
paymasterV4GetSupportedGasTokens: () => Promise<Address[]>;
|
|
39
|
+
/** @deprecated V4 uses depositFor + tokenPrices instead */
|
|
40
|
+
paymasterV4IsGasTokenSupported: (args: {
|
|
41
|
+
token: Address;
|
|
42
|
+
}) => Promise<boolean>;
|
|
43
|
+
/** @deprecated V4 does not use SBT whitelist */
|
|
44
|
+
paymasterV4AddSBT: (args: {
|
|
45
|
+
sbt: Address;
|
|
46
|
+
account?: Account | Address;
|
|
47
|
+
}) => Promise<Hash>;
|
|
48
|
+
/** @deprecated V4 does not use SBT whitelist */
|
|
49
|
+
paymasterV4RemoveSBT: (args: {
|
|
50
|
+
sbt: Address;
|
|
51
|
+
account?: Account | Address;
|
|
52
|
+
}) => Promise<Hash>;
|
|
53
|
+
/** @deprecated V4 does not use SBT whitelist */
|
|
54
|
+
paymasterV4GetSupportedSBTs: () => Promise<Address[]>;
|
|
55
|
+
/** @deprecated V4 does not use SBT whitelist */
|
|
56
|
+
paymasterV4IsSBTSupported: (args: {
|
|
57
|
+
sbt: Address;
|
|
58
|
+
}) => Promise<boolean>;
|
|
59
|
+
paymasterV4ValidatePaymasterUserOp: (args: {
|
|
60
|
+
userOp: any;
|
|
61
|
+
userOpHash: Hex;
|
|
62
|
+
maxCost: bigint;
|
|
63
|
+
}) => Promise<any>;
|
|
64
|
+
paymasterV4PostOp: (args: {
|
|
65
|
+
mode: number;
|
|
66
|
+
context: Hex;
|
|
67
|
+
actualGasCost: bigint;
|
|
68
|
+
actualUserOpFeePerGas: bigint;
|
|
69
|
+
}) => Promise<void>;
|
|
70
|
+
paymasterV4Deposit: (args: {
|
|
71
|
+
account?: Account | Address;
|
|
72
|
+
}) => Promise<Hash>;
|
|
73
|
+
paymasterV4WithdrawTo: (args: {
|
|
74
|
+
to: Address;
|
|
75
|
+
amount: bigint;
|
|
76
|
+
account?: Account | Address;
|
|
77
|
+
}) => Promise<Hash>;
|
|
78
|
+
paymasterV4AddStake: (args: {
|
|
79
|
+
unstakeDelaySec: bigint;
|
|
80
|
+
amount: bigint;
|
|
81
|
+
account?: Account | Address;
|
|
82
|
+
}) => Promise<Hash>;
|
|
83
|
+
paymasterV4UnlockPaymasterStake: (args: {
|
|
84
|
+
account?: Account | Address;
|
|
85
|
+
}) => Promise<Hash>;
|
|
86
|
+
paymasterV4WithdrawStake: (args: {
|
|
87
|
+
to: Address;
|
|
88
|
+
account?: Account | Address;
|
|
89
|
+
}) => Promise<Hash>;
|
|
90
|
+
paymasterV4GetDeposit: () => Promise<bigint>;
|
|
91
|
+
paymasterV4EntryPoint: () => Promise<Address>;
|
|
92
|
+
paymasterV4Owner: () => Promise<Address>;
|
|
93
|
+
paymasterV4TransferOwnership: (args: {
|
|
94
|
+
newOwner: Address;
|
|
95
|
+
account?: Account | Address;
|
|
96
|
+
}) => Promise<Hash>;
|
|
97
|
+
paymasterV4RenounceOwnership: (args: {
|
|
98
|
+
account?: Account | Address;
|
|
99
|
+
}) => Promise<Hash>;
|
|
100
|
+
paymasterV4Registry: () => Promise<Address>;
|
|
101
|
+
paymasterV4Treasury: () => Promise<Address>;
|
|
102
|
+
paymasterV4Paused: () => Promise<boolean>;
|
|
103
|
+
paymasterV4MaxGasCostCap: () => Promise<bigint>;
|
|
104
|
+
paymasterV4MaxEthUsdPrice: () => Promise<bigint>;
|
|
105
|
+
paymasterV4MaxGasTokens: () => Promise<bigint>;
|
|
106
|
+
paymasterV4MaxSbts: () => Promise<bigint>;
|
|
107
|
+
paymasterV4MaxServiceFee: () => Promise<bigint>;
|
|
108
|
+
paymasterV4MinEthUsdPrice: () => Promise<bigint>;
|
|
109
|
+
paymasterV4PriceStalenessThreshold: () => Promise<bigint>;
|
|
110
|
+
paymasterV4AddDeposit: (args: {
|
|
111
|
+
account?: Account | Address;
|
|
112
|
+
}) => Promise<Hash>;
|
|
113
|
+
paymasterV4UnlockStake: (args: {
|
|
114
|
+
account?: Account | Address;
|
|
115
|
+
}) => Promise<Hash>;
|
|
116
|
+
paymasterV4EthUsdPriceFeed: () => Promise<Address>;
|
|
117
|
+
paymasterV4OracleDecimals: () => Promise<number>;
|
|
118
|
+
paymasterV4TokenDecimals: (args: {
|
|
119
|
+
token: Address;
|
|
120
|
+
}) => Promise<number>;
|
|
121
|
+
paymasterV4ServiceFeeRate: () => Promise<bigint>;
|
|
122
|
+
paymasterV4CalculateCost: (args: {
|
|
123
|
+
token: Address;
|
|
124
|
+
gasCost: bigint;
|
|
125
|
+
param: any;
|
|
126
|
+
}) => Promise<bigint>;
|
|
127
|
+
paymasterV4GetRealtimeTokenCost: (args: {
|
|
128
|
+
token: Address;
|
|
129
|
+
gasCost: bigint;
|
|
130
|
+
}) => Promise<bigint>;
|
|
131
|
+
paymasterV4IsActiveInRegistry: () => Promise<boolean>;
|
|
132
|
+
paymasterV4IsRegistrySet: () => Promise<boolean>;
|
|
133
|
+
paymasterV4CachedPriceView: (args: {
|
|
134
|
+
token: Address;
|
|
135
|
+
}) => Promise<bigint>;
|
|
136
|
+
paymasterV4SetCachedPrice: (args: {
|
|
137
|
+
token: Address;
|
|
138
|
+
price: bigint;
|
|
139
|
+
account?: Account | Address;
|
|
140
|
+
}) => Promise<Hash>;
|
|
141
|
+
paymasterV4SetServiceFeeRate: (args: {
|
|
142
|
+
rate: bigint;
|
|
143
|
+
account?: Account | Address;
|
|
144
|
+
}) => Promise<Hash>;
|
|
145
|
+
paymasterV4SetMaxGasCostCap: (args: {
|
|
146
|
+
cap: bigint;
|
|
147
|
+
account?: Account | Address;
|
|
148
|
+
}) => Promise<Hash>;
|
|
149
|
+
paymasterV4SetPriceStalenessThreshold: (args: {
|
|
150
|
+
threshold: bigint;
|
|
151
|
+
account?: Account | Address;
|
|
152
|
+
}) => Promise<Hash>;
|
|
153
|
+
paymasterV4SetTreasury: (args: {
|
|
154
|
+
treasury: Address;
|
|
155
|
+
account?: Account | Address;
|
|
156
|
+
}) => Promise<Hash>;
|
|
157
|
+
paymasterV4UpdatePrice: (args: {
|
|
158
|
+
token: Address;
|
|
159
|
+
account?: Account | Address;
|
|
160
|
+
}) => Promise<Hash>;
|
|
161
|
+
paymasterV4DeactivateFromRegistry: (args: {
|
|
162
|
+
account?: Account | Address;
|
|
163
|
+
}) => Promise<Hash>;
|
|
164
|
+
paymasterV4Initialize: (args: {
|
|
165
|
+
owner: Address;
|
|
166
|
+
account?: Account | Address;
|
|
167
|
+
}) => Promise<Hash>;
|
|
168
|
+
paymasterV4Version: () => Promise<string>;
|
|
169
|
+
};
|
|
170
|
+
export declare const paymasterV4Actions: (address: Address) => (client: PublicClient | WalletClient) => PaymasterV4Actions;
|
|
@@ -0,0 +1,334 @@
|
|
|
1
|
+
import { PaymasterV4ABI } from '../abis/index.js';
|
|
2
|
+
export const paymasterV4Actions = (address) => (client) => ({
|
|
3
|
+
// === NEW: Deposit-Only Model ===
|
|
4
|
+
async paymasterV4DepositFor({ user, token, amount, account }) {
|
|
5
|
+
return client.writeContract({
|
|
6
|
+
address,
|
|
7
|
+
abi: PaymasterV4ABI,
|
|
8
|
+
functionName: 'depositFor',
|
|
9
|
+
args: [user, token, amount],
|
|
10
|
+
account: account,
|
|
11
|
+
chain: client.chain
|
|
12
|
+
});
|
|
13
|
+
},
|
|
14
|
+
async paymasterV4Withdraw({ token, amount, account }) {
|
|
15
|
+
return client.writeContract({
|
|
16
|
+
address,
|
|
17
|
+
abi: PaymasterV4ABI,
|
|
18
|
+
functionName: 'withdraw',
|
|
19
|
+
args: [token, amount],
|
|
20
|
+
account: account,
|
|
21
|
+
chain: client.chain
|
|
22
|
+
});
|
|
23
|
+
},
|
|
24
|
+
async paymasterV4Balances({ user, token }) {
|
|
25
|
+
return client.readContract({
|
|
26
|
+
address,
|
|
27
|
+
abi: PaymasterV4ABI,
|
|
28
|
+
functionName: 'balances',
|
|
29
|
+
args: [user, token]
|
|
30
|
+
});
|
|
31
|
+
},
|
|
32
|
+
async paymasterV4SetTokenPrice({ token, price, account }) {
|
|
33
|
+
return client.writeContract({
|
|
34
|
+
address,
|
|
35
|
+
abi: PaymasterV4ABI,
|
|
36
|
+
functionName: 'setTokenPrice',
|
|
37
|
+
args: [token, price],
|
|
38
|
+
account: account,
|
|
39
|
+
chain: client.chain
|
|
40
|
+
});
|
|
41
|
+
},
|
|
42
|
+
async paymasterV4TokenPrices({ token }) {
|
|
43
|
+
return client.readContract({
|
|
44
|
+
address,
|
|
45
|
+
abi: PaymasterV4ABI,
|
|
46
|
+
functionName: 'tokenPrices',
|
|
47
|
+
args: [token]
|
|
48
|
+
});
|
|
49
|
+
},
|
|
50
|
+
// === DEPRECATED: Legacy Gas Token Management ===
|
|
51
|
+
async paymasterV4AddGasToken({ token, priceFeed, account }) {
|
|
52
|
+
return client.writeContract({
|
|
53
|
+
address,
|
|
54
|
+
abi: PaymasterV4ABI,
|
|
55
|
+
functionName: 'addGasToken',
|
|
56
|
+
args: [token, priceFeed],
|
|
57
|
+
account: account,
|
|
58
|
+
chain: client.chain
|
|
59
|
+
});
|
|
60
|
+
},
|
|
61
|
+
async paymasterV4RemoveGasToken({ token, account }) {
|
|
62
|
+
return client.writeContract({
|
|
63
|
+
address,
|
|
64
|
+
abi: PaymasterV4ABI,
|
|
65
|
+
functionName: 'removeGasToken',
|
|
66
|
+
args: [token],
|
|
67
|
+
account: account,
|
|
68
|
+
chain: client.chain
|
|
69
|
+
});
|
|
70
|
+
},
|
|
71
|
+
async paymasterV4GetSupportedGasTokens() {
|
|
72
|
+
return client.readContract({
|
|
73
|
+
address,
|
|
74
|
+
abi: PaymasterV4ABI,
|
|
75
|
+
functionName: 'getSupportedGasTokens',
|
|
76
|
+
args: []
|
|
77
|
+
});
|
|
78
|
+
},
|
|
79
|
+
async paymasterV4IsGasTokenSupported({ token }) {
|
|
80
|
+
return client.readContract({
|
|
81
|
+
address,
|
|
82
|
+
abi: PaymasterV4ABI,
|
|
83
|
+
functionName: 'isGasTokenSupported',
|
|
84
|
+
args: [token]
|
|
85
|
+
});
|
|
86
|
+
},
|
|
87
|
+
// SBT Management
|
|
88
|
+
async paymasterV4AddSBT({ sbt, account }) {
|
|
89
|
+
return client.writeContract({
|
|
90
|
+
address,
|
|
91
|
+
abi: PaymasterV4ABI,
|
|
92
|
+
functionName: 'addSBT',
|
|
93
|
+
args: [sbt],
|
|
94
|
+
account: account,
|
|
95
|
+
chain: client.chain
|
|
96
|
+
});
|
|
97
|
+
},
|
|
98
|
+
async paymasterV4RemoveSBT({ sbt, account }) {
|
|
99
|
+
return client.writeContract({
|
|
100
|
+
address,
|
|
101
|
+
abi: PaymasterV4ABI,
|
|
102
|
+
functionName: 'removeSBT',
|
|
103
|
+
args: [sbt],
|
|
104
|
+
account: account,
|
|
105
|
+
chain: client.chain
|
|
106
|
+
});
|
|
107
|
+
},
|
|
108
|
+
async paymasterV4GetSupportedSBTs() {
|
|
109
|
+
return client.readContract({
|
|
110
|
+
address,
|
|
111
|
+
abi: PaymasterV4ABI,
|
|
112
|
+
functionName: 'getSupportedSBTs',
|
|
113
|
+
args: []
|
|
114
|
+
});
|
|
115
|
+
},
|
|
116
|
+
async paymasterV4IsSBTSupported({ sbt }) {
|
|
117
|
+
return client.readContract({
|
|
118
|
+
address,
|
|
119
|
+
abi: PaymasterV4ABI,
|
|
120
|
+
functionName: 'isSBTSupported',
|
|
121
|
+
args: [sbt]
|
|
122
|
+
});
|
|
123
|
+
},
|
|
124
|
+
// Validation
|
|
125
|
+
async paymasterV4ValidatePaymasterUserOp({ userOp, userOpHash, maxCost }) {
|
|
126
|
+
return client.readContract({
|
|
127
|
+
address,
|
|
128
|
+
abi: PaymasterV4ABI,
|
|
129
|
+
functionName: 'validatePaymasterUserOp',
|
|
130
|
+
args: [userOp, userOpHash, maxCost]
|
|
131
|
+
});
|
|
132
|
+
},
|
|
133
|
+
async paymasterV4PostOp({ mode, context, actualGasCost, actualUserOpFeePerGas }) {
|
|
134
|
+
throw new Error('postOp is called by EntryPoint, not directly invoked');
|
|
135
|
+
},
|
|
136
|
+
// Deposit & Withdrawal (EntryPoint accounting)
|
|
137
|
+
async paymasterV4Deposit({ account }) {
|
|
138
|
+
return client.writeContract({
|
|
139
|
+
address,
|
|
140
|
+
abi: PaymasterV4ABI,
|
|
141
|
+
functionName: 'deposit',
|
|
142
|
+
args: [],
|
|
143
|
+
account: account,
|
|
144
|
+
chain: client.chain,
|
|
145
|
+
value: 0n // Assuming non-payable or handled elsewhere if payable
|
|
146
|
+
});
|
|
147
|
+
},
|
|
148
|
+
async paymasterV4WithdrawTo({ to, amount, account }) {
|
|
149
|
+
return client.writeContract({
|
|
150
|
+
address,
|
|
151
|
+
abi: PaymasterV4ABI,
|
|
152
|
+
functionName: 'withdrawTo',
|
|
153
|
+
args: [to, amount],
|
|
154
|
+
account: account,
|
|
155
|
+
chain: client.chain
|
|
156
|
+
});
|
|
157
|
+
},
|
|
158
|
+
async paymasterV4AddStake({ unstakeDelaySec, amount, account }) {
|
|
159
|
+
return client.writeContract({
|
|
160
|
+
address,
|
|
161
|
+
abi: PaymasterV4ABI,
|
|
162
|
+
functionName: 'addStake',
|
|
163
|
+
args: [unstakeDelaySec],
|
|
164
|
+
value: amount,
|
|
165
|
+
account: account,
|
|
166
|
+
chain: client.chain
|
|
167
|
+
});
|
|
168
|
+
},
|
|
169
|
+
async paymasterV4UnlockPaymasterStake({ account }) {
|
|
170
|
+
return client.writeContract({
|
|
171
|
+
address,
|
|
172
|
+
abi: PaymasterV4ABI,
|
|
173
|
+
functionName: 'unlockStake',
|
|
174
|
+
args: [],
|
|
175
|
+
account: account,
|
|
176
|
+
chain: client.chain
|
|
177
|
+
});
|
|
178
|
+
},
|
|
179
|
+
async paymasterV4WithdrawStake({ to, account }) {
|
|
180
|
+
return client.writeContract({
|
|
181
|
+
address,
|
|
182
|
+
abi: PaymasterV4ABI,
|
|
183
|
+
functionName: 'withdrawStake',
|
|
184
|
+
args: [to],
|
|
185
|
+
account: account,
|
|
186
|
+
chain: client.chain
|
|
187
|
+
});
|
|
188
|
+
},
|
|
189
|
+
async paymasterV4GetDeposit() {
|
|
190
|
+
return client.readContract({
|
|
191
|
+
address,
|
|
192
|
+
abi: PaymasterV4ABI,
|
|
193
|
+
functionName: 'getDeposit',
|
|
194
|
+
args: []
|
|
195
|
+
});
|
|
196
|
+
},
|
|
197
|
+
// EntryPoint
|
|
198
|
+
async paymasterV4EntryPoint() {
|
|
199
|
+
return client.readContract({
|
|
200
|
+
address,
|
|
201
|
+
abi: PaymasterV4ABI,
|
|
202
|
+
functionName: 'entryPoint',
|
|
203
|
+
args: []
|
|
204
|
+
});
|
|
205
|
+
},
|
|
206
|
+
// Ownership
|
|
207
|
+
async paymasterV4Owner() {
|
|
208
|
+
return client.readContract({
|
|
209
|
+
address,
|
|
210
|
+
abi: PaymasterV4ABI,
|
|
211
|
+
functionName: 'owner',
|
|
212
|
+
args: []
|
|
213
|
+
});
|
|
214
|
+
},
|
|
215
|
+
async paymasterV4TransferOwnership({ newOwner, account }) {
|
|
216
|
+
return client.writeContract({
|
|
217
|
+
address,
|
|
218
|
+
abi: PaymasterV4ABI,
|
|
219
|
+
functionName: 'transferOwnership',
|
|
220
|
+
args: [newOwner],
|
|
221
|
+
account: account,
|
|
222
|
+
chain: client.chain
|
|
223
|
+
});
|
|
224
|
+
},
|
|
225
|
+
async paymasterV4RenounceOwnership({ account }) {
|
|
226
|
+
return client.writeContract({
|
|
227
|
+
address,
|
|
228
|
+
abi: PaymasterV4ABI,
|
|
229
|
+
functionName: 'renounceOwnership',
|
|
230
|
+
args: [],
|
|
231
|
+
account: account,
|
|
232
|
+
chain: client.chain
|
|
233
|
+
});
|
|
234
|
+
},
|
|
235
|
+
// View Functions & Constants
|
|
236
|
+
async paymasterV4Registry() {
|
|
237
|
+
return client.readContract({ address, abi: PaymasterV4ABI, functionName: 'registry', args: [] });
|
|
238
|
+
},
|
|
239
|
+
async paymasterV4Treasury() {
|
|
240
|
+
return client.readContract({ address, abi: PaymasterV4ABI, functionName: 'treasury', args: [] });
|
|
241
|
+
},
|
|
242
|
+
async paymasterV4Paused() {
|
|
243
|
+
return client.readContract({ address, abi: PaymasterV4ABI, functionName: 'paused', args: [] });
|
|
244
|
+
},
|
|
245
|
+
async paymasterV4MaxGasCostCap() {
|
|
246
|
+
return client.readContract({ address, abi: PaymasterV4ABI, functionName: 'maxGasCostCap', args: [] });
|
|
247
|
+
},
|
|
248
|
+
async paymasterV4MaxEthUsdPrice() {
|
|
249
|
+
return client.readContract({ address, abi: PaymasterV4ABI, functionName: 'MAX_ETH_USD_PRICE', args: [] });
|
|
250
|
+
},
|
|
251
|
+
async paymasterV4MaxGasTokens() {
|
|
252
|
+
return client.readContract({ address, abi: PaymasterV4ABI, functionName: 'MAX_GAS_TOKENS', args: [] });
|
|
253
|
+
},
|
|
254
|
+
async paymasterV4MaxSbts() {
|
|
255
|
+
return client.readContract({ address, abi: PaymasterV4ABI, functionName: 'MAX_SBTS', args: [] });
|
|
256
|
+
},
|
|
257
|
+
async paymasterV4MaxServiceFee() {
|
|
258
|
+
return client.readContract({ address, abi: PaymasterV4ABI, functionName: 'MAX_SERVICE_FEE', args: [] });
|
|
259
|
+
},
|
|
260
|
+
async paymasterV4MinEthUsdPrice() {
|
|
261
|
+
return client.readContract({ address, abi: PaymasterV4ABI, functionName: 'MIN_ETH_USD_PRICE', args: [] });
|
|
262
|
+
},
|
|
263
|
+
async paymasterV4PriceStalenessThreshold() {
|
|
264
|
+
return client.readContract({ address, abi: PaymasterV4ABI, functionName: 'priceStalenessThreshold', args: [] });
|
|
265
|
+
},
|
|
266
|
+
// Aliases
|
|
267
|
+
async paymasterV4AddDeposit(args) {
|
|
268
|
+
return this.paymasterV4Deposit(args);
|
|
269
|
+
},
|
|
270
|
+
async paymasterV4UnlockStake(args) {
|
|
271
|
+
return this.paymasterV4UnlockPaymasterStake(args);
|
|
272
|
+
},
|
|
273
|
+
// View Functions & Constants (Missing)
|
|
274
|
+
async paymasterV4EthUsdPriceFeed() {
|
|
275
|
+
return client.readContract({ address, abi: PaymasterV4ABI, functionName: 'ethUsdPriceFeed', args: [] });
|
|
276
|
+
},
|
|
277
|
+
async paymasterV4OracleDecimals() {
|
|
278
|
+
return client.readContract({ address, abi: PaymasterV4ABI, functionName: 'oracleDecimals', args: [] });
|
|
279
|
+
},
|
|
280
|
+
async paymasterV4TokenDecimals({ token }) {
|
|
281
|
+
return client.readContract({ address, abi: PaymasterV4ABI, functionName: 'tokenDecimals', args: [token] });
|
|
282
|
+
},
|
|
283
|
+
async paymasterV4ServiceFeeRate() {
|
|
284
|
+
return client.readContract({ address, abi: PaymasterV4ABI, functionName: 'serviceFeeRate', args: [] });
|
|
285
|
+
},
|
|
286
|
+
async paymasterV4CalculateCost({ token, gasCost, param }) {
|
|
287
|
+
return client.readContract({ address, abi: PaymasterV4ABI, functionName: 'calculateCost', args: [token, gasCost, param] });
|
|
288
|
+
},
|
|
289
|
+
async paymasterV4GetRealtimeTokenCost({ token, gasCost }) {
|
|
290
|
+
return client.readContract({ address, abi: PaymasterV4ABI, functionName: 'getRealtimeTokenCost', args: [token, gasCost] });
|
|
291
|
+
},
|
|
292
|
+
async paymasterV4IsActiveInRegistry() {
|
|
293
|
+
return client.readContract({ address, abi: PaymasterV4ABI, functionName: 'isActiveInRegistry', args: [] });
|
|
294
|
+
},
|
|
295
|
+
async paymasterV4IsRegistrySet() {
|
|
296
|
+
return client.readContract({ address, abi: PaymasterV4ABI, functionName: 'isRegistrySet', args: [] });
|
|
297
|
+
},
|
|
298
|
+
async paymasterV4CachedPriceView({ token }) {
|
|
299
|
+
return client.readContract({ address, abi: PaymasterV4ABI, functionName: 'cachedPrice', args: [token] });
|
|
300
|
+
},
|
|
301
|
+
// Admin (Missing)
|
|
302
|
+
async paymasterV4SetCachedPrice({ token, price, account }) {
|
|
303
|
+
return client.writeContract({ address, abi: PaymasterV4ABI, functionName: 'setCachedPrice', args: [token, price], account: account, chain: client.chain });
|
|
304
|
+
},
|
|
305
|
+
async paymasterV4SetServiceFeeRate({ rate, account }) {
|
|
306
|
+
return client.writeContract({ address, abi: PaymasterV4ABI, functionName: 'setServiceFeeRate', args: [rate], account: account, chain: client.chain });
|
|
307
|
+
},
|
|
308
|
+
async paymasterV4SetMaxGasCostCap({ cap, account }) {
|
|
309
|
+
return client.writeContract({ address, abi: PaymasterV4ABI, functionName: 'setMaxGasCostCap', args: [cap], account: account, chain: client.chain });
|
|
310
|
+
},
|
|
311
|
+
async paymasterV4SetPriceStalenessThreshold({ threshold, account }) {
|
|
312
|
+
return client.writeContract({ address, abi: PaymasterV4ABI, functionName: 'setPriceStalenessThreshold', args: [threshold], account: account, chain: client.chain });
|
|
313
|
+
},
|
|
314
|
+
async paymasterV4SetTreasury({ treasury, account }) {
|
|
315
|
+
return client.writeContract({ address, abi: PaymasterV4ABI, functionName: 'setTreasury', args: [treasury], account: account, chain: client.chain });
|
|
316
|
+
},
|
|
317
|
+
async paymasterV4UpdatePrice({ token, account }) {
|
|
318
|
+
return client.writeContract({ address, abi: PaymasterV4ABI, functionName: 'updatePrice', args: [token], account: account, chain: client.chain });
|
|
319
|
+
},
|
|
320
|
+
async paymasterV4DeactivateFromRegistry({ account }) {
|
|
321
|
+
return client.writeContract({ address, abi: PaymasterV4ABI, functionName: 'deactivateFromRegistry', args: [], account: account, chain: client.chain });
|
|
322
|
+
},
|
|
323
|
+
async paymasterV4Initialize({ owner, account }) {
|
|
324
|
+
return client.writeContract({ address, abi: PaymasterV4ABI, functionName: 'initialize', args: [owner], account: account, chain: client.chain });
|
|
325
|
+
},
|
|
326
|
+
async paymasterV4Version() {
|
|
327
|
+
return client.readContract({
|
|
328
|
+
address,
|
|
329
|
+
abi: PaymasterV4ABI,
|
|
330
|
+
functionName: 'version',
|
|
331
|
+
args: []
|
|
332
|
+
});
|
|
333
|
+
}
|
|
334
|
+
});
|