get-reserves-RESERVE_PUB-history.rst (11517B)
1 .. http:get:: /reserves/$RESERVE_PUB/history 2 3 Request information about the full history of 4 a reserve or an account. 5 6 **Request:** 7 8 The GET request should come with the following HTTP headers: 9 10 *If-None-Match*: 11 The client MAY provide an ``If-None-Match`` header with an 12 Etag. In that case, the server MUST additionally respond with an ``304`` 13 status code in case the reserve history matches the provided Etag. 14 15 *Taler-Reserve-History-Signature*: 16 The client MUST provide Base-32 encoded 17 EdDSA signature over a ``TALER_SIGNATURE_RESERVE_HISTORY_REQUEST`` made with 18 the respective ``$RESERVE_PRIV``, affirming desire to download the current 19 reserve transaction history. 20 21 :query start=OFFSET: *Optional.* Only return reserve history entries with 22 offsets above the given OFFSET. Allows clients to not 23 retrieve history entries they already have. 24 25 **Response:** 26 27 :http:statuscode:`200 OK`: 28 The exchange responds with a `ReserveHistory` object; the reserve was known to the exchange. 29 :http:statuscode:`204 No content`: 30 The reserve history is known, but at this point from the given starting point it is empty. Can only happen if OFFSET was positive. 31 :http:statuscode:`304 Not modified`: 32 The reserve history matches the one identified by the "If-none-match" HTTP header of the request. 33 :http:statuscode:`403 Forbidden`: 34 The *TALER_SIGNATURE_RESERVE_HISTORY_REQUEST* is invalid. 35 This response comes with a standard `ErrorDetail` response with 36 a code of ``TALER_EC_EXCHANGE_RESERVE_HISTORY_BAD_SIGNATURE``. 37 :http:statuscode:`404 Not found`: 38 The reserve key does not belong to a reserve known to the exchange. 39 This response comes with a standard `ErrorDetail` response with 40 a code of ``TALER_EC_EXCHANGE_GENERIC_RESERVE_UNKNOWN``. 41 :http:statuscode:`500 Internal Server Error`: 42 The server experienced an internal error. 43 This response comes with a standard `ErrorDetail` response. 44 Possible error codes include 45 ``TALER_EC_GENERIC_DB_FETCH_FAILED``, 46 ``TALER_EC_GENERIC_DB_SOFT_FAILURE``, or 47 ``TALER_EC_GENERIC_JSON_ALLOCATION_FAILURE``. 48 49 **Details:** 50 51 .. ts:def:: ReserveHistory 52 53 interface ReserveHistory { 54 // Balance left in the reserve. 55 balance: Amount; 56 57 // If set, gives the maximum age group that the client is required to set 58 // during withdrawal. 59 maximum_age_group: Integer; 60 61 // Transaction history for this reserve. 62 // May be partial (!). 63 history: TransactionHistoryItem[]; 64 } 65 66 Objects in the transaction history have the following format: 67 68 .. ts:def:: TransactionHistoryItem 69 70 // Union discriminated by the "type" field. 71 type TransactionHistoryItem = 72 | AccountSetupTransaction 73 | ReserveWithdrawTransaction 74 | ReserveCreditTransaction 75 | ReserveClosingTransaction 76 | ReserveRecoupTransaction 77 | ReserveHistoryRequestTransaction 78 | ReserveOpenRequestTransaction 79 | ReserveCloseRequestTransaction 80 | PurseMergeTransaction; 81 82 .. ts:def:: AccountSetupTransaction 83 84 interface AccountSetupTransaction { 85 type: "SETUP"; 86 87 // Offset of this entry in the reserve history. 88 // Useful to request incremental histories via 89 // the "start" query parameter. 90 history_offset: Integer; 91 92 // KYC fee agreed to by the reserve owner. 93 kyc_fee: Amount; 94 95 // Time when the KYC was triggered. 96 kyc_timestamp: Timestamp; 97 98 // Hash of the wire details of the account. 99 // Note that this hash is unsalted and potentially 100 // private (as it could be inverted), hence access 101 // to this endpoint must be authorized using the 102 // private key of the reserve. 103 h_wire: HashCode; 104 105 // Signature created with the reserve's private key. 106 // Must be of purpose ``TALER_SIGNATURE_ACCOUNT_SETUP_REQUEST`` over 107 // a ``TALER_AccountSetupRequestSignaturePS``. 108 reserve_sig: EddsaSignature; 109 110 } 111 112 .. ts:def:: ReserveWithdrawTransaction 113 114 interface ReserveWithdrawTransaction { 115 type: "WITHDRAW"; 116 117 // Offset of this entry in the reserve history. 118 // Useful to request incremental histories via 119 // the "start" query parameter. 120 history_offset: Integer; 121 122 // Amount withdrawn. 123 amount: Amount; 124 125 // Total fee that is charged for withdraw. 126 withdraw_fee: Amount; 127 128 // Total number of coins in the withdraw request 129 num_coins: Integer; 130 131 // Signature over a `TALER_WithdrawRequestPS` 132 // with purpose ``TALER_SIGNATURE_WALLET_RESERVE_WITHDRAW`` 133 // created with the reserve's private key. 134 reserve_sig: EddsaSignature; 135 136 // The hash of the all the planchets that were provided during the 137 // call to /withdraw. 138 h_planchets: HashCode; 139 140 // The blinding seed that was provided. It will be NULL if 141 // no denominations of cipher type Clause-Schnorr were invovled 142 blinding_seed?: BlindingMasterSeed; 143 144 // The array of hashes of public key of denominations for the coins. 145 denom_pub_hashes: HashCode[]; 146 147 // The maximum age committed to, if the withdraw request 148 // required age-restriction 149 max_age?: Integer; 150 151 // The noreveal index that was returned as part 152 // of a age-restricted withdraw, if applicable 153 noreveal_index?: Integer; 154 155 } 156 157 158 .. ts:def:: ReserveCreditTransaction 159 160 interface ReserveCreditTransaction { 161 type: "CREDIT"; 162 163 // Offset of this entry in the reserve history. 164 // Useful to request incremental histories via 165 // the "start" query parameter. 166 history_offset: Integer; 167 168 // Amount deposited. 169 amount: Amount; 170 171 // Sender account full payto:// URI. 172 sender_account_url: string; 173 174 // Opaque identifier internal to the exchange that 175 // uniquely identifies the wire transfer that credited the reserve. 176 wire_reference: Integer; 177 178 // Timestamp of the incoming wire transfer. 179 timestamp: Timestamp; 180 } 181 182 183 .. ts:def:: ReserveClosingTransaction 184 185 interface ReserveClosingTransaction { 186 type: "CLOSING"; 187 188 // Offset of this entry in the reserve history. 189 // Useful to request incremental histories via 190 // the "start" query parameter. 191 history_offset: Integer; 192 193 // Closing balance. 194 amount: Amount; 195 196 // Closing fee charged by the exchange. 197 closing_fee: Amount; 198 199 // Wire transfer subject. 200 wtid: Base32; 201 202 // Full payto URI of the wire account into which the funds were returned to. 203 receiver_account_details: string; 204 205 // This is a signature over a 206 // struct `TALER_ReserveCloseConfirmationPS` with purpose 207 // ``TALER_SIGNATURE_EXCHANGE_RESERVE_CLOSED``. 208 exchange_sig: EddsaSignature; 209 210 // Public key used to create 'exchange_sig'. 211 exchange_pub: EddsaPublicKey; 212 213 // Time when the reserve was closed. 214 timestamp: Timestamp; 215 } 216 217 218 .. ts:def:: ReserveRecoupTransaction 219 220 interface ReserveRecoupTransaction { 221 type: "RECOUP"; 222 223 // Offset of this entry in the reserve history. 224 // Useful to request incremental histories via 225 // the "start" query parameter. 226 history_offset: Integer; 227 228 // Public key of the coin that was paid back. 229 coin_pub: CoinPublicKey; 230 231 // This is a signature over a 232 // struct `TALER_RecoupConfirmationPS` with purpose 233 // ``TALER_SIGNATURE_EXCHANGE_CONFIRM_RECOUP``. 234 exchange_sig: EddsaSignature; 235 236 // Public key used to create 'exchange_sig'. 237 exchange_pub: EddsaPublicKey; 238 239 // Time when the recoup was accepted. 240 timestamp: Timestamp; 241 242 // Amount recouped to the reserve. 243 amount: Amount; 244 } 245 246 .. ts:def:: ReserveHistoryRequestTransaction 247 248 interface ReserveHistoryRequestTransaction { 249 type: "HISTORY"; 250 251 // Offset of this entry in the reserve history. 252 // Useful to request incremental histories via 253 // the "start" query parameter. 254 history_offset: Integer; 255 256 // Signature created with the reserve's private key. 257 // Must be of purpose ``TALER_SIGNATURE_RESERVE_HISTORY_REQUEST`` over 258 // a ``TALER_ReserveHistoryRequestSignaturePS``. 259 reserve_sig: EddsaSignature; 260 261 // Timestamp of the history request. 262 request_timestamp: Timestamp; 263 264 // Fee charged for the history request. 265 amount: Amount; 266 } 267 268 .. ts:def:: ReserveOpenRequestTransaction 269 270 interface ReserveOpenRequestTransaction { 271 type: "OPEN"; 272 273 // Offset of this entry in the reserve history. 274 // Useful to request incremental histories via 275 // the "start" query parameter. 276 history_offset: Integer; 277 278 // Open fee paid from the reserve. 279 open_fee: Amount; 280 281 // This is a signature over 282 // a struct `TALER_ReserveOpenPS` with purpose 283 // ``TALER_SIGNATURE_WALLET_RESERVE_OPEN``. 284 reserve_sig: EddsaSignature; 285 286 // Timestamp of the open request. 287 request_timestamp: Timestamp; 288 289 // Requested expiration. 290 requested_expiration: Timestamp; 291 292 // Requested number of free open purses. 293 requested_min_purses: Integer; 294 295 } 296 297 .. ts:def:: ReserveCloseRequestTransaction 298 299 interface ReserveCloseRequestTransaction { 300 type: "CLOSE"; 301 302 // Offset of this entry in the reserve history. 303 // Useful to request incremental histories via 304 // the "start" query parameter. 305 history_offset: Integer; 306 307 // This is a signature over 308 // a struct `TALER_ReserveClosePS` with purpose 309 // ``TALER_SIGNATURE_WALLET_RESERVE_CLOSE``. 310 reserve_sig: EddsaSignature; 311 312 // Hash over the full payto URI of the target account. 313 h_payto?: FullPaytoHash; 314 315 // Timestamp of the close request. 316 request_timestamp: Timestamp; 317 } 318 319 .. ts:def:: PurseMergeTransaction 320 321 interface PurseMergeTransaction { 322 type: "MERGE"; 323 324 // Offset of this entry in the reserve history. 325 // Useful to request incremental histories via 326 // the "start" query parameter. 327 history_offset: Integer; 328 329 // SHA-512 hash of the contact of the purse. 330 h_contract_terms: HashCode; 331 332 // EdDSA public key used to approve merges of this purse. 333 merge_pub: EddsaPublicKey; 334 335 // Minimum age required for all coins deposited into the purse. 336 min_age: Integer; 337 338 // Number that identifies who created the purse 339 // and how it was paid for. 340 flags: Integer; 341 342 // Purse public key. 343 purse_pub: EddsaPublicKey; 344 345 // EdDSA signature of the account/reserve affirming the merge 346 // over a `TALER_AccountMergeSignaturePS`. 347 // Must be of purpose ``TALER_SIGNATURE_ACCOUNT_MERGE`` 348 reserve_sig: EddsaSignature; 349 350 // Client-side timestamp of when the merge request was made. 351 merge_timestamp: Timestamp; 352 353 // Indicative time by which the purse should expire 354 // if it has not been merged into an account. At this 355 // point, all of the deposits made should be 356 // auto-refunded. 357 purse_expiration: Timestamp; 358 359 // Purse fee the reserve owner paid for the purse creation. 360 purse_fee: Amount; 361 362 // Total amount merged into the reserve. 363 // (excludes fees). 364 amount: Amount; 365 366 // True if the purse was actually merged. 367 // If false, only the purse_fee has an impact 368 // on the reserve balance! 369 merged: boolean; 370 }