create_gas_station_application
Create a Gas Station application to sponsor transaction fees for Aptos dApp users, enabling gas fee sponsorship for specified functions within your organization's project.
Instructions
Create a new Application for your Geomi Organization. Geomi is the essential toolkit for Aptos developers. This tool can be used to create a Gas Station application. Gas Station is a service that allows you to sponsor gas fees for your Aptos dApps users.
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| description | No | The description of the application. | |
| name | Yes | The name of the application. Must be between 3 and 32 characters long, with only lowercase letters, numbers, dashes and underscores. | |
| organization_id | Yes | The organization id to create the api key for. | |
| project_id | Yes | The project id to create the api key for. | |
| frontend_args | No | ||
| network | Yes | The network to create the gas station application for. Can only be testnet or mainnet. | |
| api_key_name | Yes | The name of the api key to create the gas station for. This is the name of the api key that will be created for the gas station. Must be between 3 and 32 characters long, with only lowercase letters, numbers, dashes and underscores. | |
| functions | Yes | A list of functions the gas station will sponsor. Each function should be in the format of <module_address>::<module_name>::<function_name>. |
Implementation Reference
- src/tools/geomi/applications.ts:80-166 (handler)Handler function for the 'create_gas_station_application' tool. It orchestrates the creation of an application, an API key, the gas station service, and the gas station rules.
export const createGasStationApplicationTool = { description: "Create a new Application for your Geomi Organization. Geomi is the essential toolkit for Aptos developers. This tool can be used to create a Gas Station application. Gas Station is a service that allows you to sponsor gas fees for your Aptos dApps users.", execute: async ( args: { api_key_name: string; description?: string; frontend_args?: Parameters<typeof toApiFrontendArgs>[0]; functions: string[]; name: string; network: string; organization_id: string; project_id: string; }, context: any ) => { const geomi = new Geomi(context); let applicationId: string | null = null; try { await recordTelemetry( { action: "create_gas_station_application" }, context ); // Create the application const application = await geomi.createApplication({ args: { description: args.description ?? null, name: args.name, network: args.network, service_type: "Gs", }, organization_id: args.organization_id, project_id: args.project_id, }); // Store the application id so that it can be deleted if the processor creation fails. applicationId = application.id; // Create the API key for the Gs application const apiKey = await geomi.createApiKey({ organization_id: args.organization_id, project_id: args.project_id, application_id: application.id, frontend_args: toApiFrontendArgs(args.frontend_args), name: args.api_key_name, }); const gasStationService = new GasStation( context, args.network as "testnet" | "mainnet" ); // Create the gas station const gasStation = await gasStationService.createGasStation({ application_id: application.id, organization_id: args.organization_id, project_id: args.project_id, }); // Create the gas station rules const gasStationRules = await gasStationService.createGasStationRules({ organization_id: args.organization_id, project_id: args.project_id, application_id: application.id, functions: args.functions, }); return JSON.stringify({ application: application, apiKey: apiKey, gasStation: gasStation, gasStationRules: gasStationRules, }); } catch (error) { // Delete the new application if the processor creation fails so that it's not orphaned. if (applicationId) { await geomi.deleteApplication({ application_id: applicationId, organization_id: args.organization_id, project_id: args.project_id, }); } return `❌ Failed to create Gas Station application: ${error}`; } }, name: "create_gas_station_application", parameters: CreateGasStationApplicationToolScheme, }; - Zod schema definition for the input parameters of the 'create_gas_station_application' tool.
export const CreateGasStationApplicationToolScheme = CreateApiResourceApplicationToolScheme.omit({ network: true }) .merge(CreateApiKeyToolScheme.omit({ application_id: true, name: true })) .extend({ network: z .enum(["testnet", "mainnet"]) .describe( "The network to create the gas station application for. Can only be testnet or mainnet." ), api_key_name: z .string() .describe( "The name of the api key to create the gas station for. This is the name of the api key that will be created for the gas station. Must be between 3 and 32 characters long, with only lowercase letters, numbers, dashes and underscores." ), functions: z .array(z.string()) .describe( "A list of functions the gas station will sponsor. Each function should be in the format of <module_address>::<module_name>::<function_name>." ), });