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,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 { IExecuteFunctions, INodeExecutionData, INodeType, INodeTypeDescription } from 'n8n-workflow';
|
|
2
|
+
export declare class CoinbaseCdp implements INodeType {
|
|
3
|
+
description: INodeTypeDescription;
|
|
4
|
+
execute(this: IExecuteFunctions): Promise<INodeExecutionData[][]>;
|
|
5
|
+
}
|
|
6
|
+
//# sourceMappingURL=CoinbaseCdp.node.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CoinbaseCdp.node.d.ts","sourceRoot":"","sources":["../../../src/nodes/CoinbaseCdp/CoinbaseCdp.node.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACX,iBAAiB,EACjB,kBAAkB,EAClB,SAAS,EACT,oBAAoB,EACpB,MAAM,cAAc,CAAC;AAwBtB,qBAAa,WAAY,YAAW,SAAS;IAC5C,WAAW,EAAE,oBAAoB,CA6C/B;IAEI,OAAO,CAAC,IAAI,EAAE,iBAAiB,GAAG,OAAO,CAAC,kBAAkB,EAAE,EAAE,CAAC;CA6BvE"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.CoinbaseCdp = void 0;
|
|
4
|
+
const n8n_workflow_1 = require("n8n-workflow");
|
|
5
|
+
const cdpClientFactory_1 = require("../../shared/cdpClientFactory");
|
|
6
|
+
const account_1 = require("./resources/account");
|
|
7
|
+
const solanaAccount_1 = require("./resources/solanaAccount");
|
|
8
|
+
const smartAccount_1 = require("./resources/smartAccount");
|
|
9
|
+
const transfer_1 = require("./resources/transfer");
|
|
10
|
+
const swap_1 = require("./resources/swap");
|
|
11
|
+
const policy_1 = require("./resources/policy");
|
|
12
|
+
const balance_1 = require("./resources/balance");
|
|
13
|
+
const resourceExecutors = {
|
|
14
|
+
account: account_1.executeAccountOperation,
|
|
15
|
+
solanaAccount: solanaAccount_1.executeSolanaAccountOperation,
|
|
16
|
+
smartAccount: smartAccount_1.executeSmartAccountOperation,
|
|
17
|
+
transfer: transfer_1.executeTransferOperation,
|
|
18
|
+
swap: swap_1.executeSwapOperation,
|
|
19
|
+
policy: policy_1.executePolicyOperation,
|
|
20
|
+
balance: balance_1.executeBalanceOperation,
|
|
21
|
+
};
|
|
22
|
+
class CoinbaseCdp {
|
|
23
|
+
description = {
|
|
24
|
+
displayName: 'Coinbase CDP',
|
|
25
|
+
name: 'coinbaseCdp',
|
|
26
|
+
icon: 'file:coinbase.svg',
|
|
27
|
+
group: ['transform'],
|
|
28
|
+
version: 1,
|
|
29
|
+
subtitle: '={{$parameter["resource"] + ": " + $parameter["operation"]}}',
|
|
30
|
+
description: 'Interact with Coinbase Developer Platform - accounts, transfers, swaps, policies',
|
|
31
|
+
defaults: {
|
|
32
|
+
name: 'Coinbase CDP',
|
|
33
|
+
},
|
|
34
|
+
usableAsTool: true,
|
|
35
|
+
inputs: ['main'],
|
|
36
|
+
outputs: ['main'],
|
|
37
|
+
credentials: [
|
|
38
|
+
{
|
|
39
|
+
name: 'coinbaseCdpApi',
|
|
40
|
+
required: true,
|
|
41
|
+
},
|
|
42
|
+
],
|
|
43
|
+
properties: [
|
|
44
|
+
{
|
|
45
|
+
displayName: 'Resource',
|
|
46
|
+
name: 'resource',
|
|
47
|
+
type: 'options',
|
|
48
|
+
noDataExpression: true,
|
|
49
|
+
default: 'account',
|
|
50
|
+
options: [
|
|
51
|
+
{ name: 'EVM Account', value: 'account' },
|
|
52
|
+
{ name: 'Solana Account', value: 'solanaAccount' },
|
|
53
|
+
{ name: 'Smart Account', value: 'smartAccount' },
|
|
54
|
+
{ name: 'Transfer', value: 'transfer' },
|
|
55
|
+
{ name: 'Swap', value: 'swap' },
|
|
56
|
+
{ name: 'Policy', value: 'policy' },
|
|
57
|
+
{ name: 'Balance', value: 'balance' },
|
|
58
|
+
],
|
|
59
|
+
},
|
|
60
|
+
...account_1.accountOperations,
|
|
61
|
+
...solanaAccount_1.solanaAccountOperations,
|
|
62
|
+
...smartAccount_1.smartAccountOperations,
|
|
63
|
+
...transfer_1.transferOperations,
|
|
64
|
+
...swap_1.swapOperations,
|
|
65
|
+
...policy_1.policyOperations,
|
|
66
|
+
...balance_1.balanceOperations,
|
|
67
|
+
],
|
|
68
|
+
};
|
|
69
|
+
async execute() {
|
|
70
|
+
const items = this.getInputData();
|
|
71
|
+
const returnData = [];
|
|
72
|
+
const cdp = await (0, cdpClientFactory_1.getCdpClient)(this);
|
|
73
|
+
for (let i = 0; i < items.length; i++) {
|
|
74
|
+
try {
|
|
75
|
+
const resource = this.getNodeParameter('resource', i);
|
|
76
|
+
const operation = this.getNodeParameter('operation', i);
|
|
77
|
+
const executor = resourceExecutors[resource];
|
|
78
|
+
if (!executor) {
|
|
79
|
+
throw new n8n_workflow_1.NodeOperationError(this.getNode(), `Unknown resource: ${resource}`);
|
|
80
|
+
}
|
|
81
|
+
const result = await executor(this, cdp, operation, i);
|
|
82
|
+
returnData.push({ json: result });
|
|
83
|
+
}
|
|
84
|
+
catch (error) {
|
|
85
|
+
if (this.continueOnFail()) {
|
|
86
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
87
|
+
returnData.push({ json: { error: message } });
|
|
88
|
+
continue;
|
|
89
|
+
}
|
|
90
|
+
throw error;
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
return [returnData];
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
exports.CoinbaseCdp = CoinbaseCdp;
|
|
97
|
+
//# sourceMappingURL=CoinbaseCdp.node.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CoinbaseCdp.node.js","sourceRoot":"","sources":["../../../src/nodes/CoinbaseCdp/CoinbaseCdp.node.ts"],"names":[],"mappings":";;;AAMA,+CAAkD;AAClD,oEAA6D;AAC7D,iDAAiF;AACjF,6DAAmG;AACnG,2DAAgG;AAChG,mDAAoF;AACpF,2CAAwE;AACxE,+CAA8E;AAC9E,iDAAiF;AAEjF,MAAM,iBAAiB,GAGnB;IACH,OAAO,EAAE,iCAAuB;IAChC,aAAa,EAAE,6CAA6B;IAC5C,YAAY,EAAE,2CAA4B;IA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,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,CAAC,CAAC;oBAC9C,SAAS;gBACV,CAAC;gBACD,MAAM,KAAK,CAAC;YACb,CAAC;QACF,CAAC;QAED,OAAO,CAAC,UAAU,CAAC,CAAC;IACrB,CAAC;CACD;AA7ED,kCA6EC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"node": "n8n-nodes-coinbase-cdp.coinbaseCdp",
|
|
3
|
+
"nodeVersion": "1.0",
|
|
4
|
+
"codexVersion": "1.0",
|
|
5
|
+
"categories": ["Finance & Accounting"],
|
|
6
|
+
"subcategories": {
|
|
7
|
+
"Finance & Accounting": ["Cryptocurrency"]
|
|
8
|
+
},
|
|
9
|
+
"resources": {
|
|
10
|
+
"primaryDocumentation": [
|
|
11
|
+
{
|
|
12
|
+
"url": "https://docs.cdp.coinbase.com/"
|
|
13
|
+
}
|
|
14
|
+
]
|
|
15
|
+
},
|
|
16
|
+
"alias": ["coinbase", "cdp", "blockchain", "wallet", "crypto", "web3", "transfer", "swap"]
|
|
17
|
+
}
|
|
@@ -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,29 @@
|
|
|
1
|
+
import type { INodeProperties, IExecuteFunctions } from 'n8n-workflow';
|
|
2
|
+
import type { CdpClient } from '@coinbase/cdp-sdk';
|
|
3
|
+
export declare const accountOperations: INodeProperties[];
|
|
4
|
+
export declare function executeAccountOperation(context: IExecuteFunctions, cdp: CdpClient, operation: string, i: number): Promise<{
|
|
5
|
+
address: `0x${string}`;
|
|
6
|
+
name: string;
|
|
7
|
+
network?: undefined;
|
|
8
|
+
balances?: undefined;
|
|
9
|
+
transactionHash?: undefined;
|
|
10
|
+
token?: undefined;
|
|
11
|
+
} | {
|
|
12
|
+
address: string;
|
|
13
|
+
network: string;
|
|
14
|
+
balances: {
|
|
15
|
+
token: string;
|
|
16
|
+
amount: import("@coinbase/cdp-sdk/_types/actions/evm/listTokenBalances").EvmTokenAmount;
|
|
17
|
+
}[];
|
|
18
|
+
name?: undefined;
|
|
19
|
+
transactionHash?: undefined;
|
|
20
|
+
token?: undefined;
|
|
21
|
+
} | {
|
|
22
|
+
transactionHash: `0x${string}`;
|
|
23
|
+
address: string;
|
|
24
|
+
token: string;
|
|
25
|
+
network: string;
|
|
26
|
+
name?: undefined;
|
|
27
|
+
balances?: undefined;
|
|
28
|
+
}>;
|
|
29
|
+
//# sourceMappingURL=account.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account.d.ts","sourceRoot":"","sources":["../../../../src/nodes/CoinbaseCdp/resources/account.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACvE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAGnD,eAAO,MAAM,iBAAiB,EAAE,eAAe,EA6E9C,CAAC;AAEF,wBAAsB,uBAAuB,CAC5C,OAAO,EAAE,iBAAiB,EAC1B,GAAG,EAAE,SAAS,EACd,SAAS,EAAE,MAAM,EACjB,CAAC,EAAE,MAAM;;;;;;;;;;;;;;;;;;;;;;;;GAsCT"}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.accountOperations = void 0;
|
|
4
|
+
exports.executeAccountOperation = executeAccountOperation;
|
|
5
|
+
const networkOptions_1 = require("../../../shared/networkOptions");
|
|
6
|
+
exports.accountOperations = [
|
|
7
|
+
{
|
|
8
|
+
displayName: 'Operation',
|
|
9
|
+
name: 'operation',
|
|
10
|
+
type: 'options',
|
|
11
|
+
noDataExpression: true,
|
|
12
|
+
displayOptions: { show: { resource: ['account'] } },
|
|
13
|
+
default: 'getOrCreate',
|
|
14
|
+
options: [
|
|
15
|
+
{
|
|
16
|
+
name: 'Get or Create',
|
|
17
|
+
value: 'getOrCreate',
|
|
18
|
+
description: 'Get an existing EVM account by name, or create one',
|
|
19
|
+
action: 'Get or create an EVM account',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
name: 'List Balances',
|
|
23
|
+
value: 'listBalances',
|
|
24
|
+
description: 'List all token balances for an address',
|
|
25
|
+
action: 'List token balances',
|
|
26
|
+
},
|
|
27
|
+
{
|
|
28
|
+
name: 'Request Faucet',
|
|
29
|
+
value: 'requestFaucet',
|
|
30
|
+
description: 'Request testnet tokens from a faucet',
|
|
31
|
+
action: 'Request testnet faucet tokens',
|
|
32
|
+
},
|
|
33
|
+
],
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
displayName: 'Account Name',
|
|
37
|
+
name: 'accountName',
|
|
38
|
+
type: 'string',
|
|
39
|
+
default: '',
|
|
40
|
+
required: true,
|
|
41
|
+
displayOptions: { show: { resource: ['account'], operation: ['getOrCreate'] } },
|
|
42
|
+
description: 'Unique name for the account. Returns existing if name matches.',
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
displayName: 'Address',
|
|
46
|
+
name: 'address',
|
|
47
|
+
type: 'string',
|
|
48
|
+
default: '',
|
|
49
|
+
required: true,
|
|
50
|
+
displayOptions: { show: { resource: ['account'], operation: ['listBalances', 'requestFaucet'] } },
|
|
51
|
+
description: 'The EVM wallet address (0x...)',
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
displayName: 'Network',
|
|
55
|
+
name: 'network',
|
|
56
|
+
type: 'options',
|
|
57
|
+
default: 'base-sepolia',
|
|
58
|
+
displayOptions: { show: { resource: ['account'], operation: ['listBalances'] } },
|
|
59
|
+
options: networkOptions_1.evmNetworkOptions,
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
displayName: 'Faucet Network',
|
|
63
|
+
name: 'faucetNetwork',
|
|
64
|
+
type: 'options',
|
|
65
|
+
default: 'base-sepolia',
|
|
66
|
+
displayOptions: { show: { resource: ['account'], operation: ['requestFaucet'] } },
|
|
67
|
+
options: [
|
|
68
|
+
{ name: 'Base Sepolia', value: 'base-sepolia' },
|
|
69
|
+
{ name: 'Ethereum Sepolia', value: 'ethereum-sepolia' },
|
|
70
|
+
],
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
displayName: 'Token',
|
|
74
|
+
name: 'faucetToken',
|
|
75
|
+
type: 'options',
|
|
76
|
+
default: 'eth',
|
|
77
|
+
displayOptions: { show: { resource: ['account'], operation: ['requestFaucet'] } },
|
|
78
|
+
options: [
|
|
79
|
+
{ name: 'ETH', value: 'eth' },
|
|
80
|
+
{ name: 'USDC', value: 'usdc' },
|
|
81
|
+
],
|
|
82
|
+
},
|
|
83
|
+
];
|
|
84
|
+
async function executeAccountOperation(context, cdp, operation, i) {
|
|
85
|
+
if (operation === 'getOrCreate') {
|
|
86
|
+
const name = context.getNodeParameter('accountName', i);
|
|
87
|
+
const account = await cdp.evm.getOrCreateAccount({ name });
|
|
88
|
+
return { address: account.address, name };
|
|
89
|
+
}
|
|
90
|
+
if (operation === 'listBalances') {
|
|
91
|
+
const address = context.getNodeParameter('address', i);
|
|
92
|
+
const network = context.getNodeParameter('network', i);
|
|
93
|
+
const result = await cdp.evm.listTokenBalances({
|
|
94
|
+
address: address,
|
|
95
|
+
network: network,
|
|
96
|
+
});
|
|
97
|
+
return {
|
|
98
|
+
address,
|
|
99
|
+
network,
|
|
100
|
+
balances: result.balances.map((b) => ({
|
|
101
|
+
token: b.token.symbol || b.token.contractAddress,
|
|
102
|
+
amount: b.amount,
|
|
103
|
+
})),
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
if (operation === 'requestFaucet') {
|
|
107
|
+
const address = context.getNodeParameter('address', i);
|
|
108
|
+
const network = context.getNodeParameter('faucetNetwork', i);
|
|
109
|
+
const token = context.getNodeParameter('faucetToken', i);
|
|
110
|
+
const result = await cdp.evm.requestFaucet({
|
|
111
|
+
address: address,
|
|
112
|
+
token: token,
|
|
113
|
+
network: network,
|
|
114
|
+
});
|
|
115
|
+
return { transactionHash: result.transactionHash, address, token, network };
|
|
116
|
+
}
|
|
117
|
+
throw new Error(`Unknown account operation: ${operation}`);
|
|
118
|
+
}
|
|
119
|
+
//# sourceMappingURL=account.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account.js","sourceRoot":"","sources":["../../../../src/nodes/CoinbaseCdp/resources/account.ts"],"names":[],"mappings":";;;AAmFA,0DA0CC;AA3HD,mEAAmE;AAEtD,QAAA,iBAAiB,GAAsB;IACnD;QACC,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,SAAS;QACf,gBAAgB,EAAE,IAAI;QACtB,cAAc,EAAE,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,SAAS,CAAC,EAAE,EAAE;QACnD,OAAO,EAAE,aAAa;QACtB,OAAO,EAAE;YACR;gBACC,IAAI,EAAE,eAAe;gBACrB,KAAK,EAAE,aAAa;gBACpB,WAAW,EAAE,oDAAoD;gBACjE,MAAM,EAAE,8BAA8B;aACtC;YACD;gBACC,IAAI,EAAE,eAAe;gBACrB,KAAK,EAAE,cAAc;gBACrB,WAAW,EAAE,wCAAwC;gBACrD,MAAM,EAAE,qBAAqB;aAC7B;YACD;gBACC,IAAI,EAAE,gBAAgB;gBACtB,KAAK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,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;gBACrC,KAAK,EAAE,CAAC,CAAC,KAAK,CAAC,MAAM,IAAI,CAAC,CAAC,KAAK,CAAC,eAAe;gBAChD,MAAM,EAAE,CAAC,CAAC,MAAM;aAChB,CAAC,CAAC;SACH,CAAC;IACH,CAAC;IAED,IAAI,SAAS,KAAK,eAAe,EAAE,CAAC;QACnC,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC,SAAS,EAAE,CAAC,CAAW,CAAC;QACjE,MAAM,OAAO,GAAG,OAAO,CAAC,gBAAgB,CAAC,eAAe,EAAE,CAAC,CAAW,CAAC;QACvE,MAAM,KAAK,GAAG,OAAO,CAAC,gBAAgB,CAAC,aAAa,EAAE,CAAC,CAAW,CAAC;QACnE,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,GAAG,CAAC,aAAa,CAAC;YAC1C,OAAO,EAAE,OAAwB;YACjC,KAAK,EAAE,KAAc;YACrB,OAAO,EAAE,OAAyB;SAClC,CAAC,CAAC;QACH,OAAO,EAAE,eAAe,EAAE,MAAM,CAAC,eAAe,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,CAAC;IAC7E,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,8BAA8B,SAAS,EAAE,CAAC,CAAC;AAC5D,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { INodeProperties, IExecuteFunctions } from 'n8n-workflow';
|
|
2
|
+
import type { CdpClient } from '@coinbase/cdp-sdk';
|
|
3
|
+
export declare const balanceOperations: INodeProperties[];
|
|
4
|
+
export declare function executeBalanceOperation(context: IExecuteFunctions, cdp: CdpClient, operation: string, i: number): Promise<{
|
|
5
|
+
address: string;
|
|
6
|
+
network: string;
|
|
7
|
+
balances: {
|
|
8
|
+
token: string;
|
|
9
|
+
amount: import("@coinbase/cdp-sdk/_types/actions/evm/listTokenBalances").EvmTokenAmount;
|
|
10
|
+
}[];
|
|
11
|
+
}>;
|
|
12
|
+
//# sourceMappingURL=balance.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"balance.d.ts","sourceRoot":"","sources":["../../../../src/nodes/CoinbaseCdp/resources/balance.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACvE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAGnD,eAAO,MAAM,iBAAiB,EAAE,eAAe,EAkC9C,CAAC;AAEF,wBAAsB,uBAAuB,CAC5C,OAAO,EAAE,iBAAiB,EAC1B,GAAG,EAAE,SAAS,EACd,SAAS,EAAE,MAAM,EACjB,CAAC,EAAE,MAAM;;;;;;;GAoBT"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.balanceOperations = void 0;
|
|
4
|
+
exports.executeBalanceOperation = executeBalanceOperation;
|
|
5
|
+
const networkOptions_1 = require("../../../shared/networkOptions");
|
|
6
|
+
exports.balanceOperations = [
|
|
7
|
+
{
|
|
8
|
+
displayName: 'Operation',
|
|
9
|
+
name: 'operation',
|
|
10
|
+
type: 'options',
|
|
11
|
+
noDataExpression: true,
|
|
12
|
+
displayOptions: { show: { resource: ['balance'] } },
|
|
13
|
+
default: 'listTokens',
|
|
14
|
+
options: [
|
|
15
|
+
{
|
|
16
|
+
name: 'List Token Balances',
|
|
17
|
+
value: 'listTokens',
|
|
18
|
+
description: 'List all token balances for an EVM address',
|
|
19
|
+
action: 'List token balances',
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
},
|
|
23
|
+
{
|
|
24
|
+
displayName: 'Address',
|
|
25
|
+
name: 'address',
|
|
26
|
+
type: 'string',
|
|
27
|
+
default: '',
|
|
28
|
+
required: true,
|
|
29
|
+
displayOptions: { show: { resource: ['balance'] } },
|
|
30
|
+
description: 'The EVM wallet address (0x...)',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
displayName: 'Network',
|
|
34
|
+
name: 'network',
|
|
35
|
+
type: 'options',
|
|
36
|
+
default: 'base-sepolia',
|
|
37
|
+
displayOptions: { show: { resource: ['balance'] } },
|
|
38
|
+
options: networkOptions_1.evmNetworkOptions,
|
|
39
|
+
},
|
|
40
|
+
];
|
|
41
|
+
async function executeBalanceOperation(context, cdp, operation, i) {
|
|
42
|
+
if (operation === 'listTokens') {
|
|
43
|
+
const address = context.getNodeParameter('address', i);
|
|
44
|
+
const network = context.getNodeParameter('network', i);
|
|
45
|
+
const result = await cdp.evm.listTokenBalances({
|
|
46
|
+
address: address,
|
|
47
|
+
network: network,
|
|
48
|
+
});
|
|
49
|
+
return {
|
|
50
|
+
address,
|
|
51
|
+
network,
|
|
52
|
+
balances: result.balances.map((b) => ({
|
|
53
|
+
token: b.token.symbol || b.token.contractAddress,
|
|
54
|
+
amount: b.amount,
|
|
55
|
+
})),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
throw new Error(`Unknown balance operation: ${operation}`);
|
|
59
|
+
}
|
|
60
|
+
//# sourceMappingURL=balance.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"balance.js","sourceRoot":"","sources":["../../../../src/nodes/CoinbaseCdp/resources/balance.ts"],"names":[],"mappings":";;;AAwCA,0DAwBC;AA9DD,mEAAmE;AAEtD,QAAA,iBAAiB,GAAsB;IACnD;QACC,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,SAAS;QACf,gBAAgB,EAAE,IAAI;QACtB,cAAc,EAAE,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,SAAS,CAAC,EAAE,EAAE;QACnD,OAAO,EAAE,YAAY;QACrB,OAAO,EAAE;YACR;gBACC,IAAI,EAAE,qBAAqB;gBAC3B,KAAK,EAAE,YAAY;gBACnB,WAAW,EAA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,MAAM,IAAI,KAAK,CAAC,8BAA8B,SAAS,EAAE,CAAC,CAAC;AAC5D,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { INodeProperties, IExecuteFunctions } from 'n8n-workflow';
|
|
2
|
+
import type { CdpClient } from '@coinbase/cdp-sdk';
|
|
3
|
+
export declare const policyOperations: INodeProperties[];
|
|
4
|
+
export declare function executePolicyOperation(context: IExecuteFunctions, cdp: CdpClient, operation: string, i: number): Promise<import("@coinbase/cdp-sdk").Policy | {
|
|
5
|
+
policies: import("@coinbase/cdp-sdk/_types/client/policies/policies.types").ListPoliciesResult;
|
|
6
|
+
deleted?: undefined;
|
|
7
|
+
policyId?: undefined;
|
|
8
|
+
} | {
|
|
9
|
+
deleted: boolean;
|
|
10
|
+
policyId: string;
|
|
11
|
+
policies?: undefined;
|
|
12
|
+
}>;
|
|
13
|
+
//# sourceMappingURL=policy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"policy.d.ts","sourceRoot":"","sources":["../../../../src/nodes/CoinbaseCdp/resources/policy.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACvE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,eAAO,MAAM,gBAAgB,EAAE,eAAe,EA2D7C,CAAC;AAEF,wBAAsB,sBAAsB,CAC3C,OAAO,EAAE,iBAAiB,EAC1B,GAAG,EAAE,SAAS,EACd,SAAS,EAAE,MAAM,EACjB,CAAC,EAAE,MAAM;;;;;;;;GAmCT"}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.policyOperations = void 0;
|
|
4
|
+
exports.executePolicyOperation = executePolicyOperation;
|
|
5
|
+
exports.policyOperations = [
|
|
6
|
+
{
|
|
7
|
+
displayName: 'Operation',
|
|
8
|
+
name: 'operation',
|
|
9
|
+
type: 'options',
|
|
10
|
+
noDataExpression: true,
|
|
11
|
+
displayOptions: { show: { resource: ['policy'] } },
|
|
12
|
+
default: 'list',
|
|
13
|
+
options: [
|
|
14
|
+
{
|
|
15
|
+
name: 'Create',
|
|
16
|
+
value: 'create',
|
|
17
|
+
description: 'Create a new policy',
|
|
18
|
+
action: 'Create a policy',
|
|
19
|
+
},
|
|
20
|
+
{
|
|
21
|
+
name: 'Delete',
|
|
22
|
+
value: 'delete',
|
|
23
|
+
description: 'Delete a policy by ID',
|
|
24
|
+
action: 'Delete a policy',
|
|
25
|
+
},
|
|
26
|
+
{
|
|
27
|
+
name: 'Get',
|
|
28
|
+
value: 'get',
|
|
29
|
+
description: 'Get a policy by ID',
|
|
30
|
+
action: 'Get a policy',
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
name: 'List',
|
|
34
|
+
value: 'list',
|
|
35
|
+
description: 'List all policies',
|
|
36
|
+
action: 'List policies',
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
name: 'Update',
|
|
40
|
+
value: 'update',
|
|
41
|
+
description: 'Update a policy by ID',
|
|
42
|
+
action: 'Update a policy',
|
|
43
|
+
},
|
|
44
|
+
],
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
displayName: 'Policy ID',
|
|
48
|
+
name: 'policyId',
|
|
49
|
+
type: 'string',
|
|
50
|
+
default: '',
|
|
51
|
+
required: true,
|
|
52
|
+
displayOptions: { show: { resource: ['policy'], operation: ['get', 'update', 'delete'] } },
|
|
53
|
+
description: 'The ID of the policy',
|
|
54
|
+
},
|
|
55
|
+
{
|
|
56
|
+
displayName: 'Policy JSON',
|
|
57
|
+
name: 'policyJson',
|
|
58
|
+
type: 'json',
|
|
59
|
+
default: '{}',
|
|
60
|
+
required: true,
|
|
61
|
+
displayOptions: { show: { resource: ['policy'], operation: ['create', 'update'] } },
|
|
62
|
+
description: 'Policy configuration as JSON. See CDP docs for schema.',
|
|
63
|
+
},
|
|
64
|
+
];
|
|
65
|
+
async function executePolicyOperation(context, cdp, operation, i) {
|
|
66
|
+
if (operation === 'list') {
|
|
67
|
+
const policies = await cdp.policies.listPolicies();
|
|
68
|
+
return { policies };
|
|
69
|
+
}
|
|
70
|
+
if (operation === 'get') {
|
|
71
|
+
const policyId = context.getNodeParameter('policyId', i);
|
|
72
|
+
const policy = await cdp.policies.getPolicyById({ id: policyId });
|
|
73
|
+
return policy;
|
|
74
|
+
}
|
|
75
|
+
if (operation === 'create') {
|
|
76
|
+
const policyJson = context.getNodeParameter('policyJson', i);
|
|
77
|
+
const parsed = typeof policyJson === 'string' ? JSON.parse(policyJson) : policyJson;
|
|
78
|
+
const policy = await cdp.policies.createPolicy({ policy: parsed });
|
|
79
|
+
return policy;
|
|
80
|
+
}
|
|
81
|
+
if (operation === 'update') {
|
|
82
|
+
const policyId = context.getNodeParameter('policyId', i);
|
|
83
|
+
const policyJson = context.getNodeParameter('policyJson', i);
|
|
84
|
+
const parsed = typeof policyJson === 'string' ? JSON.parse(policyJson) : policyJson;
|
|
85
|
+
const policy = await cdp.policies.updatePolicy({ id: policyId, policy: parsed });
|
|
86
|
+
return policy;
|
|
87
|
+
}
|
|
88
|
+
if (operation === 'delete') {
|
|
89
|
+
const policyId = context.getNodeParameter('policyId', i);
|
|
90
|
+
await cdp.policies.deletePolicy({ id: policyId });
|
|
91
|
+
return { deleted: true, policyId };
|
|
92
|
+
}
|
|
93
|
+
throw new Error(`Unknown policy operation: ${operation}`);
|
|
94
|
+
}
|
|
95
|
+
//# sourceMappingURL=policy.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"policy.js","sourceRoot":"","sources":["../../../../src/nodes/CoinbaseCdp/resources/policy.ts"],"names":[],"mappings":";;;AAgEA,wDAuCC;AApGY,QAAA,gBAAgB,GAAsB;IAClD;QACC,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE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CAAC;QACvE,MAAM,MAAM,GAAG,OAAO,UAAU,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,UAAU,CAAC;QACpF,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC;QACjF,OAAO,MAAM,CAAC;IACf,CAAC;IAED,IAAI,SAAS,KAAK,QAAQ,EAAE,CAAC;QAC5B,MAAM,QAAQ,GAAG,OAAO,CAAC,gBAAgB,CAAC,UAAU,EAAE,CAAC,CAAW,CAAC;QACnE,MAAM,GAAG,CAAC,QAAQ,CAAC,YAAY,CAAC,EAAE,EAAE,EAAE,QAAQ,EAAE,CAAC,CAAC;QAClD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,CAAC;IACpC,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,6BAA6B,SAAS,EAAE,CAAC,CAAC;AAC3D,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { INodeProperties, IExecuteFunctions } from 'n8n-workflow';
|
|
2
|
+
import type { CdpClient } from '@coinbase/cdp-sdk';
|
|
3
|
+
export declare const smartAccountOperations: INodeProperties[];
|
|
4
|
+
export declare function executeSmartAccountOperation(context: IExecuteFunctions, cdp: CdpClient, operation: string, i: number): Promise<{
|
|
5
|
+
address: `0x${string}`;
|
|
6
|
+
ownerAddress: `0x${string}`;
|
|
7
|
+
ownerName: string;
|
|
8
|
+
smartAccountName: string | undefined;
|
|
9
|
+
}>;
|
|
10
|
+
//# sourceMappingURL=smartAccount.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"smartAccount.d.ts","sourceRoot":"","sources":["../../../../src/nodes/CoinbaseCdp/resources/smartAccount.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACvE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,eAAO,MAAM,sBAAsB,EAAE,eAAe,EAmCnD,CAAC;AAEF,wBAAsB,4BAA4B,CACjD,OAAO,EAAE,iBAAiB,EAC1B,GAAG,EAAE,SAAS,EACd,SAAS,EAAE,MAAM,EACjB,CAAC,EAAE,MAAM;;;;;GAgBT"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.smartAccountOperations = void 0;
|
|
4
|
+
exports.executeSmartAccountOperation = executeSmartAccountOperation;
|
|
5
|
+
exports.smartAccountOperations = [
|
|
6
|
+
{
|
|
7
|
+
displayName: 'Operation',
|
|
8
|
+
name: 'operation',
|
|
9
|
+
type: 'options',
|
|
10
|
+
noDataExpression: true,
|
|
11
|
+
displayOptions: { show: { resource: ['smartAccount'] } },
|
|
12
|
+
default: 'getOrCreate',
|
|
13
|
+
options: [
|
|
14
|
+
{
|
|
15
|
+
name: 'Get or Create',
|
|
16
|
+
value: 'getOrCreate',
|
|
17
|
+
description: 'Get or create an ERC-4337 smart account with an owner',
|
|
18
|
+
action: 'Get or create a smart account',
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
},
|
|
22
|
+
{
|
|
23
|
+
displayName: 'Owner Account Name',
|
|
24
|
+
name: 'ownerAccountName',
|
|
25
|
+
type: 'string',
|
|
26
|
+
default: '',
|
|
27
|
+
required: true,
|
|
28
|
+
displayOptions: { show: { resource: ['smartAccount'], operation: ['getOrCreate'] } },
|
|
29
|
+
description: 'Name of the owner EVM account (will be created if it does not exist)',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
displayName: 'Smart Account Name',
|
|
33
|
+
name: 'smartAccountName',
|
|
34
|
+
type: 'string',
|
|
35
|
+
default: '',
|
|
36
|
+
required: true,
|
|
37
|
+
displayOptions: { show: { resource: ['smartAccount'], operation: ['getOrCreate'] } },
|
|
38
|
+
description: 'Unique name for the smart account',
|
|
39
|
+
},
|
|
40
|
+
];
|
|
41
|
+
async function executeSmartAccountOperation(context, cdp, operation, i) {
|
|
42
|
+
if (operation === 'getOrCreate') {
|
|
43
|
+
const ownerName = context.getNodeParameter('ownerAccountName', i);
|
|
44
|
+
const smartName = context.getNodeParameter('smartAccountName', i);
|
|
45
|
+
const owner = await cdp.evm.getOrCreateAccount({ name: ownerName });
|
|
46
|
+
const smartAccount = await cdp.evm.getOrCreateSmartAccount({ owner, name: smartName });
|
|
47
|
+
return {
|
|
48
|
+
address: smartAccount.address,
|
|
49
|
+
ownerAddress: owner.address,
|
|
50
|
+
ownerName,
|
|
51
|
+
smartAccountName: smartName || undefined,
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
throw new Error(`Unknown smartAccount operation: ${operation}`);
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=smartAccount.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"smartAccount.js","sourceRoot":"","sources":["../../../../src/nodes/CoinbaseCdp/resources/smartAccount.ts"],"names":[],"mappings":";;;AAwCA,oEAoBC;AAzDY,QAAA,sBAAsB,GAAsB;IACxD;QACC,WAAW,EAAE,WAAW;QACxB,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,SAAS;QACf,gBAAgB,EAAE,IAAI;QACtB,cAAc,EAAE,EAAE,IAAI,EAAE,EAAE,QAAQ,EAAE,CAAC,cAAc,CAAC,EAAE,EAAE;QACxD,OAAO,EAAE,aAAa;QACtB,OAAO,EAAE;YACR;gBACC,IAAI,EAAE,eAAe;gBACrB,KAAK,EAAE,aAAa;gBACpB,WAAW,EAAE,uDAAuD;gBACpE,MAAM,EAAE,+BAA+B;aACvC;SACD;KACD;IACD;QACC,WAAW,EAAE,oBAAoB;QACjC,IAAI,EAAE,kBAAkB;QACxB,IAAI,EAAE,Q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AAC;AACjE,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { INodeProperties, IExecuteFunctions } from 'n8n-workflow';
|
|
2
|
+
import type { CdpClient } from '@coinbase/cdp-sdk';
|
|
3
|
+
export declare const solanaAccountOperations: INodeProperties[];
|
|
4
|
+
export declare function executeSolanaAccountOperation(context: IExecuteFunctions, cdp: CdpClient, operation: string, i: number): Promise<{
|
|
5
|
+
address: string;
|
|
6
|
+
name: string;
|
|
7
|
+
signature?: undefined;
|
|
8
|
+
token?: undefined;
|
|
9
|
+
network?: undefined;
|
|
10
|
+
} | {
|
|
11
|
+
signature: string;
|
|
12
|
+
address: string;
|
|
13
|
+
token: string;
|
|
14
|
+
network: string;
|
|
15
|
+
name?: undefined;
|
|
16
|
+
}>;
|
|
17
|
+
//# sourceMappingURL=solanaAccount.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"solanaAccount.d.ts","sourceRoot":"","sources":["../../../../src/nodes/CoinbaseCdp/resources/solanaAccount.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,iBAAiB,EAAE,MAAM,cAAc,CAAC;AACvE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,eAAO,MAAM,uBAAuB,EAAE,eAAe,EAoDpD,CAAC;AAEF,wBAAsB,6BAA6B,CAClD,OAAO,EAAE,iBAAiB,EAC1B,GAAG,EAAE,SAAS,EACd,SAAS,EAAE,MAAM,EACjB,CAAC,EAAE,MAAM;;;;;;;;;;;;GAmBT"}
|