| 69 | * @module UnspentOutputsApi |
| 70 | */ |
| 71 | const unspentOutputsAPI = (client) => { |
| 72 | return { |
| 73 | /** |
| 74 | * Get one page of unspent outputs matching the specified query. |
| 75 | * |
| 76 | * @param {Object} params={} - Filter and pagination information. |
| 77 | * @param {String} params.filter - Filter string, see {@link https://chain.com/docs/core/build-applications/queries}. |
| 78 | * @param {Array<String|Number>} params.filterParams - Parameter values for filter string (if needed). |
| 79 | * @param {Integer} params.timestamp - A millisecond Unix timestamp. By using this parameter, you can perform queries that reflect the state of the blockchain at different points in time. |
| 80 | * @param {Number} params.pageSize - Number of items to return in result set. |
| 81 | * @param {pageCallback} [callback] - Optional callback. Use instead of Promise return value as desired. |
| 82 | * @returns {Promise<Page<UnspentOutput>>} Requested page of results. |
| 83 | */ |
| 84 | query: (params, cb) => shared.query(client, 'unspentOutputs', '/list-unspent-outputs', params, {cb}), |
| 85 | |
| 86 | /** |
| 87 | * Request all unspent outputs matching the specified query, calling the |
| 88 | * supplied processor callback with each item individually. |
| 89 | * |
| 90 | * @param {Object} params={} - Filter and pagination information. |
| 91 | * @param {String} params.filter - Filter string, see {@link https://chain.com/docs/core/build-applications/queries}. |
| 92 | * @param {Array<String|Number>} params.filterParams - Parameter values for filter string (if needed). |
| 93 | * @param {Integer} params.timestamp - A millisecond Unix timestamp. By using this parameter, you can perform queries that reflect the state of the blockchain at different points in time. |
| 94 | * @param {Number} params.pageSize - Number of items to return in result set. |
| 95 | * @param {QueryProcessor<UnspentOutput>} processor - Processing callback. |
| 96 | * @param {objectCallback} [callback] - Optional callback. Use instead of Promise return value as desired. |
| 97 | * @returns {Promise} A promise resolved upon processing of all items, or |
| 98 | * rejected on error. |
| 99 | */ |
| 100 | queryAll: (params, processor, cb) => shared.queryAll(client, 'unspentOutputs', params, processor, cb), |
| 101 | } |
| 102 | } |
| 103 | |
| 104 | module.exports = unspentOutputsAPI |