First SDK Script
This is the shortest end-to-end SDK flow:
- Create a project and API key.
- Add one approval rule.
- Pair a signer.
- 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:
- Open
Projectsand create a project. - Open
Integrations. - 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:
- Set the project approval mode to
bridge_all(Bridge Every Request). - Open
Integrations→Test trigger. - Send the quick trigger once.
- Confirm it appears in
Inboxand reaches the paired signer.
If this checkpoint passes, continue with the SDK script setup.
Step 4: Install the SDK
TypeScript
mkdir beav3r-sdk-quickstart && cd beav3r-sdk-quickstart
npm init -y
npm install @beav3r/sdkStep 5: Create the script
TypeScript
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
TypeScript
BEAV3R_BASE_URL=https://staging.server.beav3r.ai \
BEAV3R_API_KEY=project_api_key \
node first-sdk-script.mjsSwitch to https://server.beav3r.ai for production.
Expected result
The request appears in Inbox, routes to the paired signer, and returns one of:
approvedexecuteddeniedrejectedexpired- increase the script timeout for manual testing
For adjacent topics, use First Onchain Script, Troubleshooting Basics, and Trigger Payload Guide.
Last updated on