@clawlogic/sdk 0.0.1
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/README.md +227 -0
- package/dist/abis/agentIdentityRegistryAbi.d.ts +532 -0
- package/dist/abis/agentIdentityRegistryAbi.d.ts.map +1 -0
- package/dist/abis/agentIdentityRegistryAbi.js +2 -0
- package/dist/abis/agentIdentityRegistryAbi.js.map +1 -0
- package/dist/abis/agentRegistryAbi.d.ts +265 -0
- package/dist/abis/agentRegistryAbi.d.ts.map +1 -0
- package/dist/abis/agentRegistryAbi.js +151 -0
- package/dist/abis/agentRegistryAbi.js.map +1 -0
- package/dist/abis/agentReputationRegistryAbi.d.ts +224 -0
- package/dist/abis/agentReputationRegistryAbi.d.ts.map +1 -0
- package/dist/abis/agentReputationRegistryAbi.js +2 -0
- package/dist/abis/agentReputationRegistryAbi.js.map +1 -0
- package/dist/abis/agentValidationRegistryAbi.d.ts +281 -0
- package/dist/abis/agentValidationRegistryAbi.d.ts.map +1 -0
- package/dist/abis/agentValidationRegistryAbi.js +2 -0
- package/dist/abis/agentValidationRegistryAbi.js.map +1 -0
- package/dist/abis/outcomeTokenAbi.d.ts +255 -0
- package/dist/abis/outcomeTokenAbi.d.ts.map +1 -0
- package/dist/abis/outcomeTokenAbi.js +152 -0
- package/dist/abis/outcomeTokenAbi.js.map +1 -0
- package/dist/abis/predictionMarketHookAbi.d.ts +396 -0
- package/dist/abis/predictionMarketHookAbi.d.ts.map +1 -0
- package/dist/abis/predictionMarketHookAbi.js +212 -0
- package/dist/abis/predictionMarketHookAbi.js.map +1 -0
- package/dist/client.d.ts +241 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +569 -0
- package/dist/client.js.map +1 -0
- package/dist/config.d.ts +84 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +134 -0
- package/dist/config.js.map +1 -0
- package/dist/identity.d.ts +133 -0
- package/dist/identity.d.ts.map +1 -0
- package/dist/identity.js +314 -0
- package/dist/identity.js.map +1 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +191 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +11 -0
- package/dist/types.js.map +1 -0
- package/package.json +51 -0
- package/src/abis/.gitkeep +0 -0
- package/src/abis/AgentRegistry.json +1 -0
- package/src/abis/ENSAgentHelper.json +1 -0
- package/src/abis/OutcomeToken.json +1 -0
- package/src/abis/PredictionMarketHook.json +1 -0
- package/src/abis/agentIdentityRegistryAbi.ts +1 -0
- package/src/abis/agentRegistryAbi.ts +150 -0
- package/src/abis/agentReputationRegistryAbi.ts +1 -0
- package/src/abis/agentValidationRegistryAbi.ts +1 -0
- package/src/abis/outcomeTokenAbi.ts +153 -0
- package/src/abis/predictionMarketHookAbi.ts +214 -0
- package/src/client.ts +722 -0
- package/src/config.ts +161 -0
- package/src/identity.ts +395 -0
- package/src/index.ts +48 -0
- package/src/types.ts +207 -0
package/src/types.ts
ADDED
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Information about a prediction market.
|
|
3
|
+
*
|
|
4
|
+
* Matches the return values from PredictionMarketHook.getMarket():
|
|
5
|
+
* (description, outcome1, outcome2, outcome1Token, outcome2Token,
|
|
6
|
+
* reward, requiredBond, resolved, assertedOutcomeId, poolId, totalCollateral)
|
|
7
|
+
*/
|
|
8
|
+
export interface MarketInfo {
|
|
9
|
+
/** Unique identifier for the market (bytes32) */
|
|
10
|
+
marketId: `0x${string}`;
|
|
11
|
+
/** Human-readable market question / description */
|
|
12
|
+
description: string;
|
|
13
|
+
/** Label for outcome 1 (e.g., "yes") */
|
|
14
|
+
outcome1: string;
|
|
15
|
+
/** Label for outcome 2 (e.g., "no") */
|
|
16
|
+
outcome2: string;
|
|
17
|
+
/** Address of the outcome 1 ERC-20 token */
|
|
18
|
+
outcome1Token: `0x${string}`;
|
|
19
|
+
/** Address of the outcome 2 ERC-20 token */
|
|
20
|
+
outcome2Token: `0x${string}`;
|
|
21
|
+
/** Amount of bond currency offered as incentive to the asserter */
|
|
22
|
+
reward: bigint;
|
|
23
|
+
/** Minimum bond required from an asserter */
|
|
24
|
+
requiredBond: bigint;
|
|
25
|
+
/** Whether the market has been resolved */
|
|
26
|
+
resolved: boolean;
|
|
27
|
+
/** keccak256 hash of the asserted outcome string (bytes32(0) if none) */
|
|
28
|
+
assertedOutcomeId: `0x${string}`;
|
|
29
|
+
/** V4 pool identifier (bytes32(0) if no pool associated) */
|
|
30
|
+
poolId: `0x${string}`;
|
|
31
|
+
/** Total ETH collateral backing the market */
|
|
32
|
+
totalCollateral: bigint;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Information about a registered agent.
|
|
37
|
+
*
|
|
38
|
+
* Matches the Agent struct returned by AgentRegistry.getAgent():
|
|
39
|
+
* { name, attestation, registeredAt, exists }
|
|
40
|
+
*/
|
|
41
|
+
export interface AgentInfo {
|
|
42
|
+
/** The agent's wallet address */
|
|
43
|
+
address: `0x${string}`;
|
|
44
|
+
/** Human-readable name of the agent */
|
|
45
|
+
name: string;
|
|
46
|
+
/** TEE attestation bytes (hex-encoded) */
|
|
47
|
+
attestation: `0x${string}`;
|
|
48
|
+
/** Timestamp when the agent was registered (block.timestamp) */
|
|
49
|
+
registeredAt: bigint;
|
|
50
|
+
/** Whether the agent is registered (exists flag) */
|
|
51
|
+
exists: boolean;
|
|
52
|
+
/** ENS node (bytes32) if linked, or zero bytes if not */
|
|
53
|
+
ensNode?: `0x${string}`;
|
|
54
|
+
/** ERC-8004 agent identity token ID (if minted) */
|
|
55
|
+
agentId?: bigint;
|
|
56
|
+
/** Reputation score from ERC-8004 registry */
|
|
57
|
+
reputationScore?: ReputationScore;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* Agent reputation score from ERC-8004 AgentReputationRegistry.
|
|
62
|
+
*/
|
|
63
|
+
export interface ReputationScore {
|
|
64
|
+
/** Total number of assertions made */
|
|
65
|
+
totalAssertions: bigint;
|
|
66
|
+
/** Number of successful (correct) assertions */
|
|
67
|
+
successfulAssertions: bigint;
|
|
68
|
+
/** Total trading volume participated in (in wei) */
|
|
69
|
+
totalVolume: bigint;
|
|
70
|
+
/** Timestamp of last reputation update */
|
|
71
|
+
lastUpdated: bigint;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* Global reputation score aggregated across all chains.
|
|
76
|
+
*/
|
|
77
|
+
export interface GlobalReputationScore {
|
|
78
|
+
/** Agent's ERC-8004 identity token ID */
|
|
79
|
+
agentId: bigint;
|
|
80
|
+
/** Reputation scores per chain */
|
|
81
|
+
chainScores: Map<number, ReputationScore>;
|
|
82
|
+
/** Aggregated total assertions across all chains */
|
|
83
|
+
totalAssertions: bigint;
|
|
84
|
+
/** Aggregated successful assertions across all chains */
|
|
85
|
+
successfulAssertions: bigint;
|
|
86
|
+
/** Overall accuracy percentage (0-10000 basis points) */
|
|
87
|
+
accuracy: bigint;
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Validation types for ERC-8004 AgentValidationRegistry.
|
|
92
|
+
*/
|
|
93
|
+
export enum ValidationType {
|
|
94
|
+
NONE = 0,
|
|
95
|
+
TEE = 1,
|
|
96
|
+
STAKE = 2,
|
|
97
|
+
ZKML = 3,
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
/**
|
|
101
|
+
* Agent validation proof data.
|
|
102
|
+
*/
|
|
103
|
+
export interface ValidationProof {
|
|
104
|
+
/** Type of validation */
|
|
105
|
+
validationType: ValidationType;
|
|
106
|
+
/** Validation proof bytes */
|
|
107
|
+
proof: `0x${string}`;
|
|
108
|
+
/** Timestamp when validation was submitted */
|
|
109
|
+
timestamp: bigint;
|
|
110
|
+
/** Whether the validation is verified/valid */
|
|
111
|
+
valid: boolean;
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
/**
|
|
115
|
+
* Options for registering an agent with ENS and TEE attestation.
|
|
116
|
+
*/
|
|
117
|
+
export interface AgentRegistrationOptions {
|
|
118
|
+
/** Human-readable agent name */
|
|
119
|
+
name: string;
|
|
120
|
+
/** Optional ENS node (bytes32) - if provided, must be owned by caller */
|
|
121
|
+
ensNode?: `0x${string}`;
|
|
122
|
+
/** Optional TEE attestation for immediate verification */
|
|
123
|
+
teeAttestation?: {
|
|
124
|
+
/** Phala attestation quote */
|
|
125
|
+
quote: `0x${string}`;
|
|
126
|
+
/** Public key corresponding to the TEE */
|
|
127
|
+
publicKey: `0x${string}`;
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/**
|
|
132
|
+
* Configuration for the Clawlogic SDK client.
|
|
133
|
+
*/
|
|
134
|
+
export interface ClawlogicConfig {
|
|
135
|
+
/** Chain ID of the target network */
|
|
136
|
+
chainId: number;
|
|
137
|
+
/** RPC URL for the target network */
|
|
138
|
+
rpcUrl: string;
|
|
139
|
+
/** Contract addresses for the protocol */
|
|
140
|
+
contracts: {
|
|
141
|
+
/** AgentRegistry contract address */
|
|
142
|
+
agentRegistry: `0x${string}`;
|
|
143
|
+
/** PredictionMarketHook contract address */
|
|
144
|
+
predictionMarketHook: `0x${string}`;
|
|
145
|
+
/** Uniswap v4 PoolManager contract address */
|
|
146
|
+
poolManager: `0x${string}`;
|
|
147
|
+
/** UMA OptimisticOracleV3 contract address */
|
|
148
|
+
optimisticOracleV3: `0x${string}`;
|
|
149
|
+
/** ERC-20 bond currency address */
|
|
150
|
+
bondCurrency?: `0x${string}`;
|
|
151
|
+
/** ENS Registry address (MockENS on testnet) */
|
|
152
|
+
ensRegistry?: `0x${string}`;
|
|
153
|
+
/** ERC-8004 AgentIdentityRegistry address */
|
|
154
|
+
agentIdentityRegistry?: `0x${string}`;
|
|
155
|
+
/** ERC-8004 AgentValidationRegistry address */
|
|
156
|
+
agentValidationRegistry?: `0x${string}`;
|
|
157
|
+
/** ERC-8004 AgentReputationRegistry address */
|
|
158
|
+
agentReputationRegistry?: `0x${string}`;
|
|
159
|
+
/** Phala zkDCAP verifier address (MockPhalaVerifier on testnet) */
|
|
160
|
+
phalaVerifier?: `0x${string}`;
|
|
161
|
+
};
|
|
162
|
+
}
|
|
163
|
+
|
|
164
|
+
/**
|
|
165
|
+
* Deployment info loaded from a deployments JSON file.
|
|
166
|
+
*/
|
|
167
|
+
export interface DeploymentInfo {
|
|
168
|
+
chainId: number;
|
|
169
|
+
deployer: string;
|
|
170
|
+
deployedAt: string;
|
|
171
|
+
blockNumber: number;
|
|
172
|
+
contracts: {
|
|
173
|
+
AgentRegistry: string;
|
|
174
|
+
PredictionMarketHook: string;
|
|
175
|
+
PoolManager: string;
|
|
176
|
+
OptimisticOracleV3?: string;
|
|
177
|
+
BondCurrency?: string;
|
|
178
|
+
ENSRegistry?: string;
|
|
179
|
+
AgentIdentityRegistry?: string;
|
|
180
|
+
AgentValidationRegistry?: string;
|
|
181
|
+
AgentReputationRegistry?: string;
|
|
182
|
+
PhalaVerifier?: string;
|
|
183
|
+
};
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
/**
|
|
187
|
+
* Event log for market-related contract events.
|
|
188
|
+
*/
|
|
189
|
+
export interface MarketEvent {
|
|
190
|
+
type:
|
|
191
|
+
| 'MarketInitialized'
|
|
192
|
+
| 'TokensMinted'
|
|
193
|
+
| 'MarketAsserted'
|
|
194
|
+
| 'MarketResolved'
|
|
195
|
+
| 'AssertionFailed'
|
|
196
|
+
| 'AssertionDisputed'
|
|
197
|
+
| 'TokensSettled';
|
|
198
|
+
marketId: `0x${string}`;
|
|
199
|
+
blockNumber: bigint;
|
|
200
|
+
transactionHash: `0x${string}`;
|
|
201
|
+
args: Record<string, unknown>;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Callback type for watching market events.
|
|
206
|
+
*/
|
|
207
|
+
export type MarketEventCallback = (event: MarketEvent) => void;
|