Skip to content

Commit c78ffe1

Browse files
authored
Add btc balance (#46)
1 parent 6068180 commit c78ffe1

11 files changed

+47
-10
lines changed

Diff for: CHANGELOG.md

+6
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.13.0] - 2021-09-10
9+
10+
### Added
11+
12+
- Adds ability to create Bitcoin and Ethereum estimates using the daily balance held.
13+
814
## [1.12.0] - 2021-09-08
915

1016
### Added

Diff for: package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@patch-technology/patch",
3-
"version": "1.12.0",
3+
"version": "1.13.0",
44
"description": "Node.js wrapper for the Patch API",
55
"license": "MIT",
66
"repository": {

Diff for: src/ApiClient.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ class ApiClient {
1616
};
1717

1818
this.defaultHeaders = {
19-
'User-Agent': 'patch-node/1.12.0'
19+
'User-Agent': 'patch-node/1.13.0'
2020
};
2121

2222
/**

Diff for: src/model/CreateBitcoinEstimateRequest.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,13 @@ class CreateBitcoinEstimateRequest {
2929
);
3030
}
3131

32+
if (data.hasOwnProperty('average_daily_balance_btc_sats')) {
33+
obj['average_daily_balance_btc_sats'] = ApiClient.convertToType(
34+
data['average_daily_balance_btc_sats'],
35+
'Number'
36+
);
37+
}
38+
3239
if (data.hasOwnProperty('project_id')) {
3340
obj['project_id'] = ApiClient.convertToType(
3441
data['project_id'],
@@ -52,8 +59,11 @@ CreateBitcoinEstimateRequest.prototype['timestamp'] = undefined;
5259
CreateBitcoinEstimateRequest.prototype['transaction_value_btc_sats'] =
5360
undefined;
5461

62+
CreateBitcoinEstimateRequest.prototype['average_daily_balance_btc_sats'] =
63+
undefined;
64+
5565
CreateBitcoinEstimateRequest.prototype['project_id'] = undefined;
5666

57-
CreateBitcoinEstimateRequest.prototype['create_order'] = undefined;
67+
CreateBitcoinEstimateRequest.prototype['create_order'] = false;
5868

5969
export default CreateBitcoinEstimateRequest;

Diff for: src/model/CreateEthereumEstimateRequest.js

+11-1
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,13 @@ class CreateEthereumEstimateRequest {
3333
);
3434
}
3535

36+
if (data.hasOwnProperty('average_daily_balance_eth_gwei')) {
37+
obj['average_daily_balance_eth_gwei'] = ApiClient.convertToType(
38+
data['average_daily_balance_eth_gwei'],
39+
'Number'
40+
);
41+
}
42+
3643
if (data.hasOwnProperty('project_id')) {
3744
obj['project_id'] = ApiClient.convertToType(
3845
data['project_id'],
@@ -58,8 +65,11 @@ CreateEthereumEstimateRequest.prototype['gas_used'] = undefined;
5865
CreateEthereumEstimateRequest.prototype['transaction_value_eth_gwei'] =
5966
undefined;
6067

68+
CreateEthereumEstimateRequest.prototype['average_daily_balance_eth_gwei'] =
69+
undefined;
70+
6171
CreateEthereumEstimateRequest.prototype['project_id'] = undefined;
6272

63-
CreateEthereumEstimateRequest.prototype['create_order'] = undefined;
73+
CreateEthereumEstimateRequest.prototype['create_order'] = false;
6474

6575
export default CreateEthereumEstimateRequest;

Diff for: src/model/CreateFlightEstimateRequest.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,6 @@ CreateFlightEstimateRequest.prototype['passenger_count'] = undefined;
9292

9393
CreateFlightEstimateRequest.prototype['project_id'] = undefined;
9494

95-
CreateFlightEstimateRequest.prototype['create_order'] = undefined;
95+
CreateFlightEstimateRequest.prototype['create_order'] = false;
9696

9797
export default CreateFlightEstimateRequest;

Diff for: src/model/CreateMassEstimateRequest.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ class CreateMassEstimateRequest {
4444

4545
CreateMassEstimateRequest.prototype['mass_g'] = undefined;
4646

47-
CreateMassEstimateRequest.prototype['create_order'] = undefined;
47+
CreateMassEstimateRequest.prototype['create_order'] = false;
4848

4949
CreateMassEstimateRequest.prototype['project_id'] = undefined;
5050

Diff for: src/model/CreateShippingEstimateRequest.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,6 @@ CreateShippingEstimateRequest.prototype['transportation_method'] = undefined;
7474

7575
CreateShippingEstimateRequest.prototype['project_id'] = undefined;
7676

77-
CreateShippingEstimateRequest.prototype['create_order'] = undefined;
77+
CreateShippingEstimateRequest.prototype['create_order'] = false;
7878

7979
export default CreateShippingEstimateRequest;

Diff for: src/model/CreateVehicleEstimateRequest.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,6 @@ CreateVehicleEstimateRequest.prototype['year'] = undefined;
6767

6868
CreateVehicleEstimateRequest.prototype['project_id'] = undefined;
6969

70-
CreateVehicleEstimateRequest.prototype['create_order'] = undefined;
70+
CreateVehicleEstimateRequest.prototype['create_order'] = false;
7171

7272
export default CreateVehicleEstimateRequest;

Diff for: test/integration/estimates.test.js

+11
Original file line numberDiff line numberDiff line change
@@ -111,6 +111,17 @@ describe('Estimates Integration', function () {
111111
expect(estimate1.mass_g).to.be.above(estimate2.mass_g);
112112
});
113113

114+
it('supports creating bitcoin estimates with a daily balance', async function () {
115+
const { data: estimate1 } = await patch.estimates.createBitcoinEstimate({
116+
average_daily_balance_btc_sats: 1000000
117+
});
118+
const { data: estimate2 } = await patch.estimates.createBitcoinEstimate({
119+
average_daily_balance_btc_sats: 10000000
120+
});
121+
122+
expect(estimate1.mass_g).to.be.below(estimate2.mass_g);
123+
});
124+
114125
it('supports creating ethereum estimates with a gas value', async function () {
115126
const createEstimateResponse = await patch.estimates.createEthereumEstimate(
116127
{

0 commit comments

Comments
 (0)