@ael-protocol/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/dist/index.js ADDED
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.CHAIN_IDS = exports.ETH_ADDRESS = exports.BASE_MAINNET = exports.BASE_SEPOLIA = exports.QUOTER_ABI = exports.ERC20_ABI = exports.ROUTER_ABI = exports.IntentStatus = exports.AEL = void 0;
4
+ var ael_1 = require("./ael");
5
+ Object.defineProperty(exports, "AEL", { enumerable: true, get: function () { return ael_1.AEL; } });
6
+ var types_1 = require("./types");
7
+ Object.defineProperty(exports, "IntentStatus", { enumerable: true, get: function () { return types_1.IntentStatus; } });
8
+ var abi_1 = require("./abi");
9
+ Object.defineProperty(exports, "ROUTER_ABI", { enumerable: true, get: function () { return abi_1.ROUTER_ABI; } });
10
+ Object.defineProperty(exports, "ERC20_ABI", { enumerable: true, get: function () { return abi_1.ERC20_ABI; } });
11
+ Object.defineProperty(exports, "QUOTER_ABI", { enumerable: true, get: function () { return abi_1.QUOTER_ABI; } });
12
+ var constants_1 = require("./constants");
13
+ Object.defineProperty(exports, "BASE_SEPOLIA", { enumerable: true, get: function () { return constants_1.BASE_SEPOLIA; } });
14
+ Object.defineProperty(exports, "BASE_MAINNET", { enumerable: true, get: function () { return constants_1.BASE_MAINNET; } });
15
+ Object.defineProperty(exports, "ETH_ADDRESS", { enumerable: true, get: function () { return constants_1.ETH_ADDRESS; } });
16
+ Object.defineProperty(exports, "CHAIN_IDS", { enumerable: true, get: function () { return constants_1.CHAIN_IDS; } });
17
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,6BAA4B;AAAnB,0FAAA,GAAG,OAAA;AACZ,iCAAuC;AAA9B,qGAAA,YAAY,OAAA;AAErB,6BAA0D;AAAjD,iGAAA,UAAU,OAAA;AAAE,gGAAA,SAAS,OAAA;AAAE,iGAAA,UAAU,OAAA;AAC1C,yCAAiF;AAAxE,yGAAA,YAAY,OAAA;AAAE,yGAAA,YAAY,OAAA;AAAE,wGAAA,WAAW,OAAA;AAAE,sGAAA,SAAS,OAAA"}
@@ -0,0 +1,74 @@
1
+ import type { Address, Hash, Chain } from 'viem';
2
+ /**
3
+ * AEL SDK 配置
4
+ */
5
+ export interface AELConfig {
6
+ /** Agent 私钥 */
7
+ privateKey: `0x${string}`;
8
+ /** 链配置 */
9
+ chain: Chain;
10
+ /** Router 合约地址 */
11
+ routerAddress: Address;
12
+ /** RPC URL (可选) */
13
+ rpcUrl?: string;
14
+ }
15
+ /**
16
+ * Swap 参数
17
+ */
18
+ export interface SwapParams {
19
+ /** 输入代币地址 (ETH 用 0x0) */
20
+ tokenIn: Address;
21
+ /** 输出代币地址 */
22
+ tokenOut: Address;
23
+ /** 输入数量 (wei) */
24
+ amountIn: bigint;
25
+ /** 最小输出数量 (wei) */
26
+ minAmountOut: bigint;
27
+ /** 截止时间 (Unix 时间戳) */
28
+ deadline?: bigint;
29
+ }
30
+ /**
31
+ * Swap 结果
32
+ */
33
+ export interface SwapResult {
34
+ /** 意图哈希 */
35
+ intentHash: Hash;
36
+ /** 提交交易哈希 */
37
+ txHash: Hash;
38
+ /** 意图状态 */
39
+ status: IntentStatus;
40
+ }
41
+ /**
42
+ * 意图状态
43
+ */
44
+ export declare enum IntentStatus {
45
+ None = 0,
46
+ Pending = 1,
47
+ Settled = 2,
48
+ Refunded = 3,
49
+ Expired = 4
50
+ }
51
+ /**
52
+ * 报价结果
53
+ */
54
+ export interface QuoteResult {
55
+ /** 预计输出数量 */
56
+ amountOut: bigint;
57
+ /** 价格影响 (基点) */
58
+ priceImpact: number;
59
+ /** 费用 (基点) */
60
+ fee: number;
61
+ }
62
+ /**
63
+ * 意图详情
64
+ */
65
+ export interface IntentDetails {
66
+ agent: Address;
67
+ tokenIn: Address;
68
+ tokenOut: Address;
69
+ amountIn: bigint;
70
+ minAmountOut: bigint;
71
+ deadline: bigint;
72
+ status: IntentStatus;
73
+ }
74
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,KAAK,EAAE,MAAM,MAAM,CAAC;AAEjD;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,eAAe;IACf,UAAU,EAAE,KAAK,MAAM,EAAE,CAAC;IAC1B,UAAU;IACV,KAAK,EAAE,KAAK,CAAC;IACb,kBAAkB;IAClB,aAAa,EAAE,OAAO,CAAC;IACvB,mBAAmB;IACnB,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,yBAAyB;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,aAAa;IACb,QAAQ,EAAE,OAAO,CAAC;IAClB,iBAAiB;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,mBAAmB;IACnB,YAAY,EAAE,MAAM,CAAC;IACrB,sBAAsB;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,WAAW;IACX,UAAU,EAAE,IAAI,CAAC;IACjB,aAAa;IACb,MAAM,EAAE,IAAI,CAAC;IACb,WAAW;IACX,MAAM,EAAE,YAAY,CAAC;CACtB;AAED;;GAEG;AACH,oBAAY,YAAY;IACtB,IAAI,IAAI;IACR,OAAO,IAAI;IACX,OAAO,IAAI;IACX,QAAQ,IAAI;IACZ,OAAO,IAAI;CACZ;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,aAAa;IACb,SAAS,EAAE,MAAM,CAAC;IAClB,gBAAgB;IAChB,WAAW,EAAE,MAAM,CAAC;IACpB,cAAc;IACd,GAAG,EAAE,MAAM,CAAC;CACb;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,KAAK,EAAE,OAAO,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,YAAY,CAAC;CACtB"}
package/dist/types.js ADDED
@@ -0,0 +1,15 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.IntentStatus = void 0;
4
+ /**
5
+ * 意图状态
6
+ */
7
+ var IntentStatus;
8
+ (function (IntentStatus) {
9
+ IntentStatus[IntentStatus["None"] = 0] = "None";
10
+ IntentStatus[IntentStatus["Pending"] = 1] = "Pending";
11
+ IntentStatus[IntentStatus["Settled"] = 2] = "Settled";
12
+ IntentStatus[IntentStatus["Refunded"] = 3] = "Refunded";
13
+ IntentStatus[IntentStatus["Expired"] = 4] = "Expired";
14
+ })(IntentStatus || (exports.IntentStatus = IntentStatus = {}));
15
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";;;AA4CA;;GAEG;AACH,IAAY,YAMX;AAND,WAAY,YAAY;IACtB,+CAAQ,CAAA;IACR,qDAAW,CAAA;IACX,qDAAW,CAAA;IACX,uDAAY,CAAA;IACZ,qDAAW,CAAA;AACb,CAAC,EANW,YAAY,4BAAZ,YAAY,QAMvB"}
package/package.json ADDED
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "@ael-protocol/sdk",
3
+ "version": "0.1.0",
4
+ "description": "AEL SDK - Intent-based trading execution for AI Agents on Base",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "exports": {
8
+ ".": {
9
+ "require": "./dist/index.js",
10
+ "types": "./dist/index.d.ts"
11
+ }
12
+ },
13
+ "files": [
14
+ "dist",
15
+ "README.md"
16
+ ],
17
+ "scripts": {
18
+ "build": "tsc",
19
+ "prepublishOnly": "npm run build",
20
+ "test": "vitest run",
21
+ "test:watch": "vitest"
22
+ },
23
+ "keywords": [
24
+ "ael",
25
+ "ai-agent",
26
+ "intent",
27
+ "trading",
28
+ "base",
29
+ "ethereum",
30
+ "defi",
31
+ "web3"
32
+ ],
33
+ "author": "AEL Protocol",
34
+ "license": "MIT",
35
+ "devDependencies": {
36
+ "@types/node": "^20.14.0",
37
+ "typescript": "^5.4.5",
38
+ "ts-node": "^10.9.2",
39
+ "vitest": "^1.6.0",
40
+ "dotenv": "^16.4.5",
41
+ "viem": "^2.21.0"
42
+ },
43
+ "peerDependencies": {
44
+ "viem": "^2.0.0"
45
+ },
46
+ "engines": {
47
+ "node": ">=18.0.0"
48
+ }
49
+ }