@coinbase/agentkit 0.9.1 → 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 +181 -54
- 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 -79
- package/dist/action-providers/cdp/cdpApiActionProvider.test.js +0 -125
- package/dist/action-providers/cdp/cdpEvmWalletActionProvider.d.ts +58 -0
- package/dist/action-providers/cdp/cdpEvmWalletActionProvider.js +351 -0
- package/dist/action-providers/cdp/cdpEvmWalletActionProvider.test.d.ts +1 -0
- package/dist/action-providers/cdp/cdpEvmWalletActionProvider.test.js +520 -0
- package/dist/action-providers/cdp/cdpSmartWalletActionProvider.d.ts +57 -0
- package/dist/action-providers/cdp/cdpSmartWalletActionProvider.js +337 -0
- package/dist/action-providers/cdp/cdpSmartWalletActionProvider.test.d.ts +1 -0
- package/dist/action-providers/cdp/cdpSmartWalletActionProvider.test.js +463 -0
- package/dist/action-providers/cdp/index.d.ts +3 -0
- package/dist/action-providers/cdp/index.js +3 -0
- package/dist/action-providers/cdp/schemas.d.ts +38 -9
- package/dist/action-providers/cdp/schemas.js +49 -6
- package/dist/action-providers/cdp/spendPermissionUtils.d.ts +24 -0
- package/dist/action-providers/cdp/spendPermissionUtils.js +66 -0
- 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 +4 -0
- package/dist/action-providers/index.js +4 -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/zerion/constants.d.ts +1 -0
- package/dist/action-providers/zerion/constants.js +4 -0
- package/dist/action-providers/zerion/index.d.ts +2 -0
- package/dist/action-providers/zerion/index.js +18 -0
- package/dist/action-providers/zerion/schemas.d.ts +11 -0
- package/dist/action-providers/zerion/schemas.js +15 -0
- package/dist/action-providers/zerion/types.d.ts +125 -0
- package/dist/action-providers/zerion/types.js +16 -0
- package/dist/action-providers/zerion/utils.d.ts +3 -0
- package/dist/action-providers/zerion/utils.js +45 -0
- package/dist/action-providers/zerion/zerionActionProvider.d.ts +57 -0
- package/dist/action-providers/zerion/zerionActionProvider.js +159 -0
- package/dist/action-providers/zerion/zerionActionProvider.test.d.ts +1 -0
- package/dist/action-providers/zerion/zerionActionProvider.test.js +213 -0
- 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 +9 -0
- package/dist/wallet-providers/cdpSmartWalletProvider.d.ts +29 -3
- package/dist/wallet-providers/cdpSmartWalletProvider.js +64 -28
- 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,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.listSpendPermissionsForSpender = listSpendPermissionsForSpender;
|
|
4
|
+
exports.findLatestSpendPermission = findLatestSpendPermission;
|
|
5
|
+
/**
|
|
6
|
+
* Shared utility functions for spend permission operations.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Lists and formats spend permissions for a given smart account and spender.
|
|
10
|
+
*
|
|
11
|
+
* @param cdpClient - The CDP client to use for API calls
|
|
12
|
+
* @param smartAccountAddress - The smart account address to check permissions for
|
|
13
|
+
* @param spenderAddress - The spender address to filter permissions by
|
|
14
|
+
* @returns A formatted string containing the spend permissions or an error message
|
|
15
|
+
*/
|
|
16
|
+
async function listSpendPermissionsForSpender(cdpClient, smartAccountAddress, spenderAddress) {
|
|
17
|
+
try {
|
|
18
|
+
// List all spend permissions for the smart account
|
|
19
|
+
const allPermissions = await cdpClient.evm.listSpendPermissions({
|
|
20
|
+
address: smartAccountAddress,
|
|
21
|
+
});
|
|
22
|
+
// Filter permissions where current wallet is the spender
|
|
23
|
+
const relevantPermissions = allPermissions.spendPermissions.filter(p => p.permission?.spender.toLowerCase() === spenderAddress.toLowerCase());
|
|
24
|
+
if (relevantPermissions.length === 0) {
|
|
25
|
+
return `No spend permissions found for spender ${spenderAddress} on smart account ${smartAccountAddress}`;
|
|
26
|
+
}
|
|
27
|
+
// Format the permissions for display
|
|
28
|
+
const formattedPermissions = relevantPermissions
|
|
29
|
+
.map((p, index) => {
|
|
30
|
+
const perm = p.permission;
|
|
31
|
+
if (!perm)
|
|
32
|
+
return `${index + 1}. Invalid permission`;
|
|
33
|
+
return `${index + 1}. Token: ${perm.token}, Allowance: ${perm.allowance}, Period: ${perm.period} seconds, Start: ${perm.start}, End: ${perm.end}`;
|
|
34
|
+
})
|
|
35
|
+
.join("\n");
|
|
36
|
+
return `Found ${relevantPermissions.length} spend permission(s):\n${formattedPermissions}`;
|
|
37
|
+
}
|
|
38
|
+
catch (error) {
|
|
39
|
+
return `Failed to list spend permissions: ${error}`;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Finds and retrieves the latest valid spend permission for a given spender from a smart account.
|
|
44
|
+
*
|
|
45
|
+
* @param cdpClient - The CDP client to use for API calls
|
|
46
|
+
* @param smartAccountAddress - The smart account address to check permissions for
|
|
47
|
+
* @param spenderAddress - The spender address to find permissions for
|
|
48
|
+
* @returns The latest spend permission or throws an error if none found
|
|
49
|
+
* @throws Error if no permissions found or permission is invalid
|
|
50
|
+
*/
|
|
51
|
+
async function findLatestSpendPermission(cdpClient, smartAccountAddress, spenderAddress) {
|
|
52
|
+
const allPermissions = await cdpClient.evm.listSpendPermissions({
|
|
53
|
+
address: smartAccountAddress,
|
|
54
|
+
});
|
|
55
|
+
// Filter permissions where current wallet is the spender
|
|
56
|
+
const relevantPermissions = allPermissions.spendPermissions.filter(p => p.permission?.spender.toLowerCase() === spenderAddress.toLowerCase());
|
|
57
|
+
if (relevantPermissions.length === 0) {
|
|
58
|
+
throw new Error(`No spend permissions found for spender ${spenderAddress} on smart account ${smartAccountAddress}`);
|
|
59
|
+
}
|
|
60
|
+
// Use the latest permission (last in the array)
|
|
61
|
+
const latestPermissionWrapper = relevantPermissions.at(-1);
|
|
62
|
+
if (!latestPermissionWrapper?.permission) {
|
|
63
|
+
throw new Error("Invalid spend permission found");
|
|
64
|
+
}
|
|
65
|
+
return latestPermissionWrapper.permission;
|
|
66
|
+
}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { EvmWalletProvider } from "../../wallet-providers";
|
|
2
|
+
export declare const PERMIT2_ADDRESS = "0x000000000022D473030F116dDEE9F6B43aC78BA3";
|
|
3
|
+
/**
|
|
4
|
+
* Checks if a token is native ETH.
|
|
5
|
+
*
|
|
6
|
+
* @param token - The token address to check.
|
|
7
|
+
* @returns True if the token is native ETH, false otherwise.
|
|
8
|
+
*/
|
|
9
|
+
export declare function isNativeEth(token: string): boolean;
|
|
10
|
+
/**
|
|
11
|
+
* Gets the details (decimals and name) for both fromToken and toToken
|
|
12
|
+
*
|
|
13
|
+
* @param walletProvider - The EVM wallet provider to read contracts
|
|
14
|
+
* @param fromToken - The contract address of the from token
|
|
15
|
+
* @param toToken - The contract address of the to token
|
|
16
|
+
* @returns Promise<{fromTokenDecimals: number, toTokenDecimals: number, fromTokenName: string, toTokenName: string}>
|
|
17
|
+
*/
|
|
18
|
+
export declare function getTokenDetails(walletProvider: EvmWalletProvider, fromToken: string, toToken: string): Promise<{
|
|
19
|
+
fromTokenDecimals: number;
|
|
20
|
+
toTokenDecimals: number;
|
|
21
|
+
fromTokenName: string;
|
|
22
|
+
toTokenName: string;
|
|
23
|
+
}>;
|
|
24
|
+
/**
|
|
25
|
+
* Retry function with exponential backoff
|
|
26
|
+
*
|
|
27
|
+
* @param fn - The function to retry
|
|
28
|
+
* @param maxRetries - Maximum number of retries (default: 3)
|
|
29
|
+
* @param baseDelay - Base delay in milliseconds (default: 1000)
|
|
30
|
+
* @returns Promise that resolves with the function result or rejects with the last error
|
|
31
|
+
*/
|
|
32
|
+
export declare function retryWithExponentialBackoff<T>(fn: () => Promise<T>, maxRetries?: number, baseDelay?: number): Promise<T>;
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.PERMIT2_ADDRESS = void 0;
|
|
4
|
+
exports.isNativeEth = isNativeEth;
|
|
5
|
+
exports.getTokenDetails = getTokenDetails;
|
|
6
|
+
exports.retryWithExponentialBackoff = retryWithExponentialBackoff;
|
|
7
|
+
const viem_1 = require("viem");
|
|
8
|
+
// Permit2 contract address is the same across all networks
|
|
9
|
+
exports.PERMIT2_ADDRESS = "0x000000000022D473030F116dDEE9F6B43aC78BA3";
|
|
10
|
+
/**
|
|
11
|
+
* Checks if a token is native ETH.
|
|
12
|
+
*
|
|
13
|
+
* @param token - The token address to check.
|
|
14
|
+
* @returns True if the token is native ETH, false otherwise.
|
|
15
|
+
*/
|
|
16
|
+
function isNativeEth(token) {
|
|
17
|
+
return token.toLowerCase() === "0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee";
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* Gets the details (decimals and name) for both fromToken and toToken
|
|
21
|
+
*
|
|
22
|
+
* @param walletProvider - The EVM wallet provider to read contracts
|
|
23
|
+
* @param fromToken - The contract address of the from token
|
|
24
|
+
* @param toToken - The contract address of the to token
|
|
25
|
+
* @returns Promise<{fromTokenDecimals: number, toTokenDecimals: number, fromTokenName: string, toTokenName: string}>
|
|
26
|
+
*/
|
|
27
|
+
async function getTokenDetails(walletProvider, fromToken, toToken) {
|
|
28
|
+
// Initialize default values for native ETH
|
|
29
|
+
let fromTokenDecimals = 18;
|
|
30
|
+
let fromTokenName = "ETH";
|
|
31
|
+
let toTokenDecimals = 18;
|
|
32
|
+
let toTokenName = "ETH";
|
|
33
|
+
// Prepare multicall contracts array
|
|
34
|
+
const contracts = [];
|
|
35
|
+
const contractIndexMap = {
|
|
36
|
+
fromDecimals: -1,
|
|
37
|
+
fromName: -1,
|
|
38
|
+
toDecimals: -1,
|
|
39
|
+
toName: -1,
|
|
40
|
+
};
|
|
41
|
+
// Add from token contracts if not native ETH
|
|
42
|
+
if (!isNativeEth(fromToken)) {
|
|
43
|
+
contractIndexMap.fromDecimals = contracts.length;
|
|
44
|
+
contracts.push({
|
|
45
|
+
address: fromToken,
|
|
46
|
+
abi: viem_1.erc20Abi,
|
|
47
|
+
functionName: "decimals",
|
|
48
|
+
});
|
|
49
|
+
contractIndexMap.fromName = contracts.length;
|
|
50
|
+
contracts.push({
|
|
51
|
+
address: fromToken,
|
|
52
|
+
abi: viem_1.erc20Abi,
|
|
53
|
+
functionName: "name",
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
// Add to token contracts if not native ETH
|
|
57
|
+
if (!isNativeEth(toToken)) {
|
|
58
|
+
contractIndexMap.toDecimals = contracts.length;
|
|
59
|
+
contracts.push({
|
|
60
|
+
address: toToken,
|
|
61
|
+
abi: viem_1.erc20Abi,
|
|
62
|
+
functionName: "decimals",
|
|
63
|
+
});
|
|
64
|
+
contractIndexMap.toName = contracts.length;
|
|
65
|
+
contracts.push({
|
|
66
|
+
address: toToken,
|
|
67
|
+
abi: viem_1.erc20Abi,
|
|
68
|
+
functionName: "name",
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
// Execute multicall if there are contracts to call
|
|
72
|
+
if (contracts.length > 0) {
|
|
73
|
+
try {
|
|
74
|
+
const results = await walletProvider.getPublicClient().multicall({
|
|
75
|
+
contracts,
|
|
76
|
+
});
|
|
77
|
+
// Extract from token details
|
|
78
|
+
if (contractIndexMap.fromDecimals !== -1) {
|
|
79
|
+
const decimalsResult = results[contractIndexMap.fromDecimals];
|
|
80
|
+
const nameResult = results[contractIndexMap.fromName];
|
|
81
|
+
if (decimalsResult.status === "success" && nameResult.status === "success") {
|
|
82
|
+
fromTokenDecimals = decimalsResult.result;
|
|
83
|
+
fromTokenName = nameResult.result;
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
throw new Error(`Failed to read details for fromToken ${fromToken}. This address may not be a valid ERC20 contract.`);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
// Extract to token details
|
|
90
|
+
if (contractIndexMap.toDecimals !== -1) {
|
|
91
|
+
const decimalsResult = results[contractIndexMap.toDecimals];
|
|
92
|
+
const nameResult = results[contractIndexMap.toName];
|
|
93
|
+
if (decimalsResult.status === "success" && nameResult.status === "success") {
|
|
94
|
+
toTokenDecimals = decimalsResult.result;
|
|
95
|
+
toTokenName = nameResult.result;
|
|
96
|
+
}
|
|
97
|
+
else {
|
|
98
|
+
throw new Error(`Failed to read details for toToken ${toToken}. This address may not be a valid ERC20 contract.`);
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
catch (error) {
|
|
103
|
+
throw new Error(`Failed to read token details via multicall. Error: ${error}`);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
return { fromTokenDecimals, toTokenDecimals, fromTokenName, toTokenName };
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Utility function to sleep for a given number of milliseconds
|
|
110
|
+
*
|
|
111
|
+
* @param ms - Number of milliseconds to sleep
|
|
112
|
+
* @returns Promise that resolves after the specified delay
|
|
113
|
+
*/
|
|
114
|
+
const sleep = (ms) => new Promise(resolve => setTimeout(resolve, ms));
|
|
115
|
+
/**
|
|
116
|
+
* Retry function with exponential backoff
|
|
117
|
+
*
|
|
118
|
+
* @param fn - The function to retry
|
|
119
|
+
* @param maxRetries - Maximum number of retries (default: 3)
|
|
120
|
+
* @param baseDelay - Base delay in milliseconds (default: 1000)
|
|
121
|
+
* @returns Promise that resolves with the function result or rejects with the last error
|
|
122
|
+
*/
|
|
123
|
+
async function retryWithExponentialBackoff(fn, maxRetries = 3, baseDelay = 1000) {
|
|
124
|
+
let lastError;
|
|
125
|
+
for (let attempt = 0; attempt <= maxRetries; attempt++) {
|
|
126
|
+
// Wait before each attempt
|
|
127
|
+
// Calculate delay with exponential backoff: baseDelay * 2^attempt
|
|
128
|
+
const delay = baseDelay * Math.pow(2, attempt);
|
|
129
|
+
await sleep(delay);
|
|
130
|
+
try {
|
|
131
|
+
return await fn();
|
|
132
|
+
}
|
|
133
|
+
catch (error) {
|
|
134
|
+
lastError = error;
|
|
135
|
+
// If this was the last attempt, throw the error
|
|
136
|
+
if (attempt === maxRetries) {
|
|
137
|
+
throw lastError;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
throw lastError;
|
|
142
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
import { ActionProvider } from "../actionProvider";
|
|
3
|
+
import { Network } from "../../network";
|
|
4
|
+
import { EvmWalletProvider } from "../../wallet-providers";
|
|
5
|
+
import { ClankTokenSchema } from "./schemas";
|
|
6
|
+
/**
|
|
7
|
+
* ClankerActionProvider provides actions for clanker operations.
|
|
8
|
+
*
|
|
9
|
+
* @description
|
|
10
|
+
* This provider is designed to work with EvmWalletProvider for blockchain interactions.
|
|
11
|
+
* It supports all evm networks.
|
|
12
|
+
*/
|
|
13
|
+
export declare class ClankerActionProvider extends ActionProvider<EvmWalletProvider> {
|
|
14
|
+
/**
|
|
15
|
+
* Constructor for the ClankerActionProvider.
|
|
16
|
+
*/
|
|
17
|
+
constructor();
|
|
18
|
+
/**
|
|
19
|
+
* Clanker action provider
|
|
20
|
+
*
|
|
21
|
+
* @description
|
|
22
|
+
* This action deploys a clanker token using the Clanker sdk
|
|
23
|
+
* It automatically includes the coin in the Clanker ecosystem
|
|
24
|
+
*
|
|
25
|
+
* @param walletProvider - The wallet provider instance for blockchain interactions
|
|
26
|
+
* @param args - Clanker arguments (modify these to fine tune token deployment, like initial quote token and rewards config)
|
|
27
|
+
* @returns A promise that resolves to a string describing the clanker result
|
|
28
|
+
*/
|
|
29
|
+
clankToken(walletProvider: EvmWalletProvider, args: z.infer<typeof ClankTokenSchema>): Promise<string>;
|
|
30
|
+
/**
|
|
31
|
+
* Checks if this provider supports the given network.
|
|
32
|
+
*
|
|
33
|
+
* @param network - The network to check support for
|
|
34
|
+
* @returns True if the network is supported
|
|
35
|
+
*/
|
|
36
|
+
supportsNetwork(network: Network): boolean;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Factory function to create a new ClankerActionProvider instance.
|
|
40
|
+
*
|
|
41
|
+
* @returns A new ClankerActionProvider instance
|
|
42
|
+
*/
|
|
43
|
+
export declare const clankerActionProvider: () => ClankerActionProvider;
|
|
@@ -0,0 +1,130 @@
|
|
|
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.clankerActionProvider = exports.ClankerActionProvider = void 0;
|
|
13
|
+
const zod_1 = require("zod");
|
|
14
|
+
const actionProvider_1 = require("../actionProvider");
|
|
15
|
+
const actionDecorator_1 = require("../actionDecorator");
|
|
16
|
+
const wallet_providers_1 = require("../../wallet-providers");
|
|
17
|
+
const schemas_1 = require("./schemas");
|
|
18
|
+
const utils_1 = require("./utils");
|
|
19
|
+
/**
|
|
20
|
+
* ClankerActionProvider provides actions for clanker operations.
|
|
21
|
+
*
|
|
22
|
+
* @description
|
|
23
|
+
* This provider is designed to work with EvmWalletProvider for blockchain interactions.
|
|
24
|
+
* It supports all evm networks.
|
|
25
|
+
*/
|
|
26
|
+
class ClankerActionProvider extends actionProvider_1.ActionProvider {
|
|
27
|
+
/**
|
|
28
|
+
* Constructor for the ClankerActionProvider.
|
|
29
|
+
*/
|
|
30
|
+
constructor() {
|
|
31
|
+
super("clanker", []);
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Clanker action provider
|
|
35
|
+
*
|
|
36
|
+
* @description
|
|
37
|
+
* This action deploys a clanker token using the Clanker sdk
|
|
38
|
+
* It automatically includes the coin in the Clanker ecosystem
|
|
39
|
+
*
|
|
40
|
+
* @param walletProvider - The wallet provider instance for blockchain interactions
|
|
41
|
+
* @param args - Clanker arguments (modify these to fine tune token deployment, like initial quote token and rewards config)
|
|
42
|
+
* @returns A promise that resolves to a string describing the clanker result
|
|
43
|
+
*/
|
|
44
|
+
async clankToken(walletProvider, args) {
|
|
45
|
+
const network = walletProvider.getNetwork();
|
|
46
|
+
const networkId = network.networkId || "base-mainnet";
|
|
47
|
+
if (!this.supportsNetwork(network)) {
|
|
48
|
+
return `Can't Clank token; network ${networkId} is not supported`;
|
|
49
|
+
}
|
|
50
|
+
const clanker = await (0, utils_1.createClankerClient)(walletProvider, networkId);
|
|
51
|
+
const lockDuration = args.lockDuration_Days * 24 * 60 * 60;
|
|
52
|
+
const vestingDuration = args.vestingDuration_Days * 24 * 60 * 60;
|
|
53
|
+
const tokenConfig = {
|
|
54
|
+
name: args.tokenName,
|
|
55
|
+
symbol: args.tokenSymbol,
|
|
56
|
+
image: args.image,
|
|
57
|
+
metadata: {
|
|
58
|
+
socialMediaUrls: args.socialMediaUrls,
|
|
59
|
+
description: args.description,
|
|
60
|
+
},
|
|
61
|
+
context: {
|
|
62
|
+
interface: args.interface,
|
|
63
|
+
id: args.id,
|
|
64
|
+
},
|
|
65
|
+
tokenAdmin: walletProvider.getAddress(),
|
|
66
|
+
vault: {
|
|
67
|
+
percentage: args.vaultPercentage,
|
|
68
|
+
lockupDuration: lockDuration,
|
|
69
|
+
vestingDuration: vestingDuration,
|
|
70
|
+
},
|
|
71
|
+
chainId: Number(network.chainId),
|
|
72
|
+
};
|
|
73
|
+
try {
|
|
74
|
+
const res = await clanker.deploy(tokenConfig);
|
|
75
|
+
if ("error" in res) {
|
|
76
|
+
return `There was an error deploying the clanker token: ${res}`;
|
|
77
|
+
}
|
|
78
|
+
const { txHash } = res;
|
|
79
|
+
const confirmed = await res.waitForTransaction();
|
|
80
|
+
if ("error" in confirmed) {
|
|
81
|
+
return `There was an error confirming the clanker token deployment: ${confirmed}`;
|
|
82
|
+
}
|
|
83
|
+
const { address } = confirmed;
|
|
84
|
+
return `Clanker token deployed at ${address}! View the transaction at ${txHash}, or view the token page at https://clanker.world/clanker/${address}`;
|
|
85
|
+
}
|
|
86
|
+
catch (error) {
|
|
87
|
+
return `There was an error deploying the clanker token: ${error}`;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
/**
|
|
91
|
+
* Checks if this provider supports the given network.
|
|
92
|
+
*
|
|
93
|
+
* @param network - The network to check support for
|
|
94
|
+
* @returns True if the network is supported
|
|
95
|
+
*/
|
|
96
|
+
supportsNetwork(network) {
|
|
97
|
+
return (network.networkId === "base-mainnet" ||
|
|
98
|
+
network.networkId === "base-sepolia" ||
|
|
99
|
+
network.networkId === "arbitrum-mainnet");
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
exports.ClankerActionProvider = ClankerActionProvider;
|
|
103
|
+
__decorate([
|
|
104
|
+
(0, actionDecorator_1.CreateAction)({
|
|
105
|
+
name: "clank_token",
|
|
106
|
+
description: `
|
|
107
|
+
his tool will launch a Clanker token using the Clanker SDK.
|
|
108
|
+
It takes the following inputs:
|
|
109
|
+
- tokenName: The name of the deployed token
|
|
110
|
+
- tokenSymbol: The symbol of the deployed token
|
|
111
|
+
- description: An optional description of the token or token project
|
|
112
|
+
- socialMediaUrls: An optional array of social media links for the token, each with a platform and url
|
|
113
|
+
- image: A normal or ipfs URL pointing to the image of the token
|
|
114
|
+
- vaultPercentage: The percentage of the token supply to allocate to a vault accessible to the deployed after the lockup period with optional vesting
|
|
115
|
+
- lockDuration_Days: The lock duration of the tokens in the vault (in days) (minimum 7 days)
|
|
116
|
+
- vestingDuration_Days: The duration (in days) that the token should vest after lockup period, vesting is linear.
|
|
117
|
+
`,
|
|
118
|
+
schema: schemas_1.ClankTokenSchema,
|
|
119
|
+
}),
|
|
120
|
+
__metadata("design:type", Function),
|
|
121
|
+
__metadata("design:paramtypes", [wallet_providers_1.EvmWalletProvider, void 0]),
|
|
122
|
+
__metadata("design:returntype", Promise)
|
|
123
|
+
], ClankerActionProvider.prototype, "clankToken", null);
|
|
124
|
+
/**
|
|
125
|
+
* Factory function to create a new ClankerActionProvider instance.
|
|
126
|
+
*
|
|
127
|
+
* @returns A new ClankerActionProvider instance
|
|
128
|
+
*/
|
|
129
|
+
const clankerActionProvider = () => new ClankerActionProvider();
|
|
130
|
+
exports.clankerActionProvider = clankerActionProvider;
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Clanker Action Provider tests
|
|
4
|
+
*/
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
const clankerActionProvider_1 = require("./clankerActionProvider");
|
|
7
|
+
const schemas_1 = require("./schemas");
|
|
8
|
+
const utils_1 = require("./utils");
|
|
9
|
+
jest.mock("./utils", () => ({
|
|
10
|
+
createClankerClient: jest.fn(),
|
|
11
|
+
}));
|
|
12
|
+
const createClankerClientMock = utils_1.createClankerClient;
|
|
13
|
+
const DEPLOYED_HASH = "0xdeadbeef";
|
|
14
|
+
const DEPLOYED_TOKEN_ADDRESS = "0xabc123abc123abc123abc123abc123abc123abc1";
|
|
15
|
+
describe("Clanker action provider tests", () => {
|
|
16
|
+
const provider = (0, clankerActionProvider_1.clankerActionProvider)();
|
|
17
|
+
let mockWalletProvider;
|
|
18
|
+
beforeEach(() => {
|
|
19
|
+
mockWalletProvider = {
|
|
20
|
+
getAddress: jest.fn(),
|
|
21
|
+
getBalance: jest.fn(),
|
|
22
|
+
getName: jest.fn(),
|
|
23
|
+
getNetwork: jest.fn().mockReturnValue({
|
|
24
|
+
protocolFamily: "evm",
|
|
25
|
+
networkId: "base-mainnet",
|
|
26
|
+
}),
|
|
27
|
+
nativeTransfer: jest.fn(),
|
|
28
|
+
};
|
|
29
|
+
const fakeClanker = {
|
|
30
|
+
deploy: jest.fn(async (_tokenCfg) => ({
|
|
31
|
+
txHash: DEPLOYED_HASH,
|
|
32
|
+
waitForTransaction: async () => ({ address: DEPLOYED_TOKEN_ADDRESS }),
|
|
33
|
+
})),
|
|
34
|
+
};
|
|
35
|
+
createClankerClientMock.mockResolvedValue(fakeClanker);
|
|
36
|
+
});
|
|
37
|
+
describe("network validation", () => {
|
|
38
|
+
it("should support the protocol family and network", () => {
|
|
39
|
+
expect(provider.supportsNetwork({
|
|
40
|
+
protocolFamily: "evm",
|
|
41
|
+
networkId: "base-mainnet",
|
|
42
|
+
})).toBe(true);
|
|
43
|
+
});
|
|
44
|
+
it("should not support other protocol families", () => {
|
|
45
|
+
expect(provider.supportsNetwork({
|
|
46
|
+
protocolFamily: "other-protocol-family",
|
|
47
|
+
})).toBe(false);
|
|
48
|
+
});
|
|
49
|
+
it("should handle invalid network objects", () => {
|
|
50
|
+
expect(provider.supportsNetwork({ protocolFamily: "invalid-protocol" })).toBe(false);
|
|
51
|
+
expect(provider.supportsNetwork({})).toBe(false);
|
|
52
|
+
});
|
|
53
|
+
});
|
|
54
|
+
describe("schema validation", () => {
|
|
55
|
+
it("should validate example action schema", () => {
|
|
56
|
+
const validInput = {
|
|
57
|
+
tokenName: "testTokenName",
|
|
58
|
+
tokenSymbol: "TTN",
|
|
59
|
+
image: "https://test.com",
|
|
60
|
+
vaultPercentage: 10,
|
|
61
|
+
vestingDuration_Days: 30,
|
|
62
|
+
lockDuration_Days: 30,
|
|
63
|
+
interface: "CDP AgentKit",
|
|
64
|
+
id: "test-id",
|
|
65
|
+
};
|
|
66
|
+
const parseResult = schemas_1.ClankTokenSchema.safeParse(validInput);
|
|
67
|
+
expect(parseResult.success).toBe(true);
|
|
68
|
+
if (parseResult.success) {
|
|
69
|
+
expect(parseResult.data.tokenName).toBe("testTokenName");
|
|
70
|
+
expect(parseResult.data.tokenSymbol).toBe("TTN");
|
|
71
|
+
expect(parseResult.data.image).toBe("https://test.com");
|
|
72
|
+
expect(parseResult.data.vaultPercentage).toBe(10);
|
|
73
|
+
expect(parseResult.data.vestingDuration_Days).toBe(30);
|
|
74
|
+
expect(parseResult.data.lockDuration_Days).toBe(30);
|
|
75
|
+
}
|
|
76
|
+
});
|
|
77
|
+
it("should reject invalid example action input", () => {
|
|
78
|
+
const invalidInput = {
|
|
79
|
+
fieldName: "",
|
|
80
|
+
amount: "invalid",
|
|
81
|
+
};
|
|
82
|
+
const parseResult = schemas_1.ClankTokenSchema.safeParse(invalidInput);
|
|
83
|
+
expect(parseResult.success).toBe(false);
|
|
84
|
+
});
|
|
85
|
+
});
|
|
86
|
+
describe("clanker action execution", () => {
|
|
87
|
+
it("should execute the clanker action with wallet provider", async () => {
|
|
88
|
+
const args = {
|
|
89
|
+
tokenName: "testTokenName",
|
|
90
|
+
tokenSymbol: "TTN",
|
|
91
|
+
image: "https://test.com",
|
|
92
|
+
vaultPercentage: 10,
|
|
93
|
+
vestingDuration_Days: 30,
|
|
94
|
+
lockDuration_Days: 30,
|
|
95
|
+
interface: "CDP AgentKit",
|
|
96
|
+
id: "test-id",
|
|
97
|
+
};
|
|
98
|
+
const result = await provider.clankToken(mockWalletProvider, args);
|
|
99
|
+
expect(result).toContain(`Clanker token deployed at ${DEPLOYED_TOKEN_ADDRESS}`);
|
|
100
|
+
expect(result).toContain(`View the transaction at ${DEPLOYED_HASH}`);
|
|
101
|
+
expect(mockWalletProvider.getNetwork).toHaveBeenCalled();
|
|
102
|
+
expect(createClankerClientMock).toHaveBeenCalledWith(expect.any(Object), expect.any(String));
|
|
103
|
+
});
|
|
104
|
+
});
|
|
105
|
+
describe("supportsNetwork", () => {
|
|
106
|
+
it("should return true for base-mainnet with evm protocol", () => {
|
|
107
|
+
expect(provider.supportsNetwork({
|
|
108
|
+
protocolFamily: "evm",
|
|
109
|
+
networkId: "base-mainnet",
|
|
110
|
+
})).toBe(true);
|
|
111
|
+
});
|
|
112
|
+
it("should return false for non-base networks", () => {
|
|
113
|
+
expect(provider.supportsNetwork({
|
|
114
|
+
protocolFamily: "evm",
|
|
115
|
+
networkId: "ethereum-mainnet",
|
|
116
|
+
})).toBe(false);
|
|
117
|
+
});
|
|
118
|
+
});
|
|
119
|
+
});
|
|
@@ -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("./clankerActionProvider"), exports);
|
|
18
|
+
__exportStar(require("./schemas"), exports);
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Action schemas for the clanker action provider.
|
|
4
|
+
*
|
|
5
|
+
* This file contains the Zod schemas that define the shape and validation
|
|
6
|
+
* rules for action parameters in the clanker action provider.
|
|
7
|
+
*/
|
|
8
|
+
export declare const ClankTokenSchema: z.ZodObject<{
|
|
9
|
+
tokenName: z.ZodString;
|
|
10
|
+
tokenSymbol: z.ZodString;
|
|
11
|
+
image: z.ZodString;
|
|
12
|
+
vaultPercentage: z.ZodNumber;
|
|
13
|
+
lockDuration_Days: z.ZodNumber;
|
|
14
|
+
vestingDuration_Days: z.ZodNumber;
|
|
15
|
+
description: z.ZodOptional<z.ZodString>;
|
|
16
|
+
socialMediaUrls: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
17
|
+
platform: z.ZodString;
|
|
18
|
+
url: z.ZodString;
|
|
19
|
+
}, "strip", z.ZodTypeAny, {
|
|
20
|
+
url: string;
|
|
21
|
+
platform: string;
|
|
22
|
+
}, {
|
|
23
|
+
url: string;
|
|
24
|
+
platform: string;
|
|
25
|
+
}>, "many">>;
|
|
26
|
+
interface: z.ZodDefault<z.ZodString>;
|
|
27
|
+
id: z.ZodDefault<z.ZodString>;
|
|
28
|
+
}, "strip", z.ZodTypeAny, {
|
|
29
|
+
id: string;
|
|
30
|
+
tokenSymbol: string;
|
|
31
|
+
image: string;
|
|
32
|
+
tokenName: string;
|
|
33
|
+
vaultPercentage: number;
|
|
34
|
+
lockDuration_Days: number;
|
|
35
|
+
vestingDuration_Days: number;
|
|
36
|
+
interface: string;
|
|
37
|
+
description?: string | undefined;
|
|
38
|
+
socialMediaUrls?: {
|
|
39
|
+
url: string;
|
|
40
|
+
platform: string;
|
|
41
|
+
}[] | undefined;
|
|
42
|
+
}, {
|
|
43
|
+
tokenSymbol: string;
|
|
44
|
+
image: string;
|
|
45
|
+
tokenName: string;
|
|
46
|
+
vaultPercentage: number;
|
|
47
|
+
lockDuration_Days: number;
|
|
48
|
+
vestingDuration_Days: number;
|
|
49
|
+
id?: string | undefined;
|
|
50
|
+
description?: string | undefined;
|
|
51
|
+
socialMediaUrls?: {
|
|
52
|
+
url: string;
|
|
53
|
+
platform: string;
|
|
54
|
+
}[] | undefined;
|
|
55
|
+
interface?: string | undefined;
|
|
56
|
+
}>;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ClankTokenSchema = void 0;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
/**
|
|
6
|
+
* Action schemas for the clanker action provider.
|
|
7
|
+
*
|
|
8
|
+
* This file contains the Zod schemas that define the shape and validation
|
|
9
|
+
* rules for action parameters in the clanker action provider.
|
|
10
|
+
*/
|
|
11
|
+
exports.ClankTokenSchema = zod_1.z
|
|
12
|
+
.object({
|
|
13
|
+
tokenName: zod_1.z.string().min(1).max(100).describe("The name of the token (max 100 characters)"),
|
|
14
|
+
tokenSymbol: zod_1.z.string().min(1).max(10).describe("The symbol of the token (max 10 characters)"),
|
|
15
|
+
image: zod_1.z.string().url().describe("Normal or ipfs URL pointing to the token image"),
|
|
16
|
+
vaultPercentage: zod_1.z
|
|
17
|
+
.number()
|
|
18
|
+
.min(0)
|
|
19
|
+
.max(90)
|
|
20
|
+
.describe("Percentage of token supply allocated to a vault that can be claimed by deployer after lockup period with optional vesting"),
|
|
21
|
+
lockDuration_Days: zod_1.z
|
|
22
|
+
.number()
|
|
23
|
+
.min(7)
|
|
24
|
+
.describe("Lockup duration of token (in days), minimum 7 days"),
|
|
25
|
+
vestingDuration_Days: zod_1.z
|
|
26
|
+
.number()
|
|
27
|
+
.min(0)
|
|
28
|
+
.describe("Vesting duration of token after lockup has passed (in days). Vesting is linear over the duration"),
|
|
29
|
+
description: zod_1.z
|
|
30
|
+
.string()
|
|
31
|
+
.optional()
|
|
32
|
+
.describe("Description of the token or token project (optional)"),
|
|
33
|
+
socialMediaUrls: zod_1.z
|
|
34
|
+
.array(zod_1.z.object({ platform: zod_1.z.string(), url: zod_1.z.string() }))
|
|
35
|
+
.optional()
|
|
36
|
+
.describe("Socials for the token. These may be displayed on aggregators."),
|
|
37
|
+
interface: zod_1.z
|
|
38
|
+
.string()
|
|
39
|
+
.default("CDP AgentKit")
|
|
40
|
+
.describe('System the token was deployed via. Defaults to "CDP AgentKit".'),
|
|
41
|
+
id: zod_1.z
|
|
42
|
+
.string()
|
|
43
|
+
.default("")
|
|
44
|
+
.describe("User id of the poster on the social platform the token was deployed from. Used for provenance and will be verified by aggregators."),
|
|
45
|
+
})
|
|
46
|
+
.strip()
|
|
47
|
+
.describe("Instructions for deploying a Clanker token");
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { EvmWalletProvider } from "../../wallet-providers";
|
|
2
|
+
/**
|
|
3
|
+
* Creates the client Clanker expects from the EvmWalletProvider
|
|
4
|
+
*
|
|
5
|
+
* @param walletProvider - The wallet provider instance for blockchain interactions
|
|
6
|
+
* @param networkId - The network to Clank on
|
|
7
|
+
* @returns The Clanker implementation
|
|
8
|
+
*/
|
|
9
|
+
export declare function createClankerClient(walletProvider: EvmWalletProvider, networkId: string): Promise<import("clanker-sdk/v4", { with: { "resolution-mode": "import" } }).Clanker>;
|