Commands
chia_getAllOffers
Gets a list of offers, based on certain search criteria.
Parameter | Type | Description |
---|
start? (optional) | number | Start index. |
end? (optional) | number | End index. |
sortKey? (optional) | string | Sort key. |
reverse? (optional) | boolean | Whether to reverse order. |
includeMyOffers? (optional) | boolean | Whether to include own offers. |
includeTakenOffers? (optional) | number | Whether to include taken offers. |
Output Data
The output is an array of type TradeRecord[]
.
chia_getOffersCount
Gets the number of owned offers, taken offers, and total offers.
Output Data
Parameter | Type | Description |
---|
myOffersCount | number | Number of owned offers. |
takenOffersCount | number | Number of taken offers. |
total | number | Total number of offers. |
success | boolean | Backend success status. |
chia_cancelOffer
Cancels an offer either on-chain by spending the coins or off-chain by only removing it from the list.
Parameter | Type | Description |
---|
tradeId | string | Trade id. |
secure | boolean | Whether to cancel the offer on-chain. |
fee | number | Transaction fee in mojos. |
Output Data
Parameter | Type | Description |
---|
success | boolean | Backend success status. |
chia_checkOfferValidity
Checks whether or not an offer is still valid.
Parameter | Type | Description |
---|
offerData | string | Bech32m encoded offer data. |
Output Data
Parameter | Type | Description |
---|
id | string | Trade id. |
valid | boolean | Whether the offer is valid. |
chia_takeOffer
Accepts an offer and completes the transaction.
Parameter | Type | Description |
---|
offer | string | Bech32m encoded offer data. |
fee | number | Transaction fee in mojos. |
Output Data
Parameter | Type | Description |
---|
tradeRecord | TradeRecord | Trade record. |
success | boolean | Backend success status. |
chia_getOfferSummary
Gets the summary object of an offer.
Parameter | Type | Description |
---|
offerData | string | Bech32m encoded offer data. |
Output Data
Parameter | Type | Description |
---|
id | string | Trade id. |
summary | TradeSummary | Trade summary. |
success | boolean | Backend success status. |
chia_getOfferData
Gets the data of an offer.
Parameter | Type | Description |
---|
offerId | string | Trade id. |
Output Data
Parameter | Type | Description |
---|
offer | string | Bech32m encoded offer data. |
tradeRecord | TradeRecord | Trade record. |
success | boolean | Backend success status. |
chia_getOfferRecord
Gets the trade record of an offer.
Parameter | Type | Description |
---|
offerId | string | Trade id. |
Output Data
Parameter | Type | Description |
---|
offer | null | Use chia_getOfferData if you need this. |
tradeRecord | TradeRecord | Trade record. |
success | boolean | Backend success status. |
chia_createOfferForIds
Creates an offer for wallet ids.
Parameter | Type | Description |
---|
offer | any | Offered asset amounts. |
driverDict | any | Driver dict object. |
validateOnly? (optional) | boolean | Whether to only validate the offer. |
disableJSONFormatting? (optional) | boolean | Whether to disable JSON formatting. |
Output Data
Parameter | Type | Description |
---|
offer | string | Bech32m encoded offer data. |
tradeRecord | TradeRecord | Trade record. |
Types
TradeRecord
Parameter | Type | Description |
---|
acceptedAtTime | number | null | Timestamp when the trade was accepted. |
coinsOfInterest | Coin[] | Coins involved in trade. |
confirmedAtIndex | number | Confirmation block index. |
createdAtTime | number | Timestamp when the trade was created. |
isMyOffer | boolean | Whether this is the wallet's own offer. |
pending | Record<string, number> | Pending amounts. |
sent | number | Number of peers the transaction was sent to. |
sentTo | Peer[] | Peers the transaction was sent to. |
status | TradeStatus | Trade status. |
summary | any | Trade summary metadata. |
takenOffer | string | null | Taken bech32m encoded offer data. |
tradeId | string | Trade id. |
_offerData | string | Bech32m encoded offer data. |
TradeStatus
Values that can be returned for the trade_status. Note that offers cannot be resynced and are not available on-chain so granular trade_status is not always available.
Value | |
---|
PENDING_ACCEPT | Acceptance has been pushed to the chain and is pending confirmation. |
PENDING_CONFIRM | Acceptance has been pushed to the chain and is pending confirmation. |
PENDING_CANCEL | Cancelation has been pushed to the chain (if applicable) and is pending confirmation. |
CANCELLED | Offer cancellation has been confirmed onchain (if applicable). |
CONFIRMED | Offer acceptance has been confirmed onchain. |
FAILED | Offer acceptance failed, review logs for reasoning of failure. |