@coinbase/agentkit 0.1.1 → 0.2.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 +338 -5
- package/dist/action-providers/alchemy/alchemyTokenPricesActionProvider.d.ts +55 -0
- package/dist/action-providers/alchemy/alchemyTokenPricesActionProvider.js +173 -0
- package/dist/action-providers/alchemy/alchemyTokenPricesActionProvider.test.d.ts +1 -0
- package/dist/action-providers/alchemy/alchemyTokenPricesActionProvider.test.js +131 -0
- package/dist/action-providers/alchemy/index.d.ts +2 -0
- package/dist/action-providers/alchemy/index.js +18 -0
- package/dist/action-providers/alchemy/schemas.d.ts +41 -0
- package/dist/action-providers/alchemy/schemas.js +34 -0
- package/dist/action-providers/basename/basenameActionProvider.d.ts +1 -1
- package/dist/action-providers/cdp/cdpApiActionProvider.js +7 -1
- package/dist/action-providers/erc20/erc20ActionProvider.d.ts +1 -1
- package/dist/action-providers/erc20/schemas.d.ts +2 -2
- package/dist/action-providers/erc721/erc721ActionProvider.d.ts +1 -1
- package/dist/action-providers/index.d.ts +8 -5
- package/dist/action-providers/index.js +8 -5
- package/dist/action-providers/moonwell/constants.d.ts +78 -0
- package/dist/action-providers/moonwell/constants.js +111 -0
- package/dist/action-providers/moonwell/index.d.ts +1 -0
- package/dist/action-providers/moonwell/index.js +5 -0
- package/dist/action-providers/moonwell/moonwellActionProvider.d.ts +39 -0
- package/dist/action-providers/moonwell/moonwellActionProvider.js +249 -0
- package/dist/action-providers/moonwell/moonwellActionProvider.test.d.ts +1 -0
- package/dist/action-providers/moonwell/moonwellActionProvider.test.js +455 -0
- package/dist/action-providers/moonwell/schemas.d.ts +30 -0
- package/dist/action-providers/moonwell/schemas.js +39 -0
- package/dist/action-providers/morpho/morphoActionProvider.d.ts +1 -1
- package/dist/action-providers/morpho/schemas.d.ts +4 -4
- package/dist/action-providers/pyth/pythActionProvider.test.d.ts +1 -0
- package/dist/action-providers/pyth/pythActionProvider.test.js +113 -0
- package/dist/action-providers/spl/index.d.ts +1 -0
- package/dist/action-providers/spl/index.js +17 -0
- package/dist/action-providers/spl/schemas.d.ts +17 -0
- package/dist/action-providers/spl/schemas.js +14 -0
- package/dist/action-providers/spl/splActionProvider.d.ts +37 -0
- package/dist/action-providers/spl/splActionProvider.js +112 -0
- package/dist/action-providers/spl/splActionProvider.test.d.ts +1 -0
- package/dist/action-providers/spl/splActionProvider.test.js +206 -0
- package/dist/action-providers/wallet/walletActionProvider.d.ts +1 -1
- package/dist/action-providers/wallet/walletActionProvider.js +31 -18
- package/dist/action-providers/wallet/walletActionProvider.test.js +101 -23
- package/dist/action-providers/weth/wethActionProvider.d.ts +1 -1
- package/dist/action-providers/wow/wowActionProvider.d.ts +1 -1
- package/dist/network/index.d.ts +2 -1
- package/dist/network/index.js +2 -1
- package/dist/network/network.d.ts +7 -0
- package/dist/network/network.js +46 -1
- package/dist/network/svm.d.ts +14 -0
- package/dist/network/svm.js +33 -0
- package/dist/utils.d.ts +11 -0
- package/dist/utils.js +14 -0
- package/dist/wallet-providers/cdpWalletProvider.d.ts +13 -0
- package/dist/wallet-providers/cdpWalletProvider.js +31 -8
- package/dist/wallet-providers/index.d.ts +3 -0
- package/dist/wallet-providers/index.js +3 -0
- package/dist/wallet-providers/privyWalletProvider.d.ts +70 -0
- package/dist/wallet-providers/privyWalletProvider.js +139 -0
- package/dist/wallet-providers/solanaKeypairWalletProvider.d.ts +143 -0
- package/dist/wallet-providers/solanaKeypairWalletProvider.js +280 -0
- package/dist/wallet-providers/solanaKeypairWalletProvider.test.d.ts +1 -0
- package/dist/wallet-providers/solanaKeypairWalletProvider.test.js +24 -0
- package/dist/wallet-providers/svmWalletProvider.d.ts +56 -0
- package/dist/wallet-providers/svmWalletProvider.js +13 -0
- package/dist/wallet-providers/viemWalletProvider.d.ts +15 -1
- package/dist/wallet-providers/viemWalletProvider.js +23 -4
- package/dist/wallet-providers/walletProvider.d.ts +1 -1
- package/package.json +4 -1
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const alchemyTokenPricesActionProvider_1 = require("./alchemyTokenPricesActionProvider");
|
|
4
|
+
const MOCK_API_KEY = "alch-demo";
|
|
5
|
+
// Sample responses for each action
|
|
6
|
+
const MOCK_TOKEN_PRICES_BY_SYMBOL_RESPONSE = {
|
|
7
|
+
data: [
|
|
8
|
+
{
|
|
9
|
+
symbol: "ETH",
|
|
10
|
+
prices: [
|
|
11
|
+
{
|
|
12
|
+
currency: "usd",
|
|
13
|
+
value: "2873.490923459",
|
|
14
|
+
lastUpdatedAt: "2025-02-03T23:46:40Z",
|
|
15
|
+
},
|
|
16
|
+
],
|
|
17
|
+
},
|
|
18
|
+
],
|
|
19
|
+
};
|
|
20
|
+
const MOCK_TOKEN_PRICES_BY_ADDRESS_RESPONSE = {
|
|
21
|
+
data: [
|
|
22
|
+
{
|
|
23
|
+
network: "eth-mainnet",
|
|
24
|
+
address: "0x1234567890abcdef",
|
|
25
|
+
prices: [
|
|
26
|
+
{
|
|
27
|
+
currency: "usd",
|
|
28
|
+
value: "1234.56",
|
|
29
|
+
lastUpdatedAt: "2025-02-03T23:46:40Z",
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
};
|
|
35
|
+
describe("AlchemyTokenPricesActionProvider", () => {
|
|
36
|
+
let provider;
|
|
37
|
+
beforeEach(() => {
|
|
38
|
+
process.env.ALCHEMY_API_KEY = MOCK_API_KEY;
|
|
39
|
+
provider = (0, alchemyTokenPricesActionProvider_1.alchemyTokenPricesActionProvider)({ apiKey: MOCK_API_KEY });
|
|
40
|
+
jest.restoreAllMocks();
|
|
41
|
+
});
|
|
42
|
+
afterEach(() => {
|
|
43
|
+
jest.clearAllMocks();
|
|
44
|
+
});
|
|
45
|
+
describe("tokenPricesBySymbol", () => {
|
|
46
|
+
it("should successfully fetch token prices by symbol", async () => {
|
|
47
|
+
const fetchMock = jest.spyOn(global, "fetch").mockResolvedValue({
|
|
48
|
+
ok: true,
|
|
49
|
+
json: async () => MOCK_TOKEN_PRICES_BY_SYMBOL_RESPONSE,
|
|
50
|
+
});
|
|
51
|
+
const response = await provider.tokenPricesBySymbol({ symbols: ["ETH", "BTC"] });
|
|
52
|
+
// Verify the URL has the correct API key and query parameters.
|
|
53
|
+
const expectedUrlPart = `${provider["baseUrl"]}/${MOCK_API_KEY}/tokens/by-symbol`;
|
|
54
|
+
expect(fetchMock).toHaveBeenCalled();
|
|
55
|
+
const calledUrl = fetchMock.mock.calls[0][0];
|
|
56
|
+
expect(calledUrl).toContain(expectedUrlPart);
|
|
57
|
+
expect(calledUrl).toContain("symbols=ETH");
|
|
58
|
+
expect(calledUrl).toContain("symbols=BTC");
|
|
59
|
+
expect(response).toContain("Successfully fetched token prices by symbol");
|
|
60
|
+
expect(response).toContain(JSON.stringify(MOCK_TOKEN_PRICES_BY_SYMBOL_RESPONSE, null, 2));
|
|
61
|
+
});
|
|
62
|
+
it("should handle non-ok response for token prices by symbol", async () => {
|
|
63
|
+
jest.spyOn(global, "fetch").mockResolvedValue({
|
|
64
|
+
ok: false,
|
|
65
|
+
status: 400,
|
|
66
|
+
});
|
|
67
|
+
const response = await provider.tokenPricesBySymbol({ symbols: ["ETH"] });
|
|
68
|
+
expect(response).toContain("Error fetching token prices by symbol");
|
|
69
|
+
expect(response).toContain("400");
|
|
70
|
+
});
|
|
71
|
+
it("should handle fetch error for token prices by symbol", async () => {
|
|
72
|
+
const error = new Error("Fetch error");
|
|
73
|
+
jest.spyOn(global, "fetch").mockRejectedValue(error);
|
|
74
|
+
const response = await provider.tokenPricesBySymbol({ symbols: ["ETH"] });
|
|
75
|
+
expect(response).toContain("Error fetching token prices by symbol");
|
|
76
|
+
expect(response).toContain(error.message);
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
describe("tokenPricesByAddress", () => {
|
|
80
|
+
it("should successfully fetch token prices by address", async () => {
|
|
81
|
+
const fetchMock = jest.spyOn(global, "fetch").mockResolvedValue({
|
|
82
|
+
ok: true,
|
|
83
|
+
json: async () => MOCK_TOKEN_PRICES_BY_ADDRESS_RESPONSE,
|
|
84
|
+
});
|
|
85
|
+
const payload = {
|
|
86
|
+
addresses: [{ network: "eth-mainnet", address: "0x1234567890abcdef" }],
|
|
87
|
+
};
|
|
88
|
+
const response = await provider.tokenPricesByAddress(payload);
|
|
89
|
+
expect(fetchMock).toHaveBeenCalled();
|
|
90
|
+
// Verify that fetch was called with the correct POST URL and options.
|
|
91
|
+
const expectedUrl = `${provider["baseUrl"]}/${MOCK_API_KEY}/tokens/by-address`;
|
|
92
|
+
expect(fetchMock).toHaveBeenCalledWith(expectedUrl, expect.objectContaining({
|
|
93
|
+
method: "POST",
|
|
94
|
+
headers: expect.objectContaining({
|
|
95
|
+
Accept: "application/json",
|
|
96
|
+
"Content-Type": "application/json",
|
|
97
|
+
}),
|
|
98
|
+
body: JSON.stringify(payload),
|
|
99
|
+
}));
|
|
100
|
+
expect(response).toContain("Successfully fetched token prices by address");
|
|
101
|
+
expect(response).toContain(JSON.stringify(MOCK_TOKEN_PRICES_BY_ADDRESS_RESPONSE, null, 2));
|
|
102
|
+
});
|
|
103
|
+
it("should handle non-ok response for token prices by address", async () => {
|
|
104
|
+
jest.spyOn(global, "fetch").mockResolvedValue({
|
|
105
|
+
ok: false,
|
|
106
|
+
status: 429,
|
|
107
|
+
});
|
|
108
|
+
const payload = {
|
|
109
|
+
addresses: [{ network: "eth-mainnet", address: "0x1234567890abcdef" }],
|
|
110
|
+
};
|
|
111
|
+
const response = await provider.tokenPricesByAddress(payload);
|
|
112
|
+
expect(response).toContain("Error fetching token prices by address");
|
|
113
|
+
expect(response).toContain("429");
|
|
114
|
+
});
|
|
115
|
+
it("should handle fetch error for token prices by address", async () => {
|
|
116
|
+
const error = new Error("Fetch error");
|
|
117
|
+
jest.spyOn(global, "fetch").mockRejectedValue(error);
|
|
118
|
+
const payload = {
|
|
119
|
+
addresses: [{ network: "eth-mainnet", address: "0x1234567890abcdef" }],
|
|
120
|
+
};
|
|
121
|
+
const response = await provider.tokenPricesByAddress(payload);
|
|
122
|
+
expect(response).toContain("Error fetching token prices by address");
|
|
123
|
+
expect(response).toContain(error.message);
|
|
124
|
+
});
|
|
125
|
+
});
|
|
126
|
+
describe("supportsNetwork", () => {
|
|
127
|
+
it("should always return true", () => {
|
|
128
|
+
expect(provider.supportsNetwork()).toBe(true);
|
|
129
|
+
});
|
|
130
|
+
});
|
|
131
|
+
});
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./alchemyTokenPricesActionProvider"), exports);
|
|
18
|
+
__exportStar(require("./schemas"), exports);
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Input schema for fetching token prices by symbol.
|
|
4
|
+
*
|
|
5
|
+
* The API expects a list of token symbols.
|
|
6
|
+
*/
|
|
7
|
+
export declare const AlchemyTokenPricesBySymbolSchema: z.ZodObject<{
|
|
8
|
+
symbols: z.ZodArray<z.ZodString, "many">;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
symbols: string[];
|
|
11
|
+
}, {
|
|
12
|
+
symbols: string[];
|
|
13
|
+
}>;
|
|
14
|
+
/**
|
|
15
|
+
* Input schema for fetching token prices by address.
|
|
16
|
+
*
|
|
17
|
+
* The API expects an object with an array of addresses, where each address contains
|
|
18
|
+
* a network identifier and a token contract address.
|
|
19
|
+
*/
|
|
20
|
+
export declare const AlchemyTokenPricesByAddressSchema: z.ZodObject<{
|
|
21
|
+
addresses: z.ZodArray<z.ZodObject<{
|
|
22
|
+
network: z.ZodString;
|
|
23
|
+
address: z.ZodString;
|
|
24
|
+
}, "strip", z.ZodTypeAny, {
|
|
25
|
+
address: string;
|
|
26
|
+
network: string;
|
|
27
|
+
}, {
|
|
28
|
+
address: string;
|
|
29
|
+
network: string;
|
|
30
|
+
}>, "many">;
|
|
31
|
+
}, "strip", z.ZodTypeAny, {
|
|
32
|
+
addresses: {
|
|
33
|
+
address: string;
|
|
34
|
+
network: string;
|
|
35
|
+
}[];
|
|
36
|
+
}, {
|
|
37
|
+
addresses: {
|
|
38
|
+
address: string;
|
|
39
|
+
network: string;
|
|
40
|
+
}[];
|
|
41
|
+
}>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.AlchemyTokenPricesByAddressSchema = exports.AlchemyTokenPricesBySymbolSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
/**
|
|
6
|
+
* Input schema for fetching token prices by symbol.
|
|
7
|
+
*
|
|
8
|
+
* The API expects a list of token symbols.
|
|
9
|
+
*/
|
|
10
|
+
exports.AlchemyTokenPricesBySymbolSchema = zod_1.z
|
|
11
|
+
.object({
|
|
12
|
+
symbols: zod_1.z
|
|
13
|
+
.array(zod_1.z.string())
|
|
14
|
+
.min(1, "At least one token symbol is required. Example: ETH, BTC, SOL, etc.")
|
|
15
|
+
.max(25, "A maximum of 25 token symbols can be provided."),
|
|
16
|
+
})
|
|
17
|
+
.describe("Input schema for fetching token prices by symbol from Alchemy");
|
|
18
|
+
/**
|
|
19
|
+
* Input schema for fetching token prices by address.
|
|
20
|
+
*
|
|
21
|
+
* The API expects an object with an array of addresses, where each address contains
|
|
22
|
+
* a network identifier and a token contract address.
|
|
23
|
+
*/
|
|
24
|
+
exports.AlchemyTokenPricesByAddressSchema = zod_1.z
|
|
25
|
+
.object({
|
|
26
|
+
addresses: zod_1.z
|
|
27
|
+
.array(zod_1.z.object({
|
|
28
|
+
network: zod_1.z.string().describe("Network identifier (e.g., eth-mainnet, base-mainnet etc.)"),
|
|
29
|
+
address: zod_1.z.string().describe("Token contract address"),
|
|
30
|
+
}))
|
|
31
|
+
.min(1, "At least one address is required.")
|
|
32
|
+
.max(25, "A maximum of 25 addresses can be provided."),
|
|
33
|
+
})
|
|
34
|
+
.describe("Input schema for fetching token prices by address from Alchemy");
|
|
@@ -6,7 +6,7 @@ import { EvmWalletProvider } from "../../wallet-providers";
|
|
|
6
6
|
/**
|
|
7
7
|
* Action provider for registering Basenames.
|
|
8
8
|
*/
|
|
9
|
-
export declare class BasenameActionProvider extends ActionProvider {
|
|
9
|
+
export declare class BasenameActionProvider extends ActionProvider<EvmWalletProvider> {
|
|
10
10
|
/**
|
|
11
11
|
* Constructs a new BasenameActionProvider.
|
|
12
12
|
*/
|
|
@@ -10,6 +10,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
};
|
|
11
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
12
|
exports.cdpApiActionProvider = exports.CdpApiActionProvider = void 0;
|
|
13
|
+
const package_json_1 = require("../../../package.json");
|
|
13
14
|
const coinbase_sdk_1 = require("@coinbase/coinbase-sdk");
|
|
14
15
|
const zod_1 = require("zod");
|
|
15
16
|
const actionDecorator_1 = require("../actionDecorator");
|
|
@@ -37,7 +38,12 @@ class CdpApiActionProvider extends actionProvider_1.ActionProvider {
|
|
|
37
38
|
*/
|
|
38
39
|
this.supportsNetwork = (_) => true;
|
|
39
40
|
if (config.apiKeyName && config.apiKeyPrivateKey) {
|
|
40
|
-
coinbase_sdk_1.Coinbase.configure({
|
|
41
|
+
coinbase_sdk_1.Coinbase.configure({
|
|
42
|
+
apiKeyName: config.apiKeyName,
|
|
43
|
+
privateKey: config.apiKeyPrivateKey,
|
|
44
|
+
source: "agentkit",
|
|
45
|
+
sourceVersion: package_json_1.version,
|
|
46
|
+
});
|
|
41
47
|
}
|
|
42
48
|
else {
|
|
43
49
|
coinbase_sdk_1.Coinbase.configureFromJson();
|
|
@@ -6,7 +6,7 @@ import { EvmWalletProvider } from "../../wallet-providers";
|
|
|
6
6
|
/**
|
|
7
7
|
* ERC20ActionProvider is an action provider for ERC20 tokens.
|
|
8
8
|
*/
|
|
9
|
-
export declare class ERC20ActionProvider extends ActionProvider {
|
|
9
|
+
export declare class ERC20ActionProvider extends ActionProvider<EvmWalletProvider> {
|
|
10
10
|
/**
|
|
11
11
|
* Constructor for the ERC20ActionProvider.
|
|
12
12
|
*/
|
|
@@ -7,12 +7,12 @@ export declare const TransferSchema: z.ZodObject<{
|
|
|
7
7
|
contractAddress: z.ZodString;
|
|
8
8
|
destination: z.ZodString;
|
|
9
9
|
}, "strip", z.ZodTypeAny, {
|
|
10
|
-
amount: bigint;
|
|
11
10
|
contractAddress: string;
|
|
11
|
+
amount: bigint;
|
|
12
12
|
destination: string;
|
|
13
13
|
}, {
|
|
14
|
-
amount: bigint;
|
|
15
14
|
contractAddress: string;
|
|
15
|
+
amount: bigint;
|
|
16
16
|
destination: string;
|
|
17
17
|
}>;
|
|
18
18
|
/**
|
|
@@ -6,7 +6,7 @@ import { Network } from "../../network";
|
|
|
6
6
|
/**
|
|
7
7
|
* Erc721ActionProvider is an action provider for Erc721 contract interactions.
|
|
8
8
|
*/
|
|
9
|
-
export declare class Erc721ActionProvider extends ActionProvider {
|
|
9
|
+
export declare class Erc721ActionProvider extends ActionProvider<EvmWalletProvider> {
|
|
10
10
|
/**
|
|
11
11
|
* Constructor for the Erc721ActionProvider class.
|
|
12
12
|
*/
|
|
@@ -1,13 +1,16 @@
|
|
|
1
1
|
export * from "./actionDecorator";
|
|
2
2
|
export * from "./actionProvider";
|
|
3
|
-
export * from "./
|
|
3
|
+
export * from "./customActionProvider";
|
|
4
|
+
export * from "./alchemy";
|
|
5
|
+
export * from "./basename";
|
|
4
6
|
export * from "./cdp";
|
|
5
|
-
export * from "./weth";
|
|
6
7
|
export * from "./erc20";
|
|
7
8
|
export * from "./erc721";
|
|
8
|
-
export * from "./morpho";
|
|
9
|
-
export * from "./basename";
|
|
10
9
|
export * from "./farcaster";
|
|
10
|
+
export * from "./pyth";
|
|
11
|
+
export * from "./moonwell";
|
|
12
|
+
export * from "./morpho";
|
|
13
|
+
export * from "./spl";
|
|
11
14
|
export * from "./twitter";
|
|
12
15
|
export * from "./wallet";
|
|
13
|
-
export * from "./
|
|
16
|
+
export * from "./weth";
|
|
@@ -16,14 +16,17 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
|
16
16
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
17
|
__exportStar(require("./actionDecorator"), exports);
|
|
18
18
|
__exportStar(require("./actionProvider"), exports);
|
|
19
|
-
__exportStar(require("./
|
|
19
|
+
__exportStar(require("./customActionProvider"), exports);
|
|
20
|
+
__exportStar(require("./alchemy"), exports);
|
|
21
|
+
__exportStar(require("./basename"), exports);
|
|
20
22
|
__exportStar(require("./cdp"), exports);
|
|
21
|
-
__exportStar(require("./weth"), exports);
|
|
22
23
|
__exportStar(require("./erc20"), exports);
|
|
23
24
|
__exportStar(require("./erc721"), exports);
|
|
24
|
-
__exportStar(require("./morpho"), exports);
|
|
25
|
-
__exportStar(require("./basename"), exports);
|
|
26
25
|
__exportStar(require("./farcaster"), exports);
|
|
26
|
+
__exportStar(require("./pyth"), exports);
|
|
27
|
+
__exportStar(require("./moonwell"), exports);
|
|
28
|
+
__exportStar(require("./morpho"), exports);
|
|
29
|
+
__exportStar(require("./spl"), exports);
|
|
27
30
|
__exportStar(require("./twitter"), exports);
|
|
28
31
|
__exportStar(require("./wallet"), exports);
|
|
29
|
-
__exportStar(require("./
|
|
32
|
+
__exportStar(require("./weth"), exports);
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
export declare const MOONWELL_BASE_ADDRESSES: {
|
|
2
|
+
"0xEdc817A28E8B93B03976FBd4a3dDBc9f7D176c22": string;
|
|
3
|
+
"0x73b06D8d18De422E269645eaCe15400DE7462417": string;
|
|
4
|
+
"0x628ff693426583D9a7FB391E54366292F509D457": string;
|
|
5
|
+
"0x3bf93770f2d4a794c3d9EBEfBAeBAE2a8f09A5E5": string;
|
|
6
|
+
"0x627Fe393Bc6EdDA28e99AE648fD6fF362514304b": string;
|
|
7
|
+
"0x73902f619CEB9B31FD8EFecf435CbDf89E369Ba6": string;
|
|
8
|
+
"0xb8051464C8c92209C92F3a4CD9C73746C4c3CFb3": string;
|
|
9
|
+
"0xF877ACaFA28c19b96727966690b2f44d35aD5976": string;
|
|
10
|
+
"0xb682c840B5F4FC58B20769E691A6fa1305A501a2": string;
|
|
11
|
+
"0xfC41B49d064Ac646015b459C522820DB9472F4B5": string;
|
|
12
|
+
"0xdC7810B47eAAb250De623F0eE07764afa5F71ED1": string;
|
|
13
|
+
"0xb6419c6C2e60c4025D6D06eE4F913ce89425a357": string;
|
|
14
|
+
"0x9A858ebfF1bEb0D3495BB0e2897c1528eD84A218": string;
|
|
15
|
+
"0x70778cfcFC475c7eA0f24cC625Baf6EaE475D0c9": string;
|
|
16
|
+
};
|
|
17
|
+
export declare const MOONWELL_BASE_SEPOLIA_ADDRESSES: {
|
|
18
|
+
"0x876852425331a113d8E432eFFB3aC5BEf38f033a": string;
|
|
19
|
+
"0x5302EbD8BC32435C823c2e22B04Cd6c45f593e89": string;
|
|
20
|
+
"0x2F39a349A79492a70E152760ce7123A1933eCf28": string;
|
|
21
|
+
};
|
|
22
|
+
export declare const WETH_ROUTER_ADDRESS = "0x70778cfcFC475c7eA0f24cC625Baf6EaE475D0c9";
|
|
23
|
+
export declare const TOKEN_DECIMALS: {
|
|
24
|
+
"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913": number;
|
|
25
|
+
"0x60a3E35Cc302bFA44Cb288Bc5a4F316Fdb1adb42": number;
|
|
26
|
+
"0x04C0599Ae5A44757c0af6F9eC3b93da8976c150A": number;
|
|
27
|
+
"0xEDfa23602D0EC14714057867A78d01e94176BEA0": number;
|
|
28
|
+
"0x236aa50979D5f3De3Bd1Eeb40E81137F22ab794b": number;
|
|
29
|
+
"0xA88594D404727625A9437C3f886C7643872296AE": number;
|
|
30
|
+
"0x820C137fa70C8691f0e44Dc420a5e53c168921Dc": number;
|
|
31
|
+
"0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb": number;
|
|
32
|
+
"0x4200000000000000000000000000000000000006": number;
|
|
33
|
+
"0x2Ae3F1Ec7F1F5012CFEab0185bfc7aa3cf0DEc22": number;
|
|
34
|
+
"0xc1CBa3fCea344f92D9239c08C0568f6F2F0ee452": number;
|
|
35
|
+
"0x940181a94a35a4569e4529a3cdfb74e38fd98631": number;
|
|
36
|
+
"0x0000000000000000000000000000000000000000": number;
|
|
37
|
+
};
|
|
38
|
+
export declare const MTOKENS_UNDERLYING_DECIMALS: {
|
|
39
|
+
MOONWELL_USDC: number;
|
|
40
|
+
MOONWELL_DAI: number;
|
|
41
|
+
MOONWELL_WETH: number;
|
|
42
|
+
MOONWELL_cbETH: number;
|
|
43
|
+
MOONWELL_wstETH: number;
|
|
44
|
+
MOONWELL_AERO: number;
|
|
45
|
+
MOONWELL_weETH: number;
|
|
46
|
+
MOONWELL_cbBTC: number;
|
|
47
|
+
MOONWELL_EURC: number;
|
|
48
|
+
MOONWELL_wrsETH: number;
|
|
49
|
+
MOONWELL_WELL: number;
|
|
50
|
+
MOONWELL_USDS: number;
|
|
51
|
+
MOONWELL_TBTC: number;
|
|
52
|
+
};
|
|
53
|
+
export declare const ETH_ROUTER_ABI: {
|
|
54
|
+
name: string;
|
|
55
|
+
inputs: {
|
|
56
|
+
internalType: string;
|
|
57
|
+
name: string;
|
|
58
|
+
type: string;
|
|
59
|
+
}[];
|
|
60
|
+
outputs: never[];
|
|
61
|
+
stateMutability: string;
|
|
62
|
+
type: string;
|
|
63
|
+
}[];
|
|
64
|
+
export declare const MTOKEN_ABI: {
|
|
65
|
+
type: string;
|
|
66
|
+
name: string;
|
|
67
|
+
inputs: {
|
|
68
|
+
name: string;
|
|
69
|
+
type: string;
|
|
70
|
+
internalType: string;
|
|
71
|
+
}[];
|
|
72
|
+
outputs: {
|
|
73
|
+
name: string;
|
|
74
|
+
type: string;
|
|
75
|
+
internalType: string;
|
|
76
|
+
}[];
|
|
77
|
+
stateMutability: string;
|
|
78
|
+
}[];
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MTOKEN_ABI = exports.ETH_ROUTER_ABI = exports.MTOKENS_UNDERLYING_DECIMALS = exports.TOKEN_DECIMALS = exports.WETH_ROUTER_ADDRESS = exports.MOONWELL_BASE_SEPOLIA_ADDRESSES = exports.MOONWELL_BASE_ADDRESSES = void 0;
|
|
4
|
+
exports.MOONWELL_BASE_ADDRESSES = {
|
|
5
|
+
"0xEdc817A28E8B93B03976FBd4a3dDBc9f7D176c22": "MOONWELL_USDC",
|
|
6
|
+
"0x73b06D8d18De422E269645eaCe15400DE7462417": "MOONWELL_DAI",
|
|
7
|
+
"0x628ff693426583D9a7FB391E54366292F509D457": "MOONWELL_WETH",
|
|
8
|
+
"0x3bf93770f2d4a794c3d9EBEfBAeBAE2a8f09A5E5": "MOONWELL_cbETH",
|
|
9
|
+
"0x627Fe393Bc6EdDA28e99AE648fD6fF362514304b": "MOONWELL_wstETH",
|
|
10
|
+
"0x73902f619CEB9B31FD8EFecf435CbDf89E369Ba6": "MOONWELL_AERO",
|
|
11
|
+
"0xb8051464C8c92209C92F3a4CD9C73746C4c3CFb3": "MOONWELL_weETH",
|
|
12
|
+
"0xF877ACaFA28c19b96727966690b2f44d35aD5976": "MOONWELL_cbBTC",
|
|
13
|
+
"0xb682c840B5F4FC58B20769E691A6fa1305A501a2": "MOONWELL_EURC",
|
|
14
|
+
"0xfC41B49d064Ac646015b459C522820DB9472F4B5": "MOONWELL_wrsETH",
|
|
15
|
+
"0xdC7810B47eAAb250De623F0eE07764afa5F71ED1": "MOONWELL_WELL",
|
|
16
|
+
"0xb6419c6C2e60c4025D6D06eE4F913ce89425a357": "MOONWELL_USDS",
|
|
17
|
+
"0x9A858ebfF1bEb0D3495BB0e2897c1528eD84A218": "MOONWELL_TBTC",
|
|
18
|
+
"0x70778cfcFC475c7eA0f24cC625Baf6EaE475D0c9": "WETH_ROUTER",
|
|
19
|
+
};
|
|
20
|
+
exports.MOONWELL_BASE_SEPOLIA_ADDRESSES = {
|
|
21
|
+
"0x876852425331a113d8E432eFFB3aC5BEf38f033a": "MOONWELL_USDBC",
|
|
22
|
+
"0x5302EbD8BC32435C823c2e22B04Cd6c45f593e89": "MOONWELL_cbETH",
|
|
23
|
+
"0x2F39a349A79492a70E152760ce7123A1933eCf28": "MOONWELL_WETH",
|
|
24
|
+
};
|
|
25
|
+
exports.WETH_ROUTER_ADDRESS = "0x70778cfcFC475c7eA0f24cC625Baf6EaE475D0c9";
|
|
26
|
+
// Token decimals mapping
|
|
27
|
+
exports.TOKEN_DECIMALS = {
|
|
28
|
+
"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913": 6, // USDC
|
|
29
|
+
"0x60a3E35Cc302bFA44Cb288Bc5a4F316Fdb1adb42": 6, // EURC
|
|
30
|
+
"0x04C0599Ae5A44757c0af6F9eC3b93da8976c150A": 18, // weETH
|
|
31
|
+
"0xEDfa23602D0EC14714057867A78d01e94176BEA0": 18, // wrsETH
|
|
32
|
+
"0x236aa50979D5f3De3Bd1Eeb40E81137F22ab794b": 18, // tBTC
|
|
33
|
+
"0xA88594D404727625A9437C3f886C7643872296AE": 18, // WELL
|
|
34
|
+
"0x820C137fa70C8691f0e44Dc420a5e53c168921Dc": 18, // USDS
|
|
35
|
+
"0x50c5725949A6F0c72E6C4a641F24049A917DB0Cb": 18, // DAI
|
|
36
|
+
"0x4200000000000000000000000000000000000006": 18, // WETH
|
|
37
|
+
"0x2Ae3F1Ec7F1F5012CFEab0185bfc7aa3cf0DEc22": 18, // cbETH
|
|
38
|
+
"0xc1CBa3fCea344f92D9239c08C0568f6F2F0ee452": 18, // wstETH
|
|
39
|
+
"0x940181a94a35a4569e4529a3cdfb74e38fd98631": 18, // AERO
|
|
40
|
+
"0x0000000000000000000000000000000000000000": 18, // ETH (native)
|
|
41
|
+
};
|
|
42
|
+
exports.MTOKENS_UNDERLYING_DECIMALS = {
|
|
43
|
+
MOONWELL_USDC: 6,
|
|
44
|
+
MOONWELL_DAI: 18,
|
|
45
|
+
MOONWELL_WETH: 18,
|
|
46
|
+
MOONWELL_cbETH: 18,
|
|
47
|
+
MOONWELL_wstETH: 18,
|
|
48
|
+
MOONWELL_AERO: 18,
|
|
49
|
+
MOONWELL_weETH: 18,
|
|
50
|
+
MOONWELL_cbBTC: 18,
|
|
51
|
+
MOONWELL_EURC: 6,
|
|
52
|
+
MOONWELL_wrsETH: 18,
|
|
53
|
+
MOONWELL_WELL: 18,
|
|
54
|
+
MOONWELL_USDS: 18,
|
|
55
|
+
MOONWELL_TBTC: 18,
|
|
56
|
+
};
|
|
57
|
+
exports.ETH_ROUTER_ABI = [
|
|
58
|
+
{
|
|
59
|
+
name: "mint",
|
|
60
|
+
inputs: [
|
|
61
|
+
{
|
|
62
|
+
internalType: "address",
|
|
63
|
+
name: "receiver",
|
|
64
|
+
type: "address",
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
outputs: [],
|
|
68
|
+
stateMutability: "payable",
|
|
69
|
+
type: "function",
|
|
70
|
+
},
|
|
71
|
+
];
|
|
72
|
+
exports.MTOKEN_ABI = [
|
|
73
|
+
{
|
|
74
|
+
type: "function",
|
|
75
|
+
name: "mint",
|
|
76
|
+
inputs: [
|
|
77
|
+
{
|
|
78
|
+
name: "mintAmount",
|
|
79
|
+
type: "uint256",
|
|
80
|
+
internalType: "uint256",
|
|
81
|
+
},
|
|
82
|
+
],
|
|
83
|
+
outputs: [
|
|
84
|
+
{
|
|
85
|
+
name: "",
|
|
86
|
+
type: "uint256",
|
|
87
|
+
internalType: "uint256",
|
|
88
|
+
},
|
|
89
|
+
],
|
|
90
|
+
stateMutability: "nonpayable",
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
type: "function",
|
|
94
|
+
name: "redeemUnderlying",
|
|
95
|
+
inputs: [
|
|
96
|
+
{
|
|
97
|
+
name: "redeemAmount",
|
|
98
|
+
type: "uint256",
|
|
99
|
+
internalType: "uint256",
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
outputs: [
|
|
103
|
+
{
|
|
104
|
+
name: "",
|
|
105
|
+
type: "uint256",
|
|
106
|
+
internalType: "uint256",
|
|
107
|
+
},
|
|
108
|
+
],
|
|
109
|
+
stateMutability: "nonpayable",
|
|
110
|
+
},
|
|
111
|
+
];
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { moonwellActionProvider } from "./moonwellActionProvider";
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.moonwellActionProvider = void 0;
|
|
4
|
+
var moonwellActionProvider_1 = require("./moonwellActionProvider");
|
|
5
|
+
Object.defineProperty(exports, "moonwellActionProvider", { enumerable: true, get: function () { return moonwellActionProvider_1.moonwellActionProvider; } });
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { ActionProvider } from "../actionProvider";
|
|
3
|
+
import { EvmWalletProvider } from "../../wallet-providers";
|
|
4
|
+
import { MintSchema, RedeemSchema } from "./schemas";
|
|
5
|
+
import { Network } from "../../network";
|
|
6
|
+
export declare const SUPPORTED_NETWORKS: string[];
|
|
7
|
+
/**
|
|
8
|
+
* MoonwellActionProvider is an action provider for Moonwell MToken interactions.
|
|
9
|
+
*/
|
|
10
|
+
export declare class MoonwellActionProvider extends ActionProvider<EvmWalletProvider> {
|
|
11
|
+
/**
|
|
12
|
+
* Constructor for the MoonwellActionProvider class.
|
|
13
|
+
*/
|
|
14
|
+
constructor();
|
|
15
|
+
/**
|
|
16
|
+
* Deposits assets into a Moonwell MToken
|
|
17
|
+
*
|
|
18
|
+
* @param wallet - The wallet instance to execute the transaction
|
|
19
|
+
* @param args - The input arguments for the action
|
|
20
|
+
* @returns A success message with transaction details or an error message
|
|
21
|
+
*/
|
|
22
|
+
mint(wallet: EvmWalletProvider, args: z.infer<typeof MintSchema>): Promise<string>;
|
|
23
|
+
/**
|
|
24
|
+
* Redeems assets from a Moonwell MToken
|
|
25
|
+
*
|
|
26
|
+
* @param wallet - The wallet instance to execute the transaction
|
|
27
|
+
* @param args - The input arguments for the action
|
|
28
|
+
* @returns A success message with transaction details or an error message
|
|
29
|
+
*/
|
|
30
|
+
redeem(wallet: EvmWalletProvider, args: z.infer<typeof RedeemSchema>): Promise<string>;
|
|
31
|
+
/**
|
|
32
|
+
* Checks if the Moonwell action provider supports the given network.
|
|
33
|
+
*
|
|
34
|
+
* @param network - The network to check.
|
|
35
|
+
* @returns True if the Moonwell action provider supports the network, false otherwise.
|
|
36
|
+
*/
|
|
37
|
+
supportsNetwork: (network: Network) => boolean;
|
|
38
|
+
}
|
|
39
|
+
export declare const moonwellActionProvider: () => MoonwellActionProvider;
|