aegis-sdk 1.0.0
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 +27 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.js +34 -0
- package/package.json +31 -0
package/README.md
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
# aegis-sdk
|
|
2
|
+
|
|
3
|
+
The official client for the Aegis AI ecosystem on Stacks.
|
|
4
|
+
|
|
5
|
+
## features
|
|
6
|
+
|
|
7
|
+
- **registerAgent**: programmatically register AI agents.
|
|
8
|
+
- **updateStatus**: toggle your agent's availability on-chain.
|
|
9
|
+
- **Integration**: direct compatibility with the Aegis Agent Registry.
|
|
10
|
+
|
|
11
|
+
## installation
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
npm install aegis-sdk
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
## usage
|
|
18
|
+
|
|
19
|
+
```typescript
|
|
20
|
+
import { registerAgent } from 'aegis-sdk';
|
|
21
|
+
|
|
22
|
+
const result = await registerAgent({
|
|
23
|
+
contractAddress: 'ST...',
|
|
24
|
+
senderKey: '...',
|
|
25
|
+
network: 'testnet'
|
|
26
|
+
}, "https://metadata.url/agent-details");
|
|
27
|
+
```
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export interface AegisOptions {
|
|
2
|
+
contractAddress: string;
|
|
3
|
+
senderKey: string;
|
|
4
|
+
network?: 'mainnet' | 'testnet';
|
|
5
|
+
}
|
|
6
|
+
export declare function registerAgent(opts: AegisOptions, metadata: string): Promise<import("@stacks/transactions").TxBroadcastResult>;
|
|
7
|
+
export declare function updateStatus(opts: AegisOptions, agentId: number, active: boolean): Promise<import("@stacks/transactions").TxBroadcastResult>;
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { makeContractCall, broadcastTransaction, AnchorMode, PostConditionMode, stringUtf8CV, uintCV, boolCV, } from '@stacks/transactions';
|
|
2
|
+
import { StacksMainnet, StacksTestnet } from '@stacks/network';
|
|
3
|
+
export async function registerAgent(opts, metadata) {
|
|
4
|
+
const network = opts.network === 'mainnet' ? new StacksMainnet() : new StacksTestnet();
|
|
5
|
+
const txOptions = {
|
|
6
|
+
contractAddress: opts.contractAddress,
|
|
7
|
+
contractName: 'agent-registry',
|
|
8
|
+
functionName: 'register-agent',
|
|
9
|
+
functionArgs: [stringUtf8CV(metadata)],
|
|
10
|
+
senderKey: opts.senderKey,
|
|
11
|
+
network,
|
|
12
|
+
anchorMode: AnchorMode.Any,
|
|
13
|
+
postConditionMode: PostConditionMode.Allow,
|
|
14
|
+
fee: 400,
|
|
15
|
+
};
|
|
16
|
+
const transaction = await makeContractCall(txOptions);
|
|
17
|
+
return broadcastTransaction(transaction, network);
|
|
18
|
+
}
|
|
19
|
+
export async function updateStatus(opts, agentId, active) {
|
|
20
|
+
const network = opts.network === 'mainnet' ? new StacksMainnet() : new StacksTestnet();
|
|
21
|
+
const txOptions = {
|
|
22
|
+
contractAddress: opts.contractAddress,
|
|
23
|
+
contractName: 'agent-registry',
|
|
24
|
+
functionName: 'toggle-agent-status',
|
|
25
|
+
functionArgs: [uintCV(agentId), boolCV(active)],
|
|
26
|
+
senderKey: opts.senderKey,
|
|
27
|
+
network,
|
|
28
|
+
anchorMode: AnchorMode.Any,
|
|
29
|
+
postConditionMode: PostConditionMode.Allow,
|
|
30
|
+
fee: 400,
|
|
31
|
+
};
|
|
32
|
+
const transaction = await makeContractCall(txOptions);
|
|
33
|
+
return broadcastTransaction(transaction, network);
|
|
34
|
+
}
|
package/package.json
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "aegis-sdk",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "SDK for the Aegis AI project on Stacks.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist"
|
|
10
|
+
],
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "tsc",
|
|
13
|
+
"prepublishOnly": "npm run build"
|
|
14
|
+
},
|
|
15
|
+
"keywords": [
|
|
16
|
+
"stacks",
|
|
17
|
+
"bitcoin",
|
|
18
|
+
"ai",
|
|
19
|
+
"agent",
|
|
20
|
+
"registry"
|
|
21
|
+
],
|
|
22
|
+
"author": "Aegis Team",
|
|
23
|
+
"license": "MIT",
|
|
24
|
+
"dependencies": {
|
|
25
|
+
"@stacks/transactions": "^6.15.0",
|
|
26
|
+
"@stacks/network": "^6.17.0"
|
|
27
|
+
},
|
|
28
|
+
"devDependencies": {
|
|
29
|
+
"typescript": "^5.4.5"
|
|
30
|
+
}
|
|
31
|
+
}
|