@aastar/sdk 0.20.8 → 0.20.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/dist/BaseClient-CkBhQ1ou.d.cts +88 -0
- package/dist/UserClient-2J6XMTNV.cjs +15 -0
- package/dist/UserClient-2J6XMTNV.cjs.map +1 -0
- package/dist/account.cjs +31 -0
- package/dist/account.cjs.map +1 -0
- package/dist/account.d.cts +48 -0
- package/dist/admin.cjs +15 -0
- package/dist/admin.cjs.map +1 -0
- package/dist/admin.d.cts +62 -0
- package/dist/airaccount.cjs +452 -0
- package/dist/airaccount.cjs.map +1 -0
- package/dist/airaccount.d.cts +4 -0
- package/dist/channel-CkRRbzT8.d.cts +77 -0
- package/dist/channel.cjs +27 -0
- package/dist/channel.cjs.map +1 -0
- package/dist/channel.d.cts +64 -0
- package/dist/chunk-2RCJBWPO.cjs +1168 -0
- package/dist/chunk-2RCJBWPO.cjs.map +1 -0
- package/dist/chunk-FTJD2DWE.cjs +42472 -0
- package/dist/chunk-FTJD2DWE.cjs.map +1 -0
- package/dist/chunk-GRDC6ZRA.cjs +118 -0
- package/dist/chunk-GRDC6ZRA.cjs.map +1 -0
- package/dist/chunk-GX7NROST.cjs +421 -0
- package/dist/chunk-GX7NROST.cjs.map +1 -0
- package/dist/chunk-HSVQIFIK.cjs +128 -0
- package/dist/chunk-HSVQIFIK.cjs.map +1 -0
- package/dist/chunk-JTWY2XEG.cjs +115 -0
- package/dist/chunk-JTWY2XEG.cjs.map +1 -0
- package/dist/chunk-MRREGCWN.cjs +585 -0
- package/dist/chunk-MRREGCWN.cjs.map +1 -0
- package/dist/chunk-NT26BDGN.cjs +228 -0
- package/dist/chunk-NT26BDGN.cjs.map +1 -0
- package/dist/chunk-Q7SFCCGT.cjs +11 -0
- package/dist/chunk-Q7SFCCGT.cjs.map +1 -0
- package/dist/chunk-QLF7N6H7.cjs +448 -0
- package/dist/chunk-QLF7N6H7.cjs.map +1 -0
- package/dist/chunk-RNHSA3LO.cjs +108 -0
- package/dist/chunk-RNHSA3LO.cjs.map +1 -0
- package/dist/chunk-S5IKOOUR.cjs +393 -0
- package/dist/chunk-S5IKOOUR.cjs.map +1 -0
- package/dist/chunk-TFLZETWB.cjs +4693 -0
- package/dist/chunk-TFLZETWB.cjs.map +1 -0
- package/dist/chunk-WQREDGUF.cjs +435 -0
- package/dist/chunk-WQREDGUF.cjs.map +1 -0
- package/dist/chunk-XQROKLZI.cjs +4521 -0
- package/dist/chunk-XQROKLZI.cjs.map +1 -0
- package/dist/contract-addresses-TANQ5DLX.cjs +49 -0
- package/dist/contract-addresses-TANQ5DLX.cjs.map +1 -0
- package/dist/core.cjs +894 -0
- package/dist/core.cjs.map +1 -0
- package/dist/core.d.cts +6930 -0
- package/dist/dapp.cjs +289 -0
- package/dist/dapp.cjs.map +1 -0
- package/dist/dapp.d.cts +127 -0
- package/dist/doc-types-471vSmPO.d.cts +16 -0
- package/dist/enduser.cjs +24 -0
- package/dist/enduser.cjs.map +1 -0
- package/dist/enduser.d.cts +261 -0
- package/dist/identity.cjs +23 -0
- package/dist/identity.cjs.map +1 -0
- package/dist/identity.d.cts +81 -0
- package/dist/index-B6SfEQxo.d.cts +47 -0
- package/dist/index.cjs +2814 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +656 -0
- package/dist/kms.cjs +452 -0
- package/dist/kms.cjs.map +1 -0
- package/dist/kms.d.cts +3054 -0
- package/dist/lib-FE4GR7TO.cjs +1865 -0
- package/dist/lib-FE4GR7TO.cjs.map +1 -0
- package/dist/operator.cjs +27 -0
- package/dist/operator.cjs.map +1 -0
- package/dist/operator.d.cts +164 -0
- package/dist/paymaster.cjs +63 -0
- package/dist/paymaster.cjs.map +1 -0
- package/dist/paymaster.d.cts +312 -0
- package/dist/src-ENPA7D2S.cjs +63 -0
- package/dist/src-ENPA7D2S.cjs.map +1 -0
- package/dist/src-TQKEO2I4.cjs +894 -0
- package/dist/src-TQKEO2I4.cjs.map +1 -0
- package/dist/tier-router-DeeVg69O.d.cts +370 -0
- package/dist/tokens.cjs +15 -0
- package/dist/tokens.cjs.map +1 -0
- package/dist/tokens.d.cts +64 -0
- package/dist/x402.cjs +103 -0
- package/dist/x402.cjs.map +1 -0
- package/dist/x402.d.cts +373 -0
- package/package.json +32 -32
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunkMRREGCWN_cjs = require('./chunk-MRREGCWN.cjs');
|
|
4
|
+
require('./chunk-FTJD2DWE.cjs');
|
|
5
|
+
require('./chunk-S5IKOOUR.cjs');
|
|
6
|
+
require('./chunk-Q7SFCCGT.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
Object.defineProperty(exports, "OperatorLifecycle", {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () { return chunkMRREGCWN_cjs.OperatorLifecycle; }
|
|
13
|
+
});
|
|
14
|
+
Object.defineProperty(exports, "PaymasterOperatorClient", {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () { return chunkMRREGCWN_cjs.PaymasterOperatorClient; }
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "ProposalState", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () { return chunkMRREGCWN_cjs.ProposalState; }
|
|
21
|
+
});
|
|
22
|
+
Object.defineProperty(exports, "ProtocolClient", {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
get: function () { return chunkMRREGCWN_cjs.ProtocolClient; }
|
|
25
|
+
});
|
|
26
|
+
//# sourceMappingURL=operator.cjs.map
|
|
27
|
+
//# sourceMappingURL=operator.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"operator.cjs"}
|
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
import { Address, Hash, Hex } from 'viem';
|
|
2
|
+
import { C as ClientConfig, a as BaseClient, T as TransactionOptions } from './BaseClient-CkBhQ1ou.cjs';
|
|
3
|
+
import './doc-types-471vSmPO.cjs';
|
|
4
|
+
|
|
5
|
+
interface OperatorClientConfig extends ClientConfig {
|
|
6
|
+
superPaymasterAddress: Address;
|
|
7
|
+
tokenAddress?: Address;
|
|
8
|
+
}
|
|
9
|
+
interface SponsorshipPolicy {
|
|
10
|
+
globalLimit: bigint;
|
|
11
|
+
userLimit: bigint;
|
|
12
|
+
itemPrice: bigint;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* Client for Paymaster Operators (ROLE_PAYMASTER_SUPER)
|
|
16
|
+
*/
|
|
17
|
+
declare class PaymasterOperatorClient extends BaseClient {
|
|
18
|
+
superPaymasterAddress: Address;
|
|
19
|
+
tokenAddress?: Address;
|
|
20
|
+
ethUsdPriceFeed: Address;
|
|
21
|
+
xpntsFactory: Address;
|
|
22
|
+
constructor(config: OperatorClientConfig);
|
|
23
|
+
/**
|
|
24
|
+
* Register as SuperPaymaster Operator (one-stop API).
|
|
25
|
+
* This method handles all necessary steps:
|
|
26
|
+
* 1. Checks prerequisites (must have ROLE_COMMUNITY)
|
|
27
|
+
* 2. Checks and approves GToken to GTokenStaking
|
|
28
|
+
* 3. Registers ROLE_PAYMASTER_SUPER
|
|
29
|
+
* 4. Optionally deposits collateral to SuperPaymaster
|
|
30
|
+
*
|
|
31
|
+
* @param params Registration parameters
|
|
32
|
+
* @param options Transaction options
|
|
33
|
+
* @returns Transaction hash of role registration
|
|
34
|
+
*/
|
|
35
|
+
registerAsSuperPaymasterOperator(params?: {
|
|
36
|
+
stakeAmount?: bigint;
|
|
37
|
+
depositAmount?: bigint;
|
|
38
|
+
}, options?: TransactionOptions): Promise<Hash>;
|
|
39
|
+
/**
|
|
40
|
+
* Deploy a new Paymaster V4 and Register as AOA Operator (one-stop API).
|
|
41
|
+
* This method handles:
|
|
42
|
+
* 1. Checks prerequisites (ROLE_COMMUNITY)
|
|
43
|
+
* 2. Predicts new Paymaster address
|
|
44
|
+
* 3. Deploys Paymaster V4 via Factory
|
|
45
|
+
* 4. Registers ROLE_PAYMASTER_AOA with staking
|
|
46
|
+
*
|
|
47
|
+
* @param params Deployment parameters
|
|
48
|
+
* @param options Transaction options
|
|
49
|
+
* @returns Object containing new paymaster address and transaction hashes
|
|
50
|
+
*/
|
|
51
|
+
deployAndRegisterPaymasterV4(params?: {
|
|
52
|
+
stakeAmount?: bigint;
|
|
53
|
+
version?: string;
|
|
54
|
+
salt?: bigint;
|
|
55
|
+
priceFeed?: Address;
|
|
56
|
+
}, options?: TransactionOptions): Promise<{
|
|
57
|
+
paymasterAddress: Address;
|
|
58
|
+
deployHash: Hash;
|
|
59
|
+
registerHash: Hash;
|
|
60
|
+
}>;
|
|
61
|
+
/**
|
|
62
|
+
* Deposit collateral (aPNTs/GToken) to SuperPaymaster.
|
|
63
|
+
* This is a helper method used by registerAsSuperPaymasterOperator.
|
|
64
|
+
*/
|
|
65
|
+
depositCollateral(amount: bigint, options?: TransactionOptions): Promise<Hash>;
|
|
66
|
+
/**
|
|
67
|
+
* Configure operator parameters (Token, Treasury).
|
|
68
|
+
* Exchange rate is now read live from xPNTsToken.exchangeRate() at runtime.
|
|
69
|
+
* If parameters are undefined, existing values are preserved.
|
|
70
|
+
*/
|
|
71
|
+
configureOperator(xPNTsToken?: Address, treasury?: Address, options?: TransactionOptions): Promise<Hash>;
|
|
72
|
+
withdrawCollateral(to: Address, amount: bigint, options?: TransactionOptions): Promise<Hash>;
|
|
73
|
+
isOperator(operator: Address): Promise<boolean>;
|
|
74
|
+
getOperatorDetails(operator?: Address): Promise<any>;
|
|
75
|
+
initiateExit(options?: TransactionOptions): Promise<Hash>;
|
|
76
|
+
withdrawStake(to: Address, options?: TransactionOptions): Promise<Hash>;
|
|
77
|
+
addGasToken(token: Address, price: bigint, options?: TransactionOptions): Promise<Hash>;
|
|
78
|
+
getTokenPrice(token: Address): Promise<bigint>;
|
|
79
|
+
setupPaymasterDeposit(params: {
|
|
80
|
+
paymaster: Address;
|
|
81
|
+
user: Address;
|
|
82
|
+
token: Address;
|
|
83
|
+
amount: bigint;
|
|
84
|
+
}, options?: TransactionOptions): Promise<Hash>;
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
interface ProtocolClientConfig extends ClientConfig {
|
|
88
|
+
dvtValidatorAddress: Address;
|
|
89
|
+
blsAggregatorAddress?: Address;
|
|
90
|
+
superPaymasterAddress?: Address;
|
|
91
|
+
}
|
|
92
|
+
declare enum ProposalState {
|
|
93
|
+
Pending = 0,
|
|
94
|
+
Active = 1,
|
|
95
|
+
Canceled = 2,
|
|
96
|
+
Defeated = 3,
|
|
97
|
+
Succeeded = 4,
|
|
98
|
+
Queued = 5,
|
|
99
|
+
Expired = 6,
|
|
100
|
+
Executed = 7
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Client for Protocol Governors and Validators (Infrastructure)
|
|
104
|
+
*/
|
|
105
|
+
declare class ProtocolClient extends BaseClient {
|
|
106
|
+
dvtValidatorAddress: Address;
|
|
107
|
+
blsAggregatorAddress?: Address;
|
|
108
|
+
superPaymasterAddress?: Address;
|
|
109
|
+
constructor(config: ProtocolClientConfig);
|
|
110
|
+
/**
|
|
111
|
+
* Create a new proposal
|
|
112
|
+
*/
|
|
113
|
+
createProposal(target: Address, calldata: Hex, description: string, options?: TransactionOptions): Promise<Hash>;
|
|
114
|
+
signProposal(proposalId: bigint, signature?: Hex, options?: TransactionOptions): Promise<Hash>;
|
|
115
|
+
/**
|
|
116
|
+
* Execute a proposal with collected signatures
|
|
117
|
+
*/
|
|
118
|
+
executeWithProof(proposalId: bigint, signatures: Hex[], options?: TransactionOptions): Promise<Hash>;
|
|
119
|
+
registerBLSKey(publicKey: Hex, options?: TransactionOptions): Promise<Hash>;
|
|
120
|
+
setProtocolFee(bps: bigint, options?: TransactionOptions): Promise<Hash>;
|
|
121
|
+
setTreasury(treasury: Address, options?: TransactionOptions): Promise<Hash>;
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
interface OperatorStatus {
|
|
125
|
+
isConfigured: boolean;
|
|
126
|
+
isActive: boolean;
|
|
127
|
+
balance: bigint;
|
|
128
|
+
}
|
|
129
|
+
/**
|
|
130
|
+
* OperatorLifecycle - L3 Pattern
|
|
131
|
+
*
|
|
132
|
+
* Responsibilities:
|
|
133
|
+
* 1. Managing the complete lifecycle of a Paymaster Operator
|
|
134
|
+
* 2. Unifying setup (onboard), operation (config), and exit (withdraw)
|
|
135
|
+
*/
|
|
136
|
+
declare class OperatorLifecycle extends PaymasterOperatorClient {
|
|
137
|
+
constructor(config: OperatorClientConfig);
|
|
138
|
+
/**
|
|
139
|
+
* Check if the account is ready to become an operator
|
|
140
|
+
* (e.g., has GToken, has ROLE_COMMUNITY, etc.)
|
|
141
|
+
*/
|
|
142
|
+
checkReadiness(): Promise<OperatorStatus>;
|
|
143
|
+
/**
|
|
144
|
+
* One-click Setup: Register + Deposit + Deploy Node
|
|
145
|
+
* Wraps existing registerAsSuperPaymasterOperator or deployAndRegisterPaymasterV4
|
|
146
|
+
*/
|
|
147
|
+
setupNode(params: {
|
|
148
|
+
type: 'V4' | 'SUPER';
|
|
149
|
+
stakeAmount?: bigint;
|
|
150
|
+
depositAmount?: bigint;
|
|
151
|
+
}, options?: TransactionOptions): Promise<Hash[]>;
|
|
152
|
+
getOperatorStats(): Promise<any>;
|
|
153
|
+
/**
|
|
154
|
+
* Start the exit process: Unstake from Registry/SuperPaymaster and Unlock funds
|
|
155
|
+
*/
|
|
156
|
+
initiateExit(options?: TransactionOptions): Promise<Hash>;
|
|
157
|
+
/**
|
|
158
|
+
* Finalize exit: Withdraw all funds (Collateral + Rewards)
|
|
159
|
+
*/
|
|
160
|
+
withdrawAllFunds(to?: Address, options?: TransactionOptions): Promise<Hash[]>;
|
|
161
|
+
private getTokenBalance;
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
export { type OperatorClientConfig, OperatorLifecycle, type OperatorStatus, PaymasterOperatorClient, ProposalState, ProtocolClient, type ProtocolClientConfig, type SponsorshipPolicy };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunk2RCJBWPO_cjs = require('./chunk-2RCJBWPO.cjs');
|
|
4
|
+
require('./chunk-FTJD2DWE.cjs');
|
|
5
|
+
require('./chunk-S5IKOOUR.cjs');
|
|
6
|
+
require('./chunk-Q7SFCCGT.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
Object.defineProperty(exports, "PaymasterClient", {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () { return chunk2RCJBWPO_cjs.PaymasterClient; }
|
|
13
|
+
});
|
|
14
|
+
Object.defineProperty(exports, "PaymasterManager", {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () { return chunk2RCJBWPO_cjs.PaymasterManager; }
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "PaymasterOperator", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () { return chunk2RCJBWPO_cjs.PaymasterOperator; }
|
|
21
|
+
});
|
|
22
|
+
Object.defineProperty(exports, "SuperPaymasterAdminClient", {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
get: function () { return chunk2RCJBWPO_cjs.SuperPaymasterAdminClient; }
|
|
25
|
+
});
|
|
26
|
+
Object.defineProperty(exports, "SuperPaymasterClient", {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
get: function () { return chunk2RCJBWPO_cjs.SuperPaymasterClient; }
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "buildPaymasterData", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () { return chunk2RCJBWPO_cjs.buildPaymasterData; }
|
|
33
|
+
});
|
|
34
|
+
Object.defineProperty(exports, "buildSuperPaymasterData", {
|
|
35
|
+
enumerable: true,
|
|
36
|
+
get: function () { return chunk2RCJBWPO_cjs.buildSuperPaymasterData; }
|
|
37
|
+
});
|
|
38
|
+
Object.defineProperty(exports, "checkEligibility", {
|
|
39
|
+
enumerable: true,
|
|
40
|
+
get: function () { return chunk2RCJBWPO_cjs.checkEligibility; }
|
|
41
|
+
});
|
|
42
|
+
Object.defineProperty(exports, "formatUserOpV07", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function () { return chunk2RCJBWPO_cjs.formatUserOpV07; }
|
|
45
|
+
});
|
|
46
|
+
Object.defineProperty(exports, "getPaymasterV4Middleware", {
|
|
47
|
+
enumerable: true,
|
|
48
|
+
get: function () { return chunk2RCJBWPO_cjs.getPaymasterV4Middleware; }
|
|
49
|
+
});
|
|
50
|
+
Object.defineProperty(exports, "getSuperPaymasterMiddleware", {
|
|
51
|
+
enumerable: true,
|
|
52
|
+
get: function () { return chunk2RCJBWPO_cjs.getSuperPaymasterMiddleware; }
|
|
53
|
+
});
|
|
54
|
+
Object.defineProperty(exports, "getUserOpHashV07", {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function () { return chunk2RCJBWPO_cjs.getUserOpHashV07; }
|
|
57
|
+
});
|
|
58
|
+
Object.defineProperty(exports, "tuneGasLimit", {
|
|
59
|
+
enumerable: true,
|
|
60
|
+
get: function () { return chunk2RCJBWPO_cjs.tuneGasLimit; }
|
|
61
|
+
});
|
|
62
|
+
//# sourceMappingURL=paymaster.cjs.map
|
|
63
|
+
//# sourceMappingURL=paymaster.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"paymaster.cjs"}
|
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
export { P as PaymasterConfig, S as SuperPaymasterAdminClient, c as checkEligibility, g as getSuperPaymasterMiddleware } from './index-B6SfEQxo.cjs';
|
|
2
|
+
import { Address, Hex } from 'viem';
|
|
3
|
+
|
|
4
|
+
type PaymasterV4MiddlewareConfig = {
|
|
5
|
+
paymasterAddress: Address;
|
|
6
|
+
gasToken: Address;
|
|
7
|
+
verificationGasLimit?: bigint;
|
|
8
|
+
postOpGasLimit?: bigint;
|
|
9
|
+
};
|
|
10
|
+
type GaslessReadinessReport = {
|
|
11
|
+
isReady: boolean;
|
|
12
|
+
issues: string[];
|
|
13
|
+
details: {
|
|
14
|
+
paymasterStake: bigint;
|
|
15
|
+
paymasterDeposit: bigint;
|
|
16
|
+
ethUsdPrice: bigint;
|
|
17
|
+
tokenSupported: boolean;
|
|
18
|
+
tokenPrice: bigint;
|
|
19
|
+
userTokenBalance: bigint;
|
|
20
|
+
userPaymasterDeposit: bigint;
|
|
21
|
+
};
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* Constructs the middleware for Paymaster V4.
|
|
25
|
+
* Returns the `paymasterAndData` hex string.
|
|
26
|
+
*/
|
|
27
|
+
declare function getPaymasterV4Middleware(config: PaymasterV4MiddlewareConfig): {
|
|
28
|
+
sponsorUserOperation: (args: {
|
|
29
|
+
userOperation: any;
|
|
30
|
+
}) => Promise<{
|
|
31
|
+
paymasterAndData: `0x${string}`;
|
|
32
|
+
verificationGasLimit: bigint;
|
|
33
|
+
preVerificationGas: any;
|
|
34
|
+
}>;
|
|
35
|
+
};
|
|
36
|
+
/**
|
|
37
|
+
* Build paymasterAndData for gasless UserOperation.
|
|
38
|
+
* Layout: [Paymaster(20)] [VerificationGasLimit(16)] [PostOpGasLimit(16)] [Token(20)] [ValidUntil(6)] [ValidAfter(6)]
|
|
39
|
+
*/
|
|
40
|
+
declare function buildPaymasterData(paymasterAddress: Address, token: Address, options?: {
|
|
41
|
+
validityWindow?: number;
|
|
42
|
+
verificationGasLimit?: bigint;
|
|
43
|
+
postOpGasLimit?: bigint;
|
|
44
|
+
}): `0x${string}`;
|
|
45
|
+
/**
|
|
46
|
+
* Build paymasterAndData for SuperPaymaster V3.
|
|
47
|
+
* Layout: [Paymaster(20)] [verGas(16)] [postGas(16)] [operator(20)] [maxRate(32)]
|
|
48
|
+
* Total: 104 bytes
|
|
49
|
+
*
|
|
50
|
+
* IMPORTANT: SuperPaymaster contract generates validUntil internally using:
|
|
51
|
+
* validUntil = cachedPrice.updatedAt + priceStalenessThreshold
|
|
52
|
+
* Do NOT include validUntil/validAfter in paymasterAndData!
|
|
53
|
+
*/
|
|
54
|
+
declare function buildSuperPaymasterData(paymasterAddress: Address, operator: Address, options?: {
|
|
55
|
+
verificationGasLimit?: bigint;
|
|
56
|
+
postOpGasLimit?: bigint;
|
|
57
|
+
maxRate?: bigint;
|
|
58
|
+
}): `0x${string}`;
|
|
59
|
+
/**
|
|
60
|
+
* Helper to format UserOp for Alchemy/Standard Bundlers (v0.7 Decomposed)
|
|
61
|
+
*/
|
|
62
|
+
declare function formatUserOpV07(userOp: any): any;
|
|
63
|
+
declare function getUserOpHashV07(userOp: any, entryPoint: Address, chainId: bigint): Hex;
|
|
64
|
+
/**
|
|
65
|
+
* Tune gas limit using a dynamic nominal ceiling to satisfy Bundler efficiency (0.4)
|
|
66
|
+
* Target: Actual / Limit >= targetEfficiency
|
|
67
|
+
*/
|
|
68
|
+
declare function tuneGasLimit(estimate: bigint, nominalActual: bigint, targetEfficiency?: number): bigint;
|
|
69
|
+
|
|
70
|
+
/**
|
|
71
|
+
* PaymasterClient
|
|
72
|
+
* Focus: Integration, Funding, Interaction.
|
|
73
|
+
*/
|
|
74
|
+
declare class PaymasterClient {
|
|
75
|
+
/**
|
|
76
|
+
* @private
|
|
77
|
+
* Static utility class, should not be instantiated.
|
|
78
|
+
*/
|
|
79
|
+
private constructor();
|
|
80
|
+
private static makePlaceholderSignature;
|
|
81
|
+
private static estimatePreVerificationGasV07;
|
|
82
|
+
/**
|
|
83
|
+
* Get user's deposited balance on the Paymaster.
|
|
84
|
+
*/
|
|
85
|
+
static getDepositedBalance(publicClient: any, address: Address, user: Address, token: Address): Promise<bigint>;
|
|
86
|
+
/**
|
|
87
|
+
* Deposit tokens to Paymaster for a user (enables gasless transactions).
|
|
88
|
+
*/
|
|
89
|
+
static depositFor(wallet: any, address: Address, user: Address, token: Address, amount: bigint): Promise<any>;
|
|
90
|
+
/**
|
|
91
|
+
* Approve the Paymaster (or any spender) to spend gas tokens.
|
|
92
|
+
*/
|
|
93
|
+
static approveGasToken(wallet: any, token: Address, spender: Address, amount: bigint): Promise<any>;
|
|
94
|
+
/**
|
|
95
|
+
* Estimate Gas for a UserOperation.
|
|
96
|
+
*/
|
|
97
|
+
static estimateUserOperationGas(client: any, wallet: any, aaAddress: Address, entryPoint: Address, paymasterAddress: Address, token: Address, bundlerUrl: string, callData: `0x${string}`, options?: {
|
|
98
|
+
validityWindow?: number;
|
|
99
|
+
operator?: Address;
|
|
100
|
+
factory?: Address;
|
|
101
|
+
factoryData?: Hex;
|
|
102
|
+
}): Promise<{
|
|
103
|
+
preVerificationGas: bigint;
|
|
104
|
+
verificationGasLimit: bigint;
|
|
105
|
+
callGasLimit: bigint;
|
|
106
|
+
paymasterVerificationGasLimit: bigint;
|
|
107
|
+
paymasterPostOpGasLimit: bigint;
|
|
108
|
+
}>;
|
|
109
|
+
/**
|
|
110
|
+
* High-level API to submit a gasless UserOperation.
|
|
111
|
+
* Automatically handles nonce fetching, gas estimation (if not provided), signing, and submission.
|
|
112
|
+
*/
|
|
113
|
+
static submitGaslessUserOperation(client: any, wallet: any, aaAddress: Address, entryPoint: Address, paymasterAddress: Address, token: Address, bundlerUrl: string, callData: `0x${string}`, options?: {
|
|
114
|
+
validityWindow?: number;
|
|
115
|
+
verificationGasLimit?: bigint;
|
|
116
|
+
callGasLimit?: bigint;
|
|
117
|
+
preVerificationGas?: bigint;
|
|
118
|
+
maxFeePerGas?: bigint;
|
|
119
|
+
maxPriorityFeePerGas?: bigint;
|
|
120
|
+
autoEstimate?: boolean;
|
|
121
|
+
operator?: Address;
|
|
122
|
+
paymasterVerificationGasLimit?: bigint;
|
|
123
|
+
paymasterPostOpGasLimit?: bigint;
|
|
124
|
+
factory?: Address;
|
|
125
|
+
factoryData?: Hex;
|
|
126
|
+
}): Promise<`0x${string}`>;
|
|
127
|
+
/**
|
|
128
|
+
* Helper to extract the actual Gas Token fee from a UserOperation receipt.
|
|
129
|
+
* Looks for the 'PostOpProcessed' event emitted by the Paymaster.
|
|
130
|
+
*/
|
|
131
|
+
static getFeeFromReceipt(receipt: any, paymasterAddress: Address): {
|
|
132
|
+
tokenCost: bigint;
|
|
133
|
+
actualGasCostWei: bigint;
|
|
134
|
+
} | null;
|
|
135
|
+
/**
|
|
136
|
+
* Get the fee for a specific transaction hash.
|
|
137
|
+
* Fetches the receipt (no scanning required) and decodes the log.
|
|
138
|
+
*/
|
|
139
|
+
static getTransactionFee(publicClient: any, txHash: `0x${string}`, paymasterAddress: Address): Promise<{
|
|
140
|
+
tokenCost: bigint;
|
|
141
|
+
actualGasCostWei: bigint;
|
|
142
|
+
} | null>;
|
|
143
|
+
/**
|
|
144
|
+
* Helper: Encode a standardized ERC-20 Transfer.
|
|
145
|
+
* Returns the raw function data: `transfer(to, amount)`
|
|
146
|
+
*/
|
|
147
|
+
static encodeTokenTransfer(recipient: Address, amount: bigint): `0x${string}`;
|
|
148
|
+
/**
|
|
149
|
+
* Helper: Encode a SimpleAccount execution.
|
|
150
|
+
* Wraps the inner call into: `execute(target, value, data)`
|
|
151
|
+
* This is the payload signed by the user.
|
|
152
|
+
*/
|
|
153
|
+
static encodeExecution(target: Address, value: bigint, data: `0x${string}`): `0x${string}`;
|
|
154
|
+
/**
|
|
155
|
+
* More robust version of waitForUserOperationReceipt.
|
|
156
|
+
* Catches timeouts and returns a cleaner result.
|
|
157
|
+
*/
|
|
158
|
+
static waitForUserOperation(bundlerClient: any, hash: `0x${string}`, timeout?: number): Promise<any>;
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* PaymasterOperator
|
|
163
|
+
* Focus: Deployment, Configuration, Maintenance, Keeper Bots.
|
|
164
|
+
*/
|
|
165
|
+
declare class PaymasterOperator {
|
|
166
|
+
/**
|
|
167
|
+
* Update the cached ETH/USD price from Chainlink Oracle.
|
|
168
|
+
* Must be called if cachedPrice is 0 (uninitialized).
|
|
169
|
+
*/
|
|
170
|
+
static updatePrice(wallet: any, address: Address): Promise<any>;
|
|
171
|
+
/**
|
|
172
|
+
* Set the token price (in 8 decimals, e.g., 1e8 = $1 USD).
|
|
173
|
+
*/
|
|
174
|
+
static setTokenPrice(wallet: any, address: Address, token: Address, priceUSD: bigint): Promise<any>;
|
|
175
|
+
static getCachedPrice(publicClient: any, address: Address): Promise<{
|
|
176
|
+
price: bigint;
|
|
177
|
+
updatedAt: bigint;
|
|
178
|
+
}>;
|
|
179
|
+
static getTokenPrice(publicClient: any, address: Address, token: Address): Promise<bigint>;
|
|
180
|
+
static getDepositedBalance(publicClient: any, address: Address, user: Address, token: Address): Promise<bigint>;
|
|
181
|
+
static ensurePriceInitialized(wallet: any, publicClient: any, address: Address): Promise<boolean>;
|
|
182
|
+
static addStake(wallet: any, address: Address, amount: bigint, unstakeDelaySec: number): Promise<any>;
|
|
183
|
+
static addDeposit(wallet: any, address: Address, amount: bigint): Promise<any>;
|
|
184
|
+
static addGasToken(wallet: any, address: Address, token: Address): Promise<any>;
|
|
185
|
+
static removeGasToken(wallet: any, address: Address, token: Address): Promise<any>;
|
|
186
|
+
static setServiceFeeRate(wallet: any, address: Address, rate: bigint): Promise<any>;
|
|
187
|
+
static setMaxGasCostCap(wallet: any, address: Address, cap: bigint): Promise<any>;
|
|
188
|
+
static withdrawPNT(wallet: any, address: Address, to: Address, token: Address, amount: bigint): Promise<any>;
|
|
189
|
+
static checkGaslessReadiness(publicClient: any, entryPoint: Address, paymasterAddress: Address, user: Address, token: Address): Promise<GaslessReadinessReport>;
|
|
190
|
+
static prepareGaslessEnvironment(operatorWallet: any, publicClient: any, entryPoint: Address, paymasterAddress: Address, token: Address, options?: {
|
|
191
|
+
minStake?: bigint;
|
|
192
|
+
minDeposit?: bigint;
|
|
193
|
+
tokenPriceUSD?: bigint;
|
|
194
|
+
}): Promise<{
|
|
195
|
+
step: string;
|
|
196
|
+
hash?: string;
|
|
197
|
+
status: string;
|
|
198
|
+
}[]>;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
type GaslessTransactionConfig = {
|
|
202
|
+
token: Address;
|
|
203
|
+
recipient: Address;
|
|
204
|
+
amount: bigint;
|
|
205
|
+
operator: Address;
|
|
206
|
+
paymasterAddress: Address;
|
|
207
|
+
factory?: Address;
|
|
208
|
+
factoryData?: Hex;
|
|
209
|
+
};
|
|
210
|
+
/**
|
|
211
|
+
* SuperPaymasterClient
|
|
212
|
+
* High-level API for SuperPaymaster operations, including dynamic gas estimation.
|
|
213
|
+
*/
|
|
214
|
+
declare class SuperPaymasterClient {
|
|
215
|
+
/**
|
|
216
|
+
* @private
|
|
217
|
+
* Static utility class, should not be instantiated.
|
|
218
|
+
*/
|
|
219
|
+
private constructor();
|
|
220
|
+
/**
|
|
221
|
+
* Submit a gasless transaction using SuperPaymaster.
|
|
222
|
+
* Automatically handles gas estimation with a smart efficiency buffer.
|
|
223
|
+
*/
|
|
224
|
+
static submitGaslessTransaction(client: any, wallet: any, aaAddress: Address, entryPoint: Address, bundlerUrl: string, config: GaslessTransactionConfig): Promise<Hex>;
|
|
225
|
+
}
|
|
226
|
+
|
|
227
|
+
/**
|
|
228
|
+
* Supported paymaster types.
|
|
229
|
+
* - 'v4' → PaymasterV4 layout (84 bytes): [paymaster(20)][verGas(16)][postGas(16)][token(20)][validUntil(6)][validAfter(6)]
|
|
230
|
+
* - 'super' → SuperPaymaster layout (104 bytes): [paymaster(20)][verGas(16)][postGas(16)][operator(20)][maxRate(32)]
|
|
231
|
+
*/
|
|
232
|
+
type PaymasterType = 'v4' | 'super';
|
|
233
|
+
/**
|
|
234
|
+
* Unified parameters for building `paymasterAndData`.
|
|
235
|
+
*
|
|
236
|
+
* The byte layout differs by paymaster type; this shape carries the union of
|
|
237
|
+
* both packers' inputs. `buildPaymasterData` validates that the fields required
|
|
238
|
+
* for the resolved type are present, and dispatches to the correct existing
|
|
239
|
+
* packer. Callers no longer need to know which format a given paymaster uses.
|
|
240
|
+
*/
|
|
241
|
+
interface BuildPaymasterDataParams {
|
|
242
|
+
/**
|
|
243
|
+
* Explicit paymaster type. Preferred over address-based heuristics.
|
|
244
|
+
* If omitted, the type is resolved from `paymasterAddress` against the
|
|
245
|
+
* manager's registered known-paymaster map (throws if unresolved).
|
|
246
|
+
*/
|
|
247
|
+
type?: PaymasterType;
|
|
248
|
+
/** Paymaster contract address (first 20 bytes of the layout). */
|
|
249
|
+
paymasterAddress: Address;
|
|
250
|
+
/** Paymaster verification gas limit (16-byte field, both layouts). */
|
|
251
|
+
verificationGasLimit?: bigint;
|
|
252
|
+
/** Paymaster postOp gas limit (16-byte field, both layouts). */
|
|
253
|
+
postOpGasLimit?: bigint;
|
|
254
|
+
/** Gas token address. Required for type 'v4'. */
|
|
255
|
+
token?: Address;
|
|
256
|
+
/** Validity window in seconds (used to compute validUntil/validAfter). 'v4' only. */
|
|
257
|
+
validityWindow?: number;
|
|
258
|
+
/** Operator address. Required for type 'super'. */
|
|
259
|
+
operator?: Address;
|
|
260
|
+
/** Optional max rate commitment (rug-pull protection). 'super' only. */
|
|
261
|
+
maxRate?: bigint;
|
|
262
|
+
}
|
|
263
|
+
/**
|
|
264
|
+
* PaymasterManager — unifies the per-type `paymasterAndData` packers behind a
|
|
265
|
+
* single `buildPaymasterData` entry point that AUTO-SELECTS the correct byte
|
|
266
|
+
* format by paymaster type.
|
|
267
|
+
*
|
|
268
|
+
* Type resolution order:
|
|
269
|
+
* 1. Explicit `params.type` (preferred — no guessing).
|
|
270
|
+
* 2. Address-based lookup against the registered known-paymaster map.
|
|
271
|
+
*
|
|
272
|
+
* The underlying packers (`buildPaymasterData` / `buildSuperPaymasterData` in
|
|
273
|
+
* PaymasterUtils) remain exported and are reused verbatim here — this class
|
|
274
|
+
* does NOT reimplement byte-packing.
|
|
275
|
+
*/
|
|
276
|
+
declare class PaymasterManager {
|
|
277
|
+
private readonly knownPaymasters;
|
|
278
|
+
constructor(opts?: {
|
|
279
|
+
knownPaymasters?: Record<string, PaymasterType>;
|
|
280
|
+
});
|
|
281
|
+
/**
|
|
282
|
+
* Register a known paymaster address → type mapping so that callers can
|
|
283
|
+
* omit the explicit `type` and have it resolved from the address.
|
|
284
|
+
*/
|
|
285
|
+
registerPaymaster(address: Address, type: PaymasterType): void;
|
|
286
|
+
/**
|
|
287
|
+
* Record an address → type mapping, throwing on a CONFLICTING re-registration.
|
|
288
|
+
* Silently overwriting a v4 address with `super` (or vice-versa) would later
|
|
289
|
+
* pack the wrong-length paymasterData for a `type`-less call, so a conflicting
|
|
290
|
+
* re-registration is treated as a programmer error. Re-registering the SAME
|
|
291
|
+
* type (including a case-variant of the address) is an idempotent no-op.
|
|
292
|
+
*/
|
|
293
|
+
private setKnownPaymaster;
|
|
294
|
+
/**
|
|
295
|
+
* Resolve a paymaster's type from a registered address. Returns undefined
|
|
296
|
+
* if the address is not registered.
|
|
297
|
+
*/
|
|
298
|
+
resolveType(address: Address): PaymasterType | undefined;
|
|
299
|
+
/**
|
|
300
|
+
* Build `paymasterAndData`, auto-selecting the correct byte layout for the
|
|
301
|
+
* paymaster type. Dispatches to the existing per-type packers.
|
|
302
|
+
*/
|
|
303
|
+
buildPaymasterData(params: BuildPaymasterDataParams): Hex;
|
|
304
|
+
/**
|
|
305
|
+
* Static helper: build `paymasterAndData` for an explicit type without an
|
|
306
|
+
* instance. Useful when the caller already knows the type.
|
|
307
|
+
*/
|
|
308
|
+
static buildPaymasterData(type: PaymasterType, params: Omit<BuildPaymasterDataParams, 'type'>): Hex;
|
|
309
|
+
private static dispatch;
|
|
310
|
+
}
|
|
311
|
+
|
|
312
|
+
export { type BuildPaymasterDataParams, type GaslessReadinessReport, type GaslessTransactionConfig, PaymasterClient, PaymasterManager, PaymasterOperator, type PaymasterType, type PaymasterV4MiddlewareConfig, SuperPaymasterClient, buildPaymasterData, buildSuperPaymasterData, formatUserOpV07, getPaymasterV4Middleware, getUserOpHashV07, tuneGasLimit };
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var chunk2RCJBWPO_cjs = require('./chunk-2RCJBWPO.cjs');
|
|
4
|
+
require('./chunk-FTJD2DWE.cjs');
|
|
5
|
+
require('./chunk-S5IKOOUR.cjs');
|
|
6
|
+
require('./chunk-Q7SFCCGT.cjs');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
Object.defineProperty(exports, "PaymasterClient", {
|
|
11
|
+
enumerable: true,
|
|
12
|
+
get: function () { return chunk2RCJBWPO_cjs.PaymasterClient; }
|
|
13
|
+
});
|
|
14
|
+
Object.defineProperty(exports, "PaymasterManager", {
|
|
15
|
+
enumerable: true,
|
|
16
|
+
get: function () { return chunk2RCJBWPO_cjs.PaymasterManager; }
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "PaymasterOperator", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () { return chunk2RCJBWPO_cjs.PaymasterOperator; }
|
|
21
|
+
});
|
|
22
|
+
Object.defineProperty(exports, "SuperPaymasterAdminClient", {
|
|
23
|
+
enumerable: true,
|
|
24
|
+
get: function () { return chunk2RCJBWPO_cjs.SuperPaymasterAdminClient; }
|
|
25
|
+
});
|
|
26
|
+
Object.defineProperty(exports, "SuperPaymasterClient", {
|
|
27
|
+
enumerable: true,
|
|
28
|
+
get: function () { return chunk2RCJBWPO_cjs.SuperPaymasterClient; }
|
|
29
|
+
});
|
|
30
|
+
Object.defineProperty(exports, "buildPaymasterData", {
|
|
31
|
+
enumerable: true,
|
|
32
|
+
get: function () { return chunk2RCJBWPO_cjs.buildPaymasterData; }
|
|
33
|
+
});
|
|
34
|
+
Object.defineProperty(exports, "buildSuperPaymasterData", {
|
|
35
|
+
enumerable: true,
|
|
36
|
+
get: function () { return chunk2RCJBWPO_cjs.buildSuperPaymasterData; }
|
|
37
|
+
});
|
|
38
|
+
Object.defineProperty(exports, "checkEligibility", {
|
|
39
|
+
enumerable: true,
|
|
40
|
+
get: function () { return chunk2RCJBWPO_cjs.checkEligibility; }
|
|
41
|
+
});
|
|
42
|
+
Object.defineProperty(exports, "formatUserOpV07", {
|
|
43
|
+
enumerable: true,
|
|
44
|
+
get: function () { return chunk2RCJBWPO_cjs.formatUserOpV07; }
|
|
45
|
+
});
|
|
46
|
+
Object.defineProperty(exports, "getPaymasterV4Middleware", {
|
|
47
|
+
enumerable: true,
|
|
48
|
+
get: function () { return chunk2RCJBWPO_cjs.getPaymasterV4Middleware; }
|
|
49
|
+
});
|
|
50
|
+
Object.defineProperty(exports, "getSuperPaymasterMiddleware", {
|
|
51
|
+
enumerable: true,
|
|
52
|
+
get: function () { return chunk2RCJBWPO_cjs.getSuperPaymasterMiddleware; }
|
|
53
|
+
});
|
|
54
|
+
Object.defineProperty(exports, "getUserOpHashV07", {
|
|
55
|
+
enumerable: true,
|
|
56
|
+
get: function () { return chunk2RCJBWPO_cjs.getUserOpHashV07; }
|
|
57
|
+
});
|
|
58
|
+
Object.defineProperty(exports, "tuneGasLimit", {
|
|
59
|
+
enumerable: true,
|
|
60
|
+
get: function () { return chunk2RCJBWPO_cjs.tuneGasLimit; }
|
|
61
|
+
});
|
|
62
|
+
//# sourceMappingURL=src-ENPA7D2S.cjs.map
|
|
63
|
+
//# sourceMappingURL=src-ENPA7D2S.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","file":"src-ENPA7D2S.cjs"}
|