plugin-gblin 0.1.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 +153 -0
- package/dist/index.d.ts +28 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +531 -0
- package/dist/index.js.map +1 -0
- package/package.json +62 -0
package/README.md
ADDED
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
# plugin-gblin
|
|
2
|
+
|
|
3
|
+
**ElizaOS plugin** — gasless treasury management for AI agents on Base mainnet.
|
|
4
|
+
|
|
5
|
+
Park idle USDC into the [GBLIN](https://gblin.digital) MEV-protected index (cbBTC / WETH / USDC),
|
|
6
|
+
JIT-swap back to USDC to pay x402 invoices, and monitor treasury health —
|
|
7
|
+
all from inside your ElizaOS agent.
|
|
8
|
+
|
|
9
|
+
[](https://www.npmjs.com/package/plugin-gblin)
|
|
10
|
+
[](https://elizaos.ai)
|
|
11
|
+
[](https://base.org)
|
|
12
|
+
|
|
13
|
+
---
|
|
14
|
+
|
|
15
|
+
## What it does
|
|
16
|
+
|
|
17
|
+
| Action | Trigger phrases | Cost |
|
|
18
|
+
|---|---|---|
|
|
19
|
+
| `CHECK_GBLIN_TREASURY_HEALTH` | "check my treasury", "wallet status" | $0.002 USDC |
|
|
20
|
+
| `INVEST_IDLE_USDC_GBLIN` | "park USDC in GBLIN", "buy GBLIN", "invest 10 USDC" | $0.002 USDC |
|
|
21
|
+
| `RESCUE_USDC_FROM_GBLIN` | "need USDC", "sell GBLIN", "JIT swap", "pay invoice" | $0.005 USDC |
|
|
22
|
+
|
|
23
|
+
The **Provider** (`GBLIN_TREASURY_CONTEXT`) injects live NAV, basket weights, and
|
|
24
|
+
Crash Shield status into every agent loop ($0.001 USDC per call).
|
|
25
|
+
|
|
26
|
+
All payments are gasless for the agent: the Coinbase CDP facilitator pays on-chain
|
|
27
|
+
gas; the agent only signs an EIP-3009 `transferWithAuthorization`.
|
|
28
|
+
|
|
29
|
+
---
|
|
30
|
+
|
|
31
|
+
## Install
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# with npm
|
|
35
|
+
npm install plugin-gblin
|
|
36
|
+
|
|
37
|
+
# with bun (elizaos default)
|
|
38
|
+
bun add plugin-gblin
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
Or via the ElizaOS CLI:
|
|
42
|
+
|
|
43
|
+
```bash
|
|
44
|
+
elizaos plugins add gblin
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Configuration
|
|
50
|
+
|
|
51
|
+
Add to your agent's `.env`:
|
|
52
|
+
|
|
53
|
+
```env
|
|
54
|
+
# Required
|
|
55
|
+
EVM_PRIVATE_KEY=0x_your_agent_hot_wallet_private_key
|
|
56
|
+
|
|
57
|
+
# Optional — override defaults
|
|
58
|
+
GBLIN_BASE_URL=https://gblin.digital
|
|
59
|
+
GBLIN_RPC_URL=https://base-rpc.publicnode.com
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
> **Security**: use a **dedicated hot wallet** for the agent with only the
|
|
63
|
+
> USDC/GBLIN it needs. Never use a founder or treasury wallet here.
|
|
64
|
+
> The maximum a malicious endpoint could drain in one run is $0.005 USDC.
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## Add to your character
|
|
69
|
+
|
|
70
|
+
```typescript
|
|
71
|
+
// character.ts
|
|
72
|
+
import { type Character } from "@elizaos/core";
|
|
73
|
+
|
|
74
|
+
export const character: Character = {
|
|
75
|
+
name: "TreasuryAgent",
|
|
76
|
+
plugins: [
|
|
77
|
+
"@elizaos/plugin-sql",
|
|
78
|
+
"@elizaos/plugin-bootstrap",
|
|
79
|
+
// Add GBLIN only if private key is set
|
|
80
|
+
...(process.env.EVM_PRIVATE_KEY?.trim() ? ["plugin-gblin"] : []),
|
|
81
|
+
],
|
|
82
|
+
// ...
|
|
83
|
+
};
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Or in `character.json`:
|
|
87
|
+
|
|
88
|
+
```json
|
|
89
|
+
{
|
|
90
|
+
"name": "TreasuryAgent",
|
|
91
|
+
"plugins": ["plugin-gblin"],
|
|
92
|
+
"settings": {
|
|
93
|
+
"secrets": {
|
|
94
|
+
"EVM_PRIVATE_KEY": "0x..."
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
---
|
|
101
|
+
|
|
102
|
+
## How it works
|
|
103
|
+
|
|
104
|
+
```
|
|
105
|
+
Agent LLM decides "I have idle USDC"
|
|
106
|
+
↓
|
|
107
|
+
triggers INVEST_IDLE_USDC_GBLIN action
|
|
108
|
+
↓
|
|
109
|
+
plugin sends GET /api/x402/invest?usdc=10 (preflight → 402)
|
|
110
|
+
↓
|
|
111
|
+
plugin signs EIP-3009 transferWithAuthorization ($0.002 USDC)
|
|
112
|
+
↓
|
|
113
|
+
plugin retries with PAYMENT-SIGNATURE header
|
|
114
|
+
↓
|
|
115
|
+
GBLIN API returns {steps: [{target, calldata}, {target, calldata}]}
|
|
116
|
+
↓
|
|
117
|
+
plugin broadcasts step 1 (USDC approve) → waits confirmation
|
|
118
|
+
↓
|
|
119
|
+
plugin broadcasts step 2 (buyGBLINWithToken) → waits confirmation
|
|
120
|
+
↓
|
|
121
|
+
callback: "✅ Invested $10 USDC → GBLIN. tx: 0xab12..."
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
---
|
|
125
|
+
|
|
126
|
+
## Endpoints consumed
|
|
127
|
+
|
|
128
|
+
All calls go to `https://gblin.digital/api/x402/*`. Each is a paid x402 v2
|
|
129
|
+
endpoint on Base mainnet (chain id 8453, USDC `0x8335...`).
|
|
130
|
+
|
|
131
|
+
| Path | Price | Returns |
|
|
132
|
+
|---|---|---|
|
|
133
|
+
| `GET /api/x402/treasury-state` | $0.001 | NAV, basket, Crash Shield |
|
|
134
|
+
| `GET /api/x402/health?wallet=` | $0.002 | balances, gas runway, recommendation |
|
|
135
|
+
| `GET /api/x402/invest?usdc=` | $0.002 | sequential tx calldata |
|
|
136
|
+
| `GET /api/x402/jit?usdc=&wallet=` | $0.005 | atomic swap calldata |
|
|
137
|
+
|
|
138
|
+
Discovery manifest: [gblin.digital/api/x402/llms.txt](https://gblin.digital/api/x402/llms.txt)
|
|
139
|
+
|
|
140
|
+
---
|
|
141
|
+
|
|
142
|
+
## Protocol
|
|
143
|
+
|
|
144
|
+
- **Contract**: [`0x38DcDB3A381677239BBc652aed9811F2f8496345`](https://basescan.org/address/0x38DcDB3A381677239BBc652aed9811F2f8496345) (Base mainnet)
|
|
145
|
+
- **Owner**: [48h Timelock](https://basescan.org/address/0x6aBeC8716fFeEcf7C3D6e68255b4797113E8e5Dd) — every parameter change takes 48 hours on-chain
|
|
146
|
+
- **Basket**: 45% cbBTC + 45% WETH + 10% USDC (rebalances with on-chain Crash Shield)
|
|
147
|
+
- **MCP Server**: [`@gblin-protocol/mcp-server`](https://www.npmjs.com/package/@gblin-protocol/mcp-server) — free alternative for Claude Desktop / Cursor
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## License
|
|
152
|
+
|
|
153
|
+
MIT © GBLIN Protocol
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* plugin-gblin — ElizaOS plugin for GBLIN Protocol
|
|
3
|
+
*
|
|
4
|
+
* Exposes three Actions and one Provider that let any ElizaOS agent:
|
|
5
|
+
* • Park idle USDC into the GBLIN MEV-protected cbBTC/WETH basket (invest)
|
|
6
|
+
* • JIT-swap GBLIN back to USDC to pay x402 invoices in real-time (rescue)
|
|
7
|
+
* • Read treasury health to decide when to rebalance (health check)
|
|
8
|
+
*
|
|
9
|
+
* All on-chain calls go through the GBLIN x402 API on Base mainnet.
|
|
10
|
+
* Payments to the API ($0.001–$0.005 USDC) use EIP-3009 transferWithAuthorization
|
|
11
|
+
* signed by the agent's own wallet — no API keys, no centralised auth.
|
|
12
|
+
*
|
|
13
|
+
* Required env (via runtime.getSetting):
|
|
14
|
+
* EVM_PRIVATE_KEY — 0x-prefixed 32-byte hex key (agent hot wallet)
|
|
15
|
+
*
|
|
16
|
+
* Optional env:
|
|
17
|
+
* GBLIN_BASE_URL — override API host (default: https://gblin.digital)
|
|
18
|
+
* GBLIN_RPC_URL — override Base mainnet RPC (default: publicnode)
|
|
19
|
+
*/
|
|
20
|
+
import { type Action, type Plugin, type Provider } from "@elizaos/core";
|
|
21
|
+
declare const checkTreasuryHealthAction: Action;
|
|
22
|
+
declare const investIdleUsdcAction: Action;
|
|
23
|
+
declare const rescueUsdcAction: Action;
|
|
24
|
+
declare const gblinTreasuryProvider: Provider;
|
|
25
|
+
export declare const gblinPlugin: Plugin;
|
|
26
|
+
export default gblinPlugin;
|
|
27
|
+
export { checkTreasuryHealthAction, investIdleUsdcAction, rescueUsdcAction, gblinTreasuryProvider, };
|
|
28
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EACL,KAAK,MAAM,EAKX,KAAK,MAAM,EACX,KAAK,QAAQ,EAId,MAAM,eAAe,CAAC;AAgMvB,QAAA,MAAM,yBAAyB,EAAE,MAoHhC,CAAC;AAIF,QAAA,MAAM,oBAAoB,EAAE,MAgK3B,CAAC;AAIF,QAAA,MAAM,gBAAgB,EAAE,MA0IvB,CAAC;AAIF,QAAA,MAAM,qBAAqB,EAAE,QAwE5B,CAAC;AAIF,eAAO,MAAM,WAAW,EAAE,MAYzB,CAAC;AAEF,eAAe,WAAW,CAAC;AAE3B,OAAO,EACL,yBAAyB,EACzB,oBAAoB,EACpB,gBAAgB,EAChB,qBAAqB,GACtB,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,531 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* plugin-gblin — ElizaOS plugin for GBLIN Protocol
|
|
3
|
+
*
|
|
4
|
+
* Exposes three Actions and one Provider that let any ElizaOS agent:
|
|
5
|
+
* • Park idle USDC into the GBLIN MEV-protected cbBTC/WETH basket (invest)
|
|
6
|
+
* • JIT-swap GBLIN back to USDC to pay x402 invoices in real-time (rescue)
|
|
7
|
+
* • Read treasury health to decide when to rebalance (health check)
|
|
8
|
+
*
|
|
9
|
+
* All on-chain calls go through the GBLIN x402 API on Base mainnet.
|
|
10
|
+
* Payments to the API ($0.001–$0.005 USDC) use EIP-3009 transferWithAuthorization
|
|
11
|
+
* signed by the agent's own wallet — no API keys, no centralised auth.
|
|
12
|
+
*
|
|
13
|
+
* Required env (via runtime.getSetting):
|
|
14
|
+
* EVM_PRIVATE_KEY — 0x-prefixed 32-byte hex key (agent hot wallet)
|
|
15
|
+
*
|
|
16
|
+
* Optional env:
|
|
17
|
+
* GBLIN_BASE_URL — override API host (default: https://gblin.digital)
|
|
18
|
+
* GBLIN_RPC_URL — override Base mainnet RPC (default: publicnode)
|
|
19
|
+
*/
|
|
20
|
+
import { logger, } from "@elizaos/core";
|
|
21
|
+
import { createPublicClient, createWalletClient, encodeAbiParameters, http, parseAbiParameters, parseUnits, } from "viem";
|
|
22
|
+
import { base } from "viem/chains";
|
|
23
|
+
import { privateKeyToAccount } from "viem/accounts";
|
|
24
|
+
// ─── Constants ───────────────────────────────────────────────────────────────
|
|
25
|
+
const DEFAULT_BASE_URL = "https://gblin.digital";
|
|
26
|
+
const DEFAULT_RPC_URL = "https://base-rpc.publicnode.com";
|
|
27
|
+
const USDC_ADDRESS = "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913";
|
|
28
|
+
const USDC_DECIMALS = 6;
|
|
29
|
+
// x402 v2 EIP-3009 domain for USDC on Base mainnet
|
|
30
|
+
const USDC_DOMAIN = {
|
|
31
|
+
name: "USD Coin",
|
|
32
|
+
version: "2",
|
|
33
|
+
chainId: 8453,
|
|
34
|
+
verifyingContract: USDC_ADDRESS,
|
|
35
|
+
};
|
|
36
|
+
const TRANSFER_WITH_AUTH_TYPES = {
|
|
37
|
+
TransferWithAuthorization: [
|
|
38
|
+
{ name: "from", type: "address" },
|
|
39
|
+
{ name: "to", type: "address" },
|
|
40
|
+
{ name: "value", type: "uint256" },
|
|
41
|
+
{ name: "validAfter", type: "uint256" },
|
|
42
|
+
{ name: "validBefore", type: "uint256" },
|
|
43
|
+
{ name: "nonce", type: "bytes32" },
|
|
44
|
+
],
|
|
45
|
+
};
|
|
46
|
+
// ─── Helpers ─────────────────────────────────────────────────────────────────
|
|
47
|
+
function getConfig(runtime) {
|
|
48
|
+
const rawKey = String(runtime.getSetting("EVM_PRIVATE_KEY") ?? "");
|
|
49
|
+
if (!rawKey || !rawKey.startsWith("0x") || rawKey.length !== 66) {
|
|
50
|
+
throw new Error("EVM_PRIVATE_KEY is missing or invalid. " +
|
|
51
|
+
"Set it in your agent's environment (66-char 0x-prefixed hex).");
|
|
52
|
+
}
|
|
53
|
+
const baseUrl = String(runtime.getSetting("GBLIN_BASE_URL") ?? DEFAULT_BASE_URL);
|
|
54
|
+
const rpcUrl = String(runtime.getSetting("GBLIN_RPC_URL") ?? DEFAULT_RPC_URL);
|
|
55
|
+
const account = privateKeyToAccount(rawKey);
|
|
56
|
+
const publicClient = createPublicClient({
|
|
57
|
+
chain: base,
|
|
58
|
+
transport: http(rpcUrl),
|
|
59
|
+
});
|
|
60
|
+
const walletClient = createWalletClient({
|
|
61
|
+
account,
|
|
62
|
+
chain: base,
|
|
63
|
+
transport: http(rpcUrl),
|
|
64
|
+
});
|
|
65
|
+
return { account, publicClient, walletClient, baseUrl };
|
|
66
|
+
}
|
|
67
|
+
/**
|
|
68
|
+
* Build x402 PAYMENT-SIGNATURE header for a given endpoint price.
|
|
69
|
+
* Uses EIP-3009 transferWithAuthorization (USDC native, gasless for caller).
|
|
70
|
+
*/
|
|
71
|
+
async function buildPaymentSignature(runtime, payToAddress, priceUsdc) {
|
|
72
|
+
const { account, walletClient } = getConfig(runtime);
|
|
73
|
+
const value = parseUnits(priceUsdc, USDC_DECIMALS);
|
|
74
|
+
const validAfter = 0n;
|
|
75
|
+
const validBefore = BigInt(Math.floor(Date.now() / 1000) + 120); // 2 min
|
|
76
|
+
// Random nonce (bytes32)
|
|
77
|
+
const nonceBytes = crypto.getRandomValues(new Uint8Array(32));
|
|
78
|
+
const nonce = ("0x" +
|
|
79
|
+
Array.from(nonceBytes)
|
|
80
|
+
.map((b) => b.toString(16).padStart(2, "0"))
|
|
81
|
+
.join(""));
|
|
82
|
+
const sig = await walletClient.signTypedData({
|
|
83
|
+
account,
|
|
84
|
+
domain: USDC_DOMAIN,
|
|
85
|
+
types: TRANSFER_WITH_AUTH_TYPES,
|
|
86
|
+
primaryType: "TransferWithAuthorization",
|
|
87
|
+
message: {
|
|
88
|
+
from: account.address,
|
|
89
|
+
to: payToAddress,
|
|
90
|
+
value,
|
|
91
|
+
validAfter,
|
|
92
|
+
validBefore,
|
|
93
|
+
nonce,
|
|
94
|
+
},
|
|
95
|
+
});
|
|
96
|
+
const payload = {
|
|
97
|
+
x402Version: 2,
|
|
98
|
+
scheme: "exact",
|
|
99
|
+
network: "eip155:8453",
|
|
100
|
+
payload: {
|
|
101
|
+
signature: sig,
|
|
102
|
+
authorization: encodeAbiParameters(parseAbiParameters("address from, address to, uint256 value, uint256 validAfter, uint256 validBefore, bytes32 nonce"), [
|
|
103
|
+
account.address,
|
|
104
|
+
payToAddress,
|
|
105
|
+
value,
|
|
106
|
+
validAfter,
|
|
107
|
+
validBefore,
|
|
108
|
+
nonce,
|
|
109
|
+
]),
|
|
110
|
+
},
|
|
111
|
+
};
|
|
112
|
+
return Buffer.from(JSON.stringify(payload)).toString("base64");
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Perform a paid GET request to a GBLIN x402 endpoint.
|
|
116
|
+
* Handles the 402 → sign → retry flow automatically.
|
|
117
|
+
*/
|
|
118
|
+
async function x402Get(runtime, path) {
|
|
119
|
+
const { baseUrl } = getConfig(runtime);
|
|
120
|
+
const url = `${baseUrl}${path}`;
|
|
121
|
+
// Step 1: preflight to get payment requirements
|
|
122
|
+
const preflight = await fetch(url);
|
|
123
|
+
if (preflight.status !== 402) {
|
|
124
|
+
if (preflight.ok)
|
|
125
|
+
return preflight.json();
|
|
126
|
+
throw new Error(`Unexpected status ${preflight.status} from ${url}`);
|
|
127
|
+
}
|
|
128
|
+
const prHeader = preflight.headers.get("PAYMENT-REQUIRED");
|
|
129
|
+
if (!prHeader) {
|
|
130
|
+
throw new Error("x402: missing PAYMENT-REQUIRED header on 402 response");
|
|
131
|
+
}
|
|
132
|
+
const pr = JSON.parse(Buffer.from(prHeader, "base64").toString("utf8"));
|
|
133
|
+
const accept = pr.accepts?.[0];
|
|
134
|
+
if (!accept) {
|
|
135
|
+
throw new Error("x402: no accepts[] in PAYMENT-REQUIRED payload");
|
|
136
|
+
}
|
|
137
|
+
const payTo = accept.payTo;
|
|
138
|
+
const priceRaw = accept.amount; // micro-USDC units
|
|
139
|
+
const priceUsdc = (Number(priceRaw) / 1e6).toFixed(6);
|
|
140
|
+
// Step 2: sign payment
|
|
141
|
+
const paymentSignature = await buildPaymentSignature(runtime, payTo, priceUsdc);
|
|
142
|
+
// Step 3: retry with payment
|
|
143
|
+
const paid = await fetch(url, {
|
|
144
|
+
headers: { "PAYMENT-SIGNATURE": paymentSignature },
|
|
145
|
+
});
|
|
146
|
+
if (!paid.ok) {
|
|
147
|
+
const body = await paid.text();
|
|
148
|
+
throw new Error(`x402 payment rejected (${paid.status}): ${body.slice(0, 200)}`);
|
|
149
|
+
}
|
|
150
|
+
return paid.json();
|
|
151
|
+
}
|
|
152
|
+
// ─── Action: CHECK_GBLIN_TREASURY_HEALTH ─────────────────────────────────────
|
|
153
|
+
const checkTreasuryHealthAction = {
|
|
154
|
+
name: "CHECK_GBLIN_TREASURY_HEALTH",
|
|
155
|
+
similes: [
|
|
156
|
+
"GBLIN_HEALTH",
|
|
157
|
+
"CHECK_TREASURY",
|
|
158
|
+
"ANALYZE_WALLET_TREASURY",
|
|
159
|
+
"GET_GBLIN_BALANCES",
|
|
160
|
+
"TREASURY_STATUS",
|
|
161
|
+
],
|
|
162
|
+
description: "Query the GBLIN protocol for a wallet's treasury health: " +
|
|
163
|
+
"GBLIN/USDC/ETH balances in USD, gas runway in days, and a rebalance " +
|
|
164
|
+
"recommendation. Costs $0.002 USDC on Base mainnet via x402.",
|
|
165
|
+
validate: async (runtime) => {
|
|
166
|
+
const key = String(runtime.getSetting("EVM_PRIVATE_KEY") ?? "");
|
|
167
|
+
if (!key || !key.startsWith("0x") || key.length !== 66) {
|
|
168
|
+
logger.warn("[plugin-gblin] CHECK_GBLIN_TREASURY_HEALTH: EVM_PRIVATE_KEY missing or invalid");
|
|
169
|
+
return false;
|
|
170
|
+
}
|
|
171
|
+
return true;
|
|
172
|
+
},
|
|
173
|
+
handler: async (runtime, message, _state, _options, callback) => {
|
|
174
|
+
try {
|
|
175
|
+
const { account } = getConfig(runtime);
|
|
176
|
+
// Extract wallet address from message or use agent's own wallet
|
|
177
|
+
const text = message.content?.text ?? "";
|
|
178
|
+
const walletMatch = text.match(/0x[0-9a-fA-F]{40}/);
|
|
179
|
+
const wallet = walletMatch ? walletMatch[0] : account.address;
|
|
180
|
+
logger.info(`[plugin-gblin] Checking treasury health for wallet ${wallet}`);
|
|
181
|
+
const data = (await x402Get(runtime, `/api/x402/health?wallet=${wallet}`));
|
|
182
|
+
const balances = data.balances;
|
|
183
|
+
const runway = data.runway;
|
|
184
|
+
const rebalance = data.rebalance_recommendation;
|
|
185
|
+
const summary = `📊 **GBLIN Treasury Health** for \`${wallet}\`\n\n` +
|
|
186
|
+
`**Balances:**\n` +
|
|
187
|
+
` • GBLIN: ${balances?.gblin} ($${balances?.gblin_value_usd})\n` +
|
|
188
|
+
` • USDC: $${balances?.usdc}\n` +
|
|
189
|
+
` • ETH: ${balances?.eth} ($${balances?.eth_value_usd})\n` +
|
|
190
|
+
` • Total: **$${balances?.total_usd}**\n\n` +
|
|
191
|
+
`**Gas runway:** ${runway?.days_remaining ?? "unknown"} days\n\n` +
|
|
192
|
+
`**Recommendation:** ${rebalance ?? "No action needed"}`;
|
|
193
|
+
if (callback) {
|
|
194
|
+
await callback({
|
|
195
|
+
text: summary,
|
|
196
|
+
actions: ["CHECK_GBLIN_TREASURY_HEALTH"],
|
|
197
|
+
source: message.content?.source,
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
return {
|
|
201
|
+
success: true,
|
|
202
|
+
text: summary,
|
|
203
|
+
data,
|
|
204
|
+
};
|
|
205
|
+
}
|
|
206
|
+
catch (error) {
|
|
207
|
+
const msg = `Failed to check treasury health: ${error.message}`;
|
|
208
|
+
logger.error(`[plugin-gblin] ${msg}`);
|
|
209
|
+
if (callback) {
|
|
210
|
+
await callback({ text: `❌ ${msg}`, source: message.content?.source });
|
|
211
|
+
}
|
|
212
|
+
return { success: false, text: msg };
|
|
213
|
+
}
|
|
214
|
+
},
|
|
215
|
+
examples: [
|
|
216
|
+
[
|
|
217
|
+
{
|
|
218
|
+
name: "{{user}}",
|
|
219
|
+
content: { text: "Check my GBLIN treasury health" },
|
|
220
|
+
},
|
|
221
|
+
{
|
|
222
|
+
name: "{{agent}}",
|
|
223
|
+
content: {
|
|
224
|
+
text: "Checking treasury health via GBLIN x402 API...",
|
|
225
|
+
actions: ["CHECK_GBLIN_TREASURY_HEALTH"],
|
|
226
|
+
},
|
|
227
|
+
},
|
|
228
|
+
],
|
|
229
|
+
[
|
|
230
|
+
{
|
|
231
|
+
name: "{{user}}",
|
|
232
|
+
content: {
|
|
233
|
+
text: "What is the treasury status for 0x0000000000000000000000000000000000000001?",
|
|
234
|
+
},
|
|
235
|
+
},
|
|
236
|
+
{
|
|
237
|
+
name: "{{agent}}",
|
|
238
|
+
content: {
|
|
239
|
+
text: "I'll analyze that wallet's treasury health right now.",
|
|
240
|
+
actions: ["CHECK_GBLIN_TREASURY_HEALTH"],
|
|
241
|
+
},
|
|
242
|
+
},
|
|
243
|
+
],
|
|
244
|
+
],
|
|
245
|
+
};
|
|
246
|
+
// ─── Action: INVEST_IDLE_USDC_GBLIN ──────────────────────────────────────────
|
|
247
|
+
const investIdleUsdcAction = {
|
|
248
|
+
name: "INVEST_IDLE_USDC_GBLIN",
|
|
249
|
+
similes: [
|
|
250
|
+
"PARK_USDC_IN_GBLIN",
|
|
251
|
+
"BUY_GBLIN",
|
|
252
|
+
"CONVERT_USDC_TO_GBLIN",
|
|
253
|
+
"SHIELD_TREASURY_MEV",
|
|
254
|
+
"GBLIN_INVEST",
|
|
255
|
+
"ACCUMULATE_GBLIN",
|
|
256
|
+
],
|
|
257
|
+
description: "Convert idle USDC into the GBLIN MEV-protected index (cbBTC/WETH/USDC). " +
|
|
258
|
+
"Fetches ready-to-broadcast calldata (approve + buyGBLINWithToken) from the " +
|
|
259
|
+
"GBLIN x402 API and executes both transactions sequentially on Base mainnet. " +
|
|
260
|
+
"Costs $0.002 USDC for the API call plus gas on Base.",
|
|
261
|
+
validate: async (runtime) => {
|
|
262
|
+
const key = String(runtime.getSetting("EVM_PRIVATE_KEY") ?? "");
|
|
263
|
+
if (!key || !key.startsWith("0x") || key.length !== 66) {
|
|
264
|
+
logger.warn("[plugin-gblin] INVEST_IDLE_USDC_GBLIN: EVM_PRIVATE_KEY missing or invalid");
|
|
265
|
+
return false;
|
|
266
|
+
}
|
|
267
|
+
return true;
|
|
268
|
+
},
|
|
269
|
+
handler: async (runtime, message, _state, _options, callback) => {
|
|
270
|
+
try {
|
|
271
|
+
const { account, walletClient, publicClient } = getConfig(runtime);
|
|
272
|
+
// Extract USDC amount from message
|
|
273
|
+
const text = message.content?.text ?? "";
|
|
274
|
+
const amountMatch = text.match(/(\d+(?:\.\d+)?)\s*(?:usdc|USDC|\$)?/i);
|
|
275
|
+
const usdcAmount = amountMatch ? amountMatch[1] : "10";
|
|
276
|
+
logger.info(`[plugin-gblin] Investing ${usdcAmount} USDC into GBLIN for ${account.address}`);
|
|
277
|
+
if (callback) {
|
|
278
|
+
await callback({
|
|
279
|
+
text: `⏳ Fetching GBLIN invest calldata for $${usdcAmount} USDC...`,
|
|
280
|
+
source: message.content?.source,
|
|
281
|
+
});
|
|
282
|
+
}
|
|
283
|
+
const data = (await x402Get(runtime, `/api/x402/invest?usdc=${usdcAmount}`));
|
|
284
|
+
if (!data.steps || data.steps.length === 0) {
|
|
285
|
+
throw new Error("API returned no transaction steps");
|
|
286
|
+
}
|
|
287
|
+
const txHashes = [];
|
|
288
|
+
for (const step of data.steps) {
|
|
289
|
+
logger.info(`[plugin-gblin] Executing step ${step.step}: ${step.description}`);
|
|
290
|
+
const hash = await walletClient.sendTransaction({
|
|
291
|
+
account,
|
|
292
|
+
to: step.target,
|
|
293
|
+
data: step.calldata,
|
|
294
|
+
value: step.value ? BigInt(step.value) : 0n,
|
|
295
|
+
});
|
|
296
|
+
txHashes.push(hash);
|
|
297
|
+
await publicClient.waitForTransactionReceipt({
|
|
298
|
+
hash,
|
|
299
|
+
confirmations: 1,
|
|
300
|
+
});
|
|
301
|
+
logger.info(`[plugin-gblin] Step ${step.step} confirmed: ${hash}`);
|
|
302
|
+
}
|
|
303
|
+
const summary = `✅ **GBLIN Investment Complete**\n\n` +
|
|
304
|
+
`**Invested:** $${usdcAmount} USDC\n` +
|
|
305
|
+
`**Expected GBLIN out:** ~${data.expected_gblin_out ?? "calculating..."}\n` +
|
|
306
|
+
`**Safe min out:** ${data.safe_min_gblin_out ?? "N/A"}\n\n` +
|
|
307
|
+
`**Transactions:**\n` +
|
|
308
|
+
txHashes
|
|
309
|
+
.map((h, i) => ` Step ${i + 1}: [${h.slice(0, 10)}...](https://basescan.org/tx/${h})`)
|
|
310
|
+
.join("\n");
|
|
311
|
+
if (callback) {
|
|
312
|
+
await callback({
|
|
313
|
+
text: summary,
|
|
314
|
+
actions: ["INVEST_IDLE_USDC_GBLIN"],
|
|
315
|
+
source: message.content?.source,
|
|
316
|
+
});
|
|
317
|
+
}
|
|
318
|
+
return {
|
|
319
|
+
success: true,
|
|
320
|
+
text: summary,
|
|
321
|
+
data: { txHashes, usdcAmount, ...data },
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
catch (error) {
|
|
325
|
+
const msg = `Failed to invest USDC into GBLIN: ${error.message}`;
|
|
326
|
+
logger.error(`[plugin-gblin] ${msg}`);
|
|
327
|
+
if (callback) {
|
|
328
|
+
await callback({ text: `❌ ${msg}`, source: message.content?.source });
|
|
329
|
+
}
|
|
330
|
+
return { success: false, text: msg };
|
|
331
|
+
}
|
|
332
|
+
},
|
|
333
|
+
examples: [
|
|
334
|
+
[
|
|
335
|
+
{
|
|
336
|
+
name: "{{user}}",
|
|
337
|
+
content: { text: "I have idle USDC. Park it in GBLIN." },
|
|
338
|
+
},
|
|
339
|
+
{
|
|
340
|
+
name: "{{agent}}",
|
|
341
|
+
content: {
|
|
342
|
+
text: "Converting your idle USDC into GBLIN for MEV-protected treasury management.",
|
|
343
|
+
actions: ["INVEST_IDLE_USDC_GBLIN"],
|
|
344
|
+
},
|
|
345
|
+
},
|
|
346
|
+
],
|
|
347
|
+
[
|
|
348
|
+
{
|
|
349
|
+
name: "{{user}}",
|
|
350
|
+
content: { text: "Buy 25 USDC worth of GBLIN" },
|
|
351
|
+
},
|
|
352
|
+
{
|
|
353
|
+
name: "{{agent}}",
|
|
354
|
+
content: {
|
|
355
|
+
text: "Executing a $25 USDC → GBLIN investment on Base mainnet.",
|
|
356
|
+
actions: ["INVEST_IDLE_USDC_GBLIN"],
|
|
357
|
+
},
|
|
358
|
+
},
|
|
359
|
+
],
|
|
360
|
+
],
|
|
361
|
+
};
|
|
362
|
+
// ─── Action: RESCUE_USDC_FROM_GBLIN ──────────────────────────────────────────
|
|
363
|
+
const rescueUsdcAction = {
|
|
364
|
+
name: "RESCUE_USDC_FROM_GBLIN",
|
|
365
|
+
similes: [
|
|
366
|
+
"JIT_SWAP_GBLIN",
|
|
367
|
+
"SELL_GBLIN_FOR_USDC",
|
|
368
|
+
"CONVERT_GBLIN_TO_USDC",
|
|
369
|
+
"LIQUIDATE_GBLIN",
|
|
370
|
+
"GBLIN_TO_USDC",
|
|
371
|
+
"PAY_X402_INVOICE",
|
|
372
|
+
],
|
|
373
|
+
description: "Just-In-Time swap GBLIN → USDC in a single atomic transaction. " +
|
|
374
|
+
"Use this when the agent needs USDC to pay an x402 invoice or cover " +
|
|
375
|
+
"operational costs. Fetches atomic calldata from GBLIN x402 API and " +
|
|
376
|
+
"broadcasts it on Base mainnet. Costs $0.005 USDC for the API call plus gas.",
|
|
377
|
+
validate: async (runtime) => {
|
|
378
|
+
const key = String(runtime.getSetting("EVM_PRIVATE_KEY") ?? "");
|
|
379
|
+
if (!key || !key.startsWith("0x") || key.length !== 66) {
|
|
380
|
+
logger.warn("[plugin-gblin] RESCUE_USDC_FROM_GBLIN: EVM_PRIVATE_KEY missing or invalid");
|
|
381
|
+
return false;
|
|
382
|
+
}
|
|
383
|
+
return true;
|
|
384
|
+
},
|
|
385
|
+
handler: async (runtime, message, _state, _options, callback) => {
|
|
386
|
+
try {
|
|
387
|
+
const { account, walletClient, publicClient } = getConfig(runtime);
|
|
388
|
+
// Extract USDC amount needed from message
|
|
389
|
+
const text = message.content?.text ?? "";
|
|
390
|
+
const amountMatch = text.match(/(\d+(?:\.\d+)?)\s*(?:usdc|USDC|\$)?/i);
|
|
391
|
+
const usdcNeeded = amountMatch ? amountMatch[1] : "1";
|
|
392
|
+
logger.info(`[plugin-gblin] JIT rescue: ${usdcNeeded} USDC for ${account.address}`);
|
|
393
|
+
if (callback) {
|
|
394
|
+
await callback({
|
|
395
|
+
text: `⏳ Generating JIT GBLIN→USDC swap calldata for $${usdcNeeded}...`,
|
|
396
|
+
source: message.content?.source,
|
|
397
|
+
});
|
|
398
|
+
}
|
|
399
|
+
const data = (await x402Get(runtime, `/api/x402/jit?usdc=${usdcNeeded}&wallet=${account.address}`));
|
|
400
|
+
if (!data.target_contract || !data.calldata) {
|
|
401
|
+
throw new Error("API returned incomplete JIT swap data");
|
|
402
|
+
}
|
|
403
|
+
const hash = await walletClient.sendTransaction({
|
|
404
|
+
account,
|
|
405
|
+
to: data.target_contract,
|
|
406
|
+
data: data.calldata,
|
|
407
|
+
value: 0n,
|
|
408
|
+
});
|
|
409
|
+
await publicClient.waitForTransactionReceipt({
|
|
410
|
+
hash,
|
|
411
|
+
confirmations: 1,
|
|
412
|
+
});
|
|
413
|
+
const summary = `✅ **GBLIN → USDC JIT Swap Complete**\n\n` +
|
|
414
|
+
`**USDC received:** ~$${usdcNeeded}\n` +
|
|
415
|
+
`**GBLIN burned:** ~${data.gblin_in ?? "calculated on-chain"}\n` +
|
|
416
|
+
`**Transaction:** [${hash.slice(0, 10)}...](https://basescan.org/tx/${hash})`;
|
|
417
|
+
if (callback) {
|
|
418
|
+
await callback({
|
|
419
|
+
text: summary,
|
|
420
|
+
actions: ["RESCUE_USDC_FROM_GBLIN"],
|
|
421
|
+
source: message.content?.source,
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
return {
|
|
425
|
+
success: true,
|
|
426
|
+
text: summary,
|
|
427
|
+
data: { txHash: hash, usdcNeeded, ...data },
|
|
428
|
+
};
|
|
429
|
+
}
|
|
430
|
+
catch (error) {
|
|
431
|
+
const msg = `Failed to JIT swap GBLIN → USDC: ${error.message}`;
|
|
432
|
+
logger.error(`[plugin-gblin] ${msg}`);
|
|
433
|
+
if (callback) {
|
|
434
|
+
await callback({ text: `❌ ${msg}`, source: message.content?.source });
|
|
435
|
+
}
|
|
436
|
+
return { success: false, text: msg };
|
|
437
|
+
}
|
|
438
|
+
},
|
|
439
|
+
examples: [
|
|
440
|
+
[
|
|
441
|
+
{
|
|
442
|
+
name: "{{user}}",
|
|
443
|
+
content: { text: "I need 5 USDC to pay an x402 invoice" },
|
|
444
|
+
},
|
|
445
|
+
{
|
|
446
|
+
name: "{{agent}}",
|
|
447
|
+
content: {
|
|
448
|
+
text: "JIT-swapping GBLIN → $5 USDC to cover the invoice.",
|
|
449
|
+
actions: ["RESCUE_USDC_FROM_GBLIN"],
|
|
450
|
+
},
|
|
451
|
+
},
|
|
452
|
+
],
|
|
453
|
+
[
|
|
454
|
+
{
|
|
455
|
+
name: "{{user}}",
|
|
456
|
+
content: { text: "Sell some GBLIN for 10 USDC" },
|
|
457
|
+
},
|
|
458
|
+
{
|
|
459
|
+
name: "{{agent}}",
|
|
460
|
+
content: {
|
|
461
|
+
text: "Executing a JIT GBLIN→USDC atomic swap for $10.",
|
|
462
|
+
actions: ["RESCUE_USDC_FROM_GBLIN"],
|
|
463
|
+
},
|
|
464
|
+
},
|
|
465
|
+
],
|
|
466
|
+
],
|
|
467
|
+
};
|
|
468
|
+
// ─── Provider: GBLIN_TREASURY_CONTEXT ────────────────────────────────────────
|
|
469
|
+
const gblinTreasuryProvider = {
|
|
470
|
+
name: "GBLIN_TREASURY_CONTEXT",
|
|
471
|
+
description: "Injects current GBLIN protocol state (NAV, basket weights, Crash Shield status) " +
|
|
472
|
+
"into the agent context so the LLM can make informed treasury decisions. " +
|
|
473
|
+
"This endpoint is paid ($0.001 USDC via x402) and called on every agent loop.",
|
|
474
|
+
dynamic: true,
|
|
475
|
+
position: 100,
|
|
476
|
+
get: async (runtime, _message, _state) => {
|
|
477
|
+
const key = String(runtime.getSetting("EVM_PRIVATE_KEY") ?? "");
|
|
478
|
+
if (!key || !key.startsWith("0x") || key.length !== 66) {
|
|
479
|
+
return {
|
|
480
|
+
text: "[GBLIN] EVM_PRIVATE_KEY not set — treasury context unavailable.",
|
|
481
|
+
data: { available: false },
|
|
482
|
+
};
|
|
483
|
+
}
|
|
484
|
+
try {
|
|
485
|
+
const data = (await x402Get(runtime, "/api/x402/treasury-state"));
|
|
486
|
+
const basketSummary = data.basket
|
|
487
|
+
.map((b) => `${b.is_stable ? "USDC" : b.token.slice(0, 6) + "..."}` +
|
|
488
|
+
` ${b.dynamic_weight_pct}%${b.slashed ? " [SLASHED]" : ""}`)
|
|
489
|
+
.join(", ");
|
|
490
|
+
const text = `[GBLIN Treasury State]\n` +
|
|
491
|
+
`NAV: $${data.nav_usd.toFixed(4)} | ETH: $${data.eth_price_usd.toFixed(2)}\n` +
|
|
492
|
+
`Crash Shield: ${data.crash_shield_active ? "🔴 ACTIVE" : "🟢 inactive"}\n` +
|
|
493
|
+
`Slippage buffer: ${data.slippage_buffer_pct}% (${data.slippage_reason})\n` +
|
|
494
|
+
`Basket: ${basketSummary}`;
|
|
495
|
+
return {
|
|
496
|
+
text,
|
|
497
|
+
data,
|
|
498
|
+
values: {
|
|
499
|
+
gblin_nav_usd: data.nav_usd,
|
|
500
|
+
gblin_crash_shield: data.crash_shield_active,
|
|
501
|
+
gblin_slippage_pct: data.slippage_buffer_pct,
|
|
502
|
+
gblin_slippage_reason: data.slippage_reason,
|
|
503
|
+
},
|
|
504
|
+
};
|
|
505
|
+
}
|
|
506
|
+
catch (error) {
|
|
507
|
+
const msg = `[GBLIN] Failed to fetch treasury state: ${error.message}`;
|
|
508
|
+
logger.warn(`[plugin-gblin] Provider error: ${msg}`);
|
|
509
|
+
return {
|
|
510
|
+
text: msg,
|
|
511
|
+
data: { available: false, error: error.message },
|
|
512
|
+
};
|
|
513
|
+
}
|
|
514
|
+
},
|
|
515
|
+
};
|
|
516
|
+
// ─── Plugin export ────────────────────────────────────────────────────────────
|
|
517
|
+
export const gblinPlugin = {
|
|
518
|
+
name: "plugin-gblin",
|
|
519
|
+
description: "GBLIN Protocol treasury management for ElizaOS agents. " +
|
|
520
|
+
"Park idle USDC in a MEV-protected cbBTC/WETH index, JIT-swap back to USDC " +
|
|
521
|
+
"for x402 payments, and monitor treasury health — all on Base mainnet.",
|
|
522
|
+
actions: [
|
|
523
|
+
checkTreasuryHealthAction,
|
|
524
|
+
investIdleUsdcAction,
|
|
525
|
+
rescueUsdcAction,
|
|
526
|
+
],
|
|
527
|
+
providers: [gblinTreasuryProvider],
|
|
528
|
+
};
|
|
529
|
+
export default gblinPlugin;
|
|
530
|
+
export { checkTreasuryHealthAction, investIdleUsdcAction, rescueUsdcAction, gblinTreasuryProvider, };
|
|
531
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAUL,MAAM,GACP,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,kBAAkB,EAClB,kBAAkB,EAClB,mBAAmB,EACnB,IAAI,EACJ,kBAAkB,EAClB,UAAU,GAGX,MAAM,MAAM,CAAC;AACd,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AACnC,OAAO,EAAE,mBAAmB,EAAE,MAAM,eAAe,CAAC;AAEpD,gFAAgF;AAEhF,MAAM,gBAAgB,GAAG,uBAAuB,CAAC;AACjD,MAAM,eAAe,GAAG,iCAAiC,CAAC;AAE1D,MAAM,YAAY,GAAG,4CAAuD,CAAC;AAC7E,MAAM,aAAa,GAAG,CAAC,CAAC;AAExB,mDAAmD;AACnD,MAAM,WAAW,GAAG;IAClB,IAAI,EAAE,UAAU;IAChB,OAAO,EAAE,GAAG;IACZ,OAAO,EAAE,IAAI;IACb,iBAAiB,EAAE,YAAY;CACvB,CAAC;AAEX,MAAM,wBAAwB,GAAG;IAC/B,yBAAyB,EAAE;QACzB,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,SAAS,EAAE;QACjC,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE;QAC/B,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAAS,EAAE;QAClC,EAAE,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,SAAS,EAAE;QACvC,EAAE,IAAI,EAAE,aAAa,EAAE,IAAI,EAAE,SAAS,EAAE;QACxC,EAAE,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,SAA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,kBAAkB,EAAE,IAAI,CAAC,mBAAmB;oBAC5C,kBAAkB,EAAE,IAAI,CAAC,mBAAmB;oBAC5C,qBAAqB,EAAE,IAAI,CAAC,eAAe;iBAC5C;aACF,CAAC;QACJ,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,GAAG,GAAG,2CAA4C,KAAe,CAAC,OAAO,EAAE,CAAC;YAClF,MAAM,CAAC,IAAI,CAAC,kCAAkC,GAAG,EAAE,CAAC,CAAC;YACrD,OAAO;gBACL,IAAI,EAAE,GAAG;gBACT,IAAI,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,KAAK,EAAG,KAAe,CAAC,OAAO,EAAE;aAC5D,CAAC;QACJ,CAAC;IACH,CAAC;CACF,CAAC;AAEF,iFAAiF;AAEjF,MAAM,CAAC,MAAM,WAAW,GAAW;IACjC,IAAI,EAAE,cAAc;IACpB,WAAW,EACT,yDAAyD;QACzD,4EAA4E;QAC5E,uEAAuE;IACzE,OAAO,EAAE;QACP,yBAAyB;QACzB,oBAAoB;QACpB,gBAAgB;KACjB;IACD,SAAS,EAAE,CAAC,qBAAqB,CAAC;CACnC,CAAC;AAEF,eAAe,WAAW,CAAC;AAE3B,OAAO,EACL,yBAAyB,EACzB,oBAAoB,EACpB,gBAAgB,EAChB,qBAAqB,GACtB,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "plugin-gblin",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "ElizaOS plugin — gasless treasury rail for AI agents on Base mainnet. Routes idle USDC into the GBLIN MEV-protected cbBTC/WETH basket and JIT-swaps back to USDC for x402 invoices.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"types": "dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist",
|
|
10
|
+
"images",
|
|
11
|
+
"README.md",
|
|
12
|
+
"LICENSE"
|
|
13
|
+
],
|
|
14
|
+
"scripts": {
|
|
15
|
+
"build": "tsc --noEmit false",
|
|
16
|
+
"dev": "tsc --watch",
|
|
17
|
+
"prepublishOnly": "npm run build"
|
|
18
|
+
},
|
|
19
|
+
"keywords": [
|
|
20
|
+
"elizaos",
|
|
21
|
+
"elizaos-plugin",
|
|
22
|
+
"plugin",
|
|
23
|
+
"gblin",
|
|
24
|
+
"x402",
|
|
25
|
+
"treasury",
|
|
26
|
+
"defi",
|
|
27
|
+
"base-mainnet",
|
|
28
|
+
"ai-agent",
|
|
29
|
+
"jit-swap",
|
|
30
|
+
"mev-protection",
|
|
31
|
+
"usdc",
|
|
32
|
+
"cbbtc",
|
|
33
|
+
"weth"
|
|
34
|
+
],
|
|
35
|
+
"author": "GBLIN Protocol",
|
|
36
|
+
"license": "MIT",
|
|
37
|
+
"homepage": "https://gblin.digital/agents",
|
|
38
|
+
"bugs": {
|
|
39
|
+
"url": "https://github.com/gblinproject/GBLIN-MCP/issues"
|
|
40
|
+
},
|
|
41
|
+
"repository": {
|
|
42
|
+
"type": "git",
|
|
43
|
+
"url": "git+https://github.com/gblinproject/GBLIN-MCP.git"
|
|
44
|
+
},
|
|
45
|
+
"publishConfig": {
|
|
46
|
+
"access": "public"
|
|
47
|
+
},
|
|
48
|
+
"peerDependencies": {
|
|
49
|
+
"@elizaos/core": "^1.0.0"
|
|
50
|
+
},
|
|
51
|
+
"dependencies": {
|
|
52
|
+
"viem": "^2.21.0"
|
|
53
|
+
},
|
|
54
|
+
"devDependencies": {
|
|
55
|
+
"@elizaos/core": "^1.0.0",
|
|
56
|
+
"@types/node": "^20.14.0",
|
|
57
|
+
"typescript": "^5.5.4"
|
|
58
|
+
},
|
|
59
|
+
"engines": {
|
|
60
|
+
"node": ">=20"
|
|
61
|
+
}
|
|
62
|
+
}
|