Skip to content

Commit

Permalink
removed axios reference in the sapling package and replaced it with t…
Browse files Browse the repository at this point in the history
…he fetch counterpart
  • Loading branch information
dsawali committed Nov 24, 2023
1 parent 0429252 commit 53aa493
Show file tree
Hide file tree
Showing 5 changed files with 23 additions and 279 deletions.
35 changes: 17 additions & 18 deletions package-lock.json

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

1 change: 0 additions & 1 deletion packages/taquito-http-utils/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@
"dependencies": {
"@taquito/core": "^17.4.0",
"@types/node-fetch": "^2.6.9",
"axios": "^0.27.2",
"node-fetch": "^2.7.0"
},
"devDependencies": {
Expand Down
253 changes: 0 additions & 253 deletions packages/taquito-http-utils/src/fetch-adapter.ts

This file was deleted.

11 changes: 5 additions & 6 deletions packages/taquito-sapling/fetch-sapling-params.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* eslint-disable @typescript-eslint/no-var-requires */
const fs = require("fs")
const axios = require("axios")
const fetch = require('node-fetch');

const ZCASH_DOWNLOAD_URL = 'https://download.z.cash/downloads';
const ZCASH_SPEND_PARAMS_FILE_NAME = 'sapling-spend.params';
Expand All @@ -9,10 +9,9 @@ const SPEND_PARAMS = 'saplingSpendParams';
const OUTPUT_PARAMS = 'saplingOutputParams';

async function fetchSaplingParams(url, name) {

const response = await axios.get(`${ZCASH_DOWNLOAD_URL}/${url}`, {
responseType: 'arraybuffer',
});
const response = await fetch(`${ZCASH_DOWNLOAD_URL}/${url}`);
const arrBuff = await response.arrayBuffer();
const buff = Buffer.from(arrBuff);

fs.writeFile(`${name}.js`, `
(function (root, factory) {
Expand All @@ -28,7 +27,7 @@ async function fetchSaplingParams(url, name) {
}
}(this, function () {
return {
"${name}": "${response.data.toString('base64')}"
"${name}": "${buff.toString('base64')}"
};
}));
`, (err) => {
Expand Down
2 changes: 1 addition & 1 deletion packages/taquito-sapling/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
"bignumber.js": "^9.1.2",
"bip39": "3.1.0",
"blakejs": "^1.2.1",
"node-fetch": "^2.7.0",
"pbkdf2": "^3.1.2",
"typedarray-to-buffer": "^4.0.0"
},
Expand All @@ -86,7 +87,6 @@
"@types/typedarray-to-buffer": "^4.0.0",
"@typescript-eslint/eslint-plugin": "^6.8.0",
"@typescript-eslint/parser": "^6.8.0",
"axios": "^0.27.2",
"colors": "^1.4.0",
"coveralls": "^3.1.1",
"cross-env": "^7.0.3",
Expand Down

0 comments on commit 53aa493

Please sign in to comment.