Learn how to use Compass API SDK with Safe for smart account operations
Install Dependencies
bash npm install @safe-global/sdk-starter-kit @compass-labs/api-sdk dotenv
Set Environment Variables
.env
file in your project root: bash # .env ARBITRUM_RPC_URL="your_arbitrum_rpc_url" SIGNER_PRIVATE_KEY="your_wallet_private_key" COMPASS_API_KEY="your_compass_api_key" # If using existing safe: SAFE_ADDRESS="your_safe_address" # If creating new safe: # SIGNER_ADDRESS="your_signer_address"
Import dependencies and load environment
Create Safe client and initialize Compass API SDK
Create and prepare batched operations
ALLOWANCE_INCREASE
operation in
the first transaction. The Safe will not have any tokens initially, so the
AAVE_SUPPLY
operation should be executed in a subsequent transaction after
funding the Safe with USDC.Send batched operations and handle result