@hybrd/utils 0.3.4
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/LICENSE.md +21 -0
- package/README.md +21 -0
- package/dist/index.cjs +141 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +104 -0
- package/dist/index.js.map +1 -0
- package/package.json +53 -0
package/LICENSE.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) [2023] [Hybrid INC]
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# @hybrd/utils
|
|
2
|
+
|
|
3
|
+
Solidity + TypeScript Framework for rapid Web3 development.
|
|
4
|
+
|
|
5
|
+
## Documentation
|
|
6
|
+
|
|
7
|
+
For full documentation and examples, visit [hybrid.dev](https://hybrid.dev).
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```sh
|
|
12
|
+
npm install hybrid
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
## Community
|
|
16
|
+
|
|
17
|
+
Check out the following places for more wagmi-related content:
|
|
18
|
+
|
|
19
|
+
- Join the discussions on [Discord](https://discord.gg/CfrVhsVhfc)
|
|
20
|
+
- Follow [@hybrid\_\_dev](https://twitter.com/hybrid__dev) on Twitter for project updates
|
|
21
|
+
- Contribute or fork on [GitHub](https://github.com/ian/hybrid)
|
package/dist/index.cjs
ADDED
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
var __create = Object.create;
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __defProps = Object.defineProperties;
|
|
4
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
9
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
10
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
11
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
12
|
+
var __spreadValues = (a, b) => {
|
|
13
|
+
for (var prop in b || (b = {}))
|
|
14
|
+
if (__hasOwnProp.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
if (__getOwnPropSymbols)
|
|
17
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
18
|
+
if (__propIsEnum.call(b, prop))
|
|
19
|
+
__defNormalProp(a, prop, b[prop]);
|
|
20
|
+
}
|
|
21
|
+
return a;
|
|
22
|
+
};
|
|
23
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
24
|
+
var __export = (target, all) => {
|
|
25
|
+
for (var name in all)
|
|
26
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
27
|
+
};
|
|
28
|
+
var __copyProps = (to, from, except, desc) => {
|
|
29
|
+
if (from && typeof from === "object" || typeof from === "function") {
|
|
30
|
+
for (let key of __getOwnPropNames(from))
|
|
31
|
+
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
32
|
+
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
33
|
+
}
|
|
34
|
+
return to;
|
|
35
|
+
};
|
|
36
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
37
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
38
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
39
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
40
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
41
|
+
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
42
|
+
mod
|
|
43
|
+
));
|
|
44
|
+
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
45
|
+
var __async = (__this, __arguments, generator) => {
|
|
46
|
+
return new Promise((resolve, reject) => {
|
|
47
|
+
var fulfilled = (value) => {
|
|
48
|
+
try {
|
|
49
|
+
step(generator.next(value));
|
|
50
|
+
} catch (e) {
|
|
51
|
+
reject(e);
|
|
52
|
+
}
|
|
53
|
+
};
|
|
54
|
+
var rejected = (value) => {
|
|
55
|
+
try {
|
|
56
|
+
step(generator.throw(value));
|
|
57
|
+
} catch (e) {
|
|
58
|
+
reject(e);
|
|
59
|
+
}
|
|
60
|
+
};
|
|
61
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
62
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
63
|
+
});
|
|
64
|
+
};
|
|
65
|
+
|
|
66
|
+
// src/index.ts
|
|
67
|
+
var src_exports = {};
|
|
68
|
+
__export(src_exports, {
|
|
69
|
+
etherscanAddressURL: () => etherscanAddressURL,
|
|
70
|
+
etherscanHost: () => etherscanHost,
|
|
71
|
+
etherscanTxURL: () => etherscanTxURL,
|
|
72
|
+
readConfig: () => readConfig,
|
|
73
|
+
writeConfig: () => writeConfig
|
|
74
|
+
});
|
|
75
|
+
module.exports = __toCommonJS(src_exports);
|
|
76
|
+
|
|
77
|
+
// src/config.ts
|
|
78
|
+
var import_fs = __toESM(require("fs"), 1);
|
|
79
|
+
var readConfig = (target) => {
|
|
80
|
+
const file = target === "dev" ? "cache/dev.json" : target + ".json";
|
|
81
|
+
try {
|
|
82
|
+
return JSON.parse(
|
|
83
|
+
import_fs.default.readFileSync(process.cwd() + "/.hybrid/" + file).toString()
|
|
84
|
+
);
|
|
85
|
+
} catch (e) {
|
|
86
|
+
return {};
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
var writeConfig = (target, chainId, contractName, deployment, contract) => __async(void 0, null, function* () {
|
|
90
|
+
const file = target === "dev" ? "cache/dev.json" : target + ".json";
|
|
91
|
+
const json = yield readConfig(target);
|
|
92
|
+
yield import_fs.default.writeFileSync(
|
|
93
|
+
process.cwd() + "/.hybrid/" + file,
|
|
94
|
+
JSON.stringify(
|
|
95
|
+
__spreadProps(__spreadValues({}, json), {
|
|
96
|
+
[contractName]: __spreadValues({
|
|
97
|
+
chainId,
|
|
98
|
+
abi: contract.abi,
|
|
99
|
+
bytecode: contract.bytecode
|
|
100
|
+
}, deployment)
|
|
101
|
+
}),
|
|
102
|
+
null,
|
|
103
|
+
2
|
|
104
|
+
)
|
|
105
|
+
);
|
|
106
|
+
});
|
|
107
|
+
|
|
108
|
+
// src/etherscan.ts
|
|
109
|
+
function etherscanAddressURL(address, chainId = 1) {
|
|
110
|
+
return etherscanHost(chainId) + "/address/" + address;
|
|
111
|
+
}
|
|
112
|
+
function etherscanTxURL(hash, chainId = 1) {
|
|
113
|
+
return etherscanHost(chainId) + "/tx/" + hash;
|
|
114
|
+
}
|
|
115
|
+
function etherscanHost(chainId = 1) {
|
|
116
|
+
switch (chainId) {
|
|
117
|
+
case 1:
|
|
118
|
+
return `https://etherscan.io`;
|
|
119
|
+
case 3:
|
|
120
|
+
return `https://ropsten.etherscan.io`;
|
|
121
|
+
case 4:
|
|
122
|
+
return `https://rinkeby.etherscan.io`;
|
|
123
|
+
case 5:
|
|
124
|
+
return `https://goerli.etherscan.io`;
|
|
125
|
+
case 137:
|
|
126
|
+
return `https://polygonscan.com`;
|
|
127
|
+
case 80001:
|
|
128
|
+
return `https://mumbai.polygonscan.com`;
|
|
129
|
+
default:
|
|
130
|
+
throw new Error("Etherscan: Unknown chain id " + chainId);
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
// Annotate the CommonJS export names for ESM import in node:
|
|
134
|
+
0 && (module.exports = {
|
|
135
|
+
etherscanAddressURL,
|
|
136
|
+
etherscanHost,
|
|
137
|
+
etherscanTxURL,
|
|
138
|
+
readConfig,
|
|
139
|
+
writeConfig
|
|
140
|
+
});
|
|
141
|
+
//# sourceMappingURL=index.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/config.ts","../src/etherscan.ts"],"sourcesContent":["export * from \"./config\"\nexport * from \"./etherscan\"\n","import fs from \"fs\"\nimport { CompiledContract, DeployTarget, Deployment } from \"@hybrd/types\"\n\nexport const readConfig = (target: DeployTarget | \"dev\") => {\n const file = target === \"dev\" ? \"cache/dev.json\" : target + \".json\"\n try {\n return JSON.parse(\n fs.readFileSync(process.cwd() + \"/.hybrid/\" + file).toString()\n )\n } catch {\n return {}\n }\n}\n\nexport const writeConfig = async (\n target: DeployTarget | \"dev\",\n chainId: number,\n contractName: string,\n deployment: Deployment,\n contract: CompiledContract\n) => {\n const file = target === \"dev\" ? \"cache/dev.json\" : target + \".json\"\n\n // Load the existing config\n const json = await readConfig(target)\n\n // Rewrite the config, overwriting the newly deployed contract\n await fs.writeFileSync(\n process.cwd() + \"/.hybrid/\" + file,\n JSON.stringify(\n {\n ...json,\n [contractName]: {\n chainId: chainId,\n abi: contract.abi,\n bytecode: contract.bytecode,\n ...deployment\n }\n },\n null,\n 2\n )\n )\n}\n","export function etherscanAddressURL(address: string, chainId = 1) {\n return etherscanHost(chainId) + \"/address/\" + address\n}\n\nexport function etherscanTxURL(hash: string, chainId = 1) {\n return etherscanHost(chainId) + \"/tx/\" + hash\n}\n\nexport function etherscanHost(chainId = 1) {\n switch (chainId) {\n case 1:\n return `https://etherscan.io`\n case 3:\n return `https://ropsten.etherscan.io`\n case 4:\n return `https://rinkeby.etherscan.io`\n case 5:\n return `https://goerli.etherscan.io`\n case 137:\n return `https://polygonscan.com`\n case 80001:\n return `https://mumbai.polygonscan.com`\n default:\n throw new Error(\"Etherscan: Unknown chain id \" + chainId)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,gBAAe;AAGR,IAAM,aAAa,CAAC,WAAiC;AAC1D,QAAM,OAAO,WAAW,QAAQ,mBAAmB,SAAS;AAC5D,MAAI;AACF,WAAO,KAAK;AAAA,MACV,UAAAA,QAAG,aAAa,QAAQ,IAAI,IAAI,cAAc,IAAI,EAAE,SAAS;AAAA,IAC/D;AAAA,EACF,SAAQ,GAAN;AACA,WAAO,CAAC;AAAA,EACV;AACF;AAEO,IAAM,cAAc,CACzB,QACA,SACA,cACA,YACA,aACG;AACH,QAAM,OAAO,WAAW,QAAQ,mBAAmB,SAAS;AAG5D,QAAM,OAAO,MAAM,WAAW,MAAM;AAGpC,QAAM,UAAAA,QAAG;AAAA,IACP,QAAQ,IAAI,IAAI,cAAc;AAAA,IAC9B,KAAK;AAAA,MACH,iCACK,OADL;AAAA,QAEE,CAAC,YAAY,GAAG;AAAA,UACd;AAAA,UACA,KAAK,SAAS;AAAA,UACd,UAAU,SAAS;AAAA,WAChB;AAAA,MAEP;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;;;AC3CO,SAAS,oBAAoB,SAAiB,UAAU,GAAG;AAChE,SAAO,cAAc,OAAO,IAAI,cAAc;AAChD;AAEO,SAAS,eAAe,MAAc,UAAU,GAAG;AACxD,SAAO,cAAc,OAAO,IAAI,SAAS;AAC3C;AAEO,SAAS,cAAc,UAAU,GAAG;AACzC,UAAQ,SAAS;AAAA,IACf,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT;AACE,YAAM,IAAI,MAAM,iCAAiC,OAAO;AAAA,EAC5D;AACF;","names":["fs"]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { DeployTarget, Deployment, CompiledContract } from '@hybrd/types';
|
|
2
|
+
|
|
3
|
+
declare const readConfig: (target: DeployTarget | "dev") => any;
|
|
4
|
+
declare const writeConfig: (target: DeployTarget | "dev", chainId: number, contractName: string, deployment: Deployment, contract: CompiledContract) => Promise<void>;
|
|
5
|
+
|
|
6
|
+
declare function etherscanAddressURL(address: string, chainId?: number): string;
|
|
7
|
+
declare function etherscanTxURL(hash: string, chainId?: number): string;
|
|
8
|
+
declare function etherscanHost(chainId?: number): "https://etherscan.io" | "https://ropsten.etherscan.io" | "https://rinkeby.etherscan.io" | "https://goerli.etherscan.io" | "https://polygonscan.com" | "https://mumbai.polygonscan.com";
|
|
9
|
+
|
|
10
|
+
export { etherscanAddressURL, etherscanHost, etherscanTxURL, readConfig, writeConfig };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
var __defProp = Object.defineProperty;
|
|
2
|
+
var __defProps = Object.defineProperties;
|
|
3
|
+
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
4
|
+
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
5
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
6
|
+
var __propIsEnum = Object.prototype.propertyIsEnumerable;
|
|
7
|
+
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
8
|
+
var __spreadValues = (a, b) => {
|
|
9
|
+
for (var prop in b || (b = {}))
|
|
10
|
+
if (__hasOwnProp.call(b, prop))
|
|
11
|
+
__defNormalProp(a, prop, b[prop]);
|
|
12
|
+
if (__getOwnPropSymbols)
|
|
13
|
+
for (var prop of __getOwnPropSymbols(b)) {
|
|
14
|
+
if (__propIsEnum.call(b, prop))
|
|
15
|
+
__defNormalProp(a, prop, b[prop]);
|
|
16
|
+
}
|
|
17
|
+
return a;
|
|
18
|
+
};
|
|
19
|
+
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
20
|
+
var __async = (__this, __arguments, generator) => {
|
|
21
|
+
return new Promise((resolve, reject) => {
|
|
22
|
+
var fulfilled = (value) => {
|
|
23
|
+
try {
|
|
24
|
+
step(generator.next(value));
|
|
25
|
+
} catch (e) {
|
|
26
|
+
reject(e);
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
var rejected = (value) => {
|
|
30
|
+
try {
|
|
31
|
+
step(generator.throw(value));
|
|
32
|
+
} catch (e) {
|
|
33
|
+
reject(e);
|
|
34
|
+
}
|
|
35
|
+
};
|
|
36
|
+
var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
|
|
37
|
+
step((generator = generator.apply(__this, __arguments)).next());
|
|
38
|
+
});
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
// src/config.ts
|
|
42
|
+
import fs from "fs";
|
|
43
|
+
var readConfig = (target) => {
|
|
44
|
+
const file = target === "dev" ? "cache/dev.json" : target + ".json";
|
|
45
|
+
try {
|
|
46
|
+
return JSON.parse(
|
|
47
|
+
fs.readFileSync(process.cwd() + "/.hybrid/" + file).toString()
|
|
48
|
+
);
|
|
49
|
+
} catch (e) {
|
|
50
|
+
return {};
|
|
51
|
+
}
|
|
52
|
+
};
|
|
53
|
+
var writeConfig = (target, chainId, contractName, deployment, contract) => __async(void 0, null, function* () {
|
|
54
|
+
const file = target === "dev" ? "cache/dev.json" : target + ".json";
|
|
55
|
+
const json = yield readConfig(target);
|
|
56
|
+
yield fs.writeFileSync(
|
|
57
|
+
process.cwd() + "/.hybrid/" + file,
|
|
58
|
+
JSON.stringify(
|
|
59
|
+
__spreadProps(__spreadValues({}, json), {
|
|
60
|
+
[contractName]: __spreadValues({
|
|
61
|
+
chainId,
|
|
62
|
+
abi: contract.abi,
|
|
63
|
+
bytecode: contract.bytecode
|
|
64
|
+
}, deployment)
|
|
65
|
+
}),
|
|
66
|
+
null,
|
|
67
|
+
2
|
|
68
|
+
)
|
|
69
|
+
);
|
|
70
|
+
});
|
|
71
|
+
|
|
72
|
+
// src/etherscan.ts
|
|
73
|
+
function etherscanAddressURL(address, chainId = 1) {
|
|
74
|
+
return etherscanHost(chainId) + "/address/" + address;
|
|
75
|
+
}
|
|
76
|
+
function etherscanTxURL(hash, chainId = 1) {
|
|
77
|
+
return etherscanHost(chainId) + "/tx/" + hash;
|
|
78
|
+
}
|
|
79
|
+
function etherscanHost(chainId = 1) {
|
|
80
|
+
switch (chainId) {
|
|
81
|
+
case 1:
|
|
82
|
+
return `https://etherscan.io`;
|
|
83
|
+
case 3:
|
|
84
|
+
return `https://ropsten.etherscan.io`;
|
|
85
|
+
case 4:
|
|
86
|
+
return `https://rinkeby.etherscan.io`;
|
|
87
|
+
case 5:
|
|
88
|
+
return `https://goerli.etherscan.io`;
|
|
89
|
+
case 137:
|
|
90
|
+
return `https://polygonscan.com`;
|
|
91
|
+
case 80001:
|
|
92
|
+
return `https://mumbai.polygonscan.com`;
|
|
93
|
+
default:
|
|
94
|
+
throw new Error("Etherscan: Unknown chain id " + chainId);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
export {
|
|
98
|
+
etherscanAddressURL,
|
|
99
|
+
etherscanHost,
|
|
100
|
+
etherscanTxURL,
|
|
101
|
+
readConfig,
|
|
102
|
+
writeConfig
|
|
103
|
+
};
|
|
104
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/config.ts","../src/etherscan.ts"],"sourcesContent":["import fs from \"fs\"\nimport { CompiledContract, DeployTarget, Deployment } from \"@hybrd/types\"\n\nexport const readConfig = (target: DeployTarget | \"dev\") => {\n const file = target === \"dev\" ? \"cache/dev.json\" : target + \".json\"\n try {\n return JSON.parse(\n fs.readFileSync(process.cwd() + \"/.hybrid/\" + file).toString()\n )\n } catch {\n return {}\n }\n}\n\nexport const writeConfig = async (\n target: DeployTarget | \"dev\",\n chainId: number,\n contractName: string,\n deployment: Deployment,\n contract: CompiledContract\n) => {\n const file = target === \"dev\" ? \"cache/dev.json\" : target + \".json\"\n\n // Load the existing config\n const json = await readConfig(target)\n\n // Rewrite the config, overwriting the newly deployed contract\n await fs.writeFileSync(\n process.cwd() + \"/.hybrid/\" + file,\n JSON.stringify(\n {\n ...json,\n [contractName]: {\n chainId: chainId,\n abi: contract.abi,\n bytecode: contract.bytecode,\n ...deployment\n }\n },\n null,\n 2\n )\n )\n}\n","export function etherscanAddressURL(address: string, chainId = 1) {\n return etherscanHost(chainId) + \"/address/\" + address\n}\n\nexport function etherscanTxURL(hash: string, chainId = 1) {\n return etherscanHost(chainId) + \"/tx/\" + hash\n}\n\nexport function etherscanHost(chainId = 1) {\n switch (chainId) {\n case 1:\n return `https://etherscan.io`\n case 3:\n return `https://ropsten.etherscan.io`\n case 4:\n return `https://rinkeby.etherscan.io`\n case 5:\n return `https://goerli.etherscan.io`\n case 137:\n return `https://polygonscan.com`\n case 80001:\n return `https://mumbai.polygonscan.com`\n default:\n throw new Error(\"Etherscan: Unknown chain id \" + chainId)\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,QAAQ;AAGR,IAAM,aAAa,CAAC,WAAiC;AAC1D,QAAM,OAAO,WAAW,QAAQ,mBAAmB,SAAS;AAC5D,MAAI;AACF,WAAO,KAAK;AAAA,MACV,GAAG,aAAa,QAAQ,IAAI,IAAI,cAAc,IAAI,EAAE,SAAS;AAAA,IAC/D;AAAA,EACF,SAAQ,GAAN;AACA,WAAO,CAAC;AAAA,EACV;AACF;AAEO,IAAM,cAAc,CACzB,QACA,SACA,cACA,YACA,aACG;AACH,QAAM,OAAO,WAAW,QAAQ,mBAAmB,SAAS;AAG5D,QAAM,OAAO,MAAM,WAAW,MAAM;AAGpC,QAAM,GAAG;AAAA,IACP,QAAQ,IAAI,IAAI,cAAc;AAAA,IAC9B,KAAK;AAAA,MACH,iCACK,OADL;AAAA,QAEE,CAAC,YAAY,GAAG;AAAA,UACd;AAAA,UACA,KAAK,SAAS;AAAA,UACd,UAAU,SAAS;AAAA,WAChB;AAAA,MAEP;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAAA,EACF;AACF;;;AC3CO,SAAS,oBAAoB,SAAiB,UAAU,GAAG;AAChE,SAAO,cAAc,OAAO,IAAI,cAAc;AAChD;AAEO,SAAS,eAAe,MAAc,UAAU,GAAG;AACxD,SAAO,cAAc,OAAO,IAAI,SAAS;AAC3C;AAEO,SAAS,cAAc,UAAU,GAAG;AACzC,UAAQ,SAAS;AAAA,IACf,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT,KAAK;AACH,aAAO;AAAA,IACT;AACE,YAAM,IAAI,MAAM,iCAAiC,OAAO;AAAA,EAC5D;AACF;","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@hybrd/utils",
|
|
3
|
+
"version": "0.3.4",
|
|
4
|
+
"description": "Solidity + TypeScript Framework for Web3 Development",
|
|
5
|
+
"author": "Ian Hunter <ian@ianh.xyz>",
|
|
6
|
+
"homepage": "https://github.com/ian/hybrid#readme",
|
|
7
|
+
"license": "ISC",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"main": "./dist/index.cjs",
|
|
10
|
+
"module": "./dist/index.js",
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"files": [
|
|
13
|
+
"dist"
|
|
14
|
+
],
|
|
15
|
+
"repository": {
|
|
16
|
+
"type": "git",
|
|
17
|
+
"url": "git+https://github.com/ian/hybrid.git"
|
|
18
|
+
},
|
|
19
|
+
"scripts": {
|
|
20
|
+
"clean": "rm -rf dist",
|
|
21
|
+
"build": "tsup",
|
|
22
|
+
"dev": "nodemon"
|
|
23
|
+
},
|
|
24
|
+
"bugs": {
|
|
25
|
+
"url": "https://github.com/ian/hybrid/issues"
|
|
26
|
+
},
|
|
27
|
+
"dependencies": {
|
|
28
|
+
"abitype": "^0.7.1",
|
|
29
|
+
"bip39": "^3.1.0",
|
|
30
|
+
"chalk": "4.1.2",
|
|
31
|
+
"checksum": "^1.0.0",
|
|
32
|
+
"chokidar": "^3.5.3",
|
|
33
|
+
"commander": "^10.0.0",
|
|
34
|
+
"ethereum-private-key-to-address": "^0.0.7",
|
|
35
|
+
"ethers": "^6.1.0",
|
|
36
|
+
"figlet": "^1.5.2",
|
|
37
|
+
"inquirer": "^9.1.4",
|
|
38
|
+
"open": "^8.4.2",
|
|
39
|
+
"ora": "5.4.0",
|
|
40
|
+
"socket.io": "^4.6.1",
|
|
41
|
+
"viem": "^0.1.10"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"@hybrd/types": "^0.3.4",
|
|
45
|
+
"@types/inquirer": "^9.0.3",
|
|
46
|
+
"@types/node": "^18.14.6",
|
|
47
|
+
"nodemon": "^2.0.21",
|
|
48
|
+
"tsup": "^6.6.3",
|
|
49
|
+
"tsx": "^3.12.3",
|
|
50
|
+
"typescript": "^4.9.5"
|
|
51
|
+
},
|
|
52
|
+
"gitHead": "6f68e90dabc628f067f338766b43e0fa8c4192ac"
|
|
53
|
+
}
|