@secondlayer/cli 0.3.3 → 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/dist/cli.js +5 -19
- package/dist/cli.js.map +3 -3
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -27841,7 +27841,7 @@ function deriveContractName(filePath) {
|
|
|
27841
27841
|
function toCamelCase2(str) {
|
|
27842
27842
|
return str.replace(/[-_](.)/g, (_2, char) => char.toUpperCase()).replace(/^(.)/, (_2, char) => char.toLowerCase()).replace(/^\d/, "_$&");
|
|
27843
27843
|
}
|
|
27844
|
-
async function buildConfigFromInputs(parsedInputs, outPath, apiKey
|
|
27844
|
+
async function buildConfigFromInputs(parsedInputs, outPath, apiKey) {
|
|
27845
27845
|
const contracts = [];
|
|
27846
27846
|
for (const file of parsedInputs.files) {
|
|
27847
27847
|
const abi = await parseClarityFile(file);
|
|
@@ -27856,7 +27856,6 @@ async function buildConfigFromInputs(parsedInputs, outPath, apiKey, log) {
|
|
|
27856
27856
|
for (const contractId of parsedInputs.contractIds) {
|
|
27857
27857
|
const [address, contractName] = contractId.split(".");
|
|
27858
27858
|
const network = inferNetwork(address);
|
|
27859
|
-
log(`Fetching ${contractName} from ${network}...`);
|
|
27860
27859
|
try {
|
|
27861
27860
|
const apiClient = new StacksApiClient(network, apiKey);
|
|
27862
27861
|
const contractInfo = await apiClient.getContractInfo(contractId);
|
|
@@ -27879,7 +27878,6 @@ async function buildConfigFromInputs(parsedInputs, outPath, apiKey, log) {
|
|
|
27879
27878
|
};
|
|
27880
27879
|
}
|
|
27881
27880
|
async function generate(files, options3) {
|
|
27882
|
-
const log = (msg) => console.log(source_default.gray(` ${msg}`));
|
|
27883
27881
|
try {
|
|
27884
27882
|
let config;
|
|
27885
27883
|
if (files && files.length > 0) {
|
|
@@ -27901,9 +27899,8 @@ Examples:`));
|
|
|
27901
27899
|
No .clar files or contract addresses matched the provided inputs`));
|
|
27902
27900
|
process.exit(1);
|
|
27903
27901
|
}
|
|
27904
|
-
log(`Processing ${totalInputs} contract(s)...`);
|
|
27905
27902
|
const apiKey = options3.apiKey || process.env.HIRO_API_KEY;
|
|
27906
|
-
config = await buildConfigFromInputs(parsedInputs, options3.out, apiKey
|
|
27903
|
+
config = await buildConfigFromInputs(parsedInputs, options3.out, apiKey);
|
|
27907
27904
|
} else {
|
|
27908
27905
|
config = await loadConfig(options3.config);
|
|
27909
27906
|
}
|
|
@@ -27949,18 +27946,7 @@ To get started:`);
|
|
|
27949
27946
|
await checkBaseDependencies(process.cwd());
|
|
27950
27947
|
const contractCount = processedContracts.length;
|
|
27951
27948
|
const contractWord = contractCount === 1 ? "contract" : "contracts";
|
|
27952
|
-
console.log(source_default.green(`✓
|
|
27953
|
-
console.log(`
|
|
27954
|
-
\uD83D\uDCC4 ${config.out}`);
|
|
27955
|
-
console.log(`
|
|
27956
|
-
\uD83D\uDCA1 Import your contracts:`);
|
|
27957
|
-
if (processedContracts.length > 0) {
|
|
27958
|
-
const exampleContract = processedContracts[0];
|
|
27959
|
-
console.log(source_default.gray(` import { ${exampleContract.name} } from '${config.out.replace(/\.ts$/, "")}'`));
|
|
27960
|
-
if (processedContracts.length > 1) {
|
|
27961
|
-
console.log(source_default.gray(` // Also available: ${processedContracts.slice(1).map((c4) => c4.name).join(", ")}`));
|
|
27962
|
-
}
|
|
27963
|
-
}
|
|
27949
|
+
console.log(source_default.green(`✓ Generated \`${config.out}\` for ${contractCount} ${contractWord}`));
|
|
27964
27950
|
} catch (error) {
|
|
27965
27951
|
console.error(source_default.red("✗ Generation failed"));
|
|
27966
27952
|
console.error(source_default.red(`
|
|
@@ -28119,7 +28105,7 @@ var {
|
|
|
28119
28105
|
// package.json
|
|
28120
28106
|
var package_default = {
|
|
28121
28107
|
name: "@secondlayer/cli",
|
|
28122
|
-
version: "0.3.
|
|
28108
|
+
version: "0.3.4",
|
|
28123
28109
|
description: "CLI for generating type-safe contract interfaces for the Stacks blockchain",
|
|
28124
28110
|
type: "module",
|
|
28125
28111
|
bin: {
|
|
@@ -28195,5 +28181,5 @@ program.command("init").description("Initialize a new stacks.config.ts file").ac
|
|
|
28195
28181
|
});
|
|
28196
28182
|
program.parse();
|
|
28197
28183
|
|
|
28198
|
-
//# debugId=
|
|
28184
|
+
//# debugId=3784DD59298C867364756E2164756E21
|
|
28199
28185
|
//# sourceMappingURL=cli.js.map
|