Client library for EmbiPay Admin and Agent APIs.
npm install
# or from monorepo root: cd EmbiPay-SDK && npm link
import { EmbiPayAdmin } from '@embipay/sdk'
const admin = new EmbiPayAdmin(
'https://embi-pay-dashboard.vercel.app',
process.env.ADMIN_API_TOKEN
)
// Create wallet
const { wallet } = await admin.createWallet({
owner_user_id: 'uuid-from-supabase-auth',
balance: 100,
})
// Create pool
const { pool } = await admin.createSharedPool('resource-123', 50)
// Contribute to pool
await admin.contributeToPool(pool.pool_id, wallet.agent_id, 10, 5)
// Approve loan
await admin.approveLoan(5)
// Record repayment
await admin.recordRepayment(5, 100, 'Paid in full')
import { EmbiPayAgent } from '@embipay/sdk'
const agent = new EmbiPayAgent(
'https://embi-pay-dashboard.vercel.app',
process.env.AGENT_KEY
)
const { tasks } = await agent.fetchTasks()
await agent.completeTask(tasks[0].id, 'completed', 'Done')
| Method |
Description |
createWallet(params) |
Create agent wallet |
updateWalletBalance(agentId, balance) |
Update wallet balance |
createLoan(params) |
Create A2A loan |
approveLoan(loanId) |
Approve loan |
rejectLoan(loanId) |
Reject loan |
getLoanDetails(loanId, numInstallments) |
Get loan with schedule |
recordRepayment(loanId, amount, note) |
Record repayment |
fetchA2ALoans() |
List all loans |
createSharedPool(resourceId, totalCost) |
Create shared pool |
contributeToPool(poolId, agentId, amount, usageLimit) |
Contribute to pool |
getPoolDetails(poolId, allocationRule) |
Get pool with breakdown |
recordPoolUsage(poolId, agentId) |
Record pool usage |
registerWebhook(url, events, secret) |
Register webhook |
listWebhooks() |
List registered webhooks |
fetchAllLedgers(params) |
Fetch ledger entries |
getAgentTasks(params) |
Get agent tasks |
getAgentTasksOverview(params) |
Get tasks overview |
| Method |
Description |
fetchTasks() |
Fetch pending tasks |
completeTask(taskId, status, note) |
Complete task |
sendInvitation(humanEmail) |
Send human invitation |
getTasks() |
Get tasks |