Skip to main content
Glama
baskcart

W3 Ledger MCP Server

by baskcart

purchase_product

Debit buyer balance and credit merchant for product purchases using dual signatures to authorize transactions on the W3 Ledger.

Instructions

Purchase a product by debiting the sender's DAH balance and crediting the receiver (merchant). Requires dual signatures.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
sender_public_keyYesPublic key of the buyer.
receiver_public_keyYesPublic key of the merchant receiving payment.
orderDetailsYesOrder information.
sender_signatureYesBuyer's transaction signature.
receiver_signatureYesMerchant's co-signature for dual signing.
timestampYesISO 8601 timestamp.

Implementation Reference

  • The execution handler for the 'purchase_product' tool, which makes a POST request to the '/product-purchase' endpoint.
    case 'purchase_product': {
        const res = await client.post('/product-purchase', args);
        return toResult(res.data, !res.ok);
    }
  • The schema definition for the 'purchase_product' tool, defining the required inputs like public keys, order details, and signatures.
    {
        name: 'purchase_product',
        description:
            'Purchase a product by debiting the sender\'s DAH balance and crediting ' +
            'the receiver (merchant). Requires dual signatures.',
        inputSchema: {
            type: 'object',
            properties: {
                sender_public_key: {
                    type: 'string',
                    description: 'Public key of the buyer.',
                },
                receiver_public_key: {
                    type: 'string',
                    description: 'Public key of the merchant receiving payment.',
                },
                orderDetails: {
                    type: 'object',
                    description: 'Order information.',
                    properties: {
                        totalAmount: {
                            type: 'number',
                            description: 'Total purchase amount.',
                            minimum: 0.01,
                        },
                        orderNumber: {
                            type: 'string',
                            description: 'Unique order number.',
                        },
                    },
                    required: ['totalAmount', 'orderNumber'],
                },
                sender_signature: {
                    type: 'string',
                    description: 'Buyer\'s transaction signature.',
                },
                receiver_signature: {
                    type: 'string',
                    description: 'Merchant\'s co-signature for dual signing.',
                },
                timestamp: {
                    type: 'string',
                    description: 'ISO 8601 timestamp.',
                },
            },
            required: [
                'sender_public_key',
                'receiver_public_key',
                'orderDetails',
                'sender_signature',
                'receiver_signature',
                'timestamp',
            ],
        },
        access: 'write',
    },

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/baskcart/w3-ledger-mcp-server'

If you have feedback or need assistance with the MCP directory API, please join our Discord server