@coinbase/agentkit 0.10.0 → 0.10.1
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 +75 -0
- package/dist/action-providers/across/acrossActionProvider.js +3 -3
- package/dist/action-providers/cdp/cdpApiActionProvider.d.ts +3 -12
- package/dist/action-providers/cdp/cdpApiActionProvider.js +2 -81
- package/dist/action-providers/cdp/cdpApiActionProvider.test.js +0 -125
- package/dist/action-providers/cdp/cdpEvmWalletActionProvider.d.ts +18 -3
- package/dist/action-providers/cdp/cdpEvmWalletActionProvider.js +223 -23
- package/dist/action-providers/cdp/cdpEvmWalletActionProvider.test.js +278 -0
- package/dist/action-providers/cdp/cdpSmartWalletActionProvider.d.ts +17 -2
- package/dist/action-providers/cdp/cdpSmartWalletActionProvider.js +223 -18
- package/dist/action-providers/cdp/cdpSmartWalletActionProvider.test.js +265 -1
- package/dist/action-providers/cdp/schemas.d.ts +12 -12
- package/dist/action-providers/cdp/schemas.js +17 -5
- package/dist/action-providers/cdp/swapUtils.d.ts +32 -0
- package/dist/action-providers/cdp/swapUtils.js +142 -0
- package/dist/action-providers/clanker/clankerActionProvider.d.ts +43 -0
- package/dist/action-providers/clanker/clankerActionProvider.js +130 -0
- package/dist/action-providers/clanker/clankerActionProvider.test.d.ts +4 -0
- package/dist/action-providers/clanker/clankerActionProvider.test.js +119 -0
- package/dist/action-providers/clanker/index.d.ts +2 -0
- package/dist/action-providers/clanker/index.js +18 -0
- package/dist/action-providers/clanker/schemas.d.ts +56 -0
- package/dist/action-providers/clanker/schemas.js +47 -0
- package/dist/action-providers/clanker/utils.d.ts +9 -0
- package/dist/action-providers/clanker/utils.js +23 -0
- package/dist/action-providers/compound/constants.d.ts +1 -1
- package/dist/action-providers/compound/constants.js +2 -2
- package/dist/action-providers/erc20/constants.d.ts +35 -135
- package/dist/action-providers/erc20/constants.js +37 -189
- package/dist/action-providers/erc20/erc20ActionProvider.d.ts +9 -1
- package/dist/action-providers/erc20/erc20ActionProvider.js +87 -35
- package/dist/action-providers/erc20/erc20ActionProvider.test.js +115 -52
- package/dist/action-providers/erc20/schemas.d.ts +25 -12
- package/dist/action-providers/erc20/schemas.js +34 -6
- package/dist/action-providers/erc20/utils.d.ts +19 -0
- package/dist/action-providers/erc20/utils.js +54 -0
- package/dist/action-providers/flaunch/constants.d.ts +1 -1
- package/dist/action-providers/flaunch/constants.js +2 -2
- package/dist/action-providers/flaunch/flaunchActionProvider.js +3 -11
- package/dist/action-providers/flaunch/flaunchActionProvider.test.js +5 -0
- package/dist/action-providers/index.d.ts +3 -0
- package/dist/action-providers/index.js +3 -0
- package/dist/action-providers/jupiter/schemas.d.ts +1 -1
- package/dist/action-providers/moonwell/schemas.d.ts +2 -2
- package/dist/action-providers/morpho/morphoActionProvider.js +5 -5
- package/dist/action-providers/morpho/schemas.d.ts +2 -2
- package/dist/action-providers/pyth/pythActionProvider.js +5 -0
- package/dist/action-providers/pyth/pythActionProvider.test.js +5 -1
- package/dist/action-providers/superfluid/constants.d.ts +814 -0
- package/dist/action-providers/superfluid/constants.js +2826 -0
- package/dist/action-providers/superfluid/graphQueries/endpoints.d.ts +2 -0
- package/dist/action-providers/superfluid/graphQueries/endpoints.js +5 -0
- package/dist/action-providers/superfluid/graphQueries/queries.d.ts +1 -0
- package/dist/action-providers/superfluid/graphQueries/queries.js +35 -0
- package/dist/action-providers/superfluid/graphQueries/superfluidGraphQueries.d.ts +8 -0
- package/dist/action-providers/superfluid/graphQueries/superfluidGraphQueries.js +24 -0
- package/dist/action-providers/superfluid/graphQueries/types.d.ts +27 -0
- package/dist/action-providers/superfluid/graphQueries/types.js +2 -0
- package/dist/action-providers/superfluid/index.d.ts +7 -0
- package/dist/action-providers/superfluid/index.js +23 -0
- package/dist/action-providers/superfluid/schemas.d.ts +86 -0
- package/dist/action-providers/superfluid/schemas.js +103 -0
- package/dist/action-providers/superfluid/superfluidActionProvider.d.ts +20 -0
- package/dist/action-providers/superfluid/superfluidActionProvider.js +36 -0
- package/dist/action-providers/superfluid/superfluidPoolActionProvider.d.ts +46 -0
- package/dist/action-providers/superfluid/superfluidPoolActionProvider.js +143 -0
- package/dist/action-providers/superfluid/superfluidPoolActionProvider.test.d.ts +1 -0
- package/dist/action-providers/superfluid/superfluidPoolActionProvider.test.js +92 -0
- package/dist/action-providers/superfluid/superfluidQueryActionProvider.d.ts +27 -0
- package/dist/action-providers/superfluid/superfluidQueryActionProvider.js +71 -0
- package/dist/action-providers/superfluid/superfluidQueryActionProvider.test.d.ts +1 -0
- package/dist/action-providers/superfluid/superfluidQueryActionProvider.test.js +57 -0
- package/dist/action-providers/superfluid/superfluidStreamActionProvider.d.ts +56 -0
- package/dist/action-providers/superfluid/superfluidStreamActionProvider.js +191 -0
- package/dist/action-providers/superfluid/superfluidStreamActionProvider.test.d.ts +1 -0
- package/dist/action-providers/superfluid/superfluidStreamActionProvider.test.js +80 -0
- package/dist/action-providers/superfluid/superfluidSuperTokenCreatorActionProvider.d.ts +30 -0
- package/dist/action-providers/superfluid/superfluidSuperTokenCreatorActionProvider.js +108 -0
- package/dist/action-providers/superfluid/superfluidSuperTokenCreatorActionProvider.test.d.ts +1 -0
- package/dist/action-providers/superfluid/superfluidSuperTokenCreatorActionProvider.test.js +75 -0
- package/dist/action-providers/superfluid/superfluidWrapperActionProvider.d.ts +32 -0
- package/dist/action-providers/superfluid/superfluidWrapperActionProvider.js +101 -0
- package/dist/action-providers/superfluid/superfluidWrapperActionProvider.test.d.ts +1 -0
- package/dist/action-providers/superfluid/superfluidWrapperActionProvider.test.js +85 -0
- package/dist/action-providers/superfluid/utils/parseLogs.d.ts +18 -0
- package/dist/action-providers/superfluid/utils/parseLogs.js +78 -0
- package/dist/action-providers/truemarkets/truemarketsActionProvider.d.ts +4 -16
- package/dist/action-providers/truemarkets/truemarketsActionProvider.js +20 -41
- package/dist/action-providers/truemarkets/truemarketsActionProvider.test.js +11 -33
- package/dist/action-providers/wallet/walletActionProvider.js +21 -10
- package/dist/action-providers/wallet/walletActionProvider.test.js +6 -2
- package/dist/action-providers/zeroX/index.d.ts +1 -0
- package/dist/action-providers/zeroX/index.js +17 -0
- package/dist/action-providers/zeroX/schemas.d.ts +51 -0
- package/dist/action-providers/zeroX/schemas.js +82 -0
- package/dist/action-providers/zeroX/utils.d.ts +23 -0
- package/dist/action-providers/zeroX/utils.js +106 -0
- package/dist/action-providers/zeroX/zeroXActionProvider.d.ts +57 -0
- package/dist/action-providers/zeroX/zeroXActionProvider.js +407 -0
- package/dist/action-providers/zeroX/zeroXActionProvider.test.d.ts +1 -0
- package/dist/action-providers/zeroX/zeroXActionProvider.test.js +445 -0
- package/dist/wallet-providers/cdpEvmWalletProvider.d.ts +20 -2
- package/dist/wallet-providers/cdpEvmWalletProvider.js +40 -15
- package/dist/wallet-providers/cdpShared.d.ts +5 -0
- package/dist/wallet-providers/cdpSmartWalletProvider.d.ts +22 -3
- package/dist/wallet-providers/cdpSmartWalletProvider.js +43 -19
- package/dist/wallet-providers/cdpSolanaWalletProvider.d.ts +1 -1
- package/dist/wallet-providers/cdpSolanaWalletProvider.js +7 -7
- package/dist/wallet-providers/cdpSolanaWalletProvider.test.js +15 -12
- package/dist/wallet-providers/evmWalletProvider.d.ts +5 -1
- package/dist/wallet-providers/legacyCdpSmartWalletProvider.d.ts +9 -2
- package/dist/wallet-providers/legacyCdpSmartWalletProvider.js +12 -2
- package/dist/wallet-providers/legacyCdpWalletProvider.d.ts +12 -2
- package/dist/wallet-providers/legacyCdpWalletProvider.js +11 -2
- package/dist/wallet-providers/privyEvmDelegatedEmbeddedWalletProvider.d.ts +10 -2
- package/dist/wallet-providers/privyEvmDelegatedEmbeddedWalletProvider.js +12 -3
- package/dist/wallet-providers/privyEvmDelegatedEmbeddedWalletProvider.test.js +1 -1
- package/dist/wallet-providers/privyEvmWalletProvider.d.ts +2 -0
- package/dist/wallet-providers/privyEvmWalletProvider.js +2 -1
- package/dist/wallet-providers/privyEvmWalletProvider.test.js +1 -1
- package/dist/wallet-providers/solanaKeypairWalletProvider.d.ts +1 -1
- package/dist/wallet-providers/solanaKeypairWalletProvider.js +3 -4
- package/dist/wallet-providers/solanaKeypairWalletProvider.test.js +4 -2
- package/dist/wallet-providers/viemWalletProvider.d.ts +12 -2
- package/dist/wallet-providers/viemWalletProvider.js +12 -3
- package/dist/wallet-providers/viemWalletProvider.test.js +6 -5
- package/dist/wallet-providers/walletProvider.d.ts +1 -1
- package/dist/wallet-providers/zeroDevWalletProvider.d.ts +10 -2
- package/dist/wallet-providers/zeroDevWalletProvider.js +14 -5
- package/dist/wallet-providers/zeroDevWalletProvider.test.js +2 -2
- package/package.json +4 -2
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.BASE_SEPOLIA_GRAPH_ENDPOINT = exports.BASE_GRAPH_ENDPOINT = void 0;
|
|
4
|
+
exports.BASE_GRAPH_ENDPOINT = "https://subgraph-endpoints.superfluid.dev/base-mainnet/protocol-v1";
|
|
5
|
+
exports.BASE_SEPOLIA_GRAPH_ENDPOINT = "https://subgraph-endpoints.superfluid.dev/base-sepolia/protocol-v1";
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getAccountOutflowQuery = "\n query GetAccountData($id: ID!) {\n accounts(where: { id: $id }) {\n isSuperApp\n inflows {\n currentFlowRate\n token {\n symbol\n }\n sender {\n id\n }\n }\n outflows {\n currentFlowRate\n token {\n symbol\n }\n receiver {\n id\n }\n }\n accountTokenSnapshots {\n token {\n id\n }\n totalNumberOfActiveStreams\n totalNetFlowRate\n }\n }\n }\n";
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAccountOutflowQuery = void 0;
|
|
4
|
+
exports.getAccountOutflowQuery = `
|
|
5
|
+
query GetAccountData($id: ID!) {
|
|
6
|
+
accounts(where: { id: $id }) {
|
|
7
|
+
isSuperApp
|
|
8
|
+
inflows {
|
|
9
|
+
currentFlowRate
|
|
10
|
+
token {
|
|
11
|
+
symbol
|
|
12
|
+
}
|
|
13
|
+
sender {
|
|
14
|
+
id
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
outflows {
|
|
18
|
+
currentFlowRate
|
|
19
|
+
token {
|
|
20
|
+
symbol
|
|
21
|
+
}
|
|
22
|
+
receiver {
|
|
23
|
+
id
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
accountTokenSnapshots {
|
|
27
|
+
token {
|
|
28
|
+
id
|
|
29
|
+
}
|
|
30
|
+
totalNumberOfActiveStreams
|
|
31
|
+
totalNetFlowRate
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
`;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { SuperfluidAccountResponse } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Gets the current account outflows for the user
|
|
4
|
+
*
|
|
5
|
+
* @param userId - The user id of the account
|
|
6
|
+
* @returns The data on the current streams from the agent
|
|
7
|
+
*/
|
|
8
|
+
export declare function getAccountOutflow(userId: string): Promise<SuperfluidAccountResponse | undefined>;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAccountOutflow = getAccountOutflow;
|
|
4
|
+
const queries_1 = require("./queries");
|
|
5
|
+
const endpoints_1 = require("./endpoints");
|
|
6
|
+
/**
|
|
7
|
+
* Gets the current account outflows for the user
|
|
8
|
+
*
|
|
9
|
+
* @param userId - The user id of the account
|
|
10
|
+
* @returns The data on the current streams from the agent
|
|
11
|
+
*/
|
|
12
|
+
async function getAccountOutflow(userId) {
|
|
13
|
+
try {
|
|
14
|
+
const { GraphQLClient } = await import("graphql-request");
|
|
15
|
+
const client = new GraphQLClient(endpoints_1.BASE_GRAPH_ENDPOINT);
|
|
16
|
+
const variables = { id: userId.toLowerCase() };
|
|
17
|
+
const data = await client.request(queries_1.getAccountOutflowQuery, variables);
|
|
18
|
+
return data;
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
console.error("Error fetching account data:", error);
|
|
22
|
+
return undefined;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
export type SuperfluidAccountResponse = {
|
|
2
|
+
accounts: Account[];
|
|
3
|
+
};
|
|
4
|
+
type Account = {
|
|
5
|
+
isSuperApp: boolean;
|
|
6
|
+
inflows: Flow[];
|
|
7
|
+
outflows: Flow[];
|
|
8
|
+
accountTokenSnapshots: AccountTokenSnapshot[];
|
|
9
|
+
};
|
|
10
|
+
type Flow = {
|
|
11
|
+
currentFlowRate: string;
|
|
12
|
+
token: Token;
|
|
13
|
+
receiver: Receiver;
|
|
14
|
+
};
|
|
15
|
+
type Token = {
|
|
16
|
+
symbol?: string;
|
|
17
|
+
id?: string;
|
|
18
|
+
};
|
|
19
|
+
type Receiver = {
|
|
20
|
+
id: string;
|
|
21
|
+
};
|
|
22
|
+
type AccountTokenSnapshot = {
|
|
23
|
+
token: Token;
|
|
24
|
+
totalNumberOfActiveStreams: number;
|
|
25
|
+
totalNetFlowRate: string;
|
|
26
|
+
};
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from "./schemas";
|
|
2
|
+
export * from "./superfluidStreamActionProvider";
|
|
3
|
+
export * from "./superfluidPoolActionProvider";
|
|
4
|
+
export * from "./superfluidQueryActionProvider";
|
|
5
|
+
export * from "./superfluidWrapperActionProvider";
|
|
6
|
+
export * from "./superfluidSuperTokenCreatorActionProvider";
|
|
7
|
+
export * from "./superfluidActionProvider";
|
|
@@ -0,0 +1,23 @@
|
|
|
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("./superfluidStreamActionProvider"), exports);
|
|
19
|
+
__exportStar(require("./superfluidPoolActionProvider"), exports);
|
|
20
|
+
__exportStar(require("./superfluidQueryActionProvider"), exports);
|
|
21
|
+
__exportStar(require("./superfluidWrapperActionProvider"), exports);
|
|
22
|
+
__exportStar(require("./superfluidSuperTokenCreatorActionProvider"), exports);
|
|
23
|
+
__exportStar(require("./superfluidActionProvider"), exports);
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Input schema for creating a Superfluid stream
|
|
4
|
+
*/
|
|
5
|
+
export declare const SuperfluidCreateStreamSchema: z.ZodObject<{
|
|
6
|
+
superTokenAddress: z.ZodString;
|
|
7
|
+
recipientAddress: z.ZodString;
|
|
8
|
+
flowRate: z.ZodString;
|
|
9
|
+
}, "strip", z.ZodTypeAny, {
|
|
10
|
+
superTokenAddress: string;
|
|
11
|
+
recipientAddress: string;
|
|
12
|
+
flowRate: string;
|
|
13
|
+
}, {
|
|
14
|
+
superTokenAddress: string;
|
|
15
|
+
recipientAddress: string;
|
|
16
|
+
flowRate: string;
|
|
17
|
+
}>;
|
|
18
|
+
/**
|
|
19
|
+
* Input schema for deleting a Superfluid stream
|
|
20
|
+
*/
|
|
21
|
+
export declare const SuperfluidDeleteStreamSchema: z.ZodObject<{
|
|
22
|
+
superTokenAddress: z.ZodString;
|
|
23
|
+
recipientAddress: z.ZodString;
|
|
24
|
+
}, "strip", z.ZodTypeAny, {
|
|
25
|
+
superTokenAddress: string;
|
|
26
|
+
recipientAddress: string;
|
|
27
|
+
}, {
|
|
28
|
+
superTokenAddress: string;
|
|
29
|
+
recipientAddress: string;
|
|
30
|
+
}>;
|
|
31
|
+
/**
|
|
32
|
+
* Input schema for creating a Superfluid pool
|
|
33
|
+
*/
|
|
34
|
+
export declare const SuperfluidCreatePoolSchema: z.ZodObject<{
|
|
35
|
+
superTokenAddress: z.ZodString;
|
|
36
|
+
}, "strip", z.ZodTypeAny, {
|
|
37
|
+
superTokenAddress: string;
|
|
38
|
+
}, {
|
|
39
|
+
superTokenAddress: string;
|
|
40
|
+
}>;
|
|
41
|
+
/**
|
|
42
|
+
* Input schema for updating a Superfluid pool
|
|
43
|
+
*/
|
|
44
|
+
export declare const SuperfluidUpdatePoolSchema: z.ZodObject<{
|
|
45
|
+
poolAddress: z.ZodString;
|
|
46
|
+
recipientAddress: z.ZodString;
|
|
47
|
+
units: z.ZodNumber;
|
|
48
|
+
}, "strip", z.ZodTypeAny, {
|
|
49
|
+
recipientAddress: string;
|
|
50
|
+
poolAddress: string;
|
|
51
|
+
units: number;
|
|
52
|
+
}, {
|
|
53
|
+
recipientAddress: string;
|
|
54
|
+
poolAddress: string;
|
|
55
|
+
units: number;
|
|
56
|
+
}>;
|
|
57
|
+
/**
|
|
58
|
+
* Input schema for wrapping a Superfluid token
|
|
59
|
+
*/
|
|
60
|
+
export declare const SuperfluidWrapTokenSchema: z.ZodObject<{
|
|
61
|
+
erc20TokenAddress: z.ZodString;
|
|
62
|
+
superTokenAddress: z.ZodString;
|
|
63
|
+
wrapAmount: z.ZodNumber;
|
|
64
|
+
}, "strip", z.ZodTypeAny, {
|
|
65
|
+
superTokenAddress: string;
|
|
66
|
+
erc20TokenAddress: string;
|
|
67
|
+
wrapAmount: number;
|
|
68
|
+
}, {
|
|
69
|
+
superTokenAddress: string;
|
|
70
|
+
erc20TokenAddress: string;
|
|
71
|
+
wrapAmount: number;
|
|
72
|
+
}>;
|
|
73
|
+
/**
|
|
74
|
+
* Input schema for creating a Super Token
|
|
75
|
+
*/
|
|
76
|
+
export declare const SuperfluidCreateSuperTokenSchema: z.ZodObject<{
|
|
77
|
+
erc20TokenAddress: z.ZodString;
|
|
78
|
+
}, "strip", z.ZodTypeAny, {
|
|
79
|
+
erc20TokenAddress: string;
|
|
80
|
+
}, {
|
|
81
|
+
erc20TokenAddress: string;
|
|
82
|
+
}>;
|
|
83
|
+
/**
|
|
84
|
+
* Empty input schema used for Query action
|
|
85
|
+
*/
|
|
86
|
+
export declare const EmptySchema: z.ZodObject<{}, "strip", z.ZodTypeAny, {}, {}>;
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EmptySchema = exports.SuperfluidCreateSuperTokenSchema = exports.SuperfluidWrapTokenSchema = exports.SuperfluidUpdatePoolSchema = exports.SuperfluidCreatePoolSchema = exports.SuperfluidDeleteStreamSchema = exports.SuperfluidCreateStreamSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
/**
|
|
6
|
+
* Input schema for creating a Superfluid stream
|
|
7
|
+
*/
|
|
8
|
+
exports.SuperfluidCreateStreamSchema = zod_1.z
|
|
9
|
+
.object({
|
|
10
|
+
superTokenAddress: zod_1.z
|
|
11
|
+
.string()
|
|
12
|
+
.regex(/^0x[a-fA-F0-9]{40}$/, "Invalid Ethereum address format")
|
|
13
|
+
.describe("The ERC20 Super token to start or update streaming"),
|
|
14
|
+
recipientAddress: zod_1.z
|
|
15
|
+
.string()
|
|
16
|
+
.regex(/^0x[a-fA-F0-9]{40}$/, "Invalid Ethereum address format")
|
|
17
|
+
.describe("The EVM address to stream the token to."),
|
|
18
|
+
flowRate: zod_1.z
|
|
19
|
+
.string()
|
|
20
|
+
.describe("The rate at which the ERC20 is streamed to the recipient, in wei per second."),
|
|
21
|
+
})
|
|
22
|
+
.strip()
|
|
23
|
+
.describe("Input schema for creating or updating a Superfluid stream");
|
|
24
|
+
/**
|
|
25
|
+
* Input schema for deleting a Superfluid stream
|
|
26
|
+
*/
|
|
27
|
+
exports.SuperfluidDeleteStreamSchema = zod_1.z
|
|
28
|
+
.object({
|
|
29
|
+
superTokenAddress: zod_1.z
|
|
30
|
+
.string()
|
|
31
|
+
.regex(/^0x[a-fA-F0-9]{40}$/, "Invalid Ethereum address format")
|
|
32
|
+
.describe("The ERC20 Super Token to start streaming"),
|
|
33
|
+
recipientAddress: zod_1.z
|
|
34
|
+
.string()
|
|
35
|
+
.regex(/^0x[a-fA-F0-9]{40}$/, "Invalid Ethereum address format")
|
|
36
|
+
.describe("The EVM address to stream the token to."),
|
|
37
|
+
})
|
|
38
|
+
.strip()
|
|
39
|
+
.describe("Input schema for creating a Superfluid stream");
|
|
40
|
+
/**
|
|
41
|
+
* Input schema for creating a Superfluid pool
|
|
42
|
+
*/
|
|
43
|
+
exports.SuperfluidCreatePoolSchema = zod_1.z
|
|
44
|
+
.object({
|
|
45
|
+
superTokenAddress: zod_1.z
|
|
46
|
+
.string()
|
|
47
|
+
.regex(/^0x[a-fA-F0-9]{40}$/, "Invalid Ethereum address format")
|
|
48
|
+
.describe("The ERC20 Super token for which to create a pool"),
|
|
49
|
+
})
|
|
50
|
+
.strip()
|
|
51
|
+
.describe("Input schema for creating a Superfluid pool");
|
|
52
|
+
/**
|
|
53
|
+
* Input schema for updating a Superfluid pool
|
|
54
|
+
*/
|
|
55
|
+
exports.SuperfluidUpdatePoolSchema = zod_1.z
|
|
56
|
+
.object({
|
|
57
|
+
poolAddress: zod_1.z
|
|
58
|
+
.string()
|
|
59
|
+
.regex(/^0x[a-fA-F0-9]{40}$/, "Invalid Ethereum address format")
|
|
60
|
+
.describe("The EVM address of the token pool"),
|
|
61
|
+
recipientAddress: zod_1.z
|
|
62
|
+
.string()
|
|
63
|
+
.regex(/^0x[a-fA-F0-9]{40}$/, "Invalid Ethereum address format")
|
|
64
|
+
.describe("The EVM address to stream the token to, from the pool."),
|
|
65
|
+
units: zod_1.z.number().describe("The new units of the recipient in the pool."),
|
|
66
|
+
})
|
|
67
|
+
.strip()
|
|
68
|
+
.describe("Input schema for updating a Superfluid pool");
|
|
69
|
+
/**
|
|
70
|
+
* Input schema for wrapping a Superfluid token
|
|
71
|
+
*/
|
|
72
|
+
exports.SuperfluidWrapTokenSchema = zod_1.z
|
|
73
|
+
.object({
|
|
74
|
+
erc20TokenAddress: zod_1.z
|
|
75
|
+
.string()
|
|
76
|
+
.regex(/^0x[a-fA-F0-9]{40}$/, "Invalid Ethereum address format")
|
|
77
|
+
.describe("The ERC20 token to wrap"),
|
|
78
|
+
superTokenAddress: zod_1.z
|
|
79
|
+
.string()
|
|
80
|
+
.regex(/^0x[a-fA-F0-9]{40}$/, "Invalid Ethereum address format")
|
|
81
|
+
.describe("The token to wrap to"),
|
|
82
|
+
wrapAmount: zod_1.z
|
|
83
|
+
.number()
|
|
84
|
+
.describe("The amount of tokens to wrap in whole units (e.g. 1.5 WETH, 10 USDC)"),
|
|
85
|
+
})
|
|
86
|
+
.strip()
|
|
87
|
+
.describe("Input schema for updating a Superfluid pool");
|
|
88
|
+
/**
|
|
89
|
+
* Input schema for creating a Super Token
|
|
90
|
+
*/
|
|
91
|
+
exports.SuperfluidCreateSuperTokenSchema = zod_1.z
|
|
92
|
+
.object({
|
|
93
|
+
erc20TokenAddress: zod_1.z
|
|
94
|
+
.string()
|
|
95
|
+
.regex(/^0x[a-fA-F0-9]{40}$/, "Invalid Ethereum address format")
|
|
96
|
+
.describe("The underlying ERC20 token"),
|
|
97
|
+
})
|
|
98
|
+
.strip()
|
|
99
|
+
.describe("Input schema for creating a Super Token");
|
|
100
|
+
/**
|
|
101
|
+
* Empty input schema used for Query action
|
|
102
|
+
*/
|
|
103
|
+
exports.EmptySchema = zod_1.z.object({}).strip().describe("Empty input schema");
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ActionProvider } from "../actionProvider";
|
|
2
|
+
import { EvmWalletProvider } from "../../wallet-providers";
|
|
3
|
+
import { Network } from "../../network";
|
|
4
|
+
/**
|
|
5
|
+
* SuperfluidActionProvider aggregates all Superfluid-related actions into a single provider.
|
|
6
|
+
*/
|
|
7
|
+
export declare class SuperfluidActionProvider extends ActionProvider<EvmWalletProvider> {
|
|
8
|
+
/**
|
|
9
|
+
* Superfluid Action Provider constructor
|
|
10
|
+
*/
|
|
11
|
+
constructor();
|
|
12
|
+
/**
|
|
13
|
+
* Supports Base mainnet and Base sepolia like the underlying Superfluid providers.
|
|
14
|
+
*
|
|
15
|
+
* @param network - network to check
|
|
16
|
+
* @returns - A boolean if this action provider supports the network
|
|
17
|
+
*/
|
|
18
|
+
supportsNetwork: (network: Network) => boolean;
|
|
19
|
+
}
|
|
20
|
+
export declare const superfluidActionProvider: () => SuperfluidActionProvider;
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.superfluidActionProvider = exports.SuperfluidActionProvider = void 0;
|
|
4
|
+
const actionProvider_1 = require("../actionProvider");
|
|
5
|
+
const superfluidStreamActionProvider_1 = require("./superfluidStreamActionProvider");
|
|
6
|
+
const superfluidPoolActionProvider_1 = require("./superfluidPoolActionProvider");
|
|
7
|
+
const superfluidQueryActionProvider_1 = require("./superfluidQueryActionProvider");
|
|
8
|
+
const superfluidWrapperActionProvider_1 = require("./superfluidWrapperActionProvider");
|
|
9
|
+
const superfluidSuperTokenCreatorActionProvider_1 = require("./superfluidSuperTokenCreatorActionProvider");
|
|
10
|
+
/**
|
|
11
|
+
* SuperfluidActionProvider aggregates all Superfluid-related actions into a single provider.
|
|
12
|
+
*/
|
|
13
|
+
class SuperfluidActionProvider extends actionProvider_1.ActionProvider {
|
|
14
|
+
/**
|
|
15
|
+
* Superfluid Action Provider constructor
|
|
16
|
+
*/
|
|
17
|
+
constructor() {
|
|
18
|
+
super("superfluid", [
|
|
19
|
+
new superfluidStreamActionProvider_1.SuperfluidStreamActionProvider(),
|
|
20
|
+
new superfluidPoolActionProvider_1.SuperfluidPoolActionProvider(),
|
|
21
|
+
new superfluidQueryActionProvider_1.SuperfluidQueryActionProvider(),
|
|
22
|
+
new superfluidWrapperActionProvider_1.SuperfluidWrapperActionProvider(),
|
|
23
|
+
new superfluidSuperTokenCreatorActionProvider_1.SuperfluidSuperTokenCreatorActionProvider(),
|
|
24
|
+
]);
|
|
25
|
+
/**
|
|
26
|
+
* Supports Base mainnet and Base sepolia like the underlying Superfluid providers.
|
|
27
|
+
*
|
|
28
|
+
* @param network - network to check
|
|
29
|
+
* @returns - A boolean if this action provider supports the network
|
|
30
|
+
*/
|
|
31
|
+
this.supportsNetwork = (network) => network.networkId === "base-mainnet" || network.networkId === "base-sepolia";
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
exports.SuperfluidActionProvider = SuperfluidActionProvider;
|
|
35
|
+
const superfluidActionProvider = () => new SuperfluidActionProvider();
|
|
36
|
+
exports.superfluidActionProvider = superfluidActionProvider;
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { SuperfluidCreatePoolSchema, SuperfluidUpdatePoolSchema } from "./schemas";
|
|
3
|
+
import { ActionProvider } from "../actionProvider";
|
|
4
|
+
import { Network } from "../../network";
|
|
5
|
+
import { EvmWalletProvider } from "../../wallet-providers";
|
|
6
|
+
export type CreatePoolArgs = readonly [
|
|
7
|
+
token: `0x${string}`,
|
|
8
|
+
admin: `0x${string}`,
|
|
9
|
+
config: {
|
|
10
|
+
transferabilityForUnitsOwner: boolean;
|
|
11
|
+
distributionFromAnyAddress: boolean;
|
|
12
|
+
}
|
|
13
|
+
];
|
|
14
|
+
/**
|
|
15
|
+
* SuperfluidPoolActionProvider is an action provider for Superfluid interactions.
|
|
16
|
+
*/
|
|
17
|
+
export declare class SuperfluidPoolActionProvider extends ActionProvider<EvmWalletProvider> {
|
|
18
|
+
/**
|
|
19
|
+
* Constructor for the SuperfluidPoolActionProvider class.
|
|
20
|
+
*/
|
|
21
|
+
constructor();
|
|
22
|
+
/**
|
|
23
|
+
* Creates a pool from the agent wallet to the recipient
|
|
24
|
+
*
|
|
25
|
+
* @param walletProvider - The wallet provider to start the pool from.
|
|
26
|
+
* @param args - The input arguments for the action.
|
|
27
|
+
* @returns A JSON string containing the account details or error message
|
|
28
|
+
*/
|
|
29
|
+
createPool(walletProvider: EvmWalletProvider, args: z.infer<typeof SuperfluidCreatePoolSchema>): Promise<string>;
|
|
30
|
+
/**
|
|
31
|
+
* Updates member units for a pool
|
|
32
|
+
*
|
|
33
|
+
* @param walletProvider - The wallet provider to start the pool from.
|
|
34
|
+
* @param args - The input arguments for the action.
|
|
35
|
+
* @returns A JSON string containing the account details or error message
|
|
36
|
+
*/
|
|
37
|
+
updatePool(walletProvider: EvmWalletProvider, args: z.infer<typeof SuperfluidUpdatePoolSchema>): Promise<string>;
|
|
38
|
+
/**
|
|
39
|
+
* Checks if the Superfluid action provider supports the given network.
|
|
40
|
+
*
|
|
41
|
+
* @param network - The network to check.
|
|
42
|
+
* @returns True if the Superfluid action provider supports the network, false otherwise.
|
|
43
|
+
*/
|
|
44
|
+
supportsNetwork: (network: Network) => boolean;
|
|
45
|
+
}
|
|
46
|
+
export declare const superfluidPoolActionProvider: () => SuperfluidPoolActionProvider;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
+
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
+
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
+
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;
|
|
6
|
+
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
+
};
|
|
8
|
+
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
+
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
+
};
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.superfluidPoolActionProvider = exports.SuperfluidPoolActionProvider = void 0;
|
|
13
|
+
const zod_1 = require("zod");
|
|
14
|
+
const schemas_1 = require("./schemas");
|
|
15
|
+
const constants_1 = require("./constants");
|
|
16
|
+
const viem_1 = require("viem");
|
|
17
|
+
const actionProvider_1 = require("../actionProvider");
|
|
18
|
+
const wallet_providers_1 = require("../../wallet-providers");
|
|
19
|
+
const actionDecorator_1 = require("../actionDecorator");
|
|
20
|
+
/**
|
|
21
|
+
* SuperfluidPoolActionProvider is an action provider for Superfluid interactions.
|
|
22
|
+
*/
|
|
23
|
+
class SuperfluidPoolActionProvider extends actionProvider_1.ActionProvider {
|
|
24
|
+
/**
|
|
25
|
+
* Constructor for the SuperfluidPoolActionProvider class.
|
|
26
|
+
*/
|
|
27
|
+
constructor() {
|
|
28
|
+
super("superfluid-pool", []);
|
|
29
|
+
/**
|
|
30
|
+
* Checks if the Superfluid action provider supports the given network.
|
|
31
|
+
*
|
|
32
|
+
* @param network - The network to check.
|
|
33
|
+
* @returns True if the Superfluid action provider supports the network, false otherwise.
|
|
34
|
+
*/
|
|
35
|
+
this.supportsNetwork = (network) => network.networkId === "base-mainnet" || network.networkId === "base-sepolia";
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Creates a pool from the agent wallet to the recipient
|
|
39
|
+
*
|
|
40
|
+
* @param walletProvider - The wallet provider to start the pool from.
|
|
41
|
+
* @param args - The input arguments for the action.
|
|
42
|
+
* @returns A JSON string containing the account details or error message
|
|
43
|
+
*/
|
|
44
|
+
async createPool(walletProvider, args) {
|
|
45
|
+
try {
|
|
46
|
+
const config = {
|
|
47
|
+
transferabilityForUnitsOwner: false,
|
|
48
|
+
distributionFromAnyAddress: false,
|
|
49
|
+
};
|
|
50
|
+
const createArgs = [
|
|
51
|
+
args.superTokenAddress,
|
|
52
|
+
walletProvider.getAddress(),
|
|
53
|
+
config,
|
|
54
|
+
];
|
|
55
|
+
const data = (0, viem_1.encodeFunctionData)({
|
|
56
|
+
abi: constants_1.GDAv1ForwarderABI,
|
|
57
|
+
functionName: "createPool",
|
|
58
|
+
args: createArgs,
|
|
59
|
+
});
|
|
60
|
+
const publicClient = walletProvider.getPublicClient();
|
|
61
|
+
// We don't get contract call results, so we need to simulate to get the pool address
|
|
62
|
+
const { result } = await publicClient.simulateContract({
|
|
63
|
+
address: constants_1.GDAv1ForwarderAddress,
|
|
64
|
+
abi: constants_1.GDAv1ForwarderABI,
|
|
65
|
+
functionName: "createPool",
|
|
66
|
+
args: createArgs,
|
|
67
|
+
account: walletProvider.getAddress(),
|
|
68
|
+
});
|
|
69
|
+
const [success, pool] = result;
|
|
70
|
+
const hash = await walletProvider.sendTransaction({
|
|
71
|
+
to: constants_1.GDAv1ForwarderAddress,
|
|
72
|
+
data,
|
|
73
|
+
});
|
|
74
|
+
await walletProvider.waitForTransactionReceipt(hash);
|
|
75
|
+
if (success) {
|
|
76
|
+
return `Created pool of token ${args.superTokenAddress} at ${pool}. Transaction hash: ${hash}`;
|
|
77
|
+
}
|
|
78
|
+
else {
|
|
79
|
+
return `Failed to create token pool.`;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
catch (error) {
|
|
83
|
+
return `Error creating Superfluid pool: ${error}`;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Updates member units for a pool
|
|
88
|
+
*
|
|
89
|
+
* @param walletProvider - The wallet provider to start the pool from.
|
|
90
|
+
* @param args - The input arguments for the action.
|
|
91
|
+
* @returns A JSON string containing the account details or error message
|
|
92
|
+
*/
|
|
93
|
+
async updatePool(walletProvider, args) {
|
|
94
|
+
try {
|
|
95
|
+
const data = (0, viem_1.encodeFunctionData)({
|
|
96
|
+
abi: constants_1.GDAv1ForwarderABI,
|
|
97
|
+
functionName: "updateMemberUnits",
|
|
98
|
+
args: [args.poolAddress, args.recipientAddress, BigInt(args.units), "0x"],
|
|
99
|
+
});
|
|
100
|
+
const hash = await walletProvider.sendTransaction({
|
|
101
|
+
to: constants_1.GDAv1ForwarderAddress,
|
|
102
|
+
data,
|
|
103
|
+
});
|
|
104
|
+
await walletProvider.waitForTransactionReceipt(hash);
|
|
105
|
+
return `Updated member units of pool ${args.poolAddress} for member ${args.recipientAddress}, with new member units ${args.units}. Transaction hash: ${hash}`;
|
|
106
|
+
}
|
|
107
|
+
catch (error) {
|
|
108
|
+
return `Error updating Superfluid pool: ${error}`;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
exports.SuperfluidPoolActionProvider = SuperfluidPoolActionProvider;
|
|
113
|
+
__decorate([
|
|
114
|
+
(0, actionDecorator_1.CreateAction)({
|
|
115
|
+
name: "create_pool",
|
|
116
|
+
description: `
|
|
117
|
+
This tool will create a Superfluid pool for a desired token on an EVM network.
|
|
118
|
+
It takes the ERC20 token address to create a pool of the tokens to later be multi streamed to other wallets.
|
|
119
|
+
Do not use the ERC20 address as the destination address. If you are unsure of the destination address, please ask the user before proceeding.
|
|
120
|
+
`,
|
|
121
|
+
schema: schemas_1.SuperfluidCreatePoolSchema,
|
|
122
|
+
}),
|
|
123
|
+
__metadata("design:type", Function),
|
|
124
|
+
__metadata("design:paramtypes", [wallet_providers_1.EvmWalletProvider, void 0]),
|
|
125
|
+
__metadata("design:returntype", Promise)
|
|
126
|
+
], SuperfluidPoolActionProvider.prototype, "createPool", null);
|
|
127
|
+
__decorate([
|
|
128
|
+
(0, actionDecorator_1.CreateAction)({
|
|
129
|
+
name: "update_pool",
|
|
130
|
+
description: `
|
|
131
|
+
This tool will update a Superfluid pool for a desired token on an EVM network.
|
|
132
|
+
The pool must already have been created; this action merely updates the flow for a member of the pool.
|
|
133
|
+
It takes the EVM address of the token pool contract that was created.
|
|
134
|
+
Do not use the ERC20 address as the destination address. If you are unsure of the destination address, please ask the user before proceeding.
|
|
135
|
+
`,
|
|
136
|
+
schema: schemas_1.SuperfluidUpdatePoolSchema,
|
|
137
|
+
}),
|
|
138
|
+
__metadata("design:type", Function),
|
|
139
|
+
__metadata("design:paramtypes", [wallet_providers_1.EvmWalletProvider, void 0]),
|
|
140
|
+
__metadata("design:returntype", Promise)
|
|
141
|
+
], SuperfluidPoolActionProvider.prototype, "updatePool", null);
|
|
142
|
+
const superfluidPoolActionProvider = () => new SuperfluidPoolActionProvider();
|
|
143
|
+
exports.superfluidPoolActionProvider = superfluidPoolActionProvider;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|