@coinbase/agentkit 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 +305 -0
- package/dist/action-providers/actionDecorator.d.ts +69 -0
- package/dist/action-providers/actionDecorator.js +96 -0
- package/dist/action-providers/actionProvider.d.ts +48 -0
- package/dist/action-providers/actionProvider.js +62 -0
- package/dist/action-providers/basename/basenameActionProvider.d.ts +30 -0
- package/dist/action-providers/basename/basenameActionProvider.js +109 -0
- package/dist/action-providers/basename/basenameActionProvider.test.d.ts +1 -0
- package/dist/action-providers/basename/basenameActionProvider.test.js +146 -0
- package/dist/action-providers/basename/constants.d.ts +52 -0
- package/dist/action-providers/basename/constants.js +81 -0
- package/dist/action-providers/basename/index.d.ts +2 -0
- package/dist/action-providers/basename/index.js +18 -0
- package/dist/action-providers/basename/schemas.d.ts +14 -0
- package/dist/action-providers/basename/schemas.js +14 -0
- package/dist/action-providers/cdp/cdpApiActionProvider.d.ts +41 -0
- package/dist/action-providers/cdp/cdpApiActionProvider.js +111 -0
- package/dist/action-providers/cdp/cdpApiActionProvider.test.d.ts +1 -0
- package/dist/action-providers/cdp/cdpApiActionProvider.test.js +134 -0
- package/dist/action-providers/cdp/cdpWalletActionProvider.d.ts +58 -0
- package/dist/action-providers/cdp/cdpWalletActionProvider.js +218 -0
- package/dist/action-providers/cdp/cdpWalletActionProvider.test.d.ts +1 -0
- package/dist/action-providers/cdp/cdpWalletActionProvider.test.js +259 -0
- package/dist/action-providers/cdp/constants.d.ts +31 -0
- package/dist/action-providers/cdp/constants.js +34 -0
- package/dist/action-providers/cdp/index.d.ts +3 -0
- package/dist/action-providers/cdp/index.js +19 -0
- package/dist/action-providers/cdp/schemas.d.ts +91 -0
- package/dist/action-providers/cdp/schemas.js +77 -0
- package/dist/action-providers/customActionProvider.d.ts +30 -0
- package/dist/action-providers/customActionProvider.js +66 -0
- package/dist/action-providers/erc20/constants.d.ts +135 -0
- package/dist/action-providers/erc20/constants.js +191 -0
- package/dist/action-providers/erc20/erc20ActionProvider.d.ts +38 -0
- package/dist/action-providers/erc20/erc20ActionProvider.js +118 -0
- package/dist/action-providers/erc20/erc20ActionProvider.test.d.ts +1 -0
- package/dist/action-providers/erc20/erc20ActionProvider.test.js +117 -0
- package/dist/action-providers/erc20/index.d.ts +1 -0
- package/dist/action-providers/erc20/index.js +17 -0
- package/dist/action-providers/erc20/schemas.d.ts +27 -0
- package/dist/action-providers/erc20/schemas.js +26 -0
- package/dist/action-providers/erc721/constants.d.ts +236 -0
- package/dist/action-providers/erc721/constants.js +301 -0
- package/dist/action-providers/erc721/erc721ActionProvider.d.ts +46 -0
- package/dist/action-providers/erc721/erc721ActionProvider.js +164 -0
- package/dist/action-providers/erc721/erc721ActionProvider.test.d.ts +1 -0
- package/dist/action-providers/erc721/erc721ActionProvider.test.js +137 -0
- package/dist/action-providers/erc721/index.d.ts +1 -0
- package/dist/action-providers/erc721/index.js +17 -0
- package/dist/action-providers/erc721/schemas.d.ts +46 -0
- package/dist/action-providers/erc721/schemas.js +44 -0
- package/dist/action-providers/farcaster/farcasterActionProvider.d.ts +57 -0
- package/dist/action-providers/farcaster/farcasterActionProvider.js +142 -0
- package/dist/action-providers/farcaster/farcasterActionProvider.test.d.ts +1 -0
- package/dist/action-providers/farcaster/farcasterActionProvider.test.js +143 -0
- package/dist/action-providers/farcaster/index.d.ts +2 -0
- package/dist/action-providers/farcaster/index.js +18 -0
- package/dist/action-providers/farcaster/schemas.d.ts +15 -0
- package/dist/action-providers/farcaster/schemas.js +20 -0
- package/dist/action-providers/index.d.ts +13 -0
- package/dist/action-providers/index.js +29 -0
- package/dist/action-providers/morpho/constants.d.ts +16 -0
- package/dist/action-providers/morpho/constants.js +27 -0
- package/dist/action-providers/morpho/index.d.ts +2 -0
- package/dist/action-providers/morpho/index.js +18 -0
- package/dist/action-providers/morpho/morphoActionProvider.d.ts +39 -0
- package/dist/action-providers/morpho/morphoActionProvider.js +147 -0
- package/dist/action-providers/morpho/morphoActionProvider.test.d.ts +1 -0
- package/dist/action-providers/morpho/morphoActionProvider.test.js +126 -0
- package/dist/action-providers/morpho/schemas.d.ts +36 -0
- package/dist/action-providers/morpho/schemas.js +47 -0
- package/dist/action-providers/pyth/index.d.ts +2 -0
- package/dist/action-providers/pyth/index.js +18 -0
- package/dist/action-providers/pyth/pythActionProvider.d.ts +33 -0
- package/dist/action-providers/pyth/pythActionProvider.js +121 -0
- package/dist/action-providers/pyth/schemas.d.ts +21 -0
- package/dist/action-providers/pyth/schemas.js +20 -0
- package/dist/action-providers/twitter/index.d.ts +2 -0
- package/dist/action-providers/twitter/index.js +18 -0
- package/dist/action-providers/twitter/schemas.d.ts +38 -0
- package/dist/action-providers/twitter/schemas.js +44 -0
- package/dist/action-providers/twitter/twitterActionProvider.d.ts +82 -0
- package/dist/action-providers/twitter/twitterActionProvider.js +204 -0
- package/dist/action-providers/twitter/twitterActionProvider.test.d.ts +1 -0
- package/dist/action-providers/twitter/twitterActionProvider.test.js +185 -0
- package/dist/action-providers/wallet/index.d.ts +1 -0
- package/dist/action-providers/wallet/index.js +17 -0
- package/dist/action-providers/wallet/schemas.d.ts +19 -0
- package/dist/action-providers/wallet/schemas.js +19 -0
- package/dist/action-providers/wallet/walletActionProvider.d.ts +44 -0
- package/dist/action-providers/wallet/walletActionProvider.js +127 -0
- package/dist/action-providers/wallet/walletActionProvider.test.d.ts +1 -0
- package/dist/action-providers/wallet/walletActionProvider.test.js +116 -0
- package/dist/action-providers/weth/constants.d.ts +19 -0
- package/dist/action-providers/weth/constants.js +29 -0
- package/dist/action-providers/weth/index.d.ts +1 -0
- package/dist/action-providers/weth/index.js +17 -0
- package/dist/action-providers/weth/schemas.d.ts +8 -0
- package/dist/action-providers/weth/schemas.js +10 -0
- package/dist/action-providers/weth/wethActionProvider.d.ts +30 -0
- package/dist/action-providers/weth/wethActionProvider.js +89 -0
- package/dist/action-providers/weth/wethActionProvider.test.d.ts +1 -0
- package/dist/action-providers/weth/wethActionProvider.test.js +92 -0
- package/dist/action-providers/wow/constants.d.ts +15 -0
- package/dist/action-providers/wow/constants.js +844 -0
- package/dist/action-providers/wow/index.d.ts +2 -0
- package/dist/action-providers/wow/index.js +18 -0
- package/dist/action-providers/wow/schemas.d.ts +43 -0
- package/dist/action-providers/wow/schemas.js +47 -0
- package/dist/action-providers/wow/uniswap/constants.d.ts +3 -0
- package/dist/action-providers/wow/uniswap/constants.js +100 -0
- package/dist/action-providers/wow/uniswap/utils.d.ts +82 -0
- package/dist/action-providers/wow/uniswap/utils.js +226 -0
- package/dist/action-providers/wow/utils.d.ts +27 -0
- package/dist/action-providers/wow/utils.js +63 -0
- package/dist/action-providers/wow/wowActionProvider.d.ts +46 -0
- package/dist/action-providers/wow/wowActionProvider.js +223 -0
- package/dist/action-providers/wow/wowActionProvider.test.d.ts +1 -0
- package/dist/action-providers/wow/wowActionProvider.test.js +287 -0
- package/dist/agentkit.d.ts +45 -0
- package/dist/agentkit.js +60 -0
- package/dist/analytics/index.d.ts +1 -0
- package/dist/analytics/index.js +17 -0
- package/dist/analytics/sendAnalyticsEvent.d.ts +31 -0
- package/dist/analytics/sendAnalyticsEvent.js +51 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.js +22 -0
- package/dist/network/index.d.ts +1 -0
- package/dist/network/index.js +17 -0
- package/dist/network/network.d.ts +13 -0
- package/dist/network/network.js +41 -0
- package/dist/network/types.d.ts +17 -0
- package/dist/network/types.js +2 -0
- package/dist/utils.d.ts +11 -0
- package/dist/utils.js +43 -0
- package/dist/utils.test.d.ts +1 -0
- package/dist/utils.test.js +50 -0
- package/dist/wallet-providers/cdpWalletProvider.d.ts +218 -0
- package/dist/wallet-providers/cdpWalletProvider.js +362 -0
- package/dist/wallet-providers/evmWalletProvider.d.ts +51 -0
- package/dist/wallet-providers/evmWalletProvider.js +14 -0
- package/dist/wallet-providers/index.d.ts +4 -0
- package/dist/wallet-providers/index.js +20 -0
- package/dist/wallet-providers/viemWalletProvider.d.ts +89 -0
- package/dist/wallet-providers/viemWalletProvider.js +187 -0
- package/dist/wallet-providers/walletProvider.d.ts +48 -0
- package/dist/wallet-providers/walletProvider.js +41 -0
- package/package.json +65 -0
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
export declare const SolidityVersions: {
|
|
2
|
+
readonly "0.8.28": "0.8.28+commit.7893614a";
|
|
3
|
+
readonly "0.8.27": "0.8.27+commit.40a35a09";
|
|
4
|
+
readonly "0.8.26": "0.8.26+commit.8a97fa7a";
|
|
5
|
+
readonly "0.8.25": "0.8.25+commit.b61c2a91";
|
|
6
|
+
readonly "0.8.24": "0.8.24+commit.e11b9ed9";
|
|
7
|
+
readonly "0.8.23": "0.8.23+commit.f704f362";
|
|
8
|
+
readonly "0.8.22": "0.8.22+commit.4fc1097e";
|
|
9
|
+
readonly "0.8.21": "0.8.21+commit.d9974bed";
|
|
10
|
+
readonly "0.8.20": "0.8.20+commit.a1b79de6";
|
|
11
|
+
readonly "0.8.19": "0.8.19+commit.7dd6d404";
|
|
12
|
+
readonly "0.8.18": "0.8.18+commit.87f61d96";
|
|
13
|
+
readonly "0.8.17": "0.8.17+commit.8df45f5f";
|
|
14
|
+
readonly "0.8.16": "0.8.16+commit.07a7930e";
|
|
15
|
+
readonly "0.8.15": "0.8.15+commit.e14f2714";
|
|
16
|
+
readonly "0.8.14": "0.8.14+commit.80d49f37";
|
|
17
|
+
readonly "0.8.13": "0.8.13+commit.abaa5c0e";
|
|
18
|
+
readonly "0.8.12": "0.8.12+commit.f00d7308";
|
|
19
|
+
readonly "0.8.11": "0.8.11+commit.d7f03943";
|
|
20
|
+
readonly "0.8.10": "0.8.10+commit.fc410830";
|
|
21
|
+
readonly "0.8.9": "0.8.9+commit.e5eed63a";
|
|
22
|
+
readonly "0.8.8": "0.8.8+commit.dddeac2f";
|
|
23
|
+
readonly "0.8.7": "0.8.7+commit.e28d00a7";
|
|
24
|
+
readonly "0.8.6": "0.8.6+commit.11564f7e";
|
|
25
|
+
readonly "0.8.5": "0.8.5+commit.a4f2e591";
|
|
26
|
+
readonly "0.8.4": "0.8.4+commit.c7e474f2";
|
|
27
|
+
readonly "0.8.3": "0.8.3+commit.8d00100c";
|
|
28
|
+
readonly "0.8.2": "0.8.2+commit.661d1103";
|
|
29
|
+
readonly "0.8.1": "0.8.1+commit.df193b15";
|
|
30
|
+
readonly "0.8.0": "0.8.0+commit.c7dfd78e";
|
|
31
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.SolidityVersions = void 0;
|
|
4
|
+
exports.SolidityVersions = {
|
|
5
|
+
"0.8.28": "0.8.28+commit.7893614a",
|
|
6
|
+
"0.8.27": "0.8.27+commit.40a35a09",
|
|
7
|
+
"0.8.26": "0.8.26+commit.8a97fa7a",
|
|
8
|
+
"0.8.25": "0.8.25+commit.b61c2a91",
|
|
9
|
+
"0.8.24": "0.8.24+commit.e11b9ed9",
|
|
10
|
+
"0.8.23": "0.8.23+commit.f704f362",
|
|
11
|
+
"0.8.22": "0.8.22+commit.4fc1097e",
|
|
12
|
+
"0.8.21": "0.8.21+commit.d9974bed",
|
|
13
|
+
"0.8.20": "0.8.20+commit.a1b79de6",
|
|
14
|
+
"0.8.19": "0.8.19+commit.7dd6d404",
|
|
15
|
+
"0.8.18": "0.8.18+commit.87f61d96",
|
|
16
|
+
"0.8.17": "0.8.17+commit.8df45f5f",
|
|
17
|
+
"0.8.16": "0.8.16+commit.07a7930e",
|
|
18
|
+
"0.8.15": "0.8.15+commit.e14f2714",
|
|
19
|
+
"0.8.14": "0.8.14+commit.80d49f37",
|
|
20
|
+
"0.8.13": "0.8.13+commit.abaa5c0e",
|
|
21
|
+
"0.8.12": "0.8.12+commit.f00d7308",
|
|
22
|
+
"0.8.11": "0.8.11+commit.d7f03943",
|
|
23
|
+
"0.8.10": "0.8.10+commit.fc410830",
|
|
24
|
+
"0.8.9": "0.8.9+commit.e5eed63a",
|
|
25
|
+
"0.8.8": "0.8.8+commit.dddeac2f",
|
|
26
|
+
"0.8.7": "0.8.7+commit.e28d00a7",
|
|
27
|
+
"0.8.6": "0.8.6+commit.11564f7e",
|
|
28
|
+
"0.8.5": "0.8.5+commit.a4f2e591",
|
|
29
|
+
"0.8.4": "0.8.4+commit.c7e474f2",
|
|
30
|
+
"0.8.3": "0.8.3+commit.8d00100c",
|
|
31
|
+
"0.8.2": "0.8.2+commit.661d1103",
|
|
32
|
+
"0.8.1": "0.8.1+commit.df193b15",
|
|
33
|
+
"0.8.0": "0.8.0+commit.c7dfd78e",
|
|
34
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
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("./schemas"), exports);
|
|
18
|
+
__exportStar(require("./cdpApiActionProvider"), exports);
|
|
19
|
+
__exportStar(require("./cdpWalletActionProvider"), exports);
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Input schema for address reputation check.
|
|
4
|
+
*/
|
|
5
|
+
export declare const AddressReputationSchema: z.ZodObject<{
|
|
6
|
+
address: z.ZodString;
|
|
7
|
+
network: z.ZodString;
|
|
8
|
+
}, "strip", z.ZodTypeAny, {
|
|
9
|
+
address: string;
|
|
10
|
+
network: string;
|
|
11
|
+
}, {
|
|
12
|
+
address: string;
|
|
13
|
+
network: string;
|
|
14
|
+
}>;
|
|
15
|
+
/**
|
|
16
|
+
* Input schema for deploy contract action.
|
|
17
|
+
*/
|
|
18
|
+
export declare const DeployContractSchema: z.ZodObject<{
|
|
19
|
+
solidityVersion: z.ZodEnum<[string, ...string[]]>;
|
|
20
|
+
solidityInputJson: z.ZodString;
|
|
21
|
+
contractName: z.ZodString;
|
|
22
|
+
constructorArgs: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodAny>>;
|
|
23
|
+
}, "strip", z.ZodTypeAny, {
|
|
24
|
+
solidityVersion: string;
|
|
25
|
+
solidityInputJson: string;
|
|
26
|
+
contractName: string;
|
|
27
|
+
constructorArgs?: Record<string, any> | undefined;
|
|
28
|
+
}, {
|
|
29
|
+
solidityVersion: string;
|
|
30
|
+
solidityInputJson: string;
|
|
31
|
+
contractName: string;
|
|
32
|
+
constructorArgs?: Record<string, any> | undefined;
|
|
33
|
+
}>;
|
|
34
|
+
/**
|
|
35
|
+
* Input schema for deploy NFT action
|
|
36
|
+
*/
|
|
37
|
+
export declare const DeployNftSchema: z.ZodObject<{
|
|
38
|
+
name: z.ZodString;
|
|
39
|
+
symbol: z.ZodString;
|
|
40
|
+
baseURI: z.ZodString;
|
|
41
|
+
}, "strip", z.ZodTypeAny, {
|
|
42
|
+
symbol: string;
|
|
43
|
+
name: string;
|
|
44
|
+
baseURI: string;
|
|
45
|
+
}, {
|
|
46
|
+
symbol: string;
|
|
47
|
+
name: string;
|
|
48
|
+
baseURI: string;
|
|
49
|
+
}>;
|
|
50
|
+
/**
|
|
51
|
+
* Input schema for deploy token action.
|
|
52
|
+
*/
|
|
53
|
+
export declare const DeployTokenSchema: z.ZodObject<{
|
|
54
|
+
name: z.ZodString;
|
|
55
|
+
symbol: z.ZodString;
|
|
56
|
+
totalSupply: z.ZodType<bigint, z.ZodTypeDef, bigint>;
|
|
57
|
+
}, "strip", z.ZodTypeAny, {
|
|
58
|
+
symbol: string;
|
|
59
|
+
name: string;
|
|
60
|
+
totalSupply: bigint;
|
|
61
|
+
}, {
|
|
62
|
+
symbol: string;
|
|
63
|
+
name: string;
|
|
64
|
+
totalSupply: bigint;
|
|
65
|
+
}>;
|
|
66
|
+
/**
|
|
67
|
+
* Input schema for request faucet funds action.
|
|
68
|
+
*/
|
|
69
|
+
export declare const RequestFaucetFundsSchema: z.ZodObject<{
|
|
70
|
+
assetId: z.ZodOptional<z.ZodString>;
|
|
71
|
+
}, "strip", z.ZodTypeAny, {
|
|
72
|
+
assetId?: string | undefined;
|
|
73
|
+
}, {
|
|
74
|
+
assetId?: string | undefined;
|
|
75
|
+
}>;
|
|
76
|
+
/**
|
|
77
|
+
* Input schema for trade action.
|
|
78
|
+
*/
|
|
79
|
+
export declare const TradeSchema: z.ZodObject<{
|
|
80
|
+
amount: z.ZodType<bigint, z.ZodTypeDef, bigint>;
|
|
81
|
+
fromAssetId: z.ZodString;
|
|
82
|
+
toAssetId: z.ZodString;
|
|
83
|
+
}, "strip", z.ZodTypeAny, {
|
|
84
|
+
amount: bigint;
|
|
85
|
+
fromAssetId: string;
|
|
86
|
+
toAssetId: string;
|
|
87
|
+
}, {
|
|
88
|
+
amount: bigint;
|
|
89
|
+
fromAssetId: string;
|
|
90
|
+
toAssetId: string;
|
|
91
|
+
}>;
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.TradeSchema = exports.RequestFaucetFundsSchema = exports.DeployTokenSchema = exports.DeployNftSchema = exports.DeployContractSchema = exports.AddressReputationSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const constants_1 = require("./constants");
|
|
6
|
+
/**
|
|
7
|
+
* Input schema for address reputation check.
|
|
8
|
+
*/
|
|
9
|
+
exports.AddressReputationSchema = zod_1.z
|
|
10
|
+
.object({
|
|
11
|
+
address: zod_1.z
|
|
12
|
+
.string()
|
|
13
|
+
.regex(/^0x[a-fA-F0-9]{40}$/, "Invalid Ethereum address format")
|
|
14
|
+
.describe("The Ethereum address to check"),
|
|
15
|
+
network: zod_1.z.string().describe("The network to check the address on"),
|
|
16
|
+
})
|
|
17
|
+
.strip()
|
|
18
|
+
.describe("Input schema for address reputation check");
|
|
19
|
+
/**
|
|
20
|
+
* Input schema for deploy contract action.
|
|
21
|
+
*/
|
|
22
|
+
exports.DeployContractSchema = zod_1.z
|
|
23
|
+
.object({
|
|
24
|
+
solidityVersion: zod_1.z
|
|
25
|
+
.enum(Object.keys(constants_1.SolidityVersions))
|
|
26
|
+
.describe("The solidity compiler version"),
|
|
27
|
+
solidityInputJson: zod_1.z.string().describe("The input json for the solidity compiler"),
|
|
28
|
+
contractName: zod_1.z.string().describe("The name of the contract class to be deployed"),
|
|
29
|
+
constructorArgs: zod_1.z
|
|
30
|
+
.record(zod_1.z.string(), zod_1.z.any())
|
|
31
|
+
.describe("The constructor arguments for the contract")
|
|
32
|
+
.optional(),
|
|
33
|
+
})
|
|
34
|
+
.strip()
|
|
35
|
+
.describe("Instructions for deploying an arbitrary contract");
|
|
36
|
+
/**
|
|
37
|
+
* Input schema for deploy NFT action
|
|
38
|
+
*/
|
|
39
|
+
exports.DeployNftSchema = zod_1.z
|
|
40
|
+
.object({
|
|
41
|
+
name: zod_1.z.string().describe("The name of the NFT collection"),
|
|
42
|
+
symbol: zod_1.z.string().describe("The symbol of the NFT collection"),
|
|
43
|
+
baseURI: zod_1.z.string().describe("The base URI for the token metadata"),
|
|
44
|
+
})
|
|
45
|
+
.strip()
|
|
46
|
+
.describe("Instructions for deploying an NFT collection");
|
|
47
|
+
/**
|
|
48
|
+
* Input schema for deploy token action.
|
|
49
|
+
*/
|
|
50
|
+
exports.DeployTokenSchema = zod_1.z
|
|
51
|
+
.object({
|
|
52
|
+
name: zod_1.z.string().describe("The name of the token"),
|
|
53
|
+
symbol: zod_1.z.string().describe("The token symbol"),
|
|
54
|
+
totalSupply: zod_1.z.custom().describe("The total supply of tokens to mint"),
|
|
55
|
+
})
|
|
56
|
+
.strip()
|
|
57
|
+
.describe("Instructions for deploying a token");
|
|
58
|
+
/**
|
|
59
|
+
* Input schema for request faucet funds action.
|
|
60
|
+
*/
|
|
61
|
+
exports.RequestFaucetFundsSchema = zod_1.z
|
|
62
|
+
.object({
|
|
63
|
+
assetId: zod_1.z.string().optional().describe("The optional asset ID to request from faucet"),
|
|
64
|
+
})
|
|
65
|
+
.strip()
|
|
66
|
+
.describe("Instructions for requesting faucet funds");
|
|
67
|
+
/**
|
|
68
|
+
* Input schema for trade action.
|
|
69
|
+
*/
|
|
70
|
+
exports.TradeSchema = zod_1.z
|
|
71
|
+
.object({
|
|
72
|
+
amount: zod_1.z.custom().describe("The amount of the from asset to trade"),
|
|
73
|
+
fromAssetId: zod_1.z.string().describe("The from asset ID to trade"),
|
|
74
|
+
toAssetId: zod_1.z.string().describe("The to asset ID to receive from the trade"),
|
|
75
|
+
})
|
|
76
|
+
.strip()
|
|
77
|
+
.describe("Instructions for trading assets");
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { ActionProvider } from "./actionProvider";
|
|
3
|
+
import { Network } from "../network";
|
|
4
|
+
import { WalletProvider } from "../wallet-providers";
|
|
5
|
+
interface CustomActionProviderOptions<TWalletProvider extends WalletProvider> {
|
|
6
|
+
name: string;
|
|
7
|
+
description: string;
|
|
8
|
+
schema: z.ZodSchema;
|
|
9
|
+
invoke: ((args: any) => Promise<any>) | ((walletProvider: TWalletProvider, args: any) => Promise<any>);
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* CustomActionProvider is a custom action provider that allows for custom action registration
|
|
13
|
+
*/
|
|
14
|
+
export declare class CustomActionProvider<TWalletProvider extends WalletProvider> extends ActionProvider {
|
|
15
|
+
/**
|
|
16
|
+
* Creates a new CustomActionProvider that dynamically adds decorated action methods
|
|
17
|
+
*
|
|
18
|
+
* @param actions - Array of custom actions to be added to the provider
|
|
19
|
+
*/
|
|
20
|
+
constructor(actions: CustomActionProviderOptions<TWalletProvider>[]);
|
|
21
|
+
/**
|
|
22
|
+
* Custom action providers are supported on all networks
|
|
23
|
+
*
|
|
24
|
+
* @param _ - The network to checkpointSaver
|
|
25
|
+
* @returns true
|
|
26
|
+
*/
|
|
27
|
+
supportsNetwork(_: Network): boolean;
|
|
28
|
+
}
|
|
29
|
+
export declare const customActionProvider: <TWalletProvider extends WalletProvider>(actions: CustomActionProviderOptions<TWalletProvider> | CustomActionProviderOptions<TWalletProvider>[]) => CustomActionProvider<TWalletProvider>;
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.customActionProvider = exports.CustomActionProvider = void 0;
|
|
5
|
+
const actionDecorator_1 = require("./actionDecorator");
|
|
6
|
+
const actionProvider_1 = require("./actionProvider");
|
|
7
|
+
const wallet_providers_1 = require("../wallet-providers");
|
|
8
|
+
/**
|
|
9
|
+
* CustomActionProvider is a custom action provider that allows for custom action registration
|
|
10
|
+
*/
|
|
11
|
+
class CustomActionProvider extends actionProvider_1.ActionProvider {
|
|
12
|
+
/**
|
|
13
|
+
* Creates a new CustomActionProvider that dynamically adds decorated action methods
|
|
14
|
+
*
|
|
15
|
+
* @param actions - Array of custom actions to be added to the provider
|
|
16
|
+
*/
|
|
17
|
+
constructor(actions) {
|
|
18
|
+
super("custom", []);
|
|
19
|
+
actions.forEach(({ name, description, schema, invoke }) => {
|
|
20
|
+
// Check if the invoke function expects a wallet provider
|
|
21
|
+
const takesWalletProvider = invoke.length === 2;
|
|
22
|
+
// Define the method on the prototype with the correct signature
|
|
23
|
+
Object.defineProperty(CustomActionProvider.prototype, name, {
|
|
24
|
+
value: takesWalletProvider
|
|
25
|
+
? async function (walletProvider, args) {
|
|
26
|
+
const parsedArgs = schema.parse(args);
|
|
27
|
+
return await invoke(walletProvider, parsedArgs);
|
|
28
|
+
}
|
|
29
|
+
: async function (args) {
|
|
30
|
+
const parsedArgs = schema.parse(args);
|
|
31
|
+
return await invoke(parsedArgs);
|
|
32
|
+
},
|
|
33
|
+
configurable: true,
|
|
34
|
+
writable: true,
|
|
35
|
+
enumerable: true,
|
|
36
|
+
});
|
|
37
|
+
// Manually set the parameter metadata
|
|
38
|
+
const paramTypes = takesWalletProvider ? [wallet_providers_1.WalletProvider, Object] : [Object];
|
|
39
|
+
Reflect.defineMetadata("design:paramtypes", paramTypes, CustomActionProvider.prototype, name);
|
|
40
|
+
// Apply the decorator using original name
|
|
41
|
+
const decoratedMethod = (0, actionDecorator_1.CreateAction)({
|
|
42
|
+
name,
|
|
43
|
+
description,
|
|
44
|
+
schema,
|
|
45
|
+
})(CustomActionProvider.prototype, name, Object.getOwnPropertyDescriptor(CustomActionProvider.prototype, name));
|
|
46
|
+
// Add the decorated method to the instance
|
|
47
|
+
Object.defineProperty(this, name, {
|
|
48
|
+
value: decoratedMethod,
|
|
49
|
+
configurable: true,
|
|
50
|
+
writable: true,
|
|
51
|
+
});
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Custom action providers are supported on all networks
|
|
56
|
+
*
|
|
57
|
+
* @param _ - The network to checkpointSaver
|
|
58
|
+
* @returns true
|
|
59
|
+
*/
|
|
60
|
+
supportsNetwork(_) {
|
|
61
|
+
return true;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
exports.CustomActionProvider = CustomActionProvider;
|
|
65
|
+
const customActionProvider = (actions) => new CustomActionProvider(Array.isArray(actions) ? actions : [actions]);
|
|
66
|
+
exports.customActionProvider = customActionProvider;
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
export declare const abi: readonly [{
|
|
2
|
+
readonly type: "event";
|
|
3
|
+
readonly name: "Approval";
|
|
4
|
+
readonly inputs: readonly [{
|
|
5
|
+
readonly indexed: true;
|
|
6
|
+
readonly name: "owner";
|
|
7
|
+
readonly type: "address";
|
|
8
|
+
}, {
|
|
9
|
+
readonly indexed: true;
|
|
10
|
+
readonly name: "spender";
|
|
11
|
+
readonly type: "address";
|
|
12
|
+
}, {
|
|
13
|
+
readonly indexed: false;
|
|
14
|
+
readonly name: "value";
|
|
15
|
+
readonly type: "uint256";
|
|
16
|
+
}];
|
|
17
|
+
}, {
|
|
18
|
+
readonly type: "event";
|
|
19
|
+
readonly name: "Transfer";
|
|
20
|
+
readonly inputs: readonly [{
|
|
21
|
+
readonly indexed: true;
|
|
22
|
+
readonly name: "from";
|
|
23
|
+
readonly type: "address";
|
|
24
|
+
}, {
|
|
25
|
+
readonly indexed: true;
|
|
26
|
+
readonly name: "to";
|
|
27
|
+
readonly type: "address";
|
|
28
|
+
}, {
|
|
29
|
+
readonly indexed: false;
|
|
30
|
+
readonly name: "value";
|
|
31
|
+
readonly type: "uint256";
|
|
32
|
+
}];
|
|
33
|
+
}, {
|
|
34
|
+
readonly type: "function";
|
|
35
|
+
readonly name: "allowance";
|
|
36
|
+
readonly stateMutability: "view";
|
|
37
|
+
readonly inputs: readonly [{
|
|
38
|
+
readonly name: "owner";
|
|
39
|
+
readonly type: "address";
|
|
40
|
+
}, {
|
|
41
|
+
readonly name: "spender";
|
|
42
|
+
readonly type: "address";
|
|
43
|
+
}];
|
|
44
|
+
readonly outputs: readonly [{
|
|
45
|
+
readonly type: "uint256";
|
|
46
|
+
}];
|
|
47
|
+
}, {
|
|
48
|
+
readonly type: "function";
|
|
49
|
+
readonly name: "approve";
|
|
50
|
+
readonly stateMutability: "nonpayable";
|
|
51
|
+
readonly inputs: readonly [{
|
|
52
|
+
readonly name: "spender";
|
|
53
|
+
readonly type: "address";
|
|
54
|
+
}, {
|
|
55
|
+
readonly name: "amount";
|
|
56
|
+
readonly type: "uint256";
|
|
57
|
+
}];
|
|
58
|
+
readonly outputs: readonly [{
|
|
59
|
+
readonly type: "bool";
|
|
60
|
+
}];
|
|
61
|
+
}, {
|
|
62
|
+
readonly type: "function";
|
|
63
|
+
readonly name: "balanceOf";
|
|
64
|
+
readonly stateMutability: "view";
|
|
65
|
+
readonly inputs: readonly [{
|
|
66
|
+
readonly name: "account";
|
|
67
|
+
readonly type: "address";
|
|
68
|
+
}];
|
|
69
|
+
readonly outputs: readonly [{
|
|
70
|
+
readonly type: "uint256";
|
|
71
|
+
}];
|
|
72
|
+
}, {
|
|
73
|
+
readonly type: "function";
|
|
74
|
+
readonly name: "decimals";
|
|
75
|
+
readonly stateMutability: "view";
|
|
76
|
+
readonly inputs: readonly [];
|
|
77
|
+
readonly outputs: readonly [{
|
|
78
|
+
readonly type: "uint8";
|
|
79
|
+
}];
|
|
80
|
+
}, {
|
|
81
|
+
readonly type: "function";
|
|
82
|
+
readonly name: "name";
|
|
83
|
+
readonly stateMutability: "view";
|
|
84
|
+
readonly inputs: readonly [];
|
|
85
|
+
readonly outputs: readonly [{
|
|
86
|
+
readonly type: "string";
|
|
87
|
+
}];
|
|
88
|
+
}, {
|
|
89
|
+
readonly type: "function";
|
|
90
|
+
readonly name: "symbol";
|
|
91
|
+
readonly stateMutability: "view";
|
|
92
|
+
readonly inputs: readonly [];
|
|
93
|
+
readonly outputs: readonly [{
|
|
94
|
+
readonly type: "string";
|
|
95
|
+
}];
|
|
96
|
+
}, {
|
|
97
|
+
readonly type: "function";
|
|
98
|
+
readonly name: "totalSupply";
|
|
99
|
+
readonly stateMutability: "view";
|
|
100
|
+
readonly inputs: readonly [];
|
|
101
|
+
readonly outputs: readonly [{
|
|
102
|
+
readonly type: "uint256";
|
|
103
|
+
}];
|
|
104
|
+
}, {
|
|
105
|
+
readonly type: "function";
|
|
106
|
+
readonly name: "transfer";
|
|
107
|
+
readonly stateMutability: "nonpayable";
|
|
108
|
+
readonly inputs: readonly [{
|
|
109
|
+
readonly name: "recipient";
|
|
110
|
+
readonly type: "address";
|
|
111
|
+
}, {
|
|
112
|
+
readonly name: "amount";
|
|
113
|
+
readonly type: "uint256";
|
|
114
|
+
}];
|
|
115
|
+
readonly outputs: readonly [{
|
|
116
|
+
readonly type: "bool";
|
|
117
|
+
}];
|
|
118
|
+
}, {
|
|
119
|
+
readonly type: "function";
|
|
120
|
+
readonly name: "transferFrom";
|
|
121
|
+
readonly stateMutability: "nonpayable";
|
|
122
|
+
readonly inputs: readonly [{
|
|
123
|
+
readonly name: "sender";
|
|
124
|
+
readonly type: "address";
|
|
125
|
+
}, {
|
|
126
|
+
readonly name: "recipient";
|
|
127
|
+
readonly type: "address";
|
|
128
|
+
}, {
|
|
129
|
+
readonly name: "amount";
|
|
130
|
+
readonly type: "uint256";
|
|
131
|
+
}];
|
|
132
|
+
readonly outputs: readonly [{
|
|
133
|
+
readonly type: "bool";
|
|
134
|
+
}];
|
|
135
|
+
}];
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.abi = void 0;
|
|
4
|
+
exports.abi = [
|
|
5
|
+
{
|
|
6
|
+
type: "event",
|
|
7
|
+
name: "Approval",
|
|
8
|
+
inputs: [
|
|
9
|
+
{
|
|
10
|
+
indexed: true,
|
|
11
|
+
name: "owner",
|
|
12
|
+
type: "address",
|
|
13
|
+
},
|
|
14
|
+
{
|
|
15
|
+
indexed: true,
|
|
16
|
+
name: "spender",
|
|
17
|
+
type: "address",
|
|
18
|
+
},
|
|
19
|
+
{
|
|
20
|
+
indexed: false,
|
|
21
|
+
name: "value",
|
|
22
|
+
type: "uint256",
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
type: "event",
|
|
28
|
+
name: "Transfer",
|
|
29
|
+
inputs: [
|
|
30
|
+
{
|
|
31
|
+
indexed: true,
|
|
32
|
+
name: "from",
|
|
33
|
+
type: "address",
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
indexed: true,
|
|
37
|
+
name: "to",
|
|
38
|
+
type: "address",
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
indexed: false,
|
|
42
|
+
name: "value",
|
|
43
|
+
type: "uint256",
|
|
44
|
+
},
|
|
45
|
+
],
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
type: "function",
|
|
49
|
+
name: "allowance",
|
|
50
|
+
stateMutability: "view",
|
|
51
|
+
inputs: [
|
|
52
|
+
{
|
|
53
|
+
name: "owner",
|
|
54
|
+
type: "address",
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
name: "spender",
|
|
58
|
+
type: "address",
|
|
59
|
+
},
|
|
60
|
+
],
|
|
61
|
+
outputs: [
|
|
62
|
+
{
|
|
63
|
+
type: "uint256",
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
type: "function",
|
|
69
|
+
name: "approve",
|
|
70
|
+
stateMutability: "nonpayable",
|
|
71
|
+
inputs: [
|
|
72
|
+
{
|
|
73
|
+
name: "spender",
|
|
74
|
+
type: "address",
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
name: "amount",
|
|
78
|
+
type: "uint256",
|
|
79
|
+
},
|
|
80
|
+
],
|
|
81
|
+
outputs: [
|
|
82
|
+
{
|
|
83
|
+
type: "bool",
|
|
84
|
+
},
|
|
85
|
+
],
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
type: "function",
|
|
89
|
+
name: "balanceOf",
|
|
90
|
+
stateMutability: "view",
|
|
91
|
+
inputs: [
|
|
92
|
+
{
|
|
93
|
+
name: "account",
|
|
94
|
+
type: "address",
|
|
95
|
+
},
|
|
96
|
+
],
|
|
97
|
+
outputs: [
|
|
98
|
+
{
|
|
99
|
+
type: "uint256",
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
},
|
|
103
|
+
{
|
|
104
|
+
type: "function",
|
|
105
|
+
name: "decimals",
|
|
106
|
+
stateMutability: "view",
|
|
107
|
+
inputs: [],
|
|
108
|
+
outputs: [
|
|
109
|
+
{
|
|
110
|
+
type: "uint8",
|
|
111
|
+
},
|
|
112
|
+
],
|
|
113
|
+
},
|
|
114
|
+
{
|
|
115
|
+
type: "function",
|
|
116
|
+
name: "name",
|
|
117
|
+
stateMutability: "view",
|
|
118
|
+
inputs: [],
|
|
119
|
+
outputs: [
|
|
120
|
+
{
|
|
121
|
+
type: "string",
|
|
122
|
+
},
|
|
123
|
+
],
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
type: "function",
|
|
127
|
+
name: "symbol",
|
|
128
|
+
stateMutability: "view",
|
|
129
|
+
inputs: [],
|
|
130
|
+
outputs: [
|
|
131
|
+
{
|
|
132
|
+
type: "string",
|
|
133
|
+
},
|
|
134
|
+
],
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
type: "function",
|
|
138
|
+
name: "totalSupply",
|
|
139
|
+
stateMutability: "view",
|
|
140
|
+
inputs: [],
|
|
141
|
+
outputs: [
|
|
142
|
+
{
|
|
143
|
+
type: "uint256",
|
|
144
|
+
},
|
|
145
|
+
],
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
type: "function",
|
|
149
|
+
name: "transfer",
|
|
150
|
+
stateMutability: "nonpayable",
|
|
151
|
+
inputs: [
|
|
152
|
+
{
|
|
153
|
+
name: "recipient",
|
|
154
|
+
type: "address",
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
name: "amount",
|
|
158
|
+
type: "uint256",
|
|
159
|
+
},
|
|
160
|
+
],
|
|
161
|
+
outputs: [
|
|
162
|
+
{
|
|
163
|
+
type: "bool",
|
|
164
|
+
},
|
|
165
|
+
],
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
type: "function",
|
|
169
|
+
name: "transferFrom",
|
|
170
|
+
stateMutability: "nonpayable",
|
|
171
|
+
inputs: [
|
|
172
|
+
{
|
|
173
|
+
name: "sender",
|
|
174
|
+
type: "address",
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
name: "recipient",
|
|
178
|
+
type: "address",
|
|
179
|
+
},
|
|
180
|
+
{
|
|
181
|
+
name: "amount",
|
|
182
|
+
type: "uint256",
|
|
183
|
+
},
|
|
184
|
+
],
|
|
185
|
+
outputs: [
|
|
186
|
+
{
|
|
187
|
+
type: "bool",
|
|
188
|
+
},
|
|
189
|
+
],
|
|
190
|
+
},
|
|
191
|
+
];
|