@meshsdk/bitcoin 1.9.0-beta.86 → 1.9.0-beta.89
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +96 -59
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +96 -59
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -1272,7 +1272,7 @@ var InterceptorManager = /*#__PURE__*/ function() {
|
|
|
1272
1272
|
*
|
|
1273
1273
|
* @param {Number} id The ID that was returned by `use`
|
|
1274
1274
|
*
|
|
1275
|
-
* @returns {
|
|
1275
|
+
* @returns {void}
|
|
1276
1276
|
*/ key: "eject",
|
|
1277
1277
|
value: function eject(id) {
|
|
1278
1278
|
if (this.handlers[id]) {
|
|
@@ -2124,22 +2124,35 @@ var isURLSameOrigin_default = platform_default.hasStandardBrowserEnv ? /* @__PUR
|
|
|
2124
2124
|
// ../../node_modules/axios/lib/helpers/cookies.js
|
|
2125
2125
|
var cookies_default = platform_default.hasStandardBrowserEnv ? // Standard browser envs support document.cookie
|
|
2126
2126
|
{
|
|
2127
|
-
write: function write(name, value, expires, path, domain, secure) {
|
|
2127
|
+
write: function write(name, value, expires, path, domain, secure, sameSite) {
|
|
2128
|
+
if (typeof document === "undefined") return;
|
|
2128
2129
|
var cookie = [
|
|
2129
|
-
name
|
|
2130
|
+
"".concat(name, "=").concat(encodeURIComponent(value))
|
|
2130
2131
|
];
|
|
2131
|
-
utils_default.isNumber(expires)
|
|
2132
|
-
|
|
2133
|
-
|
|
2134
|
-
|
|
2132
|
+
if (utils_default.isNumber(expires)) {
|
|
2133
|
+
cookie.push("expires=".concat(new Date(expires).toUTCString()));
|
|
2134
|
+
}
|
|
2135
|
+
if (utils_default.isString(path)) {
|
|
2136
|
+
cookie.push("path=".concat(path));
|
|
2137
|
+
}
|
|
2138
|
+
if (utils_default.isString(domain)) {
|
|
2139
|
+
cookie.push("domain=".concat(domain));
|
|
2140
|
+
}
|
|
2141
|
+
if (secure === true) {
|
|
2142
|
+
cookie.push("secure");
|
|
2143
|
+
}
|
|
2144
|
+
if (utils_default.isString(sameSite)) {
|
|
2145
|
+
cookie.push("SameSite=".concat(sameSite));
|
|
2146
|
+
}
|
|
2135
2147
|
document.cookie = cookie.join("; ");
|
|
2136
2148
|
},
|
|
2137
2149
|
read: function read(name) {
|
|
2138
|
-
|
|
2139
|
-
|
|
2150
|
+
if (typeof document === "undefined") return null;
|
|
2151
|
+
var match = document.cookie.match(new RegExp("(?:^|; )" + name + "=([^;]*)"));
|
|
2152
|
+
return match ? decodeURIComponent(match[1]) : null;
|
|
2140
2153
|
},
|
|
2141
2154
|
remove: function remove(name) {
|
|
2142
|
-
this.write(name, "", Date.now() - 864e5);
|
|
2155
|
+
this.write(name, "", Date.now() - 864e5, "/");
|
|
2143
2156
|
}
|
|
2144
2157
|
} : // Non-standard browser env (web workers, react-native) lack needed support.
|
|
2145
2158
|
{
|
|
@@ -3048,7 +3061,7 @@ var factory = function(env) {
|
|
|
3048
3061
|
};
|
|
3049
3062
|
var seedCache = /* @__PURE__ */ new Map();
|
|
3050
3063
|
var getFetch = function(config) {
|
|
3051
|
-
var env = config
|
|
3064
|
+
var env = config && config.env || {};
|
|
3052
3065
|
var fetch2 = env.fetch, Request = env.Request, Response = env.Response;
|
|
3053
3066
|
var seeds = [
|
|
3054
3067
|
Request,
|
|
@@ -3091,41 +3104,48 @@ var renderReason = function(reason) {
|
|
|
3091
3104
|
var isResolvedHandle = function(adapter2) {
|
|
3092
3105
|
return utils_default.isFunction(adapter2) || adapter2 === null || adapter2 === false;
|
|
3093
3106
|
};
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
adapters
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
|
|
3102
|
-
|
|
3103
|
-
|
|
3104
|
-
|
|
3105
|
-
|
|
3106
|
-
|
|
3107
|
-
|
|
3108
|
-
|
|
3109
|
-
|
|
3110
|
-
throw new AxiosError_default("Unknown adapter '".concat(id, "'"));
|
|
3111
|
-
}
|
|
3112
|
-
}
|
|
3113
|
-
if (adapter2 && (utils_default.isFunction(adapter2) || (adapter2 = adapter2.get(config)))) {
|
|
3114
|
-
break;
|
|
3107
|
+
function getAdapter(adapters, config) {
|
|
3108
|
+
adapters = utils_default.isArray(adapters) ? adapters : [
|
|
3109
|
+
adapters
|
|
3110
|
+
];
|
|
3111
|
+
var length = adapters.length;
|
|
3112
|
+
var nameOrAdapter;
|
|
3113
|
+
var adapter2;
|
|
3114
|
+
var rejectedReasons = {};
|
|
3115
|
+
for(var i = 0; i < length; i++){
|
|
3116
|
+
nameOrAdapter = adapters[i];
|
|
3117
|
+
var id = void 0;
|
|
3118
|
+
adapter2 = nameOrAdapter;
|
|
3119
|
+
if (!isResolvedHandle(nameOrAdapter)) {
|
|
3120
|
+
adapter2 = knownAdapters[(id = String(nameOrAdapter)).toLowerCase()];
|
|
3121
|
+
if (adapter2 === void 0) {
|
|
3122
|
+
throw new AxiosError_default("Unknown adapter '".concat(id, "'"));
|
|
3115
3123
|
}
|
|
3116
|
-
rejectedReasons[id || "#" + i] = adapter2;
|
|
3117
3124
|
}
|
|
3118
|
-
if (
|
|
3119
|
-
|
|
3120
|
-
var _param = _sliced_to_array(param, 2), id = _param[0], state = _param[1];
|
|
3121
|
-
return "adapter ".concat(id, " ") + (state === false ? "is not supported by the environment" : "is not available in the build");
|
|
3122
|
-
});
|
|
3123
|
-
var s = length ? reasons.length > 1 ? "since :\n" + reasons.map(renderReason).join("\n") : " " + renderReason(reasons[0]) : "as no adapter specified";
|
|
3124
|
-
throw new AxiosError_default("There is no suitable adapter to dispatch the request " + s, "ERR_NOT_SUPPORT");
|
|
3125
|
+
if (adapter2 && (utils_default.isFunction(adapter2) || (adapter2 = adapter2.get(config)))) {
|
|
3126
|
+
break;
|
|
3125
3127
|
}
|
|
3126
|
-
|
|
3127
|
-
}
|
|
3128
|
-
|
|
3128
|
+
rejectedReasons[id || "#" + i] = adapter2;
|
|
3129
|
+
}
|
|
3130
|
+
if (!adapter2) {
|
|
3131
|
+
var reasons = Object.entries(rejectedReasons).map(function(param) {
|
|
3132
|
+
var _param = _sliced_to_array(param, 2), id = _param[0], state = _param[1];
|
|
3133
|
+
return "adapter ".concat(id, " ") + (state === false ? "is not supported by the environment" : "is not available in the build");
|
|
3134
|
+
});
|
|
3135
|
+
var s = length ? reasons.length > 1 ? "since :\n" + reasons.map(renderReason).join("\n") : " " + renderReason(reasons[0]) : "as no adapter specified";
|
|
3136
|
+
throw new AxiosError_default("There is no suitable adapter to dispatch the request " + s, "ERR_NOT_SUPPORT");
|
|
3137
|
+
}
|
|
3138
|
+
return adapter2;
|
|
3139
|
+
}
|
|
3140
|
+
var adapters_default = {
|
|
3141
|
+
/**
|
|
3142
|
+
* Resolve an adapter from a list of adapter names or functions.
|
|
3143
|
+
* @type {Function}
|
|
3144
|
+
*/ getAdapter: getAdapter,
|
|
3145
|
+
/**
|
|
3146
|
+
* Exposes all known adapters
|
|
3147
|
+
* @type {Object<string, Function|Object>}
|
|
3148
|
+
*/ adapters: knownAdapters
|
|
3129
3149
|
};
|
|
3130
3150
|
// ../../node_modules/axios/lib/core/dispatchRequest.js
|
|
3131
3151
|
function throwIfCancellationRequested(config) {
|
|
@@ -3165,7 +3185,7 @@ function dispatchRequest(config) {
|
|
|
3165
3185
|
});
|
|
3166
3186
|
}
|
|
3167
3187
|
// ../../node_modules/axios/lib/env/data.js
|
|
3168
|
-
var VERSION = "1.
|
|
3188
|
+
var VERSION = "1.13.2";
|
|
3169
3189
|
// ../../node_modules/axios/lib/helpers/validator.js
|
|
3170
3190
|
var validators = {};
|
|
3171
3191
|
[
|
|
@@ -3641,7 +3661,13 @@ var HttpStatusCode = {
|
|
|
3641
3661
|
InsufficientStorage: 507,
|
|
3642
3662
|
LoopDetected: 508,
|
|
3643
3663
|
NotExtended: 510,
|
|
3644
|
-
NetworkAuthenticationRequired: 511
|
|
3664
|
+
NetworkAuthenticationRequired: 511,
|
|
3665
|
+
WebServerIsDown: 521,
|
|
3666
|
+
ConnectionTimedOut: 522,
|
|
3667
|
+
OriginIsUnreachable: 523,
|
|
3668
|
+
TimeoutOccurred: 524,
|
|
3669
|
+
SslHandshakeFailed: 525,
|
|
3670
|
+
InvalidSslCertificate: 526
|
|
3645
3671
|
};
|
|
3646
3672
|
Object.entries(HttpStatusCode).forEach(function(param) {
|
|
3647
3673
|
var _param = _sliced_to_array(param, 2), key = _param[0], value = _param[1];
|
|
@@ -3687,7 +3713,7 @@ axios.HttpStatusCode = HttpStatusCode_default;
|
|
|
3687
3713
|
axios.default = axios;
|
|
3688
3714
|
var axios_default = axios;
|
|
3689
3715
|
// ../../node_modules/axios/index.js
|
|
3690
|
-
var Axios2 = axios_default.Axios, AxiosError2 = axios_default.AxiosError, CanceledError2 = axios_default.CanceledError, isCancel2 = axios_default.isCancel, CancelToken2 = axios_default.CancelToken, VERSION2 = axios_default.VERSION, all2 = axios_default.all, Cancel = axios_default.Cancel, isAxiosError2 = axios_default.isAxiosError, spread2 = axios_default.spread, toFormData2 = axios_default.toFormData, AxiosHeaders2 = axios_default.AxiosHeaders, HttpStatusCode2 = axios_default.HttpStatusCode, formToJSON = axios_default.formToJSON,
|
|
3716
|
+
var Axios2 = axios_default.Axios, AxiosError2 = axios_default.AxiosError, CanceledError2 = axios_default.CanceledError, isCancel2 = axios_default.isCancel, CancelToken2 = axios_default.CancelToken, VERSION2 = axios_default.VERSION, all2 = axios_default.all, Cancel = axios_default.Cancel, isAxiosError2 = axios_default.isAxiosError, spread2 = axios_default.spread, toFormData2 = axios_default.toFormData, AxiosHeaders2 = axios_default.AxiosHeaders, HttpStatusCode2 = axios_default.HttpStatusCode, formToJSON = axios_default.formToJSON, getAdapter2 = axios_default.getAdapter, mergeConfig2 = axios_default.mergeConfig;
|
|
3691
3717
|
// src/providers/common.ts
|
|
3692
3718
|
var parseHttpError = function(error) {
|
|
3693
3719
|
if (!axios_default.isAxiosError(error)) {
|
|
@@ -4372,11 +4398,7 @@ var MaestroProvider = /*#__PURE__*/ function() {
|
|
|
4372
4398
|
]);
|
|
4373
4399
|
return [
|
|
4374
4400
|
4,
|
|
4375
|
-
this._axiosInstance.post("/esplora/tx", txHex
|
|
4376
|
-
headers: {
|
|
4377
|
-
"Content-Type": "application/json"
|
|
4378
|
-
}
|
|
4379
|
-
})
|
|
4401
|
+
this._axiosInstance.post("/esplora/tx", txHex)
|
|
4380
4402
|
];
|
|
4381
4403
|
case 1:
|
|
4382
4404
|
_ref = _state.sent(), data = _ref.data, status = _ref.status;
|
|
@@ -4402,11 +4424,11 @@ var MaestroProvider = /*#__PURE__*/ function() {
|
|
|
4402
4424
|
value: /**
|
|
4403
4425
|
* Get fee estimates for Bitcoin transactions.
|
|
4404
4426
|
* @param blocks - The number of blocks to estimate fees for (default: 6).
|
|
4405
|
-
* @returns
|
|
4427
|
+
* @returns The estimated fee rate in satoshis per vByte.
|
|
4406
4428
|
*/ function fetchFeeEstimates() {
|
|
4407
4429
|
var blocks = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : 6;
|
|
4408
4430
|
return _async_to_generator(function() {
|
|
4409
|
-
var _ref, data, status, error;
|
|
4431
|
+
var _ref, data, status, feeRateInBtc, error;
|
|
4410
4432
|
return _ts_generator(this, function(_state) {
|
|
4411
4433
|
switch(_state.label){
|
|
4412
4434
|
case 0:
|
|
@@ -4422,10 +4444,23 @@ var MaestroProvider = /*#__PURE__*/ function() {
|
|
|
4422
4444
|
];
|
|
4423
4445
|
case 1:
|
|
4424
4446
|
_ref = _state.sent(), data = _ref.data, status = _ref.status;
|
|
4425
|
-
if (status === 200)
|
|
4426
|
-
|
|
4427
|
-
|
|
4428
|
-
|
|
4447
|
+
if (status === 200) {
|
|
4448
|
+
feeRateInBtc = data.data.feerate;
|
|
4449
|
+
if (feeRateInBtc === 0) {
|
|
4450
|
+
if (this._network === "testnet") {
|
|
4451
|
+
return [
|
|
4452
|
+
2,
|
|
4453
|
+
1
|
|
4454
|
+
];
|
|
4455
|
+
} else {
|
|
4456
|
+
throw new Error("Fee estimation unavailable for mainnet");
|
|
4457
|
+
}
|
|
4458
|
+
}
|
|
4459
|
+
return [
|
|
4460
|
+
2,
|
|
4461
|
+
feeRateInBtc * 1e8
|
|
4462
|
+
];
|
|
4463
|
+
}
|
|
4429
4464
|
throw parseHttpError(data);
|
|
4430
4465
|
case 2:
|
|
4431
4466
|
error = _state.sent();
|
|
@@ -5059,8 +5094,10 @@ var EmbeddedWallet = /*#__PURE__*/ function() {
|
|
|
5059
5094
|
break;
|
|
5060
5095
|
}
|
|
5061
5096
|
if (options.key.type === "mnemonic") {
|
|
5097
|
+
var coinType = this._network === bitcoin.networks.bitcoin ? 0 : 1;
|
|
5098
|
+
var defaultPath = "m/84'/".concat(coinType, "'/0'/0/0");
|
|
5062
5099
|
var _options_path;
|
|
5063
|
-
this._wallet = _derive(options.key.words, (_options_path = options.path) !== null && _options_path !== void 0 ? _options_path :
|
|
5100
|
+
this._wallet = _derive(options.key.words, (_options_path = options.path) !== null && _options_path !== void 0 ? _options_path : defaultPath, this._network);
|
|
5064
5101
|
this._isReadOnly = false;
|
|
5065
5102
|
} else {
|
|
5066
5103
|
this._address = options.key.address;
|
|
@@ -5594,7 +5631,7 @@ var EmbeddedWallet = /*#__PURE__*/ function() {
|
|
|
5594
5631
|
return _ts_generator(this, function(_state) {
|
|
5595
5632
|
switch(_state.label){
|
|
5596
5633
|
case 0:
|
|
5597
|
-
feeRate =
|
|
5634
|
+
feeRate = 2;
|
|
5598
5635
|
if (!this._provider) return [
|
|
5599
5636
|
3,
|
|
5600
5637
|
4
|