feat: initialize base agent node

This commit is contained in:
Jovian Dsouza 2025-05-02 00:19:41 +05:30
commit 2fbccb3423
13 changed files with 8082 additions and 536 deletions

View file

@ -0,0 +1,66 @@
import {
IAuthenticateGeneric,
ICredentialTestRequest,
ICredentialType,
INodeProperties,
} from 'n8n-workflow';
export class BaseApi implements ICredentialType {
name = 'baseApi';
displayName = 'Base API';
documentationUrl = 'https://docs.base.com/';
properties: INodeProperties[] = [
{
displayName: 'Private Key',
name: 'privateKey',
type: 'string',
typeOptions: {
password: true,
},
default: '',
required: true,
description: 'The private key of your Base wallet',
},
{
displayName: 'RPC URL',
name: 'rpcUrl',
type: 'string',
default: 'https://api.mainnet-beta.base.com',
required: true,
description: 'The URL of the Base RPC node',
},
{
displayName: 'OpenAI API Key',
name: 'openAiApiKey',
type: 'string',
typeOptions: {
password: true,
},
default: '',
required: true,
description: 'API key for OpenAI services',
},
];
authenticate: IAuthenticateGeneric = {
type: 'generic',
properties: {
headers: {
'Content-Type': 'application/json',
},
},
};
test: ICredentialTestRequest = {
request: {
baseURL: '={{$credentials.rpcUrl}}',
url: '/',
method: 'POST',
body: {
jsonrpc: '2.0',
id: 1,
method: 'getHealth',
},
},
};
}

View file

@ -1,56 +0,0 @@
import {
IAuthenticateGeneric,
ICredentialTestRequest,
ICredentialType,
INodeProperties,
} from 'n8n-workflow';
export class ExampleCredentialsApi implements ICredentialType {
name = 'exampleCredentialsApi';
displayName = 'Example Credentials API';
properties: INodeProperties[] = [
// The credentials to get from user and save encrypted.
// Properties can be defined exactly in the same way
// as node properties.
{
displayName: 'User Name',
name: 'username',
type: 'string',
default: '',
},
{
displayName: 'Password',
name: 'password',
type: 'string',
typeOptions: {
password: true,
},
default: '',
},
];
// This credential is currently not used by any node directly
// but the HTTP Request node can use it to make requests.
// The credential is also testable due to the `test` property below
authenticate: IAuthenticateGeneric = {
type: 'generic',
properties: {
auth: {
username: '={{ $credentials.username }}',
password: '={{ $credentials.password }}',
},
qs: {
// Send this as part of the query string
n8n: 'rocks',
},
},
};
// The block below tells how this credential can be tested
test: ICredentialTestRequest = {
request: {
baseURL: 'https://example.com/',
url: '',
},
};
}

View file

@ -1,50 +0,0 @@
import {
IAuthenticateGeneric,
ICredentialTestRequest,
ICredentialType,
INodeProperties,
} from 'n8n-workflow';
export class HttpBinApi implements ICredentialType {
name = 'httpbinApi';
displayName = 'HttpBin API';
documentationUrl = '<your-docs-url>';
properties: INodeProperties[] = [
{
displayName: 'Token',
name: 'token',
type: 'string',
default: '',
typeOptions: {
password: true,
}
},
{
displayName: 'Domain',
name: 'domain',
type: 'string',
default: 'https://httpbin.org',
},
];
// This allows the credential to be used by other parts of n8n
// stating how this credential is injected as part of the request
// An example is the Http Request node that can make generic calls
// reusing this credential
authenticate: IAuthenticateGeneric = {
type: 'generic',
properties: {
headers: {
Authorization: '={{"Bearer " + $credentials.token}}',
},
},
};
// The block below tells how this credential can be tested
test: ICredentialTestRequest = {
request: {
baseURL: '={{$credentials?.domain}}',
url: '/bearer',
},
};
}