Blockstream Enterprise
ReferenceAPI ReferenceSpend Requests

Create Spend Requests

Create Spend Requests.

Request

SpendRequestsCreateRequest
interface SpendRequestsCreateRequest {
  action: 'add'
  resource: string
  details: {
    id: string
    wallet_id: string
    funding_wallet_id: string | undefined
    fee_amount: number | undefined
    fee_rate: number | undefined
    maxfee: number | undefined
    feewallet: string | undefined
    coin_subset: string[] | undefined
    coin_selection_algo: string | undefined
  } & { tx_type: 'send'; request: { asset_id: string; recipients: { recipient: { type: 'wallet' | 'address' | 'recipient_payment_details'; value: string }; amount: number }[] } } | { tx_type: 'issue'; request: { issue_amount: number; reissue_amount: number; contract: { name: string; ticker: string; domain: string; precision: number; version: number }; coingecko_id: string | undefined } } | { tx_type: 'reissue'; request: { asset_id: string; amount: number } } | { tx_type: 'burn'; request: { asset_id: string; amount: number } }
}

Prop

Type

Response

SpendRequestsCreateResponse_success
interface SpendRequestsCreateResponse_success {
  status: 'success'
  error_code?: '-1' | '-2' | '-3' | '-4' | '-5' | '-6' | '-7' | '-8' | '-9' | '-10' | '-11' | '-12' | '-13' | undefined
  message?: string | undefined
  details: {
    status: 'pending' | 'processing' | 'processed' | 'failed'
  } & { id: string; wallet_id: string; funding_wallet_id: string | undefined; asset_id: string; txid: string; psxt_id: string; network: 'liquid' | 'bitcoin'; status: 'pending' | 'processing' | 'processed' | 'failed'; fee_amount: number | undefined; fee_rate: number | undefined; maxfee: number | undefined; feewallet: string | undefined; coin_subset: string[] | undefined; coin_selection_algo: string | undefined; created_at: string; updated_at: string; created_by: string; locked_by: string | undefined; proposal_ids: string[] | undefined; message: string | undefined } & { tx_type: 'send'; request: { asset_id: string; recipients: { recipient: { type: 'wallet' | 'address' | 'recipient_payment_details'; value: string }; amount: number }[] } } | { tx_type: 'issue'; request: { issue_amount: number; reissue_amount: number; contract: { name: string; ticker: string; domain: string; precision: number; version: number }; coingecko_id: string | undefined } } | { tx_type: 'burn'; request: { asset_id: string; amount: number } } | { tx_type: 'reissue'; request: { asset_id: string; amount: number } }
  metadata: unknown
}

Prop

Type

SpendRequestsCreateResponse_pending
interface SpendRequestsCreateResponse_pending {
  status: 'pending'
  error_code?: '-1' | '-2' | '-3' | '-4' | '-5' | '-6' | '-7' | '-8' | '-9' | '-10' | '-11' | '-12' | '-13' | undefined
  message?: string | undefined
  details: {
    proposal_id: string
  }
}

Prop

Type

SpendRequestsCreateResponse_failed | unauthorized | rejected
interface SpendRequestsCreateResponse_failed | unauthorized | rejected {
  status: 'failed' | 'unauthorized' | 'rejected'
  error_code?: '-1' | '-2' | '-3' | '-4' | '-5' | '-6' | '-7' | '-8' | '-9' | '-10' | '-11' | '-12' | '-13' | undefined
  message?: string | undefined
}

Prop

Type

Example

Example
import { resourceSchema } from '@blockstream/ecs-js-sdk'
import { broadcastRequest } from './broadcaster'

const response = await broadcastRequest<
  typeof resourceSchema.shape.spend-requests.shape.create
>(
  {
    action: 'add',
    resource: '/wallets/{wid}/spend-requests',
    details: {
      // TODO: fill in required fields
    },
  },
  blockstream,
)

On this page