Transaction

Get transfer requirements

Lists the payout fields the destination requires before it will accept a transfer, each with the option set the caller must choose from. `fields` is null when the destination requires nothing. Two calls: read the requirements here, then submit one chosen option per field as `metadata.required_fields` on `transaction.transfer`, keyed by the field's `key` and carrying that option's `value` and `label`. Option ids are issued per destination and can change, so read them per transfer rather than caching them. A mutation despite reading like a lookup: rails serve their catalogues scoped to the beneficiary and the paying sub-account, so resolving them registers both upstream when they do not exist yet. Call it once per route on submit intent, never as a cached or retried read. `currency_out`/`currency_in` are the same pair the transfer will carry, chain included: the paying sub-account is matched on it.

POST
/transaction.getTransferRequirements

Request Body

application/jsonRequired
external_account_idRequiredstring
currency_outRequiredobject
currency_inobject | null

Response Body

Successful response

TypeScript Definitions

Use the response body type in TypeScript.

dataRequiredobject

Error response

TypeScript Definitions

Use the response body type in TypeScript.

errorRequiredobject
curl -X POST "/v1/transaction.getTransferRequirements" \
  -H "Content-Type: application/json" \
  -d '{
    "external_account_id": "string",
    "currency_out": {
      "value": "string",
      "code": "AUD",
      "decimals": 0,
      "chain": "arbitrum",
      "metadata": "string"
    },
    "currency_in": {
      "value": "string",
      "code": "AUD",
      "decimals": 0,
      "chain": "arbitrum",
      "metadata": "string"
    }
  }'
const body = JSON.stringify({
  "external_account_id": "string",
  "currency_out": {
    "value": "string",
    "code": "AUD",
    "decimals": 0,
    "chain": "arbitrum",
    "metadata": "string"
  },
  "currency_in": {
    "value": "string",
    "code": "AUD",
    "decimals": 0,
    "chain": "arbitrum",
    "metadata": "string"
  }
})

fetch("/v1/transaction.getTransferRequirements", {
  body
})
package main

import (
  "fmt"
  "net/http"
  "io/ioutil"
  "strings"
)

func main() {
  url := "/v1/transaction.getTransferRequirements"
  body := strings.NewReader(`{
    "external_account_id": "string",
    "currency_out": {
      "value": "string",
      "code": "AUD",
      "decimals": 0,
      "chain": "arbitrum",
      "metadata": "string"
    },
    "currency_in": {
      "value": "string",
      "code": "AUD",
      "decimals": 0,
      "chain": "arbitrum",
      "metadata": "string"
    }
  }`)
  req, _ := http.NewRequest("POST", url, body)
  req.Header.Add("Content-Type", "application/json")
  res, _ := http.DefaultClient.Do(req)
  defer res.Body.Close()
  body, _ := ioutil.ReadAll(res.Body)

  fmt.Println(res)
  fmt.Println(string(body))
}
import requests

url = "/v1/transaction.getTransferRequirements"
body = {
  "external_account_id": "string",
  "currency_out": {
    "value": "string",
    "code": "AUD",
    "decimals": 0,
    "chain": "arbitrum",
    "metadata": "string"
  },
  "currency_in": {
    "value": "string",
    "code": "AUD",
    "decimals": 0,
    "chain": "arbitrum",
    "metadata": "string"
  }
}
response = requests.request("POST", url, json = body, headers = {
  "Content-Type": "application/json"
})

print(response.text)
{
  "data": {
    "fields": [
      {
        "key": "string",
        "label": "string",
        "options": [
          {
            "value": "string",
            "label": "string"
          }
        ]
      }
    ]
  }
}
{
  "error": {
    "code": "PARSE_ERROR",
    "message": "string"
  }
}