koilib 2.6.0 → 2.6.1

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/koinos.js CHANGED
@@ -2887,567 +2887,6 @@ utf8.write = function utf8_write(string, buffer, offset) {
2887
2887
  };
2888
2888
 
2889
2889
 
2890
- /***/ }),
2891
-
2892
- /***/ 4098:
2893
- /***/ (function(module, exports) {
2894
-
2895
- var global = typeof self !== 'undefined' ? self : this;
2896
- var __self__ = (function () {
2897
- function F() {
2898
- this.fetch = false;
2899
- this.DOMException = global.DOMException
2900
- }
2901
- F.prototype = global;
2902
- return new F();
2903
- })();
2904
- (function(self) {
2905
-
2906
- var irrelevant = (function (exports) {
2907
-
2908
- var support = {
2909
- searchParams: 'URLSearchParams' in self,
2910
- iterable: 'Symbol' in self && 'iterator' in Symbol,
2911
- blob:
2912
- 'FileReader' in self &&
2913
- 'Blob' in self &&
2914
- (function() {
2915
- try {
2916
- new Blob();
2917
- return true
2918
- } catch (e) {
2919
- return false
2920
- }
2921
- })(),
2922
- formData: 'FormData' in self,
2923
- arrayBuffer: 'ArrayBuffer' in self
2924
- };
2925
-
2926
- function isDataView(obj) {
2927
- return obj && DataView.prototype.isPrototypeOf(obj)
2928
- }
2929
-
2930
- if (support.arrayBuffer) {
2931
- var viewClasses = [
2932
- '[object Int8Array]',
2933
- '[object Uint8Array]',
2934
- '[object Uint8ClampedArray]',
2935
- '[object Int16Array]',
2936
- '[object Uint16Array]',
2937
- '[object Int32Array]',
2938
- '[object Uint32Array]',
2939
- '[object Float32Array]',
2940
- '[object Float64Array]'
2941
- ];
2942
-
2943
- var isArrayBufferView =
2944
- ArrayBuffer.isView ||
2945
- function(obj) {
2946
- return obj && viewClasses.indexOf(Object.prototype.toString.call(obj)) > -1
2947
- };
2948
- }
2949
-
2950
- function normalizeName(name) {
2951
- if (typeof name !== 'string') {
2952
- name = String(name);
2953
- }
2954
- if (/[^a-z0-9\-#$%&'*+.^_`|~]/i.test(name)) {
2955
- throw new TypeError('Invalid character in header field name')
2956
- }
2957
- return name.toLowerCase()
2958
- }
2959
-
2960
- function normalizeValue(value) {
2961
- if (typeof value !== 'string') {
2962
- value = String(value);
2963
- }
2964
- return value
2965
- }
2966
-
2967
- // Build a destructive iterator for the value list
2968
- function iteratorFor(items) {
2969
- var iterator = {
2970
- next: function() {
2971
- var value = items.shift();
2972
- return {done: value === undefined, value: value}
2973
- }
2974
- };
2975
-
2976
- if (support.iterable) {
2977
- iterator[Symbol.iterator] = function() {
2978
- return iterator
2979
- };
2980
- }
2981
-
2982
- return iterator
2983
- }
2984
-
2985
- function Headers(headers) {
2986
- this.map = {};
2987
-
2988
- if (headers instanceof Headers) {
2989
- headers.forEach(function(value, name) {
2990
- this.append(name, value);
2991
- }, this);
2992
- } else if (Array.isArray(headers)) {
2993
- headers.forEach(function(header) {
2994
- this.append(header[0], header[1]);
2995
- }, this);
2996
- } else if (headers) {
2997
- Object.getOwnPropertyNames(headers).forEach(function(name) {
2998
- this.append(name, headers[name]);
2999
- }, this);
3000
- }
3001
- }
3002
-
3003
- Headers.prototype.append = function(name, value) {
3004
- name = normalizeName(name);
3005
- value = normalizeValue(value);
3006
- var oldValue = this.map[name];
3007
- this.map[name] = oldValue ? oldValue + ', ' + value : value;
3008
- };
3009
-
3010
- Headers.prototype['delete'] = function(name) {
3011
- delete this.map[normalizeName(name)];
3012
- };
3013
-
3014
- Headers.prototype.get = function(name) {
3015
- name = normalizeName(name);
3016
- return this.has(name) ? this.map[name] : null
3017
- };
3018
-
3019
- Headers.prototype.has = function(name) {
3020
- return this.map.hasOwnProperty(normalizeName(name))
3021
- };
3022
-
3023
- Headers.prototype.set = function(name, value) {
3024
- this.map[normalizeName(name)] = normalizeValue(value);
3025
- };
3026
-
3027
- Headers.prototype.forEach = function(callback, thisArg) {
3028
- for (var name in this.map) {
3029
- if (this.map.hasOwnProperty(name)) {
3030
- callback.call(thisArg, this.map[name], name, this);
3031
- }
3032
- }
3033
- };
3034
-
3035
- Headers.prototype.keys = function() {
3036
- var items = [];
3037
- this.forEach(function(value, name) {
3038
- items.push(name);
3039
- });
3040
- return iteratorFor(items)
3041
- };
3042
-
3043
- Headers.prototype.values = function() {
3044
- var items = [];
3045
- this.forEach(function(value) {
3046
- items.push(value);
3047
- });
3048
- return iteratorFor(items)
3049
- };
3050
-
3051
- Headers.prototype.entries = function() {
3052
- var items = [];
3053
- this.forEach(function(value, name) {
3054
- items.push([name, value]);
3055
- });
3056
- return iteratorFor(items)
3057
- };
3058
-
3059
- if (support.iterable) {
3060
- Headers.prototype[Symbol.iterator] = Headers.prototype.entries;
3061
- }
3062
-
3063
- function consumed(body) {
3064
- if (body.bodyUsed) {
3065
- return Promise.reject(new TypeError('Already read'))
3066
- }
3067
- body.bodyUsed = true;
3068
- }
3069
-
3070
- function fileReaderReady(reader) {
3071
- return new Promise(function(resolve, reject) {
3072
- reader.onload = function() {
3073
- resolve(reader.result);
3074
- };
3075
- reader.onerror = function() {
3076
- reject(reader.error);
3077
- };
3078
- })
3079
- }
3080
-
3081
- function readBlobAsArrayBuffer(blob) {
3082
- var reader = new FileReader();
3083
- var promise = fileReaderReady(reader);
3084
- reader.readAsArrayBuffer(blob);
3085
- return promise
3086
- }
3087
-
3088
- function readBlobAsText(blob) {
3089
- var reader = new FileReader();
3090
- var promise = fileReaderReady(reader);
3091
- reader.readAsText(blob);
3092
- return promise
3093
- }
3094
-
3095
- function readArrayBufferAsText(buf) {
3096
- var view = new Uint8Array(buf);
3097
- var chars = new Array(view.length);
3098
-
3099
- for (var i = 0; i < view.length; i++) {
3100
- chars[i] = String.fromCharCode(view[i]);
3101
- }
3102
- return chars.join('')
3103
- }
3104
-
3105
- function bufferClone(buf) {
3106
- if (buf.slice) {
3107
- return buf.slice(0)
3108
- } else {
3109
- var view = new Uint8Array(buf.byteLength);
3110
- view.set(new Uint8Array(buf));
3111
- return view.buffer
3112
- }
3113
- }
3114
-
3115
- function Body() {
3116
- this.bodyUsed = false;
3117
-
3118
- this._initBody = function(body) {
3119
- this._bodyInit = body;
3120
- if (!body) {
3121
- this._bodyText = '';
3122
- } else if (typeof body === 'string') {
3123
- this._bodyText = body;
3124
- } else if (support.blob && Blob.prototype.isPrototypeOf(body)) {
3125
- this._bodyBlob = body;
3126
- } else if (support.formData && FormData.prototype.isPrototypeOf(body)) {
3127
- this._bodyFormData = body;
3128
- } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
3129
- this._bodyText = body.toString();
3130
- } else if (support.arrayBuffer && support.blob && isDataView(body)) {
3131
- this._bodyArrayBuffer = bufferClone(body.buffer);
3132
- // IE 10-11 can't handle a DataView body.
3133
- this._bodyInit = new Blob([this._bodyArrayBuffer]);
3134
- } else if (support.arrayBuffer && (ArrayBuffer.prototype.isPrototypeOf(body) || isArrayBufferView(body))) {
3135
- this._bodyArrayBuffer = bufferClone(body);
3136
- } else {
3137
- this._bodyText = body = Object.prototype.toString.call(body);
3138
- }
3139
-
3140
- if (!this.headers.get('content-type')) {
3141
- if (typeof body === 'string') {
3142
- this.headers.set('content-type', 'text/plain;charset=UTF-8');
3143
- } else if (this._bodyBlob && this._bodyBlob.type) {
3144
- this.headers.set('content-type', this._bodyBlob.type);
3145
- } else if (support.searchParams && URLSearchParams.prototype.isPrototypeOf(body)) {
3146
- this.headers.set('content-type', 'application/x-www-form-urlencoded;charset=UTF-8');
3147
- }
3148
- }
3149
- };
3150
-
3151
- if (support.blob) {
3152
- this.blob = function() {
3153
- var rejected = consumed(this);
3154
- if (rejected) {
3155
- return rejected
3156
- }
3157
-
3158
- if (this._bodyBlob) {
3159
- return Promise.resolve(this._bodyBlob)
3160
- } else if (this._bodyArrayBuffer) {
3161
- return Promise.resolve(new Blob([this._bodyArrayBuffer]))
3162
- } else if (this._bodyFormData) {
3163
- throw new Error('could not read FormData body as blob')
3164
- } else {
3165
- return Promise.resolve(new Blob([this._bodyText]))
3166
- }
3167
- };
3168
-
3169
- this.arrayBuffer = function() {
3170
- if (this._bodyArrayBuffer) {
3171
- return consumed(this) || Promise.resolve(this._bodyArrayBuffer)
3172
- } else {
3173
- return this.blob().then(readBlobAsArrayBuffer)
3174
- }
3175
- };
3176
- }
3177
-
3178
- this.text = function() {
3179
- var rejected = consumed(this);
3180
- if (rejected) {
3181
- return rejected
3182
- }
3183
-
3184
- if (this._bodyBlob) {
3185
- return readBlobAsText(this._bodyBlob)
3186
- } else if (this._bodyArrayBuffer) {
3187
- return Promise.resolve(readArrayBufferAsText(this._bodyArrayBuffer))
3188
- } else if (this._bodyFormData) {
3189
- throw new Error('could not read FormData body as text')
3190
- } else {
3191
- return Promise.resolve(this._bodyText)
3192
- }
3193
- };
3194
-
3195
- if (support.formData) {
3196
- this.formData = function() {
3197
- return this.text().then(decode)
3198
- };
3199
- }
3200
-
3201
- this.json = function() {
3202
- return this.text().then(JSON.parse)
3203
- };
3204
-
3205
- return this
3206
- }
3207
-
3208
- // HTTP methods whose capitalization should be normalized
3209
- var methods = ['DELETE', 'GET', 'HEAD', 'OPTIONS', 'POST', 'PUT'];
3210
-
3211
- function normalizeMethod(method) {
3212
- var upcased = method.toUpperCase();
3213
- return methods.indexOf(upcased) > -1 ? upcased : method
3214
- }
3215
-
3216
- function Request(input, options) {
3217
- options = options || {};
3218
- var body = options.body;
3219
-
3220
- if (input instanceof Request) {
3221
- if (input.bodyUsed) {
3222
- throw new TypeError('Already read')
3223
- }
3224
- this.url = input.url;
3225
- this.credentials = input.credentials;
3226
- if (!options.headers) {
3227
- this.headers = new Headers(input.headers);
3228
- }
3229
- this.method = input.method;
3230
- this.mode = input.mode;
3231
- this.signal = input.signal;
3232
- if (!body && input._bodyInit != null) {
3233
- body = input._bodyInit;
3234
- input.bodyUsed = true;
3235
- }
3236
- } else {
3237
- this.url = String(input);
3238
- }
3239
-
3240
- this.credentials = options.credentials || this.credentials || 'same-origin';
3241
- if (options.headers || !this.headers) {
3242
- this.headers = new Headers(options.headers);
3243
- }
3244
- this.method = normalizeMethod(options.method || this.method || 'GET');
3245
- this.mode = options.mode || this.mode || null;
3246
- this.signal = options.signal || this.signal;
3247
- this.referrer = null;
3248
-
3249
- if ((this.method === 'GET' || this.method === 'HEAD') && body) {
3250
- throw new TypeError('Body not allowed for GET or HEAD requests')
3251
- }
3252
- this._initBody(body);
3253
- }
3254
-
3255
- Request.prototype.clone = function() {
3256
- return new Request(this, {body: this._bodyInit})
3257
- };
3258
-
3259
- function decode(body) {
3260
- var form = new FormData();
3261
- body
3262
- .trim()
3263
- .split('&')
3264
- .forEach(function(bytes) {
3265
- if (bytes) {
3266
- var split = bytes.split('=');
3267
- var name = split.shift().replace(/\+/g, ' ');
3268
- var value = split.join('=').replace(/\+/g, ' ');
3269
- form.append(decodeURIComponent(name), decodeURIComponent(value));
3270
- }
3271
- });
3272
- return form
3273
- }
3274
-
3275
- function parseHeaders(rawHeaders) {
3276
- var headers = new Headers();
3277
- // Replace instances of \r\n and \n followed by at least one space or horizontal tab with a space
3278
- // https://tools.ietf.org/html/rfc7230#section-3.2
3279
- var preProcessedHeaders = rawHeaders.replace(/\r?\n[\t ]+/g, ' ');
3280
- preProcessedHeaders.split(/\r?\n/).forEach(function(line) {
3281
- var parts = line.split(':');
3282
- var key = parts.shift().trim();
3283
- if (key) {
3284
- var value = parts.join(':').trim();
3285
- headers.append(key, value);
3286
- }
3287
- });
3288
- return headers
3289
- }
3290
-
3291
- Body.call(Request.prototype);
3292
-
3293
- function Response(bodyInit, options) {
3294
- if (!options) {
3295
- options = {};
3296
- }
3297
-
3298
- this.type = 'default';
3299
- this.status = options.status === undefined ? 200 : options.status;
3300
- this.ok = this.status >= 200 && this.status < 300;
3301
- this.statusText = 'statusText' in options ? options.statusText : 'OK';
3302
- this.headers = new Headers(options.headers);
3303
- this.url = options.url || '';
3304
- this._initBody(bodyInit);
3305
- }
3306
-
3307
- Body.call(Response.prototype);
3308
-
3309
- Response.prototype.clone = function() {
3310
- return new Response(this._bodyInit, {
3311
- status: this.status,
3312
- statusText: this.statusText,
3313
- headers: new Headers(this.headers),
3314
- url: this.url
3315
- })
3316
- };
3317
-
3318
- Response.error = function() {
3319
- var response = new Response(null, {status: 0, statusText: ''});
3320
- response.type = 'error';
3321
- return response
3322
- };
3323
-
3324
- var redirectStatuses = [301, 302, 303, 307, 308];
3325
-
3326
- Response.redirect = function(url, status) {
3327
- if (redirectStatuses.indexOf(status) === -1) {
3328
- throw new RangeError('Invalid status code')
3329
- }
3330
-
3331
- return new Response(null, {status: status, headers: {location: url}})
3332
- };
3333
-
3334
- exports.DOMException = self.DOMException;
3335
- try {
3336
- new exports.DOMException();
3337
- } catch (err) {
3338
- exports.DOMException = function(message, name) {
3339
- this.message = message;
3340
- this.name = name;
3341
- var error = Error(message);
3342
- this.stack = error.stack;
3343
- };
3344
- exports.DOMException.prototype = Object.create(Error.prototype);
3345
- exports.DOMException.prototype.constructor = exports.DOMException;
3346
- }
3347
-
3348
- function fetch(input, init) {
3349
- return new Promise(function(resolve, reject) {
3350
- var request = new Request(input, init);
3351
-
3352
- if (request.signal && request.signal.aborted) {
3353
- return reject(new exports.DOMException('Aborted', 'AbortError'))
3354
- }
3355
-
3356
- var xhr = new XMLHttpRequest();
3357
-
3358
- function abortXhr() {
3359
- xhr.abort();
3360
- }
3361
-
3362
- xhr.onload = function() {
3363
- var options = {
3364
- status: xhr.status,
3365
- statusText: xhr.statusText,
3366
- headers: parseHeaders(xhr.getAllResponseHeaders() || '')
3367
- };
3368
- options.url = 'responseURL' in xhr ? xhr.responseURL : options.headers.get('X-Request-URL');
3369
- var body = 'response' in xhr ? xhr.response : xhr.responseText;
3370
- resolve(new Response(body, options));
3371
- };
3372
-
3373
- xhr.onerror = function() {
3374
- reject(new TypeError('Network request failed'));
3375
- };
3376
-
3377
- xhr.ontimeout = function() {
3378
- reject(new TypeError('Network request failed'));
3379
- };
3380
-
3381
- xhr.onabort = function() {
3382
- reject(new exports.DOMException('Aborted', 'AbortError'));
3383
- };
3384
-
3385
- xhr.open(request.method, request.url, true);
3386
-
3387
- if (request.credentials === 'include') {
3388
- xhr.withCredentials = true;
3389
- } else if (request.credentials === 'omit') {
3390
- xhr.withCredentials = false;
3391
- }
3392
-
3393
- if ('responseType' in xhr && support.blob) {
3394
- xhr.responseType = 'blob';
3395
- }
3396
-
3397
- request.headers.forEach(function(value, name) {
3398
- xhr.setRequestHeader(name, value);
3399
- });
3400
-
3401
- if (request.signal) {
3402
- request.signal.addEventListener('abort', abortXhr);
3403
-
3404
- xhr.onreadystatechange = function() {
3405
- // DONE (success or failure)
3406
- if (xhr.readyState === 4) {
3407
- request.signal.removeEventListener('abort', abortXhr);
3408
- }
3409
- };
3410
- }
3411
-
3412
- xhr.send(typeof request._bodyInit === 'undefined' ? null : request._bodyInit);
3413
- })
3414
- }
3415
-
3416
- fetch.polyfill = true;
3417
-
3418
- if (!self.fetch) {
3419
- self.fetch = fetch;
3420
- self.Headers = Headers;
3421
- self.Request = Request;
3422
- self.Response = Response;
3423
- }
3424
-
3425
- exports.Headers = Headers;
3426
- exports.Request = Request;
3427
- exports.Response = Response;
3428
- exports.fetch = fetch;
3429
-
3430
- Object.defineProperty(exports, '__esModule', { value: true });
3431
-
3432
- return exports;
3433
-
3434
- }({}));
3435
- })(__self__);
3436
- __self__.fetch.ponyfill = true;
3437
- // Remove "polyfill" property added by whatwg-fetch
3438
- delete __self__.fetch.polyfill;
3439
- // Choose between native implementation (global) or custom implementation (__self__)
3440
- // var ctx = global.fetch ? global : __self__;
3441
- var ctx = __self__; // this line disable service worker support temporarily
3442
- exports = ctx.fetch // To enable: import fetch from 'cross-fetch'
3443
- exports["default"] = ctx.fetch // For TypeScript consumers without esModuleInterop.
3444
- exports.fetch = ctx.fetch // To enable: import {fetch} from 'cross-fetch'
3445
- exports.Headers = ctx.Headers
3446
- exports.Request = ctx.Request
3447
- exports.Response = ctx.Response
3448
- module.exports = exports
3449
-
3450
-
3451
2890
  /***/ }),
3452
2891
 
3453
2892
  /***/ 556:
@@ -10616,16 +10055,12 @@ exports["default"] = Contract;
10616
10055
  /***/ }),
10617
10056
 
10618
10057
  /***/ 5635:
10619
- /***/ (function(__unused_webpack_module, exports, __webpack_require__) {
10058
+ /***/ ((__unused_webpack_module, exports) => {
10620
10059
 
10621
10060
  "use strict";
10622
10061
 
10623
- var __importDefault = (this && this.__importDefault) || function (mod) {
10624
- return (mod && mod.__esModule) ? mod : { "default": mod };
10625
- };
10626
10062
  Object.defineProperty(exports, "__esModule", ({ value: true }));
10627
10063
  exports.Provider = void 0;
10628
- const cross_fetch_1 = __importDefault(__webpack_require__(4098));
10629
10064
  async function sleep(ms) {
10630
10065
  return new Promise((r) => setTimeout(r, ms));
10631
10066
  }
@@ -10671,7 +10106,7 @@ class Provider {
10671
10106
  params,
10672
10107
  };
10673
10108
  const url = this.rpcNodes[this.currentNodeId];
10674
- const response = await (0, cross_fetch_1.default)(url, {
10109
+ const response = await fetch(url, {
10675
10110
  method: "POST",
10676
10111
  body: JSON.stringify(data),
10677
10112
  });