n8n-nodes-coinbase-cdp-agentkit 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +703 -0
- package/dist/credentials/CoinbaseCdpApi.credentials.d.ts +8 -0
- package/dist/credentials/CoinbaseCdpApi.credentials.d.ts.map +1 -0
- package/dist/credentials/CoinbaseCdpApi.credentials.js +37 -0
- package/dist/credentials/CoinbaseCdpApi.credentials.js.map +1 -0
- package/dist/icons/coinbase.svg +4 -0
- package/dist/nodes/CoinbaseAgentTool/CoinbaseAgentTool.node.d.ts +6 -0
- package/dist/nodes/CoinbaseAgentTool/CoinbaseAgentTool.node.d.ts.map +1 -0
- package/dist/nodes/CoinbaseAgentTool/CoinbaseAgentTool.node.js +110 -0
- package/dist/nodes/CoinbaseAgentTool/CoinbaseAgentTool.node.js.map +1 -0
- package/dist/nodes/CoinbaseAgentTool/CoinbaseAgentTool.node.json +17 -0
- package/dist/nodes/CoinbaseAgentTool/actions/erc20Balance.d.ts +3 -0
- package/dist/nodes/CoinbaseAgentTool/actions/erc20Balance.d.ts.map +1 -0
- package/dist/nodes/CoinbaseAgentTool/actions/erc20Balance.js +46 -0
- package/dist/nodes/CoinbaseAgentTool/actions/erc20Balance.js.map +1 -0
- package/dist/nodes/CoinbaseAgentTool/actions/erc20Transfer.d.ts +3 -0
- package/dist/nodes/CoinbaseAgentTool/actions/erc20Transfer.d.ts.map +1 -0
- package/dist/nodes/CoinbaseAgentTool/actions/erc20Transfer.js +44 -0
- package/dist/nodes/CoinbaseAgentTool/actions/erc20Transfer.js.map +1 -0
- package/dist/nodes/CoinbaseAgentTool/actions/getSwapPrice.d.ts +3 -0
- package/dist/nodes/CoinbaseAgentTool/actions/getSwapPrice.d.ts.map +1 -0
- package/dist/nodes/CoinbaseAgentTool/actions/getSwapPrice.js +57 -0
- package/dist/nodes/CoinbaseAgentTool/actions/getSwapPrice.js.map +1 -0
- package/dist/nodes/CoinbaseAgentTool/actions/nativeTransfer.d.ts +3 -0
- package/dist/nodes/CoinbaseAgentTool/actions/nativeTransfer.d.ts.map +1 -0
- package/dist/nodes/CoinbaseAgentTool/actions/nativeTransfer.js +41 -0
- package/dist/nodes/CoinbaseAgentTool/actions/nativeTransfer.js.map +1 -0
- package/dist/nodes/CoinbaseAgentTool/actions/requestFaucet.d.ts +3 -0
- package/dist/nodes/CoinbaseAgentTool/actions/requestFaucet.d.ts.map +1 -0
- package/dist/nodes/CoinbaseAgentTool/actions/requestFaucet.js +50 -0
- package/dist/nodes/CoinbaseAgentTool/actions/requestFaucet.js.map +1 -0
- package/dist/nodes/CoinbaseAgentTool/actions/swap.d.ts +3 -0
- package/dist/nodes/CoinbaseAgentTool/actions/swap.d.ts.map +1 -0
- package/dist/nodes/CoinbaseAgentTool/actions/swap.js +49 -0
- package/dist/nodes/CoinbaseAgentTool/actions/swap.js.map +1 -0
- package/dist/nodes/CoinbaseAgentTool/actions/walletDetails.d.ts +3 -0
- package/dist/nodes/CoinbaseAgentTool/actions/walletDetails.d.ts.map +1 -0
- package/dist/nodes/CoinbaseAgentTool/actions/walletDetails.js +25 -0
- package/dist/nodes/CoinbaseAgentTool/actions/walletDetails.js.map +1 -0
- package/dist/nodes/CoinbaseAgentTool/coinbase.svg +4 -0
- package/dist/nodes/CoinbaseCdp/CoinbaseCdp.node.d.ts +6 -0
- package/dist/nodes/CoinbaseCdp/CoinbaseCdp.node.d.ts.map +1 -0
- package/dist/nodes/CoinbaseCdp/CoinbaseCdp.node.js +97 -0
- package/dist/nodes/CoinbaseCdp/CoinbaseCdp.node.js.map +1 -0
- package/dist/nodes/CoinbaseCdp/CoinbaseCdp.node.json +17 -0
- package/dist/nodes/CoinbaseCdp/coinbase.svg +4 -0
- package/dist/nodes/CoinbaseCdp/resources/account.d.ts +29 -0
- package/dist/nodes/CoinbaseCdp/resources/account.d.ts.map +1 -0
- package/dist/nodes/CoinbaseCdp/resources/account.js +119 -0
- package/dist/nodes/CoinbaseCdp/resources/account.js.map +1 -0
- package/dist/nodes/CoinbaseCdp/resources/balance.d.ts +12 -0
- package/dist/nodes/CoinbaseCdp/resources/balance.d.ts.map +1 -0
- package/dist/nodes/CoinbaseCdp/resources/balance.js +60 -0
- package/dist/nodes/CoinbaseCdp/resources/balance.js.map +1 -0
- package/dist/nodes/CoinbaseCdp/resources/policy.d.ts +13 -0
- package/dist/nodes/CoinbaseCdp/resources/policy.d.ts.map +1 -0
- package/dist/nodes/CoinbaseCdp/resources/policy.js +95 -0
- package/dist/nodes/CoinbaseCdp/resources/policy.js.map +1 -0
- package/dist/nodes/CoinbaseCdp/resources/smartAccount.d.ts +10 -0
- package/dist/nodes/CoinbaseCdp/resources/smartAccount.d.ts.map +1 -0
- package/dist/nodes/CoinbaseCdp/resources/smartAccount.js +56 -0
- package/dist/nodes/CoinbaseCdp/resources/smartAccount.js.map +1 -0
- package/dist/nodes/CoinbaseCdp/resources/solanaAccount.d.ts +17 -0
- package/dist/nodes/CoinbaseCdp/resources/solanaAccount.d.ts.map +1 -0
- package/dist/nodes/CoinbaseCdp/resources/solanaAccount.js +75 -0
- package/dist/nodes/CoinbaseCdp/resources/solanaAccount.js.map +1 -0
- package/dist/nodes/CoinbaseCdp/resources/swap.d.ts +32 -0
- package/dist/nodes/CoinbaseCdp/resources/swap.d.ts.map +1 -0
- package/dist/nodes/CoinbaseCdp/resources/swap.js +124 -0
- package/dist/nodes/CoinbaseCdp/resources/swap.js.map +1 -0
- package/dist/nodes/CoinbaseCdp/resources/transfer.d.ts +12 -0
- package/dist/nodes/CoinbaseCdp/resources/transfer.d.ts.map +1 -0
- package/dist/nodes/CoinbaseCdp/resources/transfer.js +116 -0
- package/dist/nodes/CoinbaseCdp/resources/transfer.js.map +1 -0
- package/dist/nodes/CoinbaseTrigger/CoinbaseTrigger.node.d.ts +6 -0
- package/dist/nodes/CoinbaseTrigger/CoinbaseTrigger.node.d.ts.map +1 -0
- package/dist/nodes/CoinbaseTrigger/CoinbaseTrigger.node.js +106 -0
- package/dist/nodes/CoinbaseTrigger/CoinbaseTrigger.node.js.map +1 -0
- package/dist/nodes/CoinbaseTrigger/CoinbaseTrigger.node.json +17 -0
- package/dist/nodes/CoinbaseTrigger/coinbase.svg +4 -0
- package/dist/shared/cdpClientFactory.d.ts +6 -0
- package/dist/shared/cdpClientFactory.d.ts.map +1 -0
- package/dist/shared/cdpClientFactory.js +13 -0
- package/dist/shared/cdpClientFactory.js.map +1 -0
- package/dist/shared/networkOptions.d.ts +7 -0
- package/dist/shared/networkOptions.d.ts.map +1 -0
- package/dist/shared/networkOptions.js +36 -0
- package/dist/shared/networkOptions.js.map +1 -0
- package/dist/shared/toolFactory.d.ts +10 -0
- package/dist/shared/toolFactory.d.ts.map +1 -0
- package/dist/shared/toolFactory.js +21 -0
- package/dist/shared/toolFactory.js.map +1 -0
- package/dist/shared/types.d.ts +34 -0
- package/dist/shared/types.d.ts.map +1 -0
- package/dist/shared/types.js +3 -0
- package/dist/shared/types.js.map +1 -0
- package/dist/src/icons/coinbase.svg +4 -0
- package/package.json +78 -0
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ICredentialType, INodeProperties } from 'n8n-workflow';
|
|
2
|
+
export declare class CoinbaseCdpApi implements ICredentialType {
|
|
3
|
+
name: string;
|
|
4
|
+
displayName: string;
|
|
5
|
+
documentationUrl: string;
|
|
6
|
+
properties: INodeProperties[];
|
|
7
|
+
}
|
|
8
|
+
//# sourceMappingURL=CoinbaseCdpApi.credentials.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CoinbaseCdpApi.credentials.d.ts","sourceRoot":"","sources":["../../src/credentials/CoinbaseCdpApi.credentials.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,eAAe,EACf,eAAe,EACf,MAAM,cAAc,CAAC;AAEtB,qBAAa,cAAe,YAAW,eAAe;IACrD,IAAI,SAAoB;IACxB,WAAW,SAAsB;IACjC,gBAAgB,SAAoC;IACpD,UAAU,EAAE,eAAe,EAAE,CA0B3B;CACF"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CoinbaseCdpApi = void 0;
|
|
4
|
+
class CoinbaseCdpApi {
|
|
5
|
+
name = 'coinbaseCdpApi';
|
|
6
|
+
displayName = 'Coinbase CDP API';
|
|
7
|
+
documentationUrl = 'https://docs.cdp.coinbase.com/';
|
|
8
|
+
properties = [
|
|
9
|
+
{
|
|
10
|
+
displayName: 'API Key ID',
|
|
11
|
+
name: 'apiKeyId',
|
|
12
|
+
type: 'string',
|
|
13
|
+
default: '',
|
|
14
|
+
required: true,
|
|
15
|
+
description: 'Your CDP API Key ID from the Coinbase Developer Portal',
|
|
16
|
+
},
|
|
17
|
+
{
|
|
18
|
+
displayName: 'API Key Secret',
|
|
19
|
+
name: 'apiKeySecret',
|
|
20
|
+
type: 'string',
|
|
21
|
+
typeOptions: { password: true },
|
|
22
|
+
default: '',
|
|
23
|
+
required: true,
|
|
24
|
+
description: 'Your CDP API Key Secret (ES256 private key in PEM format)',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
displayName: 'Wallet Secret',
|
|
28
|
+
name: 'walletSecret',
|
|
29
|
+
type: 'string',
|
|
30
|
+
typeOptions: { password: true },
|
|
31
|
+
default: '',
|
|
32
|
+
description: 'Your CDP Wallet Secret for signing transactions. Leave empty for read-only operations.',
|
|
33
|
+
},
|
|
34
|
+
];
|
|
35
|
+
}
|
|
36
|
+
exports.CoinbaseCdpApi = CoinbaseCdpApi;
|
|
37
|
+
//# sourceMappingURL=CoinbaseCdpApi.credentials.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CoinbaseCdpApi.credentials.js","sourceRoot":"","sources":["../../src/credentials/CoinbaseCdpApi.credentials.ts"],"names":[],"mappings":";;;AAKA,MAAa,cAAc;IAC1B,IAAI,GAAG,gBAAgB,CAAC;IACxB,WAAW,GAAG,kBAAkB,CAAC;IACjC,gBAAgB,GAAG,gCAAgC,CAAC;IACpD,UAAU,GAAsB;QAC/B;YACC,WAAW,EAAE,YAAY;YACzB,IAAI,EAAE,UAAU;YAChB,IAAI,EAAE,QAAQ;YACd,OAAO,EAAE,EAAE;YACX,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,wDAAwD;SACrE;QACD;YACC,WAAW,EAAE,gBAAgB;YAC7B,IAAI,EAAE,cAAc;YACpB,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;YAC/B,OAAO,EAAE,EAAE;YACX,QAAQ,EAAE,IAAI;YACd,WAAW,EAAE,2DAA2D;SACxE;QACD;YACC,WAAW,EAAE,eAAe;YAC5B,IAAI,EAAE,cAAc;YACpB,IAAI,EAAE,QAAQ;YACd,WAAW,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE;YAC/B,OAAO,EAAE,EAAE;YACX,WAAW,EAAE,wFAAwF;SACrG;KACD,CAAC;CACF;AA/BD,wCA+BC"}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 56 56" fill="none">
|
|
2
|
+
<path d="M28 56C43.464 56 56 43.464 56 28C56 12.536 43.464 0 28 0C12.536 0 0 12.536 0 28C0 43.464 12.536 56 28 56Z" fill="#0052FF"/>
|
|
3
|
+
<path d="M28 10C18.059 10 10 18.059 10 28C10 37.941 18.059 46 28 46C37.941 46 46 37.941 46 28C46 18.059 37.941 10 28 10ZM23.5 33.5C22.672 33.5 22 32.828 22 32V24C22 23.172 22.672 22.5 23.5 22.5H32.5C33.328 22.5 34 23.172 34 24V32C34 32.828 33.328 33.5 32.5 33.5H23.5Z" fill="white"/>
|
|
4
|
+
</svg>
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { INodeType, INodeTypeDescription, ISupplyDataFunctions, SupplyData } from 'n8n-workflow';
|
|
2
|
+
export declare class CoinbaseAgentTool implements INodeType {
|
|
3
|
+
description: INodeTypeDescription;
|
|
4
|
+
supplyData(this: ISupplyDataFunctions, _itemIndex: number): Promise<SupplyData>;
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=CoinbaseAgentTool.node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CoinbaseAgentTool.node.d.ts","sourceRoot":"","sources":["../../../src/nodes/CoinbaseAgentTool/CoinbaseAgentTool.node.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,SAAS,EACT,oBAAoB,EACpB,oBAAoB,EACpB,UAAU,EACV,MAAM,cAAc,CAAC;AAoBtB,qBAAa,iBAAkB,YAAW,SAAS;IAClD,WAAW,EAAE,oBAAoB,CA8E/B;IAEI,UAAU,CAAC,IAAI,EAAE,oBAAoB,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC;CAOrF"}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CoinbaseAgentTool = void 0;
|
|
4
|
+
const cdpClientFactory_1 = require("../../shared/cdpClientFactory");
|
|
5
|
+
const walletDetails_1 = require("./actions/walletDetails");
|
|
6
|
+
const nativeTransfer_1 = require("./actions/nativeTransfer");
|
|
7
|
+
const erc20Transfer_1 = require("./actions/erc20Transfer");
|
|
8
|
+
const erc20Balance_1 = require("./actions/erc20Balance");
|
|
9
|
+
const swap_1 = require("./actions/swap");
|
|
10
|
+
const getSwapPrice_1 = require("./actions/getSwapPrice");
|
|
11
|
+
const requestFaucet_1 = require("./actions/requestFaucet");
|
|
12
|
+
const toolBuilders = {
|
|
13
|
+
walletDetails: walletDetails_1.walletDetailsTool,
|
|
14
|
+
nativeTransfer: nativeTransfer_1.nativeTransferTool,
|
|
15
|
+
erc20Transfer: erc20Transfer_1.erc20TransferTool,
|
|
16
|
+
erc20Balance: erc20Balance_1.erc20BalanceTool,
|
|
17
|
+
swap: swap_1.swapTool,
|
|
18
|
+
getSwapPrice: getSwapPrice_1.getSwapPriceTool,
|
|
19
|
+
requestFaucet: requestFaucet_1.requestFaucetTool,
|
|
20
|
+
};
|
|
21
|
+
class CoinbaseAgentTool {
|
|
22
|
+
description = {
|
|
23
|
+
displayName: 'Coinbase CDP Tool',
|
|
24
|
+
name: 'coinbaseAgentTool',
|
|
25
|
+
icon: 'file:coinbase.svg',
|
|
26
|
+
group: ['transform'],
|
|
27
|
+
version: 1,
|
|
28
|
+
description: 'Use Coinbase CDP as a tool for AI agents - wallets, transfers, swaps, and more',
|
|
29
|
+
defaults: {
|
|
30
|
+
name: 'Coinbase CDP Tool',
|
|
31
|
+
},
|
|
32
|
+
codex: {
|
|
33
|
+
categories: ['AI'],
|
|
34
|
+
subcategories: {
|
|
35
|
+
AI: ['Tools'],
|
|
36
|
+
},
|
|
37
|
+
resources: {
|
|
38
|
+
primaryDocumentation: [
|
|
39
|
+
{
|
|
40
|
+
url: 'https://docs.cdp.coinbase.com/',
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
inputs: [],
|
|
46
|
+
outputs: ['ai_tool'],
|
|
47
|
+
outputNames: ['Tool'],
|
|
48
|
+
credentials: [
|
|
49
|
+
{
|
|
50
|
+
name: 'coinbaseCdpApi',
|
|
51
|
+
required: true,
|
|
52
|
+
},
|
|
53
|
+
],
|
|
54
|
+
properties: [
|
|
55
|
+
{
|
|
56
|
+
displayName: 'Tool',
|
|
57
|
+
name: 'tool',
|
|
58
|
+
type: 'options',
|
|
59
|
+
noDataExpression: true,
|
|
60
|
+
default: 'walletDetails',
|
|
61
|
+
options: [
|
|
62
|
+
{
|
|
63
|
+
name: 'Get Wallet Details',
|
|
64
|
+
value: 'walletDetails',
|
|
65
|
+
description: 'Get or create an EVM account and return its address',
|
|
66
|
+
},
|
|
67
|
+
{
|
|
68
|
+
name: 'Native Transfer',
|
|
69
|
+
value: 'nativeTransfer',
|
|
70
|
+
description: 'Transfer native cryptocurrency (ETH, etc.) to an address',
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
name: 'ERC-20 Transfer',
|
|
74
|
+
value: 'erc20Transfer',
|
|
75
|
+
description: 'Transfer an ERC-20 token (USDC, DAI, etc.) to an address',
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
name: 'Get Balance',
|
|
79
|
+
value: 'erc20Balance',
|
|
80
|
+
description: 'Check the balance of any token for a wallet address',
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
name: 'Swap Tokens',
|
|
84
|
+
value: 'swap',
|
|
85
|
+
description: 'Swap one token for another on Base or Ethereum',
|
|
86
|
+
},
|
|
87
|
+
{
|
|
88
|
+
name: 'Get Swap Price',
|
|
89
|
+
value: 'getSwapPrice',
|
|
90
|
+
description: 'Get a price quote for a token swap without executing',
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
name: 'Request Faucet',
|
|
94
|
+
value: 'requestFaucet',
|
|
95
|
+
description: 'Request testnet tokens from a faucet',
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
|
+
},
|
|
99
|
+
],
|
|
100
|
+
};
|
|
101
|
+
async supplyData(_itemIndex) {
|
|
102
|
+
const toolName = this.getNodeParameter('tool', 0);
|
|
103
|
+
const cdp = await (0, cdpClientFactory_1.getCdpClient)(this);
|
|
104
|
+
const builder = toolBuilders[toolName];
|
|
105
|
+
const tool = builder(cdp);
|
|
106
|
+
return { response: tool };
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
exports.CoinbaseAgentTool = CoinbaseAgentTool;
|
|
110
|
+
//# sourceMappingURL=CoinbaseAgentTool.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CoinbaseAgentTool.node.js","sourceRoot":"","sources":["../../../src/nodes/CoinbaseAgentTool/CoinbaseAgentTool.node.ts"],"names":[],"mappings":";;;AAMA,o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qD;qBAClE;oBACD;wBACC,IAAI,EAAE,iBAAiB;wBACvB,KAAK,EAAE,gBAAgB;wBACvB,WAAW,EAAE,0DAA0D;qBACvE;oBACD;wBACC,IAAI,EAAE,iBAAiB;wBACvB,KAAK,EAAE,eAAe;wBACtB,WAAW,EAAE,0DAA0D;qBACvE;oBACD;wBACC,IAAI,EAAE,aAAa;wBACnB,KAAK,EAAE,cAAc;wBACrB,WAAW,EAAE,qDAAqD;qBAClE;oBACD;wBACC,IAAI,EAAE,aAAa;wBACnB,KAAK,EAAE,MAAM;wBACb,WAAW,EAAE,gDAAgD;qBAC7D;oBACD;wBACC,IAAI,EAAE,gBAAgB;wBACtB,KAAK,EAAE,cAAc;wBACrB,WAAW,EAAE,sDAAsD;qBACnE;oBACD;wBACC,IAAI,EAAE,gBAAgB;wBACtB,KAAK,EAAE,eAAe;wBACtB,WAAW,EAAE,sCAAsC;qBACnD;iBACD;aACD;SACD;KACD,CAAC;IAEF,KAAK,CAAC,UAAU,CAA6B,UAAkB;QAC9D,MAAM,QAAQ,GAAG,IAAI,CAAC,gBAAgB,CAAC,MAAM,EAAE,CAAC,CAA8B,CAAC;QAC/E,MAAM,GAAG,GAAG,MAAM,IAAA,+BAAY,EAAC,IAAI,CAAC,CAAC;QACrC,MAAM,OAAO,GAAG,YAAY,CAAC,QAAQ,CAAC,CAAC;QACvC,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC;QAC1B,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,CAAC;IAC3B,CAAC;CACD;AAxFD,8CAwFC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"node": "n8n-nodes-coinbase-cdp.coinbaseAgentTool",
|
|
3
|
+
"nodeVersion": "1.0",
|
|
4
|
+
"codexVersion": "1.0",
|
|
5
|
+
"categories": ["AI"],
|
|
6
|
+
"subcategories": {
|
|
7
|
+
"AI": ["Tools"]
|
|
8
|
+
},
|
|
9
|
+
"resources": {
|
|
10
|
+
"primaryDocumentation": [
|
|
11
|
+
{
|
|
12
|
+
"url": "https://docs.cdp.coinbase.com/"
|
|
13
|
+
}
|
|
14
|
+
]
|
|
15
|
+
},
|
|
16
|
+
"alias": ["coinbase", "cdp", "blockchain", "wallet", "crypto", "web3", "agent"]
|
|
17
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"erc20Balance.d.ts","sourceRoot":"","sources":["../../../../src/nodes/CoinbaseAgentTool/actions/erc20Balance.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAGnD,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,SAAS,wHA2C9C"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.erc20BalanceTool = erc20BalanceTool;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const toolFactory_1 = require("../../../shared/toolFactory");
|
|
6
|
+
function erc20BalanceTool(cdp) {
|
|
7
|
+
return (0, toolFactory_1.createAgentTool)({
|
|
8
|
+
name: 'get_balance',
|
|
9
|
+
description: 'Get the balance of a specific token for a given wallet address on a network. ' +
|
|
10
|
+
'Supports native tokens (e.g. "eth") and ERC-20 tokens (e.g. "usdc" or contract address). ' +
|
|
11
|
+
'Returns the balance in human-readable units.',
|
|
12
|
+
schema: zod_1.z.object({
|
|
13
|
+
address: zod_1.z.string().describe('The wallet address to check (0x...)'),
|
|
14
|
+
token: zod_1.z
|
|
15
|
+
.string()
|
|
16
|
+
.describe('Token symbol (e.g. "eth", "usdc") or contract address (0x...)'),
|
|
17
|
+
network: zod_1.z
|
|
18
|
+
.string()
|
|
19
|
+
.describe('The network to check (e.g. "base-sepolia", "base", "ethereum")'),
|
|
20
|
+
}),
|
|
21
|
+
func: async (input) => {
|
|
22
|
+
const balances = await cdp.evm.listTokenBalances({
|
|
23
|
+
address: input.address,
|
|
24
|
+
network: input.network,
|
|
25
|
+
});
|
|
26
|
+
const token = input.token.toLowerCase();
|
|
27
|
+
const matched = balances.balances.find((b) => b.token.symbol?.toLowerCase() === token ||
|
|
28
|
+
b.token.contractAddress?.toLowerCase() === token);
|
|
29
|
+
if (matched) {
|
|
30
|
+
return JSON.stringify({
|
|
31
|
+
address: input.address,
|
|
32
|
+
token: matched.token.symbol || input.token,
|
|
33
|
+
amount: matched.amount,
|
|
34
|
+
network: input.network,
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
return JSON.stringify({
|
|
38
|
+
address: input.address,
|
|
39
|
+
token: input.token,
|
|
40
|
+
amount: '0',
|
|
41
|
+
network: input.network,
|
|
42
|
+
});
|
|
43
|
+
},
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=erc20Balance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"erc20Balance.js","sourceRoot":"","sources":["../../../../src/nodes/CoinbaseAgentTool/actions/erc20Balance.ts"],"names":[],"mappings":";;AAIA,4CA2CC;AA/CD,6BAAwB;AAExB,6DAA8D;AAE9D,SAAgB,gBAAgB,CAAC,GAAc;IAC9C,OAAO,IAAA,6BAAe,EAAC;QACtB,IAAI,EAAE,aAAa;QACnB,WAAW,EACV,+EAA+E;YAC/E,2FAA2F;YAC3F,8CAA8C;QAC/C,MAAM,EAAE,OAAC,CAAC,MAAM,CAAC;YAChB,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,qCAAqC,CAAC;YACnE,KAAK,EAAE,OAAC;iBACN,MAAM,EAAE;iBACR,QAAQ,CAAC,+DAA+D,CAAC;YAC3E,OAAO,EAAE,OAAC;iBACR,MAAM,EAAE;iBACR,QAAQ,CAAC,gEAAgE,CAAC;SAC5E,CAA+B;QAChC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;YACrB,MAAM,QAAQ,GAAG,MAAM,GAAG,CAAC,GAAG,CAAC,iBAAiB,CAAC;gBAChD,OAAO,EAAE,KAAK,CAAC,OAAwB;gBACvC,OAAO,EAAE,KAAK,CAAC,OAAyB;aACxC,CAAC,CAAC;YACH,MAAM,KAAK,GAAI,KAAK,CAAC,KAAgB,CAAC,WAAW,EAAE,CAAC;YACpD,MAAM,OAAO,GAAG,QAAQ,CAAC,QAAQ,CAAC,IAAI,CACrC,CAAC,CAAC,EAAE,EAAE,CACL,CAAC,CAAC,KAAK,CAAC,MAAM,EAAE,WAAW,EAAE,KAAK,KAAK;gBACvC,CAAC,CAAC,KAAK,CAAC,eAAe,EAAE,WAAW,EAAE,KAAK,KAAK,CACjD,CAAC;YACF,IAAI,OAAO,EAAE,CAAC;gBACb,OAAO,IAAI,CAAC,SAAS,CAAC;oBACrB,OAAO,EAAE,KAAK,CAAC,OAAO;oBACtB,KAAK,EAAE,OAAO,CAAC,KAAK,CAAC,MAAM,IAAI,KAAK,CAAC,KAAK;oBAC1C,MAAM,EAAE,OAAO,CAAC,MAAM;oBACtB,OAAO,EAAE,KAAK,CAAC,OAAO;iBACtB,CAAC,CAAC;YACJ,CAAC;YACD,OAAO,IAAI,CAAC,SAAS,CAAC;gBACrB,OAAO,EAAE,KAAK,CAAC,OAAO;gBACtB,KAAK,EAAE,KAAK,CAAC,KAAK;gBAClB,MAAM,EAAE,GAAG;gBACX,OAAO,EAAE,KAAK,CAAC,OAAO;aACtB,CAAC,CAAC;QACJ,CAAC;KACD,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { CdpClient } from '@coinbase/cdp-sdk';
|
|
2
|
+
export declare function erc20TransferTool(cdp: CdpClient): import("@langchain/core/tools").DynamicStructuredTool<import("@langchain/core/tools").ToolSchemaBase, any, any, any>;
|
|
3
|
+
//# sourceMappingURL=erc20Transfer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"erc20Transfer.d.ts","sourceRoot":"","sources":["../../../../src/nodes/CoinbaseAgentTool/actions/erc20Transfer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAGnD,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,SAAS,wHAsC/C"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.erc20TransferTool = erc20TransferTool;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const toolFactory_1 = require("../../../shared/toolFactory");
|
|
6
|
+
function erc20TransferTool(cdp) {
|
|
7
|
+
return (0, toolFactory_1.createAgentTool)({
|
|
8
|
+
name: 'erc20_transfer',
|
|
9
|
+
description: 'Transfer an ERC-20 token from your wallet to another address. ' +
|
|
10
|
+
'You can specify common tokens by symbol (e.g. "usdc", "dai") or by contract address. ' +
|
|
11
|
+
'The amount should be in human-readable units (e.g. "10" for 10 USDC).',
|
|
12
|
+
schema: zod_1.z.object({
|
|
13
|
+
accountName: zod_1.z.string().describe('The name of the sender account'),
|
|
14
|
+
to: zod_1.z.string().describe('The destination wallet address (0x...)'),
|
|
15
|
+
amount: zod_1.z.string().describe('Amount in human-readable units (e.g. "10" for 10 USDC)'),
|
|
16
|
+
token: zod_1.z
|
|
17
|
+
.string()
|
|
18
|
+
.describe('Token symbol (e.g. "usdc") or contract address (0x...)'),
|
|
19
|
+
network: zod_1.z
|
|
20
|
+
.string()
|
|
21
|
+
.describe('The network to use (e.g. "base-sepolia", "base", "ethereum")'),
|
|
22
|
+
}),
|
|
23
|
+
func: async (input) => {
|
|
24
|
+
const account = await cdp.evm.getOrCreateAccount({
|
|
25
|
+
name: input.accountName,
|
|
26
|
+
});
|
|
27
|
+
const result = await account.transfer({
|
|
28
|
+
to: input.to,
|
|
29
|
+
amount: input.amount,
|
|
30
|
+
token: input.token,
|
|
31
|
+
network: input.network,
|
|
32
|
+
});
|
|
33
|
+
return JSON.stringify({
|
|
34
|
+
transactionHash: result.transactionHash,
|
|
35
|
+
from: account.address,
|
|
36
|
+
to: input.to,
|
|
37
|
+
amount: input.amount,
|
|
38
|
+
token: input.token,
|
|
39
|
+
network: input.network,
|
|
40
|
+
});
|
|
41
|
+
},
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
//# sourceMappingURL=erc20Transfer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"erc20Transfer.js","sourceRoot":"","sources":["../../../../src/nodes/CoinbaseAgentTool/actions/erc20Transfer.ts"],"names":[],"mappings":";;AAIA,8CAsCC;AA1CD,6BAAwB;AAExB,6DAA8D;AAE9D,SAAgB,iBAAiB,CAAC,GAAc;IAC/C,OAAO,IAAA,6BAAe,EAAC;QACtB,IAAI,EAAE,gBAAgB;QACtB,WAAW,EACV,gEAAgE;YAChE,uFAAuF;YACvF,uEAAuE;QACxE,MAAM,EAAE,OAAC,CAAC,MAAM,CAAC;YAChB,WAAW,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,gCAAgC,CAAC;YAClE,EAAE,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,wCAAwC,CAAC;YACjE,MAAM,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,wDAAwD,CAAC;YACrF,KAAK,EAAE,OAAC;iBACN,MAAM,EAAE;iBACR,QAAQ,CAAC,wDAAwD,CAAC;YACpE,OAAO,EAAE,OAAC;iBACR,MAAM,EAAE;iBACR,QAAQ,CAAC,8DAA8D,CAAC;SAC1E,CAA+B;QAChC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;YACrB,MAAM,OAAO,GAAG,MAAM,GAAG,CAAC,GAAG,CAAC,kBAAkB,CAAC;gBAChD,IAAI,EAAE,KAAK,CAAC,WAAqB;aACjC,CAAC,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,OAAO,CAAC,QAAQ,CAAC;gBACrC,EAAE,EAAE,KAAK,CAAC,EAAmB;gBAC7B,MAAM,EAAE,KAAK,CAAC,MAAqC;gBACnD,KAAK,EAAE,KAAK,CAAC,KAAe;gBAC5B,OAAO,EAAE,KAAK,CAAC,OAAyB;aACxC,CAAC,CAAC;YACH,OAAO,IAAI,CAAC,SAAS,CAAC;gBACrB,eAAe,EAAE,MAAM,CAAC,eAAe;gBACvC,IAAI,EAAE,OAAO,CAAC,OAAO;gBACrB,EAAE,EAAE,KAAK,CAAC,EAAE;gBACZ,MAAM,EAAE,KAAK,CAAC,MAAM;gBACpB,KAAK,EAAE,KAAK,CAAC,KAAK;gBAClB,OAAO,EAAE,KAAK,CAAC,OAAO;aACtB,CAAC,CAAC;QACJ,CAAC;KACD,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getSwapPrice.d.ts","sourceRoot":"","sources":["../../../../src/nodes/CoinbaseAgentTool/actions/getSwapPrice.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAGnD,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,SAAS,wHAmD9C"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getSwapPriceTool = getSwapPriceTool;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const toolFactory_1 = require("../../../shared/toolFactory");
|
|
6
|
+
function getSwapPriceTool(cdp) {
|
|
7
|
+
return (0, toolFactory_1.createAgentTool)({
|
|
8
|
+
name: 'get_swap_price',
|
|
9
|
+
description: 'Get a price quote for swapping one token for another without executing the trade. ' +
|
|
10
|
+
'Use this to check prices before executing a swap. Returns estimated output amount.',
|
|
11
|
+
schema: zod_1.z.object({
|
|
12
|
+
accountName: zod_1.z.string().describe('The name of the account to quote for'),
|
|
13
|
+
fromToken: zod_1.z
|
|
14
|
+
.string()
|
|
15
|
+
.describe('Token to swap from - symbol (e.g. "eth") or contract address'),
|
|
16
|
+
toToken: zod_1.z
|
|
17
|
+
.string()
|
|
18
|
+
.describe('Token to swap to - symbol (e.g. "usdc") or contract address'),
|
|
19
|
+
fromAmount: zod_1.z
|
|
20
|
+
.string()
|
|
21
|
+
.describe('Amount of source token in human-readable units'),
|
|
22
|
+
network: zod_1.z
|
|
23
|
+
.string()
|
|
24
|
+
.describe('Network for the quote (e.g. "base", "ethereum")'),
|
|
25
|
+
}),
|
|
26
|
+
func: async (input) => {
|
|
27
|
+
const account = await cdp.evm.getOrCreateAccount({
|
|
28
|
+
name: input.accountName,
|
|
29
|
+
});
|
|
30
|
+
const quote = await account.quoteSwap({
|
|
31
|
+
fromToken: input.fromToken,
|
|
32
|
+
toToken: input.toToken,
|
|
33
|
+
fromAmount: input.fromAmount,
|
|
34
|
+
network: input.network,
|
|
35
|
+
});
|
|
36
|
+
if (!quote.liquidityAvailable) {
|
|
37
|
+
return JSON.stringify({
|
|
38
|
+
error: 'Insufficient liquidity for swap',
|
|
39
|
+
fromToken: input.fromToken,
|
|
40
|
+
toToken: input.toToken,
|
|
41
|
+
fromAmount: input.fromAmount,
|
|
42
|
+
liquidityAvailable: false,
|
|
43
|
+
network: input.network,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
return JSON.stringify({
|
|
47
|
+
fromToken: input.fromToken,
|
|
48
|
+
toToken: input.toToken,
|
|
49
|
+
fromAmount: input.fromAmount,
|
|
50
|
+
toAmount: quote.toAmount,
|
|
51
|
+
liquidityAvailable: true,
|
|
52
|
+
network: input.network,
|
|
53
|
+
});
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=getSwapPrice.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getSwapPrice.js","sourceRoot":"","sources":["../../../../src/nodes/CoinbaseAgentTool/actions/getSwap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oBACtB,UAAU,EAAE,KAAK,CAAC,UAAU;oBAC5B,kBAAkB,EAAE,KAAK;oBACzB,OAAO,EAAE,KAAK,CAAC,OAAO;iBACtB,CAAC,CAAC;YACJ,CAAC;YACD,OAAO,IAAI,CAAC,SAAS,CAAC;gBACrB,SAAS,EAAE,KAAK,CAAC,SAAS;gBAC1B,OAAO,EAAE,KAAK,CAAC,OAAO;gBACtB,UAAU,EAAE,KAAK,CAAC,UAAU;gBAC5B,QAAQ,EAAE,KAAK,CAAC,QAAQ;gBACxB,kBAAkB,EAAE,IAAI;gBACxB,OAAO,EAAE,KAAK,CAAC,OAAO;aACtB,CAAC,CAAC;QACJ,CAAC;KACD,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { CdpClient } from '@coinbase/cdp-sdk';
|
|
2
|
+
export declare function nativeTransferTool(cdp: CdpClient): import("@langchain/core/tools").DynamicStructuredTool<import("@langchain/core/tools").ToolSchemaBase, any, any, any>;
|
|
3
|
+
//# sourceMappingURL=nativeTransfer.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nativeTransfer.d.ts","sourceRoot":"","sources":["../../../../src/nodes/CoinbaseAgentTool/actions/nativeTransfer.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAInD,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,SAAS,wHAkChD"}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.nativeTransferTool = nativeTransferTool;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const cdp_sdk_1 = require("@coinbase/cdp-sdk");
|
|
6
|
+
const toolFactory_1 = require("../../../shared/toolFactory");
|
|
7
|
+
function nativeTransferTool(cdp) {
|
|
8
|
+
return (0, toolFactory_1.createAgentTool)({
|
|
9
|
+
name: 'native_transfer',
|
|
10
|
+
description: 'Transfer native cryptocurrency (ETH, MATIC, AVAX, etc.) from your wallet to another address. ' +
|
|
11
|
+
'You must specify the amount in whole units (e.g. "0.01" for 0.01 ETH). ' +
|
|
12
|
+
'Do NOT use this for ERC-20 token transfers - use erc20_transfer instead.',
|
|
13
|
+
schema: zod_1.z.object({
|
|
14
|
+
accountName: zod_1.z.string().describe('The name of the sender account'),
|
|
15
|
+
to: zod_1.z.string().describe('The destination wallet address (0x...)'),
|
|
16
|
+
amount: zod_1.z.string().describe('Amount to transfer in whole units (e.g. "0.01")'),
|
|
17
|
+
network: zod_1.z
|
|
18
|
+
.string()
|
|
19
|
+
.describe('The network to use (e.g. "base-sepolia", "base", "ethereum")'),
|
|
20
|
+
}),
|
|
21
|
+
func: async (input) => {
|
|
22
|
+
const account = await cdp.evm.getOrCreateAccount({
|
|
23
|
+
name: input.accountName,
|
|
24
|
+
});
|
|
25
|
+
const result = await account.transfer({
|
|
26
|
+
to: input.to,
|
|
27
|
+
amount: (0, cdp_sdk_1.parseEther)(input.amount),
|
|
28
|
+
token: 'eth',
|
|
29
|
+
network: input.network,
|
|
30
|
+
});
|
|
31
|
+
return JSON.stringify({
|
|
32
|
+
transactionHash: result.transactionHash,
|
|
33
|
+
from: account.address,
|
|
34
|
+
to: input.to,
|
|
35
|
+
amount: input.amount,
|
|
36
|
+
network: input.network,
|
|
37
|
+
});
|
|
38
|
+
},
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
//# sourceMappingURL=nativeTransfer.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nativeTransfer.js","sourceRoot":"","sources":["../../../../src/nodes/CoinbaseAgentTool/actions/nativeTransfer.ts"],"names":[],"mappings":";;AAKA,gDAkCC;AAvCD,6BAAwB;AAExB,+CAA+C;AAC/C,6DAA8D;AAE9D,SAAgB,kBAAkB,CAAC,GAAc;IAChD,OAAO,IAAA,6BAAe,EAAC;QACtB,I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dp: CdpClient): import("@langchain/core/tools").DynamicStructuredTool<import("@langchain/core/tools").ToolSchemaBase, any, any, any>;
|
|
3
|
+
//# sourceMappingURL=requestFaucet.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requestFaucet.d.ts","sourceRoot":"","sources":["../../../../src/nodes/CoinbaseAgentTool/actions/requestFaucet.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAGnD,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,SAAS,wHA8C/C"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.requestFaucetTool = requestFaucetTool;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const toolFactory_1 = require("../../../shared/toolFactory");
|
|
6
|
+
function requestFaucetTool(cdp) {
|
|
7
|
+
return (0, toolFactory_1.createAgentTool)({
|
|
8
|
+
name: 'request_faucet',
|
|
9
|
+
description: 'Request testnet tokens from a faucet. Only works on testnets. ' +
|
|
10
|
+
'Available: ETH on base-sepolia/ethereum-sepolia, USDC on base-sepolia/ethereum-sepolia, SOL on solana-devnet.',
|
|
11
|
+
schema: zod_1.z.object({
|
|
12
|
+
address: zod_1.z.string().describe('The wallet address to receive testnet tokens'),
|
|
13
|
+
token: zod_1.z
|
|
14
|
+
.string()
|
|
15
|
+
.describe('Token to request: "eth", "usdc", or "sol"'),
|
|
16
|
+
network: zod_1.z
|
|
17
|
+
.string()
|
|
18
|
+
.describe('Testnet network: "base-sepolia", "ethereum-sepolia", or "solana-devnet"'),
|
|
19
|
+
}),
|
|
20
|
+
func: async (input) => {
|
|
21
|
+
const network = input.network;
|
|
22
|
+
if (network.startsWith('solana')) {
|
|
23
|
+
const result = await cdp.solana.requestFaucet({
|
|
24
|
+
address: input.address,
|
|
25
|
+
token: input.token,
|
|
26
|
+
});
|
|
27
|
+
return JSON.stringify({
|
|
28
|
+
success: true,
|
|
29
|
+
transactionSignature: result.signature,
|
|
30
|
+
address: input.address,
|
|
31
|
+
token: input.token,
|
|
32
|
+
network,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
const result = await cdp.evm.requestFaucet({
|
|
36
|
+
address: input.address,
|
|
37
|
+
token: input.token,
|
|
38
|
+
network: network,
|
|
39
|
+
});
|
|
40
|
+
return JSON.stringify({
|
|
41
|
+
success: true,
|
|
42
|
+
transactionHash: result.transactionHash,
|
|
43
|
+
address: input.address,
|
|
44
|
+
token: input.token,
|
|
45
|
+
network,
|
|
46
|
+
});
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=requestFaucet.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requestFaucet.js","sourceRoot":"","sources":["../../../../src/nodes/CoinbaseAgentTool/actions/requestFaucet.ts"],"names":[],"mappings":";;AAIA,8CA8CC;AAlDD,6BAAwB;AAExB,6DAA8D;AAE9D,SAAgB,iBAAiB,CAAC,GAAc;IAC/C,OAAO,IAAA,6BAAe,EAAC;QACtB,IAAI,EAAE,gBAAgB;QACtB,WAAW,EACV,gEAAgE;YAChE,+GAA+G;QAChH,MAAM,EAAE,OAAC,CAAC,MAAM,CAAC;YAChB,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,8CAA8C,CAAC;YAC5E,KAAK,EAAE,OAAC;iBACN,MAAM,EAAE;iBACR,QAAQ,CAAC,2CAA2C,CAAC;YACvD,OAAO,EAAE,OAAC;iBACR,MAAM,EAAE;iBACR,QAAQ,CACR,yEAAyE,CACzE;SACF,CAA+B;QAChC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;YACrB,MAAM,OAAO,GAAG,KAAK,CAAC,OAAiB,CAAC;YACxC,IAAI,OAAO,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAClC,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,MAAM,CAAC,aAAa,CAAC;oBAC7C,OAAO,EAAE,KAAK,CAAC,OAAiB;oBAChC,KAAK,EAAE,KAAK,CAAC,KAAc;iBAC3B,CAAC,CAAC;gBACH,OAAO,IAAI,CAAC,SAAS,CAAC;oBACrB,OAAO,EAAE,IAAI;oBACb,oBAAoB,EAAE,MAAM,CAAC,SAAS;oBACtC,OAAO,EAAE,KAAK,CAAC,OAAO;oBACtB,KAAK,EAAE,KAAK,CAAC,KAAK;oBAClB,OAAO;iBACP,CAAC,CAAC;YACJ,CAAC;YACD,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,GAAG,CAAC,aAAa,CAAC;gBAC1C,OAAO,EAAE,KAAK,CAAC,OAAwB;gBACvC,KAAK,EAAE,KAAK,CAAC,KAAc;gBAC3B,OAAO,EAAE,OAAyB;aAClC,CAAC,CAAC;YACH,OAAO,IAAI,CAAC,SAAS,CAAC;gBACrB,OAAO,EAAE,IAAI;gBACb,eAAe,EAAE,MAAM,CAAC,eAAe;gBACvC,OAAO,EAAE,KAAK,CAAC,OAAO;gBACtB,KAAK,EAAE,KAAK,CAAC,KAAK;gBAClB,OAAO;aACP,CAAC,CAAC;QACJ,CAAC;KACD,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"swap.d.ts","sourceRoot":"","sources":["../../../../src/nodes/CoinbaseAgentTool/actions/swap.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAGnD,wBAAgB,QAAQ,CAAC,GAAG,EAAE,SAAS,wHA2CtC"}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.swapTool = swapTool;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const toolFactory_1 = require("../../../shared/toolFactory");
|
|
6
|
+
function swapTool(cdp) {
|
|
7
|
+
return (0, toolFactory_1.createAgentTool)({
|
|
8
|
+
name: 'swap_tokens',
|
|
9
|
+
description: 'Swap one token for another on an EVM network. ' +
|
|
10
|
+
'Supported networks: Base, Ethereum (mainnet and testnet). ' +
|
|
11
|
+
'Specify tokens by symbol (e.g. "eth", "usdc") or contract address. ' +
|
|
12
|
+
'Amount is in human-readable units of the source token.',
|
|
13
|
+
schema: zod_1.z.object({
|
|
14
|
+
accountName: zod_1.z.string().describe('The name of the account performing the swap'),
|
|
15
|
+
fromToken: zod_1.z
|
|
16
|
+
.string()
|
|
17
|
+
.describe('Token to swap from - symbol (e.g. "eth") or contract address'),
|
|
18
|
+
toToken: zod_1.z
|
|
19
|
+
.string()
|
|
20
|
+
.describe('Token to swap to - symbol (e.g. "usdc") or contract address'),
|
|
21
|
+
fromAmount: zod_1.z
|
|
22
|
+
.string()
|
|
23
|
+
.describe('Amount of source token in human-readable units (e.g. "0.01")'),
|
|
24
|
+
network: zod_1.z
|
|
25
|
+
.string()
|
|
26
|
+
.describe('Network for the swap (e.g. "base", "base-sepolia", "ethereum")'),
|
|
27
|
+
}),
|
|
28
|
+
func: async (input) => {
|
|
29
|
+
const account = await cdp.evm.getOrCreateAccount({
|
|
30
|
+
name: input.accountName,
|
|
31
|
+
});
|
|
32
|
+
const result = await account.swap({
|
|
33
|
+
fromToken: input.fromToken,
|
|
34
|
+
toToken: input.toToken,
|
|
35
|
+
fromAmount: input.fromAmount,
|
|
36
|
+
network: input.network,
|
|
37
|
+
});
|
|
38
|
+
return JSON.stringify({
|
|
39
|
+
transactionHash: result.transactionHash,
|
|
40
|
+
from: account.address,
|
|
41
|
+
fromToken: input.fromToken,
|
|
42
|
+
toToken: input.toToken,
|
|
43
|
+
fromAmount: input.fromAmount,
|
|
44
|
+
network: input.network,
|
|
45
|
+
});
|
|
46
|
+
},
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
//# sourceMappingURL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AM,CAAC,eAAe;gBACvC,IAAI,EAAE,OAAO,CAAC,OAAO;gBACrB,SAAS,EAAE,KAAK,CAAC,SAAS;gBAC1B,OAAO,EAAE,KAAK,CAAC,OAAO;gBACtB,UAAU,EAAE,KAAK,CAAC,UAAU;gBAC5B,OAAO,EAAE,KAAK,CAAC,OAAO;aACtB,CAAC,CAAC;QACJ,CAAC;KACD,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import type { CdpClient } from '@coinbase/cdp-sdk';
|
|
2
|
+
export declare function walletDetailsTool(cdp: CdpClient): import("@langchain/core/tools").DynamicStructuredTool<import("@langchain/core/tools").ToolSchemaBase, any, any, any>;
|
|
3
|
+
//# sourceMappingURL=walletDetails.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"walletDetails.d.ts","sourceRoot":"","sources":["../../../../src/nodes/CoinbaseAgentTool/actions/walletDetails.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAGnD,wBAAgB,iBAAiB,CAAC,GAAG,EAAE,SAAS,wHAmB/C"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.walletDetailsTool = walletDetailsTool;
|
|
4
|
+
const zod_1 = require("zod");
|
|
5
|
+
const toolFactory_1 = require("../../../shared/toolFactory");
|
|
6
|
+
function walletDetailsTool(cdp) {
|
|
7
|
+
return (0, toolFactory_1.createAgentTool)({
|
|
8
|
+
name: 'get_wallet_details',
|
|
9
|
+
description: 'Get details about an EVM account (wallet) including its address. ' +
|
|
10
|
+
'Use this to retrieve an existing account by name or create a new one.',
|
|
11
|
+
schema: zod_1.z.object({
|
|
12
|
+
name: zod_1.z.string().describe('The name of the account to get or create'),
|
|
13
|
+
}),
|
|
14
|
+
func: async (input) => {
|
|
15
|
+
const account = await cdp.evm.getOrCreateAccount({
|
|
16
|
+
name: input.name,
|
|
17
|
+
});
|
|
18
|
+
return JSON.stringify({
|
|
19
|
+
address: account.address,
|
|
20
|
+
name: input.name,
|
|
21
|
+
});
|
|
22
|
+
},
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
//# sourceMappingURL=walletDetails.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"walletDetails.js","sourceRoot":"","sources":["../../../../src/nodes/CoinbaseAgentTool/actions/walletDetails.ts"],"names":[],"mappings":";;AAIA,8CAmBC;AAvBD,6BAAwB;AAExB,6DAA8D;AAE9D,SAAgB,iBAAiB,CAAC,GAAc;IAC/C,OAAO,IAAA,6BAAe,EAAC;QACtB,IAAI,EAAE,oBAAoB;QAC1B,WAAW,EACV,mEAAmE;YACnE,uEAAuE;QACxE,MAAM,EAAE,OAAC,CAAC,MAAM,CAAC;YAChB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,CAAC,0CAA0C,CAAC;SACrE,CAA+B;QAChC,IAAI,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE;YACrB,MAAM,OAAO,GAAG,MAAM,GAAG,CAAC,GAAG,CAAC,kBAAkB,CAAC;gBAChD,IAAI,EAAE,KAAK,CAAC,IAAc;aAC1B,CAAC,CAAC;YACH,OAAO,IAAI,CAAC,SAAS,CAAC;gBACrB,OAAO,EAAE,OAAO,CAAC,OAAO;gBACxB,IAAI,EAAE,KAAK,CAAC,IAAI;aAChB,CAAC,CAAC;QACJ,CAAC;KACD,CAAC,CAAC;AACJ,CAAC"}
|