@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
package/README.md
CHANGED
|
@@ -5,60 +5,73 @@ AgentKit is a framework for easily enabling AI agents to take actions onchain. I
|
|
|
5
5
|
## Table of Contents
|
|
6
6
|
|
|
7
7
|
- [Agentkit](#agentkit)
|
|
8
|
-
- [
|
|
9
|
-
- [
|
|
10
|
-
- [
|
|
11
|
-
- [
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
- [
|
|
16
|
-
- [
|
|
17
|
-
- [
|
|
18
|
-
- [
|
|
19
|
-
|
|
20
|
-
- [
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
- [
|
|
24
|
-
|
|
25
|
-
- [
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
- [
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
- [
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
- [
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
- [
|
|
52
|
-
- [
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
- [
|
|
56
|
-
- [
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
- [
|
|
8
|
+
- [Table of Contents](#table-of-contents)
|
|
9
|
+
- [Getting Started](#getting-started)
|
|
10
|
+
- [Installation](#installation)
|
|
11
|
+
- [Usage](#usage)
|
|
12
|
+
- [Create an AgentKit instance. If no wallet or action providers are specified, the agent will use the `CdpWalletProvider` and `WalletProvider` action provider.](#create-an-agentkit-instance-if-no-wallet-or-action-providers-are-specified-the-agent-will-use-the-cdpwalletprovider-and-walletprovider-action-provider)
|
|
13
|
+
- [Create an AgentKit instance](#create-an-agentkit-instance)
|
|
14
|
+
- [Create an AgentKit instance with a specified wallet provider.](#create-an-agentkit-instance-with-a-specified-wallet-provider)
|
|
15
|
+
- [Create an AgentKit instance with a specified action providers.](#create-an-agentkit-instance-with-a-specified-action-providers)
|
|
16
|
+
- [Use the agent's actions with a framework extension. For example, using LangChain + OpenAI.](#use-the-agents-actions-with-a-framework-extension-for-example-using-langchain--openai)
|
|
17
|
+
- [Action Providers](#action-providers)
|
|
18
|
+
- [Creating an Action Provider](#creating-an-action-provider)
|
|
19
|
+
- [Adding Actions to your Action Provider](#adding-actions-to-your-action-provider)
|
|
20
|
+
- [Required Typescript Compiler Options](#required-typescript-compiler-options)
|
|
21
|
+
- [Steps to create an action](#steps-to-create-an-action)
|
|
22
|
+
- [Adding Actions to your Action Provider that use a Wallet Provider](#adding-actions-to-your-action-provider-that-use-a-wallet-provider)
|
|
23
|
+
- [Adding an Action Provider to your AgentKit instance.](#adding-an-action-provider-to-your-agentkit-instance)
|
|
24
|
+
- [EVM Wallet Providers](#evm-wallet-providers)
|
|
25
|
+
- [CdpEvmWalletProvider](#cdpevmwalletprovider)
|
|
26
|
+
- [Basic Configuration](#basic-configuration)
|
|
27
|
+
- [Using an Existing Wallet](#using-an-existing-wallet)
|
|
28
|
+
- [Creating a New Wallet](#creating-a-new-wallet)
|
|
29
|
+
- [Environment Variables](#environment-variables)
|
|
30
|
+
- [Exporting a wallet](#exporting-a-wallet)
|
|
31
|
+
- [CdpSmartWalletProvider](#cdpsmartwalletprovider)
|
|
32
|
+
- [Basic Configuration](#basic-configuration-1)
|
|
33
|
+
- [Using an Existing Smart Wallet](#using-an-existing-smart-wallet)
|
|
34
|
+
- [Specifying an Owner Account](#specifying-an-owner-account)
|
|
35
|
+
- [Creating a New Smart Wallet](#creating-a-new-smart-wallet)
|
|
36
|
+
- [Environment Variables](#environment-variables-1)
|
|
37
|
+
- [Exporting Smart Wallet Information](#exporting-smart-wallet-information)
|
|
38
|
+
- [Key Differences from Regular Wallets](#key-differences-from-regular-wallets)
|
|
39
|
+
- [LegacyCdpWalletProvider](#legacycdpwalletprovider)
|
|
40
|
+
- [Network Configuration](#network-configuration)
|
|
41
|
+
- [Configuring from an existing CDP API Wallet](#configuring-from-an-existing-cdp-api-wallet)
|
|
42
|
+
- [Configuring from a mnemonic phrase](#configuring-from-a-mnemonic-phrase)
|
|
43
|
+
- [Exporting a wallet](#exporting-a-wallet-1)
|
|
44
|
+
- [Importing a wallet from `WalletData` JSON string](#importing-a-wallet-from-walletdata-json-string)
|
|
45
|
+
- [Configuring LegacyCdpWalletProvider gas parameters](#configuring-legacycdpwalletprovider-gas-parameters)
|
|
46
|
+
- [ViemWalletProvider](#viemwalletprovider)
|
|
47
|
+
- [Configuring ViemWalletProvider gas parameters](#configuring-viemwalletprovider-gas-parameters)
|
|
48
|
+
- [PrivyWalletProvider](#privywalletprovider)
|
|
49
|
+
- [Server Wallet Configuration](#server-wallet-configuration)
|
|
50
|
+
- [Delegated Embedded Wallet Configuration](#delegated-embedded-wallet-configuration)
|
|
51
|
+
- [Prerequisites](#prerequisites)
|
|
52
|
+
- [Supported Operations](#supported-operations)
|
|
53
|
+
- [Authorization Keys](#authorization-keys)
|
|
54
|
+
- [Exporting Privy Wallet information](#exporting-privy-wallet-information)
|
|
55
|
+
- [SmartWalletProvider](#smartwalletprovider)
|
|
56
|
+
- [ZeroDevWalletProvider](#zerodevwalletprovider)
|
|
57
|
+
- [Configuring from CdpWalletProvider](#configuring-from-cdpwalletprovider)
|
|
58
|
+
- [Configuring from PrivyWalletProvider](#configuring-from-privywalletprovider)
|
|
59
|
+
- [Configuring from ViemWalletProvider](#configuring-from-viemwalletprovider)
|
|
60
|
+
- [SVM Wallet Providers](#svm-wallet-providers)
|
|
61
|
+
- [CdpV2SolanaWalletProvider](#cdpv2solanawalletprovider)
|
|
62
|
+
- [Basic Configuration](#basic-configuration-2)
|
|
63
|
+
- [Using an Existing Wallet](#using-an-existing-wallet-1)
|
|
64
|
+
- [Creating a New Wallet](#creating-a-new-wallet-1)
|
|
65
|
+
- [Environment Variables](#environment-variables-2)
|
|
66
|
+
- [Supported Networks](#supported-networks)
|
|
67
|
+
- [SolanaKeypairWalletProvider](#solanakeypairwalletprovider)
|
|
68
|
+
- [Solana Network Configuration](#solana-network-configuration)
|
|
69
|
+
- [RPC URL Configuration](#rpc-url-configuration)
|
|
70
|
+
- [PrivyWalletProvider (Solana)](#privywalletprovider-solana)
|
|
71
|
+
- [Connection Configuration](#connection-configuration)
|
|
72
|
+
- [Authorization Keys](#authorization-keys-1)
|
|
73
|
+
- [Exporting Privy Wallet information](#exporting-privy-wallet-information-1)
|
|
74
|
+
- [Contributing](#contributing)
|
|
62
75
|
|
|
63
76
|
## Getting Started
|
|
64
77
|
|
|
@@ -158,6 +171,48 @@ const agent = createReactAgent({
|
|
|
158
171
|
|
|
159
172
|
## Action Providers
|
|
160
173
|
|
|
174
|
+
<details>
|
|
175
|
+
<summary><strong>CDP EVM Wallet</strong></summary>
|
|
176
|
+
<table width="100%">
|
|
177
|
+
<tr>
|
|
178
|
+
<td width="200"><code>list_spend_permissions</code></td>
|
|
179
|
+
<td width="768">Lists spend permissions that have been granted to the current EVM wallet by a smart account.</td>
|
|
180
|
+
</tr>
|
|
181
|
+
<tr>
|
|
182
|
+
<td width="200"><code>use_spend_permission</code></td>
|
|
183
|
+
<td width="768">Uses a spend permission to spend tokens on behalf of a smart account that the current EVM wallet has permission to spend.</td>
|
|
184
|
+
</tr>
|
|
185
|
+
<tr>
|
|
186
|
+
<td width="200"><code>get_swap_price</code></td>
|
|
187
|
+
<td width="768">Fetches a price quote for swapping between two tokens using the CDP Swap API (does not execute swap).</td>
|
|
188
|
+
</tr>
|
|
189
|
+
<tr>
|
|
190
|
+
<td width="200"><code>swap</code></td>
|
|
191
|
+
<td width="768">Executes a token swap using the CDP Swap API with automatic token approvals.</td>
|
|
192
|
+
</tr>
|
|
193
|
+
</table>
|
|
194
|
+
</details>
|
|
195
|
+
<details>
|
|
196
|
+
<summary><strong>CDP Smart Wallet</strong></summary>
|
|
197
|
+
<table width="100%">
|
|
198
|
+
<tr>
|
|
199
|
+
<td width="200"><code>list_spend_permissions</code></td>
|
|
200
|
+
<td width="768">Lists spend permissions that have been granted to the current smart wallet by a smart account.</td>
|
|
201
|
+
</tr>
|
|
202
|
+
<tr>
|
|
203
|
+
<td width="200"><code>use_spend_permission</code></td>
|
|
204
|
+
<td width="768">Uses a spend permission to spend tokens on behalf of a smart account that the current smart wallet has permission to spend.</td>
|
|
205
|
+
</tr>
|
|
206
|
+
<tr>
|
|
207
|
+
<td width="200"><code>get_swap_price</code></td>
|
|
208
|
+
<td width="768">Fetches a price quote for swapping between two tokens using the CDP Swap API (does not execute swap).</td>
|
|
209
|
+
</tr>
|
|
210
|
+
<tr>
|
|
211
|
+
<td width="200"><code>swap</code></td>
|
|
212
|
+
<td width="768">Executes a token swap using the CDP Swap API with automatic token approvals.</td>
|
|
213
|
+
</tr>
|
|
214
|
+
</table>
|
|
215
|
+
</details>
|
|
161
216
|
<details>
|
|
162
217
|
<summary><strong>Across</strong></summary>
|
|
163
218
|
<table width="100%">
|
|
@@ -181,6 +236,15 @@ const agent = createReactAgent({
|
|
|
181
236
|
</table>
|
|
182
237
|
</details>
|
|
183
238
|
<details>
|
|
239
|
+
<summary><strong>Clanker</strong></summary>
|
|
240
|
+
<table width="100%">
|
|
241
|
+
<tr>
|
|
242
|
+
<td width="200"><code>clank_token</code></td>
|
|
243
|
+
<td width="768">Deploys an ERC20 Clanker token based on the supplied config.</td>
|
|
244
|
+
</tr>
|
|
245
|
+
</table>
|
|
246
|
+
</details>
|
|
247
|
+
<details>
|
|
184
248
|
<summary><strong>Compound</strong></summary>
|
|
185
249
|
<table width="100%">
|
|
186
250
|
<tr>
|
|
@@ -233,6 +297,10 @@ const agent = createReactAgent({
|
|
|
233
297
|
<td width="200"><code>transfer</code></td>
|
|
234
298
|
<td width="768">Transfers a specified amount of ERC-20 tokens to a destination address.</td>
|
|
235
299
|
</tr>
|
|
300
|
+
<tr>
|
|
301
|
+
<td width="200"><code>get_erc20_token_address</code></td>
|
|
302
|
+
<td width="768">Gets the contract address for frequently used ERC20 tokens on different networks by token symbol.</td>
|
|
303
|
+
</tr>
|
|
236
304
|
</table>
|
|
237
305
|
</details>
|
|
238
306
|
<details>
|
|
@@ -344,6 +412,43 @@ const agent = createReactAgent({
|
|
|
344
412
|
</table>
|
|
345
413
|
</details>
|
|
346
414
|
<details>
|
|
415
|
+
<summary><strong>Superfluid</strong></summary>
|
|
416
|
+
<table width="100%">
|
|
417
|
+
<tr>
|
|
418
|
+
<td width="200"><code>create_pool</code></td>
|
|
419
|
+
<td width="768">Creates a new Superfluid pool for a Supertoken.</td>
|
|
420
|
+
</tr>
|
|
421
|
+
<tr>
|
|
422
|
+
<td width="200"><code>update_pool</code></td>
|
|
423
|
+
<td width="768">Updates an existing Superfluid pool with recipients and flow rates.</td>
|
|
424
|
+
</tr>
|
|
425
|
+
<tr>
|
|
426
|
+
<td width="200"><code>query_streams</code></td>
|
|
427
|
+
<td width="768">Queries existing Superfluid streams using Graphql.</td>
|
|
428
|
+
</tr>
|
|
429
|
+
<tr>
|
|
430
|
+
<td width="200"><code>create_stream</code></td>
|
|
431
|
+
<td width="768">Creates a new Superfluid stream to an address with a given flow rate.</td>
|
|
432
|
+
</tr>
|
|
433
|
+
<tr>
|
|
434
|
+
<td width="200"><code>update_stream</code></td>
|
|
435
|
+
<td width="768">Updates an existing Superfluid stream with a new flow rate.</td>
|
|
436
|
+
</tr>
|
|
437
|
+
<tr>
|
|
438
|
+
<td width="200"><code>delete_stream</code></td>
|
|
439
|
+
<td width="768">Stops an existing Superfluid stream.</td>
|
|
440
|
+
</tr>
|
|
441
|
+
<tr>
|
|
442
|
+
<td width="200"><code>create_super_token</code></td>
|
|
443
|
+
<td width="768">Creates a new Supertoken implementation for an existing ERC20 token.</td>
|
|
444
|
+
</tr>
|
|
445
|
+
<tr>
|
|
446
|
+
<td width="200"><code>wrap_superfluid_token</code></td>
|
|
447
|
+
<td width="768">Wraps an ERC20 token into its Superfluid Super token implementation.</td>
|
|
448
|
+
</tr>
|
|
449
|
+
</table>
|
|
450
|
+
</details>
|
|
451
|
+
<details>
|
|
347
452
|
<summary><strong>Twitter</strong></summary>
|
|
348
453
|
<table width="100%">
|
|
349
454
|
<tr>
|
|
@@ -448,6 +553,28 @@ it will return payment details that can be used on retry.</td>
|
|
|
448
553
|
<tr>
|
|
449
554
|
<td width="200"><code>make_http_request_with_x402</code></td>
|
|
450
555
|
<td width="768">Combines make_http_request and retry_http_request_with_x402 into a single step.</td>
|
|
556
|
+
<summary><strong>ZeroX</strong></summary>
|
|
557
|
+
<table width="100%">
|
|
558
|
+
<tr>
|
|
559
|
+
<td width="200"><code>get_swap_price_quote_from_0x</code></td>
|
|
560
|
+
<td width="768">Fetches a price quote for swapping between two tokens using the 0x API.</td>
|
|
561
|
+
</tr>
|
|
562
|
+
<tr>
|
|
563
|
+
<td width="200"><code>execute_swap_on_0x</code></td>
|
|
564
|
+
<td width="768">Executes a token swap between two tokens using the 0x API.</td>
|
|
565
|
+
</tr>
|
|
566
|
+
</table>
|
|
567
|
+
</details>
|
|
568
|
+
<details>
|
|
569
|
+
<summary><strong>Zerion</strong></summary>
|
|
570
|
+
<table width="100%">
|
|
571
|
+
<tr>
|
|
572
|
+
<td width="200"><code>getPortfolioOverview</code></td>
|
|
573
|
+
<td width="768">Fetches and summarizes a crypto wallet's portfolio in USD.</td>
|
|
574
|
+
</tr>
|
|
575
|
+
<tr>
|
|
576
|
+
<td width="200"><code>getFungiblePositions</code></td>
|
|
577
|
+
<td width="768">Retrieves and summarizes a wallet's fungible token holdings (including DeFi positions)</td>
|
|
451
578
|
</tr>
|
|
452
579
|
</table>
|
|
453
580
|
</details>
|
|
@@ -31,7 +31,7 @@ const schemas_1 = require("./schemas");
|
|
|
31
31
|
const wallet_providers_1 = require("../../wallet-providers");
|
|
32
32
|
const utils_1 = require("./utils");
|
|
33
33
|
const accounts_1 = require("viem/accounts");
|
|
34
|
-
const
|
|
34
|
+
const viem_2 = require("viem");
|
|
35
35
|
/**
|
|
36
36
|
* AcrossActionProvider provides actions for cross-chain bridging via Across Protocol.
|
|
37
37
|
*/
|
|
@@ -141,7 +141,7 @@ class AcrossActionProvider extends actionProvider_1.ActionProvider {
|
|
|
141
141
|
// Check ERC20 token balance
|
|
142
142
|
const tokenBalance = (await walletProvider.readContract({
|
|
143
143
|
address: inputToken,
|
|
144
|
-
abi:
|
|
144
|
+
abi: viem_2.erc20Abi,
|
|
145
145
|
functionName: "balanceOf",
|
|
146
146
|
args: [address],
|
|
147
147
|
}));
|
|
@@ -194,7 +194,7 @@ class AcrossActionProvider extends actionProvider_1.ActionProvider {
|
|
|
194
194
|
approvalTxHash = await walletProvider.sendTransaction({
|
|
195
195
|
to: inputToken,
|
|
196
196
|
data: (0, viem_1.encodeFunctionData)({
|
|
197
|
-
abi:
|
|
197
|
+
abi: viem_2.erc20Abi,
|
|
198
198
|
functionName: "approve",
|
|
199
199
|
args: [quote.deposit.spokePoolAddress, quote.deposit.inputAmount],
|
|
200
200
|
}),
|
|
@@ -2,14 +2,13 @@ import { z } from "zod";
|
|
|
2
2
|
import { Network } from "../../network";
|
|
3
3
|
import { WalletProvider } from "../../wallet-providers";
|
|
4
4
|
import { ActionProvider } from "../actionProvider";
|
|
5
|
-
import { RequestFaucetFundsV2Schema
|
|
5
|
+
import { RequestFaucetFundsV2Schema } from "./schemas";
|
|
6
6
|
/**
|
|
7
7
|
* CdpApiActionProvider is an action provider for CDP API.
|
|
8
8
|
*
|
|
9
9
|
* This provider is used for any action that uses the CDP API, but does not require a CDP Wallet.
|
|
10
10
|
*/
|
|
11
11
|
export declare class CdpApiActionProvider extends ActionProvider<WalletProvider> {
|
|
12
|
-
#private;
|
|
13
12
|
/**
|
|
14
13
|
* Constructor for the CdpApiActionProvider class.
|
|
15
14
|
*/
|
|
@@ -23,20 +22,12 @@ export declare class CdpApiActionProvider extends ActionProvider<WalletProvider>
|
|
|
23
22
|
*/
|
|
24
23
|
faucet(walletProvider: WalletProvider, args: z.infer<typeof RequestFaucetFundsV2Schema>): Promise<string>;
|
|
25
24
|
/**
|
|
26
|
-
*
|
|
27
|
-
*
|
|
28
|
-
* @param walletProvider - The wallet provider to perform the swap with.
|
|
29
|
-
* @param args - The input arguments for the swap action.
|
|
30
|
-
* @returns A confirmation message with transaction details.
|
|
31
|
-
*/
|
|
32
|
-
swap(walletProvider: WalletProvider, args: z.infer<typeof SwapSchema>): Promise<string>;
|
|
33
|
-
/**
|
|
34
|
-
* Checks if the Cdp action provider supports the given network.
|
|
25
|
+
* Checks if the CDP action provider supports the given network.
|
|
35
26
|
*
|
|
36
27
|
* NOTE: Network scoping is done at the action implementation level
|
|
37
28
|
*
|
|
38
29
|
* @param _ - The network to check.
|
|
39
|
-
* @returns True if the
|
|
30
|
+
* @returns True if the CDP action provider supports the network, false otherwise.
|
|
40
31
|
*/
|
|
41
32
|
supportsNetwork: (_: Network) => boolean;
|
|
42
33
|
}
|
|
@@ -8,12 +8,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
8
8
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
10
|
};
|
|
11
|
-
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
|
|
12
|
-
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
|
|
13
|
-
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
|
|
14
|
-
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
|
|
15
|
-
};
|
|
16
|
-
var _CdpApiActionProvider_instances, _CdpApiActionProvider_getCdpSdkNetwork;
|
|
17
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
12
|
exports.cdpApiActionProvider = exports.CdpApiActionProvider = void 0;
|
|
19
13
|
const zod_1 = require("zod");
|
|
@@ -33,14 +27,13 @@ class CdpApiActionProvider extends actionProvider_1.ActionProvider {
|
|
|
33
27
|
*/
|
|
34
28
|
constructor() {
|
|
35
29
|
super("cdp_api", []);
|
|
36
|
-
_CdpApiActionProvider_instances.add(this);
|
|
37
30
|
/**
|
|
38
|
-
* Checks if the
|
|
31
|
+
* Checks if the CDP action provider supports the given network.
|
|
39
32
|
*
|
|
40
33
|
* NOTE: Network scoping is done at the action implementation level
|
|
41
34
|
*
|
|
42
35
|
* @param _ - The network to check.
|
|
43
|
-
* @returns True if the
|
|
36
|
+
* @returns True if the CDP action provider supports the network, false otherwise.
|
|
44
37
|
*/
|
|
45
38
|
this.supportsNetwork = (_) => true;
|
|
46
39
|
}
|
|
@@ -84,64 +77,8 @@ class CdpApiActionProvider extends actionProvider_1.ActionProvider {
|
|
|
84
77
|
throw new Error("Wallet provider is not a CDP Wallet Provider.");
|
|
85
78
|
}
|
|
86
79
|
}
|
|
87
|
-
/**
|
|
88
|
-
* Swaps tokens using the CDP client.
|
|
89
|
-
*
|
|
90
|
-
* @param walletProvider - The wallet provider to perform the swap with.
|
|
91
|
-
* @param args - The input arguments for the swap action.
|
|
92
|
-
* @returns A confirmation message with transaction details.
|
|
93
|
-
*/
|
|
94
|
-
async swap(walletProvider, args) {
|
|
95
|
-
const network = walletProvider.getNetwork();
|
|
96
|
-
const networkId = network.networkId;
|
|
97
|
-
if ((0, cdpShared_1.isWalletProviderWithClient)(walletProvider)) {
|
|
98
|
-
if (network.protocolFamily === "evm") {
|
|
99
|
-
try {
|
|
100
|
-
const cdpNetwork = __classPrivateFieldGet(this, _CdpApiActionProvider_instances, "m", _CdpApiActionProvider_getCdpSdkNetwork).call(this, networkId);
|
|
101
|
-
// Get the account for the wallet address
|
|
102
|
-
const account = await walletProvider.getClient().evm.getAccount({
|
|
103
|
-
address: walletProvider.getAddress(),
|
|
104
|
-
});
|
|
105
|
-
// Execute swap using the all-in-one pattern
|
|
106
|
-
const swapResult = await account.swap({
|
|
107
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
108
|
-
network: cdpNetwork,
|
|
109
|
-
from: args.fromAssetId,
|
|
110
|
-
to: args.toAssetId,
|
|
111
|
-
amount: args.amount,
|
|
112
|
-
slippageBps: 100, // 1% slippage tolerance
|
|
113
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
114
|
-
});
|
|
115
|
-
return `Successfully swapped ${args.amount} ${args.fromAssetId.toUpperCase()} to ${args.toAssetId.toUpperCase()}. Transaction hash: ${swapResult.transactionHash}`;
|
|
116
|
-
}
|
|
117
|
-
catch (error) {
|
|
118
|
-
throw new Error(`Swap failed: ${error}`);
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
else {
|
|
122
|
-
throw new Error("Swap is currently only supported on EVM networks.");
|
|
123
|
-
}
|
|
124
|
-
}
|
|
125
|
-
else {
|
|
126
|
-
throw new Error("Wallet provider is not a CDP Wallet Provider.");
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
80
|
}
|
|
130
81
|
exports.CdpApiActionProvider = CdpApiActionProvider;
|
|
131
|
-
_CdpApiActionProvider_instances = new WeakSet(), _CdpApiActionProvider_getCdpSdkNetwork = function _CdpApiActionProvider_getCdpSdkNetwork(networkId) {
|
|
132
|
-
switch (networkId) {
|
|
133
|
-
case "base-sepolia":
|
|
134
|
-
return "base-sepolia";
|
|
135
|
-
case "base-mainnet":
|
|
136
|
-
return "base";
|
|
137
|
-
case "ethereum-sepolia":
|
|
138
|
-
return "ethereum-sepolia";
|
|
139
|
-
case "ethereum-mainnet":
|
|
140
|
-
return "ethereum";
|
|
141
|
-
default:
|
|
142
|
-
return networkId; // For other networks, use as-is
|
|
143
|
-
}
|
|
144
|
-
};
|
|
145
82
|
__decorate([
|
|
146
83
|
(0, actionDecorator_1.CreateAction)({
|
|
147
84
|
name: "request_faucet_funds",
|
|
@@ -157,19 +94,5 @@ from another wallet and provide the user with your wallet details.`,
|
|
|
157
94
|
__metadata("design:paramtypes", [wallet_providers_1.WalletProvider, void 0]),
|
|
158
95
|
__metadata("design:returntype", Promise)
|
|
159
96
|
], CdpApiActionProvider.prototype, "faucet", null);
|
|
160
|
-
__decorate([
|
|
161
|
-
(0, actionDecorator_1.CreateAction)({
|
|
162
|
-
name: "swap",
|
|
163
|
-
description: `This tool swaps tokens using the CDP API. It takes the wallet, from asset ID, to asset ID, and amount as input.
|
|
164
|
-
Swaps are currently supported on EVM networks like Base and Ethereum.
|
|
165
|
-
Example usage:
|
|
166
|
-
- Swap 0.1 ETH to USDC: { fromAssetId: "eth", toAssetId: "usdc", amount: "0.1" }
|
|
167
|
-
- Swap 100 USDC to ETH: { fromAssetId: "usdc", toAssetId: "eth", amount: "100" }`,
|
|
168
|
-
schema: schemas_1.SwapSchema,
|
|
169
|
-
}),
|
|
170
|
-
__metadata("design:type", Function),
|
|
171
|
-
__metadata("design:paramtypes", [wallet_providers_1.WalletProvider, void 0]),
|
|
172
|
-
__metadata("design:returntype", Promise)
|
|
173
|
-
], CdpApiActionProvider.prototype, "swap", null);
|
|
174
97
|
const cdpApiActionProvider = () => new CdpApiActionProvider();
|
|
175
98
|
exports.cdpApiActionProvider = cdpApiActionProvider;
|
|
@@ -10,20 +10,14 @@ describe("CDP API Action Provider", () => {
|
|
|
10
10
|
let mockCdpClient;
|
|
11
11
|
beforeEach(() => {
|
|
12
12
|
jest.clearAllMocks();
|
|
13
|
-
const mockAccount = {
|
|
14
|
-
swap: jest.fn(),
|
|
15
|
-
};
|
|
16
13
|
mockCdpClient = {
|
|
17
14
|
evm: {
|
|
18
15
|
requestFaucet: jest.fn(),
|
|
19
|
-
getAccount: jest.fn(),
|
|
20
16
|
},
|
|
21
17
|
solana: {
|
|
22
18
|
requestFaucet: jest.fn(),
|
|
23
19
|
},
|
|
24
20
|
};
|
|
25
|
-
// Set up default mock behavior
|
|
26
|
-
mockCdpClient.evm.getAccount.mockResolvedValue(mockAccount);
|
|
27
21
|
mockWalletProvider = {
|
|
28
22
|
getNetwork: jest.fn(),
|
|
29
23
|
getAddress: jest.fn(),
|
|
@@ -93,94 +87,6 @@ describe("CDP API Action Provider", () => {
|
|
|
93
87
|
await expect(actionProvider.faucet(mockWalletWithoutClient, { assetId: "eth" })).rejects.toThrow("Wallet provider is not a CDP Wallet Provider");
|
|
94
88
|
});
|
|
95
89
|
});
|
|
96
|
-
describe("swap", () => {
|
|
97
|
-
it("should perform swap on base-sepolia", async () => {
|
|
98
|
-
const mockNetwork = { protocolFamily: "evm", networkId: "base-sepolia" };
|
|
99
|
-
mockWalletProvider.getNetwork.mockReturnValue(mockNetwork);
|
|
100
|
-
mockWalletProvider.getAddress.mockReturnValue("0x123456789");
|
|
101
|
-
mockWalletProvider.getClient.mockReturnValue(mockCdpClient);
|
|
102
|
-
const mockAccount = { swap: jest.fn() };
|
|
103
|
-
mockCdpClient.evm.getAccount.mockResolvedValue(mockAccount);
|
|
104
|
-
mockAccount.swap.mockResolvedValue({
|
|
105
|
-
transactionHash: "0xswap123456",
|
|
106
|
-
});
|
|
107
|
-
const result = await actionProvider.swap(mockWalletProvider, {
|
|
108
|
-
fromAssetId: "eth",
|
|
109
|
-
toAssetId: "usdc",
|
|
110
|
-
amount: "0.1",
|
|
111
|
-
});
|
|
112
|
-
expect(mockCdpClient.evm.getAccount).toHaveBeenCalledWith({
|
|
113
|
-
address: "0x123456789",
|
|
114
|
-
});
|
|
115
|
-
expect(mockAccount.swap).toHaveBeenCalledWith({
|
|
116
|
-
network: "base-sepolia",
|
|
117
|
-
from: "eth",
|
|
118
|
-
to: "usdc",
|
|
119
|
-
amount: "0.1",
|
|
120
|
-
slippageBps: 100,
|
|
121
|
-
});
|
|
122
|
-
expect(result).toContain("Successfully swapped 0.1 ETH to USDC");
|
|
123
|
-
expect(result).toContain("0xswap123456");
|
|
124
|
-
});
|
|
125
|
-
it("should perform swap on base-mainnet", async () => {
|
|
126
|
-
const mockNetwork = { protocolFamily: "evm", networkId: "base-mainnet" };
|
|
127
|
-
mockWalletProvider.getNetwork.mockReturnValue(mockNetwork);
|
|
128
|
-
mockWalletProvider.getAddress.mockReturnValue("0x123456789");
|
|
129
|
-
mockWalletProvider.getClient.mockReturnValue(mockCdpClient);
|
|
130
|
-
const mockAccount = { swap: jest.fn() };
|
|
131
|
-
mockCdpClient.evm.getAccount.mockResolvedValue(mockAccount);
|
|
132
|
-
mockAccount.swap.mockResolvedValue({
|
|
133
|
-
transactionHash: "0xswap789",
|
|
134
|
-
});
|
|
135
|
-
const result = await actionProvider.swap(mockWalletProvider, {
|
|
136
|
-
fromAssetId: "usdc",
|
|
137
|
-
toAssetId: "eth",
|
|
138
|
-
amount: "100",
|
|
139
|
-
});
|
|
140
|
-
expect(mockAccount.swap).toHaveBeenCalledWith({
|
|
141
|
-
network: "base", // Should convert base-mainnet to base
|
|
142
|
-
from: "usdc",
|
|
143
|
-
to: "eth",
|
|
144
|
-
amount: "100",
|
|
145
|
-
slippageBps: 100,
|
|
146
|
-
});
|
|
147
|
-
expect(result).toContain("Successfully swapped 100 USDC to ETH");
|
|
148
|
-
});
|
|
149
|
-
it("should throw error for non-EVM networks", async () => {
|
|
150
|
-
const mockNetwork = { protocolFamily: "svm", networkId: "solana-devnet" };
|
|
151
|
-
mockWalletProvider.getNetwork.mockReturnValue(mockNetwork);
|
|
152
|
-
mockWalletProvider.getClient.mockReturnValue(mockCdpClient);
|
|
153
|
-
await expect(actionProvider.swap(mockWalletProvider, {
|
|
154
|
-
fromAssetId: "sol",
|
|
155
|
-
toAssetId: "usdc",
|
|
156
|
-
amount: "1",
|
|
157
|
-
})).rejects.toThrow("Swap is currently only supported on EVM networks");
|
|
158
|
-
});
|
|
159
|
-
it("should throw error for wallet provider without client", async () => {
|
|
160
|
-
const mockWalletWithoutClient = {
|
|
161
|
-
getNetwork: jest.fn().mockReturnValue({ protocolFamily: "evm", networkId: "base-sepolia" }),
|
|
162
|
-
};
|
|
163
|
-
await expect(actionProvider.swap(mockWalletWithoutClient, {
|
|
164
|
-
fromAssetId: "eth",
|
|
165
|
-
toAssetId: "usdc",
|
|
166
|
-
amount: "0.1",
|
|
167
|
-
})).rejects.toThrow("Wallet provider is not a CDP Wallet Provider");
|
|
168
|
-
});
|
|
169
|
-
it("should handle swap errors", async () => {
|
|
170
|
-
const mockNetwork = { protocolFamily: "evm", networkId: "base-sepolia" };
|
|
171
|
-
mockWalletProvider.getNetwork.mockReturnValue(mockNetwork);
|
|
172
|
-
mockWalletProvider.getAddress.mockReturnValue("0x123456789");
|
|
173
|
-
mockWalletProvider.getClient.mockReturnValue(mockCdpClient);
|
|
174
|
-
const mockAccount = { swap: jest.fn() };
|
|
175
|
-
mockCdpClient.evm.getAccount.mockResolvedValue(mockAccount);
|
|
176
|
-
mockAccount.swap.mockRejectedValue(new Error("Insufficient liquidity"));
|
|
177
|
-
await expect(actionProvider.swap(mockWalletProvider, {
|
|
178
|
-
fromAssetId: "eth",
|
|
179
|
-
toAssetId: "usdc",
|
|
180
|
-
amount: "1000",
|
|
181
|
-
})).rejects.toThrow("Swap failed: Error: Insufficient liquidity");
|
|
182
|
-
});
|
|
183
|
-
});
|
|
184
90
|
describe("RequestFaucetFundsV2Schema", () => {
|
|
185
91
|
it("should validate correct input", () => {
|
|
186
92
|
const validInput = { assetId: "eth" };
|
|
@@ -193,35 +99,4 @@ describe("CDP API Action Provider", () => {
|
|
|
193
99
|
expect(result.success).toBe(true);
|
|
194
100
|
});
|
|
195
101
|
});
|
|
196
|
-
describe("SwapSchema", () => {
|
|
197
|
-
it("should validate correct swap input", () => {
|
|
198
|
-
const validInput = {
|
|
199
|
-
fromAssetId: "eth",
|
|
200
|
-
toAssetId: "usdc",
|
|
201
|
-
amount: "0.1",
|
|
202
|
-
};
|
|
203
|
-
const result = schemas_1.SwapSchema.safeParse(validInput);
|
|
204
|
-
expect(result.success).toBe(true);
|
|
205
|
-
expect(result.data).toEqual(validInput);
|
|
206
|
-
});
|
|
207
|
-
it("should validate swap input with network", () => {
|
|
208
|
-
const validInput = {
|
|
209
|
-
fromAssetId: "usdc",
|
|
210
|
-
toAssetId: "eth",
|
|
211
|
-
amount: "100",
|
|
212
|
-
network: "base-sepolia",
|
|
213
|
-
};
|
|
214
|
-
const result = schemas_1.SwapSchema.safeParse(validInput);
|
|
215
|
-
expect(result.success).toBe(true);
|
|
216
|
-
expect(result.data).toEqual(validInput);
|
|
217
|
-
});
|
|
218
|
-
it("should fail validation when missing required fields", () => {
|
|
219
|
-
const invalidInput = {
|
|
220
|
-
fromAssetId: "eth",
|
|
221
|
-
// missing toAssetId and amount
|
|
222
|
-
};
|
|
223
|
-
const result = schemas_1.SwapSchema.safeParse(invalidInput);
|
|
224
|
-
expect(result.success).toBe(false);
|
|
225
|
-
});
|
|
226
|
-
});
|
|
227
102
|
});
|