|
| 1 | +--- |
| 2 | +slug: /rpc-offers |
| 3 | +--- |
| 4 | + |
| 5 | +# Offers |
| 6 | + |
| 7 | +## make_offer |
| 8 | + |
| 9 | +**Request** |
| 10 | + |
| 11 | +| Parameter | Type | Required | Description | |
| 12 | +| ----------------- | ---------------------------- | -------- | -------------------------------------------------------------- | |
| 13 | +| offered_assets | [Assets](./rpc-types#assets) | true | The assets being spent to make the offer. | |
| 14 | +| requested_assets | [Assets](./rpc-types#assets) | true | The assets that must be paid to fulfill the offer. | |
| 15 | +| fee | [Amount](./rpc-types#amount) | true | The amount of mojos to pay as the fee once the offer is taken. | |
| 16 | +| receive_address | string | false | Overrides the address the requested assets will be sent to. | |
| 17 | +| expires_at_second | number | false | The seconds since UNIX epoch at which the offer expires. | |
| 18 | +| auto_import | boolean | false | Whether the app should import and track the offer's status. | |
| 19 | + |
| 20 | +**Response** |
| 21 | + |
| 22 | +| Parameter | Type | Description | |
| 23 | +| --------- | ------ | ----------------------------------------------------------------- | |
| 24 | +| offer | string | The bech32m encoded offer string. | |
| 25 | +| offer_id | string | An offer id that is compatible with [Dexie](https://dexie.space). | |
| 26 | + |
| 27 | +## take_offer |
| 28 | + |
| 29 | +**Request** |
| 30 | + |
| 31 | +| Parameter | Type | Required | Description | |
| 32 | +| ----------- | ---------------------------- | -------- | ----------------------------------------------------------- | |
| 33 | +| offer | string | true | The bech32m encoded offer string. | |
| 34 | +| fee | [Amount](./rpc-types#amount) | true | The amount of additional mojos to add to the maker's fee. | |
| 35 | +| auto_submit | boolean | false | Whether the transaction should be submitted to the mempool. | |
| 36 | + |
| 37 | +**Response** |
| 38 | + |
| 39 | +| Parameter | Type | Description | |
| 40 | +| -------------- | ------------------ | ------------------------------------------------------ | |
| 41 | +| summary | TransactionSummary | The inputs and outputs in the transaction. | |
| 42 | +| spend_bundle | SpendBundle | The spend bundle representing the transaction. | |
| 43 | +| transaction_id | string | The hash of the spend bundle submitted to the mempool. | |
| 44 | + |
| 45 | +<!-- |
| 46 | +#[derive(Debug, Clone, Serialize, Deserialize)] |
| 47 | +#[cfg_attr(feature = "tauri", derive(specta::Type))] |
| 48 | +pub struct CombineOffers { |
| 49 | + pub offers: Vec<String>, |
| 50 | +} |
| 51 | +
|
| 52 | +#[derive(Debug, Clone, Serialize, Deserialize)] |
| 53 | +#[cfg_attr(feature = "tauri", derive(specta::Type))] |
| 54 | +pub struct CombineOffersResponse { |
| 55 | + pub offer: String, |
| 56 | +} |
| 57 | +
|
| 58 | +#[derive(Debug, Clone, Serialize, Deserialize)] |
| 59 | +#[cfg_attr(feature = "tauri", derive(specta::Type))] |
| 60 | +pub struct ViewOffer { |
| 61 | + pub offer: String, |
| 62 | +} |
| 63 | +
|
| 64 | +#[derive(Debug, Clone, Serialize, Deserialize)] |
| 65 | +#[cfg_attr(feature = "tauri", derive(specta::Type))] |
| 66 | +pub struct ViewOfferResponse { |
| 67 | + pub offer: OfferSummary, |
| 68 | +} |
| 69 | +
|
| 70 | +#[derive(Debug, Clone, Serialize, Deserialize)] |
| 71 | +#[cfg_attr(feature = "tauri", derive(specta::Type))] |
| 72 | +pub struct ImportOffer { |
| 73 | + pub offer: String, |
| 74 | +} |
| 75 | +
|
| 76 | +#[derive(Debug, Clone, Serialize, Deserialize)] |
| 77 | +#[cfg_attr(feature = "tauri", derive(specta::Type))] |
| 78 | +pub struct ImportOfferResponse { |
| 79 | + pub offer_id: String, |
| 80 | +} |
| 81 | +
|
| 82 | +#[derive(Debug, Clone, Copy, Serialize, Deserialize)] |
| 83 | +#[cfg_attr(feature = "tauri", derive(specta::Type))] |
| 84 | +pub struct GetOffers {} |
| 85 | +
|
| 86 | +#[derive(Debug, Clone, Serialize, Deserialize)] |
| 87 | +#[cfg_attr(feature = "tauri", derive(specta::Type))] |
| 88 | +pub struct GetOffersResponse { |
| 89 | + pub offers: Vec<OfferRecord>, |
| 90 | +} |
| 91 | +
|
| 92 | +#[derive(Debug, Clone, Serialize, Deserialize)] |
| 93 | +#[cfg_attr(feature = "tauri", derive(specta::Type))] |
| 94 | +pub struct GetOffer { |
| 95 | + pub offer_id: String, |
| 96 | +} |
| 97 | +
|
| 98 | +#[derive(Debug, Clone, Serialize, Deserialize)] |
| 99 | +#[cfg_attr(feature = "tauri", derive(specta::Type))] |
| 100 | +pub struct GetOfferResponse { |
| 101 | + pub offer: OfferRecord, |
| 102 | +} |
| 103 | +
|
| 104 | +#[derive(Debug, Clone, Serialize, Deserialize)] |
| 105 | +#[cfg_attr(feature = "tauri", derive(specta::Type))] |
| 106 | +pub struct DeleteOffer { |
| 107 | + pub offer_id: String, |
| 108 | +} |
| 109 | +
|
| 110 | +#[derive(Debug, Clone, Copy, Serialize, Deserialize)] |
| 111 | +#[cfg_attr(feature = "tauri", derive(specta::Type))] |
| 112 | +pub struct DeleteOfferResponse {} |
| 113 | +
|
| 114 | +#[derive(Debug, Clone, Serialize, Deserialize)] |
| 115 | +#[cfg_attr(feature = "tauri", derive(specta::Type))] |
| 116 | +pub struct CancelOffer { |
| 117 | + pub offer_id: String, |
| 118 | + pub fee: Amount, |
| 119 | + #[serde(default)] |
| 120 | + pub auto_submit: bool, |
| 121 | +} |
| 122 | +
|
| 123 | +pub type CancelOfferResponse = TransactionResponse; |
| 124 | +
|
| 125 | +#[derive(Debug, Clone, Serialize, Deserialize)] |
| 126 | +#[cfg_attr(feature = "tauri", derive(specta::Type))] |
| 127 | +pub struct CancelOffers { |
| 128 | + pub offer_ids: Vec<String>, |
| 129 | + pub fee: Amount, |
| 130 | + #[serde(default)] |
| 131 | + pub auto_submit: bool, |
| 132 | +} |
| 133 | +
|
| 134 | +pub type CancelOffersResponse = TransactionResponse; |
| 135 | +
|
| 136 | +fn yes() -> bool { |
| 137 | + true |
| 138 | +} --> |
0 commit comments