@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.
- 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/dapp/src/index.d.ts +3 -0
- package/dist/dapp/src/index.js +3 -0
- package/dist/dapp/src/ui/components/EvaluationPanel.d.ts +11 -0
- package/dist/dapp/src/ui/components/EvaluationPanel.js +37 -0
- package/dist/dapp/src/ui/hooks/useCreditScore.d.ts +13 -0
- package/dist/dapp/src/ui/hooks/useCreditScore.js +32 -0
- package/dist/dapp/src/ui/hooks/useSuperPaymaster.d.ts +8 -0
- package/dist/dapp/src/ui/hooks/useSuperPaymaster.js +23 -0
- package/dist/dapp/src/ui/index.d.ts +4 -0
- package/dist/dapp/src/ui/index.js +17 -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/PaymasterOperator.d.ts +41 -0
- package/dist/paymaster/src/V4/PaymasterOperator.js +241 -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/SuperPaymasterClient.d.ts +21 -0
- package/dist/paymaster/src/V4/SuperPaymasterClient.js +73 -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 +31 -0
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
import { type Address, type PublicClient, type WalletClient, type Hex, type Hash, type Account } from 'viem';
|
|
2
|
+
export type ReputationActions = {
|
|
3
|
+
setReputationRule: (args: {
|
|
4
|
+
ruleId: Hex;
|
|
5
|
+
rule: any;
|
|
6
|
+
account?: Account | Address;
|
|
7
|
+
}) => Promise<Hash>;
|
|
8
|
+
getReputationRule: (args: {
|
|
9
|
+
ruleId: Hex;
|
|
10
|
+
}) => Promise<any>;
|
|
11
|
+
enableRule: (args: {
|
|
12
|
+
ruleId: Hex;
|
|
13
|
+
account?: Account | Address;
|
|
14
|
+
}) => Promise<Hash>;
|
|
15
|
+
disableRule: (args: {
|
|
16
|
+
ruleId: Hex;
|
|
17
|
+
account?: Account | Address;
|
|
18
|
+
}) => Promise<Hash>;
|
|
19
|
+
isRuleActive: (args: {
|
|
20
|
+
ruleId: Hex;
|
|
21
|
+
}) => Promise<boolean>;
|
|
22
|
+
getActiveRules: (args: {
|
|
23
|
+
community: Address;
|
|
24
|
+
}) => Promise<Hex[]>;
|
|
25
|
+
getRuleCount: () => Promise<bigint>;
|
|
26
|
+
computeScore: (args: {
|
|
27
|
+
user: Address;
|
|
28
|
+
community: Address;
|
|
29
|
+
}) => Promise<bigint>;
|
|
30
|
+
getUserScore: (args: {
|
|
31
|
+
user: Address;
|
|
32
|
+
}) => Promise<bigint>;
|
|
33
|
+
getCommunityScore: (args: {
|
|
34
|
+
community: Address;
|
|
35
|
+
}) => Promise<bigint>;
|
|
36
|
+
communityReputations: (args: {
|
|
37
|
+
community: Address;
|
|
38
|
+
user: Address;
|
|
39
|
+
}) => Promise<bigint>;
|
|
40
|
+
setRule: (args: {
|
|
41
|
+
ruleId: Hex;
|
|
42
|
+
rule: any;
|
|
43
|
+
account?: Account | Address;
|
|
44
|
+
}) => Promise<Hash>;
|
|
45
|
+
calculateReputation: (args: {
|
|
46
|
+
user: Address;
|
|
47
|
+
community: Address;
|
|
48
|
+
}) => Promise<bigint>;
|
|
49
|
+
nftCollectionBoost: (args: {
|
|
50
|
+
collection: Address;
|
|
51
|
+
}) => Promise<bigint>;
|
|
52
|
+
batchUpdateScores: (args: {
|
|
53
|
+
users: Address[];
|
|
54
|
+
scores: bigint[];
|
|
55
|
+
account?: Account | Address;
|
|
56
|
+
}) => Promise<Hash>;
|
|
57
|
+
batchSyncToRegistry: (args: {
|
|
58
|
+
users: Address[];
|
|
59
|
+
account?: Account | Address;
|
|
60
|
+
}) => Promise<Hash>;
|
|
61
|
+
syncToRegistry: (args: {
|
|
62
|
+
user: Address;
|
|
63
|
+
communities: Address[];
|
|
64
|
+
ruleIds: Hex[][];
|
|
65
|
+
activities: bigint[][];
|
|
66
|
+
epoch: bigint;
|
|
67
|
+
proof: Hex;
|
|
68
|
+
account?: Account | Address;
|
|
69
|
+
}) => Promise<Hash>;
|
|
70
|
+
setRegistry: (args: {
|
|
71
|
+
registry: Address;
|
|
72
|
+
account?: Account | Address;
|
|
73
|
+
}) => Promise<Hash>;
|
|
74
|
+
setEntropyFactor: (args: {
|
|
75
|
+
factor: bigint;
|
|
76
|
+
account?: Account | Address;
|
|
77
|
+
}) => Promise<Hash>;
|
|
78
|
+
getEntropyFactor: () => Promise<bigint>;
|
|
79
|
+
REGISTRY: () => Promise<Address>;
|
|
80
|
+
reputationOwner: () => Promise<Address>;
|
|
81
|
+
transferReputationOwnership: (args: {
|
|
82
|
+
newOwner: Address;
|
|
83
|
+
account?: Account | Address;
|
|
84
|
+
}) => Promise<Hash>;
|
|
85
|
+
renounceReputationOwnership: (args: {
|
|
86
|
+
account?: Account | Address;
|
|
87
|
+
}) => Promise<Hash>;
|
|
88
|
+
setCommunityReputation: (args: {
|
|
89
|
+
community: Address;
|
|
90
|
+
reputation: bigint;
|
|
91
|
+
account?: Account | Address;
|
|
92
|
+
}) => Promise<Hash>;
|
|
93
|
+
updateNFTHoldStart: (args: {
|
|
94
|
+
user: Address;
|
|
95
|
+
collection: Address;
|
|
96
|
+
start: bigint;
|
|
97
|
+
account?: Account | Address;
|
|
98
|
+
}) => Promise<Hash>;
|
|
99
|
+
communityRules: (args: {
|
|
100
|
+
community: Address;
|
|
101
|
+
ruleId: Hex;
|
|
102
|
+
}) => Promise<boolean>;
|
|
103
|
+
defaultRule: () => Promise<Hex>;
|
|
104
|
+
entropyFactors: (args: {
|
|
105
|
+
factorId: bigint;
|
|
106
|
+
}) => Promise<bigint>;
|
|
107
|
+
nftHoldStart: (args: {
|
|
108
|
+
user: Address;
|
|
109
|
+
collection: Address;
|
|
110
|
+
}) => Promise<bigint>;
|
|
111
|
+
boostedCollections: (args: {
|
|
112
|
+
collection: Address;
|
|
113
|
+
}) => Promise<bigint>;
|
|
114
|
+
communityActiveRules: (args: {
|
|
115
|
+
community: Address;
|
|
116
|
+
ruleId: Hex;
|
|
117
|
+
}) => Promise<boolean>;
|
|
118
|
+
getReputationBreakdown: (args: {
|
|
119
|
+
user: Address;
|
|
120
|
+
community: Address;
|
|
121
|
+
}) => Promise<any>;
|
|
122
|
+
setNFTBoost: (args: {
|
|
123
|
+
collection: Address;
|
|
124
|
+
boost: bigint;
|
|
125
|
+
account?: Account | Address;
|
|
126
|
+
}) => Promise<Hash>;
|
|
127
|
+
reputationVersion: () => Promise<string>;
|
|
128
|
+
};
|
|
129
|
+
export declare const reputationActions: (address: Address) => (client: PublicClient | WalletClient) => ReputationActions;
|
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
import { ReputationSystemABI } from '../abis/index.js';
|
|
2
|
+
export const reputationActions = (address) => (client) => ({
|
|
3
|
+
// 规则配置
|
|
4
|
+
async setReputationRule({ ruleId, rule, account }) {
|
|
5
|
+
return client.writeContract({
|
|
6
|
+
address,
|
|
7
|
+
abi: ReputationSystemABI,
|
|
8
|
+
functionName: 'setReputationRule',
|
|
9
|
+
args: [ruleId, rule],
|
|
10
|
+
account: account,
|
|
11
|
+
chain: client.chain
|
|
12
|
+
});
|
|
13
|
+
},
|
|
14
|
+
async getReputationRule({ ruleId }) {
|
|
15
|
+
return client.readContract({
|
|
16
|
+
address,
|
|
17
|
+
abi: ReputationSystemABI,
|
|
18
|
+
functionName: 'getReputationRule',
|
|
19
|
+
args: [ruleId]
|
|
20
|
+
});
|
|
21
|
+
},
|
|
22
|
+
async enableRule({ ruleId, account }) {
|
|
23
|
+
return client.writeContract({
|
|
24
|
+
address,
|
|
25
|
+
abi: ReputationSystemABI,
|
|
26
|
+
functionName: 'enableRule',
|
|
27
|
+
args: [ruleId],
|
|
28
|
+
account: account,
|
|
29
|
+
chain: client.chain
|
|
30
|
+
});
|
|
31
|
+
},
|
|
32
|
+
async disableRule({ ruleId, account }) {
|
|
33
|
+
return client.writeContract({
|
|
34
|
+
address,
|
|
35
|
+
abi: ReputationSystemABI,
|
|
36
|
+
functionName: 'disableRule',
|
|
37
|
+
args: [ruleId],
|
|
38
|
+
account: account,
|
|
39
|
+
chain: client.chain
|
|
40
|
+
});
|
|
41
|
+
},
|
|
42
|
+
async isRuleActive({ ruleId }) {
|
|
43
|
+
return client.readContract({
|
|
44
|
+
address,
|
|
45
|
+
abi: ReputationSystemABI,
|
|
46
|
+
functionName: 'isRuleActive',
|
|
47
|
+
args: [ruleId]
|
|
48
|
+
});
|
|
49
|
+
},
|
|
50
|
+
async getActiveRules({ community }) {
|
|
51
|
+
return client.readContract({
|
|
52
|
+
address,
|
|
53
|
+
abi: ReputationSystemABI,
|
|
54
|
+
functionName: 'getActiveRules',
|
|
55
|
+
args: [community]
|
|
56
|
+
});
|
|
57
|
+
},
|
|
58
|
+
async getRuleCount() {
|
|
59
|
+
return client.readContract({
|
|
60
|
+
address,
|
|
61
|
+
abi: ReputationSystemABI,
|
|
62
|
+
functionName: 'getRuleCount',
|
|
63
|
+
args: []
|
|
64
|
+
});
|
|
65
|
+
},
|
|
66
|
+
// 积分计算
|
|
67
|
+
async computeScore({ user, community }) {
|
|
68
|
+
return client.readContract({
|
|
69
|
+
address,
|
|
70
|
+
abi: ReputationSystemABI,
|
|
71
|
+
functionName: 'computeScore',
|
|
72
|
+
args: [user, community]
|
|
73
|
+
});
|
|
74
|
+
},
|
|
75
|
+
async getUserScore({ user }) {
|
|
76
|
+
return client.readContract({
|
|
77
|
+
address,
|
|
78
|
+
abi: ReputationSystemABI,
|
|
79
|
+
functionName: 'getUserScore',
|
|
80
|
+
args: [user]
|
|
81
|
+
});
|
|
82
|
+
},
|
|
83
|
+
async getCommunityScore({ community }) {
|
|
84
|
+
return client.readContract({
|
|
85
|
+
address,
|
|
86
|
+
abi: ReputationSystemABI,
|
|
87
|
+
functionName: 'getCommunityScore',
|
|
88
|
+
args: [community]
|
|
89
|
+
});
|
|
90
|
+
},
|
|
91
|
+
// Public mapping getter
|
|
92
|
+
async communityReputations({ community, user }) {
|
|
93
|
+
return client.readContract({
|
|
94
|
+
address,
|
|
95
|
+
abi: ReputationSystemABI,
|
|
96
|
+
functionName: 'communityReputations',
|
|
97
|
+
args: [community, user]
|
|
98
|
+
});
|
|
99
|
+
},
|
|
100
|
+
// Missing Critical Actions
|
|
101
|
+
async setRule(args) {
|
|
102
|
+
return this.setReputationRule(args);
|
|
103
|
+
},
|
|
104
|
+
async calculateReputation(args) {
|
|
105
|
+
// Assuming calculateReputation calls computeScore or check if dedicated function exists
|
|
106
|
+
// Report said calculateReputation matches ABI.
|
|
107
|
+
return client.readContract({
|
|
108
|
+
address,
|
|
109
|
+
abi: ReputationSystemABI,
|
|
110
|
+
functionName: 'calculateReputation', // If this fails, it means calculateReputation is NOT in ABI and tool was confused? But report said it IS in ABI.
|
|
111
|
+
args: [args.user, args.community]
|
|
112
|
+
});
|
|
113
|
+
},
|
|
114
|
+
async nftCollectionBoost({ collection }) {
|
|
115
|
+
return client.readContract({
|
|
116
|
+
address,
|
|
117
|
+
abi: ReputationSystemABI,
|
|
118
|
+
functionName: 'nftCollectionBoost',
|
|
119
|
+
args: [collection]
|
|
120
|
+
});
|
|
121
|
+
},
|
|
122
|
+
// 批量操作
|
|
123
|
+
async batchUpdateScores({ users, scores, account }) {
|
|
124
|
+
return client.writeContract({
|
|
125
|
+
address,
|
|
126
|
+
abi: ReputationSystemABI,
|
|
127
|
+
functionName: 'batchUpdateScores',
|
|
128
|
+
args: [users, scores],
|
|
129
|
+
account: account,
|
|
130
|
+
chain: client.chain
|
|
131
|
+
});
|
|
132
|
+
},
|
|
133
|
+
async batchSyncToRegistry({ users, account }) {
|
|
134
|
+
return client.writeContract({
|
|
135
|
+
address,
|
|
136
|
+
abi: ReputationSystemABI,
|
|
137
|
+
functionName: 'batchSyncToRegistry',
|
|
138
|
+
args: [users],
|
|
139
|
+
account: account,
|
|
140
|
+
chain: client.chain
|
|
141
|
+
});
|
|
142
|
+
},
|
|
143
|
+
async syncToRegistry({ user, communities, ruleIds, activities, epoch, proof, account }) {
|
|
144
|
+
return client.writeContract({
|
|
145
|
+
address,
|
|
146
|
+
abi: ReputationSystemABI,
|
|
147
|
+
functionName: 'syncToRegistry',
|
|
148
|
+
args: [user, communities, ruleIds, activities, epoch, proof],
|
|
149
|
+
account: account,
|
|
150
|
+
chain: client.chain
|
|
151
|
+
});
|
|
152
|
+
},
|
|
153
|
+
// Admin & Config
|
|
154
|
+
async setRegistry({ registry, account }) {
|
|
155
|
+
return client.writeContract({
|
|
156
|
+
address,
|
|
157
|
+
abi: ReputationSystemABI,
|
|
158
|
+
functionName: 'setRegistry',
|
|
159
|
+
args: [registry],
|
|
160
|
+
account: account,
|
|
161
|
+
chain: client.chain
|
|
162
|
+
});
|
|
163
|
+
},
|
|
164
|
+
async setEntropyFactor({ factor, account }) {
|
|
165
|
+
return client.writeContract({
|
|
166
|
+
address,
|
|
167
|
+
abi: ReputationSystemABI,
|
|
168
|
+
functionName: 'setEntropyFactor',
|
|
169
|
+
args: [factor],
|
|
170
|
+
account: account,
|
|
171
|
+
chain: client.chain
|
|
172
|
+
});
|
|
173
|
+
},
|
|
174
|
+
async getEntropyFactor() {
|
|
175
|
+
return client.readContract({
|
|
176
|
+
address,
|
|
177
|
+
abi: ReputationSystemABI,
|
|
178
|
+
functionName: 'getEntropyFactor',
|
|
179
|
+
args: []
|
|
180
|
+
});
|
|
181
|
+
},
|
|
182
|
+
// Constants
|
|
183
|
+
async REGISTRY() {
|
|
184
|
+
return client.readContract({
|
|
185
|
+
address,
|
|
186
|
+
abi: ReputationSystemABI,
|
|
187
|
+
functionName: 'REGISTRY',
|
|
188
|
+
args: []
|
|
189
|
+
});
|
|
190
|
+
},
|
|
191
|
+
// Ownership
|
|
192
|
+
async reputationOwner() {
|
|
193
|
+
return client.readContract({
|
|
194
|
+
address,
|
|
195
|
+
abi: ReputationSystemABI,
|
|
196
|
+
functionName: 'owner',
|
|
197
|
+
args: []
|
|
198
|
+
});
|
|
199
|
+
},
|
|
200
|
+
async renounceReputationOwnership({ account } = {}) {
|
|
201
|
+
return client.writeContract({
|
|
202
|
+
address,
|
|
203
|
+
abi: ReputationSystemABI,
|
|
204
|
+
functionName: 'renounceOwnership',
|
|
205
|
+
args: [],
|
|
206
|
+
account: account,
|
|
207
|
+
chain: client.chain
|
|
208
|
+
});
|
|
209
|
+
},
|
|
210
|
+
async transferReputationOwnership({ newOwner, account }) {
|
|
211
|
+
return client.writeContract({
|
|
212
|
+
address,
|
|
213
|
+
abi: ReputationSystemABI,
|
|
214
|
+
functionName: 'transferOwnership',
|
|
215
|
+
args: [newOwner],
|
|
216
|
+
account: account,
|
|
217
|
+
chain: client.chain
|
|
218
|
+
});
|
|
219
|
+
},
|
|
220
|
+
async setCommunityReputation({ community, reputation, account }) {
|
|
221
|
+
return client.writeContract({
|
|
222
|
+
address,
|
|
223
|
+
abi: ReputationSystemABI,
|
|
224
|
+
functionName: 'setCommunityReputation',
|
|
225
|
+
args: [community, reputation],
|
|
226
|
+
account: account,
|
|
227
|
+
chain: client.chain
|
|
228
|
+
});
|
|
229
|
+
},
|
|
230
|
+
async updateNFTHoldStart({ user, collection, start, account }) {
|
|
231
|
+
return client.writeContract({
|
|
232
|
+
address,
|
|
233
|
+
abi: ReputationSystemABI,
|
|
234
|
+
functionName: 'updateNFTHoldStart',
|
|
235
|
+
args: [user, collection, start],
|
|
236
|
+
account: account,
|
|
237
|
+
chain: client.chain
|
|
238
|
+
});
|
|
239
|
+
},
|
|
240
|
+
// Views
|
|
241
|
+
async communityRules({ community, ruleId }) {
|
|
242
|
+
return client.readContract({ address, abi: ReputationSystemABI, functionName: 'communityRules', args: [community, ruleId] });
|
|
243
|
+
},
|
|
244
|
+
async defaultRule() {
|
|
245
|
+
return client.readContract({ address, abi: ReputationSystemABI, functionName: 'defaultRule', args: [] });
|
|
246
|
+
},
|
|
247
|
+
async entropyFactors({ factorId }) {
|
|
248
|
+
return client.readContract({ address, abi: ReputationSystemABI, functionName: 'entropyFactors', args: [factorId] });
|
|
249
|
+
},
|
|
250
|
+
async nftHoldStart({ user, collection }) {
|
|
251
|
+
return client.readContract({ address, abi: ReputationSystemABI, functionName: 'nftHoldStart', args: [user, collection] });
|
|
252
|
+
},
|
|
253
|
+
async boostedCollections({ collection }) {
|
|
254
|
+
return client.readContract({ address, abi: ReputationSystemABI, functionName: 'boostedCollections', args: [collection] });
|
|
255
|
+
},
|
|
256
|
+
async communityActiveRules({ community, ruleId }) {
|
|
257
|
+
return client.readContract({ address, abi: ReputationSystemABI, functionName: 'communityActiveRules', args: [community, ruleId] });
|
|
258
|
+
},
|
|
259
|
+
async getReputationBreakdown({ user, community }) {
|
|
260
|
+
return client.readContract({ address, abi: ReputationSystemABI, functionName: 'getReputationBreakdown', args: [user, community] });
|
|
261
|
+
},
|
|
262
|
+
async setNFTBoost({ collection, boost, account }) {
|
|
263
|
+
return client.writeContract({
|
|
264
|
+
address,
|
|
265
|
+
abi: ReputationSystemABI,
|
|
266
|
+
functionName: 'setNFTBoost',
|
|
267
|
+
args: [collection, boost],
|
|
268
|
+
account: account,
|
|
269
|
+
chain: client.chain
|
|
270
|
+
});
|
|
271
|
+
},
|
|
272
|
+
// Version
|
|
273
|
+
async reputationVersion() {
|
|
274
|
+
return client.readContract({
|
|
275
|
+
address,
|
|
276
|
+
abi: ReputationSystemABI,
|
|
277
|
+
functionName: 'version',
|
|
278
|
+
args: []
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
});
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
import { type Address, type PublicClient, type WalletClient, type Hex, type Hash, type Account } from 'viem';
|
|
2
|
+
export type SBTActions = {
|
|
3
|
+
sbtSafeMintForRole: (args: {
|
|
4
|
+
roleId: Hex;
|
|
5
|
+
to: Address;
|
|
6
|
+
tokenURI: string;
|
|
7
|
+
account?: Account | Address;
|
|
8
|
+
}) => Promise<Hash>;
|
|
9
|
+
sbtAirdropMint: (args: {
|
|
10
|
+
roleId: Hex;
|
|
11
|
+
to: Address;
|
|
12
|
+
tokenURI: string;
|
|
13
|
+
account?: Account | Address;
|
|
14
|
+
}) => Promise<Hash>;
|
|
15
|
+
sbtMintForRole: (args: {
|
|
16
|
+
roleId: Hex;
|
|
17
|
+
to: Address;
|
|
18
|
+
account?: Account | Address;
|
|
19
|
+
}) => Promise<Hash>;
|
|
20
|
+
sbtGetUserSBT: (args: {
|
|
21
|
+
user: Address;
|
|
22
|
+
roleId: Hex;
|
|
23
|
+
}) => Promise<bigint>;
|
|
24
|
+
sbtGetSBTData: (args: {
|
|
25
|
+
tokenId: bigint;
|
|
26
|
+
}) => Promise<any>;
|
|
27
|
+
sbtGetCommunityMembership: (args: {
|
|
28
|
+
user: Address;
|
|
29
|
+
community: Address;
|
|
30
|
+
}) => Promise<bigint>;
|
|
31
|
+
sbtGetMemberships: (args: {
|
|
32
|
+
user: Address;
|
|
33
|
+
}) => Promise<any[]>;
|
|
34
|
+
sbtGetActiveMemberships: (args: {
|
|
35
|
+
user: Address;
|
|
36
|
+
}) => Promise<any[]>;
|
|
37
|
+
sbtVerifyCommunityMembership: (args: {
|
|
38
|
+
user: Address;
|
|
39
|
+
community: Address;
|
|
40
|
+
}) => Promise<boolean>;
|
|
41
|
+
sbtUserToSBT: (args: {
|
|
42
|
+
user: Address;
|
|
43
|
+
}) => Promise<bigint>;
|
|
44
|
+
sbtSbtData: (args: {
|
|
45
|
+
tokenId: bigint;
|
|
46
|
+
}) => Promise<any>;
|
|
47
|
+
sbtMembershipIndex: (args: {
|
|
48
|
+
user: Address;
|
|
49
|
+
index: bigint;
|
|
50
|
+
}) => Promise<any>;
|
|
51
|
+
sbtBalanceOf: (args: {
|
|
52
|
+
owner: Address;
|
|
53
|
+
}) => Promise<bigint>;
|
|
54
|
+
sbtOwnerOf: (args: {
|
|
55
|
+
tokenId: bigint;
|
|
56
|
+
}) => Promise<Address>;
|
|
57
|
+
sbtSafeTransferFrom: (args: {
|
|
58
|
+
from: Address;
|
|
59
|
+
to: Address;
|
|
60
|
+
tokenId: bigint;
|
|
61
|
+
account?: Account | Address;
|
|
62
|
+
}) => Promise<Hash>;
|
|
63
|
+
sbtTransferFrom: (args: {
|
|
64
|
+
from: Address;
|
|
65
|
+
to: Address;
|
|
66
|
+
tokenId: bigint;
|
|
67
|
+
account?: Account | Address;
|
|
68
|
+
}) => Promise<Hash>;
|
|
69
|
+
sbtApprove: (args: {
|
|
70
|
+
to: Address;
|
|
71
|
+
tokenId: bigint;
|
|
72
|
+
account?: Account | Address;
|
|
73
|
+
}) => Promise<Hash>;
|
|
74
|
+
sbtSetApprovalForAll: (args: {
|
|
75
|
+
operator: Address;
|
|
76
|
+
approved: boolean;
|
|
77
|
+
account?: Account | Address;
|
|
78
|
+
}) => Promise<Hash>;
|
|
79
|
+
sbtGetApproved: (args: {
|
|
80
|
+
tokenId: bigint;
|
|
81
|
+
}) => Promise<Address>;
|
|
82
|
+
sbtIsApprovedForAll: (args: {
|
|
83
|
+
owner: Address;
|
|
84
|
+
operator: Address;
|
|
85
|
+
}) => Promise<boolean>;
|
|
86
|
+
sbtName: () => Promise<string>;
|
|
87
|
+
sbtSymbol: () => Promise<string>;
|
|
88
|
+
sbtTokenURI: (args: {
|
|
89
|
+
tokenId: bigint;
|
|
90
|
+
}) => Promise<string>;
|
|
91
|
+
sbtTotalSupply: () => Promise<bigint>;
|
|
92
|
+
sbtTokenByIndex: (args: {
|
|
93
|
+
index: bigint;
|
|
94
|
+
}) => Promise<bigint>;
|
|
95
|
+
sbtTokenOfOwnerByIndex: (args: {
|
|
96
|
+
owner: Address;
|
|
97
|
+
index: bigint;
|
|
98
|
+
}) => Promise<bigint>;
|
|
99
|
+
sbtSupportsInterface: (args: {
|
|
100
|
+
interfaceId: Hex;
|
|
101
|
+
}) => Promise<boolean>;
|
|
102
|
+
sbtNextTokenId: () => Promise<bigint>;
|
|
103
|
+
sbtMint: (args: {
|
|
104
|
+
to: Address;
|
|
105
|
+
tokenURI: string;
|
|
106
|
+
account?: Account | Address;
|
|
107
|
+
}) => Promise<Hash>;
|
|
108
|
+
sbtBurn: (args: {
|
|
109
|
+
tokenId: bigint;
|
|
110
|
+
account?: Account | Address;
|
|
111
|
+
}) => Promise<Hash>;
|
|
112
|
+
sbtBurnSBT: (args: {
|
|
113
|
+
tokenId: bigint;
|
|
114
|
+
account?: Account | Address;
|
|
115
|
+
}) => Promise<Hash>;
|
|
116
|
+
sbtDeactivateAllMemberships: (args: {
|
|
117
|
+
user: Address;
|
|
118
|
+
account?: Account | Address;
|
|
119
|
+
}) => Promise<Hash>;
|
|
120
|
+
sbtSetBaseURI: (args: {
|
|
121
|
+
baseURI: string;
|
|
122
|
+
account?: Account | Address;
|
|
123
|
+
}) => Promise<Hash>;
|
|
124
|
+
sbtLeaveCommunity: (args: {
|
|
125
|
+
community: Address;
|
|
126
|
+
account?: Account | Address;
|
|
127
|
+
}) => Promise<Hash>;
|
|
128
|
+
sbtDeactivateMembership: (args: {
|
|
129
|
+
tokenId: bigint;
|
|
130
|
+
account?: Account | Address;
|
|
131
|
+
}) => Promise<Hash>;
|
|
132
|
+
sbtRecordActivity: (args: {
|
|
133
|
+
user: Address;
|
|
134
|
+
account?: Account | Address;
|
|
135
|
+
}) => Promise<Hash>;
|
|
136
|
+
sbtLastActivityTime: (args: {
|
|
137
|
+
user: Address;
|
|
138
|
+
}) => Promise<bigint>;
|
|
139
|
+
sbtWeeklyActivity: (args: {
|
|
140
|
+
user: Address;
|
|
141
|
+
}) => Promise<bigint>;
|
|
142
|
+
sbtReputationCalculator: () => Promise<Address>;
|
|
143
|
+
sbtSetReputationCalculator: (args: {
|
|
144
|
+
calculator: Address;
|
|
145
|
+
account?: Account | Address;
|
|
146
|
+
}) => Promise<Hash>;
|
|
147
|
+
sbtMintFee: () => Promise<bigint>;
|
|
148
|
+
sbtSetMintFee: (args: {
|
|
149
|
+
fee: bigint;
|
|
150
|
+
account?: Account | Address;
|
|
151
|
+
}) => Promise<Hash>;
|
|
152
|
+
sbtMinLockAmount: () => Promise<bigint>;
|
|
153
|
+
sbtSetMinLockAmount: (args: {
|
|
154
|
+
amount: bigint;
|
|
155
|
+
account?: Account | Address;
|
|
156
|
+
}) => Promise<Hash>;
|
|
157
|
+
sbtPause: (args: {
|
|
158
|
+
account?: Account | Address;
|
|
159
|
+
}) => Promise<Hash>;
|
|
160
|
+
sbtUnpause: (args: {
|
|
161
|
+
account?: Account | Address;
|
|
162
|
+
}) => Promise<Hash>;
|
|
163
|
+
sbtPaused: () => Promise<boolean>;
|
|
164
|
+
sbtDaoMultisig: () => Promise<Address>;
|
|
165
|
+
sbtSetDAOMultisig: (args: {
|
|
166
|
+
multisig: Address;
|
|
167
|
+
account?: Account | Address;
|
|
168
|
+
}) => Promise<Hash>;
|
|
169
|
+
sbtSetRegistry: (args: {
|
|
170
|
+
registry: Address;
|
|
171
|
+
account?: Account | Address;
|
|
172
|
+
}) => Promise<Hash>;
|
|
173
|
+
sbtSetSuperPaymaster: (args: {
|
|
174
|
+
paymaster: Address;
|
|
175
|
+
account?: Account | Address;
|
|
176
|
+
}) => Promise<Hash>;
|
|
177
|
+
sbtVersion: () => Promise<string>;
|
|
178
|
+
sbtREGISTRY: () => Promise<Address>;
|
|
179
|
+
sbtGTOKEN_STAKING: () => Promise<Address>;
|
|
180
|
+
sbtGTOKEN: () => Promise<Address>;
|
|
181
|
+
sbtSUPER_PAYMASTER: () => Promise<Address>;
|
|
182
|
+
sbtOwner: () => Promise<Address>;
|
|
183
|
+
sbtTransferSBTOwnership: (args: {
|
|
184
|
+
newOwner: Address;
|
|
185
|
+
account?: Account | Address;
|
|
186
|
+
}) => Promise<Hash>;
|
|
187
|
+
sbtRenounceOwnership: (args: {
|
|
188
|
+
account?: Account | Address;
|
|
189
|
+
}) => Promise<Hash>;
|
|
190
|
+
};
|
|
191
|
+
export declare const sbtActions: (address: Address) => (client: PublicClient | WalletClient) => SBTActions;
|