@pooflabs/core 0.0.4 → 0.0.6

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.js CHANGED
@@ -2,8 +2,7 @@
2
2
 
3
3
  var axios = require('axios');
4
4
  var web3_js = require('@solana/web3.js');
5
- var require$$0 = require('buffer');
6
- var require$$0$1 = require('crypto');
5
+ var require$$0 = require('crypto');
7
6
  var anchor = require('@coral-xyz/anchor');
8
7
 
9
8
  function _interopNamespaceDefault(e) {
@@ -203,235 +202,137 @@ class WebSessionManager {
203
202
  }
204
203
  WebSessionManager.TAROBASE_SESSION_STORAGE_KEY = "tarobase_session_storage";
205
204
 
206
- function getDefaultExportFromCjs (x) {
207
- return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
208
- }
209
-
210
- var safeBuffer = {exports: {}};
211
-
212
- /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
213
-
214
- var hasRequiredSafeBuffer;
215
-
216
- function requireSafeBuffer () {
217
- if (hasRequiredSafeBuffer) return safeBuffer.exports;
218
- hasRequiredSafeBuffer = 1;
219
- (function (module, exports$1) {
220
- /* eslint-disable node/no-deprecated-api */
221
- var buffer = require$$0;
222
- var Buffer = buffer.Buffer;
223
-
224
- // alternative to using Object.keys for old browsers
225
- function copyProps (src, dst) {
226
- for (var key in src) {
227
- dst[key] = src[key];
228
- }
229
- }
230
- if (Buffer.from && Buffer.alloc && Buffer.allocUnsafe && Buffer.allocUnsafeSlow) {
231
- module.exports = buffer;
232
- } else {
233
- // Copy properties from require('buffer')
234
- copyProps(buffer, exports$1);
235
- exports$1.Buffer = SafeBuffer;
236
- }
237
-
238
- function SafeBuffer (arg, encodingOrOffset, length) {
239
- return Buffer(arg, encodingOrOffset, length)
240
- }
241
-
242
- SafeBuffer.prototype = Object.create(Buffer.prototype);
243
-
244
- // Copy static methods from Buffer
245
- copyProps(Buffer, SafeBuffer);
246
-
247
- SafeBuffer.from = function (arg, encodingOrOffset, length) {
248
- if (typeof arg === 'number') {
249
- throw new TypeError('Argument must not be a number')
250
- }
251
- return Buffer(arg, encodingOrOffset, length)
252
- };
253
-
254
- SafeBuffer.alloc = function (size, fill, encoding) {
255
- if (typeof size !== 'number') {
256
- throw new TypeError('Argument must be a number')
257
- }
258
- var buf = Buffer(size);
259
- if (fill !== undefined) {
260
- if (typeof encoding === 'string') {
261
- buf.fill(fill, encoding);
262
- } else {
263
- buf.fill(fill);
264
- }
265
- } else {
266
- buf.fill(0);
267
- }
268
- return buf
269
- };
270
-
271
- SafeBuffer.allocUnsafe = function (size) {
272
- if (typeof size !== 'number') {
273
- throw new TypeError('Argument must be a number')
274
- }
275
- return Buffer(size)
276
- };
277
-
278
- SafeBuffer.allocUnsafeSlow = function (size) {
279
- if (typeof size !== 'number') {
280
- throw new TypeError('Argument must be a number')
281
- }
282
- return buffer.SlowBuffer(size)
283
- };
284
- } (safeBuffer, safeBuffer.exports));
285
- return safeBuffer.exports;
286
- }
287
-
288
- var src;
289
- var hasRequiredSrc;
290
-
291
- function requireSrc () {
292
- if (hasRequiredSrc) return src;
293
- hasRequiredSrc = 1;
294
- // base-x encoding / decoding
295
- // Copyright (c) 2018 base-x contributors
296
- // Copyright (c) 2014-2018 The Bitcoin Core developers (base58.cpp)
297
- // Distributed under the MIT software license, see the accompanying
298
- // file LICENSE or http://www.opensource.org/licenses/mit-license.php.
299
- // @ts-ignore
300
- var _Buffer = requireSafeBuffer().Buffer;
301
- function base (ALPHABET) {
302
- if (ALPHABET.length >= 255) { throw new TypeError('Alphabet too long') }
303
- var BASE_MAP = new Uint8Array(256);
304
- for (var j = 0; j < BASE_MAP.length; j++) {
305
- BASE_MAP[j] = 255;
306
- }
307
- for (var i = 0; i < ALPHABET.length; i++) {
308
- var x = ALPHABET.charAt(i);
309
- var xc = x.charCodeAt(0);
310
- if (BASE_MAP[xc] !== 255) { throw new TypeError(x + ' is ambiguous') }
311
- BASE_MAP[xc] = i;
312
- }
313
- var BASE = ALPHABET.length;
314
- var LEADER = ALPHABET.charAt(0);
315
- var FACTOR = Math.log(BASE) / Math.log(256); // log(BASE) / log(256), rounded up
316
- var iFACTOR = Math.log(256) / Math.log(BASE); // log(256) / log(BASE), rounded up
317
- function encode (source) {
318
- if (Array.isArray(source) || source instanceof Uint8Array) { source = _Buffer.from(source); }
319
- if (!_Buffer.isBuffer(source)) { throw new TypeError('Expected Buffer') }
320
- if (source.length === 0) { return '' }
321
- // Skip & count leading zeroes.
322
- var zeroes = 0;
323
- var length = 0;
324
- var pbegin = 0;
325
- var pend = source.length;
326
- while (pbegin !== pend && source[pbegin] === 0) {
327
- pbegin++;
328
- zeroes++;
329
- }
330
- // Allocate enough space in big-endian base58 representation.
331
- var size = ((pend - pbegin) * iFACTOR + 1) >>> 0;
332
- var b58 = new Uint8Array(size);
333
- // Process the bytes.
334
- while (pbegin !== pend) {
335
- var carry = source[pbegin];
336
- // Apply "b58 = b58 * 256 + ch".
337
- var i = 0;
338
- for (var it1 = size - 1; (carry !== 0 || i < length) && (it1 !== -1); it1--, i++) {
339
- carry += (256 * b58[it1]) >>> 0;
340
- b58[it1] = (carry % BASE) >>> 0;
341
- carry = (carry / BASE) >>> 0;
342
- }
343
- if (carry !== 0) { throw new Error('Non-zero carry') }
344
- length = i;
345
- pbegin++;
346
- }
347
- // Skip leading zeroes in base58 result.
348
- var it2 = size - length;
349
- while (it2 !== size && b58[it2] === 0) {
350
- it2++;
351
- }
352
- // Translate the result into a string.
353
- var str = LEADER.repeat(zeroes);
354
- for (; it2 < size; ++it2) { str += ALPHABET.charAt(b58[it2]); }
355
- return str
356
- }
357
- function decodeUnsafe (source) {
358
- if (typeof source !== 'string') { throw new TypeError('Expected String') }
359
- if (source.length === 0) { return _Buffer.alloc(0) }
360
- var psz = 0;
361
- // Skip and count leading '1's.
362
- var zeroes = 0;
363
- var length = 0;
364
- while (source[psz] === LEADER) {
365
- zeroes++;
366
- psz++;
367
- }
368
- // Allocate enough space in big-endian base256 representation.
369
- var size = (((source.length - psz) * FACTOR) + 1) >>> 0; // log(58) / log(256), rounded up.
370
- var b256 = new Uint8Array(size);
371
- // Process the characters.
372
- while (psz < source.length) {
373
- // Find code of next character
374
- var charCode = source.charCodeAt(psz);
375
- // Base map can not be indexed using char code
376
- if (charCode > 255) { return }
377
- // Decode character
378
- var carry = BASE_MAP[charCode];
379
- // Invalid character
380
- if (carry === 255) { return }
381
- var i = 0;
382
- for (var it3 = size - 1; (carry !== 0 || i < length) && (it3 !== -1); it3--, i++) {
383
- carry += (BASE * b256[it3]) >>> 0;
384
- b256[it3] = (carry % 256) >>> 0;
385
- carry = (carry / 256) >>> 0;
386
- }
387
- if (carry !== 0) { throw new Error('Non-zero carry') }
388
- length = i;
389
- psz++;
390
- }
391
- // Skip leading zeroes in b256.
392
- var it4 = size - length;
393
- while (it4 !== size && b256[it4] === 0) {
394
- it4++;
395
- }
396
- var vch = _Buffer.allocUnsafe(zeroes + (size - it4));
397
- vch.fill(0x00, 0, zeroes);
398
- var j = zeroes;
399
- while (it4 !== size) {
400
- vch[j++] = b256[it4++];
401
- }
402
- return vch
403
- }
404
- function decode (string) {
405
- var buffer = decodeUnsafe(string);
406
- if (buffer) { return buffer }
407
- throw new Error('Non-base' + BASE + ' character')
408
- }
409
- return {
410
- encode: encode,
411
- decodeUnsafe: decodeUnsafe,
412
- decode: decode
413
- }
414
- }
415
- src = base;
416
- return src;
205
+ // base-x encoding / decoding
206
+ // Copyright (c) 2018 base-x contributors
207
+ // Copyright (c) 2014-2018 The Bitcoin Core developers (base58.cpp)
208
+ // Distributed under the MIT software license, see the accompanying
209
+ // file LICENSE or http://www.opensource.org/licenses/mit-license.php.
210
+ function base (ALPHABET) {
211
+ if (ALPHABET.length >= 255) { throw new TypeError('Alphabet too long') }
212
+ const BASE_MAP = new Uint8Array(256);
213
+ for (let j = 0; j < BASE_MAP.length; j++) {
214
+ BASE_MAP[j] = 255;
215
+ }
216
+ for (let i = 0; i < ALPHABET.length; i++) {
217
+ const x = ALPHABET.charAt(i);
218
+ const xc = x.charCodeAt(0);
219
+ if (BASE_MAP[xc] !== 255) { throw new TypeError(x + ' is ambiguous') }
220
+ BASE_MAP[xc] = i;
221
+ }
222
+ const BASE = ALPHABET.length;
223
+ const LEADER = ALPHABET.charAt(0);
224
+ const FACTOR = Math.log(BASE) / Math.log(256); // log(BASE) / log(256), rounded up
225
+ const iFACTOR = Math.log(256) / Math.log(BASE); // log(256) / log(BASE), rounded up
226
+ function encode (source) {
227
+ // eslint-disable-next-line no-empty
228
+ if (source instanceof Uint8Array) ; else if (ArrayBuffer.isView(source)) {
229
+ source = new Uint8Array(source.buffer, source.byteOffset, source.byteLength);
230
+ } else if (Array.isArray(source)) {
231
+ source = Uint8Array.from(source);
232
+ }
233
+ if (!(source instanceof Uint8Array)) { throw new TypeError('Expected Uint8Array') }
234
+ if (source.length === 0) { return '' }
235
+ // Skip & count leading zeroes.
236
+ let zeroes = 0;
237
+ let length = 0;
238
+ let pbegin = 0;
239
+ const pend = source.length;
240
+ while (pbegin !== pend && source[pbegin] === 0) {
241
+ pbegin++;
242
+ zeroes++;
243
+ }
244
+ // Allocate enough space in big-endian base58 representation.
245
+ const size = ((pend - pbegin) * iFACTOR + 1) >>> 0;
246
+ const b58 = new Uint8Array(size);
247
+ // Process the bytes.
248
+ while (pbegin !== pend) {
249
+ let carry = source[pbegin];
250
+ // Apply "b58 = b58 * 256 + ch".
251
+ let i = 0;
252
+ for (let it1 = size - 1; (carry !== 0 || i < length) && (it1 !== -1); it1--, i++) {
253
+ carry += (256 * b58[it1]) >>> 0;
254
+ b58[it1] = (carry % BASE) >>> 0;
255
+ carry = (carry / BASE) >>> 0;
256
+ }
257
+ if (carry !== 0) { throw new Error('Non-zero carry') }
258
+ length = i;
259
+ pbegin++;
260
+ }
261
+ // Skip leading zeroes in base58 result.
262
+ let it2 = size - length;
263
+ while (it2 !== size && b58[it2] === 0) {
264
+ it2++;
265
+ }
266
+ // Translate the result into a string.
267
+ let str = LEADER.repeat(zeroes);
268
+ for (; it2 < size; ++it2) { str += ALPHABET.charAt(b58[it2]); }
269
+ return str
270
+ }
271
+ function decodeUnsafe (source) {
272
+ if (typeof source !== 'string') { throw new TypeError('Expected String') }
273
+ if (source.length === 0) { return new Uint8Array() }
274
+ let psz = 0;
275
+ // Skip and count leading '1's.
276
+ let zeroes = 0;
277
+ let length = 0;
278
+ while (source[psz] === LEADER) {
279
+ zeroes++;
280
+ psz++;
281
+ }
282
+ // Allocate enough space in big-endian base256 representation.
283
+ const size = (((source.length - psz) * FACTOR) + 1) >>> 0; // log(58) / log(256), rounded up.
284
+ const b256 = new Uint8Array(size);
285
+ // Process the characters.
286
+ while (psz < source.length) {
287
+ // Find code of next character
288
+ const charCode = source.charCodeAt(psz);
289
+ // Base map can not be indexed using char code
290
+ if (charCode > 255) { return }
291
+ // Decode character
292
+ let carry = BASE_MAP[charCode];
293
+ // Invalid character
294
+ if (carry === 255) { return }
295
+ let i = 0;
296
+ for (let it3 = size - 1; (carry !== 0 || i < length) && (it3 !== -1); it3--, i++) {
297
+ carry += (BASE * b256[it3]) >>> 0;
298
+ b256[it3] = (carry % 256) >>> 0;
299
+ carry = (carry / 256) >>> 0;
300
+ }
301
+ if (carry !== 0) { throw new Error('Non-zero carry') }
302
+ length = i;
303
+ psz++;
304
+ }
305
+ // Skip leading zeroes in b256.
306
+ let it4 = size - length;
307
+ while (it4 !== size && b256[it4] === 0) {
308
+ it4++;
309
+ }
310
+ const vch = new Uint8Array(zeroes + (size - it4));
311
+ let j = zeroes;
312
+ while (it4 !== size) {
313
+ vch[j++] = b256[it4++];
314
+ }
315
+ return vch
316
+ }
317
+ function decode (string) {
318
+ const buffer = decodeUnsafe(string);
319
+ if (buffer) { return buffer }
320
+ throw new Error('Non-base' + BASE + ' character')
321
+ }
322
+ return {
323
+ encode,
324
+ decodeUnsafe,
325
+ decode
326
+ }
417
327
  }
418
328
 
419
- var bs58$1;
420
- var hasRequiredBs58;
421
-
422
- function requireBs58 () {
423
- if (hasRequiredBs58) return bs58$1;
424
- hasRequiredBs58 = 1;
425
- var basex = requireSrc();
426
- var ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
329
+ var ALPHABET = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';
330
+ var bs58 = base(ALPHABET);
427
331
 
428
- bs58$1 = basex(ALPHABET);
429
- return bs58$1;
332
+ function getDefaultExportFromCjs (x) {
333
+ return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
430
334
  }
431
335
 
432
- var bs58Exports = requireBs58();
433
- var bs58 = /*@__PURE__*/getDefaultExportFromCjs(bs58Exports);
434
-
435
336
  function commonjsRequire(path) {
436
337
  throw new Error('Could not dynamically require "' + path + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
437
338
  }
@@ -2822,7 +2723,7 @@ function requireNaclFast () {
2822
2723
  });
2823
2724
  } else if (typeof commonjsRequire !== 'undefined') {
2824
2725
  // Node.js.
2825
- crypto = require$$0$1;
2726
+ crypto = require$$0;
2826
2727
  if (crypto && crypto.randomBytes) {
2827
2728
  nacl.setPRNG(function(x, n) {
2828
2729
  var i, v = crypto.randomBytes(n);
@@ -2894,7 +2795,7 @@ function requireBn () {
2894
2795
  if (hasRequiredBn) return bn$1.exports;
2895
2796
  hasRequiredBn = 1;
2896
2797
  (function (module) {
2897
- (function (module, exports$1) {
2798
+ (function (module, exports) {
2898
2799
 
2899
2800
  // Utils
2900
2801
  function assert (val, msg) {
@@ -2937,7 +2838,7 @@ function requireBn () {
2937
2838
  if (typeof module === 'object') {
2938
2839
  module.exports = BN;
2939
2840
  } else {
2940
- exports$1.BN = BN;
2841
+ exports.BN = BN;
2941
2842
  }
2942
2843
 
2943
2844
  BN.BN = BN;
@@ -6670,7 +6571,11 @@ const GET_CACHE_TTL = 500; // Adjust this value as needed (in milliseconds)
6670
6571
  let lastCacheCleanup = Date.now();
6671
6572
  async function get(path, opts = {}) {
6672
6573
  try {
6673
- const normalizedPath = path.startsWith("/") ? path.slice(1) : path;
6574
+ let normalizedPath = path.startsWith("/") ? path.slice(1) : path;
6575
+ // Remove last '*' if it exists in the path
6576
+ if (normalizedPath.endsWith("*") && normalizedPath.length > 1) {
6577
+ normalizedPath = normalizedPath.slice(0, -1);
6578
+ }
6674
6579
  if (!normalizedPath || normalizedPath.length === 0) {
6675
6580
  return new Error("Invalid path provided.");
6676
6581
  }