REST API
To interact with the REST API, it is required to set the header Content-Type: application/json
and send a JSON payload containing values for the fields specified below, or if no inputs are described, an empty object can be supplied.
/address
Retrieves the pint1
address associated with the daemon's connection to pintp2p.
/ethereum-address
Retrieves the Ethereum wallet address associated with the daemon which is used to sign spends involved in trades.
/peer
Retrieves the orderbook hosted by a remote peer on the PintSwap network, as well as any other details hosted by the peer, including the bio
Inputs:
A .drip name can be used in place of a pint address, if one is registered
/peer-image
Pipes binary data to stdout containing the PNG image content for a PeerId profile picture. Should be redirected to a file. Inputs can be a pint address or a .drip name.
Inputs:
/add
Adds a limit order to the local orderbook. If the order exists on the daemon, it can be taken by anyone who dials the peer with the /trade function, whether or not the node is actively publishing. It only requires the pint address of the daemon to trade against it, or otherwise the .drip name registered, if there is one.
Inputs:
/limit
Alternative syntax for the functionality in /add, which will adjust for a decimals() value automatically, so a floating point value can be used with the RPC for a price and amount.
Inputs:
/offers
Retrives the local orders hosted on the daemon process which will be published if /publish is invoked.
/delete
Deletes an order from the local orderbook hosted on the daemon process.
/clear
Deletes the entire local orderbook hosted on the daemon process.
/publish
Begins publishing the orderbook local to the daemon. This must be called after the daemon initializes or your orders will not be visible on the public orderbook.
Example:
/subscribe
Begins listening fo orderbook publishes on the PintSwap network. Orders will accumulate and can thereafter be queried with the /orderbook route. If this API endpoint is not called after the daemon initializes the /orderbook route will respond with an empty list.
/unsubscribe
Stops listening for orderbook publishes on the PintSwap network.
/orderbook
Returns a view of the complete orderbook and associated PeerId for each offering.
/trade
Attempts to negotiate a trade aggregating the complete set of orderid/amount pairs supplied, with the targeted peer. Supports the broadcast: true
property which, if set, will attempt to execute the trade transactions as a bundle using the flashbots relay API.
A /trade invocation can only execute if the base asset / trade asset pair are consistent throughout the list of orders to take, and they all must be offered by the same peer. This is true for any trade execution on the PintSwap protocol, whether it is by the daemon or the webapp that is being called to perform the trade.
Inputs:
/register
Registers a name on the .drip nameserver peers. Can only be unregistered with the PeerId used to register. Further work is planned to improve name resolution access control and mutability. For now, ensure you do not lose your PeerId if you intend to keep your .drip name.
Inputs:
/resolve
Resolves a .drip
name to a pint address. Can also be used to do reverse lookups
Inputs:
/set-bio
Sets the bio associated with your daemon process, as visible on the webapp.
Inputs:
/set-image
Sets the profile picture associated with your daemon process, as visible on the webapp.
Inputs:
ws://localhost:42161
Open a WebSocket connection to ws://: as specified by the environment to begin receiving logs in the form
Last updated