@suiware/ai-tools
Version:
Pluggable tools for Vercel AI SDK which allow AI assistants to interact with Sui Network and perform various actions.
39 lines (37 loc) • 1.4 kB
JavaScript
import { NaviService, SuinsService } from './chunk-OZX7KUX2.mjs';
import { __async, disableConsoleLog, enableConsoleLog, SuiService } from './chunk-HFORSGSH.mjs';
import { tool } from 'ai';
import z from 'zod';
var suiTransferTool = tool({
description: "Transfer the amount of the specified coin to the specified address",
parameters: z.object({
coin: z.string().refine((value) => NaviService.isSupportedCoin(value), {
message: "The coin not supported"
}).describe(
"The target address. Suins names starting with @ or ending with .sui are supported."
),
amount: z.number().describe("The amount of SUI"),
address: z.string().refine(
(value) => SuiService.isValidSuiAddress(value) || SuinsService.isValidSuinsName(value),
{ message: "Invalid Sui address" }
).describe(
"The target address. Suins names starting with @ or ending with .sui are supported."
)
}),
execute: (_0) => __async(null, [_0], function* ({ coin, amount, address }) {
const originalConsoleLog = disableConsoleLog();
const naviService = new NaviService();
const txDigest = yield naviService.transfer(
coin,
address,
amount
);
enableConsoleLog(originalConsoleLog);
return {
digest: txDigest
};
})
});
export { suiTransferTool };
//# sourceMappingURL=chunk-AW62QHE5.mjs.map
//# sourceMappingURL=chunk-AW62QHE5.mjs.map