Skip to content

Commit

Permalink
Add getAllContracts method
Browse files Browse the repository at this point in the history
  • Loading branch information
Lbqds committed Feb 21, 2025
1 parent 6cc6df4 commit 754e6df
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions artifacts/ts/contracts.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ import { Contract, ContractFactory } from "@alephium/web3";

let contracts: ContractFactory<any>[] | undefined = undefined;

export function getAllContracts(): ContractFactory<any>[] {
return contracts ?? [];
}

export function registerContract(factory: ContractFactory<any>) {
if (contracts === undefined) {
contracts = [factory];
Expand Down
4 changes: 4 additions & 0 deletions packages/cli/src/codegen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -643,6 +643,10 @@ function genContractByCodeHash(outDir: string) {
let contracts: ContractFactory<any>[] | undefined = undefined
export function getAllContracts(): ContractFactory<any>[] {
return contracts ?? []
}
export function registerContract(factory: ContractFactory<any>) {
if (contracts === undefined) {
contracts = [factory]
Expand Down

0 comments on commit 754e6df

Please sign in to comment.