@aastar/dapp 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.
Files changed (108) hide show
  1. package/LICENSE +21 -0
  2. package/dist/core/src/abis/BLSAggregator.json +686 -0
  3. package/dist/core/src/abis/BLSValidator.json +42 -0
  4. package/dist/core/src/abis/DVTValidator.json +368 -0
  5. package/dist/core/src/abis/EntryPoint.json +1382 -0
  6. package/dist/core/src/abis/GToken.json +513 -0
  7. package/dist/core/src/abis/GTokenStaking.json +949 -0
  8. package/dist/core/src/abis/MySBT.json +1518 -0
  9. package/dist/core/src/abis/Paymaster.json +1143 -0
  10. package/dist/core/src/abis/PaymasterFactory.json +640 -0
  11. package/dist/core/src/abis/Registry.json +1942 -0
  12. package/dist/core/src/abis/ReputationSystem.json +699 -0
  13. package/dist/core/src/abis/SimpleAccount.json +560 -0
  14. package/dist/core/src/abis/SimpleAccountFactory.json +111 -0
  15. package/dist/core/src/abis/SuperPaymaster.json +1781 -0
  16. package/dist/core/src/abis/index.d.ts +1126 -0
  17. package/dist/core/src/abis/index.js +91 -0
  18. package/dist/core/src/abis/xPNTsFactory.json +718 -0
  19. package/dist/core/src/abis/xPNTsToken.json +1280 -0
  20. package/dist/core/src/actions/StateValidator.d.ts +68 -0
  21. package/dist/core/src/actions/StateValidator.js +187 -0
  22. package/dist/core/src/actions/account.d.ts +55 -0
  23. package/dist/core/src/actions/account.js +133 -0
  24. package/dist/core/src/actions/aggregator.d.ts +17 -0
  25. package/dist/core/src/actions/aggregator.js +31 -0
  26. package/dist/core/src/actions/dvt.d.ts +30 -0
  27. package/dist/core/src/actions/dvt.js +41 -0
  28. package/dist/core/src/actions/entryPoint.d.ts +90 -0
  29. package/dist/core/src/actions/entryPoint.js +211 -0
  30. package/dist/core/src/actions/factory.d.ts +215 -0
  31. package/dist/core/src/actions/factory.js +442 -0
  32. package/dist/core/src/actions/faucet.d.ts +48 -0
  33. package/dist/core/src/actions/faucet.js +337 -0
  34. package/dist/core/src/actions/gtokenExtended.d.ts +39 -0
  35. package/dist/core/src/actions/gtokenExtended.js +115 -0
  36. package/dist/core/src/actions/index.d.ts +15 -0
  37. package/dist/core/src/actions/index.js +17 -0
  38. package/dist/core/src/actions/paymasterV4.d.ts +170 -0
  39. package/dist/core/src/actions/paymasterV4.js +334 -0
  40. package/dist/core/src/actions/registry.d.ts +246 -0
  41. package/dist/core/src/actions/registry.js +667 -0
  42. package/dist/core/src/actions/reputation.d.ts +129 -0
  43. package/dist/core/src/actions/reputation.js +281 -0
  44. package/dist/core/src/actions/sbt.d.ts +191 -0
  45. package/dist/core/src/actions/sbt.js +533 -0
  46. package/dist/core/src/actions/staking.d.ts +132 -0
  47. package/dist/core/src/actions/staking.js +330 -0
  48. package/dist/core/src/actions/superPaymaster.d.ts +237 -0
  49. package/dist/core/src/actions/superPaymaster.js +644 -0
  50. package/dist/core/src/actions/tokens.d.ts +229 -0
  51. package/dist/core/src/actions/tokens.js +415 -0
  52. package/dist/core/src/branding.d.ts +30 -0
  53. package/dist/core/src/branding.js +30 -0
  54. package/dist/core/src/clients/BaseClient.d.ts +25 -0
  55. package/dist/core/src/clients/BaseClient.js +66 -0
  56. package/dist/core/src/clients/types.d.ts +60 -0
  57. package/dist/core/src/clients/types.js +1 -0
  58. package/dist/core/src/clients.d.ts +5 -0
  59. package/dist/core/src/clients.js +11 -0
  60. package/dist/core/src/communities.d.ts +52 -0
  61. package/dist/core/src/communities.js +73 -0
  62. package/dist/core/src/config/ContractConfigManager.d.ts +20 -0
  63. package/dist/core/src/config/ContractConfigManager.js +48 -0
  64. package/dist/core/src/constants.d.ts +88 -0
  65. package/dist/core/src/constants.js +125 -0
  66. package/dist/core/src/contract-addresses.d.ts +110 -0
  67. package/dist/core/src/contract-addresses.js +99 -0
  68. package/dist/core/src/contracts.d.ts +424 -0
  69. package/dist/core/src/contracts.js +343 -0
  70. package/dist/core/src/crypto/blsSigner.d.ts +64 -0
  71. package/dist/core/src/crypto/blsSigner.js +98 -0
  72. package/dist/core/src/crypto/index.d.ts +1 -0
  73. package/dist/core/src/crypto/index.js +1 -0
  74. package/dist/core/src/index.d.ts +21 -0
  75. package/dist/core/src/index.js +21 -0
  76. package/dist/core/src/networks.d.ts +127 -0
  77. package/dist/core/src/networks.js +118 -0
  78. package/dist/core/src/requirementChecker.d.ts +38 -0
  79. package/dist/core/src/requirementChecker.js +139 -0
  80. package/dist/core/src/roles.d.ts +204 -0
  81. package/dist/core/src/roles.js +211 -0
  82. package/dist/core/src/utils/validation.d.ts +24 -0
  83. package/dist/core/src/utils/validation.js +56 -0
  84. package/dist/dapp/src/index.d.ts +3 -0
  85. package/dist/dapp/src/index.js +3 -0
  86. package/dist/dapp/src/ui/components/EvaluationPanel.d.ts +11 -0
  87. package/dist/dapp/src/ui/components/EvaluationPanel.js +37 -0
  88. package/dist/dapp/src/ui/hooks/useCreditScore.d.ts +13 -0
  89. package/dist/dapp/src/ui/hooks/useCreditScore.js +32 -0
  90. package/dist/dapp/src/ui/hooks/useSuperPaymaster.d.ts +8 -0
  91. package/dist/dapp/src/ui/hooks/useSuperPaymaster.js +23 -0
  92. package/dist/dapp/src/ui/index.d.ts +4 -0
  93. package/dist/dapp/src/ui/index.js +17 -0
  94. package/dist/paymaster/src/SuperPaymaster/index.d.ts +44 -0
  95. package/dist/paymaster/src/SuperPaymaster/index.js +133 -0
  96. package/dist/paymaster/src/V4/PaymasterClient.d.ts +79 -0
  97. package/dist/paymaster/src/V4/PaymasterClient.js +315 -0
  98. package/dist/paymaster/src/V4/PaymasterOperator.d.ts +41 -0
  99. package/dist/paymaster/src/V4/PaymasterOperator.js +241 -0
  100. package/dist/paymaster/src/V4/PaymasterUtils.d.ts +55 -0
  101. package/dist/paymaster/src/V4/PaymasterUtils.js +124 -0
  102. package/dist/paymaster/src/V4/SuperPaymasterClient.d.ts +21 -0
  103. package/dist/paymaster/src/V4/SuperPaymasterClient.js +73 -0
  104. package/dist/paymaster/src/V4/index.d.ts +4 -0
  105. package/dist/paymaster/src/V4/index.js +4 -0
  106. package/dist/paymaster/src/index.d.ts +2 -0
  107. package/dist/paymaster/src/index.js +4 -0
  108. package/package.json +31 -0
@@ -0,0 +1,211 @@
1
+ import { EntryPointABI } from '../abis/index.js';
2
+ export var EntryPointVersion;
3
+ (function (EntryPointVersion) {
4
+ EntryPointVersion["V06"] = "0.6";
5
+ EntryPointVersion["V07"] = "0.7";
6
+ })(EntryPointVersion || (EntryPointVersion = {}));
7
+ export const entryPointActions = (address, version = EntryPointVersion.V07) => (client) => ({
8
+ version,
9
+ async balanceOf({ account }) {
10
+ // v0.6 and v0.7 both use balanceOf(address)
11
+ return client.readContract({
12
+ address,
13
+ abi: [{ name: 'balanceOf', inputs: [{ type: 'address' }], outputs: [{ type: 'uint256' }], type: 'function', stateMutability: 'view' }],
14
+ functionName: 'balanceOf',
15
+ args: [account]
16
+ });
17
+ },
18
+ async depositTo({ account, amount, txAccount }) {
19
+ // v0.6 and v0.7 both use depositTo(address)
20
+ return client.writeContract({
21
+ address,
22
+ abi: [{ name: 'depositTo', type: 'function', inputs: [{ type: 'address' }], outputs: [], stateMutability: 'payable' }],
23
+ functionName: 'depositTo',
24
+ args: [account],
25
+ value: amount,
26
+ account: txAccount,
27
+ chain: client.chain
28
+ });
29
+ },
30
+ async getNonce({ sender, key }) {
31
+ if (version === EntryPointVersion.V06) {
32
+ // v0.6: getNonce(address, uint192)
33
+ return client.readContract({
34
+ address,
35
+ abi: [{ name: 'getNonce', type: 'function', inputs: [{ type: 'address', name: 'sender' }, { type: 'uint256', name: 'key' }], outputs: [{ type: 'uint256' }], stateMutability: 'view' }],
36
+ functionName: 'getNonce',
37
+ args: [sender, key]
38
+ });
39
+ }
40
+ else {
41
+ // v0.7: getNonce(address, uint192) - Note: v0.7 actually uses 192 bit key but in ABI it's uint192
42
+ return client.readContract({
43
+ address,
44
+ abi: [{ name: 'getNonce', type: 'function', inputs: [{ type: 'address', name: 'sender' }, { type: 'uint192', name: 'key' }], outputs: [{ type: 'uint256' }], stateMutability: 'view' }],
45
+ functionName: 'getNonce',
46
+ args: [sender, key]
47
+ });
48
+ }
49
+ },
50
+ async getDepositInfo({ account }) {
51
+ const result = await client.readContract({
52
+ address,
53
+ abi: [{
54
+ name: 'getDepositInfo',
55
+ type: 'function',
56
+ inputs: [{ type: 'address', name: 'account' }],
57
+ outputs: [
58
+ { type: 'uint112', name: 'deposit' },
59
+ { type: 'bool', name: 'staked' },
60
+ { type: 'uint112', name: 'stake' },
61
+ { type: 'uint32', name: 'unstakeDelaySec' },
62
+ { type: 'uint48', name: 'withdrawTime' }
63
+ ],
64
+ stateMutability: 'view'
65
+ }],
66
+ functionName: 'getDepositInfo',
67
+ args: [account]
68
+ });
69
+ return {
70
+ deposit: result[0],
71
+ staked: result[1],
72
+ stake: result[2],
73
+ unstakeDelaySec: result[3],
74
+ withdrawTime: result[4]
75
+ };
76
+ },
77
+ async addStake({ unstakeDelaySec, amount, account }) {
78
+ return client.writeContract({
79
+ address,
80
+ abi: EntryPointABI,
81
+ functionName: 'addStake',
82
+ args: [unstakeDelaySec],
83
+ value: amount,
84
+ account: account,
85
+ chain: client.chain
86
+ });
87
+ },
88
+ async unlockStake({ account }) {
89
+ return client.writeContract({
90
+ address,
91
+ abi: EntryPointABI,
92
+ functionName: 'unlockStake',
93
+ args: [],
94
+ account: account,
95
+ chain: client.chain
96
+ });
97
+ },
98
+ async withdrawStake({ withdrawAddress, account }) {
99
+ return client.writeContract({
100
+ address,
101
+ abi: EntryPointABI,
102
+ functionName: 'withdrawStake',
103
+ args: [withdrawAddress],
104
+ account: account,
105
+ chain: client.chain
106
+ });
107
+ },
108
+ async withdrawTo({ withdrawAddress, amount, account }) {
109
+ return client.writeContract({
110
+ address,
111
+ abi: EntryPointABI,
112
+ functionName: 'withdrawTo',
113
+ args: [withdrawAddress, amount],
114
+ account: account,
115
+ chain: client.chain
116
+ });
117
+ },
118
+ async handleOps({ ops, beneficiary, account }) {
119
+ return client.writeContract({
120
+ address,
121
+ abi: EntryPointABI,
122
+ functionName: 'handleOps',
123
+ args: [ops, beneficiary],
124
+ account: account,
125
+ chain: client.chain
126
+ });
127
+ },
128
+ async handleAggregatedOps({ opsPerAggregator, beneficiary, account }) {
129
+ return client.writeContract({
130
+ address,
131
+ abi: EntryPointABI,
132
+ functionName: 'handleAggregatedOps',
133
+ args: [opsPerAggregator, beneficiary],
134
+ account: account,
135
+ chain: client.chain
136
+ });
137
+ },
138
+ async innerHandleOp({ callData, opInfo, context, account }) {
139
+ return client.writeContract({
140
+ address,
141
+ abi: EntryPointABI,
142
+ functionName: 'innerHandleOp',
143
+ args: [callData, opInfo, context],
144
+ account: account,
145
+ chain: client.chain
146
+ });
147
+ },
148
+ async delegateAndRevert({ target, data, account }) {
149
+ // This typically reverts, but we act as a writer
150
+ return client.writeContract({
151
+ address,
152
+ abi: EntryPointABI,
153
+ functionName: 'delegateAndRevert',
154
+ args: [target, data],
155
+ account: account,
156
+ chain: client.chain
157
+ });
158
+ },
159
+ async getUserOpHash({ op }) {
160
+ return client.readContract({
161
+ address,
162
+ abi: EntryPointABI,
163
+ functionName: 'getUserOpHash',
164
+ args: [op]
165
+ });
166
+ },
167
+ async getSenderAddress({ initCode }) {
168
+ // getSenderAddress usually reverts with the address. Viem might throw.
169
+ // But let's assume standard call first.
170
+ // Actually in EP v0.7 it might return if called off-chain or revert.
171
+ // We will try readContract.
172
+ try {
173
+ return await client.readContract({
174
+ address,
175
+ abi: EntryPointABI,
176
+ functionName: 'getSenderAddress',
177
+ args: [initCode]
178
+ });
179
+ }
180
+ catch (e) {
181
+ // Extract address from error if needed, but for now just implementing the method call.
182
+ // Usually this method reverts with SenderAddressResult(address)
183
+ throw e;
184
+ }
185
+ },
186
+ async senderCreator() {
187
+ return client.readContract({ address, abi: EntryPointABI, functionName: 'senderCreator', args: [] });
188
+ },
189
+ async incrementNonce({ key, account }) {
190
+ return client.writeContract({ address, abi: EntryPointABI, functionName: 'incrementNonce', args: [key], account: account, chain: client.chain });
191
+ },
192
+ async nonceSequenceNumber({ sender, key }) {
193
+ return client.readContract({ address, abi: EntryPointABI, functionName: 'nonceSequenceNumber', args: [sender, key] });
194
+ },
195
+ async supportsInterface({ interfaceId }) {
196
+ return client.readContract({ address, abi: EntryPointABI, functionName: 'supportsInterface', args: [interfaceId] });
197
+ },
198
+ async eip712Domain() {
199
+ return client.readContract({ address, abi: EntryPointABI, functionName: 'eip712Domain', args: [] });
200
+ },
201
+ async getCurrentUserOpHash() {
202
+ // View that returns 'bytes32'
203
+ return client.readContract({ address, abi: EntryPointABI, functionName: 'getCurrentUserOpHash', args: [] });
204
+ },
205
+ async getDomainSeparatorV4() {
206
+ return client.readContract({ address, abi: EntryPointABI, functionName: 'getDomainSeparatorV4', args: [] });
207
+ },
208
+ async getPackedUserOpTypeHash() {
209
+ return client.readContract({ address, abi: EntryPointABI, functionName: 'getPackedUserOpTypeHash', args: [] });
210
+ }
211
+ });
@@ -0,0 +1,215 @@
1
+ import { type Address, type PublicClient, type WalletClient, type Hex, type Hash, type Account } from 'viem';
2
+ export type XPNTsFactoryActions = {
3
+ createToken: (args: {
4
+ name: string;
5
+ symbol: string;
6
+ community: Address;
7
+ account?: Account | Address;
8
+ }) => Promise<Hash>;
9
+ deployForCommunity: (args: {
10
+ community: Address;
11
+ account?: Account | Address;
12
+ }) => Promise<Hash>;
13
+ getTokenAddress: (args: {
14
+ community: Address;
15
+ }) => Promise<Address>;
16
+ predictAddress: (args: {
17
+ community: Address;
18
+ salt?: bigint;
19
+ }) => Promise<Address>;
20
+ isTokenDeployed: (args: {
21
+ community: Address;
22
+ }) => Promise<boolean>;
23
+ getCommunityByToken: (args: {
24
+ token: Address;
25
+ }) => Promise<Address>;
26
+ getAllTokens: () => Promise<Address[]>;
27
+ getTokenCount: () => Promise<bigint>;
28
+ deployedTokens: (args: {
29
+ index: bigint;
30
+ }) => Promise<Address>;
31
+ communityToToken: (args: {
32
+ community: Address;
33
+ }) => Promise<Address>;
34
+ setRegistry: (args: {
35
+ registry: Address;
36
+ account?: Account | Address;
37
+ }) => Promise<Hash>;
38
+ setSuperPaymaster: (args: {
39
+ paymaster: Address;
40
+ account?: Account | Address;
41
+ }) => Promise<Hash>;
42
+ setImplementation: (args: {
43
+ impl: Address;
44
+ account?: Account | Address;
45
+ }) => Promise<Hash>;
46
+ getImplementation: () => Promise<Address>;
47
+ REGISTRY: () => Promise<Address>;
48
+ SUPER_PAYMASTER: () => Promise<Address>;
49
+ tokenImplementation: () => Promise<Address>;
50
+ xPNTsFactoryOwner: () => Promise<Address>;
51
+ transferXPNTsFactoryOwnership: (args: {
52
+ newOwner: Address;
53
+ account?: Account | Address;
54
+ }) => Promise<Hash>;
55
+ renounceXPNTsFactoryOwnership: (args: {
56
+ account?: Account | Address;
57
+ }) => Promise<Hash>;
58
+ deployxPNTsToken: (args: {
59
+ name: string;
60
+ symbol: string;
61
+ community: Address;
62
+ account?: Account | Address;
63
+ }) => Promise<Hash>;
64
+ predictDepositAmount: (args: {
65
+ community: Address;
66
+ userCount: bigint;
67
+ }) => Promise<bigint>;
68
+ getPredictionParams: (args: {
69
+ community: Address;
70
+ }) => Promise<any>;
71
+ getDepositBreakdown: (args: {
72
+ community: Address;
73
+ }) => Promise<any>;
74
+ getAPNTsPrice: () => Promise<bigint>;
75
+ aPNTsPriceUSD: () => Promise<bigint>;
76
+ setIndustryMultiplier: (args: {
77
+ industry: string;
78
+ multiplier: bigint;
79
+ account?: Account | Address;
80
+ }) => Promise<Hash>;
81
+ setSuperPaymasterAddress: (args: {
82
+ paymaster: Address;
83
+ account?: Account | Address;
84
+ }) => Promise<Hash>;
85
+ updateAPNTsPrice: (args: {
86
+ newPrice: bigint;
87
+ account?: Account | Address;
88
+ }) => Promise<Hash>;
89
+ updatePrediction: (args: {
90
+ community: Address;
91
+ userCount: bigint;
92
+ account?: Account | Address;
93
+ }) => Promise<Hash>;
94
+ updatePredictionCustom: (args: {
95
+ community: Address;
96
+ params: any;
97
+ account?: Account | Address;
98
+ }) => Promise<Hash>;
99
+ hasToken: (args: {
100
+ token: Address;
101
+ }) => Promise<boolean>;
102
+ getDeployedCount: () => Promise<bigint>;
103
+ industryMultipliers: (args: {
104
+ industry: string;
105
+ }) => Promise<bigint>;
106
+ getIndustryMultiplier: (args: {
107
+ industry: string;
108
+ }) => Promise<bigint>;
109
+ predictions: (args: {
110
+ community: Address;
111
+ }) => Promise<any>;
112
+ MIN_SUGGESTED_AMOUNT: () => Promise<bigint>;
113
+ DEFAULT_SAFETY_FACTOR: () => Promise<bigint>;
114
+ SUPERPAYMASTER: () => Promise<Address>;
115
+ xPNTsFactoryVersion: () => Promise<string>;
116
+ };
117
+ export type PaymasterFactoryActions = {
118
+ deployPaymaster: (args: {
119
+ owner: Address;
120
+ version?: string;
121
+ initData?: Hex;
122
+ account?: Account | Address;
123
+ }) => Promise<Hash>;
124
+ deployPaymasterDeterministic: (args: {
125
+ owner: Address;
126
+ version?: string;
127
+ initData?: Hex;
128
+ salt: Hex;
129
+ account?: Account | Address;
130
+ }) => Promise<Hash>;
131
+ predictPaymasterAddress: (args: {
132
+ owner: Address;
133
+ salt: Hex;
134
+ }) => Promise<Address>;
135
+ calculateAddress: (args: {
136
+ owner: Address;
137
+ }) => Promise<Address>;
138
+ getPaymaster: (args: {
139
+ owner: Address;
140
+ }) => Promise<Address>;
141
+ getPaymasterCount: () => Promise<bigint>;
142
+ getAllPaymasters: () => Promise<Address[]>;
143
+ isPaymasterDeployed: (args: {
144
+ owner: Address;
145
+ }) => Promise<boolean>;
146
+ hasPaymaster: (args: {
147
+ owner: Address;
148
+ }) => Promise<boolean>;
149
+ getPaymasterList: (args: {
150
+ offset: bigint;
151
+ limit: bigint;
152
+ }) => Promise<Address[]>;
153
+ paymasterList: (args: {
154
+ index: bigint;
155
+ }) => Promise<Address>;
156
+ totalDeployed: () => Promise<bigint>;
157
+ getOperatorByPaymaster: (args: {
158
+ paymaster: Address;
159
+ }) => Promise<Address>;
160
+ operatorByPaymaster: (args: {
161
+ paymaster: Address;
162
+ }) => Promise<Address>;
163
+ getPaymasterByOperator: (args: {
164
+ operator: Address;
165
+ }) => Promise<Address>;
166
+ paymasterByOperator: (args: {
167
+ operator: Address;
168
+ }) => Promise<Address>;
169
+ getPaymasterInfo: (args: {
170
+ paymaster: Address;
171
+ }) => Promise<any>;
172
+ hasImplementation: (args: {
173
+ version: string;
174
+ }) => Promise<boolean>;
175
+ implementations: (args: {
176
+ version: string;
177
+ }) => Promise<Address>;
178
+ setImplementationV4: (args: {
179
+ impl: Address;
180
+ account?: Account | Address;
181
+ }) => Promise<Hash>;
182
+ getImplementationV4: () => Promise<Address>;
183
+ setRegistry: (args: {
184
+ registry: Address;
185
+ account?: Account | Address;
186
+ }) => Promise<Hash>;
187
+ addImplementation: (args: {
188
+ version: string;
189
+ implementation: Address;
190
+ account?: Account | Address;
191
+ }) => Promise<Hash>;
192
+ upgradeImplementation: (args: {
193
+ version: string;
194
+ newImplementation: Address;
195
+ account?: Account | Address;
196
+ }) => Promise<Hash>;
197
+ setDefaultVersion: (args: {
198
+ version: string;
199
+ account?: Account | Address;
200
+ }) => Promise<Hash>;
201
+ REGISTRY: () => Promise<Address>;
202
+ ENTRY_POINT: () => Promise<Address>;
203
+ paymasterFactoryOwner: () => Promise<Address>;
204
+ transferPaymasterFactoryOwnership: (args: {
205
+ newOwner: Address;
206
+ account?: Account | Address;
207
+ }) => Promise<Hash>;
208
+ renouncePaymasterFactoryOwnership: (args: {
209
+ account?: Account | Address;
210
+ }) => Promise<Hash>;
211
+ defaultVersion: () => Promise<string>;
212
+ paymasterFactoryVersion: () => Promise<string>;
213
+ };
214
+ export declare const xPNTsFactoryActions: (address: Address) => (client: PublicClient | WalletClient) => XPNTsFactoryActions;
215
+ export declare const paymasterFactoryActions: (address: Address) => (client: PublicClient | WalletClient) => PaymasterFactoryActions;