mirror of
https://github.com/alexgo-io/clarity-codegen.git
synced 2026-01-12 14:34:34 +08:00
feat: add contract overwrite
This commit is contained in:
@@ -250,6 +250,7 @@ export const generateContractFromAbi = async ({
|
||||
apiHost,
|
||||
output,
|
||||
packageName,
|
||||
contractOverwrites,
|
||||
}: {
|
||||
contractName: string;
|
||||
aliasContractName?: string;
|
||||
@@ -257,8 +258,9 @@ export const generateContractFromAbi = async ({
|
||||
apiHost: string;
|
||||
output: string;
|
||||
packageName: string;
|
||||
contractOverwrites: {[from: string]: string}
|
||||
}): Promise<void> => {
|
||||
const url = `${apiHost}/v2/contracts/interface/${principal}/${contractName}`;
|
||||
const url = `${apiHost}/v2/contracts/interface/${principal}/${contractOverwrites[contractName] ?? contractName}`;
|
||||
const response = await axios.get(url);
|
||||
const interfaceData: ClarityAbi = response.data;
|
||||
const defs = {} as Record<string, ContractEntryDescriptorDef>;
|
||||
|
||||
@@ -10,7 +10,8 @@ export async function generateContracts(
|
||||
contracts: string[],
|
||||
output: string,
|
||||
name: string,
|
||||
packageName: string = "clarity-codegen"
|
||||
packageName: string = "clarity-codegen",
|
||||
contractOverwrites: {[from: string]: string} = {}
|
||||
) {
|
||||
const batch = new YBatch({ concurrency: 16 });
|
||||
for (const cname of contracts) {
|
||||
@@ -22,6 +23,7 @@ export async function generateContracts(
|
||||
contractName: cname,
|
||||
output,
|
||||
packageName,
|
||||
contractOverwrites
|
||||
});
|
||||
console.log(`Generated contract ${principal}.${cname}`);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user