Language

Choose a language

/build/rpc / cosign / bulletin_board

cosign.post_offer

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

cosign.post_offer "offer_type" "asset_send" "asset_recv" amount price ( ["method",...] ["region",...] requires_escrow min_reputation_score ) Post a trading offer to the bulletin board. Arguments: 1. offer_type (string, required) Offer type: buy|sell|swap 2. asset_send (string, required) Asset being sent (e.g., BTC, USD) 3. asset_recv (string, required) Asset being received 4. amount (numeric, required) Amount of asset_send 5. price (numeric, required) Exchange rate 6. payment_methods (json array, optional) Accepted payment methods [ "method", (string) Payment method ... ] 7. regions (json array, optional) Allowed regions [ "region", (string) Region code ... ] 8. requires_escrow (boolean, optional) Whether escrow is required (default: false) 9. min_reputation_score (numeric, optional) Minimum reputation score for taker (default: 0) Result: { (json object) "success" : true|false, (boolean) Whether post succeeded "offer_id" : "str" (string) UUID of the created offer } Examples: > bitcoin-cli cosign.post_offer "sell" "BTC" "USD" 0.1 65000 > curl --user myusername --data-binary '{"jsonrpc": "2.0", "id": "curltest", "method": "cosign.post_offer", "params": ["sell","BTC","USD",0.1,65000]}' -H 'content-type: application/json' http://127.0.0.1:8332/

Signature

cosign.post_offer(offer_type: string, asset_send: string, asset_recv: string, amount: number, price: number, payment_methods?: array, regions?: array, requires_escrow?: boolean, min_reputation_score?: number) → any

Code samples

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

Parameters

NameTypeReq.Description
offer_typestringyesOffer type: buy|sell|swap
asset_sendstringyesAsset being sent (e.g., BTC, USD)
asset_recvstringyesAsset being received
amountnumberyesAmount of asset_send
pricenumberyesExchange rate
payment_methodsany[]Accepted payment methods [ "method", (string) Payment method ... ]
regionsany[]Allowed regions [ "region", (string) Region code ... ]
requires_escrowbooleanWhether escrow is required (default: false)
min_reputation_scorenumberMinimum reputation score for taker (default: 0)

Result

Type:  any

{ (json object) "success" : true|false, (boolean) Whether post succeeded "offer_id" : "str" (string) UUID of the created offer }

Source: services/core-node/bcore/src/rpc/cosign.cpp:1787

C++ symbol: cosign_post_offer