@agentxv2/sdk 0.5.2 → 0.5.4
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/dist/configuration.d.mts +31 -0
- package/dist/configuration.d.ts +31 -0
- package/dist/configuration.js +155 -0
- package/dist/configuration.js.map +1 -0
- package/dist/configuration.mjs +128 -0
- package/dist/configuration.mjs.map +1 -0
- package/dist/core.d.mts +64 -0
- package/dist/core.d.ts +64 -0
- package/dist/endpoint.d.mts +39 -0
- package/dist/endpoint.d.ts +39 -0
- package/dist/endpoint.js +193 -0
- package/dist/endpoint.js.map +1 -0
- package/dist/endpoint.mjs +166 -0
- package/dist/endpoint.mjs.map +1 -0
- package/dist/index-BlD1-fQt.d.mts +209 -0
- package/dist/index-DV-tFsBT.d.ts +209 -0
- package/dist/index.d.mts +271 -0
- package/dist/index.d.ts +271 -0
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.mts +3 -0
- package/dist/react.d.ts +3 -0
- package/dist/types-2aHUvS4M.d.mts +297 -0
- package/dist/types-2aHUvS4M.d.ts +297 -0
- package/package.json +2 -2
- /package/dist/{core/index.js → core.js} +0 -0
- /package/dist/{core/index.js.map → core.js.map} +0 -0
- /package/dist/{core/index.mjs → core.mjs} +0 -0
- /package/dist/{core/index.mjs.map → core.mjs.map} +0 -0
- /package/dist/{react/index.js → react.js} +0 -0
- /package/dist/{react/index.js.map → react.js.map} +0 -0
- /package/dist/{react/index.mjs → react.mjs} +0 -0
- /package/dist/{react/index.mjs.map → react.mjs.map} +0 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Address, PublicClient } from 'viem';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* ConfigurationRegistry SDK
|
|
5
|
+
* On-chain key-value config store for AI Agents
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
interface ConfigEntry {
|
|
9
|
+
agentId: bigint;
|
|
10
|
+
key: string;
|
|
11
|
+
value: string;
|
|
12
|
+
dataType: string;
|
|
13
|
+
updatedAt: bigint;
|
|
14
|
+
updatedBy: Address;
|
|
15
|
+
}
|
|
16
|
+
interface ConfigurationConfig {
|
|
17
|
+
address: Address;
|
|
18
|
+
}
|
|
19
|
+
declare class ConfigurationClient {
|
|
20
|
+
private address;
|
|
21
|
+
private publicClient;
|
|
22
|
+
constructor(config: ConfigurationConfig, publicClient?: PublicClient);
|
|
23
|
+
setPublicClient(client: PublicClient): void;
|
|
24
|
+
get(agentId: bigint, key: string): Promise<ConfigEntry | null>;
|
|
25
|
+
getAll(agentId: bigint): Promise<ConfigEntry[]>;
|
|
26
|
+
getKeys(agentId: bigint): Promise<string[]>;
|
|
27
|
+
getCount(agentId: bigint): Promise<bigint>;
|
|
28
|
+
exists(agentId: bigint, key: string): Promise<boolean>;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export { type ConfigEntry, ConfigurationClient, type ConfigurationConfig };
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { Address, PublicClient } from 'viem';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* ConfigurationRegistry SDK
|
|
5
|
+
* On-chain key-value config store for AI Agents
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
interface ConfigEntry {
|
|
9
|
+
agentId: bigint;
|
|
10
|
+
key: string;
|
|
11
|
+
value: string;
|
|
12
|
+
dataType: string;
|
|
13
|
+
updatedAt: bigint;
|
|
14
|
+
updatedBy: Address;
|
|
15
|
+
}
|
|
16
|
+
interface ConfigurationConfig {
|
|
17
|
+
address: Address;
|
|
18
|
+
}
|
|
19
|
+
declare class ConfigurationClient {
|
|
20
|
+
private address;
|
|
21
|
+
private publicClient;
|
|
22
|
+
constructor(config: ConfigurationConfig, publicClient?: PublicClient);
|
|
23
|
+
setPublicClient(client: PublicClient): void;
|
|
24
|
+
get(agentId: bigint, key: string): Promise<ConfigEntry | null>;
|
|
25
|
+
getAll(agentId: bigint): Promise<ConfigEntry[]>;
|
|
26
|
+
getKeys(agentId: bigint): Promise<string[]>;
|
|
27
|
+
getCount(agentId: bigint): Promise<bigint>;
|
|
28
|
+
exists(agentId: bigint, key: string): Promise<boolean>;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
export { type ConfigEntry, ConfigurationClient, type ConfigurationConfig };
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
4
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __export = (target, all) => {
|
|
7
|
+
for (var name in all)
|
|
8
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
|
+
};
|
|
10
|
+
var __copyProps = (to, from, except, desc) => {
|
|
11
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
12
|
+
for (let key of __getOwnPropNames(from))
|
|
13
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
14
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
15
|
+
}
|
|
16
|
+
return to;
|
|
17
|
+
};
|
|
18
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
|
+
|
|
20
|
+
// src/configuration/index.ts
|
|
21
|
+
var configuration_exports = {};
|
|
22
|
+
__export(configuration_exports, {
|
|
23
|
+
ConfigurationClient: () => ConfigurationClient
|
|
24
|
+
});
|
|
25
|
+
module.exports = __toCommonJS(configuration_exports);
|
|
26
|
+
|
|
27
|
+
// src/configuration/configuration.ts
|
|
28
|
+
var ABI = [
|
|
29
|
+
{
|
|
30
|
+
name: "getConfig",
|
|
31
|
+
type: "function",
|
|
32
|
+
stateMutability: "view",
|
|
33
|
+
inputs: [
|
|
34
|
+
{ name: "agentId", type: "uint256" },
|
|
35
|
+
{ name: "configKey", type: "string" }
|
|
36
|
+
],
|
|
37
|
+
outputs: [{
|
|
38
|
+
type: "tuple",
|
|
39
|
+
components: [
|
|
40
|
+
{ name: "agentId", type: "uint256" },
|
|
41
|
+
{ name: "key", type: "string" },
|
|
42
|
+
{ name: "value", type: "string" },
|
|
43
|
+
{ name: "dataType", type: "string" },
|
|
44
|
+
{ name: "updatedAt", type: "uint256" },
|
|
45
|
+
{ name: "updatedBy", type: "address" }
|
|
46
|
+
]
|
|
47
|
+
}]
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: "getAgentConfigs",
|
|
51
|
+
type: "function",
|
|
52
|
+
stateMutability: "view",
|
|
53
|
+
inputs: [{ name: "agentId", type: "uint256" }],
|
|
54
|
+
outputs: [{
|
|
55
|
+
type: "tuple[]",
|
|
56
|
+
components: [
|
|
57
|
+
{ name: "agentId", type: "uint256" },
|
|
58
|
+
{ name: "key", type: "string" },
|
|
59
|
+
{ name: "value", type: "string" },
|
|
60
|
+
{ name: "dataType", type: "string" },
|
|
61
|
+
{ name: "updatedAt", type: "uint256" },
|
|
62
|
+
{ name: "updatedBy", type: "address" }
|
|
63
|
+
]
|
|
64
|
+
}]
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
name: "getConfigKeys",
|
|
68
|
+
type: "function",
|
|
69
|
+
stateMutability: "view",
|
|
70
|
+
inputs: [{ name: "agentId", type: "uint256" }],
|
|
71
|
+
outputs: [{ type: "string[]" }]
|
|
72
|
+
},
|
|
73
|
+
{
|
|
74
|
+
name: "getConfigCount",
|
|
75
|
+
type: "function",
|
|
76
|
+
stateMutability: "view",
|
|
77
|
+
inputs: [{ name: "agentId", type: "uint256" }],
|
|
78
|
+
outputs: [{ type: "uint256" }]
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
name: "configExists",
|
|
82
|
+
type: "function",
|
|
83
|
+
stateMutability: "view",
|
|
84
|
+
inputs: [
|
|
85
|
+
{ name: "agentId", type: "uint256" },
|
|
86
|
+
{ name: "configKey", type: "string" }
|
|
87
|
+
],
|
|
88
|
+
outputs: [{ type: "bool" }]
|
|
89
|
+
}
|
|
90
|
+
];
|
|
91
|
+
var ConfigurationClient = class {
|
|
92
|
+
address;
|
|
93
|
+
publicClient;
|
|
94
|
+
constructor(config, publicClient) {
|
|
95
|
+
this.address = config.address;
|
|
96
|
+
this.publicClient = publicClient ?? null;
|
|
97
|
+
}
|
|
98
|
+
setPublicClient(client) {
|
|
99
|
+
this.publicClient = client;
|
|
100
|
+
}
|
|
101
|
+
async get(agentId, key) {
|
|
102
|
+
if (!this.publicClient) throw new Error("publicClient not set");
|
|
103
|
+
try {
|
|
104
|
+
return await this.publicClient.readContract({
|
|
105
|
+
address: this.address,
|
|
106
|
+
abi: ABI,
|
|
107
|
+
functionName: "getConfig",
|
|
108
|
+
args: [agentId, key]
|
|
109
|
+
});
|
|
110
|
+
} catch {
|
|
111
|
+
return null;
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
async getAll(agentId) {
|
|
115
|
+
if (!this.publicClient) throw new Error("publicClient not set");
|
|
116
|
+
return await this.publicClient.readContract({
|
|
117
|
+
address: this.address,
|
|
118
|
+
abi: ABI,
|
|
119
|
+
functionName: "getAgentConfigs",
|
|
120
|
+
args: [agentId]
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
async getKeys(agentId) {
|
|
124
|
+
if (!this.publicClient) throw new Error("publicClient not set");
|
|
125
|
+
return await this.publicClient.readContract({
|
|
126
|
+
address: this.address,
|
|
127
|
+
abi: ABI,
|
|
128
|
+
functionName: "getConfigKeys",
|
|
129
|
+
args: [agentId]
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
async getCount(agentId) {
|
|
133
|
+
if (!this.publicClient) throw new Error("publicClient not set");
|
|
134
|
+
return await this.publicClient.readContract({
|
|
135
|
+
address: this.address,
|
|
136
|
+
abi: ABI,
|
|
137
|
+
functionName: "getConfigCount",
|
|
138
|
+
args: [agentId]
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
async exists(agentId, key) {
|
|
142
|
+
if (!this.publicClient) throw new Error("publicClient not set");
|
|
143
|
+
return await this.publicClient.readContract({
|
|
144
|
+
address: this.address,
|
|
145
|
+
abi: ABI,
|
|
146
|
+
functionName: "configExists",
|
|
147
|
+
args: [agentId, key]
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
152
|
+
0 && (module.exports = {
|
|
153
|
+
ConfigurationClient
|
|
154
|
+
});
|
|
155
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/configuration/index.ts","../../src/configuration/configuration.ts"],"sourcesContent":["export * from './configuration'\n","/**\n * ConfigurationRegistry SDK\n * On-chain key-value config store for AI Agents\n */\nimport { type PublicClient, type WalletClient, type Address, type Hash } from 'viem'\n\nexport interface ConfigEntry {\n agentId: bigint\n key: string\n value: string\n dataType: string\n updatedAt: bigint\n updatedBy: Address\n}\n\nexport interface ConfigurationConfig {\n address: Address\n}\n\nconst ABI = [\n {\n name: 'getConfig',\n type: 'function',\n stateMutability: 'view',\n inputs: [\n { name: 'agentId', type: 'uint256' },\n { name: 'configKey', type: 'string' },\n ],\n outputs: [{\n type: 'tuple',\n components: [\n { name: 'agentId', type: 'uint256' },\n { name: 'key', type: 'string' },\n { name: 'value', type: 'string' },\n { name: 'dataType', type: 'string' },\n { name: 'updatedAt', type: 'uint256' },\n { name: 'updatedBy', type: 'address' },\n ],\n }],\n },\n {\n name: 'getAgentConfigs',\n type: 'function',\n stateMutability: 'view',\n inputs: [{ name: 'agentId', type: 'uint256' }],\n outputs: [{\n type: 'tuple[]',\n components: [\n { name: 'agentId', type: 'uint256' },\n { name: 'key', type: 'string' },\n { name: 'value', type: 'string' },\n { name: 'dataType', type: 'string' },\n { name: 'updatedAt', type: 'uint256' },\n { name: 'updatedBy', type: 'address' },\n ],\n }],\n },\n {\n name: 'getConfigKeys',\n type: 'function',\n stateMutability: 'view',\n inputs: [{ name: 'agentId', type: 'uint256' }],\n outputs: [{ type: 'string[]' }],\n },\n {\n name: 'getConfigCount',\n type: 'function',\n stateMutability: 'view',\n inputs: [{ name: 'agentId', type: 'uint256' }],\n outputs: [{ type: 'uint256' }],\n },\n {\n name: 'configExists',\n type: 'function',\n stateMutability: 'view',\n inputs: [\n { name: 'agentId', type: 'uint256' },\n { name: 'configKey', type: 'string' },\n ],\n outputs: [{ type: 'bool' }],\n },\n] as const\n\nexport class ConfigurationClient {\n private address: Address\n private publicClient: PublicClient | null\n\n constructor(config: ConfigurationConfig, publicClient?: PublicClient) {\n this.address = config.address\n this.publicClient = publicClient ?? null\n }\n\n setPublicClient(client: PublicClient) {\n this.publicClient = client\n }\n\n async get(agentId: bigint, key: string): Promise<ConfigEntry | null> {\n if (!this.publicClient) throw new Error('publicClient not set')\n try {\n return (await this.publicClient.readContract({\n address: this.address,\n abi: ABI,\n functionName: 'getConfig',\n args: [agentId, key],\n })) as ConfigEntry\n } catch {\n return null\n }\n }\n\n async getAll(agentId: bigint): Promise<ConfigEntry[]> {\n if (!this.publicClient) throw new Error('publicClient not set')\n return (await this.publicClient.readContract({\n address: this.address,\n abi: ABI,\n functionName: 'getAgentConfigs',\n args: [agentId],\n })) as ConfigEntry[]\n }\n\n async getKeys(agentId: bigint): Promise<string[]> {\n if (!this.publicClient) throw new Error('publicClient not set')\n return (await this.publicClient.readContract({\n address: this.address,\n abi: ABI,\n functionName: 'getConfigKeys',\n args: [agentId],\n })) as string[]\n }\n\n async getCount(agentId: bigint): Promise<bigint> {\n if (!this.publicClient) throw new Error('publicClient not set')\n return (await this.publicClient.readContract({\n address: this.address,\n abi: ABI,\n functionName: 'getConfigCount',\n args: [agentId],\n })) as bigint\n }\n\n async exists(agentId: bigint, key: string): Promise<boolean> {\n if (!this.publicClient) throw new Error('publicClient not set')\n return (await this.publicClient.readContract({\n address: this.address,\n abi: ABI,\n functionName: 'configExists',\n args: [agentId, key],\n })) as boolean\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACmBA,IAAM,MAAM;AAAA,EACV;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,iBAAiB;AAAA,IACjB,QAAQ;AAAA,MACN,EAAE,MAAM,WAAW,MAAM,UAAU;AAAA,MACnC,EAAE,MAAM,aAAa,MAAM,SAAS;AAAA,IACtC;AAAA,IACA,SAAS,CAAC;AAAA,MACR,MAAM;AAAA,MACN,YAAY;AAAA,QACV,EAAE,MAAM,WAAW,MAAM,UAAU;AAAA,QACnC,EAAE,MAAM,OAAO,MAAM,SAAS;AAAA,QAC9B,EAAE,MAAM,SAAS,MAAM,SAAS;AAAA,QAChC,EAAE,MAAM,YAAY,MAAM,SAAS;AAAA,QACnC,EAAE,MAAM,aAAa,MAAM,UAAU;AAAA,QACrC,EAAE,MAAM,aAAa,MAAM,UAAU;AAAA,MACvC;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,iBAAiB;AAAA,IACjB,QAAQ,CAAC,EAAE,MAAM,WAAW,MAAM,UAAU,CAAC;AAAA,IAC7C,SAAS,CAAC;AAAA,MACR,MAAM;AAAA,MACN,YAAY;AAAA,QACV,EAAE,MAAM,WAAW,MAAM,UAAU;AAAA,QACnC,EAAE,MAAM,OAAO,MAAM,SAAS;AAAA,QAC9B,EAAE,MAAM,SAAS,MAAM,SAAS;AAAA,QAChC,EAAE,MAAM,YAAY,MAAM,SAAS;AAAA,QACnC,EAAE,MAAM,aAAa,MAAM,UAAU;AAAA,QACrC,EAAE,MAAM,aAAa,MAAM,UAAU;AAAA,MACvC;AAAA,IACF,CAAC;AAAA,EACH;AAAA,EACA;AAAA,IACE,MAAM;AAAA,IAC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S,KAAK;AAAA,MACd,KAAK;AAAA,MACL,cAAc;AAAA,MACd,MAAM,CAAC,OAAO;AAAA,IAChB,CAAC;AAAA,EACH;AAAA,EAEA,MAAM,QAAQ,SAAoC;AAChD,QAAI,CAAC,KAAK,aAAc,OAAM,IAAI,MAAM,sBAAsB;AAC9D,WAAQ,MAAM,KAAK,aAAa,aAAa;AAAA,MAC3C,SAAS,KAAK;AAAA,MACd,KAAK;AAAA,MACL,cAAc;AAAA,MACd,MAAM,CAAC,OAAO;AAAA,IAChB,CAAC;AAAA,EACH;AAAA,EAEA,MAAM,SAAS,SAAkC;AAC/C,QAAI,CAAC,KAAK,aAAc,OAAM,IAAI,MAAM,sBAAsB;AAC9D,WAAQ,MAAM,KAAK,aAAa,aAAa;AAAA,MAC3C,SAAS,KAAK;AAAA,MACd,KAAK;AAAA,MACL,cAAc;AAAA,MACd,MAAM,CAAC,OAAO;AAAA,IAChB,CAAC;AAAA,EACH;AAAA,EAEA,MAAM,OAAO,SAAiB,KAA+B;AAC3D,QAAI,CAAC,KAAK,aAAc,OAAM,IAAI,MAAM,sBAAsB;AAC9D,WAAQ,MAAM,KAAK,aAAa,aAAa;AAAA,MAC3C,SAAS,KAAK;AAAA,MACd,KAAK;AAAA,MACL,cAAc;AAAA,MACd,MAAM,CAAC,SAAS,GAAG;AAAA,IACrB,CAAC;AAAA,EACH;AACF;","names":[]}
|
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
// src/configuration/configuration.ts
|
|
2
|
+
var ABI = [
|
|
3
|
+
{
|
|
4
|
+
name: "getConfig",
|
|
5
|
+
type: "function",
|
|
6
|
+
stateMutability: "view",
|
|
7
|
+
inputs: [
|
|
8
|
+
{ name: "agentId", type: "uint256" },
|
|
9
|
+
{ name: "configKey", type: "string" }
|
|
10
|
+
],
|
|
11
|
+
outputs: [{
|
|
12
|
+
type: "tuple",
|
|
13
|
+
components: [
|
|
14
|
+
{ name: "agentId", type: "uint256" },
|
|
15
|
+
{ name: "key", type: "string" },
|
|
16
|
+
{ name: "value", type: "string" },
|
|
17
|
+
{ name: "dataType", type: "string" },
|
|
18
|
+
{ name: "updatedAt", type: "uint256" },
|
|
19
|
+
{ name: "updatedBy", type: "address" }
|
|
20
|
+
]
|
|
21
|
+
}]
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
name: "getAgentConfigs",
|
|
25
|
+
type: "function",
|
|
26
|
+
stateMutability: "view",
|
|
27
|
+
inputs: [{ name: "agentId", type: "uint256" }],
|
|
28
|
+
outputs: [{
|
|
29
|
+
type: "tuple[]",
|
|
30
|
+
components: [
|
|
31
|
+
{ name: "agentId", type: "uint256" },
|
|
32
|
+
{ name: "key", type: "string" },
|
|
33
|
+
{ name: "value", type: "string" },
|
|
34
|
+
{ name: "dataType", type: "string" },
|
|
35
|
+
{ name: "updatedAt", type: "uint256" },
|
|
36
|
+
{ name: "updatedBy", type: "address" }
|
|
37
|
+
]
|
|
38
|
+
}]
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
name: "getConfigKeys",
|
|
42
|
+
type: "function",
|
|
43
|
+
stateMutability: "view",
|
|
44
|
+
inputs: [{ name: "agentId", type: "uint256" }],
|
|
45
|
+
outputs: [{ type: "string[]" }]
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
name: "getConfigCount",
|
|
49
|
+
type: "function",
|
|
50
|
+
stateMutability: "view",
|
|
51
|
+
inputs: [{ name: "agentId", type: "uint256" }],
|
|
52
|
+
outputs: [{ type: "uint256" }]
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
name: "configExists",
|
|
56
|
+
type: "function",
|
|
57
|
+
stateMutability: "view",
|
|
58
|
+
inputs: [
|
|
59
|
+
{ name: "agentId", type: "uint256" },
|
|
60
|
+
{ name: "configKey", type: "string" }
|
|
61
|
+
],
|
|
62
|
+
outputs: [{ type: "bool" }]
|
|
63
|
+
}
|
|
64
|
+
];
|
|
65
|
+
var ConfigurationClient = class {
|
|
66
|
+
address;
|
|
67
|
+
publicClient;
|
|
68
|
+
constructor(config, publicClient) {
|
|
69
|
+
this.address = config.address;
|
|
70
|
+
this.publicClient = publicClient ?? null;
|
|
71
|
+
}
|
|
72
|
+
setPublicClient(client) {
|
|
73
|
+
this.publicClient = client;
|
|
74
|
+
}
|
|
75
|
+
async get(agentId, key) {
|
|
76
|
+
if (!this.publicClient) throw new Error("publicClient not set");
|
|
77
|
+
try {
|
|
78
|
+
return await this.publicClient.readContract({
|
|
79
|
+
address: this.address,
|
|
80
|
+
abi: ABI,
|
|
81
|
+
functionName: "getConfig",
|
|
82
|
+
args: [agentId, key]
|
|
83
|
+
});
|
|
84
|
+
} catch {
|
|
85
|
+
return null;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
async getAll(agentId) {
|
|
89
|
+
if (!this.publicClient) throw new Error("publicClient not set");
|
|
90
|
+
return await this.publicClient.readContract({
|
|
91
|
+
address: this.address,
|
|
92
|
+
abi: ABI,
|
|
93
|
+
functionName: "getAgentConfigs",
|
|
94
|
+
args: [agentId]
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
async getKeys(agentId) {
|
|
98
|
+
if (!this.publicClient) throw new Error("publicClient not set");
|
|
99
|
+
return await this.publicClient.readContract({
|
|
100
|
+
address: this.address,
|
|
101
|
+
abi: ABI,
|
|
102
|
+
functionName: "getConfigKeys",
|
|
103
|
+
args: [agentId]
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
async getCount(agentId) {
|
|
107
|
+
if (!this.publicClient) throw new Error("publicClient not set");
|
|
108
|
+
return await this.publicClient.readContract({
|
|
109
|
+
address: this.address,
|
|
110
|
+
abi: ABI,
|
|
111
|
+
functionName: "getConfigCount",
|
|
112
|
+
args: [agentId]
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
async exists(agentId, key) {
|
|
116
|
+
if (!this.publicClient) throw new Error("publicClient not set");
|
|
117
|
+
return await this.publicClient.readContract({
|
|
118
|
+
address: this.address,
|
|
119
|
+
abi: ABI,
|
|
120
|
+
functionName: "configExists",
|
|
121
|
+
args: [agentId, key]
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
};
|
|
125
|
+
export {
|
|
126
|
+
ConfigurationClient
|
|
127
|
+
};
|
|
128
|
+
//# sourceMappingURL=index.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/configuration/configuration.ts"],"sourcesContent":["/**\n * ConfigurationRegistry SDK\n * On-chain key-value config store for AI Agents\n */\nimport { type PublicClient, type WalletClient, type Address, type Hash } from 'viem'\n\nexport interface ConfigEntry {\n agentId: bigint\n key: string\n value: string\n dataType: string\n updatedAt: bigint\n updatedBy: Address\n}\n\nexport interface ConfigurationConfig {\n address: Address\n}\n\nconst ABI = [\n {\n name: 'getConfig',\n type: 'function',\n stateMutability: 'view',\n inputs: [\n { name: 'agentId', type: 'uint256' },\n { name: 'configKey', type: 'string' },\n ],\n outputs: [{\n type: 'tuple',\n components: [\n { name: 'agentId', type: 'uint256' },\n { name: 'key', type: 'string' },\n { name: 'value', type: 'string' },\n { name: 'dataType', type: 'string' },\n { name: 'updatedAt', type: 'uint256' },\n { name: 'updatedBy', type: 'address' },\n ],\n }],\n },\n {\n name: 'getAgentConfigs',\n type: 'function',\n stateMutability: 'view',\n inputs: [{ name: 'agentId', type: 'uint256' }],\n outputs: [{\n type: 'tuple[]',\n components: [\n { name: 'agentId', type: 'uint256' },\n { name: 'key', type: 'string' },\n { name: 'value', type: 'string' },\n { name: 'dataType', type: 'string' },\n { name: 'updatedAt', type: 'uint256' },\n { name: 'updatedBy', type: 'address' },\n ],\n }],\n },\n {\n name: 'getConfigKeys',\n type: 'function',\n stateMutability: 'view',\n inputs: [{ name: 'agentId', type: 'uint256' }],\n outputs: [{ type: 'string[]' }],\n },\n {\n name: 'getConfigCount',\n type: 'function',\n stateMutability: 'view',\n inputs: [{ name: 'agentId', type: 'uint256' }],\n outputs: [{ type: 'uint256' }],\n },\n {\n name: 'configExists',\n type: 'function',\n stateMutability: 'view',\n inputs: [\n { name: 'agentId', type: 'uint256' },\n { name: 'configKey', type: 'string' },\n ],\n outputs: [{ type: 'bool' }],\n },\n] as const\n\nexport class ConfigurationClient {\n private address: Address\n private publicClient: PublicClient | null\n\n constructor(config: ConfigurationConfig, publicClient?: PublicClient) {\n this.address = config.address\n this.publicClient = publicClient ?? null\n }\n\n setPublicClient(client: PublicClient) {\n this.publicClient = client\n }\n\n async get(agentId: bigint, key: string): Promise<ConfigEntry | null> {\n if (!this.publicClient) throw new Error('publicClient not set')\n try {\n return (await this.publicClient.readContract({\n address: this.address,\n abi: ABI,\n functionName: 'getConfig',\n args: [agentId, key],\n })) as ConfigEntry\n } catch {\n return null\n }\n }\n\n async getAll(agentId: bigint): Promise<ConfigEntry[]> {\n if (!this.publicClient) throw new Error('publicClient not set')\n return (await this.publicClient.readContract({\n address: this.address,\n abi: ABI,\n functionName: 'getAgentConfigs',\n args: [agentId],\n })) as ConfigEntry[]\n }\n\n async getKeys(agentId: bigint): Promise<string[]> {\n if (!this.publicClient) throw new Error('publicClient not set')\n return (await this.publicClient.readContract({\n address: this.address,\n abi: ABI,\n functionName: 'getConfigKeys',\n args: [agentId],\n })) as string[]\n }\n\n async getCount(agentId: bigint): Promise<bigint> {\n if (!this.publicClient) throw new Error('publicClient not set')\n return (await this.publicClient.readContract({\n address: this.address,\n abi: ABI,\n functionName: 'getConfigCount',\n args: [agentId],\n })) as bigint\n }\n\n async exists(agentId: bigint, key: string): Promise<boolean> {\n if (!this.publicClient) throw new Error('publicClient not set')\n return (await this.publicClient.readContract({\n address: this.address,\n abi: ABI,\n functionName: 'configExists',\n args: [agentId, key],\n })) as boolean\n }\n}\n"],"mappings":";AAmBA,IAAM,MAAM;AAAA,EACV;AAAA,IACE,MAAM;AAAA,IACN,MAAM;AAAA,IACN,iBAAiB;AAAA,IACjB,QAAQ;AAAA,MACN,EAAE,MAAM,WAAW,MAAM,UAAU;AAAA,MACnC,EAAE,MA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A,EACH;AAAA,EAEA,MAAM,SAAS,SAAkC;AAC/C,QAAI,CAAC,KAAK,aAAc,OAAM,IAAI,MAAM,sBAAsB;AAC9D,WAAQ,MAAM,KAAK,aAAa,aAAa;AAAA,MAC3C,SAAS,KAAK;AAAA,MACd,KAAK;AAAA,MACL,cAAc;AAAA,MACd,MAAM,CAAC,OAAO;AAAA,IAChB,CAAC;AAAA,EACH;AAAA,EAEA,MAAM,OAAO,SAAiB,KAA+B;AAC3D,QAAI,CAAC,KAAK,aAAc,OAAM,IAAI,MAAM,sBAAsB;AAC9D,WAAQ,MAAM,KAAK,aAAa,aAAa;AAAA,MAC3C,SAAS,KAAK;AAAA,MACd,KAAK;AAAA,MACL,cAAc;AAAA,MACd,MAAM,CAAC,SAAS,GAAG;AAAA,IACrB,CAAC;AAAA,EACH;AACF;","names":[]}
|
package/dist/core.d.mts
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { E as EncryptedPayload, i as AgentPrivatePayload, g as AgentPayload, P as PackResult } from '../types-2aHUvS4M.mjs';
|
|
2
|
+
export { a as A2AAgentCard, e as A2ASkillExecution, b as A2ATask, f as A2ATaskStatus, h as AgentPricing, j as AgentPublicPayload, d as AgentReputation, c as AgentReview, k as AgentSearchQuery, l as AgentSearchResult, A as AgentSubscription, m as AgentXConfig, n as AgentXContracts, o as AgentXError, p as AgentXErrorCode, J as JSONSchema, q as JSONSchemaProperty, M as McpConnection, r as McpTransport, O as OnChainAgentMetadata, s as PricingType, R as RegisteredAgent, S as SkillDef, t as SkillExecutionMode, u as SkillExecutionRemote, v as SubscriptionRequired, w as SubscriptionStatus, U as UnpackResult } from '../types-2aHUvS4M.mjs';
|
|
3
|
+
export { bytesToHex, hexToBytes } from '@noble/ciphers/utils.js';
|
|
4
|
+
|
|
5
|
+
declare function randomBytes(length: number): Uint8Array;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Encrypt with AES-256-GCM.
|
|
9
|
+
* Wire format (same as aihunter-saas): base64( IV[12] || ciphertext || authTag[16] )
|
|
10
|
+
*/
|
|
11
|
+
declare function aesEncrypt(plaintext: string, keyHex: string): string;
|
|
12
|
+
/**
|
|
13
|
+
* Decrypt AES-256-GCM (same wire format as aihunter-saas).
|
|
14
|
+
*/
|
|
15
|
+
declare function aesDecrypt(encryptedBase64: string, keyHex: string): string;
|
|
16
|
+
/**
|
|
17
|
+
* Generate a cryptographically random AES-256 key (hex, 64 chars).
|
|
18
|
+
*/
|
|
19
|
+
declare function generateAesKey(): string;
|
|
20
|
+
/**
|
|
21
|
+
* Encrypt data with recipient's secp256k1 public key (ECIES).
|
|
22
|
+
*
|
|
23
|
+
* @param dataHex The data to encrypt (hex, e.g. AES key)
|
|
24
|
+
* @param publicKey Recipient's public key (hex, 04-prefixed uncompressed or 02/03 compressed)
|
|
25
|
+
*/
|
|
26
|
+
declare function eciesEncrypt(dataHex: string, publicKey: string): string;
|
|
27
|
+
/**
|
|
28
|
+
* Decrypt ECIES ciphertext with recipient's secp256k1 private key.
|
|
29
|
+
*/
|
|
30
|
+
declare function eciesDecrypt(dataHex: string, privateKey: string): string;
|
|
31
|
+
/**
|
|
32
|
+
* Encrypt an Agent's private payload with AES-256-GCM.
|
|
33
|
+
*/
|
|
34
|
+
declare function encryptPayload(payload: AgentPrivatePayload, keyHex?: string): EncryptedPayload;
|
|
35
|
+
/**
|
|
36
|
+
* Decrypt an EncryptedPayload.
|
|
37
|
+
*/
|
|
38
|
+
declare function decryptPayload(encrypted: EncryptedPayload, keyHex: string): AgentPrivatePayload;
|
|
39
|
+
/**
|
|
40
|
+
* Pack an AgentPayload for publishing.
|
|
41
|
+
* 1. Split public/private
|
|
42
|
+
* 2. AES-256-GCM encrypt private part
|
|
43
|
+
* 3. ECIES wrap AES key with creator's public key
|
|
44
|
+
*/
|
|
45
|
+
declare function packAgentForPublish(agent: AgentPayload, publicKey: string, aesKeyHex?: string): PackResult;
|
|
46
|
+
/**
|
|
47
|
+
* Unpack an Agent:
|
|
48
|
+
* 1. ECIES decrypt the AES key (private key)
|
|
49
|
+
* 2. AES-256-GCM decrypt the payload
|
|
50
|
+
*/
|
|
51
|
+
declare function unpackAgent(encryptedPayload: EncryptedPayload, eciesEncryptedKey: string, privateKey: string): AgentPrivatePayload;
|
|
52
|
+
/**
|
|
53
|
+
* Generate a secp256k1 keypair compatible with Ethereum wallets.
|
|
54
|
+
*/
|
|
55
|
+
declare function generateKeyPair(): {
|
|
56
|
+
privateKey: string;
|
|
57
|
+
publicKey: string;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Derive public key from private key (hex).
|
|
61
|
+
*/
|
|
62
|
+
declare function getPublicKey(privateKey: string): string;
|
|
63
|
+
|
|
64
|
+
export { AgentPayload, AgentPrivatePayload, EncryptedPayload, PackResult, aesDecrypt, aesEncrypt, decryptPayload, eciesDecrypt, eciesEncrypt, encryptPayload, generateAesKey, generateKeyPair, getPublicKey, packAgentForPublish, randomBytes, unpackAgent };
|
package/dist/core.d.ts
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { E as EncryptedPayload, i as AgentPrivatePayload, g as AgentPayload, P as PackResult } from '../types-2aHUvS4M.js';
|
|
2
|
+
export { a as A2AAgentCard, e as A2ASkillExecution, b as A2ATask, f as A2ATaskStatus, h as AgentPricing, j as AgentPublicPayload, d as AgentReputation, c as AgentReview, k as AgentSearchQuery, l as AgentSearchResult, A as AgentSubscription, m as AgentXConfig, n as AgentXContracts, o as AgentXError, p as AgentXErrorCode, J as JSONSchema, q as JSONSchemaProperty, M as McpConnection, r as McpTransport, O as OnChainAgentMetadata, s as PricingType, R as RegisteredAgent, S as SkillDef, t as SkillExecutionMode, u as SkillExecutionRemote, v as SubscriptionRequired, w as SubscriptionStatus, U as UnpackResult } from '../types-2aHUvS4M.js';
|
|
3
|
+
export { bytesToHex, hexToBytes } from '@noble/ciphers/utils.js';
|
|
4
|
+
|
|
5
|
+
declare function randomBytes(length: number): Uint8Array;
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Encrypt with AES-256-GCM.
|
|
9
|
+
* Wire format (same as aihunter-saas): base64( IV[12] || ciphertext || authTag[16] )
|
|
10
|
+
*/
|
|
11
|
+
declare function aesEncrypt(plaintext: string, keyHex: string): string;
|
|
12
|
+
/**
|
|
13
|
+
* Decrypt AES-256-GCM (same wire format as aihunter-saas).
|
|
14
|
+
*/
|
|
15
|
+
declare function aesDecrypt(encryptedBase64: string, keyHex: string): string;
|
|
16
|
+
/**
|
|
17
|
+
* Generate a cryptographically random AES-256 key (hex, 64 chars).
|
|
18
|
+
*/
|
|
19
|
+
declare function generateAesKey(): string;
|
|
20
|
+
/**
|
|
21
|
+
* Encrypt data with recipient's secp256k1 public key (ECIES).
|
|
22
|
+
*
|
|
23
|
+
* @param dataHex The data to encrypt (hex, e.g. AES key)
|
|
24
|
+
* @param publicKey Recipient's public key (hex, 04-prefixed uncompressed or 02/03 compressed)
|
|
25
|
+
*/
|
|
26
|
+
declare function eciesEncrypt(dataHex: string, publicKey: string): string;
|
|
27
|
+
/**
|
|
28
|
+
* Decrypt ECIES ciphertext with recipient's secp256k1 private key.
|
|
29
|
+
*/
|
|
30
|
+
declare function eciesDecrypt(dataHex: string, privateKey: string): string;
|
|
31
|
+
/**
|
|
32
|
+
* Encrypt an Agent's private payload with AES-256-GCM.
|
|
33
|
+
*/
|
|
34
|
+
declare function encryptPayload(payload: AgentPrivatePayload, keyHex?: string): EncryptedPayload;
|
|
35
|
+
/**
|
|
36
|
+
* Decrypt an EncryptedPayload.
|
|
37
|
+
*/
|
|
38
|
+
declare function decryptPayload(encrypted: EncryptedPayload, keyHex: string): AgentPrivatePayload;
|
|
39
|
+
/**
|
|
40
|
+
* Pack an AgentPayload for publishing.
|
|
41
|
+
* 1. Split public/private
|
|
42
|
+
* 2. AES-256-GCM encrypt private part
|
|
43
|
+
* 3. ECIES wrap AES key with creator's public key
|
|
44
|
+
*/
|
|
45
|
+
declare function packAgentForPublish(agent: AgentPayload, publicKey: string, aesKeyHex?: string): PackResult;
|
|
46
|
+
/**
|
|
47
|
+
* Unpack an Agent:
|
|
48
|
+
* 1. ECIES decrypt the AES key (private key)
|
|
49
|
+
* 2. AES-256-GCM decrypt the payload
|
|
50
|
+
*/
|
|
51
|
+
declare function unpackAgent(encryptedPayload: EncryptedPayload, eciesEncryptedKey: string, privateKey: string): AgentPrivatePayload;
|
|
52
|
+
/**
|
|
53
|
+
* Generate a secp256k1 keypair compatible with Ethereum wallets.
|
|
54
|
+
*/
|
|
55
|
+
declare function generateKeyPair(): {
|
|
56
|
+
privateKey: string;
|
|
57
|
+
publicKey: string;
|
|
58
|
+
};
|
|
59
|
+
/**
|
|
60
|
+
* Derive public key from private key (hex).
|
|
61
|
+
*/
|
|
62
|
+
declare function getPublicKey(privateKey: string): string;
|
|
63
|
+
|
|
64
|
+
export { AgentPayload, AgentPrivatePayload, EncryptedPayload, PackResult, aesDecrypt, aesEncrypt, decryptPayload, eciesDecrypt, eciesEncrypt, encryptPayload, generateAesKey, generateKeyPair, getPublicKey, packAgentForPublish, randomBytes, unpackAgent };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Address, PublicClient } from 'viem';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* MultiEndpointRegistry SDK
|
|
5
|
+
* OxaChain L1 + Sepolia — multi-endpoint management for AI Agents
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
interface EndpointRecord {
|
|
9
|
+
endpointId: bigint;
|
|
10
|
+
agentId: bigint;
|
|
11
|
+
name: string;
|
|
12
|
+
endpointType: string;
|
|
13
|
+
protocol: string;
|
|
14
|
+
url: string;
|
|
15
|
+
description: string;
|
|
16
|
+
isActive: boolean;
|
|
17
|
+
createdAt: bigint;
|
|
18
|
+
updatedAt: bigint;
|
|
19
|
+
createdBy: Address;
|
|
20
|
+
}
|
|
21
|
+
interface MultiEndpointConfig {
|
|
22
|
+
address: Address;
|
|
23
|
+
}
|
|
24
|
+
declare class MultiEndpointClient {
|
|
25
|
+
private address;
|
|
26
|
+
private publicClient;
|
|
27
|
+
constructor(config: MultiEndpointConfig, publicClient?: PublicClient);
|
|
28
|
+
setPublicClient(client: PublicClient): void;
|
|
29
|
+
getActiveEndpoints(agentId: bigint): Promise<EndpointRecord[]>;
|
|
30
|
+
getAllEndpoints(agentId: bigint): Promise<EndpointRecord[]>;
|
|
31
|
+
getEndpoint(endpointId: bigint): Promise<EndpointRecord>;
|
|
32
|
+
getStats(agentId: bigint): Promise<[bigint, bigint, bigint, bigint, bigint]>;
|
|
33
|
+
/** Pick best active endpoint for the agent — prefer HTTP, take first active */
|
|
34
|
+
pickBestEndpoint(agentId: bigint): Promise<EndpointRecord | null>;
|
|
35
|
+
/** Pick any active endpoint URL — for MCP connector */
|
|
36
|
+
getBestMCPUrl(agentId: bigint): Promise<string | null>;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export { type EndpointRecord, MultiEndpointClient, type MultiEndpointConfig };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Address, PublicClient } from 'viem';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* MultiEndpointRegistry SDK
|
|
5
|
+
* OxaChain L1 + Sepolia — multi-endpoint management for AI Agents
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
interface EndpointRecord {
|
|
9
|
+
endpointId: bigint;
|
|
10
|
+
agentId: bigint;
|
|
11
|
+
name: string;
|
|
12
|
+
endpointType: string;
|
|
13
|
+
protocol: string;
|
|
14
|
+
url: string;
|
|
15
|
+
description: string;
|
|
16
|
+
isActive: boolean;
|
|
17
|
+
createdAt: bigint;
|
|
18
|
+
updatedAt: bigint;
|
|
19
|
+
createdBy: Address;
|
|
20
|
+
}
|
|
21
|
+
interface MultiEndpointConfig {
|
|
22
|
+
address: Address;
|
|
23
|
+
}
|
|
24
|
+
declare class MultiEndpointClient {
|
|
25
|
+
private address;
|
|
26
|
+
private publicClient;
|
|
27
|
+
constructor(config: MultiEndpointConfig, publicClient?: PublicClient);
|
|
28
|
+
setPublicClient(client: PublicClient): void;
|
|
29
|
+
getActiveEndpoints(agentId: bigint): Promise<EndpointRecord[]>;
|
|
30
|
+
getAllEndpoints(agentId: bigint): Promise<EndpointRecord[]>;
|
|
31
|
+
getEndpoint(endpointId: bigint): Promise<EndpointRecord>;
|
|
32
|
+
getStats(agentId: bigint): Promise<[bigint, bigint, bigint, bigint, bigint]>;
|
|
33
|
+
/** Pick best active endpoint for the agent — prefer HTTP, take first active */
|
|
34
|
+
pickBestEndpoint(agentId: bigint): Promise<EndpointRecord | null>;
|
|
35
|
+
/** Pick any active endpoint URL — for MCP connector */
|
|
36
|
+
getBestMCPUrl(agentId: bigint): Promise<string | null>;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export { type EndpointRecord, MultiEndpointClient, type MultiEndpointConfig };
|