@hybrd/utils 0.6.0 → 0.7.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/dist/index.cjs +64 -123
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +3118 -3
- package/dist/index.js +126 -99
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.cjs
CHANGED
|
@@ -19,6 +19,38 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
19
19
|
// src/index.ts
|
|
20
20
|
var src_exports = {};
|
|
21
21
|
__export(src_exports, {
|
|
22
|
+
CHAINS: () => CHAINS,
|
|
23
|
+
CHAIN_NAMES: () => CHAIN_NAMES,
|
|
24
|
+
bipsToDecimal: () => bipsToDecimal,
|
|
25
|
+
bipsToPercent: () => bipsToPercent,
|
|
26
|
+
chainForStage: () => chainForStage,
|
|
27
|
+
etherscanAddressURL: () => etherscanAddressURL,
|
|
28
|
+
etherscanHost: () => etherscanHost,
|
|
29
|
+
etherscanTxURL: () => etherscanTxURL,
|
|
30
|
+
getChainById: () => getChainById,
|
|
31
|
+
percentToBips: () => percentToBips,
|
|
32
|
+
truncateEthAddress: () => truncateEthAddress
|
|
33
|
+
});
|
|
34
|
+
module.exports = __toCommonJS(src_exports);
|
|
35
|
+
|
|
36
|
+
// src/basisPoints.ts
|
|
37
|
+
function bipsToPercent(bp) {
|
|
38
|
+
if (typeof bp !== "number")
|
|
39
|
+
return null;
|
|
40
|
+
return parseInt(bp.toString()) / 100;
|
|
41
|
+
}
|
|
42
|
+
function percentToBips(percent) {
|
|
43
|
+
return percent * 100;
|
|
44
|
+
}
|
|
45
|
+
function bipsToDecimal(bp) {
|
|
46
|
+
if (typeof bp !== "number")
|
|
47
|
+
return 0;
|
|
48
|
+
return parseInt(bp.toString()) / 1e4;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// ../../node_modules/wagmi/dist/chains.js
|
|
52
|
+
var chains_exports = {};
|
|
53
|
+
__export(chains_exports, {
|
|
22
54
|
arbitrum: () => arbitrum,
|
|
23
55
|
arbitrumGoerli: () => arbitrumGoerli,
|
|
24
56
|
aurora: () => aurora,
|
|
@@ -26,8 +58,6 @@ __export(src_exports, {
|
|
|
26
58
|
avalanche: () => avalanche,
|
|
27
59
|
avalancheFuji: () => avalancheFuji,
|
|
28
60
|
baseGoerli: () => baseGoerli,
|
|
29
|
-
bipsToDecimal: () => bipsToDecimal,
|
|
30
|
-
bipsToPercent: () => bipsToPercent,
|
|
31
61
|
boba: () => boba,
|
|
32
62
|
bronos: () => bronos,
|
|
33
63
|
bronosTestnet: () => bronosTestnet,
|
|
@@ -36,14 +66,10 @@ __export(src_exports, {
|
|
|
36
66
|
canto: () => canto,
|
|
37
67
|
celo: () => celo,
|
|
38
68
|
celoAlfajores: () => celoAlfajores,
|
|
39
|
-
chainName: () => chainName,
|
|
40
69
|
cronos: () => cronos,
|
|
41
70
|
crossbell: () => crossbell,
|
|
42
71
|
dfk: () => dfk,
|
|
43
72
|
dogechain: () => dogechain,
|
|
44
|
-
etherscanAddressURL: () => etherscanAddressURL,
|
|
45
|
-
etherscanHost: () => etherscanHost,
|
|
46
|
-
etherscanTxURL: () => etherscanTxURL,
|
|
47
73
|
evmos: () => evmos,
|
|
48
74
|
evmosTestnet: () => evmosTestnet,
|
|
49
75
|
fantom: () => fantom,
|
|
@@ -73,7 +99,6 @@ __export(src_exports, {
|
|
|
73
99
|
okc: () => okc,
|
|
74
100
|
optimism: () => optimism,
|
|
75
101
|
optimismGoerli: () => optimismGoerli,
|
|
76
|
-
percentToBips: () => percentToBips,
|
|
77
102
|
polygon: () => polygon,
|
|
78
103
|
polygonMumbai: () => polygonMumbai,
|
|
79
104
|
polygonZkEvm: () => polygonZkEvm,
|
|
@@ -102,7 +127,6 @@ __export(src_exports, {
|
|
|
102
127
|
taraxaTestnet: () => taraxaTestnet,
|
|
103
128
|
telos: () => telos,
|
|
104
129
|
telosTestnet: () => telosTestnet,
|
|
105
|
-
truncateEthAddress: () => truncateEthAddress,
|
|
106
130
|
wanchain: () => wanchain,
|
|
107
131
|
wanchainTestnet: () => wanchainTestnet,
|
|
108
132
|
xdc: () => xdc,
|
|
@@ -111,22 +135,6 @@ __export(src_exports, {
|
|
|
111
135
|
zkSync: () => zkSync,
|
|
112
136
|
zkSyncTestnet: () => zkSyncTestnet
|
|
113
137
|
});
|
|
114
|
-
module.exports = __toCommonJS(src_exports);
|
|
115
|
-
|
|
116
|
-
// src/basisPoints.ts
|
|
117
|
-
function bipsToPercent(bp) {
|
|
118
|
-
if (typeof bp !== "number")
|
|
119
|
-
return null;
|
|
120
|
-
return parseInt(bp.toString()) / 100;
|
|
121
|
-
}
|
|
122
|
-
function percentToBips(percent) {
|
|
123
|
-
return percent * 100;
|
|
124
|
-
}
|
|
125
|
-
function bipsToDecimal(bp) {
|
|
126
|
-
if (typeof bp !== "number")
|
|
127
|
-
return 0;
|
|
128
|
-
return parseInt(bp.toString()) / 1e4;
|
|
129
|
-
}
|
|
130
138
|
|
|
131
139
|
// ../../node_modules/@wagmi/core/node_modules/@wagmi/chains/dist/index.mjs
|
|
132
140
|
var arbitrum = {
|
|
@@ -2237,21 +2245,34 @@ var zkSyncTestnet = {
|
|
|
2237
2245
|
};
|
|
2238
2246
|
|
|
2239
2247
|
// src/chains.ts
|
|
2240
|
-
|
|
2241
|
-
|
|
2242
|
-
|
|
2243
|
-
|
|
2244
|
-
|
|
2245
|
-
|
|
2246
|
-
|
|
2247
|
-
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2252
|
-
|
|
2253
|
-
|
|
2248
|
+
var CHAINS = {
|
|
2249
|
+
ethereum: [mainnet, goerli],
|
|
2250
|
+
polygon: [polygon, polygonMumbai],
|
|
2251
|
+
arbitrum: [arbitrum, arbitrumGoerli],
|
|
2252
|
+
optimism: [optimism, optimismGoerli],
|
|
2253
|
+
base: [void 0, baseGoerli],
|
|
2254
|
+
localhost: [localhost, localhost]
|
|
2255
|
+
};
|
|
2256
|
+
var CHAIN_NAMES = Object.keys(CHAINS);
|
|
2257
|
+
var chainForStage = (chainName, stage) => {
|
|
2258
|
+
const chains = CHAINS[chainName];
|
|
2259
|
+
if (!chains)
|
|
2260
|
+
throw new Error("Unknown chain: " + chainName);
|
|
2261
|
+
const [test, prod] = chains;
|
|
2262
|
+
switch (stage) {
|
|
2263
|
+
case "test":
|
|
2264
|
+
return test;
|
|
2265
|
+
case "prod":
|
|
2266
|
+
return prod;
|
|
2267
|
+
default:
|
|
2268
|
+
throw new Error(
|
|
2269
|
+
"Unknown deploy stage: " + stage + " (expected test|prod)"
|
|
2270
|
+
);
|
|
2254
2271
|
}
|
|
2272
|
+
};
|
|
2273
|
+
function getChainById(chainId) {
|
|
2274
|
+
const id = parseInt(chainId.toString());
|
|
2275
|
+
return Object.values(chains_exports).find((chain) => (chain == null ? void 0 : chain.id) === id);
|
|
2255
2276
|
}
|
|
2256
2277
|
|
|
2257
2278
|
// src/etherscan.ts
|
|
@@ -2285,96 +2306,16 @@ function truncateEthAddress(address) {
|
|
|
2285
2306
|
}
|
|
2286
2307
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2287
2308
|
0 && (module.exports = {
|
|
2288
|
-
|
|
2289
|
-
|
|
2290
|
-
aurora,
|
|
2291
|
-
auroraTestnet,
|
|
2292
|
-
avalanche,
|
|
2293
|
-
avalancheFuji,
|
|
2294
|
-
baseGoerli,
|
|
2309
|
+
CHAINS,
|
|
2310
|
+
CHAIN_NAMES,
|
|
2295
2311
|
bipsToDecimal,
|
|
2296
2312
|
bipsToPercent,
|
|
2297
|
-
|
|
2298
|
-
bronos,
|
|
2299
|
-
bronosTestnet,
|
|
2300
|
-
bsc,
|
|
2301
|
-
bscTestnet,
|
|
2302
|
-
canto,
|
|
2303
|
-
celo,
|
|
2304
|
-
celoAlfajores,
|
|
2305
|
-
chainName,
|
|
2306
|
-
cronos,
|
|
2307
|
-
crossbell,
|
|
2308
|
-
dfk,
|
|
2309
|
-
dogechain,
|
|
2313
|
+
chainForStage,
|
|
2310
2314
|
etherscanAddressURL,
|
|
2311
2315
|
etherscanHost,
|
|
2312
2316
|
etherscanTxURL,
|
|
2313
|
-
|
|
2314
|
-
evmosTestnet,
|
|
2315
|
-
fantom,
|
|
2316
|
-
fantomTestnet,
|
|
2317
|
-
filecoin,
|
|
2318
|
-
filecoinCalibration,
|
|
2319
|
-
filecoinHyperspace,
|
|
2320
|
-
flare,
|
|
2321
|
-
flareTestnet,
|
|
2322
|
-
foundry,
|
|
2323
|
-
gnosis,
|
|
2324
|
-
gnosisChiado,
|
|
2325
|
-
goerli,
|
|
2326
|
-
hardhat,
|
|
2327
|
-
harmonyOne,
|
|
2328
|
-
iotex,
|
|
2329
|
-
iotexTestnet,
|
|
2330
|
-
klaytn,
|
|
2331
|
-
localhost,
|
|
2332
|
-
mainnet,
|
|
2333
|
-
metis,
|
|
2334
|
-
metisGoerli,
|
|
2335
|
-
moonbaseAlpha,
|
|
2336
|
-
moonbeam,
|
|
2337
|
-
moonriver,
|
|
2338
|
-
nexi,
|
|
2339
|
-
okc,
|
|
2340
|
-
optimism,
|
|
2341
|
-
optimismGoerli,
|
|
2317
|
+
getChainById,
|
|
2342
2318
|
percentToBips,
|
|
2343
|
-
|
|
2344
|
-
polygonMumbai,
|
|
2345
|
-
polygonZkEvm,
|
|
2346
|
-
polygonZkEvmTestnet,
|
|
2347
|
-
scrollTestnet,
|
|
2348
|
-
sepolia,
|
|
2349
|
-
shardeumSphinx,
|
|
2350
|
-
skaleBlockBrawlers,
|
|
2351
|
-
skaleCalypso,
|
|
2352
|
-
skaleCalypsoTestnet,
|
|
2353
|
-
skaleChaosTestnet,
|
|
2354
|
-
skaleCryptoBlades,
|
|
2355
|
-
skaleCryptoColosseum,
|
|
2356
|
-
skaleEuropa,
|
|
2357
|
-
skaleEuropaTestnet,
|
|
2358
|
-
skaleExorde,
|
|
2359
|
-
skaleHumanProtocol,
|
|
2360
|
-
skaleNebula,
|
|
2361
|
-
skaleNebulaTestnet,
|
|
2362
|
-
skaleRazor,
|
|
2363
|
-
skaleTitan,
|
|
2364
|
-
skaleTitanTestnet,
|
|
2365
|
-
songbird,
|
|
2366
|
-
songbirdTestnet,
|
|
2367
|
-
taraxa,
|
|
2368
|
-
taraxaTestnet,
|
|
2369
|
-
telos,
|
|
2370
|
-
telosTestnet,
|
|
2371
|
-
truncateEthAddress,
|
|
2372
|
-
wanchain,
|
|
2373
|
-
wanchainTestnet,
|
|
2374
|
-
xdc,
|
|
2375
|
-
xdcTestnet,
|
|
2376
|
-
zhejiang,
|
|
2377
|
-
zkSync,
|
|
2378
|
-
zkSyncTestnet
|
|
2319
|
+
truncateEthAddress
|
|
2379
2320
|
});
|
|
2380
2321
|
//# sourceMappingURL=index.cjs.map
|