@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,229 @@
|
|
|
1
|
+
import { type Address, type PublicClient, type WalletClient, type Hex, type Hash, type Account } from 'viem';
|
|
2
|
+
export type TokenActions = {
|
|
3
|
+
tokenTotalSupply: (args: {
|
|
4
|
+
token: Address;
|
|
5
|
+
}) => Promise<bigint>;
|
|
6
|
+
tokenBalanceOf: (args: {
|
|
7
|
+
token: Address;
|
|
8
|
+
account: Address;
|
|
9
|
+
}) => Promise<bigint>;
|
|
10
|
+
tokenCap: (args: {
|
|
11
|
+
token: Address;
|
|
12
|
+
}) => Promise<bigint>;
|
|
13
|
+
tokenRemainingMintableSupply: (args: {
|
|
14
|
+
token: Address;
|
|
15
|
+
}) => Promise<bigint>;
|
|
16
|
+
tokenTransfer: (args: {
|
|
17
|
+
token: Address;
|
|
18
|
+
to: Address;
|
|
19
|
+
amount: bigint;
|
|
20
|
+
account?: Account | Address;
|
|
21
|
+
}) => Promise<Hash>;
|
|
22
|
+
tokenTransferFrom: (args: {
|
|
23
|
+
token: Address;
|
|
24
|
+
from: Address;
|
|
25
|
+
to: Address;
|
|
26
|
+
amount: bigint;
|
|
27
|
+
account?: Account | Address;
|
|
28
|
+
}) => Promise<Hash>;
|
|
29
|
+
tokenApprove: (args: {
|
|
30
|
+
token: Address;
|
|
31
|
+
spender: Address;
|
|
32
|
+
amount: bigint;
|
|
33
|
+
account?: Account | Address;
|
|
34
|
+
}) => Promise<Hash>;
|
|
35
|
+
tokenAllowance: (args: {
|
|
36
|
+
token: Address;
|
|
37
|
+
owner: Address;
|
|
38
|
+
spender: Address;
|
|
39
|
+
}) => Promise<bigint>;
|
|
40
|
+
tokenMint: (args: {
|
|
41
|
+
token: Address;
|
|
42
|
+
to: Address;
|
|
43
|
+
amount: bigint;
|
|
44
|
+
account?: Account | Address;
|
|
45
|
+
}) => Promise<Hash>;
|
|
46
|
+
tokenBurn: (args: {
|
|
47
|
+
token: Address;
|
|
48
|
+
amount: bigint;
|
|
49
|
+
account?: Account | Address;
|
|
50
|
+
}) => Promise<Hash>;
|
|
51
|
+
tokenBurnFrom: (args: {
|
|
52
|
+
token: Address;
|
|
53
|
+
from: Address;
|
|
54
|
+
amount: bigint;
|
|
55
|
+
account?: Account | Address;
|
|
56
|
+
}) => Promise<Hash>;
|
|
57
|
+
tokenName: (args: {
|
|
58
|
+
token: Address;
|
|
59
|
+
}) => Promise<string>;
|
|
60
|
+
tokenSymbol: (args: {
|
|
61
|
+
token: Address;
|
|
62
|
+
}) => Promise<string>;
|
|
63
|
+
tokenDecimals: (args: {
|
|
64
|
+
token: Address;
|
|
65
|
+
}) => Promise<number>;
|
|
66
|
+
tokenOwner: (args: {
|
|
67
|
+
token: Address;
|
|
68
|
+
}) => Promise<Address>;
|
|
69
|
+
tokenTransferTokenOwnership: (args: {
|
|
70
|
+
token: Address;
|
|
71
|
+
newOwner: Address;
|
|
72
|
+
account?: Account | Address;
|
|
73
|
+
}) => Promise<Hash>;
|
|
74
|
+
tokenRenounceOwnership: (args: {
|
|
75
|
+
token: Address;
|
|
76
|
+
account?: Account | Address;
|
|
77
|
+
}) => Promise<Hash>;
|
|
78
|
+
tokenUpdateExchangeRate: (args: {
|
|
79
|
+
token: Address;
|
|
80
|
+
newRate: bigint;
|
|
81
|
+
account?: Account | Address;
|
|
82
|
+
}) => Promise<Hash>;
|
|
83
|
+
tokenGetDebt: (args: {
|
|
84
|
+
token: Address;
|
|
85
|
+
user: Address;
|
|
86
|
+
}) => Promise<bigint>;
|
|
87
|
+
tokenRepayDebt: (args: {
|
|
88
|
+
token: Address;
|
|
89
|
+
amount: bigint;
|
|
90
|
+
account?: Account | Address;
|
|
91
|
+
}) => Promise<Hash>;
|
|
92
|
+
tokenTransferAndCall: (args: {
|
|
93
|
+
token: Address;
|
|
94
|
+
to: Address;
|
|
95
|
+
amount: bigint;
|
|
96
|
+
data?: Hex;
|
|
97
|
+
account?: Account | Address;
|
|
98
|
+
}) => Promise<Hash>;
|
|
99
|
+
tokenAddAutoApprovedSpender: (args: {
|
|
100
|
+
token: Address;
|
|
101
|
+
spender: Address;
|
|
102
|
+
account?: Account | Address;
|
|
103
|
+
}) => Promise<Hash>;
|
|
104
|
+
tokenRemoveAutoApprovedSpender: (args: {
|
|
105
|
+
token: Address;
|
|
106
|
+
spender: Address;
|
|
107
|
+
account?: Account | Address;
|
|
108
|
+
}) => Promise<Hash>;
|
|
109
|
+
tokenIsAutoApprovedSpender: (args: {
|
|
110
|
+
token: Address;
|
|
111
|
+
spender: Address;
|
|
112
|
+
}) => Promise<boolean>;
|
|
113
|
+
tokenSUPERPAYMASTER_ADDRESS: (args: {
|
|
114
|
+
token: Address;
|
|
115
|
+
}) => Promise<Address>;
|
|
116
|
+
tokenFACTORY: (args: {
|
|
117
|
+
token: Address;
|
|
118
|
+
}) => Promise<Address>;
|
|
119
|
+
tokenTransferOwnership: (args: {
|
|
120
|
+
token: Address;
|
|
121
|
+
newOwner: Address;
|
|
122
|
+
account?: Account | Address;
|
|
123
|
+
}) => Promise<Hash>;
|
|
124
|
+
tokenTransferCommunityOwnership: (args: {
|
|
125
|
+
token: Address;
|
|
126
|
+
newOwner: Address;
|
|
127
|
+
account?: Account | Address;
|
|
128
|
+
}) => Promise<Hash>;
|
|
129
|
+
tokenCommunityName: (args: {
|
|
130
|
+
token: Address;
|
|
131
|
+
}) => Promise<string>;
|
|
132
|
+
tokenCommunityENS: (args: {
|
|
133
|
+
token: Address;
|
|
134
|
+
}) => Promise<string>;
|
|
135
|
+
tokenExchangeRate: (args: {
|
|
136
|
+
token: Address;
|
|
137
|
+
}) => Promise<bigint>;
|
|
138
|
+
tokenSpendingLimits: (args: {
|
|
139
|
+
token: Address;
|
|
140
|
+
user: Address;
|
|
141
|
+
}) => Promise<bigint>;
|
|
142
|
+
tokenDefaultSpendingLimitXPNTs: (args: {
|
|
143
|
+
token: Address;
|
|
144
|
+
}) => Promise<bigint>;
|
|
145
|
+
tokenCumulativeSpent: (args: {
|
|
146
|
+
token: Address;
|
|
147
|
+
user: Address;
|
|
148
|
+
}) => Promise<bigint>;
|
|
149
|
+
tokenDebts: (args: {
|
|
150
|
+
token: Address;
|
|
151
|
+
user: Address;
|
|
152
|
+
}) => Promise<bigint>;
|
|
153
|
+
tokenUsedOpHashes: (args: {
|
|
154
|
+
token: Address;
|
|
155
|
+
hash: Hex;
|
|
156
|
+
}) => Promise<boolean>;
|
|
157
|
+
tokenDOMAIN_SEPARATOR: (args: {
|
|
158
|
+
token: Address;
|
|
159
|
+
}) => Promise<Hex>;
|
|
160
|
+
tokenNonces: (args: {
|
|
161
|
+
token: Address;
|
|
162
|
+
owner: Address;
|
|
163
|
+
}) => Promise<bigint>;
|
|
164
|
+
tokenPermit: (args: {
|
|
165
|
+
token: Address;
|
|
166
|
+
owner: Address;
|
|
167
|
+
spender: Address;
|
|
168
|
+
value: bigint;
|
|
169
|
+
deadline: bigint;
|
|
170
|
+
v: number;
|
|
171
|
+
r: Hex;
|
|
172
|
+
s: Hex;
|
|
173
|
+
account?: Account | Address;
|
|
174
|
+
}) => Promise<Hash>;
|
|
175
|
+
tokenAutoApprovedSpenders: (args: {
|
|
176
|
+
token: Address;
|
|
177
|
+
spender: Address;
|
|
178
|
+
}) => Promise<boolean>;
|
|
179
|
+
tokenBurnFromWithOpHash: (args: {
|
|
180
|
+
token: Address;
|
|
181
|
+
account: Address;
|
|
182
|
+
amount: bigint;
|
|
183
|
+
opHash: Hex;
|
|
184
|
+
userOpAccount?: Account | Address;
|
|
185
|
+
}) => Promise<Hash>;
|
|
186
|
+
tokenCommunityOwner: (args: {
|
|
187
|
+
token: Address;
|
|
188
|
+
}) => Promise<Address>;
|
|
189
|
+
tokenEip712Domain: (args: {
|
|
190
|
+
token: Address;
|
|
191
|
+
}) => Promise<any>;
|
|
192
|
+
tokenGetDefaultSpendingLimitXPNTs: (args: {
|
|
193
|
+
token: Address;
|
|
194
|
+
}) => Promise<bigint>;
|
|
195
|
+
tokenGetMetadata: (args: {
|
|
196
|
+
token: Address;
|
|
197
|
+
}) => Promise<string>;
|
|
198
|
+
tokenNeedsApproval: (args: {
|
|
199
|
+
token: Address;
|
|
200
|
+
owner: Address;
|
|
201
|
+
spender: Address;
|
|
202
|
+
amount: bigint;
|
|
203
|
+
}) => Promise<boolean>;
|
|
204
|
+
tokenRecordDebt: (args: {
|
|
205
|
+
token: Address;
|
|
206
|
+
user: Address;
|
|
207
|
+
amount: bigint;
|
|
208
|
+
account?: Account | Address;
|
|
209
|
+
}) => Promise<Hash>;
|
|
210
|
+
tokenDEFAULT_SPENDING_LIMIT_APNTS: (args: {
|
|
211
|
+
token: Address;
|
|
212
|
+
}) => Promise<bigint>;
|
|
213
|
+
tokenSetPaymasterLimit: (args: {
|
|
214
|
+
token: Address;
|
|
215
|
+
user: Address;
|
|
216
|
+
limit: bigint;
|
|
217
|
+
account?: Account | Address;
|
|
218
|
+
}) => Promise<Hash>;
|
|
219
|
+
tokenSetSuperPaymasterAddress: (args: {
|
|
220
|
+
token: Address;
|
|
221
|
+
superPaymaster: Address;
|
|
222
|
+
account?: Account | Address;
|
|
223
|
+
}) => Promise<Hash>;
|
|
224
|
+
tokenVersion: (args: {
|
|
225
|
+
token: Address;
|
|
226
|
+
}) => Promise<string>;
|
|
227
|
+
};
|
|
228
|
+
export declare const gTokenActions: () => (client: PublicClient | WalletClient) => TokenActions;
|
|
229
|
+
export declare const tokenActions: () => (client: PublicClient | WalletClient) => TokenActions;
|
|
@@ -0,0 +1,415 @@
|
|
|
1
|
+
import { GTokenABI, xPNTsTokenABI } from '../abis/index.js';
|
|
2
|
+
function getTokenABI(token) {
|
|
3
|
+
// Auto-detect ABI based on token type or use generic xPNTsTokenABI
|
|
4
|
+
return xPNTsTokenABI;
|
|
5
|
+
}
|
|
6
|
+
export const gTokenActions = () => (client) => ({
|
|
7
|
+
// Use GTokenABI for everything
|
|
8
|
+
...tokenActions()(client),
|
|
9
|
+
async tokenTotalSupply({ token }) {
|
|
10
|
+
return client.readContract({ address: token, abi: GTokenABI, functionName: 'totalSupply', args: [] });
|
|
11
|
+
},
|
|
12
|
+
async tokenBalanceOf({ token, account }) {
|
|
13
|
+
return client.readContract({ address: token, abi: GTokenABI, functionName: 'balanceOf', args: [account] });
|
|
14
|
+
},
|
|
15
|
+
async tokenTransfer({ token, to, amount, account }) {
|
|
16
|
+
return client.writeContract({ address: token, abi: GTokenABI, functionName: 'transfer', args: [to, amount], account: account, chain: client.chain });
|
|
17
|
+
},
|
|
18
|
+
async tokenTransferFrom({ token, from, to, amount, account }) {
|
|
19
|
+
return client.writeContract({ address: token, abi: GTokenABI, functionName: 'transferFrom', args: [from, to, amount], account: account, chain: client.chain });
|
|
20
|
+
},
|
|
21
|
+
async tokenApprove({ token, spender, amount, account }) {
|
|
22
|
+
return client.writeContract({ address: token, abi: GTokenABI, functionName: 'approve', args: [spender, amount], account: account, chain: client.chain });
|
|
23
|
+
},
|
|
24
|
+
async tokenAllowance({ token, owner, spender }) {
|
|
25
|
+
return client.readContract({ address: token, abi: GTokenABI, functionName: 'allowance', args: [owner, spender] });
|
|
26
|
+
},
|
|
27
|
+
async tokenMint({ token, to, amount, account }) {
|
|
28
|
+
return client.writeContract({ address: token, abi: GTokenABI, functionName: 'mint', args: [to, amount], account: account, chain: client.chain });
|
|
29
|
+
},
|
|
30
|
+
async tokenBurn({ token, amount, account }) {
|
|
31
|
+
return client.writeContract({ address: token, abi: GTokenABI, functionName: 'burn', args: [amount], account: account, chain: client.chain });
|
|
32
|
+
},
|
|
33
|
+
async tokenBurnFrom({ token, from, amount, account }) {
|
|
34
|
+
return client.writeContract({ address: token, abi: GTokenABI, functionName: 'burnFrom', args: [from, amount], account: account, chain: client.chain });
|
|
35
|
+
},
|
|
36
|
+
async tokenName({ token }) {
|
|
37
|
+
return client.readContract({ address: token, abi: GTokenABI, functionName: 'name', args: [] });
|
|
38
|
+
},
|
|
39
|
+
async tokenSymbol({ token }) {
|
|
40
|
+
return client.readContract({ address: token, abi: GTokenABI, functionName: 'symbol', args: [] });
|
|
41
|
+
},
|
|
42
|
+
async tokenDecimals({ token }) {
|
|
43
|
+
return client.readContract({ address: token, abi: GTokenABI, functionName: 'decimals', args: [] });
|
|
44
|
+
},
|
|
45
|
+
async tokenOwner({ token }) {
|
|
46
|
+
return client.readContract({ address: token, abi: GTokenABI, functionName: 'owner', args: [] });
|
|
47
|
+
},
|
|
48
|
+
async tokenTransferTokenOwnership({ token, newOwner, account }) {
|
|
49
|
+
return client.writeContract({ address: token, abi: GTokenABI, functionName: 'transferOwnership', args: [newOwner], account: account, chain: client.chain });
|
|
50
|
+
},
|
|
51
|
+
async tokenRenounceOwnership({ token, account }) {
|
|
52
|
+
return client.writeContract({ address: token, abi: GTokenABI, functionName: 'renounceOwnership', args: [], account: account, chain: client.chain });
|
|
53
|
+
},
|
|
54
|
+
async tokenCap({ token }) {
|
|
55
|
+
return client.readContract({ address: token, abi: GTokenABI, functionName: 'cap', args: [] });
|
|
56
|
+
},
|
|
57
|
+
async tokenRemainingMintableSupply({ token }) {
|
|
58
|
+
return client.readContract({ address: token, abi: GTokenABI, functionName: 'remainingMintableSupply', args: [] });
|
|
59
|
+
},
|
|
60
|
+
});
|
|
61
|
+
export const tokenActions = () => (client) => ({
|
|
62
|
+
// ERC20 Standard
|
|
63
|
+
async tokenTotalSupply({ token }) {
|
|
64
|
+
return client.readContract({
|
|
65
|
+
address: token,
|
|
66
|
+
abi: getTokenABI(token),
|
|
67
|
+
functionName: 'totalSupply',
|
|
68
|
+
args: []
|
|
69
|
+
});
|
|
70
|
+
},
|
|
71
|
+
async tokenCap({ token }) {
|
|
72
|
+
return client.readContract({
|
|
73
|
+
address: token,
|
|
74
|
+
abi: getTokenABI(token),
|
|
75
|
+
functionName: 'cap',
|
|
76
|
+
args: []
|
|
77
|
+
});
|
|
78
|
+
},
|
|
79
|
+
async tokenRemainingMintableSupply({ token }) {
|
|
80
|
+
return client.readContract({
|
|
81
|
+
address: token,
|
|
82
|
+
abi: getTokenABI(token),
|
|
83
|
+
functionName: 'remainingMintableSupply',
|
|
84
|
+
args: []
|
|
85
|
+
});
|
|
86
|
+
},
|
|
87
|
+
async tokenBalanceOf({ token, account }) {
|
|
88
|
+
return client.readContract({
|
|
89
|
+
address: token,
|
|
90
|
+
abi: getTokenABI(token),
|
|
91
|
+
functionName: 'balanceOf',
|
|
92
|
+
args: [account]
|
|
93
|
+
});
|
|
94
|
+
},
|
|
95
|
+
async tokenTransfer({ token, to, amount, account }) {
|
|
96
|
+
return client.writeContract({
|
|
97
|
+
address: token,
|
|
98
|
+
abi: getTokenABI(token),
|
|
99
|
+
functionName: 'transfer',
|
|
100
|
+
args: [to, amount],
|
|
101
|
+
account: account,
|
|
102
|
+
chain: client.chain
|
|
103
|
+
});
|
|
104
|
+
},
|
|
105
|
+
async tokenTransferFrom({ token, from, to, amount, account }) {
|
|
106
|
+
return client.writeContract({
|
|
107
|
+
address: token,
|
|
108
|
+
abi: getTokenABI(token),
|
|
109
|
+
functionName: 'transferFrom',
|
|
110
|
+
args: [from, to, amount],
|
|
111
|
+
account: account,
|
|
112
|
+
chain: client.chain
|
|
113
|
+
});
|
|
114
|
+
},
|
|
115
|
+
async tokenApprove({ token, spender, amount, account }) {
|
|
116
|
+
return client.writeContract({
|
|
117
|
+
address: token,
|
|
118
|
+
abi: getTokenABI(token),
|
|
119
|
+
functionName: 'approve',
|
|
120
|
+
args: [spender, amount],
|
|
121
|
+
account: account,
|
|
122
|
+
chain: client.chain
|
|
123
|
+
});
|
|
124
|
+
},
|
|
125
|
+
async tokenAllowance({ token, owner, spender }) {
|
|
126
|
+
return client.readContract({
|
|
127
|
+
address: token,
|
|
128
|
+
abi: getTokenABI(token),
|
|
129
|
+
functionName: 'allowance',
|
|
130
|
+
args: [owner, spender]
|
|
131
|
+
});
|
|
132
|
+
},
|
|
133
|
+
// Mintable/Burnable
|
|
134
|
+
async tokenMint({ token, to, amount, account }) {
|
|
135
|
+
return client.writeContract({
|
|
136
|
+
address: token,
|
|
137
|
+
abi: getTokenABI(token),
|
|
138
|
+
functionName: 'mint',
|
|
139
|
+
args: [to, amount],
|
|
140
|
+
account: account,
|
|
141
|
+
chain: client.chain
|
|
142
|
+
});
|
|
143
|
+
},
|
|
144
|
+
async tokenBurn({ token, amount, account }) {
|
|
145
|
+
return client.writeContract({
|
|
146
|
+
address: token,
|
|
147
|
+
abi: getTokenABI(token),
|
|
148
|
+
functionName: 'burn',
|
|
149
|
+
args: [amount],
|
|
150
|
+
account: account,
|
|
151
|
+
chain: client.chain
|
|
152
|
+
});
|
|
153
|
+
},
|
|
154
|
+
async tokenBurnFrom({ token, from, amount, account }) {
|
|
155
|
+
return client.writeContract({
|
|
156
|
+
address: token,
|
|
157
|
+
abi: getTokenABI(token),
|
|
158
|
+
functionName: 'burnFrom',
|
|
159
|
+
args: [from, amount],
|
|
160
|
+
account: account,
|
|
161
|
+
chain: client.chain
|
|
162
|
+
});
|
|
163
|
+
},
|
|
164
|
+
// ERC20 Metadata
|
|
165
|
+
async tokenName({ token }) {
|
|
166
|
+
return client.readContract({
|
|
167
|
+
address: token,
|
|
168
|
+
abi: getTokenABI(token),
|
|
169
|
+
functionName: 'name',
|
|
170
|
+
args: []
|
|
171
|
+
});
|
|
172
|
+
},
|
|
173
|
+
async tokenSymbol({ token }) {
|
|
174
|
+
return client.readContract({
|
|
175
|
+
address: token,
|
|
176
|
+
abi: getTokenABI(token),
|
|
177
|
+
functionName: 'symbol',
|
|
178
|
+
args: []
|
|
179
|
+
});
|
|
180
|
+
},
|
|
181
|
+
async tokenDecimals({ token }) {
|
|
182
|
+
return client.readContract({
|
|
183
|
+
address: token,
|
|
184
|
+
abi: getTokenABI(token),
|
|
185
|
+
functionName: 'decimals',
|
|
186
|
+
args: []
|
|
187
|
+
});
|
|
188
|
+
},
|
|
189
|
+
// Ownable
|
|
190
|
+
async tokenOwner({ token }) {
|
|
191
|
+
return client.readContract({
|
|
192
|
+
address: token,
|
|
193
|
+
abi: getTokenABI(token),
|
|
194
|
+
functionName: 'owner',
|
|
195
|
+
args: []
|
|
196
|
+
});
|
|
197
|
+
},
|
|
198
|
+
async tokenTransferTokenOwnership({ token, newOwner, account }) {
|
|
199
|
+
return client.writeContract({
|
|
200
|
+
address: token,
|
|
201
|
+
abi: getTokenABI(token),
|
|
202
|
+
functionName: 'transferOwnership',
|
|
203
|
+
args: [newOwner],
|
|
204
|
+
account: account,
|
|
205
|
+
chain: client.chain
|
|
206
|
+
});
|
|
207
|
+
},
|
|
208
|
+
async tokenRenounceOwnership({ token, account }) {
|
|
209
|
+
return client.writeContract({
|
|
210
|
+
address: token,
|
|
211
|
+
abi: getTokenABI(token),
|
|
212
|
+
functionName: 'renounceOwnership',
|
|
213
|
+
args: [],
|
|
214
|
+
account: account,
|
|
215
|
+
chain: client.chain
|
|
216
|
+
});
|
|
217
|
+
},
|
|
218
|
+
// xPNTs/aPNTs specific
|
|
219
|
+
async tokenUpdateExchangeRate({ token, newRate, account }) {
|
|
220
|
+
return client.writeContract({
|
|
221
|
+
address: token,
|
|
222
|
+
abi: getTokenABI(token),
|
|
223
|
+
functionName: 'updateExchangeRate',
|
|
224
|
+
args: [newRate],
|
|
225
|
+
account: account,
|
|
226
|
+
chain: client.chain
|
|
227
|
+
});
|
|
228
|
+
},
|
|
229
|
+
async tokenGetDebt({ token, user }) {
|
|
230
|
+
return client.readContract({
|
|
231
|
+
address: token,
|
|
232
|
+
abi: getTokenABI(token),
|
|
233
|
+
functionName: 'getDebt',
|
|
234
|
+
args: [user]
|
|
235
|
+
});
|
|
236
|
+
},
|
|
237
|
+
async tokenRepayDebt({ token, amount, account }) {
|
|
238
|
+
return client.writeContract({
|
|
239
|
+
address: token,
|
|
240
|
+
abi: getTokenABI(token),
|
|
241
|
+
functionName: 'repayDebt',
|
|
242
|
+
args: [amount],
|
|
243
|
+
account: account,
|
|
244
|
+
chain: client.chain
|
|
245
|
+
});
|
|
246
|
+
},
|
|
247
|
+
async tokenTransferAndCall({ token, to, amount, data = '0x', account }) {
|
|
248
|
+
return client.writeContract({
|
|
249
|
+
address: token,
|
|
250
|
+
abi: getTokenABI(token),
|
|
251
|
+
functionName: 'transferAndCall',
|
|
252
|
+
args: [to, amount, data],
|
|
253
|
+
account: account,
|
|
254
|
+
chain: client.chain
|
|
255
|
+
});
|
|
256
|
+
},
|
|
257
|
+
// Auto Approval
|
|
258
|
+
async tokenAddAutoApprovedSpender({ token, spender, account }) {
|
|
259
|
+
return client.writeContract({
|
|
260
|
+
address: token,
|
|
261
|
+
abi: xPNTsTokenABI,
|
|
262
|
+
functionName: 'addAutoApprovedSpender',
|
|
263
|
+
args: [spender],
|
|
264
|
+
account: account,
|
|
265
|
+
chain: client.chain
|
|
266
|
+
});
|
|
267
|
+
},
|
|
268
|
+
async tokenRemoveAutoApprovedSpender({ token, spender, account }) {
|
|
269
|
+
return client.writeContract({
|
|
270
|
+
address: token,
|
|
271
|
+
abi: xPNTsTokenABI,
|
|
272
|
+
functionName: 'removeAutoApprovedSpender',
|
|
273
|
+
args: [spender],
|
|
274
|
+
account: account,
|
|
275
|
+
chain: client.chain
|
|
276
|
+
});
|
|
277
|
+
},
|
|
278
|
+
async tokenIsAutoApprovedSpender({ token, spender }) {
|
|
279
|
+
return client.readContract({
|
|
280
|
+
address: token,
|
|
281
|
+
abi: xPNTsTokenABI,
|
|
282
|
+
functionName: 'isAutoApprovedSpender',
|
|
283
|
+
args: [spender]
|
|
284
|
+
});
|
|
285
|
+
},
|
|
286
|
+
// Constants
|
|
287
|
+
async tokenSUPERPAYMASTER_ADDRESS({ token }) {
|
|
288
|
+
return client.readContract({
|
|
289
|
+
address: token,
|
|
290
|
+
abi: xPNTsTokenABI,
|
|
291
|
+
functionName: 'SUPERPAYMASTER_ADDRESS',
|
|
292
|
+
args: []
|
|
293
|
+
});
|
|
294
|
+
},
|
|
295
|
+
async tokenFACTORY({ token }) {
|
|
296
|
+
return client.readContract({
|
|
297
|
+
address: token,
|
|
298
|
+
abi: xPNTsTokenABI,
|
|
299
|
+
functionName: 'FACTORY',
|
|
300
|
+
args: []
|
|
301
|
+
});
|
|
302
|
+
},
|
|
303
|
+
async tokenTransferOwnership(args) {
|
|
304
|
+
return this.tokenTransferTokenOwnership(args);
|
|
305
|
+
},
|
|
306
|
+
async tokenTransferCommunityOwnership({ token, newOwner, account }) {
|
|
307
|
+
return client.writeContract({
|
|
308
|
+
address: token,
|
|
309
|
+
abi: xPNTsTokenABI,
|
|
310
|
+
functionName: 'transferCommunityOwnership',
|
|
311
|
+
args: [newOwner],
|
|
312
|
+
account: account,
|
|
313
|
+
chain: client.chain
|
|
314
|
+
});
|
|
315
|
+
},
|
|
316
|
+
// xPNTs Views
|
|
317
|
+
async tokenCommunityName({ token }) {
|
|
318
|
+
return client.readContract({ address: token, abi: xPNTsTokenABI, functionName: 'communityName', args: [] });
|
|
319
|
+
},
|
|
320
|
+
async tokenCommunityENS({ token }) {
|
|
321
|
+
return client.readContract({ address: token, abi: xPNTsTokenABI, functionName: 'communityENS', args: [] });
|
|
322
|
+
},
|
|
323
|
+
async tokenExchangeRate({ token }) {
|
|
324
|
+
return client.readContract({ address: token, abi: xPNTsTokenABI, functionName: 'exchangeRate', args: [] });
|
|
325
|
+
},
|
|
326
|
+
async tokenSpendingLimits({ token, user }) {
|
|
327
|
+
return client.readContract({ address: token, abi: xPNTsTokenABI, functionName: 'spendingLimits', args: [user] });
|
|
328
|
+
},
|
|
329
|
+
async tokenDefaultSpendingLimitXPNTs({ token }) {
|
|
330
|
+
try {
|
|
331
|
+
return client.readContract({ address: token, abi: xPNTsTokenABI, functionName: 'defaultSpendingLimitXPNTs', args: [] });
|
|
332
|
+
}
|
|
333
|
+
catch {
|
|
334
|
+
return client.readContract({ address: token, abi: xPNTsTokenABI, functionName: 'getDefaultSpendingLimitXPNTs', args: [] });
|
|
335
|
+
}
|
|
336
|
+
},
|
|
337
|
+
async tokenCumulativeSpent({ token, user }) {
|
|
338
|
+
return client.readContract({ address: token, abi: xPNTsTokenABI, functionName: 'cumulativeSpent', args: [user] });
|
|
339
|
+
},
|
|
340
|
+
async tokenDebts({ token, user }) {
|
|
341
|
+
return client.readContract({ address: token, abi: xPNTsTokenABI, functionName: 'debts', args: [user] });
|
|
342
|
+
},
|
|
343
|
+
async tokenUsedOpHashes({ token, hash }) {
|
|
344
|
+
return client.readContract({ address: token, abi: xPNTsTokenABI, functionName: 'usedOpHashes', args: [hash] });
|
|
345
|
+
},
|
|
346
|
+
// EIP2612
|
|
347
|
+
async tokenDOMAIN_SEPARATOR({ token }) {
|
|
348
|
+
return client.readContract({ address: token, abi: xPNTsTokenABI, functionName: 'DOMAIN_SEPARATOR', args: [] });
|
|
349
|
+
},
|
|
350
|
+
async tokenNonces({ token, owner }) {
|
|
351
|
+
return client.readContract({ address: token, abi: xPNTsTokenABI, functionName: 'nonces', args: [owner] });
|
|
352
|
+
},
|
|
353
|
+
async tokenPermit({ token, owner, spender, value, deadline, v, r, s, account }) {
|
|
354
|
+
return client.writeContract({
|
|
355
|
+
address: token,
|
|
356
|
+
abi: xPNTsTokenABI,
|
|
357
|
+
functionName: 'permit',
|
|
358
|
+
args: [owner, spender, value, deadline, v, r, s],
|
|
359
|
+
account: account,
|
|
360
|
+
chain: client.chain
|
|
361
|
+
});
|
|
362
|
+
},
|
|
363
|
+
// xPNTs Additional
|
|
364
|
+
async tokenAutoApprovedSpenders({ token, spender }) {
|
|
365
|
+
return client.readContract({ address: token, abi: xPNTsTokenABI, functionName: 'autoApprovedSpenders', args: [spender] });
|
|
366
|
+
},
|
|
367
|
+
async tokenBurnFromWithOpHash({ token, account: user, amount, opHash, userOpAccount }) {
|
|
368
|
+
return client.writeContract({ address: token, abi: xPNTsTokenABI, functionName: 'burnFromWithOpHash', args: [user, amount, opHash], account: userOpAccount, chain: client.chain });
|
|
369
|
+
},
|
|
370
|
+
async tokenCommunityOwner({ token }) {
|
|
371
|
+
return client.readContract({ address: token, abi: xPNTsTokenABI, functionName: 'communityOwner', args: [] });
|
|
372
|
+
},
|
|
373
|
+
async tokenEip712Domain({ token }) {
|
|
374
|
+
return client.readContract({ address: token, abi: xPNTsTokenABI, functionName: 'eip712Domain', args: [] });
|
|
375
|
+
},
|
|
376
|
+
async tokenGetDefaultSpendingLimitXPNTs({ token }) {
|
|
377
|
+
return client.readContract({ address: token, abi: xPNTsTokenABI, functionName: 'getDefaultSpendingLimitXPNTs', args: [] });
|
|
378
|
+
},
|
|
379
|
+
async tokenGetMetadata({ token }) {
|
|
380
|
+
return client.readContract({ address: token, abi: xPNTsTokenABI, functionName: 'getMetadata', args: [] });
|
|
381
|
+
},
|
|
382
|
+
async tokenNeedsApproval({ token, owner, spender, amount }) {
|
|
383
|
+
return client.readContract({ address: token, abi: xPNTsTokenABI, functionName: 'needsApproval', args: [owner, spender, amount] });
|
|
384
|
+
},
|
|
385
|
+
async tokenRecordDebt({ token, user, amount, account }) {
|
|
386
|
+
return client.writeContract({ address: token, abi: xPNTsTokenABI, functionName: 'recordDebt', args: [user, amount], account: account, chain: client.chain });
|
|
387
|
+
},
|
|
388
|
+
async tokenDEFAULT_SPENDING_LIMIT_APNTS({ token }) {
|
|
389
|
+
return client.readContract({ address: token, abi: xPNTsTokenABI, functionName: 'DEFAULT_SPENDING_LIMIT_APNTS', args: [] });
|
|
390
|
+
},
|
|
391
|
+
// Admin
|
|
392
|
+
async tokenSetPaymasterLimit({ token, user, limit, account }) {
|
|
393
|
+
return client.writeContract({
|
|
394
|
+
address: token,
|
|
395
|
+
abi: xPNTsTokenABI,
|
|
396
|
+
functionName: 'setPaymasterLimit',
|
|
397
|
+
args: [user, limit],
|
|
398
|
+
account: account,
|
|
399
|
+
chain: client.chain
|
|
400
|
+
});
|
|
401
|
+
},
|
|
402
|
+
async tokenSetSuperPaymasterAddress({ token, superPaymaster, account }) {
|
|
403
|
+
return client.writeContract({
|
|
404
|
+
address: token,
|
|
405
|
+
abi: xPNTsTokenABI,
|
|
406
|
+
functionName: 'setSuperPaymasterAddress',
|
|
407
|
+
args: [superPaymaster],
|
|
408
|
+
account: account,
|
|
409
|
+
chain: client.chain
|
|
410
|
+
});
|
|
411
|
+
},
|
|
412
|
+
async tokenVersion({ token }) {
|
|
413
|
+
return client.readContract({ address: token, abi: xPNTsTokenABI, functionName: 'version', args: [] });
|
|
414
|
+
}
|
|
415
|
+
});
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AAStar Community Branding Configuration
|
|
3
|
+
*/
|
|
4
|
+
export declare const BRANDING: {
|
|
5
|
+
readonly logo: "https://raw.githubusercontent.com/jhfnetboy/MarkDownImg/main/img/202505031325963.png";
|
|
6
|
+
readonly icon: "https://www.aastar.io/favicon.ico";
|
|
7
|
+
readonly colors: {
|
|
8
|
+
readonly primary: "#FF6B35";
|
|
9
|
+
readonly primaryLight: "#FF8C42";
|
|
10
|
+
readonly secondary: "#4A90E2";
|
|
11
|
+
readonly secondaryDark: "#357ABD";
|
|
12
|
+
readonly success: "#4CAF50";
|
|
13
|
+
readonly warning: "#FFC107";
|
|
14
|
+
readonly error: "#F44336";
|
|
15
|
+
readonly gray50: "#F9FAFB";
|
|
16
|
+
readonly gray100: "#F3F4F6";
|
|
17
|
+
readonly gray700: "#374151";
|
|
18
|
+
readonly gray800: "#1F2937";
|
|
19
|
+
readonly gray900: "#111827";
|
|
20
|
+
};
|
|
21
|
+
};
|
|
22
|
+
export declare const LINKS: {
|
|
23
|
+
readonly main: "https://aastar.io";
|
|
24
|
+
readonly airAccount: "https://airAccount.aastar.io";
|
|
25
|
+
readonly superPaymaster: "https://superpaymaster.aastar.io";
|
|
26
|
+
readonly demo: "https://aastar.io/demo";
|
|
27
|
+
readonly github: "https://github.com/AAStarCommunity";
|
|
28
|
+
readonly discord: "https://discord.gg/aastar";
|
|
29
|
+
readonly twitter: "https://twitter.com/AAStarCommunity";
|
|
30
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* AAStar Community Branding Configuration
|
|
3
|
+
*/
|
|
4
|
+
export const BRANDING = {
|
|
5
|
+
logo: "https://raw.githubusercontent.com/jhfnetboy/MarkDownImg/main/img/202505031325963.png",
|
|
6
|
+
icon: "https://www.aastar.io/favicon.ico",
|
|
7
|
+
colors: {
|
|
8
|
+
primary: "#FF6B35",
|
|
9
|
+
primaryLight: "#FF8C42",
|
|
10
|
+
secondary: "#4A90E2",
|
|
11
|
+
secondaryDark: "#357ABD",
|
|
12
|
+
success: "#4CAF50",
|
|
13
|
+
warning: "#FFC107",
|
|
14
|
+
error: "#F44336",
|
|
15
|
+
gray50: "#F9FAFB",
|
|
16
|
+
gray100: "#F3F4F6",
|
|
17
|
+
gray700: "#374151",
|
|
18
|
+
gray800: "#1F2937",
|
|
19
|
+
gray900: "#111827",
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
export const LINKS = {
|
|
23
|
+
main: "https://aastar.io",
|
|
24
|
+
airAccount: "https://airAccount.aastar.io",
|
|
25
|
+
superPaymaster: "https://superpaymaster.aastar.io",
|
|
26
|
+
demo: "https://aastar.io/demo",
|
|
27
|
+
github: "https://github.com/AAStarCommunity",
|
|
28
|
+
discord: "https://discord.gg/aastar",
|
|
29
|
+
twitter: "https://twitter.com/AAStarCommunity",
|
|
30
|
+
};
|