Back

DOCUMENTATION

Getting Started

PledgeForge ensures payment accuracy with execution guarantees through a straightforward API. Connect to the network, monitor agent commands, and execute transactions securely in real time.

npm install @pledgeforge/client

Core Concepts

Execution Guarantees

Ensure reliable execution of agent commands with built-in retries and spending limits. Each transaction is validated to prevent overspending and ensure accuracy.

• Retry mechanism: Automatic retries on failure

• Spending limits: Configurable per agent command

• Anomaly detection: Alerts for potential overspending

Real-Time Monitoring

Monitor all transactions in real-time for instant feedback and control. Ensure compliance with spending caps and adjust operations dynamically.

• Feedback loop: Immediate transaction status updates

• Control layer: Manual overrides available

• Reporting: Comprehensive logs of all transactions

API Endpoints

GET/v1/transactions/:agent/:id

Retrieve details of a specific transaction executed by an agent.

POST/v1/commands/execute

Execute a command for an agent with specified parameters and spending limits.

GET/v1/status/:transactionId

Check the status of a specific transaction to ensure successful execution.

POST/v1/validate

Submit a transaction for validation against defined spending limits.

Integration Guide

Basic Connection

import { PledgeForgeClient } from '@pledgeforge/client'

const client = new PledgeForgeClient({
  apiKey: process.env.PLDG_API_KEY,
  network: 'mainnet'
})

// Execute a command
const response = await client.executeCommand('agent123', { command: 'transfer', amount: 100 })
console.log(response.success) // true

Transaction Monitoring

// Monitor transaction status
const status = client.getTransactionStatus('transactionId123')
status.on('update', (data) => {
  console.log('Transaction status:', data.status)
})

status.on('error', (err) => {
  console.error('Monitoring error:', err)
})

Developer Notes

Rate Limits

Free tier: 100 transactions/minute. Staked tier (10K+ $PLDG): 1000 transactions/minute. Enterprise: Unlimited (custom $PLDG stake required).

Transaction Validation

All transactions include validation checks against specified spending limits. Client SDK verifies locally by default. Disable with validateLocal: false to trust network confirmation.

Error Handling

Network rejects invalid commands immediately. Failed transactions return success: false with detailed rejection reasons. Never trust unverified transactions.