@phantom/utils 1.0.0-beta.4 → 1.0.2

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.d.ts CHANGED
@@ -22,4 +22,11 @@ declare function randomString(length: number): string;
22
22
  declare const getSecureTimestamp: () => Promise<number>;
23
23
  declare const getSecureTimestampSync: () => number;
24
24
 
25
- export { getSecureTimestamp, getSecureTimestampSync, randomString, randomUUID };
25
+ /**
26
+ * Network utility functions for working with blockchain network identifiers
27
+ */
28
+ declare function getChainPrefix(networkId: string): string;
29
+ declare function isEthereumChain(networkId: string): boolean;
30
+ declare function isSolanaChain(networkId: string): boolean;
31
+
32
+ export { getChainPrefix, getSecureTimestamp, getSecureTimestampSync, isEthereumChain, isSolanaChain, randomString, randomUUID };
package/dist/index.js CHANGED
@@ -20,8 +20,11 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
20
20
  // src/index.ts
21
21
  var src_exports = {};
22
22
  __export(src_exports, {
23
+ getChainPrefix: () => getChainPrefix,
23
24
  getSecureTimestamp: () => getSecureTimestamp,
24
25
  getSecureTimestampSync: () => getSecureTimestampSync,
26
+ isEthereumChain: () => isEthereumChain,
27
+ isSolanaChain: () => isSolanaChain,
25
28
  randomString: () => randomString,
26
29
  randomUUID: () => randomUUID
27
30
  });
@@ -113,10 +116,26 @@ var TimeService = class {
113
116
  var timeService = TimeService.getInstance();
114
117
  var getSecureTimestamp = () => timeService.now();
115
118
  var getSecureTimestampSync = () => timeService.nowSync();
119
+
120
+ // src/network.ts
121
+ function getChainPrefix(networkId) {
122
+ return networkId.split(":")[0].toLowerCase();
123
+ }
124
+ function isEthereumChain(networkId) {
125
+ const network = getChainPrefix(networkId);
126
+ return network === "eip155";
127
+ }
128
+ function isSolanaChain(networkId) {
129
+ const network = getChainPrefix(networkId);
130
+ return network === "solana";
131
+ }
116
132
  // Annotate the CommonJS export names for ESM import in node:
117
133
  0 && (module.exports = {
134
+ getChainPrefix,
118
135
  getSecureTimestamp,
119
136
  getSecureTimestampSync,
137
+ isEthereumChain,
138
+ isSolanaChain,
120
139
  randomString,
121
140
  randomUUID
122
141
  });
package/dist/index.mjs CHANGED
@@ -84,9 +84,25 @@ var TimeService = class {
84
84
  var timeService = TimeService.getInstance();
85
85
  var getSecureTimestamp = () => timeService.now();
86
86
  var getSecureTimestampSync = () => timeService.nowSync();
87
+
88
+ // src/network.ts
89
+ function getChainPrefix(networkId) {
90
+ return networkId.split(":")[0].toLowerCase();
91
+ }
92
+ function isEthereumChain(networkId) {
93
+ const network = getChainPrefix(networkId);
94
+ return network === "eip155";
95
+ }
96
+ function isSolanaChain(networkId) {
97
+ const network = getChainPrefix(networkId);
98
+ return network === "solana";
99
+ }
87
100
  export {
101
+ getChainPrefix,
88
102
  getSecureTimestamp,
89
103
  getSecureTimestampSync,
104
+ isEthereumChain,
105
+ isSolanaChain,
90
106
  randomString,
91
107
  randomUUID
92
108
  };
package/package.json CHANGED
@@ -1,7 +1,12 @@
1
1
  {
2
2
  "name": "@phantom/utils",
3
- "version": "1.0.0-beta.4",
3
+ "version": "1.0.2",
4
4
  "description": "Utility functions for Phantom Wallet SDK",
5
+ "repository": {
6
+ "type": "git",
7
+ "url": "https://github.com/phantom/phantom-connect-sdk",
8
+ "directory": "packages/utils"
9
+ },
5
10
  "main": "dist/index.js",
6
11
  "module": "dist/index.mjs",
7
12
  "types": "dist/index.d.ts",