@certik/skynet 0.22.0 → 0.22.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/address.js CHANGED
@@ -1,69 +1,23 @@
1
- // @bun
2
- var __create = Object.create;
3
- var __getProtoOf = Object.getPrototypeOf;
4
- var __defProp = Object.defineProperty;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
7
- var __hasOwnProp = Object.prototype.hasOwnProperty;
8
- var __toESM = (mod, isNodeMode, target) => {
9
- target = mod != null ? __create(__getProtoOf(mod)) : {};
10
- const to = isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target;
11
- for (let key of __getOwnPropNames(mod))
12
- if (!__hasOwnProp.call(to, key))
13
- __defProp(to, key, {
14
- get: () => mod[key],
15
- enumerable: true
16
- });
17
- return to;
18
- };
19
- var __moduleCache = /* @__PURE__ */ new WeakMap;
20
- var __toCommonJS = (from) => {
21
- var entry = __moduleCache.get(from), desc;
22
- if (entry)
23
- return entry;
24
- entry = __defProp({}, "__esModule", { value: true });
25
- if (from && typeof from === "object" || typeof from === "function")
26
- __getOwnPropNames(from).map((key) => !__hasOwnProp.call(entry, key) && __defProp(entry, key, {
27
- get: () => from[key],
28
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
29
- }));
30
- __moduleCache.set(from, entry);
31
- return entry;
32
- };
33
- var __commonJS = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
34
- var __export = (target, all) => {
35
- for (var name in all)
36
- __defProp(target, name, {
37
- get: all[name],
38
- enumerable: true,
39
- configurable: true,
40
- set: (newValue) => all[name] = () => newValue
41
- });
42
- };
43
- var __esm = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
44
- var __require = import.meta.require;
45
-
46
- // address.ts
47
- function parseAddress(address) {
48
- const separatorIndex = address.indexOf(":");
49
- let protocolPart;
50
- let addressPart;
51
- if (separatorIndex === -1) {
52
- protocolPart = "eth";
53
- addressPart = address;
54
- } else {
55
- protocolPart = address.slice(0, separatorIndex);
56
- addressPart = address.slice(separatorIndex + 1);
57
- }
58
- if (addressPart.startsWith("0x")) {
59
- addressPart = addressPart.toLowerCase();
60
- }
61
- return [protocolPart, addressPart];
1
+ export function parseAddress(address) {
2
+ // in case of address has multiple colons, we only split the first one
3
+ const separatorIndex = address.indexOf(":");
4
+ let protocolPart;
5
+ let addressPart;
6
+ if (separatorIndex === -1) {
7
+ // if there is no colon, we assume it is an ethereum address
8
+ protocolPart = "eth";
9
+ addressPart = address;
10
+ }
11
+ else {
12
+ protocolPart = address.slice(0, separatorIndex);
13
+ addressPart = address.slice(separatorIndex + 1);
14
+ }
15
+ if (addressPart.startsWith("0x")) {
16
+ // We only lowercase the address part if it starts with 0x, otherwise it is a case-sensitive address (such as tron)
17
+ addressPart = addressPart.toLowerCase();
18
+ }
19
+ return [protocolPart, addressPart];
62
20
  }
63
- function composeAddress(protocol, addr) {
64
- return `${protocol}:${addr}`;
21
+ export function composeAddress(protocol, addr) {
22
+ return `${protocol}:${addr}`;
65
23
  }
66
- export {
67
- parseAddress,
68
- composeAddress
69
- };