@boostxyz/cli 1.1.0-alpha.34 → 1.1.0-alpha.35
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/ccip-B90Impbv.js +145 -0
- package/dist/ccip-DQqriboS.cjs +1 -0
- package/dist/cli.cjs +2 -2
- package/dist/cli.js +145 -35
- package/dist/commands/deploy.cjs +1 -1
- package/dist/commands/deploy.js +371 -313
- package/dist/commands/seed.cjs +2 -2
- package/dist/commands/seed.js +3389 -465
- package/dist/utils-C7UotnrC.cjs +44 -0
- package/dist/utils-CX1JpbvX.js +21452 -0
- package/package.json +1 -1
- package/dist/utils-D0bdHF2y.js +0 -64
- package/dist/utils-DX4pZJ98.cjs +0 -3
|
@@ -0,0 +1,145 @@
|
|
|
1
|
+
import { B as p, y as m, z as y, A as k, D as b, E, F as L, G as O, H as h, n as x } from "./utils-CX1JpbvX.js";
|
|
2
|
+
class M extends p {
|
|
3
|
+
constructor({ callbackSelector: r, cause: e, data: o, extraData: c, sender: d, urls: a }) {
|
|
4
|
+
var i;
|
|
5
|
+
super(e.shortMessage || "An error occurred while fetching for an offchain result.", {
|
|
6
|
+
cause: e,
|
|
7
|
+
metaMessages: [
|
|
8
|
+
...e.metaMessages || [],
|
|
9
|
+
(i = e.metaMessages) != null && i.length ? "" : [],
|
|
10
|
+
"Offchain Gateway Call:",
|
|
11
|
+
a && [
|
|
12
|
+
" Gateway URL(s):",
|
|
13
|
+
...a.map((f) => ` ${m(f)}`)
|
|
14
|
+
],
|
|
15
|
+
` Sender: ${d}`,
|
|
16
|
+
` Data: ${o}`,
|
|
17
|
+
` Callback selector: ${r}`,
|
|
18
|
+
` Extra data: ${c}`
|
|
19
|
+
].flat(),
|
|
20
|
+
name: "OffchainLookupError"
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
class R extends p {
|
|
25
|
+
constructor({ result: r, url: e }) {
|
|
26
|
+
super("Offchain gateway response is malformed. Response data must be a hex value.", {
|
|
27
|
+
metaMessages: [
|
|
28
|
+
`Gateway URL: ${m(e)}`,
|
|
29
|
+
`Response: ${y(r)}`
|
|
30
|
+
],
|
|
31
|
+
name: "OffchainLookupResponseMalformedError"
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
class $ extends p {
|
|
36
|
+
constructor({ sender: r, to: e }) {
|
|
37
|
+
super("Reverted sender address does not match target contract address (`to`).", {
|
|
38
|
+
metaMessages: [
|
|
39
|
+
`Contract address: ${e}`,
|
|
40
|
+
`OffchainLookup sender address: ${r}`
|
|
41
|
+
],
|
|
42
|
+
name: "OffchainLookupSenderMismatchError"
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
const D = "0x556f1830", S = {
|
|
47
|
+
name: "OffchainLookup",
|
|
48
|
+
type: "error",
|
|
49
|
+
inputs: [
|
|
50
|
+
{
|
|
51
|
+
name: "sender",
|
|
52
|
+
type: "address"
|
|
53
|
+
},
|
|
54
|
+
{
|
|
55
|
+
name: "urls",
|
|
56
|
+
type: "string[]"
|
|
57
|
+
},
|
|
58
|
+
{
|
|
59
|
+
name: "callData",
|
|
60
|
+
type: "bytes"
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: "callbackFunction",
|
|
64
|
+
type: "bytes4"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
name: "extraData",
|
|
68
|
+
type: "bytes"
|
|
69
|
+
}
|
|
70
|
+
]
|
|
71
|
+
};
|
|
72
|
+
async function G(n, { blockNumber: r, blockTag: e, data: o, to: c }) {
|
|
73
|
+
const { args: d } = k({
|
|
74
|
+
data: o,
|
|
75
|
+
abi: [S]
|
|
76
|
+
}), [a, i, f, t, s] = d, { ccipRead: u } = n, w = u && typeof (u == null ? void 0 : u.request) == "function" ? u.request : q;
|
|
77
|
+
try {
|
|
78
|
+
if (!b(c, a))
|
|
79
|
+
throw new $({ sender: a, to: c });
|
|
80
|
+
const l = await w({ data: f, sender: a, urls: i }), { data: g } = await E(n, {
|
|
81
|
+
blockNumber: r,
|
|
82
|
+
blockTag: e,
|
|
83
|
+
data: L([
|
|
84
|
+
t,
|
|
85
|
+
O([{ type: "bytes" }, { type: "bytes" }], [l, s])
|
|
86
|
+
]),
|
|
87
|
+
to: c
|
|
88
|
+
});
|
|
89
|
+
return g;
|
|
90
|
+
} catch (l) {
|
|
91
|
+
throw new M({
|
|
92
|
+
callbackSelector: t,
|
|
93
|
+
cause: l,
|
|
94
|
+
data: o,
|
|
95
|
+
extraData: s,
|
|
96
|
+
sender: a,
|
|
97
|
+
urls: i
|
|
98
|
+
});
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
async function q({ data: n, sender: r, urls: e }) {
|
|
102
|
+
var c;
|
|
103
|
+
let o = new Error("An unknown error occurred.");
|
|
104
|
+
for (let d = 0; d < e.length; d++) {
|
|
105
|
+
const a = e[d], i = a.includes("{data}") ? "GET" : "POST", f = i === "POST" ? { data: n, sender: r } : void 0;
|
|
106
|
+
try {
|
|
107
|
+
const t = await fetch(a.replace("{sender}", r).replace("{data}", n), {
|
|
108
|
+
body: JSON.stringify(f),
|
|
109
|
+
method: i
|
|
110
|
+
});
|
|
111
|
+
let s;
|
|
112
|
+
if ((c = t.headers.get("Content-Type")) != null && c.startsWith("application/json") ? s = (await t.json()).data : s = await t.text(), !t.ok) {
|
|
113
|
+
o = new h({
|
|
114
|
+
body: f,
|
|
115
|
+
details: s != null && s.error ? y(s.error) : t.statusText,
|
|
116
|
+
headers: t.headers,
|
|
117
|
+
status: t.status,
|
|
118
|
+
url: a
|
|
119
|
+
});
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
if (!x(s)) {
|
|
123
|
+
o = new R({
|
|
124
|
+
result: s,
|
|
125
|
+
url: a
|
|
126
|
+
});
|
|
127
|
+
continue;
|
|
128
|
+
}
|
|
129
|
+
return s;
|
|
130
|
+
} catch (t) {
|
|
131
|
+
o = new h({
|
|
132
|
+
body: f,
|
|
133
|
+
details: t.message,
|
|
134
|
+
url: a
|
|
135
|
+
});
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
throw o;
|
|
139
|
+
}
|
|
140
|
+
export {
|
|
141
|
+
q as ccipRequest,
|
|
142
|
+
G as offchainLookup,
|
|
143
|
+
S as offchainLookupAbiItem,
|
|
144
|
+
D as offchainLookupSignature
|
|
145
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("./utils-C7UotnrC.cjs");class w extends e.BaseError{constructor({callbackSelector:o,cause:t,data:n,extraData:i,sender:u,urls:a}){var f;super(t.shortMessage||"An error occurred while fetching for an offchain result.",{cause:t,metaMessages:[...t.metaMessages||[],(f=t.metaMessages)!=null&&f.length?"":[],"Offchain Gateway Call:",a&&[" Gateway URL(s):",...a.map(d=>` ${e.getUrl(d)}`)],` Sender: ${u}`,` Data: ${n}`,` Callback selector: ${o}`,` Extra data: ${i}`].flat(),name:"OffchainLookupError"})}}class k extends e.BaseError{constructor({result:o,url:t}){super("Offchain gateway response is malformed. Response data must be a hex value.",{metaMessages:[`Gateway URL: ${e.getUrl(t)}`,`Response: ${e.stringify(o)}`],name:"OffchainLookupResponseMalformedError"})}}class b extends e.BaseError{constructor({sender:o,to:t}){super("Reverted sender address does not match target contract address (`to`).",{metaMessages:[`Contract address: ${t}`,`OffchainLookup sender address: ${o}`],name:"OffchainLookupSenderMismatchError"})}}const E="0x556f1830",h={name:"OffchainLookup",type:"error",inputs:[{name:"sender",type:"address"},{name:"urls",type:"string[]"},{name:"callData",type:"bytes"},{name:"callbackFunction",type:"bytes4"},{name:"extraData",type:"bytes"}]};async function L(c,{blockNumber:o,blockTag:t,data:n,to:i}){const{args:u}=e.decodeErrorResult({data:n,abi:[h]}),[a,f,d,r,s]=u,{ccipRead:l}=c,m=l&&typeof(l==null?void 0:l.request)=="function"?l.request:y;try{if(!e.isAddressEqual(i,a))throw new b({sender:a,to:i});const p=await m({data:d,sender:a,urls:f}),{data:g}=await e.call(c,{blockNumber:o,blockTag:t,data:e.concat([r,e.encodeAbiParameters([{type:"bytes"},{type:"bytes"}],[p,s])]),to:i});return g}catch(p){throw new w({callbackSelector:r,cause:p,data:n,extraData:s,sender:a,urls:f})}}async function y({data:c,sender:o,urls:t}){var i;let n=new Error("An unknown error occurred.");for(let u=0;u<t.length;u++){const a=t[u],f=a.includes("{data}")?"GET":"POST",d=f==="POST"?{data:c,sender:o}:void 0;try{const r=await fetch(a.replace("{sender}",o).replace("{data}",c),{body:JSON.stringify(d),method:f});let s;if((i=r.headers.get("Content-Type"))!=null&&i.startsWith("application/json")?s=(await r.json()).data:s=await r.text(),!r.ok){n=new e.HttpRequestError({body:d,details:s!=null&&s.error?e.stringify(s.error):r.statusText,headers:r.headers,status:r.status,url:a});continue}if(!e.isHex(s)){n=new k({result:s,url:a});continue}return s}catch(r){n=new e.HttpRequestError({body:d,details:r.message,url:a})}}throw n}exports.ccipRequest=y;exports.offchainLookup=L;exports.offchainLookupAbiItem=h;exports.offchainLookupSignature=E;
|
package/dist/cli.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
"use strict";const
|
|
2
|
+
"use strict";const w=require("node:fs/promises"),_=require("node:path"),y=require("./utils-C7UotnrC.cjs"),S=require("./index.cjs"),N=Symbol("arg flag");class l extends Error{constructor(o,f){super(o),this.name="ArgError",this.code=f,Object.setPrototypeOf(this,l.prototype)}}function v(r,{argv:o=process.argv.slice(2),permissive:f=!1,stopAtPositional:t=!1}={}){if(!r)throw new l("argument specification object is required","ARG_CONFIG_NO_SPEC");const a={_:[]},p={},d={};for(const e of Object.keys(r)){if(!e)throw new l("argument key cannot be an empty string","ARG_CONFIG_EMPTY_KEY");if(e[0]!=="-")throw new l(`argument key must start with '-' but found: '${e}'`,"ARG_CONFIG_NONOPT_KEY");if(e.length===1)throw new l(`argument key must have a name; singular '-' keys are not allowed: ${e}`,"ARG_CONFIG_NONAME_KEY");if(typeof r[e]=="string"){p[e]=r[e];continue}let n=r[e],c=!1;if(Array.isArray(n)&&n.length===1&&typeof n[0]=="function"){const[h]=n;n=(u,i,m=[])=>(m.push(h(u,i,m[m.length-1])),m),c=h===Boolean||h[N]===!0}else if(typeof n=="function")c=n===Boolean||n[N]===!0;else throw new l(`type missing or not a function or valid array type: ${e}`,"ARG_CONFIG_VAD_TYPE");if(e[1]!=="-"&&e.length>2)throw new l(`short argument keys (with a single hyphen) must have only one character: ${e}`,"ARG_CONFIG_SHORTOPT_TOOLONG");d[e]=[n,c]}for(let e=0,n=o.length;e<n;e++){const c=o[e];if(t&&a._.length>0){a._=a._.concat(o.slice(e));break}if(c==="--"){a._=a._.concat(o.slice(e+1));break}if(c.length>1&&c[0]==="-"){const h=c[1]==="-"||c.length===2?[c]:c.slice(1).split("").map(u=>`-${u}`);for(let u=0;u<h.length;u++){const i=h[u],[m,b]=i[1]==="-"?i.split(/=(.*)/,2):[i,void 0];let s=m;for(;s in p;)s=p[s];if(!(s in d))if(f){a._.push(i);continue}else throw new l(`unknown or unexpected option: ${m}`,"ARG_UNKNOWN_OPTION");const[g,A]=d[s];if(!A&&u+1<h.length)throw new l(`option requires argument (but was followed by another short argument): ${m}`,"ARG_MISSING_REQUIRED_SHORTARG");if(A)a[s]=g(!0,s,a[s]);else if(b===void 0){if(o.length<e+2||o[e+1].length>1&&o[e+1][0]==="-"&&!(o[e+1].match(/^-?\d*(\.(?=\d))?\d*$/)&&(g===Number||typeof BigInt<"u"&&g===BigInt))){const G=m===s?"":` (alias for ${s})`;throw new l(`option requires argument: ${m}${G}`,"ARG_MISSING_REQUIRED_LONGARG")}a[s]=g(o[e+1],s,a[s]),++e}else a[s]=g(b,s,a[s])}}else a._.push(c)}return a}v.flag=r=>(r[N]=!0,r);v.COUNT=v.flag((r,o,f)=>(f||0)+1);v.ArgError=l;var R=v;const $=y.getDefaultExportFromCjs(R),k="2.0.0-alpha.33",D="1.1.0-alpha.35",E=`
|
|
3
3
|
Deploy Boost Protocol V2, and retrieve base implementation addresses.
|
|
4
4
|
|
|
5
5
|
Usage: boost <COMMAND>
|
|
@@ -24,4 +24,4 @@ Options:
|
|
|
24
24
|
--cacheDir Path to artifact cache directory
|
|
25
25
|
--force Bypass cache for given command and configuration, re-running any tasks and re-generating cache artifacts
|
|
26
26
|
--format Specify command output format, either env or json
|
|
27
|
-
`;BigInt.prototype.toJSON=function(){return Number(this)};const
|
|
27
|
+
`;BigInt.prototype.toJSON=function(){return Number(this)};const O=$({"--help":Boolean,"--version":Boolean,"--chain":String,"--privateKey":String,"--mnemonic":String,"--rpcUrl":String,"--out":String,"--cacheDir":String,"--force":Boolean,"--format":String,"--from":String,"-h":"--help","-v":"--version"});async function I(){var c,h,u;const{_:r,...o}=O,f=r.at(0);if(O["--version"])return console.log(D),0;if(O["--help"])return console.log(E),0;if(!f||!S.commands[f])return console.log(E),127;const t={help:o["--help"],version:o["--version"],chain:o["--chain"],privateKey:o["--privateKey"],mnemonic:o["--mnemonic"],rpcUrl:o["--rpcUrl"],out:o["--out"],cacheDir:o["--cacheDir"],force:o["--force"],format:o["--format"]};t.format||(t.format="env");const a=(c=t.cacheDir)!=null&&c.startsWith("./")?_.resolve(process.cwd(),t.cacheDir):t.cacheDir||_.resolve(process.cwd(),"./.boost"),p=`${r.join("-")}-v${k.split(".").slice(0,2).join("-")}-${t.chain}-${t!=null&&t.privateKey?(h=t.privateKey)==null?void 0:h.slice(t.privateKey.length-5):((u=t.mnemonic)==null?void 0:u.split(" ").at(-1))||""}`,d=_.resolve(a,p);async function e(){const i=await S.commands[f](r.slice(1),t);return f==="seed"&&r.includes("generate")&&(t.format="json"),t.format==="env"?y.objectToEnv(i):JSON.stringify(i,null,2)}let n;if(t.force)n=await e();else try{n=await w.readFile(d,{encoding:"utf-8"});const i=y.validateJson(n);t.format==="json"&&i===!1&&(n=JSON.stringify(y.envToObject(n),null,2)),t.format==="env"&&i!==!1&&(n=y.objectToEnv(i))}catch(i){if(i instanceof Error&&i.message.includes("ENOENT"))n=await e();else throw i}if(typeof n==null)throw new Error("No result found after cache and command operations. This shouldn't happen.");t.out?(await w.mkdir(t.out,{recursive:!0}),await w.writeFile(t.out,n,{encoding:"utf8"}),console.log(`Succesfully wrote result to ${t.out}`)):console.log(n)}I().then((r=0)=>process.exit(r)).catch(r=>{console.error(r),process.exit(1)});
|
package/dist/cli.js
CHANGED
|
@@ -1,10 +1,120 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import { commands as
|
|
6
|
-
|
|
7
|
-
|
|
2
|
+
import v from "node:fs/promises";
|
|
3
|
+
import w from "node:path";
|
|
4
|
+
import { g as E, v as $, e as k, o as A } from "./utils-CX1JpbvX.js";
|
|
5
|
+
import { commands as S } from "./index.js";
|
|
6
|
+
const O = Symbol("arg flag");
|
|
7
|
+
class l extends Error {
|
|
8
|
+
constructor(o, u) {
|
|
9
|
+
super(o), this.name = "ArgError", this.code = u, Object.setPrototypeOf(this, l.prototype);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
function y(r, {
|
|
13
|
+
argv: o = process.argv.slice(2),
|
|
14
|
+
permissive: u = !1,
|
|
15
|
+
stopAtPositional: t = !1
|
|
16
|
+
} = {}) {
|
|
17
|
+
if (!r)
|
|
18
|
+
throw new l(
|
|
19
|
+
"argument specification object is required",
|
|
20
|
+
"ARG_CONFIG_NO_SPEC"
|
|
21
|
+
);
|
|
22
|
+
const a = { _: [] }, p = {}, g = {};
|
|
23
|
+
for (const e of Object.keys(r)) {
|
|
24
|
+
if (!e)
|
|
25
|
+
throw new l(
|
|
26
|
+
"argument key cannot be an empty string",
|
|
27
|
+
"ARG_CONFIG_EMPTY_KEY"
|
|
28
|
+
);
|
|
29
|
+
if (e[0] !== "-")
|
|
30
|
+
throw new l(
|
|
31
|
+
`argument key must start with '-' but found: '${e}'`,
|
|
32
|
+
"ARG_CONFIG_NONOPT_KEY"
|
|
33
|
+
);
|
|
34
|
+
if (e.length === 1)
|
|
35
|
+
throw new l(
|
|
36
|
+
`argument key must have a name; singular '-' keys are not allowed: ${e}`,
|
|
37
|
+
"ARG_CONFIG_NONAME_KEY"
|
|
38
|
+
);
|
|
39
|
+
if (typeof r[e] == "string") {
|
|
40
|
+
p[e] = r[e];
|
|
41
|
+
continue;
|
|
42
|
+
}
|
|
43
|
+
let n = r[e], c = !1;
|
|
44
|
+
if (Array.isArray(n) && n.length === 1 && typeof n[0] == "function") {
|
|
45
|
+
const [h] = n;
|
|
46
|
+
n = (f, i, m = []) => (m.push(h(f, i, m[m.length - 1])), m), c = h === Boolean || h[O] === !0;
|
|
47
|
+
} else if (typeof n == "function")
|
|
48
|
+
c = n === Boolean || n[O] === !0;
|
|
49
|
+
else
|
|
50
|
+
throw new l(
|
|
51
|
+
`type missing or not a function or valid array type: ${e}`,
|
|
52
|
+
"ARG_CONFIG_VAD_TYPE"
|
|
53
|
+
);
|
|
54
|
+
if (e[1] !== "-" && e.length > 2)
|
|
55
|
+
throw new l(
|
|
56
|
+
`short argument keys (with a single hyphen) must have only one character: ${e}`,
|
|
57
|
+
"ARG_CONFIG_SHORTOPT_TOOLONG"
|
|
58
|
+
);
|
|
59
|
+
g[e] = [n, c];
|
|
60
|
+
}
|
|
61
|
+
for (let e = 0, n = o.length; e < n; e++) {
|
|
62
|
+
const c = o[e];
|
|
63
|
+
if (t && a._.length > 0) {
|
|
64
|
+
a._ = a._.concat(o.slice(e));
|
|
65
|
+
break;
|
|
66
|
+
}
|
|
67
|
+
if (c === "--") {
|
|
68
|
+
a._ = a._.concat(o.slice(e + 1));
|
|
69
|
+
break;
|
|
70
|
+
}
|
|
71
|
+
if (c.length > 1 && c[0] === "-") {
|
|
72
|
+
const h = c[1] === "-" || c.length === 2 ? [c] : c.slice(1).split("").map((f) => `-${f}`);
|
|
73
|
+
for (let f = 0; f < h.length; f++) {
|
|
74
|
+
const i = h[f], [m, N] = i[1] === "-" ? i.split(/=(.*)/, 2) : [i, void 0];
|
|
75
|
+
let s = m;
|
|
76
|
+
for (; s in p; )
|
|
77
|
+
s = p[s];
|
|
78
|
+
if (!(s in g))
|
|
79
|
+
if (u) {
|
|
80
|
+
a._.push(i);
|
|
81
|
+
continue;
|
|
82
|
+
} else
|
|
83
|
+
throw new l(
|
|
84
|
+
`unknown or unexpected option: ${m}`,
|
|
85
|
+
"ARG_UNKNOWN_OPTION"
|
|
86
|
+
);
|
|
87
|
+
const [d, b] = g[s];
|
|
88
|
+
if (!b && f + 1 < h.length)
|
|
89
|
+
throw new l(
|
|
90
|
+
`option requires argument (but was followed by another short argument): ${m}`,
|
|
91
|
+
"ARG_MISSING_REQUIRED_SHORTARG"
|
|
92
|
+
);
|
|
93
|
+
if (b)
|
|
94
|
+
a[s] = d(!0, s, a[s]);
|
|
95
|
+
else if (N === void 0) {
|
|
96
|
+
if (o.length < e + 2 || o[e + 1].length > 1 && o[e + 1][0] === "-" && !(o[e + 1].match(/^-?\d*(\.(?=\d))?\d*$/) && (d === Number || // eslint-disable-next-line no-undef
|
|
97
|
+
typeof BigInt < "u" && d === BigInt))) {
|
|
98
|
+
const R = m === s ? "" : ` (alias for ${s})`;
|
|
99
|
+
throw new l(
|
|
100
|
+
`option requires argument: ${m}${R}`,
|
|
101
|
+
"ARG_MISSING_REQUIRED_LONGARG"
|
|
102
|
+
);
|
|
103
|
+
}
|
|
104
|
+
a[s] = d(o[e + 1], s, a[s]), ++e;
|
|
105
|
+
} else
|
|
106
|
+
a[s] = d(N, s, a[s]);
|
|
107
|
+
}
|
|
108
|
+
} else
|
|
109
|
+
a._.push(c);
|
|
110
|
+
}
|
|
111
|
+
return a;
|
|
112
|
+
}
|
|
113
|
+
y.flag = (r) => (r[O] = !0, r);
|
|
114
|
+
y.COUNT = y.flag((r, o, u) => (u || 0) + 1);
|
|
115
|
+
y.ArgError = l;
|
|
116
|
+
var D = y;
|
|
117
|
+
const I = /* @__PURE__ */ E(D), T = "2.0.0-alpha.33", C = "1.1.0-alpha.35", G = `
|
|
8
118
|
Deploy Boost Protocol V2, and retrieve base implementation addresses.
|
|
9
119
|
|
|
10
120
|
Usage: boost <COMMAND>
|
|
@@ -33,7 +143,7 @@ Options:
|
|
|
33
143
|
BigInt.prototype.toJSON = function() {
|
|
34
144
|
return Number(this);
|
|
35
145
|
};
|
|
36
|
-
const
|
|
146
|
+
const _ = I({
|
|
37
147
|
"--help": Boolean,
|
|
38
148
|
"--version": Boolean,
|
|
39
149
|
"--chain": String,
|
|
@@ -48,16 +158,16 @@ const c = w({
|
|
|
48
158
|
"-h": "--help",
|
|
49
159
|
"-v": "--version"
|
|
50
160
|
});
|
|
51
|
-
async function
|
|
52
|
-
var
|
|
53
|
-
const { _: r, ...o } =
|
|
54
|
-
if (
|
|
55
|
-
return console.log(
|
|
56
|
-
if (
|
|
57
|
-
return console.log(
|
|
58
|
-
if (!
|
|
59
|
-
return console.log(
|
|
60
|
-
const
|
|
161
|
+
async function P() {
|
|
162
|
+
var c, h, f;
|
|
163
|
+
const { _: r, ...o } = _, u = r.at(0);
|
|
164
|
+
if (_["--version"])
|
|
165
|
+
return console.log(C), 0;
|
|
166
|
+
if (_["--help"])
|
|
167
|
+
return console.log(G), 0;
|
|
168
|
+
if (!u || !S[u])
|
|
169
|
+
return console.log(G), 127;
|
|
170
|
+
const t = {
|
|
61
171
|
help: o["--help"],
|
|
62
172
|
version: o["--version"],
|
|
63
173
|
chain: o["--chain"],
|
|
@@ -69,31 +179,31 @@ async function K() {
|
|
|
69
179
|
force: o["--force"],
|
|
70
180
|
format: o["--format"]
|
|
71
181
|
};
|
|
72
|
-
|
|
73
|
-
const
|
|
74
|
-
async function
|
|
75
|
-
const
|
|
76
|
-
return
|
|
182
|
+
t.format || (t.format = "env");
|
|
183
|
+
const a = (c = t.cacheDir) != null && c.startsWith("./") ? w.resolve(process.cwd(), t.cacheDir) : t.cacheDir || w.resolve(process.cwd(), "./.boost"), p = `${r.join("-")}-v${T.split(".").slice(0, 2).join("-")}-${t.chain}-${t != null && t.privateKey ? (h = t.privateKey) == null ? void 0 : h.slice(t.privateKey.length - 5) : ((f = t.mnemonic) == null ? void 0 : f.split(" ").at(-1)) || ""}`, g = w.resolve(a, p);
|
|
184
|
+
async function e() {
|
|
185
|
+
const i = await S[u](r.slice(1), t);
|
|
186
|
+
return u === "seed" && r.includes("generate") && (t.format = "json"), t.format === "env" ? A(i) : JSON.stringify(i, null, 2);
|
|
77
187
|
}
|
|
78
|
-
let
|
|
79
|
-
if (
|
|
80
|
-
|
|
188
|
+
let n;
|
|
189
|
+
if (t.force)
|
|
190
|
+
n = await e();
|
|
81
191
|
else
|
|
82
192
|
try {
|
|
83
|
-
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
} catch (
|
|
87
|
-
if (
|
|
88
|
-
|
|
89
|
-
else throw
|
|
193
|
+
n = await v.readFile(g, { encoding: "utf-8" });
|
|
194
|
+
const i = $(n);
|
|
195
|
+
t.format === "json" && i === !1 && (n = JSON.stringify(k(n), null, 2)), t.format === "env" && i !== !1 && (n = A(i));
|
|
196
|
+
} catch (i) {
|
|
197
|
+
if (i instanceof Error && i.message.includes("ENOENT"))
|
|
198
|
+
n = await e();
|
|
199
|
+
else throw i;
|
|
90
200
|
}
|
|
91
|
-
if (typeof
|
|
201
|
+
if (typeof n == null)
|
|
92
202
|
throw new Error(
|
|
93
203
|
"No result found after cache and command operations. This shouldn't happen."
|
|
94
204
|
);
|
|
95
|
-
|
|
205
|
+
t.out ? (await v.mkdir(t.out, { recursive: !0 }), await v.writeFile(t.out, n, { encoding: "utf8" }), console.log(`Succesfully wrote result to ${t.out}`)) : console.log(n);
|
|
96
206
|
}
|
|
97
|
-
|
|
207
|
+
P().then((r = 0) => process.exit(r)).catch((r) => {
|
|
98
208
|
console.error(r), process.exit(1);
|
|
99
209
|
});
|