SettleMint
Developer guidesCLI

Scripting and automation

Use the DALP CLI in shell scripts, CI/CD pipelines, and automated workflows with JSON output and environment variables.

The DALP CLI is designed for both interactive use and headless automation. Use JSON output, environment variables, and composable commands to build robust scripts and CI/CD pipelines.

JSON output for scripting

Set the output format to JSON for machine-readable responses:

# Per-command
dalp tokens list --format json

# Or set globally
dalp config set format json

Pipe to jq

# Get all token addresses
dalp tokens list --format json | jq -r '.[].address'

# Get the first admin's wallet
dalp users admin-list --format json | jq -r '.[0].wallet'

# Count tokens by type
dalp tokens list --format json | jq 'group_by(.type) | map({type: .[0].type, count: length})'

Environment-based authentication

For CI/CD and headless environments, use environment variables instead of interactive login:

export DALP_URL=https://your-platform.example.com
export DALP_ORG=your-org-slug

For non-interactive authentication, create an API key through the web UI or another authenticated CLI session, then use it directly:

# Create an API key from an authenticated session
dalp auth api-key-create "ci-pipeline"

# Store the output key securely in your CI secrets

Scripting patterns

Token issuance script

#!/usr/bin/env bash
set -euo pipefail

# Create a bond token
result=$(dalp tokens create \
  --type bond \
  --name "Corporate Bond 2025" \
  --symbol CB25 \
  --decimals 18 \
  --countryCode 840 \
  --json '{"maturityDate": "2025-12-31", "couponRate": "5.5"}' \
  --format json)

address=$(echo "$result" | jq -r '.address')
echo "Token deployed at: $address"

# Mint initial supply to the treasury
dalp tokens mint \
  --address "$address" \
  --to 0xTREASURY... \
  --amount 1000000

# Grant supply management to operations team
dalp tokens grant-role \
  --address "$address" \
  --role supplyManagement \
  --account 0xOPS_WALLET...

User onboarding script

#!/usr/bin/env bash
set -euo pipefail

EMAIL="$1"
NAME="$2"

# Create user
user=$(dalp users create --email "$EMAIL" --name "$NAME" --format json)
userId=$(echo "$user" | jq -r '.id')
wallet=$(echo "$user" | jq -r '.wallet')

echo "Created user $userId with wallet $wallet"

# Register identity
dalp identities register --wallet "$wallet" --country US

# Create KYC version
version=$(dalp kyc version-create "$userId" --format json)
versionId=$(echo "$version" | jq -r '.id')

echo "KYC version $versionId ready for document upload"

Batch operations

#!/usr/bin/env bash
set -euo pipefail

TOKEN_ADDRESS="$1"
RECIPIENTS_FILE="$2"  # CSV: wallet,amount

while IFS=, read -r wallet amount; do
  echo "Minting $amount to $wallet..."
  dalp tokens mint \
    --address "$TOKEN_ADDRESS" \
    --to "$wallet" \
    --amount "$amount"
done < "$RECIPIENTS_FILE"

CI/CD integration

GitHub Actions

name: Token deployment
on:
  workflow_dispatch:
    inputs:
      token_name:
        description: "Token name"
        required: true

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/setup-node@v4
        with:
          node-version: "22"

      - name: Install DALP CLI
        run: npm install -g @settlemint/dalp-cli

      - name: Deploy token
        run: |
          dalp tokens create \
            --type equity \
            --name "${{ inputs.token_name }}" \
            --symbol "TKN" \
            --decimals 18 \
            --format json
        env:
          DALP_URL: ${{ secrets.DALP_URL }}

Error handling in scripts

The CLI exits with a non-zero code on errors. Use standard shell error handling:

#!/usr/bin/env bash
set -euo pipefail

if ! dalp whoami --format json > /dev/null 2>&1; then
  echo "Not authenticated. Run: dalp login"
  exit 1
fi

# Proceed with authenticated operations
dalp tokens list --format json

Project configuration

Create a .dalprc.json in your project root for team-shared settings:

{
  "apiUrl": "https://staging.example.com",
  "defaultOrg": "engineering",
  "format": "json"
}

This file can be committed to version control. Credentials are never stored in project config – they remain in the secure credential store.

On this page