nano-wallet-js-test-1
Version:
SDK for developers to create and interact with Nanocurrency wallet easily
23 lines (22 loc) • 833 B
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.fetchWithTimeout = exports.TunedBigNumber = void 0;
const bignumber_js_1 = __importDefault(require("bignumber.js"));
exports.TunedBigNumber = bignumber_js_1.default.clone({
EXPONENTIAL_AT: 1e9,
DECIMAL_PLACES: 36,
});
const fetchWithTimeout = async (url, { timeout, ...options }) => {
const controller = new AbortController();
const timeoutId = setTimeout(() => controller.abort(), timeout);
const response = await fetch(url, {
...options,
signal: controller.signal,
});
clearTimeout(timeoutId);
return response;
};
exports.fetchWithTimeout = fetchWithTimeout;