@hybrd/utils 0.3.5-alpha.2 → 0.3.5-alpha.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/dist/index.cjs +2 -84
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.ts +1 -6
- package/dist/index.js +1 -74
- package/dist/index.js.map +1 -1
- package/package.json +4 -4
package/dist/index.cjs
CHANGED
|
@@ -1,26 +1,7 @@
|
|
|
1
|
-
var __create = Object.create;
|
|
2
1
|
var __defProp = Object.defineProperty;
|
|
3
|
-
var __defProps = Object.defineProperties;
|
|
4
2
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropDescs = Object.getOwnPropertyDescriptors;
|
|
6
3
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
|
-
var __getOwnPropSymbols = Object.getOwnPropertySymbols;
|
|
8
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
9
4
|
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
5
|
var __export = (target, all) => {
|
|
25
6
|
for (var name in all)
|
|
26
7
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
@@ -33,78 +14,17 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
33
14
|
}
|
|
34
15
|
return to;
|
|
35
16
|
};
|
|
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
17
|
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
18
|
|
|
66
19
|
// src/index.ts
|
|
67
20
|
var src_exports = {};
|
|
68
21
|
__export(src_exports, {
|
|
69
22
|
etherscanAddressURL: () => etherscanAddressURL,
|
|
70
23
|
etherscanHost: () => etherscanHost,
|
|
71
|
-
etherscanTxURL: () => etherscanTxURL
|
|
72
|
-
readConfig: () => readConfig,
|
|
73
|
-
writeConfig: () => writeConfig
|
|
24
|
+
etherscanTxURL: () => etherscanTxURL
|
|
74
25
|
});
|
|
75
26
|
module.exports = __toCommonJS(src_exports);
|
|
76
27
|
|
|
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
28
|
// src/etherscan.ts
|
|
109
29
|
function etherscanAddressURL(address, chainId = 1) {
|
|
110
30
|
return etherscanHost(chainId) + "/address/" + address;
|
|
@@ -134,8 +54,6 @@ function etherscanHost(chainId = 1) {
|
|
|
134
54
|
0 && (module.exports = {
|
|
135
55
|
etherscanAddressURL,
|
|
136
56
|
etherscanHost,
|
|
137
|
-
etherscanTxURL
|
|
138
|
-
readConfig,
|
|
139
|
-
writeConfig
|
|
57
|
+
etherscanTxURL
|
|
140
58
|
});
|
|
141
59
|
//# sourceMappingURL=index.cjs.map
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/etherscan.ts"],"sourcesContent":["export * from \"./etherscan\"\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;;;ACAO,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/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,5 @@
|
|
|
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
1
|
declare function etherscanAddressURL(address: string, chainId?: number): string;
|
|
7
2
|
declare function etherscanTxURL(hash: string, chainId?: number): string;
|
|
8
3
|
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
4
|
|
|
10
|
-
export { etherscanAddressURL, etherscanHost, etherscanTxURL
|
|
5
|
+
export { etherscanAddressURL, etherscanHost, etherscanTxURL };
|
package/dist/index.js
CHANGED
|
@@ -1,74 +1,3 @@
|
|
|
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
1
|
// src/etherscan.ts
|
|
73
2
|
function etherscanAddressURL(address, chainId = 1) {
|
|
74
3
|
return etherscanHost(chainId) + "/address/" + address;
|
|
@@ -97,8 +26,6 @@ function etherscanHost(chainId = 1) {
|
|
|
97
26
|
export {
|
|
98
27
|
etherscanAddressURL,
|
|
99
28
|
etherscanHost,
|
|
100
|
-
etherscanTxURL
|
|
101
|
-
readConfig,
|
|
102
|
-
writeConfig
|
|
29
|
+
etherscanTxURL
|
|
103
30
|
};
|
|
104
31
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/
|
|
1
|
+
{"version":3,"sources":["../src/etherscan.ts"],"sourcesContent":["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":";AAAO,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
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hybrd/utils",
|
|
3
|
-
"version": "0.3.5-alpha.
|
|
3
|
+
"version": "0.3.5-alpha.4",
|
|
4
4
|
"description": "Solidity + TypeScript Framework for Web3 Development",
|
|
5
5
|
"author": "Ian Hunter <ian@ianh.xyz>",
|
|
6
6
|
"homepage": "https://github.com/ian/hybrid#readme",
|
|
7
7
|
"license": "ISC",
|
|
8
8
|
"type": "module",
|
|
9
|
-
"types": "dist/index.d.ts",
|
|
9
|
+
"types": "./dist/index.d.ts",
|
|
10
10
|
"exports": {
|
|
11
11
|
".": {
|
|
12
12
|
"module": "./dist/index.js",
|
|
@@ -47,7 +47,7 @@
|
|
|
47
47
|
"viem": "^0.1.10"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
|
-
"@hybrd/types": "^0.3.5-alpha.
|
|
50
|
+
"@hybrd/types": "^0.3.5-alpha.4",
|
|
51
51
|
"@types/inquirer": "^9.0.3",
|
|
52
52
|
"@types/node": "^18.14.6",
|
|
53
53
|
"nodemon": "^2.0.21",
|
|
@@ -55,5 +55,5 @@
|
|
|
55
55
|
"tsx": "^3.12.3",
|
|
56
56
|
"typescript": "^4.9.5"
|
|
57
57
|
},
|
|
58
|
-
"gitHead": "
|
|
58
|
+
"gitHead": "2f52dc8bc2882c19c884db2dd79bbbf3477c9b32"
|
|
59
59
|
}
|