claude-sdk 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 ADDED
@@ -0,0 +1,6 @@
1
+ # ClaudeLiquidity SDK
2
+
3
+ ## Install
4
+ ```bash
5
+ npm i @claudeliquidity-sdk/sdk
6
+
@@ -0,0 +1,11 @@
1
+ import type { AgentDecision } from "./types.js";
2
+ export type ClaudeAgentOptions = {
3
+ model?: string;
4
+ apiKey: string;
5
+ };
6
+ export declare class ClaudeAgent {
7
+ private readonly opts;
8
+ constructor(opts: ClaudeAgentOptions);
9
+ decide(_prompt: string): Promise<AgentDecision>;
10
+ }
11
+ //# sourceMappingURL=claude.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"claude.d.ts","sourceRoot":"","sources":["../../src/agent/claude.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAEhD,MAAM,MAAM,kBAAkB,GAAG;IAC/B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,qBAAa,WAAW;IACV,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAAJ,IAAI,EAAE,kBAAkB;IAE/C,MAAM,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,aAAa,CAAC;CAMtD"}
@@ -0,0 +1,12 @@
1
+ export type AgentAction = {
2
+ type: "getBalance";
3
+ } | {
4
+ type: "transferSol";
5
+ to: string;
6
+ lamports: number;
7
+ };
8
+ export type AgentDecision = {
9
+ reason: string;
10
+ actions: AgentAction[];
11
+ };
12
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/agent/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,WAAW,GACnB;IAAE,IAAI,EAAE,YAAY,CAAA;CAAE,GACtB;IAAE,IAAI,EAAE,aAAa,CAAC;IAAC,EAAE,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC;AAE1D,MAAM,MAAM,aAAa,GAAG;IAC1B,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,WAAW,EAAE,CAAC;CACxB,CAAC"}
package/dist/index.cjs ADDED
@@ -0,0 +1,87 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __export = (target, all) => {
9
+ for (var name in all)
10
+ __defProp(target, name, { get: all[name], enumerable: true });
11
+ };
12
+ var __copyProps = (to, from, except, desc) => {
13
+ if (from && typeof from === "object" || typeof from === "function") {
14
+ for (let key of __getOwnPropNames(from))
15
+ if (!__hasOwnProp.call(to, key) && key !== except)
16
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
21
+ // If the importer is in node compatibility mode or this is not an ESM
22
+ // file that has been converted to a CommonJS file using a Babel-
23
+ // compatible transform (i.e. "__esModule" has not been set), then set
24
+ // "default" to the CommonJS "module.exports" for node compatibility.
25
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
26
+ mod
27
+ ));
28
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
29
+
30
+ // src/index.ts
31
+ var index_exports = {};
32
+ __export(index_exports, {
33
+ ClaudeAgent: () => ClaudeAgent,
34
+ getBalanceLamports: () => getBalanceLamports,
35
+ keypairFromSource: () => keypairFromSource,
36
+ transferSol: () => transferSol
37
+ });
38
+ module.exports = __toCommonJS(index_exports);
39
+
40
+ // src/solana/wallet.ts
41
+ var import_web3 = require("@solana/web3.js");
42
+ var import_bs58 = __toESM(require("bs58"), 1);
43
+ function keypairFromSource(src) {
44
+ if (src.kind === "secretKeyBase58") {
45
+ const bytes = import_bs58.default.decode(src.secretKeyBase58);
46
+ return import_web3.Keypair.fromSecretKey(bytes);
47
+ }
48
+ return import_web3.Keypair.fromSecretKey(Uint8Array.from(src.secretKeyJson));
49
+ }
50
+
51
+ // src/solana/tx.ts
52
+ var import_web32 = require("@solana/web3.js");
53
+ async function getBalanceLamports(conn, pubkey) {
54
+ return await conn.getBalance(pubkey);
55
+ }
56
+ async function transferSol(conn, payer, to, lamports) {
57
+ const tx = new import_web32.Transaction().add(
58
+ import_web32.SystemProgram.transfer({
59
+ fromPubkey: payer.publicKey,
60
+ toPubkey: to,
61
+ lamports
62
+ })
63
+ );
64
+ const sig = await (0, import_web32.sendAndConfirmTransaction)(conn, tx, [payer]);
65
+ return sig;
66
+ }
67
+
68
+ // src/agent/claude.ts
69
+ var ClaudeAgent = class {
70
+ constructor(opts) {
71
+ this.opts = opts;
72
+ }
73
+ async decide(_prompt) {
74
+ return {
75
+ reason: "stub",
76
+ actions: [{ type: "getBalance" }]
77
+ };
78
+ }
79
+ };
80
+ // Annotate the CommonJS export names for ESM import in node:
81
+ 0 && (module.exports = {
82
+ ClaudeAgent,
83
+ getBalanceLamports,
84
+ keypairFromSource,
85
+ transferSol
86
+ });
87
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/solana/wallet.ts","../src/solana/tx.ts","../src/agent/claude.ts"],"sourcesContent":["export * from \"./solana/types.js\";\nexport { keypairFromSource } from \"./solana/wallet.js\";\nexport { getBalanceLamports, transferSol } from \"./solana/tx.js\";\n\nexport * from \"./agent/types.js\";\nexport { ClaudeAgent } from \"./agent/claude.js\";\n","import { Keypair } from \"@solana/web3.js\";\nimport bs58 from \"bs58\";\nimport type { WalletSource } from \"./types.js\";\n\nexport function keypairFromSource(src: WalletSource): Keypair {\n if (src.kind === \"secretKeyBase58\") {\n const bytes = bs58.decode(src.secretKeyBase58);\n return Keypair.fromSecretKey(bytes);\n }\n return Keypair.fromSecretKey(Uint8Array.from(src.secretKeyJson));\n}\n","import {\n Connection,\n PublicKey,\n SystemProgram,\n Transaction,\n sendAndConfirmTransaction,\n Keypair,\n} from \"@solana/web3.js\";\n\nexport async function getBalanceLamports(conn: Connection, pubkey: PublicKey) {\n return await conn.getBalance(pubkey);\n}\n\nexport async function transferSol(\n conn: Connection,\n payer: Keypair,\n to: PublicKey,\n lamports: number\n) {\n const tx = new Transaction().add(\n SystemProgram.transfer({\n fromPubkey: payer.publicKey,\n toPubkey: to,\n lamports,\n })\n );\n\n const sig = await sendAndConfirmTransaction(conn, tx, [payer]);\n return sig;\n}\n","import type { AgentDecision } from \"./types.js\";\n\nexport type ClaudeAgentOptions = {\n model?: string;\n apiKey: string;\n};\n\nexport class ClaudeAgent {\n constructor(private readonly opts: ClaudeAgentOptions) {}\n\n async decide(_prompt: string): Promise<AgentDecision> {\n return {\n reason: \"stub\",\n actions: [{ type: \"getBalance\" }],\n };\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,kBAAwB;AACxB,kBAAiB;AAGV,SAAS,kBAAkB,KAA4B;AAC5D,MAAI,IAAI,SAAS,mBAAmB;AAClC,UAAM,QAAQ,YAAAA,QAAK,OAAO,IAAI,eAAe;AAC7C,WAAO,oBAAQ,cAAc,KAAK;AAAA,EACpC;AACA,SAAO,oBAAQ,cAAc,WAAW,KAAK,IAAI,aAAa,CAAC;AACjE;;;ACVA,IAAAC,eAOO;AAEP,eAAsB,mBAAmB,MAAkB,QAAmB;AAC5E,SAAO,MAAM,KAAK,WAAW,MAAM;AACrC;AAEA,eAAsB,YACpB,MACA,OACA,IACA,UACA;AACA,QAAM,KAAK,IAAI,yBAAY,EAAE;AAAA,IAC3B,2BAAc,SAAS;AAAA,MACrB,YAAY,MAAM;AAAA,MAClB,UAAU;AAAA,MACV;AAAA,IACF,CAAC;AAAA,EACH;AAEA,QAAM,MAAM,UAAM,wCAA0B,MAAM,IAAI,CAAC,KAAK,CAAC;AAC7D,SAAO;AACT;;;ACtBO,IAAM,cAAN,MAAkB;AAAA,EACvB,YAA6B,MAA0B;AAA1B;AAAA,EAA2B;AAAA,EAExD,MAAM,OAAO,SAAyC;AACpD,WAAO;AAAA,MACL,QAAQ;AAAA,MACR,SAAS,CAAC,EAAE,MAAM,aAAa,CAAC;AAAA,IAClC;AAAA,EACF;AACF;","names":["bs58","import_web3"]}
@@ -0,0 +1,6 @@
1
+ export * from "./solana/types.js";
2
+ export { keypairFromSource } from "./solana/wallet.js";
3
+ export { getBalanceLamports, transferSol } from "./solana/tx.js";
4
+ export * from "./agent/types.js";
5
+ export { ClaudeAgent } from "./agent/claude.js";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,mBAAmB,CAAC;AAClC,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AACvD,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAEjE,cAAc,kBAAkB,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC"}
package/dist/index.js ADDED
@@ -0,0 +1,51 @@
1
+ // src/solana/wallet.ts
2
+ import { Keypair } from "@solana/web3.js";
3
+ import bs58 from "bs58";
4
+ function keypairFromSource(src) {
5
+ if (src.kind === "secretKeyBase58") {
6
+ const bytes = bs58.decode(src.secretKeyBase58);
7
+ return Keypair.fromSecretKey(bytes);
8
+ }
9
+ return Keypair.fromSecretKey(Uint8Array.from(src.secretKeyJson));
10
+ }
11
+
12
+ // src/solana/tx.ts
13
+ import {
14
+ SystemProgram,
15
+ Transaction,
16
+ sendAndConfirmTransaction
17
+ } from "@solana/web3.js";
18
+ async function getBalanceLamports(conn, pubkey) {
19
+ return await conn.getBalance(pubkey);
20
+ }
21
+ async function transferSol(conn, payer, to, lamports) {
22
+ const tx = new Transaction().add(
23
+ SystemProgram.transfer({
24
+ fromPubkey: payer.publicKey,
25
+ toPubkey: to,
26
+ lamports
27
+ })
28
+ );
29
+ const sig = await sendAndConfirmTransaction(conn, tx, [payer]);
30
+ return sig;
31
+ }
32
+
33
+ // src/agent/claude.ts
34
+ var ClaudeAgent = class {
35
+ constructor(opts) {
36
+ this.opts = opts;
37
+ }
38
+ async decide(_prompt) {
39
+ return {
40
+ reason: "stub",
41
+ actions: [{ type: "getBalance" }]
42
+ };
43
+ }
44
+ };
45
+ export {
46
+ ClaudeAgent,
47
+ getBalanceLamports,
48
+ keypairFromSource,
49
+ transferSol
50
+ };
51
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/solana/wallet.ts","../src/solana/tx.ts","../src/agent/claude.ts"],"sourcesContent":["import { Keypair } from \"@solana/web3.js\";\nimport bs58 from \"bs58\";\nimport type { WalletSource } from \"./types.js\";\n\nexport function keypairFromSource(src: WalletSource): Keypair {\n if (src.kind === \"secretKeyBase58\") {\n const bytes = bs58.decode(src.secretKeyBase58);\n return Keypair.fromSecretKey(bytes);\n }\n return Keypair.fromSecretKey(Uint8Array.from(src.secretKeyJson));\n}\n","import {\n Connection,\n PublicKey,\n SystemProgram,\n Transaction,\n sendAndConfirmTransaction,\n Keypair,\n} from \"@solana/web3.js\";\n\nexport async function getBalanceLamports(conn: Connection, pubkey: PublicKey) {\n return await conn.getBalance(pubkey);\n}\n\nexport async function transferSol(\n conn: Connection,\n payer: Keypair,\n to: PublicKey,\n lamports: number\n) {\n const tx = new Transaction().add(\n SystemProgram.transfer({\n fromPubkey: payer.publicKey,\n toPubkey: to,\n lamports,\n })\n );\n\n const sig = await sendAndConfirmTransaction(conn, tx, [payer]);\n return sig;\n}\n","import type { AgentDecision } from \"./types.js\";\n\nexport type ClaudeAgentOptions = {\n model?: string;\n apiKey: string;\n};\n\nexport class ClaudeAgent {\n constructor(private readonly opts: ClaudeAgentOptions) {}\n\n async decide(_prompt: string): Promise<AgentDecision> {\n return {\n reason: \"stub\",\n actions: [{ type: \"getBalance\" }],\n };\n }\n}\n"],"mappings":";AAAA,SAAS,eAAe;AACxB,OAAO,UAAU;AAGV,SAAS,kBAAkB,KAA4B;AAC5D,MAAI,IAAI,SAAS,mBAAmB;AAClC,UAAM,QAAQ,KAAK,OAAO,IAAI,eAAe;AAC7C,WAAO,QAAQ,cAAc,KAAK;AAAA,EACpC;AACA,SAAO,QAAQ,cAAc,WAAW,KAAK,IAAI,aAAa,CAAC;AACjE;;;ACVA;AAAA,EAGE;AAAA,EACA;AAAA,EACA;AAAA,OAEK;AAEP,eAAsB,mBAAmB,MAAkB,QAAmB;AAC5E,SAAO,MAAM,KAAK,WAAW,MAAM;AACrC;AAEA,eAAsB,YACpB,MACA,OACA,IACA,UACA;AACA,QAAM,KAAK,IAAI,YAAY,EAAE;AAAA,IAC3B,cAAc,SAAS;AAAA,MACrB,YAAY,MAAM;AAAA,MAClB,UAAU;AAAA,MACV;AAAA,IACF,CAAC;AAAA,EACH;AAEA,QAAM,MAAM,MAAM,0BAA0B,MAAM,IAAI,CAAC,KAAK,CAAC;AAC7D,SAAO;AACT;;;ACtBO,IAAM,cAAN,MAAkB;AAAA,EACvB,YAA6B,MAA0B;AAA1B;AAAA,EAA2B;AAAA,EAExD,MAAM,OAAO,SAAyC;AACpD,WAAO;AAAA,MACL,QAAQ;AAAA,MACR,SAAS,CAAC,EAAE,MAAM,aAAa,CAAC;AAAA,IAClC;AAAA,EACF;AACF;","names":[]}
@@ -0,0 +1,4 @@
1
+ import { Connection, PublicKey, Keypair } from "@solana/web3.js";
2
+ export declare function getBalanceLamports(conn: Connection, pubkey: PublicKey): Promise<number>;
3
+ export declare function transferSol(conn: Connection, payer: Keypair, to: PublicKey, lamports: number): Promise<string>;
4
+ //# sourceMappingURL=tx.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"tx.d.ts","sourceRoot":"","sources":["../../src/solana/tx.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,SAAS,EAIT,OAAO,EACR,MAAM,iBAAiB,CAAC;AAEzB,wBAAsB,kBAAkB,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,EAAE,SAAS,mBAE3E;AAED,wBAAsB,WAAW,CAC/B,IAAI,EAAE,UAAU,EAChB,KAAK,EAAE,OAAO,EACd,EAAE,EAAE,SAAS,EACb,QAAQ,EAAE,MAAM,mBAYjB"}
@@ -0,0 +1,13 @@
1
+ import type { Commitment } from "@solana/web3.js";
2
+ export type SolanaClientOptions = {
3
+ rpcUrl: string;
4
+ commitment?: Commitment;
5
+ };
6
+ export type WalletSource = {
7
+ kind: "secretKeyBase58";
8
+ secretKeyBase58: string;
9
+ } | {
10
+ kind: "secretKeyJson";
11
+ secretKeyJson: number[];
12
+ };
13
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/solana/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAElD,MAAM,MAAM,mBAAmB,GAAG;IAChC,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,CAAC,EAAE,UAAU,CAAC;CACzB,CAAC;AAEF,MAAM,MAAM,YAAY,GACpB;IAAE,IAAI,EAAE,iBAAiB,CAAC;IAAC,eAAe,EAAE,MAAM,CAAA;CAAE,GACpD;IAAE,IAAI,EAAE,eAAe,CAAC;IAAC,aAAa,EAAE,MAAM,EAAE,CAAA;CAAE,CAAC"}
@@ -0,0 +1,4 @@
1
+ import { Keypair } from "@solana/web3.js";
2
+ import type { WalletSource } from "./types.js";
3
+ export declare function keypairFromSource(src: WalletSource): Keypair;
4
+ //# sourceMappingURL=wallet.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"wallet.d.ts","sourceRoot":"","sources":["../../src/solana/wallet.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE1C,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,YAAY,GAAG,OAAO,CAM5D"}
package/package.json ADDED
@@ -0,0 +1,38 @@
1
+ {
2
+ "name": "claude-sdk",
3
+ "version": "0.1.0",
4
+ "description": "Claude SDK: manage Solana wallets with an AI agent",
5
+ "license": "MIT",
6
+ "type": "module",
7
+ "main": "./dist/index.cjs",
8
+ "module": "./dist/index.js",
9
+ "types": "./dist/index.d.ts",
10
+ "exports": {
11
+ ".": {
12
+ "types": "./dist/index.d.ts",
13
+ "import": "./dist/index.js",
14
+ "require": "./dist/index.cjs"
15
+ }
16
+ },
17
+ "files": [
18
+ "dist",
19
+ "README.md",
20
+ "LICENSE"
21
+ ],
22
+ "sideEffects": false,
23
+ "scripts": {
24
+ "build": "tsup src/index.ts --format esm,cjs --sourcemap --clean && tsc -p tsconfig.json --emitDeclarationOnly --outDir dist",
25
+ "prepack": "npm run build"
26
+ },
27
+ "devDependencies": {
28
+ "tsup": "^8.0.2",
29
+ "typescript": "^5.4.0"
30
+ },
31
+ "publishConfig": {
32
+ "access": "public"
33
+ },
34
+ "dependencies": {
35
+ "@solana/web3.js": "^1.98.4",
36
+ "bs58": "^6.0.0"
37
+ }
38
+ }