Skip to content

Commit

Permalink
Added proxy URL to prevent CORS issue
Browse files Browse the repository at this point in the history
  • Loading branch information
SDargarh committed Jan 24, 2024
1 parent fa277c7 commit 265520a
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 7 deletions.
6 changes: 5 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,8 @@
### 2.0.5 (2024-01-23)

- Replaced blockcyper api with sochain api to fetch fees in satoshi
- Updated sign transaction to use bitcoinjs-lib
- Updated sign transaction to use bitcoinjs-lib

### 2.0.6 (2024-01-23)

- Added proxy URL to prevent CORS issue
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@getsafle/vault-bitcoin-controller",
"version": "2.0.5",
"version": "2.0.6",
"description": "",
"engines": {
"node": ">= 10"
Expand Down
1 change: 1 addition & 0 deletions src/constants/index.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
module.exports = {
SOCHAIN_API_KEY: 'jsGr7ioLvkz1Hfo6uwH_CGYdOnIpWtrJ',
SOCHAIN_BASE_URL: "https://sochain.com/api/v3/",
PROD_PROXY_BASE_URL: "https://proxy.getsafle.com"
}
15 changes: 12 additions & 3 deletions src/helper/calculateFeeAndInput.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,24 @@
const axios = require('axios')
var sb = require("satoshi-bitcoin");
const { PROD_PROXY_BASE_URL} = require("../constants/index.js");

async function getTransactionSize(URL, headers){

let inputCount = 0;
let outputCount = 2;

let data = {
"url": URL,
"headers": headers
}

const utxos = await axios({
url : `${URL}`,
method: 'GET',
headers: headers
url : `${PROD_PROXY_BASE_URL}` + '/get',
method: "POST",
data: JSON.stringify(data),
headers: {
'Content-Type': 'application/json'
},
});

let totalAmountAvailable = 0;
Expand Down

0 comments on commit 265520a

Please sign in to comment.