basileus-agentkit-plugin 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.
Files changed (69) hide show
  1. package/.nvmrc +1 -0
  2. package/.prettierrc +7 -0
  3. package/dist/actions/aleph.d.ts +2 -0
  4. package/dist/actions/aleph.js +114 -0
  5. package/dist/actions/aleph.js.map +1 -0
  6. package/dist/actions/compound/compoundActionProvider.d.ts +2 -0
  7. package/dist/actions/compound/compoundActionProvider.js +130 -0
  8. package/dist/actions/compound/compoundActionProvider.js.map +1 -0
  9. package/dist/actions/compound/constants.d.ts +194 -0
  10. package/dist/actions/compound/constants.js +134 -0
  11. package/dist/actions/compound/constants.js.map +1 -0
  12. package/dist/actions/compound/index.d.ts +1 -0
  13. package/dist/actions/compound/index.js +2 -0
  14. package/dist/actions/compound/index.js.map +1 -0
  15. package/dist/actions/compound/schemas.d.ts +42 -0
  16. package/dist/actions/compound/schemas.js +41 -0
  17. package/dist/actions/compound/schemas.js.map +1 -0
  18. package/dist/actions/compound/utils.d.ts +15 -0
  19. package/dist/actions/compound/utils.js +260 -0
  20. package/dist/actions/compound/utils.js.map +1 -0
  21. package/dist/actions/constants.d.ts +69 -0
  22. package/dist/actions/constants.js +50 -0
  23. package/dist/actions/constants.js.map +1 -0
  24. package/dist/actions/index.d.ts +2 -0
  25. package/dist/actions/index.js +3 -0
  26. package/dist/actions/index.js.map +1 -0
  27. package/dist/agent-loop.d.ts +14 -0
  28. package/dist/agent-loop.js +60 -0
  29. package/dist/agent-loop.js.map +1 -0
  30. package/dist/aleph-publisher.d.ts +9 -0
  31. package/dist/aleph-publisher.js +41 -0
  32. package/dist/aleph-publisher.js.map +1 -0
  33. package/dist/index.d.ts +11 -0
  34. package/dist/index.js +9 -0
  35. package/dist/index.js.map +1 -0
  36. package/dist/summarizer.d.ts +3 -0
  37. package/dist/summarizer.js +21 -0
  38. package/dist/summarizer.js.map +1 -0
  39. package/dist/tools.d.ts +6 -0
  40. package/dist/tools.js +30 -0
  41. package/dist/tools.js.map +1 -0
  42. package/dist/types.d.ts +15 -0
  43. package/dist/types.js +2 -0
  44. package/dist/types.js.map +1 -0
  45. package/dist/wallet.d.ts +17520 -0
  46. package/dist/wallet.js +47 -0
  47. package/dist/wallet.js.map +1 -0
  48. package/dist/x402-tracker.d.ts +2 -0
  49. package/dist/x402-tracker.js +39 -0
  50. package/dist/x402-tracker.js.map +1 -0
  51. package/eslint.config.js +26 -0
  52. package/package.json +86 -0
  53. package/src/actions/aleph.ts +145 -0
  54. package/src/actions/compound/compoundActionProvider.ts +166 -0
  55. package/src/actions/compound/constants.ts +140 -0
  56. package/src/actions/compound/index.ts +1 -0
  57. package/src/actions/compound/schemas.ts +45 -0
  58. package/src/actions/compound/utils.ts +367 -0
  59. package/src/actions/constants.ts +53 -0
  60. package/src/actions/index.ts +2 -0
  61. package/src/agent-loop.ts +93 -0
  62. package/src/aleph-publisher.ts +44 -0
  63. package/src/index.ts +11 -0
  64. package/src/summarizer.ts +30 -0
  65. package/src/tools.ts +40 -0
  66. package/src/types.ts +17 -0
  67. package/src/wallet.ts +73 -0
  68. package/src/x402-tracker.ts +43 -0
  69. package/tsconfig.json +15 -0
package/.nvmrc ADDED
@@ -0,0 +1 @@
1
+ v24
package/.prettierrc ADDED
@@ -0,0 +1,7 @@
1
+ {
2
+ "semi": true,
3
+ "singleQuote": false,
4
+ "trailingComma": "all",
5
+ "printWidth": 100,
6
+ "tabWidth": 2
7
+ }
@@ -0,0 +1,2 @@
1
+ import { EvmWalletProvider } from "@coinbase/agentkit";
2
+ export declare function createAlephActionProvider(rpcUrl?: string): import("@coinbase/agentkit").CustomActionProvider<EvmWalletProvider>;
@@ -0,0 +1,114 @@
1
+ import { z } from "zod";
2
+ import { customActionProvider, SuperfluidQueryActionProvider, } from "@coinbase/agentkit";
3
+ import { createPublicClient, formatUnits, http, parseEther, encodeFunctionData } from "viem";
4
+ import { base } from "viem/chains";
5
+ import { ALEPH_ADDRESS, WETH_ADDRESS, UNISWAP_ROUTER, UNISWAP_ALEPH_POOL, uniswapV3PoolAbi, uniswapRouterAbi, } from "./constants.js";
6
+ const balanceOfAbi = [
7
+ {
8
+ inputs: [{ name: "account", type: "address" }],
9
+ name: "balanceOf",
10
+ outputs: [{ name: "", type: "uint256" }],
11
+ stateMutability: "view",
12
+ type: "function",
13
+ },
14
+ ];
15
+ export function createAlephActionProvider(rpcUrl) {
16
+ const publicClient = createPublicClient({
17
+ chain: base,
18
+ transport: http(rpcUrl),
19
+ });
20
+ return customActionProvider([
21
+ {
22
+ name: "get_aleph_info",
23
+ description: "Get your current ALEPH balance, hourly consumption rate, estimated hours of compute left, ETH balance, and ALEPH/ETH price. Use this to decide whether you need to buy more ALEPH.",
24
+ schema: z.object({}),
25
+ invoke: async (walletProvider, _args) => {
26
+ try {
27
+ const address = walletProvider.getAddress();
28
+ const sfQuery = new SuperfluidQueryActionProvider();
29
+ const streamsResult = await sfQuery.queryStreams(walletProvider);
30
+ let alephPerHour = 0;
31
+ try {
32
+ const jsonStr = streamsResult.replace("Current outflows are ", "");
33
+ const outflows = JSON.parse(jsonStr);
34
+ const alephOutflows = outflows.filter((o) => o.token.symbol.toLowerCase().includes("aleph"));
35
+ const totalFlowRate = alephOutflows.reduce((sum, o) => sum + BigInt(o.currentFlowRate), 0n);
36
+ alephPerHour = parseFloat(formatUnits(totalFlowRate * 3600n, 18));
37
+ }
38
+ catch {
39
+ // No outflows or parse error
40
+ }
41
+ const rawBalance = await publicClient.readContract({
42
+ address: ALEPH_ADDRESS,
43
+ abi: balanceOfAbi,
44
+ functionName: "balanceOf",
45
+ args: [address],
46
+ });
47
+ const alephBalance = parseFloat(formatUnits(rawBalance, 18));
48
+ let hoursLeft = 1000000;
49
+ if (alephPerHour > 0) {
50
+ hoursLeft = Math.round(alephBalance / alephPerHour);
51
+ }
52
+ const ethBalanceWei = await publicClient.getBalance({ address });
53
+ const ethBalance = parseFloat(formatUnits(ethBalanceWei, 18));
54
+ const slot0 = await publicClient.readContract({
55
+ address: UNISWAP_ALEPH_POOL,
56
+ abi: uniswapV3PoolAbi,
57
+ functionName: "slot0",
58
+ });
59
+ const sqrtPriceX96 = slot0[0];
60
+ const price = Number(sqrtPriceX96) / 2 ** 96;
61
+ const alephPerEth = price * price;
62
+ return JSON.stringify({
63
+ aleph_balance: Math.round(alephBalance * 1000) / 1000,
64
+ aleph_consumed_per_hour: Math.round(alephPerHour * 1000) / 1000,
65
+ hours_left_until_death: hoursLeft,
66
+ eth_balance: Math.round(ethBalance * 10000) / 10000,
67
+ aleph_per_eth: Math.round(alephPerEth * 100) / 100,
68
+ });
69
+ }
70
+ catch (err) {
71
+ return `Error getting ALEPH info: ${err instanceof Error ? err.message : String(err)}`;
72
+ }
73
+ },
74
+ },
75
+ {
76
+ name: "swap_eth_to_aleph",
77
+ description: "Swap ETH to ALEPH via Uniswap V3 to pay for your computing. Provide the amount of ETH to swap.",
78
+ schema: z.object({
79
+ ethAmount: z.string().describe("Amount of ETH to swap, e.g. '0.01'"),
80
+ }),
81
+ invoke: async (walletProvider, args) => {
82
+ try {
83
+ const amountInWei = parseEther(args.ethAmount);
84
+ const address = walletProvider.getAddress();
85
+ const data = encodeFunctionData({
86
+ abi: uniswapRouterAbi,
87
+ functionName: "exactInputSingle",
88
+ args: [
89
+ {
90
+ tokenIn: WETH_ADDRESS,
91
+ tokenOut: ALEPH_ADDRESS,
92
+ fee: 10000,
93
+ recipient: address,
94
+ amountIn: amountInWei,
95
+ amountOutMinimum: 0n,
96
+ sqrtPriceLimitX96: 0n,
97
+ },
98
+ ],
99
+ });
100
+ const txHash = await walletProvider.sendTransaction({
101
+ to: UNISWAP_ROUTER,
102
+ data,
103
+ value: amountInWei,
104
+ });
105
+ return `Swap transaction sent. Hash: ${txHash}`;
106
+ }
107
+ catch (err) {
108
+ return `Error swapping ETH to ALEPH: ${err instanceof Error ? err.message : String(err)}`;
109
+ }
110
+ },
111
+ },
112
+ ]);
113
+ }
114
+ //# sourceM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AS,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,oCAAoC,CAAC;aACrE,CAAC;YACF,MAAM,EAAE,KAAK,EAAE,cAAiC,EAAE,IAA2B,EAAE,EAAE;gBAC/E,IAAI,CAAC;oBACH,MAAM,WAAW,GAAG,UAAU,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;oBAC/C,MAAM,OAAO,GAAG,cAAc,CAAC,UAAU,EAAmB,CAAC;oBAE7D,MAAM,IAAI,GAAG,kBAAkB,CAAC;wBAC9B,GAAG,EAAE,gBAAgB;wBACrB,YAAY,EAAE,kBAAkB;wBAChC,IAAI,EAAE;4BACJ;gCACE,OAAO,EAAE,YAAY;gCACrB,QAAQ,EAAE,aAAa;gCACvB,GAAG,EAAE,KAAK;gCACV,SAAS,EAAE,OAAO;gCAClB,QAAQ,EAAE,WAAW;gCACrB,gBAAgB,EAAE,EAAE;gCACpB,iBAAiB,EAAE,EAAE;6BACtB;yBACF;qBACF,CAAC,CAAC;oBAEH,MAAM,MAAM,GAAG,MAAM,cAAc,CAAC,eAAe,CAAC;wBAClD,EAAE,EAAE,cAAc;wBAClB,IAAI;wBACJ,KAAK,EAAE,WAAW;qBACnB,CAAC,CAAC;oBAEH,OAAO,gCAAgC,MAAM,EAAE,CAAC;gBAClD,CAAC;gBAAC,OAAO,GAAG,EAAE,CAAC;oBACb,OAAO,gCAAgC,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,CAAC;gBAC5F,CAAC;YACH,CAAC;SACF;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,2 @@
1
+ import { EvmWalletProvider } from "@coinbase/agentkit";
2
+ export declare const compoundFixedProvider: import("@coinbase/agentkit").CustomActionProvider<EvmWalletProvider>;
@@ -0,0 +1,130 @@
1
+ /**
2
+ * Fixed Compound action provider — local copy with base asset fixes.
3
+ *
4
+ * Fixes from upstream @coinbase/agentkit:
5
+ * - get_portfolio: reads base asset supply via Comet.balanceOf() (was missing)
6
+ * - withdraw: for base asset (USDC), checks balanceOf instead of collateralBalanceOf
7
+ *
8
+ * Uses customActionProvider (no decorators) so tsx/esbuild can run it.
9
+ * TODO: Remove this directory once agentkit merges the fix.
10
+ */
11
+ import { encodeFunctionData, formatUnits, parseUnits, erc20Abi } from "viem";
12
+ import { customActionProvider } from "@coinbase/agentkit";
13
+ import { COMET_ABI } from "./constants.js";
14
+ import { CompoundSupplySchema, CompoundWithdrawSchema, CompoundPortfolioSchema, } from "./schemas.js";
15
+ import { getBaseAssetBalance, getCollateralBalance, getHealthRatio, getHealthRatioAfterWithdraw, getTokenBalance, getTokenDecimals, getTokenSymbol, getPortfolioDetailsMarkdown, getCometAddress, getAssetAddress, getBaseTokenAddress, } from "./utils.js";
16
+ async function approve(wallet, tokenAddress, spenderAddress, amount) {
17
+ try {
18
+ const data = encodeFunctionData({
19
+ abi: erc20Abi,
20
+ functionName: "approve",
21
+ args: [spenderAddress, amount],
22
+ });
23
+ const txHash = await wallet.sendTransaction({
24
+ to: tokenAddress,
25
+ data,
26
+ });
27
+ await wallet.waitForTransactionReceipt(txHash);
28
+ return `Successfully approved ${spenderAddress} to spend ${amount} tokens`;
29
+ }
30
+ catch (error) {
31
+ return `Error approving tokens: ${error}`;
32
+ }
33
+ }
34
+ export const compoundFixedProvider = customActionProvider([
35
+ {
36
+ name: "compound_supply",
37
+ description: "Supply assets to Compound. assetId: 'weth', 'cbeth', 'cbbtc', 'wsteth', or 'usdc'. amount: human-readable.",
38
+ schema: CompoundSupplySchema,
39
+ invoke: async (wallet, args) => {
40
+ try {
41
+ const network = wallet.getNetwork();
42
+ const cometAddress = getCometAddress(network);
43
+ const tokenAddress = getAssetAddress(network, args.assetId);
44
+ const decimals = await getTokenDecimals(wallet, tokenAddress);
45
+ const amountAtomic = parseUnits(args.amount, decimals);
46
+ const walletBalance = await getTokenBalance(wallet, tokenAddress);
47
+ if (walletBalance < amountAtomic) {
48
+ const humanBalance = formatUnits(walletBalance, decimals);
49
+ return `Error: Insufficient balance. You have ${humanBalance}, but trying to supply ${args.amount}`;
50
+ }
51
+ const approvalResult = await approve(wallet, tokenAddress, cometAddress, amountAtomic);
52
+ if (approvalResult.startsWith("Error")) {
53
+ return `Error approving token: ${approvalResult}`;
54
+ }
55
+ const data = encodeFunctionData({
56
+ abi: COMET_ABI,
57
+ functionName: "supply",
58
+ args: [tokenAddress, amountAtomic],
59
+ });
60
+ const txHash = await wallet.sendTransaction({ to: cometAddress, data });
61
+ await wallet.waitForTransactionReceipt(txHash);
62
+ const sym = await getTokenSymbol(wallet, tokenAddress);
63
+ return `Supplied ${args.amount} ${sym} to Compound.\nTransaction hash: ${txHash}`;
64
+ }
65
+ catch (err) {
66
+ return `Error supplying to Compound: ${err instanceof Error ? err.message : err}`;
67
+ }
68
+ },
69
+ },
70
+ {
71
+ name: "compound_withdraw",
72
+ description: "Withdraw assets from Compound. assetId: 'weth', 'cbeth', 'cbbtc', 'wsteth', or 'usdc'. amount: human-readable.",
73
+ schema: CompoundWithdrawSchema,
74
+ invoke: async (wallet, args) => {
75
+ try {
76
+ const cometAddress = getCometAddress(wallet.getNetwork());
77
+ const tokenAddress = getAssetAddress(wallet.getNetwork(), args.assetId);
78
+ const decimals = await getTokenDecimals(wallet, tokenAddress);
79
+ const amountAtomic = parseUnits(args.amount, decimals);
80
+ const baseTokenAddress = await getBaseTokenAddress(wallet, cometAddress);
81
+ const isBaseAsset = tokenAddress.toLowerCase() === baseTokenAddress.toLowerCase();
82
+ if (isBaseAsset) {
83
+ const baseBalance = await getBaseAssetBalance(wallet, cometAddress);
84
+ if (amountAtomic > baseBalance) {
85
+ return `Error: Insufficient balance. Trying to withdraw ${args.amount}, but only have ${formatUnits(baseBalance, decimals)} supplied`;
86
+ }
87
+ }
88
+ else {
89
+ const collateralBalance = await getCollateralBalance(wallet, cometAddress, tokenAddress);
90
+ if (amountAtomic > collateralBalance) {
91
+ return `Error: Insufficient balance. Trying to withdraw ${args.amount}, but only have ${formatUnits(collateralBalance, decimals)} supplied`;
92
+ }
93
+ const projectedHealth = await getHealthRatioAfterWithdraw(wallet, cometAddress, tokenAddress, amountAtomic);
94
+ if (projectedHealth.lessThan(1)) {
95
+ return `Error: Withdrawing ${args.amount} would result in unhealthy position. Health ratio would be ${projectedHealth.toFixed(2)}`;
96
+ }
97
+ }
98
+ const data = encodeFunctionData({
99
+ abi: COMET_ABI,
100
+ functionName: "withdraw",
101
+ args: [tokenAddress, amountAtomic],
102
+ });
103
+ const txHash = await wallet.sendTransaction({ to: cometAddress, data });
104
+ await wallet.waitForTransactionReceipt(txHash);
105
+ const sym = await getTokenSymbol(wallet, tokenAddress);
106
+ const health = await getHealthRatio(wallet, cometAddress);
107
+ return `Withdrawn ${args.amount} ${sym} from Compound.\nTransaction hash: ${txHash}\nHealth ratio: ${health.toFixed(2)}`;
108
+ }
109
+ catch (err) {
110
+ return `Error withdrawing from Compound: ${err instanceof Error ? err.message : err}`;
111
+ }
112
+ },
113
+ },
114
+ {
115
+ name: "compound_get_portfolio",
116
+ description: "Get Compound portfolio: base asset supply (earns APY), collateral balances, borrow positions.",
117
+ schema: CompoundPortfolioSchema,
118
+ // NOTE: must have 2 params so customActionProvider passes wallet as first arg
119
+ invoke: async (wallet, _args) => {
120
+ try {
121
+ const cometAddress = getCometAddress(wallet.getNetwork());
122
+ return await getPortfolioDetailsMarkdown(wallet, cometAddress);
123
+ }
124
+ catch (err) {
125
+ return `Error getting portfolio: ${err instanceof Error ? err.message : err}`;
126
+ }
127
+ },
128
+ },
129
+ ]);
130
+ //# sourceMappingURL=compoundActionProvider.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"compoundActionProvider.js","sourceRoot":"","sources":["../../../src/actions/compound/compoundActionProvider.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AACH,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,UAAU,EAAE,QAAQ,EAAE,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AAwB;QAC9B,WAAW,EACT,+FAA+F;QACjG,MAAM,EAAE,uBAAuB;QAC/B,8EAA8E;QAC9E,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE;YAC9B,IAAI,CAAC;gBACH,MAAM,YAAY,GAAG,eAAe,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC,CAAC;gBAC1D,OAAO,MAAM,2BAA2B,CAAC,MAAM,EAAE,YAAY,CAAC,CAAC;YACjE,CAAC;YAAC,OAAO,GAAG,EAAE,CAAC;gBACb,OAAO,4BAA4B,GAAG,YAAY,KAAK,CAAC,CAAC,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;YAChF,CAAC;QACH,CAAC;KACF;CACF,CAAC,CAAC"}
@@ -0,0 +1,194 @@
1
+ import { type Address } from "viem";
2
+ import { erc20Abi as ERC20_ABI } from "viem";
3
+ export declare const SUPPORTED_NETWORKS: string[];
4
+ export declare const COMET_ADDRESSES: Record<string, Address>;
5
+ export declare const ASSET_ADDRESSES: Record<string, Record<string, Address>>;
6
+ export { ERC20_ABI };
7
+ export declare const COMET_ABI: readonly [{
8
+ readonly inputs: readonly [{
9
+ readonly internalType: "address";
10
+ readonly name: "asset";
11
+ readonly type: "address";
12
+ }, {
13
+ readonly internalType: "uint256";
14
+ readonly name: "amount";
15
+ readonly type: "uint256";
16
+ }];
17
+ readonly name: "supply";
18
+ readonly outputs: readonly [];
19
+ readonly stateMutability: "nonpayable";
20
+ readonly type: "function";
21
+ }, {
22
+ readonly inputs: readonly [{
23
+ readonly internalType: "address";
24
+ readonly name: "asset";
25
+ readonly type: "address";
26
+ }, {
27
+ readonly internalType: "uint256";
28
+ readonly name: "amount";
29
+ readonly type: "uint256";
30
+ }];
31
+ readonly name: "withdraw";
32
+ readonly outputs: readonly [];
33
+ readonly stateMutability: "nonpayable";
34
+ readonly type: "function";
35
+ }, {
36
+ readonly inputs: readonly [{
37
+ readonly internalType: "address";
38
+ readonly name: "priceFeed";
39
+ readonly type: "address";
40
+ }];
41
+ readonly name: "getPrice";
42
+ readonly outputs: readonly [{
43
+ readonly internalType: "uint256";
44
+ readonly name: "";
45
+ readonly type: "uint256";
46
+ }];
47
+ readonly stateMutability: "view";
48
+ readonly type: "function";
49
+ }, {
50
+ readonly inputs: readonly [{
51
+ readonly internalType: "address";
52
+ readonly name: "account";
53
+ readonly type: "address";
54
+ }];
55
+ readonly name: "borrowBalanceOf";
56
+ readonly outputs: readonly [{
57
+ readonly internalType: "uint256";
58
+ readonly name: "";
59
+ readonly type: "uint256";
60
+ }];
61
+ readonly stateMutability: "view";
62
+ readonly type: "function";
63
+ }, {
64
+ readonly inputs: readonly [];
65
+ readonly name: "numAssets";
66
+ readonly outputs: readonly [{
67
+ readonly internalType: "uint8";
68
+ readonly name: "";
69
+ readonly type: "uint8";
70
+ }];
71
+ readonly stateMutability: "view";
72
+ readonly type: "function";
73
+ }, {
74
+ readonly inputs: readonly [{
75
+ readonly internalType: "uint8";
76
+ readonly name: "i";
77
+ readonly type: "uint8";
78
+ }];
79
+ readonly name: "getAssetInfo";
80
+ readonly outputs: readonly [{
81
+ readonly components: readonly [{
82
+ readonly internalType: "uint8";
83
+ readonly name: "offset";
84
+ readonly type: "uint8";
85
+ }, {
86
+ readonly internalType: "address";
87
+ readonly name: "asset";
88
+ readonly type: "address";
89
+ }, {
90
+ readonly internalType: "address";
91
+ readonly name: "priceFeed";
92
+ readonly type: "address";
93
+ }, {
94
+ readonly internalType: "uint64";
95
+ readonly name: "scale";
96
+ readonly type: "uint64";
97
+ }, {
98
+ readonly internalType: "uint64";
99
+ readonly name: "borrowCollateralFactor";
100
+ readonly type: "uint64";
101
+ }, {
102
+ readonly internalType: "uint64";
103
+ readonly name: "liquidateCollateralFactor";
104
+ readonly type: "uint64";
105
+ }, {
106
+ readonly internalType: "uint64";
107
+ readonly name: "liquidationFactor";
108
+ readonly type: "uint64";
109
+ }, {
110
+ readonly internalType: "uint128";
111
+ readonly name: "supplyCap";
112
+ readonly type: "uint128";
113
+ }];
114
+ readonly internalType: "struct CometCore.AssetInfo";
115
+ readonly name: "";
116
+ readonly type: "tuple";
117
+ }];
118
+ readonly stateMutability: "view";
119
+ readonly type: "function";
120
+ }, {
121
+ readonly inputs: readonly [];
122
+ readonly name: "baseToken";
123
+ readonly outputs: readonly [{
124
+ readonly internalType: "address";
125
+ readonly name: "";
126
+ readonly type: "address";
127
+ }];
128
+ readonly stateMutability: "view";
129
+ readonly type: "function";
130
+ }, {
131
+ readonly inputs: readonly [];
132
+ readonly name: "baseTokenPriceFeed";
133
+ readonly outputs: readonly [{
134
+ readonly internalType: "address";
135
+ readonly name: "";
136
+ readonly type: "address";
137
+ }];
138
+ readonly stateMutability: "view";
139
+ readonly type: "function";
140
+ }, {
141
+ readonly inputs: readonly [{
142
+ readonly internalType: "address";
143
+ readonly name: "account";
144
+ readonly type: "address";
145
+ }, {
146
+ readonly internalType: "address";
147
+ readonly name: "asset";
148
+ readonly type: "address";
149
+ }];
150
+ readonly name: "collateralBalanceOf";
151
+ readonly outputs: readonly [{
152
+ readonly internalType: "uint128";
153
+ readonly name: "balance";
154
+ readonly type: "uint128";
155
+ }];
156
+ readonly stateMutability: "view";
157
+ readonly type: "function";
158
+ }, {
159
+ readonly inputs: readonly [{
160
+ readonly internalType: "address";
161
+ readonly name: "account";
162
+ readonly type: "address";
163
+ }];
164
+ readonly name: "balanceOf";
165
+ readonly outputs: readonly [{
166
+ readonly internalType: "uint256";
167
+ readonly name: "";
168
+ readonly type: "uint256";
169
+ }];
170
+ readonly stateMutability: "view";
171
+ readonly type: "function";
172
+ }];
173
+ export declare const PRICE_FEED_ABI: readonly [{
174
+ readonly inputs: readonly [];
175
+ readonly name: "latestRoundData";
176
+ readonly outputs: readonly [{
177
+ readonly name: "roundId";
178
+ readonly type: "uint80";
179
+ }, {
180
+ readonly name: "answer";
181
+ readonly type: "int256";
182
+ }, {
183
+ readonly name: "startedAt";
184
+ readonly type: "uint256";
185
+ }, {
186
+ readonly name: "updatedAt";
187
+ readonly type: "uint256";
188
+ }, {
189
+ readonly name: "answeredInRound";
190
+ readonly type: "uint80";
191
+ }];
192
+ readonly stateMutability: "view";
193
+ readonly type: "function";
194
+ }];
@@ -0,0 +1,134 @@
1
+ import { erc20Abi as ERC20_ABI } from "viem";
2
+ export const SUPPORTED_NETWORKS = ["base-mainnet", "base-sepolia"];
3
+ export const COMET_ADDRESSES = {
4
+ "base-mainnet": "0xb125E6687d4313864e53df431d5425969c15Eb2F",
5
+ "base-sepolia": "0x571621Ce60Cebb0c1D442B5afb38B1663C6Bf017",
6
+ };
7
+ export const ASSET_ADDRESSES = {
8
+ "base-mainnet": {
9
+ weth: "0x4200000000000000000000000000000000000006",
10
+ cbeth: "0x2Ae3F1Ec7F1F5012CFEab0185bfc7aa3cf0DEc22",
11
+ cbbtc: "0xcbB7C0000aB88B473b1f5aFd9ef808440eed33Bf",
12
+ wsteth: "0xc1CBa3fCea344f92D9239c08C0568f6F2F0ee452",
13
+ usdc: "0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913",
14
+ },
15
+ "base-sepolia": {
16
+ weth: "0x4200000000000000000000000000000000000006",
17
+ usdc: "0x036CbD53842c5426634e7929541eC2318f3dCF7e",
18
+ wsteth: "0x774eD9EDB0C5202dF9A86183804b5D9E99dC6CA3",
19
+ },
20
+ };
21
+ export { ERC20_ABI };
22
+ export const COMET_ABI = [
23
+ {
24
+ inputs: [
25
+ { internalType: "address", name: "asset", type: "address" },
26
+ { internalType: "uint256", name: "amount", type: "uint256" },
27
+ ],
28
+ name: "supply",
29
+ outputs: [],
30
+ stateMutability: "nonpayable",
31
+ type: "function",
32
+ },
33
+ {
34
+ inputs: [
35
+ { internalType: "address", name: "asset", type: "address" },
36
+ { internalType: "uint256", name: "amount", type: "uint256" },
37
+ ],
38
+ name: "withdraw",
39
+ outputs: [],
40
+ stateMutability: "nonpayable",
41
+ type: "function",
42
+ },
43
+ {
44
+ inputs: [{ internalType: "address", name: "priceFeed", type: "address" }],
45
+ name: "getPrice",
46
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
47
+ stateMutability: "view",
48
+ type: "function",
49
+ },
50
+ {
51
+ inputs: [{ internalType: "address", name: "account", type: "address" }],
52
+ name: "borrowBalanceOf",
53
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
54
+ stateMutability: "view",
55
+ type: "function",
56
+ },
57
+ {
58
+ inputs: [],
59
+ name: "numAssets",
60
+ outputs: [{ internalType: "uint8", name: "", type: "uint8" }],
61
+ stateMutability: "view",
62
+ type: "function",
63
+ },
64
+ {
65
+ inputs: [{ internalType: "uint8", name: "i", type: "uint8" }],
66
+ name: "getAssetInfo",
67
+ outputs: [
68
+ {
69
+ components: [
70
+ { internalType: "uint8", name: "offset", type: "uint8" },
71
+ { internalType: "address", name: "asset", type: "address" },
72
+ { internalType: "address", name: "priceFeed", type: "address" },
73
+ { internalType: "uint64", name: "scale", type: "uint64" },
74
+ { internalType: "uint64", name: "borrowCollateralFactor", type: "uint64" },
75
+ { internalType: "uint64", name: "liquidateCollateralFactor", type: "uint64" },
76
+ { internalType: "uint64", name: "liquidationFactor", type: "uint64" },
77
+ { internalType: "uint128", name: "supplyCap", type: "uint128" },
78
+ ],
79
+ internalType: "struct CometCore.AssetInfo",
80
+ name: "",
81
+ type: "tuple",
82
+ },
83
+ ],
84
+ stateMutability: "view",
85
+ type: "function",
86
+ },
87
+ {
88
+ inputs: [],
89
+ name: "baseToken",
90
+ outputs: [{ internalType: "address", name: "", type: "address" }],
91
+ stateMutability: "view",
92
+ type: "function",
93
+ },
94
+ {
95
+ inputs: [],
96
+ name: "baseTokenPriceFeed",
97
+ outputs: [{ internalType: "address", name: "", type: "address" }],
98
+ stateMutability: "view",
99
+ type: "function",
100
+ },
101
+ {
102
+ inputs: [
103
+ { internalType: "address", name: "account", type: "address" },
104
+ { internalType: "address", name: "asset", type: "address" },
105
+ ],
106
+ name: "collateralBalanceOf",
107
+ outputs: [{ internalType: "uint128", name: "balance", type: "uint128" }],
108
+ stateMutability: "view",
109
+ type: "function",
110
+ },
111
+ {
112
+ inputs: [{ internalType: "address", name: "account", type: "address" }],
113
+ name: "balanceOf",
114
+ outputs: [{ internalType: "uint256", name: "", type: "uint256" }],
115
+ stateMutability: "view",
116
+ type: "function",
117
+ },
118
+ ];
119
+ export const PRICE_FEED_ABI = [
120
+ {
121
+ inputs: [],
122
+ name: "latestRoundData",
123
+ outputs: [
124
+ { name: "roundId", type: "uint80" },
125
+ { name: "answer", type: "int256" },
126
+ { name: "startedAt", type: "uint256" },
127
+ { name: "updatedAt", type: "uint256" },
128
+ { name: "answeredInRound", type: "uint80" },
129
+ ],
130
+ stateMutability: "view",
131
+ type: "function",
132
+ },
133
+ ];
134
+ //# sourceMappingURL=constants.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../../src/actions/compound/constants.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,IAAI,SAAS,EAAE,MAAM,MAAM,CAAC;AAE7C,MAAM,CAAC,MAAM,kBAAkB,GAAG,CAAC,cAAc,EAAE,cAAc,CAAC,CAAC;AAEnE,MAAM,CAAC,MAAM,eAAe,GAA4B;IACtD,cAAc,EAAE,4CAA4C;IAC5D,cAAc,EAAE,4CAA4C;CAC7D,CAAC;AAEF,MAAM,CAAC,MAAM,eAAe,GAA4C;IACtE,cAAc,EAAE;QACd,IAAI,EAAE,4CAA4C;QAClD,KAAK,EAAE,4CAA4C;QACnD,KAAK,EAAE,4CAA4C;QACnD,MAAM,EAAE,4CAA4C;QACpD,IAAI,EAAE,4CAA4C;KACnD;IACD,cAAc,EAAE;QACd,IAAI,EAAE,4CAA4C;QAClD,IAAI,EAAE,4CAA4C;QAClD,MAAM,EAAE,4CAA4C;KACrD;CACF,CAAC;AAEF,OAAO,EAAE,SAAS,EAAE,CAAC;AAErB,MAAM,CAAC,MAAM,SAAS,GAAG;IACvB;QACE,MAAM,EAA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I,EAAE,QAAQ,EAAE;YACnC,EAAE,IAAI,EAAE,QAAQ,EAAE,IAAI,EAAE,QAAQ,EAAE;YAClC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE;YACtC,EAAE,IAAI,EAAE,WAAW,EAAE,IAAI,EAAE,SAAS,EAAE;YACtC,EAAE,IAAI,EAAE,iBAAiB,EAAE,IAAI,EAAE,QAAQ,EAAE;SAC5C;QACD,eAAe,EAAE,MAAM;QACvB,IAAI,EAAE,UAAU;KACjB;CACO,CAAC"}
@@ -0,0 +1 @@
1
+ export { compoundFixedProvider } from "./compoundActionProvider.js";
@@ -0,0 +1,2 @@
1
+ export { compoundFixedProvider } from "./compoundActionProvider.js";
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/actions/compound/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,6BAA6B,CAAC"}