@w3ux/utils 0.9.1 → 0.10.0

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/base.cjs CHANGED
@@ -37,7 +37,7 @@ __export(base_exports, {
37
37
  });
38
38
  module.exports = __toCommonJS(base_exports);
39
39
  var import_bignumber = require("bignumber.js");
40
- var import_util_crypto = require("@polkadot/util-crypto");
40
+ var import_substrate_bindings = require("@polkadot-api/substrate-bindings");
41
41
  var camelize = (str) => {
42
42
  const convertToString = (string) => {
43
43
  if (string) {
@@ -136,9 +136,8 @@ var appendOrEmpty = (condition, value) => condition ? ` ${value}` : "";
136
136
  var appendOr = (condition, value, fallback) => condition ? ` ${value}` : ` ${fallback}`;
137
137
  var formatAccountSs58 = (address, ss58Prefix) => {
138
138
  try {
139
- const decodedAddress = (0, import_util_crypto.decodeAddress)(address);
140
- const formattedAddress = (0, import_util_crypto.encodeAddress)(decodedAddress, ss58Prefix);
141
- return formattedAddress;
139
+ const codec = (0, import_substrate_bindings.AccountId)(ss58Prefix);
140
+ return codec.dec(codec.enc(address));
142
141
  } catch (e) {
143
142
  return null;
144
143
  }
package/base.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // src/base.ts
2
2
  import { BigNumber } from "bignumber.js";
3
- import { decodeAddress, encodeAddress } from "@polkadot/util-crypto";
3
+ import { AccountId } from "@polkadot-api/substrate-bindings";
4
4
  var camelize = (str) => {
5
5
  const convertToString = (string) => {
6
6
  if (string) {
@@ -99,9 +99,8 @@ var appendOrEmpty = (condition, value) => condition ? ` ${value}` : "";
99
99
  var appendOr = (condition, value, fallback) => condition ? ` ${value}` : ` ${fallback}`;
100
100
  var formatAccountSs58 = (address, ss58Prefix) => {
101
101
  try {
102
- const decodedAddress = decodeAddress(address);
103
- const formattedAddress = encodeAddress(decodedAddress, ss58Prefix);
104
- return formattedAddress;
102
+ const codec = AccountId(ss58Prefix);
103
+ return codec.dec(codec.enc(address));
105
104
  } catch (e) {
106
105
  return null;
107
106
  }
package/index.cjs CHANGED
@@ -1,6 +1,8 @@
1
+ var __create = Object.create;
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
4
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
7
  var __export = (target, all) => {
6
8
  for (var name in all)
@@ -14,6 +16,14 @@ var __copyProps = (to, from, except, desc) => {
14
16
  }
15
17
  return to;
16
18
  };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
17
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
28
 
19
29
  // src/index.ts
@@ -65,7 +75,7 @@ module.exports = __toCommonJS(src_exports);
65
75
 
66
76
  // src/base.ts
67
77
  var import_bignumber = require("bignumber.js");
68
- var import_util_crypto = require("@polkadot/util-crypto");
78
+ var import_substrate_bindings = require("@polkadot-api/substrate-bindings");
69
79
  var camelize = (str) => {
70
80
  const convertToString = (string) => {
71
81
  if (string) {
@@ -164,9 +174,8 @@ var appendOrEmpty = (condition, value) => condition ? ` ${value}` : "";
164
174
  var appendOr = (condition, value, fallback) => condition ? ` ${value}` : ` ${fallback}`;
165
175
  var formatAccountSs58 = (address, ss58Prefix) => {
166
176
  try {
167
- const decodedAddress = (0, import_util_crypto.decodeAddress)(address);
168
- const formattedAddress = (0, import_util_crypto.encodeAddress)(decodedAddress, ss58Prefix);
169
- return formattedAddress;
177
+ const codec = (0, import_substrate_bindings.AccountId)(ss58Prefix);
178
+ return codec.dec(codec.enc(address));
170
179
  } catch (e) {
171
180
  return null;
172
181
  }
@@ -182,10 +191,155 @@ var isSuperset = (set, subset) => {
182
191
  return true;
183
192
  };
184
193
 
194
+ // ../../node_modules/@polkadot/x-textdecoder/node.js
195
+ var import_node_util = __toESM(require("util"), 1);
196
+
197
+ // ../../node_modules/@polkadot/x-global/index.js
198
+ function evaluateThis(fn) {
199
+ return fn("return this");
200
+ }
201
+ var xglobal = typeof globalThis !== "undefined" ? globalThis : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : evaluateThis(Function);
202
+ function extractGlobal(name, fallback) {
203
+ return typeof xglobal[name] === "undefined" ? fallback : xglobal[name];
204
+ }
205
+
206
+ // ../../node_modules/@polkadot/x-textdecoder/node.js
207
+ var TextDecoder = /* @__PURE__ */ extractGlobal("TextDecoder", import_node_util.default.TextDecoder);
208
+
209
+ // ../../node_modules/@polkadot/x-textencoder/node.js
210
+ var import_node_util2 = __toESM(require("util"), 1);
211
+ var Fallback = class {
212
+ __internal__encoder;
213
+ constructor() {
214
+ this.__internal__encoder = new import_node_util2.default.TextEncoder();
215
+ }
216
+ // For a Jest 26.0.1 environment, Buffer !== Uint8Array
217
+ encode(value) {
218
+ return Uint8Array.from(this.__internal__encoder.encode(value));
219
+ }
220
+ };
221
+ var TextEncoder = /* @__PURE__ */ extractGlobal("TextEncoder", Fallback);
222
+
223
+ // ../../node_modules/@polkadot/util/is/function.js
224
+ function isFunction(value) {
225
+ return typeof value === "function";
226
+ }
227
+
228
+ // ../../node_modules/@polkadot/x-bigint/index.js
229
+ function invalidFallback() {
230
+ return Number.NaN;
231
+ }
232
+ var BigInt = /* @__PURE__ */ extractGlobal("BigInt", invalidFallback);
233
+
234
+ // ../../node_modules/@polkadot/util/hex/toU8a.js
235
+ var CHR = "0123456789abcdef";
236
+ var U8 = new Uint8Array(256);
237
+ var U16 = new Uint8Array(256 * 256);
238
+ for (let i = 0, count = CHR.length; i < count; i++) {
239
+ U8[CHR[i].charCodeAt(0) | 0] = i | 0;
240
+ if (i > 9) {
241
+ U8[CHR[i].toUpperCase().charCodeAt(0) | 0] = i | 0;
242
+ }
243
+ }
244
+ for (let i = 0; i < 256; i++) {
245
+ const s = i << 8;
246
+ for (let j = 0; j < 256; j++) {
247
+ U16[s | j] = U8[i] << 4 | U8[j];
248
+ }
249
+ }
250
+ function hexToU8a(value, bitLength = -1) {
251
+ if (!value) {
252
+ return new Uint8Array();
253
+ }
254
+ let s = value.startsWith("0x") ? 2 : 0;
255
+ const decLength = Math.ceil((value.length - s) / 2);
256
+ const endLength = Math.ceil(bitLength === -1 ? decLength : bitLength / 8);
257
+ const result = new Uint8Array(endLength);
258
+ const offset = endLength > decLength ? endLength - decLength : 0;
259
+ for (let i = offset; i < endLength; i++, s += 2) {
260
+ result[i] = U16[value.charCodeAt(s) << 8 | value.charCodeAt(s + 1)];
261
+ }
262
+ return result;
263
+ }
264
+
265
+ // ../../node_modules/@polkadot/util/is/hex.js
266
+ var REGEX_HEX_PREFIXED = /^0x[\da-fA-F]+$/;
267
+ function isHex(value, bitLength = -1, ignoreLength) {
268
+ return typeof value === "string" && (value === "0x" || REGEX_HEX_PREFIXED.test(value)) && (bitLength === -1 ? ignoreLength || value.length % 2 === 0 : value.length === 2 + Math.ceil(bitLength / 4));
269
+ }
270
+
271
+ // ../../node_modules/@polkadot/util/has.js
272
+ var hasBigInt = typeof BigInt === "function" && typeof BigInt.asIntN === "function";
273
+ var hasBuffer = typeof xglobal.Buffer === "function" && typeof xglobal.Buffer.isBuffer === "function";
274
+ var hasProcess = typeof xglobal.process === "object";
275
+
276
+ // ../../node_modules/@polkadot/util/is/buffer.js
277
+ function isBuffer(value) {
278
+ return hasBuffer && !!value && isFunction(value.readDoubleLE) && xglobal.Buffer.isBuffer(value);
279
+ }
280
+
281
+ // ../../node_modules/@polkadot/util/is/u8a.js
282
+ function isU8a(value) {
283
+ return (value && value.constructor) === Uint8Array || value instanceof Uint8Array;
284
+ }
285
+
286
+ // ../../node_modules/@polkadot/util/string/toU8a.js
287
+ var encoder = new TextEncoder();
288
+ function stringToU8a(value) {
289
+ return value ? encoder.encode(value.toString()) : new Uint8Array();
290
+ }
291
+
292
+ // ../../node_modules/@polkadot/util/u8a/toU8a.js
293
+ function u8aToU8a(value) {
294
+ return isU8a(value) ? isBuffer(value) ? new Uint8Array(value) : value : isHex(value) ? hexToU8a(value) : Array.isArray(value) ? new Uint8Array(value) : stringToU8a(value);
295
+ }
296
+
297
+ // ../../node_modules/@polkadot/util/u8a/eq.js
298
+ function u8aEq(a, b) {
299
+ const u8aa = u8aToU8a(a);
300
+ const u8ab = u8aToU8a(b);
301
+ if (u8aa.length === u8ab.length) {
302
+ const dvA = new DataView(u8aa.buffer, u8aa.byteOffset);
303
+ const dvB = new DataView(u8ab.buffer, u8ab.byteOffset);
304
+ const mod = u8aa.length % 4 | 0;
305
+ const length = u8aa.length - mod | 0;
306
+ for (let i = 0; i < length; i += 4) {
307
+ if (dvA.getUint32(i) !== dvB.getUint32(i)) {
308
+ return false;
309
+ }
310
+ }
311
+ for (let i = length, count = u8aa.length; i < count; i++) {
312
+ if (u8aa[i] !== u8ab[i]) {
313
+ return false;
314
+ }
315
+ }
316
+ return true;
317
+ }
318
+ return false;
319
+ }
320
+
321
+ // ../../node_modules/@polkadot/util/u8a/toString.js
322
+ var decoder = new TextDecoder("utf-8");
323
+ function u8aToString(value) {
324
+ return value ? decoder.decode(value) : "";
325
+ }
326
+
327
+ // ../../node_modules/@polkadot/util/u8a/wrap.js
328
+ var U8A_WRAP_ETHEREUM = /* @__PURE__ */ u8aToU8a("Ethereum Signed Message:\n");
329
+ var U8A_WRAP_PREFIX = /* @__PURE__ */ u8aToU8a("<Bytes>");
330
+ var U8A_WRAP_POSTFIX = /* @__PURE__ */ u8aToU8a("</Bytes>");
331
+ var WRAP_LEN = U8A_WRAP_PREFIX.length + U8A_WRAP_POSTFIX.length;
332
+ function u8aIsWrapped(u8a, withEthereum) {
333
+ return u8a.length >= WRAP_LEN && u8aEq(u8a.subarray(0, U8A_WRAP_PREFIX.length), U8A_WRAP_PREFIX) && u8aEq(u8a.slice(-U8A_WRAP_POSTFIX.length), U8A_WRAP_POSTFIX) || withEthereum && u8a.length >= U8A_WRAP_ETHEREUM.length && u8aEq(u8a.subarray(0, U8A_WRAP_ETHEREUM.length), U8A_WRAP_ETHEREUM);
334
+ }
335
+ function u8aUnwrapBytes(bytes) {
336
+ const u8a = u8aToU8a(bytes);
337
+ return u8aIsWrapped(u8a, false) ? u8a.subarray(U8A_WRAP_PREFIX.length, u8a.length - U8A_WRAP_POSTFIX.length) : u8a;
338
+ }
339
+
185
340
  // src/unit.ts
186
- var import_util_crypto2 = require("@polkadot/util-crypto");
187
- var import_util = require("@polkadot/util");
188
341
  var import_bignumber2 = require("bignumber.js");
342
+ var import_substrate_bindings2 = require("@polkadot-api/substrate-bindings");
189
343
  var remToUnit = (rem) => Number(rem.slice(0, rem.length - 3)) * parseFloat(getComputedStyle(document.documentElement).fontSize);
190
344
  var planckToUnit = (val, units) => new import_bignumber2.BigNumber(
191
345
  val.dividedBy(new import_bignumber2.BigNumber(10).exponentiatedBy(units)).toFixed(units)
@@ -215,10 +369,8 @@ var localStorageOrDefault = (key, _default, parse = false) => {
215
369
  };
216
370
  var isValidAddress = (address) => {
217
371
  try {
218
- if ((0, import_util.isHex)(address)) {
219
- return true;
220
- }
221
- (0, import_util_crypto2.decodeAddress)(address);
372
+ const codec = (0, import_substrate_bindings2.AccountId)();
373
+ codec.dec(codec.enc(address));
222
374
  return true;
223
375
  } catch (e) {
224
376
  return false;
@@ -227,7 +379,7 @@ var isValidAddress = (address) => {
227
379
  var determinePoolDisplay = (address, batchItem) => {
228
380
  const defaultDisplay = ellipsisFn(address, 6);
229
381
  let display = batchItem ?? defaultDisplay;
230
- const displayAsBytes = (0, import_util.u8aToString)((0, import_util.u8aUnwrapBytes)(display));
382
+ const displayAsBytes = u8aToString(u8aUnwrapBytes(display));
231
383
  if (displayAsBytes !== "") {
232
384
  display = displayAsBytes;
233
385
  }
package/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  // src/base.ts
2
2
  import { BigNumber } from "bignumber.js";
3
- import { decodeAddress, encodeAddress } from "@polkadot/util-crypto";
3
+ import { AccountId } from "@polkadot-api/substrate-bindings";
4
4
  var camelize = (str) => {
5
5
  const convertToString = (string) => {
6
6
  if (string) {
@@ -99,9 +99,8 @@ var appendOrEmpty = (condition, value) => condition ? ` ${value}` : "";
99
99
  var appendOr = (condition, value, fallback) => condition ? ` ${value}` : ` ${fallback}`;
100
100
  var formatAccountSs58 = (address, ss58Prefix) => {
101
101
  try {
102
- const decodedAddress = decodeAddress(address);
103
- const formattedAddress = encodeAddress(decodedAddress, ss58Prefix);
104
- return formattedAddress;
102
+ const codec = AccountId(ss58Prefix);
103
+ return codec.dec(codec.enc(address));
105
104
  } catch (e) {
106
105
  return null;
107
106
  }
@@ -117,10 +116,155 @@ var isSuperset = (set, subset) => {
117
116
  return true;
118
117
  };
119
118
 
119
+ // ../../node_modules/@polkadot/x-textdecoder/node.js
120
+ import util from "node:util";
121
+
122
+ // ../../node_modules/@polkadot/x-global/index.js
123
+ function evaluateThis(fn) {
124
+ return fn("return this");
125
+ }
126
+ var xglobal = typeof globalThis !== "undefined" ? globalThis : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : evaluateThis(Function);
127
+ function extractGlobal(name, fallback) {
128
+ return typeof xglobal[name] === "undefined" ? fallback : xglobal[name];
129
+ }
130
+
131
+ // ../../node_modules/@polkadot/x-textdecoder/node.js
132
+ var TextDecoder = /* @__PURE__ */ extractGlobal("TextDecoder", util.TextDecoder);
133
+
134
+ // ../../node_modules/@polkadot/x-textencoder/node.js
135
+ import util2 from "node:util";
136
+ var Fallback = class {
137
+ __internal__encoder;
138
+ constructor() {
139
+ this.__internal__encoder = new util2.TextEncoder();
140
+ }
141
+ // For a Jest 26.0.1 environment, Buffer !== Uint8Array
142
+ encode(value) {
143
+ return Uint8Array.from(this.__internal__encoder.encode(value));
144
+ }
145
+ };
146
+ var TextEncoder = /* @__PURE__ */ extractGlobal("TextEncoder", Fallback);
147
+
148
+ // ../../node_modules/@polkadot/util/is/function.js
149
+ function isFunction(value) {
150
+ return typeof value === "function";
151
+ }
152
+
153
+ // ../../node_modules/@polkadot/x-bigint/index.js
154
+ function invalidFallback() {
155
+ return Number.NaN;
156
+ }
157
+ var BigInt = /* @__PURE__ */ extractGlobal("BigInt", invalidFallback);
158
+
159
+ // ../../node_modules/@polkadot/util/hex/toU8a.js
160
+ var CHR = "0123456789abcdef";
161
+ var U8 = new Uint8Array(256);
162
+ var U16 = new Uint8Array(256 * 256);
163
+ for (let i = 0, count = CHR.length; i < count; i++) {
164
+ U8[CHR[i].charCodeAt(0) | 0] = i | 0;
165
+ if (i > 9) {
166
+ U8[CHR[i].toUpperCase().charCodeAt(0) | 0] = i | 0;
167
+ }
168
+ }
169
+ for (let i = 0; i < 256; i++) {
170
+ const s = i << 8;
171
+ for (let j = 0; j < 256; j++) {
172
+ U16[s | j] = U8[i] << 4 | U8[j];
173
+ }
174
+ }
175
+ function hexToU8a(value, bitLength = -1) {
176
+ if (!value) {
177
+ return new Uint8Array();
178
+ }
179
+ let s = value.startsWith("0x") ? 2 : 0;
180
+ const decLength = Math.ceil((value.length - s) / 2);
181
+ const endLength = Math.ceil(bitLength === -1 ? decLength : bitLength / 8);
182
+ const result = new Uint8Array(endLength);
183
+ const offset = endLength > decLength ? endLength - decLength : 0;
184
+ for (let i = offset; i < endLength; i++, s += 2) {
185
+ result[i] = U16[value.charCodeAt(s) << 8 | value.charCodeAt(s + 1)];
186
+ }
187
+ return result;
188
+ }
189
+
190
+ // ../../node_modules/@polkadot/util/is/hex.js
191
+ var REGEX_HEX_PREFIXED = /^0x[\da-fA-F]+$/;
192
+ function isHex(value, bitLength = -1, ignoreLength) {
193
+ return typeof value === "string" && (value === "0x" || REGEX_HEX_PREFIXED.test(value)) && (bitLength === -1 ? ignoreLength || value.length % 2 === 0 : value.length === 2 + Math.ceil(bitLength / 4));
194
+ }
195
+
196
+ // ../../node_modules/@polkadot/util/has.js
197
+ var hasBigInt = typeof BigInt === "function" && typeof BigInt.asIntN === "function";
198
+ var hasBuffer = typeof xglobal.Buffer === "function" && typeof xglobal.Buffer.isBuffer === "function";
199
+ var hasProcess = typeof xglobal.process === "object";
200
+
201
+ // ../../node_modules/@polkadot/util/is/buffer.js
202
+ function isBuffer(value) {
203
+ return hasBuffer && !!value && isFunction(value.readDoubleLE) && xglobal.Buffer.isBuffer(value);
204
+ }
205
+
206
+ // ../../node_modules/@polkadot/util/is/u8a.js
207
+ function isU8a(value) {
208
+ return (value && value.constructor) === Uint8Array || value instanceof Uint8Array;
209
+ }
210
+
211
+ // ../../node_modules/@polkadot/util/string/toU8a.js
212
+ var encoder = new TextEncoder();
213
+ function stringToU8a(value) {
214
+ return value ? encoder.encode(value.toString()) : new Uint8Array();
215
+ }
216
+
217
+ // ../../node_modules/@polkadot/util/u8a/toU8a.js
218
+ function u8aToU8a(value) {
219
+ return isU8a(value) ? isBuffer(value) ? new Uint8Array(value) : value : isHex(value) ? hexToU8a(value) : Array.isArray(value) ? new Uint8Array(value) : stringToU8a(value);
220
+ }
221
+
222
+ // ../../node_modules/@polkadot/util/u8a/eq.js
223
+ function u8aEq(a, b) {
224
+ const u8aa = u8aToU8a(a);
225
+ const u8ab = u8aToU8a(b);
226
+ if (u8aa.length === u8ab.length) {
227
+ const dvA = new DataView(u8aa.buffer, u8aa.byteOffset);
228
+ const dvB = new DataView(u8ab.buffer, u8ab.byteOffset);
229
+ const mod = u8aa.length % 4 | 0;
230
+ const length = u8aa.length - mod | 0;
231
+ for (let i = 0; i < length; i += 4) {
232
+ if (dvA.getUint32(i) !== dvB.getUint32(i)) {
233
+ return false;
234
+ }
235
+ }
236
+ for (let i = length, count = u8aa.length; i < count; i++) {
237
+ if (u8aa[i] !== u8ab[i]) {
238
+ return false;
239
+ }
240
+ }
241
+ return true;
242
+ }
243
+ return false;
244
+ }
245
+
246
+ // ../../node_modules/@polkadot/util/u8a/toString.js
247
+ var decoder = new TextDecoder("utf-8");
248
+ function u8aToString(value) {
249
+ return value ? decoder.decode(value) : "";
250
+ }
251
+
252
+ // ../../node_modules/@polkadot/util/u8a/wrap.js
253
+ var U8A_WRAP_ETHEREUM = /* @__PURE__ */ u8aToU8a("Ethereum Signed Message:\n");
254
+ var U8A_WRAP_PREFIX = /* @__PURE__ */ u8aToU8a("<Bytes>");
255
+ var U8A_WRAP_POSTFIX = /* @__PURE__ */ u8aToU8a("</Bytes>");
256
+ var WRAP_LEN = U8A_WRAP_PREFIX.length + U8A_WRAP_POSTFIX.length;
257
+ function u8aIsWrapped(u8a, withEthereum) {
258
+ return u8a.length >= WRAP_LEN && u8aEq(u8a.subarray(0, U8A_WRAP_PREFIX.length), U8A_WRAP_PREFIX) && u8aEq(u8a.slice(-U8A_WRAP_POSTFIX.length), U8A_WRAP_POSTFIX) || withEthereum && u8a.length >= U8A_WRAP_ETHEREUM.length && u8aEq(u8a.subarray(0, U8A_WRAP_ETHEREUM.length), U8A_WRAP_ETHEREUM);
259
+ }
260
+ function u8aUnwrapBytes(bytes) {
261
+ const u8a = u8aToU8a(bytes);
262
+ return u8aIsWrapped(u8a, false) ? u8a.subarray(U8A_WRAP_PREFIX.length, u8a.length - U8A_WRAP_POSTFIX.length) : u8a;
263
+ }
264
+
120
265
  // src/unit.ts
121
- import { decodeAddress as decodeAddress2 } from "@polkadot/util-crypto";
122
- import { isHex, u8aToString, u8aUnwrapBytes } from "@polkadot/util";
123
266
  import { BigNumber as BigNumber2 } from "bignumber.js";
267
+ import { AccountId as AccountId2 } from "@polkadot-api/substrate-bindings";
124
268
  var remToUnit = (rem) => Number(rem.slice(0, rem.length - 3)) * parseFloat(getComputedStyle(document.documentElement).fontSize);
125
269
  var planckToUnit = (val, units) => new BigNumber2(
126
270
  val.dividedBy(new BigNumber2(10).exponentiatedBy(units)).toFixed(units)
@@ -150,10 +294,8 @@ var localStorageOrDefault = (key, _default, parse = false) => {
150
294
  };
151
295
  var isValidAddress = (address) => {
152
296
  try {
153
- if (isHex(address)) {
154
- return true;
155
- }
156
- decodeAddress2(address);
297
+ const codec = AccountId2();
298
+ codec.dec(codec.enc(address));
157
299
  return true;
158
300
  } catch (e) {
159
301
  return false;
package/package.json CHANGED
@@ -1,10 +1,9 @@
1
1
  {
2
2
  "name": "@w3ux/utils",
3
- "version": "0.9.1",
3
+ "version": "0.10.0",
4
4
  "license": "GPL-3.0-only",
5
5
  "dependencies": {
6
- "@polkadot/util": "^13.1.1",
7
- "@polkadot/util-crypto": "^13.1.1",
6
+ "@polkadot-api/substrate-bindings": "^0.9.3",
8
7
  "bignumber.js": "^9.1.1"
9
8
  },
10
9
  "main": "index.cjs",
package/unit.cjs CHANGED
@@ -1,6 +1,8 @@
1
+ var __create = Object.create;
1
2
  var __defProp = Object.defineProperty;
2
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __getProtoOf = Object.getPrototypeOf;
4
6
  var __hasOwnProp = Object.prototype.hasOwnProperty;
5
7
  var __export = (target, all) => {
6
8
  for (var name in all)
@@ -14,6 +16,14 @@ var __copyProps = (to, from, except, desc) => {
14
16
  }
15
17
  return to;
16
18
  };
19
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
20
+ // If the importer is in node compatibility mode or this is not an ESM
21
+ // file that has been converted to a CommonJS file using a Babel-
22
+ // compatible transform (i.e. "__esModule" has not been set), then set
23
+ // "default" to the CommonJS "module.exports" for node compatibility.
24
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
25
+ mod
26
+ ));
17
27
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
18
28
 
19
29
  // src/unit.ts
@@ -47,13 +57,159 @@ __export(unit_exports, {
47
57
  varToUrlHash: () => varToUrlHash
48
58
  });
49
59
  module.exports = __toCommonJS(unit_exports);
50
- var import_util_crypto2 = require("@polkadot/util-crypto");
51
- var import_util = require("@polkadot/util");
60
+
61
+ // ../../node_modules/@polkadot/x-textdecoder/node.js
62
+ var import_node_util = __toESM(require("util"), 1);
63
+
64
+ // ../../node_modules/@polkadot/x-global/index.js
65
+ function evaluateThis(fn) {
66
+ return fn("return this");
67
+ }
68
+ var xglobal = typeof globalThis !== "undefined" ? globalThis : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : evaluateThis(Function);
69
+ function extractGlobal(name, fallback) {
70
+ return typeof xglobal[name] === "undefined" ? fallback : xglobal[name];
71
+ }
72
+
73
+ // ../../node_modules/@polkadot/x-textdecoder/node.js
74
+ var TextDecoder = /* @__PURE__ */ extractGlobal("TextDecoder", import_node_util.default.TextDecoder);
75
+
76
+ // ../../node_modules/@polkadot/x-textencoder/node.js
77
+ var import_node_util2 = __toESM(require("util"), 1);
78
+ var Fallback = class {
79
+ __internal__encoder;
80
+ constructor() {
81
+ this.__internal__encoder = new import_node_util2.default.TextEncoder();
82
+ }
83
+ // For a Jest 26.0.1 environment, Buffer !== Uint8Array
84
+ encode(value) {
85
+ return Uint8Array.from(this.__internal__encoder.encode(value));
86
+ }
87
+ };
88
+ var TextEncoder = /* @__PURE__ */ extractGlobal("TextEncoder", Fallback);
89
+
90
+ // ../../node_modules/@polkadot/util/is/function.js
91
+ function isFunction(value) {
92
+ return typeof value === "function";
93
+ }
94
+
95
+ // ../../node_modules/@polkadot/x-bigint/index.js
96
+ function invalidFallback() {
97
+ return Number.NaN;
98
+ }
99
+ var BigInt = /* @__PURE__ */ extractGlobal("BigInt", invalidFallback);
100
+
101
+ // ../../node_modules/@polkadot/util/hex/toU8a.js
102
+ var CHR = "0123456789abcdef";
103
+ var U8 = new Uint8Array(256);
104
+ var U16 = new Uint8Array(256 * 256);
105
+ for (let i = 0, count = CHR.length; i < count; i++) {
106
+ U8[CHR[i].charCodeAt(0) | 0] = i | 0;
107
+ if (i > 9) {
108
+ U8[CHR[i].toUpperCase().charCodeAt(0) | 0] = i | 0;
109
+ }
110
+ }
111
+ for (let i = 0; i < 256; i++) {
112
+ const s = i << 8;
113
+ for (let j = 0; j < 256; j++) {
114
+ U16[s | j] = U8[i] << 4 | U8[j];
115
+ }
116
+ }
117
+ function hexToU8a(value, bitLength = -1) {
118
+ if (!value) {
119
+ return new Uint8Array();
120
+ }
121
+ let s = value.startsWith("0x") ? 2 : 0;
122
+ const decLength = Math.ceil((value.length - s) / 2);
123
+ const endLength = Math.ceil(bitLength === -1 ? decLength : bitLength / 8);
124
+ const result = new Uint8Array(endLength);
125
+ const offset = endLength > decLength ? endLength - decLength : 0;
126
+ for (let i = offset; i < endLength; i++, s += 2) {
127
+ result[i] = U16[value.charCodeAt(s) << 8 | value.charCodeAt(s + 1)];
128
+ }
129
+ return result;
130
+ }
131
+
132
+ // ../../node_modules/@polkadot/util/is/hex.js
133
+ var REGEX_HEX_PREFIXED = /^0x[\da-fA-F]+$/;
134
+ function isHex(value, bitLength = -1, ignoreLength) {
135
+ return typeof value === "string" && (value === "0x" || REGEX_HEX_PREFIXED.test(value)) && (bitLength === -1 ? ignoreLength || value.length % 2 === 0 : value.length === 2 + Math.ceil(bitLength / 4));
136
+ }
137
+
138
+ // ../../node_modules/@polkadot/util/has.js
139
+ var hasBigInt = typeof BigInt === "function" && typeof BigInt.asIntN === "function";
140
+ var hasBuffer = typeof xglobal.Buffer === "function" && typeof xglobal.Buffer.isBuffer === "function";
141
+ var hasProcess = typeof xglobal.process === "object";
142
+
143
+ // ../../node_modules/@polkadot/util/is/buffer.js
144
+ function isBuffer(value) {
145
+ return hasBuffer && !!value && isFunction(value.readDoubleLE) && xglobal.Buffer.isBuffer(value);
146
+ }
147
+
148
+ // ../../node_modules/@polkadot/util/is/u8a.js
149
+ function isU8a(value) {
150
+ return (value && value.constructor) === Uint8Array || value instanceof Uint8Array;
151
+ }
152
+
153
+ // ../../node_modules/@polkadot/util/string/toU8a.js
154
+ var encoder = new TextEncoder();
155
+ function stringToU8a(value) {
156
+ return value ? encoder.encode(value.toString()) : new Uint8Array();
157
+ }
158
+
159
+ // ../../node_modules/@polkadot/util/u8a/toU8a.js
160
+ function u8aToU8a(value) {
161
+ return isU8a(value) ? isBuffer(value) ? new Uint8Array(value) : value : isHex(value) ? hexToU8a(value) : Array.isArray(value) ? new Uint8Array(value) : stringToU8a(value);
162
+ }
163
+
164
+ // ../../node_modules/@polkadot/util/u8a/eq.js
165
+ function u8aEq(a, b) {
166
+ const u8aa = u8aToU8a(a);
167
+ const u8ab = u8aToU8a(b);
168
+ if (u8aa.length === u8ab.length) {
169
+ const dvA = new DataView(u8aa.buffer, u8aa.byteOffset);
170
+ const dvB = new DataView(u8ab.buffer, u8ab.byteOffset);
171
+ const mod = u8aa.length % 4 | 0;
172
+ const length = u8aa.length - mod | 0;
173
+ for (let i = 0; i < length; i += 4) {
174
+ if (dvA.getUint32(i) !== dvB.getUint32(i)) {
175
+ return false;
176
+ }
177
+ }
178
+ for (let i = length, count = u8aa.length; i < count; i++) {
179
+ if (u8aa[i] !== u8ab[i]) {
180
+ return false;
181
+ }
182
+ }
183
+ return true;
184
+ }
185
+ return false;
186
+ }
187
+
188
+ // ../../node_modules/@polkadot/util/u8a/toString.js
189
+ var decoder = new TextDecoder("utf-8");
190
+ function u8aToString(value) {
191
+ return value ? decoder.decode(value) : "";
192
+ }
193
+
194
+ // ../../node_modules/@polkadot/util/u8a/wrap.js
195
+ var U8A_WRAP_ETHEREUM = /* @__PURE__ */ u8aToU8a("Ethereum Signed Message:\n");
196
+ var U8A_WRAP_PREFIX = /* @__PURE__ */ u8aToU8a("<Bytes>");
197
+ var U8A_WRAP_POSTFIX = /* @__PURE__ */ u8aToU8a("</Bytes>");
198
+ var WRAP_LEN = U8A_WRAP_PREFIX.length + U8A_WRAP_POSTFIX.length;
199
+ function u8aIsWrapped(u8a, withEthereum) {
200
+ return u8a.length >= WRAP_LEN && u8aEq(u8a.subarray(0, U8A_WRAP_PREFIX.length), U8A_WRAP_PREFIX) && u8aEq(u8a.slice(-U8A_WRAP_POSTFIX.length), U8A_WRAP_POSTFIX) || withEthereum && u8a.length >= U8A_WRAP_ETHEREUM.length && u8aEq(u8a.subarray(0, U8A_WRAP_ETHEREUM.length), U8A_WRAP_ETHEREUM);
201
+ }
202
+ function u8aUnwrapBytes(bytes) {
203
+ const u8a = u8aToU8a(bytes);
204
+ return u8aIsWrapped(u8a, false) ? u8a.subarray(U8A_WRAP_PREFIX.length, u8a.length - U8A_WRAP_POSTFIX.length) : u8a;
205
+ }
206
+
207
+ // src/unit.ts
52
208
  var import_bignumber2 = require("bignumber.js");
53
209
 
54
210
  // src/base.ts
55
211
  var import_bignumber = require("bignumber.js");
56
- var import_util_crypto = require("@polkadot/util-crypto");
212
+ var import_substrate_bindings = require("@polkadot-api/substrate-bindings");
57
213
  var ellipsisFn = (str, amount = 6, position = "center") => {
58
214
  const half = str.length / 2;
59
215
  if (amount <= 4) {
@@ -83,6 +239,7 @@ var ellipsisFn = (str, amount = 6, position = "center") => {
83
239
  var rmCommas = (val) => val.replace(/,/g, "");
84
240
 
85
241
  // src/unit.ts
242
+ var import_substrate_bindings2 = require("@polkadot-api/substrate-bindings");
86
243
  var remToUnit = (rem) => Number(rem.slice(0, rem.length - 3)) * parseFloat(getComputedStyle(document.documentElement).fontSize);
87
244
  var planckToUnit = (val, units) => new import_bignumber2.BigNumber(
88
245
  val.dividedBy(new import_bignumber2.BigNumber(10).exponentiatedBy(units)).toFixed(units)
@@ -112,10 +269,8 @@ var localStorageOrDefault = (key, _default, parse = false) => {
112
269
  };
113
270
  var isValidAddress = (address) => {
114
271
  try {
115
- if ((0, import_util.isHex)(address)) {
116
- return true;
117
- }
118
- (0, import_util_crypto2.decodeAddress)(address);
272
+ const codec = (0, import_substrate_bindings2.AccountId)();
273
+ codec.dec(codec.enc(address));
119
274
  return true;
120
275
  } catch (e) {
121
276
  return false;
@@ -124,7 +279,7 @@ var isValidAddress = (address) => {
124
279
  var determinePoolDisplay = (address, batchItem) => {
125
280
  const defaultDisplay = ellipsisFn(address, 6);
126
281
  let display = batchItem ?? defaultDisplay;
127
- const displayAsBytes = (0, import_util.u8aToString)((0, import_util.u8aUnwrapBytes)(display));
282
+ const displayAsBytes = u8aToString(u8aUnwrapBytes(display));
128
283
  if (displayAsBytes !== "") {
129
284
  display = displayAsBytes;
130
285
  }
package/unit.js CHANGED
@@ -1,11 +1,155 @@
1
+ // ../../node_modules/@polkadot/x-textdecoder/node.js
2
+ import util from "node:util";
3
+
4
+ // ../../node_modules/@polkadot/x-global/index.js
5
+ function evaluateThis(fn) {
6
+ return fn("return this");
7
+ }
8
+ var xglobal = typeof globalThis !== "undefined" ? globalThis : typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : evaluateThis(Function);
9
+ function extractGlobal(name, fallback) {
10
+ return typeof xglobal[name] === "undefined" ? fallback : xglobal[name];
11
+ }
12
+
13
+ // ../../node_modules/@polkadot/x-textdecoder/node.js
14
+ var TextDecoder = /* @__PURE__ */ extractGlobal("TextDecoder", util.TextDecoder);
15
+
16
+ // ../../node_modules/@polkadot/x-textencoder/node.js
17
+ import util2 from "node:util";
18
+ var Fallback = class {
19
+ __internal__encoder;
20
+ constructor() {
21
+ this.__internal__encoder = new util2.TextEncoder();
22
+ }
23
+ // For a Jest 26.0.1 environment, Buffer !== Uint8Array
24
+ encode(value) {
25
+ return Uint8Array.from(this.__internal__encoder.encode(value));
26
+ }
27
+ };
28
+ var TextEncoder = /* @__PURE__ */ extractGlobal("TextEncoder", Fallback);
29
+
30
+ // ../../node_modules/@polkadot/util/is/function.js
31
+ function isFunction(value) {
32
+ return typeof value === "function";
33
+ }
34
+
35
+ // ../../node_modules/@polkadot/x-bigint/index.js
36
+ function invalidFallback() {
37
+ return Number.NaN;
38
+ }
39
+ var BigInt = /* @__PURE__ */ extractGlobal("BigInt", invalidFallback);
40
+
41
+ // ../../node_modules/@polkadot/util/hex/toU8a.js
42
+ var CHR = "0123456789abcdef";
43
+ var U8 = new Uint8Array(256);
44
+ var U16 = new Uint8Array(256 * 256);
45
+ for (let i = 0, count = CHR.length; i < count; i++) {
46
+ U8[CHR[i].charCodeAt(0) | 0] = i | 0;
47
+ if (i > 9) {
48
+ U8[CHR[i].toUpperCase().charCodeAt(0) | 0] = i | 0;
49
+ }
50
+ }
51
+ for (let i = 0; i < 256; i++) {
52
+ const s = i << 8;
53
+ for (let j = 0; j < 256; j++) {
54
+ U16[s | j] = U8[i] << 4 | U8[j];
55
+ }
56
+ }
57
+ function hexToU8a(value, bitLength = -1) {
58
+ if (!value) {
59
+ return new Uint8Array();
60
+ }
61
+ let s = value.startsWith("0x") ? 2 : 0;
62
+ const decLength = Math.ceil((value.length - s) / 2);
63
+ const endLength = Math.ceil(bitLength === -1 ? decLength : bitLength / 8);
64
+ const result = new Uint8Array(endLength);
65
+ const offset = endLength > decLength ? endLength - decLength : 0;
66
+ for (let i = offset; i < endLength; i++, s += 2) {
67
+ result[i] = U16[value.charCodeAt(s) << 8 | value.charCodeAt(s + 1)];
68
+ }
69
+ return result;
70
+ }
71
+
72
+ // ../../node_modules/@polkadot/util/is/hex.js
73
+ var REGEX_HEX_PREFIXED = /^0x[\da-fA-F]+$/;
74
+ function isHex(value, bitLength = -1, ignoreLength) {
75
+ return typeof value === "string" && (value === "0x" || REGEX_HEX_PREFIXED.test(value)) && (bitLength === -1 ? ignoreLength || value.length % 2 === 0 : value.length === 2 + Math.ceil(bitLength / 4));
76
+ }
77
+
78
+ // ../../node_modules/@polkadot/util/has.js
79
+ var hasBigInt = typeof BigInt === "function" && typeof BigInt.asIntN === "function";
80
+ var hasBuffer = typeof xglobal.Buffer === "function" && typeof xglobal.Buffer.isBuffer === "function";
81
+ var hasProcess = typeof xglobal.process === "object";
82
+
83
+ // ../../node_modules/@polkadot/util/is/buffer.js
84
+ function isBuffer(value) {
85
+ return hasBuffer && !!value && isFunction(value.readDoubleLE) && xglobal.Buffer.isBuffer(value);
86
+ }
87
+
88
+ // ../../node_modules/@polkadot/util/is/u8a.js
89
+ function isU8a(value) {
90
+ return (value && value.constructor) === Uint8Array || value instanceof Uint8Array;
91
+ }
92
+
93
+ // ../../node_modules/@polkadot/util/string/toU8a.js
94
+ var encoder = new TextEncoder();
95
+ function stringToU8a(value) {
96
+ return value ? encoder.encode(value.toString()) : new Uint8Array();
97
+ }
98
+
99
+ // ../../node_modules/@polkadot/util/u8a/toU8a.js
100
+ function u8aToU8a(value) {
101
+ return isU8a(value) ? isBuffer(value) ? new Uint8Array(value) : value : isHex(value) ? hexToU8a(value) : Array.isArray(value) ? new Uint8Array(value) : stringToU8a(value);
102
+ }
103
+
104
+ // ../../node_modules/@polkadot/util/u8a/eq.js
105
+ function u8aEq(a, b) {
106
+ const u8aa = u8aToU8a(a);
107
+ const u8ab = u8aToU8a(b);
108
+ if (u8aa.length === u8ab.length) {
109
+ const dvA = new DataView(u8aa.buffer, u8aa.byteOffset);
110
+ const dvB = new DataView(u8ab.buffer, u8ab.byteOffset);
111
+ const mod = u8aa.length % 4 | 0;
112
+ const length = u8aa.length - mod | 0;
113
+ for (let i = 0; i < length; i += 4) {
114
+ if (dvA.getUint32(i) !== dvB.getUint32(i)) {
115
+ return false;
116
+ }
117
+ }
118
+ for (let i = length, count = u8aa.length; i < count; i++) {
119
+ if (u8aa[i] !== u8ab[i]) {
120
+ return false;
121
+ }
122
+ }
123
+ return true;
124
+ }
125
+ return false;
126
+ }
127
+
128
+ // ../../node_modules/@polkadot/util/u8a/toString.js
129
+ var decoder = new TextDecoder("utf-8");
130
+ function u8aToString(value) {
131
+ return value ? decoder.decode(value) : "";
132
+ }
133
+
134
+ // ../../node_modules/@polkadot/util/u8a/wrap.js
135
+ var U8A_WRAP_ETHEREUM = /* @__PURE__ */ u8aToU8a("Ethereum Signed Message:\n");
136
+ var U8A_WRAP_PREFIX = /* @__PURE__ */ u8aToU8a("<Bytes>");
137
+ var U8A_WRAP_POSTFIX = /* @__PURE__ */ u8aToU8a("</Bytes>");
138
+ var WRAP_LEN = U8A_WRAP_PREFIX.length + U8A_WRAP_POSTFIX.length;
139
+ function u8aIsWrapped(u8a, withEthereum) {
140
+ return u8a.length >= WRAP_LEN && u8aEq(u8a.subarray(0, U8A_WRAP_PREFIX.length), U8A_WRAP_PREFIX) && u8aEq(u8a.slice(-U8A_WRAP_POSTFIX.length), U8A_WRAP_POSTFIX) || withEthereum && u8a.length >= U8A_WRAP_ETHEREUM.length && u8aEq(u8a.subarray(0, U8A_WRAP_ETHEREUM.length), U8A_WRAP_ETHEREUM);
141
+ }
142
+ function u8aUnwrapBytes(bytes) {
143
+ const u8a = u8aToU8a(bytes);
144
+ return u8aIsWrapped(u8a, false) ? u8a.subarray(U8A_WRAP_PREFIX.length, u8a.length - U8A_WRAP_POSTFIX.length) : u8a;
145
+ }
146
+
1
147
  // src/unit.ts
2
- import { decodeAddress as decodeAddress2 } from "@polkadot/util-crypto";
3
- import { isHex, u8aToString, u8aUnwrapBytes } from "@polkadot/util";
4
148
  import { BigNumber as BigNumber2 } from "bignumber.js";
5
149
 
6
150
  // src/base.ts
7
151
  import { BigNumber } from "bignumber.js";
8
- import { decodeAddress, encodeAddress } from "@polkadot/util-crypto";
152
+ import { AccountId } from "@polkadot-api/substrate-bindings";
9
153
  var ellipsisFn = (str, amount = 6, position = "center") => {
10
154
  const half = str.length / 2;
11
155
  if (amount <= 4) {
@@ -35,6 +179,7 @@ var ellipsisFn = (str, amount = 6, position = "center") => {
35
179
  var rmCommas = (val) => val.replace(/,/g, "");
36
180
 
37
181
  // src/unit.ts
182
+ import { AccountId as AccountId2 } from "@polkadot-api/substrate-bindings";
38
183
  var remToUnit = (rem) => Number(rem.slice(0, rem.length - 3)) * parseFloat(getComputedStyle(document.documentElement).fontSize);
39
184
  var planckToUnit = (val, units) => new BigNumber2(
40
185
  val.dividedBy(new BigNumber2(10).exponentiatedBy(units)).toFixed(units)
@@ -64,10 +209,8 @@ var localStorageOrDefault = (key, _default, parse = false) => {
64
209
  };
65
210
  var isValidAddress = (address) => {
66
211
  try {
67
- if (isHex(address)) {
68
- return true;
69
- }
70
- decodeAddress2(address);
212
+ const codec = AccountId2();
213
+ codec.dec(codec.enc(address));
71
214
  return true;
72
215
  } catch (e) {
73
216
  return false;
package/util/index.cjs DELETED
@@ -1,23 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from === "object" || typeof from === "function") {
7
- for (let key of __getOwnPropNames(from))
8
- if (!__hasOwnProp.call(to, key) && key !== except)
9
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
- }
11
- return to;
12
- };
13
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
-
16
- // src/util/index.ts
17
- var util_exports = {};
18
- module.exports = __toCommonJS(util_exports);
19
- __reExport(util_exports, require("@polkadot/util"), module.exports);
20
- // Annotate the CommonJS export names for ESM import in node:
21
- 0 && (module.exports = {
22
- ...require("@polkadot/util")
23
- });
package/util/index.d.cts DELETED
@@ -1,2 +0,0 @@
1
- export * from '@polkadot/util';
2
- import '@polkadot/util-crypto';
package/util/index.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export * from '@polkadot/util';
2
- import '@polkadot/util-crypto';
package/util/index.js DELETED
@@ -1,2 +0,0 @@
1
- // src/util/index.ts
2
- export * from "@polkadot/util";
@@ -1,23 +0,0 @@
1
- var __defProp = Object.defineProperty;
2
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
3
- var __getOwnPropNames = Object.getOwnPropertyNames;
4
- var __hasOwnProp = Object.prototype.hasOwnProperty;
5
- var __copyProps = (to, from, except, desc) => {
6
- if (from && typeof from === "object" || typeof from === "function") {
7
- for (let key of __getOwnPropNames(from))
8
- if (!__hasOwnProp.call(to, key) && key !== except)
9
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
10
- }
11
- return to;
12
- };
13
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
14
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
15
-
16
- // src/util-crypto/index.ts
17
- var util_crypto_exports = {};
18
- module.exports = __toCommonJS(util_crypto_exports);
19
- __reExport(util_crypto_exports, require("@polkadot/util-crypto"), module.exports);
20
- // Annotate the CommonJS export names for ESM import in node:
21
- 0 && (module.exports = {
22
- ...require("@polkadot/util-crypto")
23
- });
@@ -1 +0,0 @@
1
- export * from '@polkadot/util-crypto';
@@ -1 +0,0 @@
1
- export * from '@polkadot/util-crypto';
@@ -1,2 +0,0 @@
1
- // src/util-crypto/index.ts
2
- export * from "@polkadot/util-crypto";