Skip to main content

Offer Commands

Commands

chia_getAllOffers

Gets a list of offers, based on certain search criteria.

ParameterTypeDescription
start? (optional)numberStart index.
end? (optional)numberEnd index.
sortKey? (optional)stringSort key.
reverse? (optional)booleanWhether to reverse order.
includeMyOffers? (optional)booleanWhether to include own offers.
includeTakenOffers? (optional)numberWhether 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

ParameterTypeDescription
myOffersCountnumberNumber of owned offers.
takenOffersCountnumberNumber of taken offers.
totalnumberTotal number of offers.
successbooleanBackend success status.

chia_cancelOffer

Cancels an offer either on-chain by spending the coins or off-chain by only removing it from the list.

ParameterTypeDescription
tradeIdstringTrade id.
securebooleanWhether to cancel the offer on-chain.
feenumberTransaction fee in mojos.

Output Data

ParameterTypeDescription
successbooleanBackend success status.

chia_checkOfferValidity

Checks whether or not an offer is still valid.

ParameterTypeDescription
offerDatastringBech32m encoded offer data.

Output Data

ParameterTypeDescription
idstringTrade id.
validbooleanWhether the offer is valid.

chia_takeOffer

Accepts an offer and completes the transaction.

ParameterTypeDescription
offerstringBech32m encoded offer data.
feenumberTransaction fee in mojos.

Output Data

ParameterTypeDescription
tradeRecordTradeRecordTrade record.
successbooleanBackend success status.

chia_getOfferSummary

Gets the summary object of an offer.

ParameterTypeDescription
offerDatastringBech32m encoded offer data.

Output Data

ParameterTypeDescription
idstringTrade id.
summaryTradeSummaryTrade summary.
successbooleanBackend success status.

chia_getOfferData

Gets the data of an offer.

ParameterTypeDescription
offerIdstringTrade id.

Output Data

ParameterTypeDescription
offerstringBech32m encoded offer data.
tradeRecordTradeRecordTrade record.
successbooleanBackend success status.

chia_getOfferRecord

Gets the trade record of an offer.

ParameterTypeDescription
offerIdstringTrade id.

Output Data

ParameterTypeDescription
offernullUse chia_getOfferData if you need this.
tradeRecordTradeRecordTrade record.
successbooleanBackend success status.

chia_createOfferForIds

Creates an offer for wallet ids.

ParameterTypeDescription
offeranyOffered asset amounts.
driverDictanyDriver dict object.
validateOnly? (optional)booleanWhether to only validate the offer.
disableJSONFormatting? (optional)booleanWhether to disable JSON formatting.

Output Data

ParameterTypeDescription
offerstringBech32m encoded offer data.
tradeRecordTradeRecordTrade record.

Types

TradeRecord

ParameterTypeDescription
acceptedAtTimenumber | nullTimestamp when the trade was accepted.
coinsOfInterestCoin[]Coins involved in trade.
confirmedAtIndexnumberConfirmation block index.
createdAtTimenumberTimestamp when the trade was created.
isMyOfferbooleanWhether this is the wallet's own offer.
pendingRecord<string, number>Pending amounts.
sentnumberNumber of peers the transaction was sent to.
sentToPeer[]Peers the transaction was sent to.
statusTradeStatusTrade status.
summaryanyTrade summary metadata.
takenOfferstring | nullTaken bech32m encoded offer data.
tradeIdstringTrade id.
_offerDatastringBech32m 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_ACCEPTAcceptance has been pushed to the chain and is pending confirmation.
PENDING_CONFIRMAcceptance has been pushed to the chain and is pending confirmation.
PENDING_CANCELCancelation has been pushed to the chain (if applicable) and is pending confirmation.
CANCELLEDOffer cancellation has been confirmed onchain (if applicable).
CONFIRMEDOffer acceptance has been confirmed onchain.
FAILEDOffer acceptance failed, review logs for reasoning of failure.