Language

Choose a language

/build/rpc / contracts / spot

spot.build_atomic

  • workflowspot-trade·step 8 of 9Workflow: spot-trade · step 8 of 9

spot.build_atomic "id" ( {"fee_rate":n} ) Construct the atomic swap PSBT for a spot offer. Arguments: 1. id (string, required) Spot offer identifier 2. options (json object, optional) Optional builder settings { "fee_rate": n, (numeric, optional) Override fee rate in sat/vB (wallet estimate if omitted) } Result: { (json object) "psbt" : "str", (string) Base64-encoded PSBT "complete" : true|false, (boolean) Whether the PSBT already contains all signatures "fee" : n, (numeric) Transaction fee paid by this wallet "changepos" : n, (numeric) Index of the native (BTC) change output, or -1 if none "my_role" : "str", (string) Wallet's role in the swap: 'alice', 'bob', or 'observer' "my_output_index" : n, (numeric) Index of the output receiving assets to this wallet, or -1 if observer "asset_change_index" : n (numeric) Index of the asset change output, or -1 if none } Examples: > bitcoin-cli spot.build_atomic "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"

Signature

spot.build_atomic(id: string, options?: object) → any

Code samples

curl --user "$RPC_USER:$RPC_PASS" \
  --data-binary '{"jsonrpc":"1.0","id":"docs","method":"spot.build_atomic","params":["\"<id>\"",{}]}' \
  -H 'content-type: text/plain;' \
  http://127.0.0.1:8332/

Parameters

NameTypeReq.Description
idstringyesSpot offer identifier
optionsobjectOptional builder settings { "fee_rate": n, (numeric, optional) Override fee rate in sat/vB (wallet estimate if omitted) }

Result

Type:  any

{ (json object) "psbt" : "str", (string) Base64-encoded PSBT "complete" : true|false, (boolean) Whether the PSBT already contains all signatures "fee" : n, (numeric) Transaction fee paid by this wallet "changepos" : n, (numeric) Index of the native (BTC) change output, or -1 if none "my_role" : "str", (string) Wallet's role in the swap: 'alice', 'bob', or 'observer' "my_output_index" : n, (numeric) Index of the output receiving assets to this wallet, or -1 if observer "asset_change_index" : n (numeric) Index of the asset change output, or -1 if none }

Source: services/core-node/bcore/src/wallet/rpc/contracts.cpp:8817

C++ symbol: spot_build_atomic