@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/dist/config.js
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
2
|
+
// Arbitrum Sepolia
|
|
3
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
4
|
+
/**
|
|
5
|
+
* Arbitrum Sepolia chain ID.
|
|
6
|
+
*/
|
|
7
|
+
export const ARBITRUM_SEPOLIA_CHAIN_ID = 421614;
|
|
8
|
+
/**
|
|
9
|
+
* Default RPC URL for Arbitrum Sepolia.
|
|
10
|
+
*/
|
|
11
|
+
export const ARBITRUM_SEPOLIA_RPC_URL = 'https://sepolia-rollup.arbitrum.io/rpc';
|
|
12
|
+
/**
|
|
13
|
+
* Default configuration for Arbitrum Sepolia testnet.
|
|
14
|
+
*
|
|
15
|
+
* Contract addresses are placeholders and will be updated after deployment.
|
|
16
|
+
* Use `loadConfig()` to load real addresses from a deployments JSON file.
|
|
17
|
+
*/
|
|
18
|
+
export const ARBITRUM_SEPOLIA_CONFIG = {
|
|
19
|
+
chainId: ARBITRUM_SEPOLIA_CHAIN_ID,
|
|
20
|
+
rpcUrl: ARBITRUM_SEPOLIA_RPC_URL,
|
|
21
|
+
contracts: {
|
|
22
|
+
agentRegistry: '0x0000000000000000000000000000000000000000',
|
|
23
|
+
predictionMarketHook: '0x0000000000000000000000000000000000000000',
|
|
24
|
+
poolManager: '0x0000000000000000000000000000000000000000',
|
|
25
|
+
optimisticOracleV3: '0x0000000000000000000000000000000000000000',
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
29
|
+
// Circle Arc Testnet
|
|
30
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
31
|
+
/**
|
|
32
|
+
* Circle Arc testnet chain ID.
|
|
33
|
+
*/
|
|
34
|
+
export const ARC_TESTNET_CHAIN_ID = 5042002;
|
|
35
|
+
/**
|
|
36
|
+
* Default RPC URL for Circle Arc testnet.
|
|
37
|
+
*/
|
|
38
|
+
export const ARC_TESTNET_RPC_URL = 'https://rpc.testnet.arc.network';
|
|
39
|
+
/**
|
|
40
|
+
* Block explorer URL for Circle Arc testnet.
|
|
41
|
+
*/
|
|
42
|
+
export const ARC_TESTNET_EXPLORER_URL = 'https://testnet.arcscan.app';
|
|
43
|
+
/**
|
|
44
|
+
* Default configuration for Circle Arc testnet.
|
|
45
|
+
*
|
|
46
|
+
* Arc is Circle's EVM-compatible L1 where USDC is the native gas token.
|
|
47
|
+
* On Arc, `msg.value` sends native USDC (18 decimals), so the existing
|
|
48
|
+
* `mintOutcomeTokens()` payable function works directly -- collateral is
|
|
49
|
+
* USDC instead of ETH.
|
|
50
|
+
*
|
|
51
|
+
* Important: Uniswap V4 and UMA OOV3 are NOT natively available on Arc.
|
|
52
|
+
* The deployment uses mock contracts for both. V4 pool swaps are not
|
|
53
|
+
* functional; only the prediction market lifecycle operates.
|
|
54
|
+
*
|
|
55
|
+
* Contract addresses are placeholders and will be updated after deployment.
|
|
56
|
+
* Use `loadConfigFromDeployment()` to load real addresses.
|
|
57
|
+
*/
|
|
58
|
+
export const ARC_TESTNET_CONFIG = {
|
|
59
|
+
chainId: ARC_TESTNET_CHAIN_ID,
|
|
60
|
+
rpcUrl: ARC_TESTNET_RPC_URL,
|
|
61
|
+
contracts: {
|
|
62
|
+
agentRegistry: '0x0000000000000000000000000000000000000000',
|
|
63
|
+
predictionMarketHook: '0x0000000000000000000000000000000000000000',
|
|
64
|
+
poolManager: '0x0000000000000000000000000000000000000000',
|
|
65
|
+
optimisticOracleV3: '0x0000000000000000000000000000000000000000',
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* Load a ClawlogicConfig from a deployments JSON file.
|
|
70
|
+
*
|
|
71
|
+
* The deployments JSON must conform to the DeploymentInfo interface:
|
|
72
|
+
* ```json
|
|
73
|
+
* {
|
|
74
|
+
* "chainId": 421614,
|
|
75
|
+
* "deployer": "0x...",
|
|
76
|
+
* "deployedAt": "2026-02-XX",
|
|
77
|
+
* "blockNumber": 0,
|
|
78
|
+
* "contracts": {
|
|
79
|
+
* "AgentRegistry": "0x...",
|
|
80
|
+
* "PredictionMarketHook": "0x...",
|
|
81
|
+
* "PoolManager": "0x..."
|
|
82
|
+
* }
|
|
83
|
+
* }
|
|
84
|
+
* ```
|
|
85
|
+
*
|
|
86
|
+
* @param deployment - The parsed deployment info object.
|
|
87
|
+
* @param rpcUrl - Optional RPC URL override. Defaults based on chain ID:
|
|
88
|
+
* - Arc testnet (5042002) -> Arc testnet RPC
|
|
89
|
+
* - All others -> Arbitrum Sepolia public RPC
|
|
90
|
+
* @returns A ClawlogicConfig ready for use with the ClawlogicClient.
|
|
91
|
+
*/
|
|
92
|
+
export function loadConfigFromDeployment(deployment, rpcUrl) {
|
|
93
|
+
const defaultRpc = deployment.chainId === ARC_TESTNET_CHAIN_ID
|
|
94
|
+
? ARC_TESTNET_RPC_URL
|
|
95
|
+
: ARBITRUM_SEPOLIA_RPC_URL;
|
|
96
|
+
const zero = '0x0000000000000000000000000000000000000000';
|
|
97
|
+
return {
|
|
98
|
+
chainId: deployment.chainId,
|
|
99
|
+
rpcUrl: rpcUrl ?? defaultRpc,
|
|
100
|
+
contracts: {
|
|
101
|
+
agentRegistry: deployment.contracts.AgentRegistry,
|
|
102
|
+
predictionMarketHook: deployment.contracts.PredictionMarketHook,
|
|
103
|
+
poolManager: deployment.contracts.PoolManager,
|
|
104
|
+
optimisticOracleV3: (deployment.contracts.OptimisticOracleV3 ?? zero),
|
|
105
|
+
bondCurrency: (deployment.contracts.BondCurrency ?? zero),
|
|
106
|
+
ensRegistry: (deployment.contracts.ENSRegistry ?? zero),
|
|
107
|
+
agentIdentityRegistry: (deployment.contracts.AgentIdentityRegistry ?? zero),
|
|
108
|
+
agentValidationRegistry: (deployment.contracts.AgentValidationRegistry ?? zero),
|
|
109
|
+
agentReputationRegistry: (deployment.contracts.AgentReputationRegistry ?? zero),
|
|
110
|
+
phalaVerifier: (deployment.contracts.PhalaVerifier ?? zero),
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Create a ClawlogicConfig from explicit contract addresses.
|
|
116
|
+
*
|
|
117
|
+
* @param addresses - Object with contract addresses.
|
|
118
|
+
* @param chainId - Chain ID (default: Arbitrum Sepolia 421614).
|
|
119
|
+
* @param rpcUrl - RPC URL (default: Arbitrum Sepolia public RPC).
|
|
120
|
+
* @returns A ClawlogicConfig ready for use with the ClawlogicClient.
|
|
121
|
+
*/
|
|
122
|
+
export function createConfig(addresses, chainId = ARBITRUM_SEPOLIA_CHAIN_ID, rpcUrl = ARBITRUM_SEPOLIA_RPC_URL) {
|
|
123
|
+
return {
|
|
124
|
+
chainId,
|
|
125
|
+
rpcUrl,
|
|
126
|
+
contracts: {
|
|
127
|
+
agentRegistry: addresses.agentRegistry,
|
|
128
|
+
predictionMarketHook: addresses.predictionMarketHook,
|
|
129
|
+
poolManager: addresses.poolManager,
|
|
130
|
+
optimisticOracleV3: addresses.optimisticOracleV3 ?? '0x0000000000000000000000000000000000000000',
|
|
131
|
+
},
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAEA,gFAAgF;AAChF,mBAAmB;AACnB,gFAAgF;AAEhF;;GAEG;AACH,MAAM,CAAC,MAAM,yBAAyB,GAAG,MAAM,CAAC;AAEhD;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,wCAAwC,CAAC;AAEjF;;;;;GAKG;AACH,MAAM,CAAC,MAAM,uBAAuB,GAAoB;IACtD,OAAO,EAAE,yBAAyB;IAClC,MAAM,EAAE,wBAAwB;IAChC,SAAS,EAAE;QACT,aAAa,EAAE,4CAA4C;QAC3D,oBAAoB,EAAE,4CAA4C;QAClE,WAAW,EAAE,4CAA4C;QACzD,kBAAkB,EAAE,4CAA4C;KACjE;CACF,CAAC;AAEF,gFAAgF;AAChF,qBAAqB;AACrB,gFAAgF;AAEhF;;GAEG;AACH,MAAM,CAAC,MAAM,oBAAoB,GAAG,OAAO,CAAC;AAE5C;;GAEG;AACH,MAAM,CAAC,MAAM,mBAAmB,GAAG,iCAAiC,CAAC;AAErE;;GAEG;AACH,MAAM,CAAC,MAAM,wBAAwB,GAAG,6BAA6B,CAAC;AAEtE;;;;;;;;;;;;;;GAcG;AACH,MAAM,CAAC,MAAM,kBAAkB,GAAoB;IACjD,OAAO,EAAE,oBAAoB;IAC7B,MAAM,EAAE,mBAAmB;IAC3B,SAAS,EAAE;QACT,aAAa,EAAE,4CAA4C;QAC3D,oBAAoB,EAAE,4CAA4C;QAClE,WAAW,EAAE,4CAA4C;QACzD,kBAAkB,EAAE,4CAA4C;KACjE;CACF,CAAC;AAEF;;;;;;;;;;;;;;;;;;;;;;;GAu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AAoB,EAAE,SAAS,CAAC,oBAAoB;YACpD,WAAW,EAAE,SAAS,CAAC,WAAW;YAClC,kBAAkB,EAChB,SAAS,CAAC,kBAAkB,IAAI,4CAA4C;SAC/E;KACF,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file identity.ts
|
|
3
|
+
*
|
|
4
|
+
* Phase 1 Identity & Trust infrastructure for $CLAWLOGIC.
|
|
5
|
+
*
|
|
6
|
+
* Provides SDK methods for:
|
|
7
|
+
* - ENS agent identity resolution
|
|
8
|
+
* - ERC-8004 identity, reputation, and validation registries
|
|
9
|
+
* - Phala TEE attestation verification
|
|
10
|
+
*/
|
|
11
|
+
import type { PublicClient, WalletClient, Transport, Chain, Account } from 'viem';
|
|
12
|
+
import type { AgentInfo, ReputationScore, GlobalReputationScore, ValidationProof } from './types.js';
|
|
13
|
+
import { ValidationType } from './types.js';
|
|
14
|
+
/**
|
|
15
|
+
* Extended contract addresses for Phase 1 identity infrastructure.
|
|
16
|
+
*/
|
|
17
|
+
export interface IdentityContracts {
|
|
18
|
+
agentIdentityRegistry: `0x${string}`;
|
|
19
|
+
agentReputationRegistry: `0x${string}`;
|
|
20
|
+
agentValidationRegistry: `0x${string}`;
|
|
21
|
+
ensRegistry?: `0x${string}`;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Identity client for Phase 1 ENS + ERC-8004 + TEE functionality.
|
|
25
|
+
*
|
|
26
|
+
* This class extends the base ClawlogicClient with identity-related methods.
|
|
27
|
+
* Use this alongside ClawlogicClient for full protocol interaction.
|
|
28
|
+
*/
|
|
29
|
+
export declare class IdentityClient {
|
|
30
|
+
private readonly publicClient;
|
|
31
|
+
private readonly walletClient;
|
|
32
|
+
private readonly contracts;
|
|
33
|
+
constructor(publicClient: PublicClient<Transport, Chain>, walletClient: WalletClient<Transport, Chain, Account> | undefined, contracts: IdentityContracts);
|
|
34
|
+
/**
|
|
35
|
+
* Resolve an ENS name to an agent address.
|
|
36
|
+
*
|
|
37
|
+
* @param ensName - ENS name (e.g., "alpha.agent.eth")
|
|
38
|
+
* @returns Agent address, or null if not found
|
|
39
|
+
*/
|
|
40
|
+
resolveAgentENS(ensName: string): Promise<`0x${string}` | null>;
|
|
41
|
+
/**
|
|
42
|
+
* Get the ENS name for a given agent address (reverse resolution).
|
|
43
|
+
*
|
|
44
|
+
* @param address - Agent address
|
|
45
|
+
* @returns ENS name, or null if not linked
|
|
46
|
+
*/
|
|
47
|
+
getAgentENSName(address: `0x${string}`): Promise<string | null>;
|
|
48
|
+
/**
|
|
49
|
+
* Get the ERC-8004 identity token for an agent address.
|
|
50
|
+
*
|
|
51
|
+
* @param address - Agent address
|
|
52
|
+
* @returns Object with tokenId and metadataURI, or null if no identity exists
|
|
53
|
+
*/
|
|
54
|
+
getAgentIdentityToken(address: `0x${string}`): Promise<{
|
|
55
|
+
tokenId: bigint;
|
|
56
|
+
metadataURI: string;
|
|
57
|
+
} | null>;
|
|
58
|
+
/**
|
|
59
|
+
* Get the reputation score for an agent.
|
|
60
|
+
*
|
|
61
|
+
* @param agentId - ERC-8004 agent identity token ID
|
|
62
|
+
* @returns Reputation score with assertions, volume, and accuracy
|
|
63
|
+
*/
|
|
64
|
+
getAgentReputation(agentId: bigint): Promise<ReputationScore>;
|
|
65
|
+
/**
|
|
66
|
+
* Get the assertion accuracy percentage for an agent.
|
|
67
|
+
*
|
|
68
|
+
* @param agentId - ERC-8004 agent identity token ID
|
|
69
|
+
* @returns Accuracy as a number 0-100 (percentage)
|
|
70
|
+
*/
|
|
71
|
+
getAssertionAccuracy(agentId: bigint): Promise<number>;
|
|
72
|
+
/**
|
|
73
|
+
* Get global reputation aggregated across all chains.
|
|
74
|
+
*
|
|
75
|
+
* This method queries The Graph subgraph (Phase 3.3) for cross-chain data.
|
|
76
|
+
* For single-chain use, falls back to local chain reputation.
|
|
77
|
+
*
|
|
78
|
+
* @param agentId - ERC-8004 agent identity token ID
|
|
79
|
+
* @returns Global reputation score
|
|
80
|
+
*/
|
|
81
|
+
getGlobalReputation(agentId: bigint): Promise<GlobalReputationScore>;
|
|
82
|
+
/**
|
|
83
|
+
* Check if an agent has a specific validation type verified.
|
|
84
|
+
*
|
|
85
|
+
* @param agentId - ERC-8004 agent identity token ID
|
|
86
|
+
* @param validationType - Type of validation to check (TEE, STAKE, ZKML)
|
|
87
|
+
* @returns True if validated, false otherwise
|
|
88
|
+
*/
|
|
89
|
+
isValidated(agentId: bigint, validationType: ValidationType): Promise<boolean>;
|
|
90
|
+
/**
|
|
91
|
+
* Get validation proof for a specific validation type.
|
|
92
|
+
*
|
|
93
|
+
* @param agentId - ERC-8004 agent identity token ID
|
|
94
|
+
* @param validationType - Type of validation
|
|
95
|
+
* @returns Validation proof data, or null if not found
|
|
96
|
+
*/
|
|
97
|
+
getValidationProof(agentId: bigint, validationType: ValidationType): Promise<ValidationProof | null>;
|
|
98
|
+
/**
|
|
99
|
+
* Check if an agent is TEE-verified.
|
|
100
|
+
*
|
|
101
|
+
* Convenience method for checking TEE validation status.
|
|
102
|
+
*
|
|
103
|
+
* @param address - Agent address
|
|
104
|
+
* @returns True if TEE-verified, false otherwise
|
|
105
|
+
*/
|
|
106
|
+
isTeeVerified(address: `0x${string}`): Promise<boolean>;
|
|
107
|
+
/**
|
|
108
|
+
* Submit a validation proof for verification.
|
|
109
|
+
*
|
|
110
|
+
* @param agentId - ERC-8004 agent identity token ID
|
|
111
|
+
* @param proof - Validation proof bytes
|
|
112
|
+
* @param validationType - Type of validation being submitted
|
|
113
|
+
* @returns Transaction hash
|
|
114
|
+
*/
|
|
115
|
+
submitValidation(agentId: bigint, proof: `0x${string}`, validationType: ValidationType): Promise<`0x${string}`>;
|
|
116
|
+
/**
|
|
117
|
+
* Get extended agent info including ENS, identity token, and reputation.
|
|
118
|
+
*
|
|
119
|
+
* This is a convenience method that aggregates data from multiple registries.
|
|
120
|
+
*
|
|
121
|
+
* @param address - Agent address
|
|
122
|
+
* @returns Extended AgentInfo with all identity data
|
|
123
|
+
*/
|
|
124
|
+
getExtendedAgentInfo(address: `0x${string}`): Promise<AgentInfo & {
|
|
125
|
+
ensName: string | null;
|
|
126
|
+
identityToken: {
|
|
127
|
+
tokenId: bigint;
|
|
128
|
+
metadataURI: string;
|
|
129
|
+
} | null;
|
|
130
|
+
teeVerified: boolean;
|
|
131
|
+
}>;
|
|
132
|
+
}
|
|
133
|
+
//# sourceMappingURL=identity.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"identity.d.ts","sourceRoot":"","sources":["../src/identity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EACV,YAAY,EACZ,YAAY,EACZ,SAAS,EACT,KAAK,EACL,OAAO,EACR,MAAM,MAAM,CAAC;AAEd,OAAO,KAAK,EACV,SAAS,EACT,eAAe,EACf,qBAAqB,EACrB,eAAe,EAEhB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAO5C;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,qBAAqB,EAAE,KAAK,MAAM,EAAE,CAAC;IACrC,uBAAuB,EAAE,KAAK,MAAM,EAAE,CAAC;IACvC,uBAAuB,EAAE,KAAK,MAAM,EAAE,CAAC;IACvC,WAAW,CAAC,EAAE,KAAK,MAAM,EAAE,CAAC;CAC7B;AAED;;;;;GAKG;AACH,qBAAa,cAAc;IAEvB,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,YAAY;IAC7B,OAAO,CAAC,QAAQ,CAAC,SAAS;gBAFT,YAAY,EAAE,YAAY,CAAC,SAAS,EAAE,KAAK,CAAC,EAC5C,YAAY,EAAE,YAAY,CAAC,SAAS,EAAE,KAAK,EAAE,OAAO,CAAC,GAAG,SAAS,EACjE,SAAS,EAAE,iBAAiB;IAO/C;;;;;OAKG;IACG,eAAe,CAAC,OAAO,EAAE,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C;QACvB,aAAa,EAAE;YAAE,OAAO,EAAE,MAAM,CAAC;YAAC,WAAW,EAAE,MAAM,CAAA;SAAE,GAAG,IAAI,CAAC;QAC/D,WAAW,EAAE,OAAO,CAAC;KACtB,CAAC;CAoCH"}
|
package/dist/identity.js
ADDED
|
@@ -0,0 +1,314 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file identity.ts
|
|
3
|
+
*
|
|
4
|
+
* Phase 1 Identity & Trust infrastructure for $CLAWLOGIC.
|
|
5
|
+
*
|
|
6
|
+
* Provides SDK methods for:
|
|
7
|
+
* - ENS agent identity resolution
|
|
8
|
+
* - ERC-8004 identity, reputation, and validation registries
|
|
9
|
+
* - Phala TEE attestation verification
|
|
10
|
+
*/
|
|
11
|
+
import { namehash } from 'viem/ens';
|
|
12
|
+
import { ValidationType } from './types.js';
|
|
13
|
+
// Placeholder ABIs - will be populated after contract deployment
|
|
14
|
+
import { agentIdentityRegistryAbi } from './abis/agentIdentityRegistryAbi.js';
|
|
15
|
+
import { agentReputationRegistryAbi } from './abis/agentReputationRegistryAbi.js';
|
|
16
|
+
import { agentValidationRegistryAbi } from './abis/agentValidationRegistryAbi.js';
|
|
17
|
+
/**
|
|
18
|
+
* Identity client for Phase 1 ENS + ERC-8004 + TEE functionality.
|
|
19
|
+
*
|
|
20
|
+
* This class extends the base ClawlogicClient with identity-related methods.
|
|
21
|
+
* Use this alongside ClawlogicClient for full protocol interaction.
|
|
22
|
+
*/
|
|
23
|
+
export class IdentityClient {
|
|
24
|
+
publicClient;
|
|
25
|
+
walletClient;
|
|
26
|
+
contracts;
|
|
27
|
+
constructor(publicClient, walletClient, contracts) {
|
|
28
|
+
this.publicClient = publicClient;
|
|
29
|
+
this.walletClient = walletClient;
|
|
30
|
+
this.contracts = contracts;
|
|
31
|
+
}
|
|
32
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
33
|
+
// ENS Methods
|
|
34
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
35
|
+
/**
|
|
36
|
+
* Resolve an ENS name to an agent address.
|
|
37
|
+
*
|
|
38
|
+
* @param ensName - ENS name (e.g., "alpha.agent.eth")
|
|
39
|
+
* @returns Agent address, or null if not found
|
|
40
|
+
*/
|
|
41
|
+
async resolveAgentENS(ensName) {
|
|
42
|
+
try {
|
|
43
|
+
// ENS resolution is handled by AgentRegistry.getAgentByENS(), not the
|
|
44
|
+
// identity registry. Use the main ClawlogicClient for ENS resolution.
|
|
45
|
+
// This method is a no-op placeholder; callers should use
|
|
46
|
+
// ClawlogicClient.getAgentByENS() directly.
|
|
47
|
+
return null;
|
|
48
|
+
}
|
|
49
|
+
catch {
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Get the ENS name for a given agent address (reverse resolution).
|
|
55
|
+
*
|
|
56
|
+
* @param address - Agent address
|
|
57
|
+
* @returns ENS name, or null if not linked
|
|
58
|
+
*/
|
|
59
|
+
async getAgentENSName(address) {
|
|
60
|
+
try {
|
|
61
|
+
// This will be implemented once AgentRegistry includes ENS reverse mapping
|
|
62
|
+
// For now, return null (requires contract support)
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
return null;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
70
|
+
// ERC-8004 Identity Registry Methods
|
|
71
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
72
|
+
/**
|
|
73
|
+
* Get the ERC-8004 identity token for an agent address.
|
|
74
|
+
*
|
|
75
|
+
* @param address - Agent address
|
|
76
|
+
* @returns Object with tokenId and metadataURI, or null if no identity exists
|
|
77
|
+
*/
|
|
78
|
+
async getAgentIdentityToken(address) {
|
|
79
|
+
try {
|
|
80
|
+
// Check balance first — should be 1 if agent has identity
|
|
81
|
+
const balance = await this.publicClient.readContract({
|
|
82
|
+
address: this.contracts.agentIdentityRegistry,
|
|
83
|
+
abi: agentIdentityRegistryAbi,
|
|
84
|
+
functionName: 'balanceOf',
|
|
85
|
+
args: [address],
|
|
86
|
+
});
|
|
87
|
+
if (balance === 0n) {
|
|
88
|
+
return null;
|
|
89
|
+
}
|
|
90
|
+
// The registry doesn't have tokenOfOwnerByIndex (not ERC-721 Enumerable).
|
|
91
|
+
// Scan sequential token IDs from 1..totalAgents to find one owned by address.
|
|
92
|
+
const totalAgents = await this.publicClient.readContract({
|
|
93
|
+
address: this.contracts.agentIdentityRegistry,
|
|
94
|
+
abi: agentIdentityRegistryAbi,
|
|
95
|
+
functionName: 'totalAgents',
|
|
96
|
+
});
|
|
97
|
+
for (let id = 1n; id <= totalAgents; id++) {
|
|
98
|
+
try {
|
|
99
|
+
const owner = await this.publicClient.readContract({
|
|
100
|
+
address: this.contracts.agentIdentityRegistry,
|
|
101
|
+
abi: agentIdentityRegistryAbi,
|
|
102
|
+
functionName: 'ownerOf',
|
|
103
|
+
args: [id],
|
|
104
|
+
});
|
|
105
|
+
if (owner.toLowerCase() === address.toLowerCase()) {
|
|
106
|
+
const metadataURI = await this.publicClient.readContract({
|
|
107
|
+
address: this.contracts.agentIdentityRegistry,
|
|
108
|
+
abi: agentIdentityRegistryAbi,
|
|
109
|
+
functionName: 'tokenURI',
|
|
110
|
+
args: [id],
|
|
111
|
+
});
|
|
112
|
+
return { tokenId: id, metadataURI };
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
catch {
|
|
116
|
+
// Token ID might not exist; continue scanning
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
return null;
|
|
120
|
+
}
|
|
121
|
+
catch {
|
|
122
|
+
return null;
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
126
|
+
// ERC-8004 Reputation Registry Methods
|
|
127
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
128
|
+
/**
|
|
129
|
+
* Get the reputation score for an agent.
|
|
130
|
+
*
|
|
131
|
+
* @param agentId - ERC-8004 agent identity token ID
|
|
132
|
+
* @returns Reputation score with assertions, volume, and accuracy
|
|
133
|
+
*/
|
|
134
|
+
async getAgentReputation(agentId) {
|
|
135
|
+
const result = await this.publicClient.readContract({
|
|
136
|
+
address: this.contracts.agentReputationRegistry,
|
|
137
|
+
abi: agentReputationRegistryAbi,
|
|
138
|
+
functionName: 'getReputationScore',
|
|
139
|
+
args: [agentId],
|
|
140
|
+
});
|
|
141
|
+
const score = result;
|
|
142
|
+
return {
|
|
143
|
+
totalAssertions: score.totalAssertions,
|
|
144
|
+
successfulAssertions: score.successfulAssertions,
|
|
145
|
+
totalVolume: score.totalVolume,
|
|
146
|
+
lastUpdated: score.lastUpdated,
|
|
147
|
+
};
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Get the assertion accuracy percentage for an agent.
|
|
151
|
+
*
|
|
152
|
+
* @param agentId - ERC-8004 agent identity token ID
|
|
153
|
+
* @returns Accuracy as a number 0-100 (percentage)
|
|
154
|
+
*/
|
|
155
|
+
async getAssertionAccuracy(agentId) {
|
|
156
|
+
const accuracy = await this.publicClient.readContract({
|
|
157
|
+
address: this.contracts.agentReputationRegistry,
|
|
158
|
+
abi: agentReputationRegistryAbi,
|
|
159
|
+
functionName: 'getAccuracy',
|
|
160
|
+
args: [agentId],
|
|
161
|
+
});
|
|
162
|
+
// Convert from basis points (0-10000) to percentage (0-100)
|
|
163
|
+
return Number(accuracy) / 100;
|
|
164
|
+
}
|
|
165
|
+
/**
|
|
166
|
+
* Get global reputation aggregated across all chains.
|
|
167
|
+
*
|
|
168
|
+
* This method queries The Graph subgraph (Phase 3.3) for cross-chain data.
|
|
169
|
+
* For single-chain use, falls back to local chain reputation.
|
|
170
|
+
*
|
|
171
|
+
* @param agentId - ERC-8004 agent identity token ID
|
|
172
|
+
* @returns Global reputation score
|
|
173
|
+
*/
|
|
174
|
+
async getGlobalReputation(agentId) {
|
|
175
|
+
// TODO: Implement The Graph query in Phase 3.3
|
|
176
|
+
// For now, return local chain reputation only
|
|
177
|
+
const localScore = await this.getAgentReputation(agentId);
|
|
178
|
+
const accuracy = await this.getAssertionAccuracy(agentId);
|
|
179
|
+
return {
|
|
180
|
+
agentId,
|
|
181
|
+
chainScores: new Map(), // Will be populated in Phase 3.3
|
|
182
|
+
totalAssertions: localScore.totalAssertions,
|
|
183
|
+
successfulAssertions: localScore.successfulAssertions,
|
|
184
|
+
accuracy: BigInt(Math.round(accuracy * 100)), // Convert to basis points
|
|
185
|
+
};
|
|
186
|
+
}
|
|
187
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
188
|
+
// ERC-8004 Validation Registry Methods
|
|
189
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
190
|
+
/**
|
|
191
|
+
* Check if an agent has a specific validation type verified.
|
|
192
|
+
*
|
|
193
|
+
* @param agentId - ERC-8004 agent identity token ID
|
|
194
|
+
* @param validationType - Type of validation to check (TEE, STAKE, ZKML)
|
|
195
|
+
* @returns True if validated, false otherwise
|
|
196
|
+
*/
|
|
197
|
+
async isValidated(agentId, validationType) {
|
|
198
|
+
const result = await this.publicClient.readContract({
|
|
199
|
+
address: this.contracts.agentValidationRegistry,
|
|
200
|
+
abi: agentValidationRegistryAbi,
|
|
201
|
+
functionName: 'isValidated',
|
|
202
|
+
args: [agentId, validationType],
|
|
203
|
+
});
|
|
204
|
+
return result;
|
|
205
|
+
}
|
|
206
|
+
/**
|
|
207
|
+
* Get validation proof for a specific validation type.
|
|
208
|
+
*
|
|
209
|
+
* @param agentId - ERC-8004 agent identity token ID
|
|
210
|
+
* @param validationType - Type of validation
|
|
211
|
+
* @returns Validation proof data, or null if not found
|
|
212
|
+
*/
|
|
213
|
+
async getValidationProof(agentId, validationType) {
|
|
214
|
+
try {
|
|
215
|
+
const result = await this.publicClient.readContract({
|
|
216
|
+
address: this.contracts.agentValidationRegistry,
|
|
217
|
+
abi: agentValidationRegistryAbi,
|
|
218
|
+
functionName: 'getValidation',
|
|
219
|
+
args: [agentId, validationType],
|
|
220
|
+
});
|
|
221
|
+
const validation = result;
|
|
222
|
+
return {
|
|
223
|
+
validationType: validation.validationType,
|
|
224
|
+
proof: validation.proof,
|
|
225
|
+
timestamp: validation.timestamp,
|
|
226
|
+
valid: validation.valid,
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
catch {
|
|
230
|
+
return null;
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
/**
|
|
234
|
+
* Check if an agent is TEE-verified.
|
|
235
|
+
*
|
|
236
|
+
* Convenience method for checking TEE validation status.
|
|
237
|
+
*
|
|
238
|
+
* @param address - Agent address
|
|
239
|
+
* @returns True if TEE-verified, false otherwise
|
|
240
|
+
*/
|
|
241
|
+
async isTeeVerified(address) {
|
|
242
|
+
const identity = await this.getAgentIdentityToken(address);
|
|
243
|
+
if (!identity) {
|
|
244
|
+
return false;
|
|
245
|
+
}
|
|
246
|
+
return this.isValidated(identity.tokenId, ValidationType.TEE);
|
|
247
|
+
}
|
|
248
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
249
|
+
// Write Methods (require wallet client)
|
|
250
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
251
|
+
/**
|
|
252
|
+
* Submit a validation proof for verification.
|
|
253
|
+
*
|
|
254
|
+
* @param agentId - ERC-8004 agent identity token ID
|
|
255
|
+
* @param proof - Validation proof bytes
|
|
256
|
+
* @param validationType - Type of validation being submitted
|
|
257
|
+
* @returns Transaction hash
|
|
258
|
+
*/
|
|
259
|
+
async submitValidation(agentId, proof, validationType) {
|
|
260
|
+
if (!this.walletClient) {
|
|
261
|
+
throw new Error('IdentityClient: Wallet client required for write operations');
|
|
262
|
+
}
|
|
263
|
+
const hash = await this.walletClient.writeContract({
|
|
264
|
+
address: this.contracts.agentValidationRegistry,
|
|
265
|
+
abi: agentValidationRegistryAbi,
|
|
266
|
+
functionName: 'submitValidation',
|
|
267
|
+
args: [agentId, proof, validationType],
|
|
268
|
+
});
|
|
269
|
+
return hash;
|
|
270
|
+
}
|
|
271
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
272
|
+
// Helper Methods
|
|
273
|
+
// ═══════════════════════════════════════════════════════════════════════════
|
|
274
|
+
/**
|
|
275
|
+
* Get extended agent info including ENS, identity token, and reputation.
|
|
276
|
+
*
|
|
277
|
+
* This is a convenience method that aggregates data from multiple registries.
|
|
278
|
+
*
|
|
279
|
+
* @param address - Agent address
|
|
280
|
+
* @returns Extended AgentInfo with all identity data
|
|
281
|
+
*/
|
|
282
|
+
async getExtendedAgentInfo(address) {
|
|
283
|
+
// Get base agent info (from main AgentRegistry)
|
|
284
|
+
// This will be called from the main client
|
|
285
|
+
// Get ENS name
|
|
286
|
+
const ensName = await this.getAgentENSName(address);
|
|
287
|
+
// Get identity token
|
|
288
|
+
const identityToken = await this.getAgentIdentityToken(address);
|
|
289
|
+
// Get reputation if identity exists
|
|
290
|
+
let reputationScore;
|
|
291
|
+
if (identityToken) {
|
|
292
|
+
reputationScore = await this.getAgentReputation(identityToken.tokenId);
|
|
293
|
+
}
|
|
294
|
+
// Check TEE verification
|
|
295
|
+
const teeVerified = identityToken
|
|
296
|
+
? await this.isValidated(identityToken.tokenId, ValidationType.TEE)
|
|
297
|
+
: false;
|
|
298
|
+
// Return extended info (base info will be merged by caller)
|
|
299
|
+
return {
|
|
300
|
+
address,
|
|
301
|
+
name: '', // Will be filled by caller from AgentRegistry
|
|
302
|
+
attestation: '0x', // Will be filled by caller
|
|
303
|
+
registeredAt: 0n, // Will be filled by caller
|
|
304
|
+
exists: true,
|
|
305
|
+
ensNode: ensName ? namehash(ensName) : undefined,
|
|
306
|
+
agentId: identityToken?.tokenId,
|
|
307
|
+
reputationScore,
|
|
308
|
+
ensName,
|
|
309
|
+
identityToken,
|
|
310
|
+
teeVerified,
|
|
311
|
+
};
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
//# sourceMappingURL=identity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"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,IAAI,eAA4C,CAAC;QACjD,IAAI,aAAa,EAAE,CAAC;YAClB,eAAe,GAAG,MAAM,IAAI,CAAC,kBAAkB,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;QACzE,CAAC;QAED,yBAAyB;QACzB,MAAM,WAAW,GAAG,aAAa;YAC/B,CAAC,CAAC,MAAM,IAAI,CAAC,WAAW,CAAC,aAAa,CAAC,OAAO,EAAE,cAAc,CAAC,GAAG,CAAC;YACnE,CAAC,CAAC,KAAK,CAAC;QAEV,4DAA4D;QAC5D,OAAO;YACL,OAAO;YACP,IAAI,EAAE,EAAE,EAAE,8CAA8C;YACxD,WAAW,EAAE,IAAI,EAAE,2BAA2B;YAC9C,YAAY,EAAE,EAAE,EAAE,2BAA2B;YAC7C,MAAM,EAAE,IAAI;YACZ,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC,QAAQ,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,SAAS;YAChD,OAAO,EAAE,aAAa,EAAE,OAAO;YAC/B,eAAe;YACf,OAAO;YACP,aAAa;YACb,WAAW;SACZ,CAAC;IACJ,CAAC;CACF"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export { ClawlogicClient } from './client.js';
|
|
2
|
+
export { IdentityClient } from './identity.js';
|
|
3
|
+
export type { IdentityContracts } from './identity.js';
|
|
4
|
+
export type { MarketInfo, AgentInfo, ClawlogicConfig, DeploymentInfo, MarketEvent, MarketEventCallback, ReputationScore, GlobalReputationScore, ValidationProof, AgentRegistrationOptions, } from './types.js';
|
|
5
|
+
export { ValidationType } from './types.js';
|
|
6
|
+
export { ARBITRUM_SEPOLIA_CONFIG, ARBITRUM_SEPOLIA_CHAIN_ID, ARBITRUM_SEPOLIA_RPC_URL, ARC_TESTNET_CONFIG, ARC_TESTNET_CHAIN_ID, ARC_TESTNET_RPC_URL, ARC_TESTNET_EXPLORER_URL, loadConfigFromDeployment, createConfig, } from './config.js';
|
|
7
|
+
export { agentRegistryAbi } from './abis/agentRegistryAbi.js';
|
|
8
|
+
export { predictionMarketHookAbi } from './abis/predictionMarketHookAbi.js';
|
|
9
|
+
export { outcomeTokenAbi } from './abis/outcomeTokenAbi.js';
|
|
10
|
+
export { agentIdentityRegistryAbi } from './abis/agentIdentityRegistryAbi.js';
|
|
11
|
+
export { agentReputationRegistryAbi } from './abis/agentReputationRegistryAbi.js';
|
|
12
|
+
export { agentValidationRegistryAbi } from './abis/agentValidationRegistryAbi.js';
|
|
13
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAG9C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAC/C,YAAY,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAGvD,YAAY,EACV,UAAU,EACV,SAAS,EACT,eAAe,EACf,cAAc,EACd,WAAW,EACX,mBAAmB,EACnB,eAAe,EACf,qBAAqB,EACrB,eAAe,EACf,wBAAwB,GACzB,MAAM,YAAY,CAAC;AACpB,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAG5C,OAAO,EACL,uBAAuB,EACvB,yBAAyB,EACzB,wBAAwB,EACxB,kBAAkB,EAClB,oBAAoB,EACpB,mBAAmB,EACnB,wBAAwB,EACxB,wBAAwB,EACxB,YAAY,GACb,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAG5D,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAClF,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
2
|
+
// @clawlogic/sdk - Public API
|
|
3
|
+
// ─────────────────────────────────────────────────────────────────────────────
|
|
4
|
+
// Main client
|
|
5
|
+
export { ClawlogicClient } from './client.js';
|
|
6
|
+
// Phase 1: Identity & Trust infrastructure
|
|
7
|
+
export { IdentityClient } from './identity.js';
|
|
8
|
+
export { ValidationType } from './types.js';
|
|
9
|
+
// Configuration helpers
|
|
10
|
+
export { ARBITRUM_SEPOLIA_CONFIG, ARBITRUM_SEPOLIA_CHAIN_ID, ARBITRUM_SEPOLIA_RPC_URL, ARC_TESTNET_CONFIG, ARC_TESTNET_CHAIN_ID, ARC_TESTNET_RPC_URL, ARC_TESTNET_EXPLORER_URL, loadConfigFromDeployment, createConfig, } from './config.js';
|
|
11
|
+
// ABIs (for advanced usage / direct contract interaction)
|
|
12
|
+
export { agentRegistryAbi } from './abis/agentRegistryAbi.js';
|
|
13
|
+
export { predictionMarketHookAbi } from './abis/predictionMarketHookAbi.js';
|
|
14
|
+
export { outcomeTokenAbi } from './abis/outcomeTokenAbi.js';
|
|
15
|
+
// Phase 1: Identity ABIs
|
|
16
|
+
export { agentIdentityRegistryAbi } from './abis/agentIdentityRegistryAbi.js';
|
|
17
|
+
export { agentReputationRegistryAbi } from './abis/agentReputationRegistryAbi.js';
|
|
18
|
+
export { agentValidationRegistryAbi } from './abis/agentValidationRegistryAbi.js';
|
|
19
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,8BAA8B;AAC9B,gFAAgF;AAEhF,cAAc;AACd,OAAO,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAE9C,2CAA2C;AAC3C,OAAO,EAAE,cAAc,EAAE,MAAM,eAAe,CAAC;AAgB/C,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,wBAAwB;AACxB,OAAO,EACL,uBAAuB,EACvB,yBAAyB,EACzB,wBAAwB,EACxB,kBAAkB,EAClB,oBAAoB,EACpB,mBAAmB,EACnB,wBAAwB,EACxB,wBAAwB,EACxB,YAAY,GACb,MAAM,aAAa,CAAC;AAErB,0DAA0D;AAC1D,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAC9D,OAAO,EAAE,uBAAuB,EAAE,MAAM,mCAAmC,CAAC;AAC5E,OAAO,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAE5D,yBAAyB;AACzB,OAAO,EAAE,wBAAwB,EAAE,MAAM,oCAAoC,CAAC;AAC9E,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC;AAClF,OAAO,EAAE,0BAA0B,EAAE,MAAM,sCAAsC,CAAC"}
|