@cann4n/actions-soroswap 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.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/mockSoroswap.d.ts +12 -0
- package/dist/mockSoroswap.d.ts.map +1 -0
- package/dist/mockSoroswap.js +78 -0
- package/dist/mockSoroswap.js.map +1 -0
- package/dist/soroswapActionProvider.d.ts +87 -0
- package/dist/soroswapActionProvider.d.ts.map +1 -0
- package/dist/soroswapActionProvider.js +120 -0
- package/dist/soroswapActionProvider.js.map +1 -0
- package/dist/soroswapActionProvider.test.d.ts +2 -0
- package/dist/soroswapActionProvider.test.d.ts.map +1 -0
- package/dist/soroswapActionProvider.test.js +64 -0
- package/dist/soroswapActionProvider.test.js.map +1 -0
- package/package.json +43 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC"}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
export declare class MockSoroswap {
|
|
2
|
+
private pools;
|
|
3
|
+
constructor();
|
|
4
|
+
getQuote(tokenIn: string, tokenOut: string, amountIn: bigint): string;
|
|
5
|
+
swap(tokenIn: string, tokenOut: string, amountIn: bigint, minAmountOut?: bigint): string;
|
|
6
|
+
addLiquidity(tokenA: string, tokenB: string, amountA: bigint, amountB: bigint): string;
|
|
7
|
+
removeLiquidity(tokenA: string, tokenB: string, liquidity: bigint): string;
|
|
8
|
+
private getPoolKey;
|
|
9
|
+
private getReserves;
|
|
10
|
+
private calculateOutput;
|
|
11
|
+
}
|
|
12
|
+
//# sourceMappingURL=mockSoroswap.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mockSoroswap.d.ts","sourceRoot":"","sources":["../src/mockSoroswap.ts"],"names":[],"mappings":"AAAA,qBAAa,YAAY;IACvB,OAAO,CAAC,KAAK,CAAkE;;IAO/E,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM;IASrE,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,YAAY,GAAE,MAAW,GAAG,MAAM;IAmB5F,YAAY,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM;IAgBtF,eAAe,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,MAAM;IAY1E,OAAO,CAAC,UAAU;IAIlB,OAAO,CAAC,WAAW;IAKnB,OAAO,CAAC,eAAe;CAMxB"}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
export class MockSoroswap {
|
|
2
|
+
pools = new Map();
|
|
3
|
+
constructor() {
|
|
4
|
+
this.pools.set("USDC/XLM", { reserve0: 10000000000000n, reserve1: 500000000000000n });
|
|
5
|
+
this.pools.set("USDC/EURC", { reserve0: 5000000000000n, reserve1: 4000000000000n });
|
|
6
|
+
}
|
|
7
|
+
getQuote(tokenIn, tokenOut, amountIn) {
|
|
8
|
+
const poolKey = this.getPoolKey(tokenIn, tokenOut);
|
|
9
|
+
const pool = this.pools.get(poolKey);
|
|
10
|
+
if (!pool)
|
|
11
|
+
return `Error: No pool for ${tokenIn}/${tokenOut}`;
|
|
12
|
+
const [reserveIn, reserveOut] = this.getReserves(tokenIn, tokenOut, pool);
|
|
13
|
+
const amountOut = this.calculateOutput(amountIn, reserveIn, reserveOut);
|
|
14
|
+
return `Quote: ${amountIn} ${tokenIn} \u2192 ${amountOut} ${tokenOut} (price: ${Number(amountOut) / Number(amountIn)})`;
|
|
15
|
+
}
|
|
16
|
+
swap(tokenIn, tokenOut, amountIn, minAmountOut = 0n) {
|
|
17
|
+
const poolKey = this.getPoolKey(tokenIn, tokenOut);
|
|
18
|
+
const pool = this.pools.get(poolKey);
|
|
19
|
+
if (!pool)
|
|
20
|
+
return `Error: No pool for ${tokenIn}/${tokenOut}`;
|
|
21
|
+
const [reserveIn, reserveOut] = this.getReserves(tokenIn, tokenOut, pool);
|
|
22
|
+
const amountOut = this.calculateOutput(amountIn, reserveIn, reserveOut);
|
|
23
|
+
if (amountOut < minAmountOut) {
|
|
24
|
+
return `Error: Slippage exceeded. Expected >= ${minAmountOut}, got ${amountOut}`;
|
|
25
|
+
}
|
|
26
|
+
if (tokenIn < tokenOut) {
|
|
27
|
+
pool.reserve0 += amountIn;
|
|
28
|
+
pool.reserve1 -= amountOut;
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
pool.reserve1 += amountIn;
|
|
32
|
+
pool.reserve0 -= amountOut;
|
|
33
|
+
}
|
|
34
|
+
return `Swapped ${amountIn} ${tokenIn} \u2192 ${amountOut} ${tokenOut}. New reserves: ${pool.reserve0}/${pool.reserve1}`;
|
|
35
|
+
}
|
|
36
|
+
addLiquidity(tokenA, tokenB, amountA, amountB) {
|
|
37
|
+
const poolKey = this.getPoolKey(tokenA, tokenB);
|
|
38
|
+
if (!this.pools.has(poolKey)) {
|
|
39
|
+
this.pools.set(poolKey, { reserve0: 0n, reserve1: 0n });
|
|
40
|
+
}
|
|
41
|
+
const pool = this.pools.get(poolKey);
|
|
42
|
+
if (tokenA < tokenB) {
|
|
43
|
+
pool.reserve0 += amountA;
|
|
44
|
+
pool.reserve1 += amountB;
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
pool.reserve1 += amountA;
|
|
48
|
+
pool.reserve0 += amountB;
|
|
49
|
+
}
|
|
50
|
+
return `Added liquidity: ${amountA} ${tokenA} + ${amountB} ${tokenB}`;
|
|
51
|
+
}
|
|
52
|
+
removeLiquidity(tokenA, tokenB, liquidity) {
|
|
53
|
+
const poolKey = this.getPoolKey(tokenA, tokenB);
|
|
54
|
+
const pool = this.pools.get(poolKey);
|
|
55
|
+
if (!pool)
|
|
56
|
+
return `Error: No pool for ${tokenA}/${tokenB}`;
|
|
57
|
+
const ratio = Number(liquidity) / Number(pool.reserve0 + pool.reserve1);
|
|
58
|
+
const amountA = BigInt(Math.floor(Number(pool.reserve0) * ratio));
|
|
59
|
+
const amountB = BigInt(Math.floor(Number(pool.reserve1) * ratio));
|
|
60
|
+
pool.reserve0 -= amountA;
|
|
61
|
+
pool.reserve1 -= amountB;
|
|
62
|
+
return `Removed liquidity: ${amountA} ${tokenA} + ${amountB} ${tokenB}`;
|
|
63
|
+
}
|
|
64
|
+
getPoolKey(a, b) {
|
|
65
|
+
return [a, b].sort().join("/");
|
|
66
|
+
}
|
|
67
|
+
getReserves(a, b, pool) {
|
|
68
|
+
const [token0, token1] = [a, b].sort();
|
|
69
|
+
return token0 === a ? [pool.reserve0, pool.reserve1] : [pool.reserve1, pool.reserve0];
|
|
70
|
+
}
|
|
71
|
+
calculateOutput(amountIn, reserveIn, reserveOut) {
|
|
72
|
+
const amountInWithFee = amountIn * 997n;
|
|
73
|
+
const numerator = amountInWithFee * reserveOut;
|
|
74
|
+
const denominator = reserveIn * 1000n + amountInWithFee;
|
|
75
|
+
return numerator / denominator;
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
//# sourceMappingURL=mockSoroswap.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mockSoroswap.js","sourceRoot":"","sources":["../src/mockSoro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C,CAAC,IAAI,EAAE,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACjC,CAAC;IAEO,WAAW,CAAC,CAAS,EAAE,CAAS,EAAE,IAA4C;QACpF,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC;QACvC,OAAO,MAAM,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,QAAQ,EAAE,IAAI,CAAC,QAAQ,CAAC,CAAC;IACxF,CAAC;IAEO,eAAe,CAAC,QAAgB,EAAE,SAAiB,EAAE,UAAkB;QAC7E,MAAM,eAAe,GAAG,QAAQ,GAAG,IAAI,CAAC;QACxC,MAAM,SAAS,GAAG,eAAe,GAAG,UAAU,CAAC;QAC/C,MAAM,WAAW,GAAG,SAAS,GAAG,KAAK,GAAG,eAAe,CAAC;QACxD,OAAO,SAAS,GAAG,WAAW,CAAC;IACjC,CAAC;CACF"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import type { WalletProvider, StellarNetwork } from "@cann4n/core";
|
|
3
|
+
import { ActionProvider } from "@cann4n/core";
|
|
4
|
+
declare const SwapSchema: z.ZodObject<{
|
|
5
|
+
tokenIn: z.ZodString;
|
|
6
|
+
tokenOut: z.ZodString;
|
|
7
|
+
amountIn: z.ZodString;
|
|
8
|
+
minAmountOut: z.ZodOptional<z.ZodString>;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
tokenIn: string;
|
|
11
|
+
tokenOut: string;
|
|
12
|
+
amountIn: string;
|
|
13
|
+
minAmountOut?: string | undefined;
|
|
14
|
+
}, {
|
|
15
|
+
tokenIn: string;
|
|
16
|
+
tokenOut: string;
|
|
17
|
+
amountIn: string;
|
|
18
|
+
minAmountOut?: string | undefined;
|
|
19
|
+
}>;
|
|
20
|
+
declare const QuoteSchema: z.ZodObject<{
|
|
21
|
+
tokenIn: z.ZodString;
|
|
22
|
+
tokenOut: z.ZodString;
|
|
23
|
+
amountIn: z.ZodString;
|
|
24
|
+
}, "strip", z.ZodTypeAny, {
|
|
25
|
+
tokenIn: string;
|
|
26
|
+
tokenOut: string;
|
|
27
|
+
amountIn: string;
|
|
28
|
+
}, {
|
|
29
|
+
tokenIn: string;
|
|
30
|
+
tokenOut: string;
|
|
31
|
+
amountIn: string;
|
|
32
|
+
}>;
|
|
33
|
+
declare const AddLiquiditySchema: z.ZodObject<{
|
|
34
|
+
tokenA: z.ZodString;
|
|
35
|
+
tokenB: z.ZodString;
|
|
36
|
+
amountADesired: z.ZodString;
|
|
37
|
+
amountBDesired: z.ZodString;
|
|
38
|
+
amountAMin: z.ZodOptional<z.ZodString>;
|
|
39
|
+
amountBMin: z.ZodOptional<z.ZodString>;
|
|
40
|
+
}, "strip", z.ZodTypeAny, {
|
|
41
|
+
tokenA: string;
|
|
42
|
+
tokenB: string;
|
|
43
|
+
amountADesired: string;
|
|
44
|
+
amountBDesired: string;
|
|
45
|
+
amountAMin?: string | undefined;
|
|
46
|
+
amountBMin?: string | undefined;
|
|
47
|
+
}, {
|
|
48
|
+
tokenA: string;
|
|
49
|
+
tokenB: string;
|
|
50
|
+
amountADesired: string;
|
|
51
|
+
amountBDesired: string;
|
|
52
|
+
amountAMin?: string | undefined;
|
|
53
|
+
amountBMin?: string | undefined;
|
|
54
|
+
}>;
|
|
55
|
+
declare const RemoveLiquiditySchema: z.ZodObject<{
|
|
56
|
+
tokenA: z.ZodString;
|
|
57
|
+
tokenB: z.ZodString;
|
|
58
|
+
liquidity: z.ZodString;
|
|
59
|
+
amountAMin: z.ZodOptional<z.ZodString>;
|
|
60
|
+
amountBMin: z.ZodOptional<z.ZodString>;
|
|
61
|
+
}, "strip", z.ZodTypeAny, {
|
|
62
|
+
tokenA: string;
|
|
63
|
+
tokenB: string;
|
|
64
|
+
liquidity: string;
|
|
65
|
+
amountAMin?: string | undefined;
|
|
66
|
+
amountBMin?: string | undefined;
|
|
67
|
+
}, {
|
|
68
|
+
tokenA: string;
|
|
69
|
+
tokenB: string;
|
|
70
|
+
liquidity: string;
|
|
71
|
+
amountAMin?: string | undefined;
|
|
72
|
+
amountBMin?: string | undefined;
|
|
73
|
+
}>;
|
|
74
|
+
export declare class SoroswapProvider extends ActionProvider {
|
|
75
|
+
private pools;
|
|
76
|
+
constructor();
|
|
77
|
+
private getPool;
|
|
78
|
+
swapExactTokensForTokens(_wallet: WalletProvider, args: z.infer<typeof SwapSchema>): Promise<string>;
|
|
79
|
+
getQuote(_wallet: WalletProvider, args: z.infer<typeof QuoteSchema>): Promise<string>;
|
|
80
|
+
addLiquidity(_wallet: WalletProvider, args: z.infer<typeof AddLiquiditySchema>): Promise<string>;
|
|
81
|
+
removeLiquidity(_wallet: WalletProvider, args: z.infer<typeof RemoveLiquiditySchema>): Promise<string>;
|
|
82
|
+
supportsNetwork(network: StellarNetwork): boolean;
|
|
83
|
+
}
|
|
84
|
+
/** Create a Soroswap action provider for DEX swaps and liquidity. */
|
|
85
|
+
export declare const soroswapActions: () => SoroswapProvider;
|
|
86
|
+
export {};
|
|
87
|
+
//# sourceMappingURL=soroswapActionProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"soroswapActionProvider.d.ts","sourceRoot":"","sources":["../src/soroswapActionProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AACnE,OAAO,EAAU,cAAc,EAAE,MAAM,cAAc,CAAC;AAGtD,QAAA,MAAM,UAAU;;;;;;;;;;;;;;;EAKd,CAAC;AAEH,QAAA,MAAM,WAAW;;;;;;;;;;;;EAIf,CAAC;AAEH,QAAA,MAAM,kBAAkB;;;;;;;;;;;;;;;;;;;;;EAOtB,CAAC;AAEH,QAAA,MAAM,qBAAqB;;;;;;;;;;;;;;;;;;EAMzB,CAAC;AAEH,qBAAa,gBAAiB,SAAQ,cAAc;IAClD,OAAO,CAAC,KAAK,CAAwC;;IAMrD,OAAO,CAAC,OAAO;IAgBT,wBAAwB,CAAC,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,UAAU,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;IAgBpG,QAAQ,CAAC,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,WAAW,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;IAYrF,YAAY,CAAC,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,kBAAkB,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;IAiBhG,eAAe,CAAC,OAAO,EAAE,cAAc,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,GAAG,OAAO,CAAC,MAAM,CAAC;IAQ5G,eAAe,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO;CAGlD;AAED,qEAAqE;AACrE,eAAO,MAAM,eAAe,wBAA+B,CAAC"}
|
|
@@ -0,0 +1,120 @@
|
|
|
1
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
2
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
3
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
4
|
+
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
5
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
6
|
+
};
|
|
7
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
|
+
};
|
|
10
|
+
import { z } from "zod";
|
|
11
|
+
import { Action, ActionProvider } from "@cann4n/core";
|
|
12
|
+
import { MockSoroswap } from "./mockSoroswap";
|
|
13
|
+
const SwapSchema = z.object({
|
|
14
|
+
tokenIn: z.string().describe("Input token contract address"),
|
|
15
|
+
tokenOut: z.string().describe("Output token contract address"),
|
|
16
|
+
amountIn: z.string().describe("Input amount (in token base units)"),
|
|
17
|
+
minAmountOut: z.string().optional().describe("Minimum output amount (slippage protection)"),
|
|
18
|
+
});
|
|
19
|
+
const QuoteSchema = z.object({
|
|
20
|
+
tokenIn: z.string().describe("Input token contract address"),
|
|
21
|
+
tokenOut: z.string().describe("Output token contract address"),
|
|
22
|
+
amountIn: z.string().describe("Input amount"),
|
|
23
|
+
});
|
|
24
|
+
const AddLiquiditySchema = z.object({
|
|
25
|
+
tokenA: z.string().describe("First token address"),
|
|
26
|
+
tokenB: z.string().describe("Second token address"),
|
|
27
|
+
amountADesired: z.string().describe("Desired amount of token A"),
|
|
28
|
+
amountBDesired: z.string().describe("Desired amount of token B"),
|
|
29
|
+
amountAMin: z.string().optional().describe("Minimum amount of token A"),
|
|
30
|
+
amountBMin: z.string().optional().describe("Minimum amount of token B"),
|
|
31
|
+
});
|
|
32
|
+
const RemoveLiquiditySchema = z.object({
|
|
33
|
+
tokenA: z.string().describe("First token address"),
|
|
34
|
+
tokenB: z.string().describe("Second token address"),
|
|
35
|
+
liquidity: z.string().describe("LP token amount to burn"),
|
|
36
|
+
amountAMin: z.string().optional().describe("Minimum amount of token A to receive"),
|
|
37
|
+
amountBMin: z.string().optional().describe("Minimum amount of token B to receive"),
|
|
38
|
+
});
|
|
39
|
+
export class SoroswapProvider extends ActionProvider {
|
|
40
|
+
pools = new Map();
|
|
41
|
+
constructor() {
|
|
42
|
+
super("soroswap", []);
|
|
43
|
+
}
|
|
44
|
+
getPool(_tokenA, _tokenB) {
|
|
45
|
+
const key = [_tokenA, _tokenB].sort().join("/");
|
|
46
|
+
if (!this.pools.has(key)) {
|
|
47
|
+
this.pools.set(key, new MockSoroswap());
|
|
48
|
+
}
|
|
49
|
+
return this.pools.get(key);
|
|
50
|
+
}
|
|
51
|
+
async swapExactTokensForTokens(_wallet, args) {
|
|
52
|
+
return this.getPool(args.tokenIn, args.tokenOut).swap(args.tokenIn, args.tokenOut, BigInt(args.amountIn), args.minAmountOut ? BigInt(args.minAmountOut) : 0n);
|
|
53
|
+
}
|
|
54
|
+
async getQuote(_wallet, args) {
|
|
55
|
+
return this.getPool(args.tokenIn, args.tokenOut).getQuote(args.tokenIn, args.tokenOut, BigInt(args.amountIn));
|
|
56
|
+
}
|
|
57
|
+
async addLiquidity(_wallet, args) {
|
|
58
|
+
return this.getPool(args.tokenA, args.tokenB).addLiquidity(args.tokenA, args.tokenB, BigInt(args.amountADesired), BigInt(args.amountBDesired));
|
|
59
|
+
}
|
|
60
|
+
async removeLiquidity(_wallet, args) {
|
|
61
|
+
return this.getPool(args.tokenA, args.tokenB).removeLiquidity(args.tokenA, args.tokenB, BigInt(args.liquidity));
|
|
62
|
+
}
|
|
63
|
+
supportsNetwork(network) {
|
|
64
|
+
return ["testnet", "pubnet"].includes(network.networkId);
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
__decorate([
|
|
68
|
+
Action({
|
|
69
|
+
name: "swap_exact_tokens_for_tokens",
|
|
70
|
+
description: "Swap an exact amount of input tokens for as many output tokens as possible via Soroswap",
|
|
71
|
+
similes: ["swap", "trade", "exchange tokens"],
|
|
72
|
+
schema: SwapSchema,
|
|
73
|
+
returnDirect: true,
|
|
74
|
+
needsWallet: true,
|
|
75
|
+
}),
|
|
76
|
+
__metadata("design:type", Function),
|
|
77
|
+
__metadata("design:paramtypes", [Function, void 0]),
|
|
78
|
+
__metadata("design:returntype", Promise)
|
|
79
|
+
], SoroswapProvider.prototype, "swapExactTokensForTokens", null);
|
|
80
|
+
__decorate([
|
|
81
|
+
Action({
|
|
82
|
+
name: "get_quote",
|
|
83
|
+
description: "Get a price quote for a token swap via Soroswap",
|
|
84
|
+
similes: ["quote", "price", "swap quote"],
|
|
85
|
+
schema: QuoteSchema,
|
|
86
|
+
needsWallet: true,
|
|
87
|
+
}),
|
|
88
|
+
__metadata("design:type", Function),
|
|
89
|
+
__metadata("design:paramtypes", [Function, void 0]),
|
|
90
|
+
__metadata("design:returntype", Promise)
|
|
91
|
+
], SoroswapProvider.prototype, "getQuote", null);
|
|
92
|
+
__decorate([
|
|
93
|
+
Action({
|
|
94
|
+
name: "add_liquidity",
|
|
95
|
+
description: "Add liquidity to a Soroswap pair",
|
|
96
|
+
similes: ["provide liquidity", "add liquidity"],
|
|
97
|
+
schema: AddLiquiditySchema,
|
|
98
|
+
returnDirect: true,
|
|
99
|
+
needsWallet: true,
|
|
100
|
+
}),
|
|
101
|
+
__metadata("design:type", Function),
|
|
102
|
+
__metadata("design:paramtypes", [Function, void 0]),
|
|
103
|
+
__metadata("design:returntype", Promise)
|
|
104
|
+
], SoroswapProvider.prototype, "addLiquidity", null);
|
|
105
|
+
__decorate([
|
|
106
|
+
Action({
|
|
107
|
+
name: "remove_liquidity",
|
|
108
|
+
description: "Remove liquidity from a Soroswap pair",
|
|
109
|
+
similes: ["remove liquidity", "withdraw liquidity"],
|
|
110
|
+
schema: RemoveLiquiditySchema,
|
|
111
|
+
returnDirect: true,
|
|
112
|
+
needsWallet: true,
|
|
113
|
+
}),
|
|
114
|
+
__metadata("design:type", Function),
|
|
115
|
+
__metadata("design:paramtypes", [Function, void 0]),
|
|
116
|
+
__metadata("design:returntype", Promise)
|
|
117
|
+
], SoroswapProvider.prototype, "removeLiquidity", null);
|
|
118
|
+
/** Create a Soroswap action provider for DEX swaps and liquidity. */
|
|
119
|
+
export const soroswapActions = () => new SoroswapProvider();
|
|
120
|
+
//# sourceMappingURL=soroswapActionProvider.js.map
|
|
@@ -0,0 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
1
|
+
{"version":3,"file":"soroswapActionProvider.test.d.ts","sourceRoot":"","sources":["../src/soroswapActionProvider.test.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { describe, it, expect } from "vitest";
|
|
2
|
+
import { MockWalletProvider } from "@cann4n/core";
|
|
3
|
+
import { SoroswapProvider } from "./soroswapActionProvider";
|
|
4
|
+
describe("SoroswapProvider", () => {
|
|
5
|
+
const wallet = new MockWalletProvider();
|
|
6
|
+
const provider = new SoroswapProvider();
|
|
7
|
+
it("should provide soroswap actions", () => {
|
|
8
|
+
const actions = provider.getActions(wallet);
|
|
9
|
+
const names = actions.map((a) => a.name);
|
|
10
|
+
expect(names).toContain("soroswap_swap_exact_tokens_for_tokens");
|
|
11
|
+
expect(names).toContain("soroswap_get_quote");
|
|
12
|
+
expect(names).toContain("soroswap_add_liquidity");
|
|
13
|
+
expect(names).toContain("soroswap_remove_liquidity");
|
|
14
|
+
});
|
|
15
|
+
it("should describe actions for LLM", () => {
|
|
16
|
+
const actions = provider.getActions(wallet);
|
|
17
|
+
const swap = actions.find((a) => a.name === "soroswap_swap_exact_tokens_for_tokens");
|
|
18
|
+
expect(swap.description).toContain("Swap");
|
|
19
|
+
expect(swap.similes.length).toBeGreaterThan(0);
|
|
20
|
+
});
|
|
21
|
+
it("should get swap quote", async () => {
|
|
22
|
+
const actions = provider.getActions(wallet);
|
|
23
|
+
const quote = actions.find((a) => a.name === "soroswap_get_quote");
|
|
24
|
+
const result = await quote.invoke({
|
|
25
|
+
tokenIn: "USDC",
|
|
26
|
+
tokenOut: "XLM",
|
|
27
|
+
amountIn: "1000000",
|
|
28
|
+
});
|
|
29
|
+
expect(result).toContain("Quote:");
|
|
30
|
+
expect(result).toContain("XLM");
|
|
31
|
+
});
|
|
32
|
+
it("should execute swap", async () => {
|
|
33
|
+
const actions = provider.getActions(wallet);
|
|
34
|
+
const swap = actions.find((a) => a.name === "soroswap_swap_exact_tokens_for_tokens");
|
|
35
|
+
const result = await swap.invoke({
|
|
36
|
+
tokenIn: "USDC",
|
|
37
|
+
tokenOut: "XLM",
|
|
38
|
+
amountIn: "1000000",
|
|
39
|
+
});
|
|
40
|
+
expect(result).toContain("Swapped");
|
|
41
|
+
});
|
|
42
|
+
it("should add liquidity", async () => {
|
|
43
|
+
const actions = provider.getActions(wallet);
|
|
44
|
+
const addLiq = actions.find((a) => a.name === "soroswap_add_liquidity");
|
|
45
|
+
const result = await addLiq.invoke({
|
|
46
|
+
tokenA: "USDC",
|
|
47
|
+
tokenB: "EURC",
|
|
48
|
+
amountADesired: "1000000",
|
|
49
|
+
amountBDesired: "900000",
|
|
50
|
+
});
|
|
51
|
+
expect(result).toContain("Added liquidity");
|
|
52
|
+
});
|
|
53
|
+
it("should remove liquidity", async () => {
|
|
54
|
+
const actions = provider.getActions(wallet);
|
|
55
|
+
const removeLiq = actions.find((a) => a.name === "soroswap_remove_liquidity");
|
|
56
|
+
const result = await removeLiq.invoke({
|
|
57
|
+
tokenA: "USDC",
|
|
58
|
+
tokenB: "EURC",
|
|
59
|
+
liquidity: "1000",
|
|
60
|
+
});
|
|
61
|
+
expect(result).toContain("Removed liquidity");
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
//# sourceMappingURL=soroswapActionProvider.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"soroswapActionProvider.test.js","sourceRoot":"","sources":["../src/soroswapActionProvider.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,MAAM,cAAc,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,QAAQ,CAAC,kBAAkB,EAAE,GAAG,EAAE;IAChC,MAAM,MAAM,GAAG,IAAI,kBAAkB,EAAE,CAAC;IACxC,MAAM,QAAQ,GAAG,IAAI,gBAAg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9C,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,yBAAyB,EAAE,KAAK,IAAI,EAAE;QACvC,MAAM,OAAO,GAAG,QAAQ,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;QAC5C,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,IAAI,KAAK,2BAA2B,CAAE,CAAC;QAC/E,MAAM,MAAM,GAAG,MAAM,SAAS,CAAC,MAAM,CAAC;YACpC,MAAM,EAAE,MAAM;YACd,MAAM,EAAE,MAAM;YACd,SAAS,EAAE,MAAM;SAClB,CAAC,CAAC;QACH,MAAM,CAAC,MAAM,CAAC,CAAC,SAAS,CAAC,mBAAmB,CAAC,CAAC;IAChD,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@cann4n/actions-soroswap",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Soroswap DEX swap actions for AgentKit Stellar",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js",
|
|
13
|
+
"default": "./dist/index.js"
|
|
14
|
+
}
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist"
|
|
18
|
+
],
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"@cann4n/core": "^0.1.0",
|
|
21
|
+
"zod": "^3.24.0"
|
|
22
|
+
},
|
|
23
|
+
"devDependencies": {
|
|
24
|
+
"typescript": "^5.7.0",
|
|
25
|
+
"vitest": "^3.0.0"
|
|
26
|
+
},
|
|
27
|
+
"publishConfig": {
|
|
28
|
+
"access": "public"
|
|
29
|
+
},
|
|
30
|
+
"license": "MIT",
|
|
31
|
+
"repository": {
|
|
32
|
+
"type": "git",
|
|
33
|
+
"url": "https://github.com/anomalyco/agentkit-stellar.git",
|
|
34
|
+
"directory": "packages/actions-soroswap"
|
|
35
|
+
},
|
|
36
|
+
"scripts": {
|
|
37
|
+
"build": "tsc",
|
|
38
|
+
"test": "vitest run",
|
|
39
|
+
"lint": "eslint src/",
|
|
40
|
+
"typecheck": "tsc --noEmit",
|
|
41
|
+
"clean": "rm -rf dist"
|
|
42
|
+
}
|
|
43
|
+
}
|