diff --git a/CHANGELOG.md b/CHANGELOG.md index eb2cb19..5ba97bc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.13.0] - 2021-09-10 + +### Added + +- Adds ability to create Bitcoin and Ethereum estimates using the daily balance held. + ## [1.12.0] - 2021-09-08 ### Added diff --git a/package-lock.json b/package-lock.json index a2d28bd..5bfbe24 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@patch-technology/patch", - "version": "1.12.0", + "version": "1.13.0", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "@patch-technology/patch", - "version": "1.12.0", + "version": "1.13.0", "license": "MIT", "dependencies": { "query-string": "^7.0.1", diff --git a/package.json b/package.json index f689a4d..8256529 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@patch-technology/patch", - "version": "1.12.0", + "version": "1.13.0", "description": "Node.js wrapper for the Patch API", "license": "MIT", "repository": { diff --git a/src/ApiClient.js b/src/ApiClient.js index 5fce057..dc6ff85 100644 --- a/src/ApiClient.js +++ b/src/ApiClient.js @@ -16,7 +16,7 @@ class ApiClient { }; this.defaultHeaders = { - 'User-Agent': 'patch-node/1.12.0' + 'User-Agent': 'patch-node/1.13.0' }; /** diff --git a/src/model/CreateBitcoinEstimateRequest.js b/src/model/CreateBitcoinEstimateRequest.js index ff9ebbc..2d441ff 100644 --- a/src/model/CreateBitcoinEstimateRequest.js +++ b/src/model/CreateBitcoinEstimateRequest.js @@ -29,6 +29,13 @@ class CreateBitcoinEstimateRequest { ); } + if (data.hasOwnProperty('average_daily_balance_btc_sats')) { + obj['average_daily_balance_btc_sats'] = ApiClient.convertToType( + data['average_daily_balance_btc_sats'], + 'Number' + ); + } + if (data.hasOwnProperty('project_id')) { obj['project_id'] = ApiClient.convertToType( data['project_id'], @@ -52,8 +59,11 @@ CreateBitcoinEstimateRequest.prototype['timestamp'] = undefined; CreateBitcoinEstimateRequest.prototype['transaction_value_btc_sats'] = undefined; +CreateBitcoinEstimateRequest.prototype['average_daily_balance_btc_sats'] = + undefined; + CreateBitcoinEstimateRequest.prototype['project_id'] = undefined; -CreateBitcoinEstimateRequest.prototype['create_order'] = undefined; +CreateBitcoinEstimateRequest.prototype['create_order'] = false; export default CreateBitcoinEstimateRequest; diff --git a/src/model/CreateEthereumEstimateRequest.js b/src/model/CreateEthereumEstimateRequest.js index 9bdac83..655d0ff 100644 --- a/src/model/CreateEthereumEstimateRequest.js +++ b/src/model/CreateEthereumEstimateRequest.js @@ -33,6 +33,13 @@ class CreateEthereumEstimateRequest { ); } + if (data.hasOwnProperty('average_daily_balance_eth_gwei')) { + obj['average_daily_balance_eth_gwei'] = ApiClient.convertToType( + data['average_daily_balance_eth_gwei'], + 'Number' + ); + } + if (data.hasOwnProperty('project_id')) { obj['project_id'] = ApiClient.convertToType( data['project_id'], @@ -58,8 +65,11 @@ CreateEthereumEstimateRequest.prototype['gas_used'] = undefined; CreateEthereumEstimateRequest.prototype['transaction_value_eth_gwei'] = undefined; +CreateEthereumEstimateRequest.prototype['average_daily_balance_eth_gwei'] = + undefined; + CreateEthereumEstimateRequest.prototype['project_id'] = undefined; -CreateEthereumEstimateRequest.prototype['create_order'] = undefined; +CreateEthereumEstimateRequest.prototype['create_order'] = false; export default CreateEthereumEstimateRequest; diff --git a/src/model/CreateFlightEstimateRequest.js b/src/model/CreateFlightEstimateRequest.js index a2f3701..274777b 100644 --- a/src/model/CreateFlightEstimateRequest.js +++ b/src/model/CreateFlightEstimateRequest.js @@ -92,6 +92,6 @@ CreateFlightEstimateRequest.prototype['passenger_count'] = undefined; CreateFlightEstimateRequest.prototype['project_id'] = undefined; -CreateFlightEstimateRequest.prototype['create_order'] = undefined; +CreateFlightEstimateRequest.prototype['create_order'] = false; export default CreateFlightEstimateRequest; diff --git a/src/model/CreateMassEstimateRequest.js b/src/model/CreateMassEstimateRequest.js index e9d4269..d89654f 100644 --- a/src/model/CreateMassEstimateRequest.js +++ b/src/model/CreateMassEstimateRequest.js @@ -44,7 +44,7 @@ class CreateMassEstimateRequest { CreateMassEstimateRequest.prototype['mass_g'] = undefined; -CreateMassEstimateRequest.prototype['create_order'] = undefined; +CreateMassEstimateRequest.prototype['create_order'] = false; CreateMassEstimateRequest.prototype['project_id'] = undefined; diff --git a/src/model/CreateShippingEstimateRequest.js b/src/model/CreateShippingEstimateRequest.js index 9cfd86b..f0b2b48 100644 --- a/src/model/CreateShippingEstimateRequest.js +++ b/src/model/CreateShippingEstimateRequest.js @@ -74,6 +74,6 @@ CreateShippingEstimateRequest.prototype['transportation_method'] = undefined; CreateShippingEstimateRequest.prototype['project_id'] = undefined; -CreateShippingEstimateRequest.prototype['create_order'] = undefined; +CreateShippingEstimateRequest.prototype['create_order'] = false; export default CreateShippingEstimateRequest; diff --git a/src/model/CreateVehicleEstimateRequest.js b/src/model/CreateVehicleEstimateRequest.js index b5f3c0e..7cc9cd8 100644 --- a/src/model/CreateVehicleEstimateRequest.js +++ b/src/model/CreateVehicleEstimateRequest.js @@ -67,6 +67,6 @@ CreateVehicleEstimateRequest.prototype['year'] = undefined; CreateVehicleEstimateRequest.prototype['project_id'] = undefined; -CreateVehicleEstimateRequest.prototype['create_order'] = undefined; +CreateVehicleEstimateRequest.prototype['create_order'] = false; export default CreateVehicleEstimateRequest; diff --git a/test/integration/estimates.test.js b/test/integration/estimates.test.js index 5c80bcf..6592071 100644 --- a/test/integration/estimates.test.js +++ b/test/integration/estimates.test.js @@ -111,6 +111,17 @@ describe('Estimates Integration', function () { expect(estimate1.mass_g).to.be.above(estimate2.mass_g); }); + it('supports creating bitcoin estimates with a daily balance', async function () { + const { data: estimate1 } = await patch.estimates.createBitcoinEstimate({ + average_daily_balance_btc_sats: 1000000 + }); + const { data: estimate2 } = await patch.estimates.createBitcoinEstimate({ + average_daily_balance_btc_sats: 10000000 + }); + + expect(estimate1.mass_g).to.be.below(estimate2.mass_g); + }); + it('supports creating ethereum estimates with a gas value', async function () { const createEstimateResponse = await patch.estimates.createEthereumEstimate( {