Skip to Content
SDKFirst SDK Script

First SDK Script

This is the shortest end-to-end SDK flow:

  1. Create a project and API key.
  2. Add one approval rule.
  3. Pair a signer.
  4. Run one script and approve it.

Use:

  • staging: https://staging.server.beav3r.ai
  • production: https://server.beav3r.ai

Before starting

Required:

  • Beav3r dashboard access: https://dashboard.beav3r.ai
  • one project API key
  • one active signer paired to that project

If setup is incomplete, start with:

Step 1: Create a project and API key

In the dashboard:

  1. Open Projects and create a project.
  2. Open Integrations.
  3. Create an API key and copy it.

Step 2: Add one approval rule

In Policy Studio, add:

  • action type: payments.send_usdt
  • effect: Require approval
  • reason: Require approval above 10 USDT
  • condition field: amount
  • operator: gt
  • value: 10

Step 3: Pair a signer

In Integrations, create a pairing session and scan the QR with the mobile signer. Confirm signer status is active.

Checkpoint: quick dashboard trigger (before script)

Before writing and running the script:

  1. Set the project approval mode to bridge_all (Bridge Every Request).
  2. Open IntegrationsTest trigger.
  3. Send the quick trigger once.
  4. Confirm it appears in Inbox and reaches the paired signer.

If this checkpoint passes, continue with the SDK script setup.

Step 4: Install the SDK

mkdir beav3r-sdk-quickstart && cd beav3r-sdk-quickstart npm init -y npm install @beav3r/sdk

Step 5: Create the script

first-sdk-script.mjs
import { Beav3r } from '@beav3r/sdk' const client = new Beav3r({ baseUrl: process.env.BEAV3R_BASE_URL ?? 'https://staging.server.beav3r.ai', apiKey: process.env.BEAV3R_API_KEY, agentId: process.env.BEAV3R_AGENT_ID ?? 'sdk_quickstart', defaultExpirySeconds: Number(process.env.BEAV3R_DEFAULT_EXPIRY_SECONDS ?? 180) }) const result = await client.guardAndWait( { actionType: 'payments.send_usdt', payload: { amount: 25, asset: 'USDT', network: 'base', recipient: '0x1111111111111111111111111111111111111111' }, attributes: { amount: 25 } }, { pollIntervalMs: 2000, timeoutMs: 5 * 60 * 1000 } ) console.log(JSON.stringify(result, null, 2))

Step 6: Run it

BEAV3R_BASE_URL=https://staging.server.beav3r.ai \ BEAV3R_API_KEY=project_api_key \ node first-sdk-script.mjs

Switch to https://server.beav3r.ai for production.

Expected result

The request appears in Inbox, routes to the paired signer, and returns one of:

  • approved
  • executed
  • denied
  • rejected
  • expired
  • increase the script timeout for manual testing

For adjacent topics, use First Onchain Script, Troubleshooting Basics, and Trigger Payload Guide.

Last updated on