rgb_create_swap
Create asset swaps on the RGB Lightning Network to exchange digital assets using specified swap parameters for peer-to-peer transactions.
Instructions
Create a new asset swap
Input Schema
TableJSON Schema
| Name | Required | Description | Default |
|---|---|---|---|
| swapParams | Yes | Swap parameters object |
Implementation Reference
- src/server.ts:252-267 (registration)Registration of the 'rgb_create_swap' tool, including input schema (loose passthrough object) and inline handler that calls rgbClient.createSwap(swapParams) and returns JSON result.server.tool( 'rgb_create_swap', 'Create a new asset swap', { swapParams: z.object({}).passthrough().describe('Swap parameters object'), }, async ({ swapParams }) => { try { const result = await rgbClient.createSwap(swapParams); return { content: [{ type: 'text', text: JSON.stringify(result, null, 2) }] }; } catch (error) { const errorMessage = error instanceof Error ? error.message : String(error); return { content: [{ type: 'text', text: `Error: ${errorMessage}` }], isError: true }; } } );
- src/rgb-client.ts:106-108 (helper)Helper wrapper method in RGBApiClientWrapper that delegates the swap creation to the underlying RgbApiClient SDK's swaps.createSwap method.async createSwap(swapParams: any) { return await this.client.swaps.createSwap(swapParams); }
- src/types.ts:115-117 (schema)Type definition for swap parameters (loose object type). Note: the zod schema in registration is also loose.export interface SwapParams { [key: string]: any; }