Skip to content

Commit

Permalink
[BLCKCHN-217] Add Cronos ID #38
Browse files Browse the repository at this point in the history
Add resolveCronosId functionality

- Introduced new parameters for resolving a CronosId to its corresponding wallet address in `chain-ai.helpers.ts`.
- Updated `agent.constants.ts` to include the new function in the tools list.
- Modified `agent.interfaces.ts` to define the new `ResolveCronosId` function and its associated data structure.

This enhancement allows users to resolve CronosIds, improving the functionality of the agent service.
  • Loading branch information
leejw51crypto committed Jan 6, 2025
1 parent 0312ff0 commit 5503d2e
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 0 deletions.
11 changes: 11 additions & 0 deletions ai/cryptocom-ai-agent-service/src/helpers/chain-ai.helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,3 +154,14 @@ export const getErc20BalanceParameters = {
},
required: ['address', 'contractAddress'],
};

export const resolveCronosIdParameters = {
type: 'object',
properties: {
cronosId: {
type: 'string',
description: 'The CronosId to resolve (must end with .cro)',
},
},
required: ['cronosId'],
};
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {
wrapTokenParameters,
getCurrentTimeParameters,
getErc20BalanceParameters,
resolveCronosIdParameters,
} from '../../helpers/chain-ai.helpers.js';
import { BlockchainFunction } from './agent.interfaces.js';

Expand Down Expand Up @@ -124,6 +125,14 @@ export const TOOLS: OpenAI.Chat.ChatCompletionTool[] = [
parameters: getErc20BalanceParameters,
},
},
{
type: 'function',
function: {
name: BlockchainFunction.ResolveCronosId,
description: 'Resolve a CronosId (.cro) to its corresponding wallet address',
parameters: resolveCronosIdParameters,
},
},
];

export const GEMINI_TOOLS = {
Expand Down Expand Up @@ -306,5 +315,19 @@ export const GEMINI_TOOLS = {
required: ['address', 'contractAddress'],
},
},
{
name: BlockchainFunction.ResolveCronosId,
description: 'Resolve a CronosId (.cro) to its corresponding wallet address',
parameters: {
type: 'OBJECT',
properties: {
cronosId: {
type: 'STRING',
description: 'The CronosId to resolve (must end with .cro)',
},
},
required: ['cronosId'],
},
},
],
};
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ export interface FunctionArgs {
fromContractAddress: string;
toContractAddress: string;
name: string;
cronosId: string;
}

export enum Symbol {
Expand Down Expand Up @@ -91,6 +92,7 @@ export enum BlockchainFunction {
GetCurrentTime = 'getCurrentTime',
FunctionNotFound = 'functionNotFound',
GetErc20Balance = 'getErc20Balance',
ResolveCronosId = 'resolveCronosId',
}

export interface BlockchainFunctionResponse<T> {
Expand Down Expand Up @@ -246,3 +248,8 @@ export interface GeminiOptions {
apiKey: string;
model?: string;
}

export interface ResolveCronosIdData {
cronosId: string;
resolvedAddress: string;
}

0 comments on commit 5503d2e

Please sign in to comment.