@aastar/account 0.16.7 → 0.16.11

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 (79) hide show
  1. package/dist/{account/src/eoa.js → eoa.js} +1 -2
  2. package/package.json +4 -7
  3. package/dist/core/src/abis/index.d.ts +0 -1126
  4. package/dist/core/src/abis/index.js +0 -91
  5. package/dist/core/src/actions/StateValidator.d.ts +0 -68
  6. package/dist/core/src/actions/StateValidator.js +0 -187
  7. package/dist/core/src/actions/account.d.ts +0 -55
  8. package/dist/core/src/actions/account.js +0 -133
  9. package/dist/core/src/actions/aggregator.d.ts +0 -17
  10. package/dist/core/src/actions/aggregator.js +0 -31
  11. package/dist/core/src/actions/dvt.d.ts +0 -30
  12. package/dist/core/src/actions/dvt.js +0 -41
  13. package/dist/core/src/actions/entryPoint.d.ts +0 -90
  14. package/dist/core/src/actions/entryPoint.js +0 -211
  15. package/dist/core/src/actions/factory.d.ts +0 -215
  16. package/dist/core/src/actions/factory.js +0 -442
  17. package/dist/core/src/actions/faucet.d.ts +0 -48
  18. package/dist/core/src/actions/faucet.js +0 -337
  19. package/dist/core/src/actions/gtokenExtended.d.ts +0 -39
  20. package/dist/core/src/actions/gtokenExtended.js +0 -115
  21. package/dist/core/src/actions/index.d.ts +0 -15
  22. package/dist/core/src/actions/index.js +0 -17
  23. package/dist/core/src/actions/paymasterV4.d.ts +0 -170
  24. package/dist/core/src/actions/paymasterV4.js +0 -334
  25. package/dist/core/src/actions/registry.d.ts +0 -246
  26. package/dist/core/src/actions/registry.js +0 -667
  27. package/dist/core/src/actions/reputation.d.ts +0 -129
  28. package/dist/core/src/actions/reputation.js +0 -281
  29. package/dist/core/src/actions/sbt.d.ts +0 -191
  30. package/dist/core/src/actions/sbt.js +0 -533
  31. package/dist/core/src/actions/staking.d.ts +0 -132
  32. package/dist/core/src/actions/staking.js +0 -330
  33. package/dist/core/src/actions/superPaymaster.d.ts +0 -237
  34. package/dist/core/src/actions/superPaymaster.js +0 -644
  35. package/dist/core/src/actions/tokens.d.ts +0 -229
  36. package/dist/core/src/actions/tokens.js +0 -415
  37. package/dist/core/src/branding.d.ts +0 -30
  38. package/dist/core/src/branding.js +0 -30
  39. package/dist/core/src/clients/BaseClient.d.ts +0 -25
  40. package/dist/core/src/clients/BaseClient.js +0 -66
  41. package/dist/core/src/clients/types.d.ts +0 -60
  42. package/dist/core/src/clients/types.js +0 -1
  43. package/dist/core/src/clients.d.ts +0 -5
  44. package/dist/core/src/clients.js +0 -11
  45. package/dist/core/src/communities.d.ts +0 -52
  46. package/dist/core/src/communities.js +0 -73
  47. package/dist/core/src/config/ContractConfigManager.d.ts +0 -20
  48. package/dist/core/src/config/ContractConfigManager.js +0 -48
  49. package/dist/core/src/constants.d.ts +0 -88
  50. package/dist/core/src/constants.js +0 -125
  51. package/dist/core/src/contract-addresses.d.ts +0 -110
  52. package/dist/core/src/contract-addresses.js +0 -99
  53. package/dist/core/src/contracts.d.ts +0 -424
  54. package/dist/core/src/contracts.js +0 -343
  55. package/dist/core/src/crypto/blsSigner.d.ts +0 -64
  56. package/dist/core/src/crypto/blsSigner.js +0 -98
  57. package/dist/core/src/crypto/index.d.ts +0 -1
  58. package/dist/core/src/crypto/index.js +0 -1
  59. package/dist/core/src/index.d.ts +0 -21
  60. package/dist/core/src/index.js +0 -21
  61. package/dist/core/src/networks.d.ts +0 -127
  62. package/dist/core/src/networks.js +0 -118
  63. package/dist/core/src/requirementChecker.d.ts +0 -38
  64. package/dist/core/src/requirementChecker.js +0 -139
  65. package/dist/core/src/roles.d.ts +0 -204
  66. package/dist/core/src/roles.js +0 -211
  67. package/dist/core/src/utils/validation.d.ts +0 -24
  68. package/dist/core/src/utils/validation.js +0 -56
  69. /package/dist/{account/src/accounts → accounts}/simple.d.ts +0 -0
  70. /package/dist/{account/src/accounts → accounts}/simple.js +0 -0
  71. /package/dist/{account/src/accounts → accounts}/simple.test.d.ts +0 -0
  72. /package/dist/{account/src/accounts → accounts}/simple.test.js +0 -0
  73. /package/dist/{account/src/eoa.d.ts → eoa.d.ts} +0 -0
  74. /package/dist/{account/src/eoa.test.d.ts → eoa.test.d.ts} +0 -0
  75. /package/dist/{account/src/eoa.test.js → eoa.test.js} +0 -0
  76. /package/dist/{account/src/index.d.ts → index.d.ts} +0 -0
  77. /package/dist/{account/src/index.js → index.js} +0 -0
  78. /package/dist/{account/src/index.test.d.ts → index.test.d.ts} +0 -0
  79. /package/dist/{account/src/index.test.js → index.test.js} +0 -0
@@ -1,91 +0,0 @@
1
- /**
2
- * Smart Contract ABIs (Unified Naming)
3
- *
4
- * 命名策略:
5
- * - 文件名:统一无版本号(如 BLSAggregator.json)
6
- * - 版本信息:通过 ABI 中的 version() 函数获取
7
- * - 同步时自动去除版本号后缀(V3 等)
8
- */
9
- // Core System
10
- import RegistryABIData from './Registry.json' with { type: 'json' };
11
- import GTokenABIData from './GToken.json' with { type: 'json' };
12
- import GTokenStakingABIData from './GTokenStaking.json' with { type: 'json' };
13
- import SuperPaymasterABIData from './SuperPaymaster.json' with { type: 'json' };
14
- import PaymasterFactoryABIData from './PaymasterFactory.json' with { type: 'json' };
15
- import PaymasterABIData from './Paymaster.json' with { type: 'json' };
16
- // AA Standard (从 out/ 提取)
17
- import EntryPointABIData from './EntryPoint.json' with { type: 'json' };
18
- import SimpleAccountABIData from './SimpleAccount.json' with { type: 'json' };
19
- import SimpleAccountFactoryABIData from './SimpleAccountFactory.json' with { type: 'json' };
20
- // Token System
21
- import xPNTsTokenABIData from './xPNTsToken.json' with { type: 'json' };
22
- import xPNTsFactoryABIData from './xPNTsFactory.json' with { type: 'json' };
23
- import MySBTABIData from './MySBT.json' with { type: 'json' };
24
- // Identity & Reputation
25
- import ReputationSystemABIData from './ReputationSystem.json' with { type: 'json' };
26
- // Monitoring System
27
- import DVTValidatorABIData from './DVTValidator.json' with { type: 'json' };
28
- import BLSAggregatorABIData from './BLSAggregator.json' with { type: 'json' };
29
- import BLSValidatorABIData from './BLSValidator.json' with { type: 'json' };
30
- // ========== Re-export ABIs (Raw Arrays) ==========
31
- // ========== Re-export ABIs (Raw Arrays) ==========
32
- function extractAbi(artifact) {
33
- // If it's an array, it IS the ABI. If it's an object, try .abi.
34
- // If .abi is undefined but it's not an array, it might be an older format or unexpected,
35
- // but strictly checking Array.isArray helps standard foundry artifacts vs hardhat artifacts.
36
- return Array.isArray(artifact) ? artifact : artifact.abi;
37
- }
38
- export const RegistryABI = extractAbi(RegistryABIData);
39
- export const GTokenABI = extractAbi(GTokenABIData);
40
- export const GTokenStakingABI = extractAbi(GTokenStakingABIData);
41
- export const SuperPaymasterABI = extractAbi(SuperPaymasterABIData);
42
- export const PaymasterFactoryABI = extractAbi(PaymasterFactoryABIData);
43
- export const PaymasterV4ABI = extractAbi(PaymasterABIData);
44
- export const PaymasterABI = extractAbi(PaymasterABIData);
45
- export const EntryPointABI = extractAbi(EntryPointABIData);
46
- export const SimpleAccountABI = extractAbi(SimpleAccountABIData);
47
- export const SimpleAccountFactoryABI = extractAbi(SimpleAccountFactoryABIData);
48
- export const xPNTsTokenABI = extractAbi(xPNTsTokenABIData);
49
- export const xPNTsFactoryABI = extractAbi(xPNTsFactoryABIData);
50
- export const MySBTABI = extractAbi(MySBTABIData);
51
- export const ReputationSystemABI = extractAbi(ReputationSystemABIData);
52
- export const DVTValidatorABI = extractAbi(DVTValidatorABIData);
53
- export const BLSAggregatorABI = extractAbi(BLSAggregatorABIData);
54
- export const BLSValidatorABI = extractAbi(BLSValidatorABIData);
55
- // ========== Artifacts (Flattened) ==========
56
- export const RegistryArtifact = RegistryABIData;
57
- export const GTokenArtifact = GTokenABIData;
58
- export const GTokenStakingArtifact = GTokenStakingABIData;
59
- export const SuperPaymasterArtifact = SuperPaymasterABIData;
60
- export const PaymasterFactoryArtifact = PaymasterFactoryABIData;
61
- export const PaymasterV4Artifact = PaymasterABIData;
62
- export const PaymasterArtifact = PaymasterABIData;
63
- export const EntryPointArtifact = EntryPointABIData;
64
- export const SimpleAccountArtifact = SimpleAccountABIData;
65
- export const SimpleAccountFactoryArtifact = SimpleAccountFactoryABIData;
66
- export const xPNTsTokenArtifact = xPNTsTokenABIData;
67
- export const xPNTsFactoryArtifact = xPNTsFactoryABIData;
68
- export const MySBTArtifact = MySBTABIData;
69
- export const ReputationSystemArtifact = ReputationSystemABIData;
70
- export const DVTValidatorArtifact = DVTValidatorABIData;
71
- export const BLSAggregatorArtifact = BLSAggregatorABIData;
72
- export const BLSValidatorArtifact = BLSValidatorABIData;
73
- // ========== Abis Namespace (Unified Access) ==========
74
- export const Abis = {
75
- Registry: RegistryABI,
76
- GToken: GTokenABI,
77
- GTokenStaking: GTokenStakingABI,
78
- SuperPaymaster: SuperPaymasterABI,
79
- PaymasterFactory: PaymasterFactoryABI,
80
- Paymaster: PaymasterABI,
81
- EntryPoint: EntryPointABI,
82
- SimpleAccount: SimpleAccountABI,
83
- SimpleAccountFactory: SimpleAccountFactoryABI,
84
- xPNTsToken: xPNTsTokenABI,
85
- xPNTsFactory: xPNTsFactoryABI,
86
- MySBT: MySBTABI,
87
- ReputationSystem: ReputationSystemABI,
88
- DVTValidator: DVTValidatorABI,
89
- BLSAggregator: BLSAggregatorABI,
90
- BLSValidator: BLSValidatorABI,
91
- };
@@ -1,68 +0,0 @@
1
- import { type Hex, type Address, type Chain } from 'viem';
2
- /**
3
- * Interface definitions
4
- */
5
- export interface ValidationParams {
6
- rpcUrl: string;
7
- chain: Chain;
8
- }
9
- export interface RoleValidationParams extends ValidationParams {
10
- registryAddress: Address;
11
- roleId: Hex;
12
- userAddress: Address;
13
- }
14
- export interface BalanceValidationParams extends ValidationParams {
15
- address: Address;
16
- minBalance?: string;
17
- }
18
- export interface TokenBalanceValidationParams extends BalanceValidationParams {
19
- tokenAddress: Address;
20
- }
21
- export interface DeploymentValidationParams extends ValidationParams {
22
- contractAddress: Address;
23
- }
24
- export interface ValidationResult {
25
- valid: boolean;
26
- message?: string;
27
- data?: any;
28
- }
29
- export interface AccountBalance {
30
- address: Address;
31
- eth: bigint;
32
- gToken: bigint;
33
- aPNTs: bigint;
34
- xPNTs: bigint;
35
- }
36
- export declare class StateValidator {
37
- /**
38
- * Create PublicClient helper
39
- */
40
- private static createClient;
41
- /**
42
- * Batch fetch balances for multiple accounts
43
- */
44
- static getAccountBalances(params: {
45
- rpcUrl: string;
46
- chain: Chain;
47
- addresses: Address[];
48
- gTokenAddress?: Address;
49
- aPNTsAddress?: Address;
50
- xPNTsAddress?: Address;
51
- }): Promise<AccountBalance[]>;
52
- /**
53
- * Role Validation
54
- */
55
- static validateRole(params: RoleValidationParams): Promise<ValidationResult>;
56
- /**
57
- * ETH Balance Validation
58
- */
59
- static validateETHBalance(params: BalanceValidationParams): Promise<ValidationResult>;
60
- /**
61
- * Token Balance Validation
62
- */
63
- static validateTokenBalance(params: TokenBalanceValidationParams): Promise<ValidationResult>;
64
- /**
65
- * Deployment Validation
66
- */
67
- static validateDeployment(params: DeploymentValidationParams): Promise<ValidationResult>;
68
- }
@@ -1,187 +0,0 @@
1
- import { createPublicClient, http, erc20Abi, formatEther } from 'viem';
2
- export class StateValidator {
3
- /**
4
- * Create PublicClient helper
5
- */
6
- static createClient(params) {
7
- return createPublicClient({
8
- chain: params.chain,
9
- transport: http(params.rpcUrl)
10
- });
11
- }
12
- /**
13
- * Batch fetch balances for multiple accounts
14
- */
15
- static async getAccountBalances(params) {
16
- const client = this.createClient({ rpcUrl: params.rpcUrl, chain: params.chain });
17
- const results = await Promise.all(params.addresses.map(async (address) => {
18
- const [eth, gToken, aPNTs, xPNTs] = await Promise.all([
19
- client.getBalance({ address }),
20
- params.gTokenAddress
21
- ? client.readContract({
22
- address: params.gTokenAddress,
23
- abi: erc20Abi,
24
- functionName: 'balanceOf',
25
- args: [address]
26
- })
27
- : Promise.resolve(0n),
28
- params.aPNTsAddress
29
- ? client.readContract({
30
- address: params.aPNTsAddress,
31
- abi: erc20Abi,
32
- functionName: 'balanceOf',
33
- args: [address]
34
- })
35
- : Promise.resolve(0n),
36
- params.xPNTsAddress
37
- ? client.readContract({
38
- address: params.xPNTsAddress,
39
- abi: erc20Abi,
40
- functionName: 'balanceOf',
41
- args: [address]
42
- })
43
- : Promise.resolve(0n)
44
- ]);
45
- return {
46
- address,
47
- eth,
48
- gToken,
49
- aPNTs,
50
- xPNTs
51
- };
52
- }));
53
- return results;
54
- }
55
- /**
56
- * Role Validation
57
- */
58
- static async validateRole(params) {
59
- try {
60
- const client = this.createClient(params);
61
- const hasRole = await client.readContract({
62
- address: params.registryAddress,
63
- abi: [{
64
- name: 'hasRole',
65
- type: 'function',
66
- stateMutability: 'view',
67
- inputs: [
68
- { name: 'roleId', type: 'bytes32' },
69
- { name: 'user', type: 'address' }
70
- ],
71
- outputs: [{ name: '', type: 'bool' }]
72
- }],
73
- functionName: 'hasRole',
74
- args: [params.roleId, params.userAddress]
75
- });
76
- return {
77
- valid: hasRole,
78
- message: hasRole
79
- ? `✅ User ${params.userAddress} has role ${params.roleId}`
80
- : `❌ User ${params.userAddress} does NOT have role ${params.roleId}`,
81
- data: { hasRole }
82
- };
83
- }
84
- catch (error) {
85
- return {
86
- valid: false,
87
- message: `❌ Role validation failed: ${error.message}`,
88
- data: { error }
89
- };
90
- }
91
- }
92
- /**
93
- * ETH Balance Validation
94
- */
95
- static async validateETHBalance(params) {
96
- try {
97
- const client = this.createClient(params);
98
- const balance = await client.getBalance({ address: params.address });
99
- const balanceETH = Number(formatEther(balance));
100
- if (params.minBalance) {
101
- const minBalanceWei = BigInt(Math.floor(parseFloat(params.minBalance) * 1e18));
102
- const sufficient = balance >= minBalanceWei;
103
- return {
104
- valid: sufficient,
105
- message: sufficient
106
- ? `✅ ETH balance (${balanceETH.toFixed(4)}) meets minimum (${params.minBalance})`
107
- : `❌ ETH balance (${balanceETH.toFixed(4)}) below minimum (${params.minBalance})`,
108
- data: { balance, balanceETH, minBalance: params.minBalance }
109
- };
110
- }
111
- return {
112
- valid: true,
113
- message: `ℹ️ ETH balance: ${balanceETH.toFixed(4)} ETH`,
114
- data: { balance, balanceETH }
115
- };
116
- }
117
- catch (error) {
118
- return {
119
- valid: false,
120
- message: `❌ ETH balance validation failed: ${error.message}`,
121
- data: { error }
122
- };
123
- }
124
- }
125
- /**
126
- * Token Balance Validation
127
- */
128
- static async validateTokenBalance(params) {
129
- try {
130
- const client = this.createClient(params);
131
- const balance = await client.readContract({
132
- address: params.tokenAddress,
133
- abi: erc20Abi,
134
- functionName: 'balanceOf',
135
- args: [params.address]
136
- });
137
- const balanceToken = Number(formatEther(balance));
138
- if (params.minBalance) {
139
- const minBalanceWei = BigInt(Math.floor(parseFloat(params.minBalance) * 1e18));
140
- const sufficient = balance >= minBalanceWei;
141
- return {
142
- valid: sufficient,
143
- message: sufficient
144
- ? `✅ Token balance (${balanceToken.toFixed(4)}) meets minimum (${params.minBalance})`
145
- : `❌ Token balance (${balanceToken.toFixed(4)}) below minimum (${params.minBalance})`,
146
- data: { balance, balanceToken, minBalance: params.minBalance }
147
- };
148
- }
149
- return {
150
- valid: true,
151
- message: `ℹ️ Token balance: ${balanceToken.toFixed(4)}`,
152
- data: { balance, balanceToken }
153
- };
154
- }
155
- catch (error) {
156
- return {
157
- valid: false,
158
- message: `❌ Token balance validation failed: ${error.message}`,
159
- data: { error }
160
- };
161
- }
162
- }
163
- /**
164
- * Deployment Validation
165
- */
166
- static async validateDeployment(params) {
167
- try {
168
- const client = this.createClient(params);
169
- const code = await client.getBytecode({ address: params.contractAddress });
170
- const isDeployed = code !== undefined && code !== '0x';
171
- return {
172
- valid: isDeployed,
173
- message: isDeployed
174
- ? `✅ Contract deployed at ${params.contractAddress}`
175
- : `❌ No contract found at ${params.contractAddress}`,
176
- data: { code, isDeployed }
177
- };
178
- }
179
- catch (error) {
180
- return {
181
- valid: false,
182
- message: `❌ Deployment validation failed: ${error.message}`,
183
- data: { error }
184
- };
185
- }
186
- }
187
- }
@@ -1,55 +0,0 @@
1
- import { type Address, type PublicClient, type WalletClient, type Hex, type Hash, type Account } from 'viem';
2
- export type AccountActions = {
3
- execute: (args: {
4
- dest: Address;
5
- value: bigint;
6
- func: Hex;
7
- account?: Account | Address;
8
- }) => Promise<Hash>;
9
- executeBatch: (args: {
10
- dest: Address[];
11
- value: bigint[];
12
- func: Hex[];
13
- account?: Account | Address;
14
- }) => Promise<Hash>;
15
- getNonce: () => Promise<bigint>;
16
- entryPoint: () => Promise<Address>;
17
- addDeposit: (args: {
18
- account?: Account | Address;
19
- }) => Promise<Hash>;
20
- withdrawDepositTo: (args: {
21
- withdrawAddress: Address;
22
- amount: bigint;
23
- account?: Account | Address;
24
- }) => Promise<Hash>;
25
- getDeposit: () => Promise<bigint>;
26
- owner: () => Promise<Address>;
27
- initialize: (args: {
28
- owner: Address;
29
- account?: Account | Address;
30
- }) => Promise<Hash>;
31
- upgradeToAndCall: (args: {
32
- newImplementation: Address;
33
- data: Hex;
34
- account?: Account | Address;
35
- }) => Promise<Hash>;
36
- proxiableUUID: () => Promise<Hex>;
37
- supportsInterface: (args: {
38
- interfaceId: Hex;
39
- }) => Promise<boolean>;
40
- UPGRADE_INTERFACE_VERSION: () => Promise<string>;
41
- };
42
- export type AccountFactoryActions = {
43
- createAccount: (args: {
44
- owner: Address;
45
- salt: bigint;
46
- account?: Account | Address;
47
- }) => Promise<Hash>;
48
- getAddress: (args: {
49
- owner: Address;
50
- salt: bigint;
51
- }) => Promise<Address>;
52
- accountImplementation: () => Promise<Address>;
53
- };
54
- export declare const accountActions: (address: Address) => (client: PublicClient | WalletClient) => AccountActions;
55
- export declare const accountFactoryActions: (address: Address) => (client: PublicClient | WalletClient) => AccountFactoryActions;
@@ -1,133 +0,0 @@
1
- import { SimpleAccountABI, SimpleAccountFactoryABI } from '../abis/index.js';
2
- export const accountActions = (address) => (client) => ({
3
- async execute({ dest, value, func, account }) {
4
- return client.writeContract({
5
- address,
6
- abi: SimpleAccountABI,
7
- functionName: 'execute',
8
- args: [dest, value, func],
9
- account: account,
10
- chain: client.chain
11
- });
12
- },
13
- async executeBatch({ dest, value, func, account }) {
14
- // Zip arguments into Call[] struct format
15
- const calls = dest.map((t, i) => ({
16
- target: t,
17
- value: value[i],
18
- data: func[i]
19
- }));
20
- return client.writeContract({
21
- address,
22
- abi: SimpleAccountABI,
23
- functionName: 'executeBatch',
24
- args: [calls],
25
- account: account,
26
- chain: client.chain
27
- });
28
- },
29
- async getNonce() {
30
- return client.readContract({
31
- address,
32
- abi: SimpleAccountABI,
33
- functionName: 'getNonce',
34
- args: []
35
- });
36
- },
37
- async entryPoint() {
38
- return client.readContract({
39
- address,
40
- abi: SimpleAccountABI,
41
- functionName: 'entryPoint',
42
- args: []
43
- });
44
- },
45
- async addDeposit({ account }) {
46
- return client.writeContract({
47
- address,
48
- abi: SimpleAccountABI,
49
- functionName: 'addDeposit',
50
- args: [],
51
- account: account,
52
- chain: client.chain
53
- });
54
- },
55
- async withdrawDepositTo({ withdrawAddress, amount, account }) {
56
- return client.writeContract({
57
- address,
58
- abi: SimpleAccountABI,
59
- functionName: 'withdrawDepositTo',
60
- args: [withdrawAddress, amount],
61
- account: account,
62
- chain: client.chain
63
- });
64
- },
65
- async getDeposit() {
66
- return client.readContract({
67
- address,
68
- abi: SimpleAccountABI,
69
- functionName: 'getDeposit',
70
- args: []
71
- });
72
- },
73
- async owner() {
74
- return client.readContract({
75
- address,
76
- abi: SimpleAccountABI,
77
- functionName: 'owner',
78
- args: []
79
- });
80
- },
81
- async initialize({ owner, account }) {
82
- return client.writeContract({
83
- address,
84
- abi: SimpleAccountABI,
85
- functionName: 'initialize',
86
- args: [owner],
87
- account: account,
88
- chain: client.chain
89
- });
90
- },
91
- async upgradeToAndCall({ newImplementation, data, account }) {
92
- return client.writeContract({
93
- address,
94
- abi: SimpleAccountABI,
95
- functionName: 'upgradeToAndCall',
96
- args: [newImplementation, data],
97
- account: account,
98
- chain: client.chain
99
- });
100
- },
101
- async proxiableUUID() {
102
- return client.readContract({ address, abi: SimpleAccountABI, functionName: 'proxiableUUID', args: [] });
103
- },
104
- async supportsInterface({ interfaceId }) {
105
- return client.readContract({ address, abi: SimpleAccountABI, functionName: 'supportsInterface', args: [interfaceId] });
106
- },
107
- async UPGRADE_INTERFACE_VERSION() {
108
- return client.readContract({ address, abi: SimpleAccountABI, functionName: 'UPGRADE_INTERFACE_VERSION', args: [] });
109
- }
110
- });
111
- export const accountFactoryActions = (address) => (client) => ({
112
- async createAccount({ owner, salt, account }) {
113
- return client.writeContract({
114
- address,
115
- abi: SimpleAccountFactoryABI,
116
- functionName: 'createAccount',
117
- args: [owner, salt],
118
- account: account,
119
- chain: client.chain
120
- });
121
- },
122
- async getAddress({ owner, salt }) {
123
- return client.readContract({
124
- address,
125
- abi: SimpleAccountFactoryABI,
126
- functionName: 'getAddress',
127
- args: [owner, salt]
128
- });
129
- },
130
- async accountImplementation() {
131
- return client.readContract({ address, abi: SimpleAccountFactoryABI, functionName: 'accountImplementation', args: [] });
132
- }
133
- });
@@ -1,17 +0,0 @@
1
- import { type Address, type PublicClient, type WalletClient, type Hex, type Hash, type Account } from 'viem';
2
- export type AggregatorActions = {
3
- registerBLSPublicKey: (args: {
4
- address: Address;
5
- publicKey: Hex;
6
- account?: Account | Address;
7
- }) => Promise<Hash>;
8
- setBLSThreshold: (args: {
9
- address: Address;
10
- threshold: number;
11
- account?: Account | Address;
12
- }) => Promise<Hash>;
13
- getBLSThreshold: (args: {
14
- address: Address;
15
- }) => Promise<bigint>;
16
- };
17
- export declare const aggregatorActions: () => (client: PublicClient | WalletClient) => AggregatorActions;
@@ -1,31 +0,0 @@
1
- import { BLSAggregatorABI } from '../abis/index.js';
2
- export const aggregatorActions = () => (client) => ({
3
- async registerBLSPublicKey({ address, publicKey, account }) {
4
- return client.writeContract({
5
- address,
6
- abi: BLSAggregatorABI,
7
- functionName: 'registerBLSPublicKey',
8
- args: [publicKey],
9
- account: account,
10
- chain: client.chain
11
- });
12
- },
13
- async setBLSThreshold({ address, threshold, account }) {
14
- return client.writeContract({
15
- address,
16
- abi: BLSAggregatorABI,
17
- functionName: 'setThreshold',
18
- args: [BigInt(threshold)],
19
- account: account,
20
- chain: client.chain
21
- });
22
- },
23
- async getBLSThreshold({ address }) {
24
- return client.readContract({
25
- address,
26
- abi: BLSAggregatorABI,
27
- functionName: 'threshold',
28
- args: []
29
- });
30
- }
31
- });
@@ -1,30 +0,0 @@
1
- import { type Address, type PublicClient, type WalletClient, type Hex, type Hash, type Account } from 'viem';
2
- export type DVTActions = {
3
- createSlashProposal: (args: {
4
- address: Address;
5
- operator: Address;
6
- level: number;
7
- reason: string;
8
- account?: Account | Address;
9
- }) => Promise<Hash>;
10
- signSlashProposal: (args: {
11
- address: Address;
12
- proposalId: bigint;
13
- signature: Hex;
14
- account?: Account | Address;
15
- }) => Promise<Hash>;
16
- executeSlashWithProof: (args: {
17
- address: Address;
18
- proposalId: bigint;
19
- repUsers: Address[];
20
- newScores: bigint[];
21
- epoch: bigint;
22
- proof: Hex;
23
- account?: Account | Address;
24
- }) => Promise<Hash>;
25
- isValidator: (args: {
26
- address: Address;
27
- user: Address;
28
- }) => Promise<boolean>;
29
- };
30
- export declare const dvtActions: () => (client: PublicClient | WalletClient) => DVTActions;
@@ -1,41 +0,0 @@
1
- import { DVTValidatorABI } from '../abis/index.js';
2
- export const dvtActions = () => (client) => ({
3
- async createSlashProposal({ address, operator, level, reason, account }) {
4
- return client.writeContract({
5
- address,
6
- abi: DVTValidatorABI,
7
- functionName: 'createProposal',
8
- args: [operator, level, reason],
9
- account: account,
10
- chain: client.chain
11
- });
12
- },
13
- async signSlashProposal({ address, proposalId, signature, account }) {
14
- return client.writeContract({
15
- address,
16
- abi: DVTValidatorABI,
17
- functionName: 'signProposal',
18
- args: [proposalId, signature],
19
- account: account,
20
- chain: client.chain
21
- });
22
- },
23
- async executeSlashWithProof({ address, proposalId, repUsers, newScores, epoch, proof, account }) {
24
- return client.writeContract({
25
- address,
26
- abi: DVTValidatorABI,
27
- functionName: 'executeWithProof',
28
- args: [proposalId, repUsers, newScores, epoch, proof],
29
- account: account,
30
- chain: client.chain
31
- });
32
- },
33
- async isValidator({ address, user }) {
34
- return client.readContract({
35
- address,
36
- abi: DVTValidatorABI,
37
- functionName: 'isValidator',
38
- args: [user]
39
- });
40
- }
41
- });