mahdiyari / hive-tx-js

Lightweight and complete JavaScript library for using Hive blockchain in Javascript environments such as Web or NodeJS.
MIT License
25 stars 12 forks source link

feat(call.js): Replaced axios by node-fetch #30

Closed cedricguillas closed 1 year ago

cedricguillas commented 1 year ago

Replaced axios by node-fetch to make sure HiveTx is compatible with extensions service workers

mahdiyari commented 1 year ago

The reason for not merging this PR is to keep the library compatible out of the box with other frameworks like Nativescript. I remember fetch not working there. Axios is more compatible in my experience than fetch.

We can probably look for other alternatives.

mahdiyari commented 1 year ago

You can now add custom adapters to axios through a config option. This makes it possible to use fetch. Updated readme with the following example:

You can define a different adapter if your environment doesn't support 'xhr' or 'http' See https://github.com/haverstack/axios-fetch-adapter Example:

import fetchAdapter from '@haverstack/axios-fetch-adapter'
hiveTx.config.axiosAdapter = fetchAdapter