diff --git a/src/contracts/Campaign.ts b/src/contracts/Campaign.ts index 5b08647..b27165e 100644 --- a/src/contracts/Campaign.ts +++ b/src/contracts/Campaign.ts @@ -220,7 +220,7 @@ export const CreateCampaign = ZkProgram({ }, }); -class CampaignProof extends ZkProgram.Proof(CreateCampaign) {} +export class CampaignProof extends ZkProgram.Proof(CreateCampaign) {} export enum EventEnum { CAMPAIGN_CREATED = 'campaign-created', diff --git a/src/contracts/Funding.ts b/src/contracts/Funding.ts index 7150602..e3d073c 100644 --- a/src/contracts/Funding.ts +++ b/src/contracts/Funding.ts @@ -266,7 +266,7 @@ export const CreateRollupProof = ZkProgram({ }, }); -class ProofRollupAction extends ZkProgram.Proof(CreateRollupProof) {} +export class ProofRollupAction extends ZkProgram.Proof(CreateRollupProof) {} export class FundingContract extends SmartContract { @state(Field) actionState = State(); diff --git a/src/contracts/Participation.ts b/src/contracts/Participation.ts index 68d0d59..46a1cca 100644 --- a/src/contracts/Participation.ts +++ b/src/contracts/Participation.ts @@ -72,20 +72,14 @@ export class JoinCampaignInput extends Struct({ } } -export class checkParticipationIndexInput extends Struct({ +export class CheckParticipationIndexInput extends Struct({ campaignId: Field, projectId: Field, participationIndex: Field, indexWitness: indexAndInfoWitness, }) { - static fromFields(fields: Field[]): checkParticipationIndexInput { - return super.fromFields(fields) as checkParticipationIndexInput; - } -} - -export class UpdateCampaignInput extends Struct({}) { - static fromFields(fields: Field[]): UpdateCampaignInput { - return super.fromFields(fields) as UpdateCampaignInput; + static fromFields(fields: Field[]): CheckParticipationIndexInput { + return super.fromFields(fields) as CheckParticipationIndexInput; } } @@ -208,7 +202,7 @@ export const JoinCampaign = ZkProgram({ }, }); -class ParticipationProof extends ZkProgram.Proof(JoinCampaign) {} +export class ParticipationProof extends ZkProgram.Proof(JoinCampaign) {} export class ParticipationContract extends SmartContract { // campaignId -> projectId -> index. start from 1, if index = 0 means that project have not participate @@ -267,7 +261,7 @@ export class ParticipationContract extends SmartContract { // check if this is first time join campaign let notIn = this.checkParticipationIndex( - new checkParticipationIndexInput({ + new CheckParticipationIndexInput({ campaignId: input.campaignId, projectId: input.projectId, participationIndex: Field(0), @@ -341,7 +335,7 @@ export class ParticipationContract extends SmartContract { this.emitEvent(EventEnum.ACTIONS_REDUCED, lastActionState); } - @method checkParticipationIndex(input: checkParticipationIndexInput): Bool { + @method checkParticipationIndex(input: CheckParticipationIndexInput): Bool { let isValid = Bool(true); let index = IndexStorage.calculateLevel1Index({ diff --git a/src/contracts/Treasury.ts b/src/contracts/Treasury.ts index 6271699..21de5a6 100644 --- a/src/contracts/Treasury.ts +++ b/src/contracts/Treasury.ts @@ -159,7 +159,7 @@ export const ClaimFund = ZkProgram({ }, }); -class TreasuryProof extends ZkProgram.Proof(ClaimFund) {} +export class TreasuryProof extends ZkProgram.Proof(ClaimFund) {} export enum EventEnum { ACTIONS_REDUCED = 'actions-reduced', diff --git a/src/index.ts b/src/index.ts index 9360510..297b571 100644 --- a/src/index.ts +++ b/src/index.ts @@ -1,3 +1,101 @@ export * as Constants from './constants.js'; export * as Storage from './contracts/storages.js'; export * as ZkApp from './contracts/index.js'; + +export { + // Structs + CheckProjectOwerInput, + CreateProjectInput, + UpdateProjectInput, + CreateProjectProofOutput, + + // Zk Programs & Proofs + CreateProject, + ProjectProof, + + // Smart Contract + ProjectContract, + + // Actions & Events + ProjectAction, + EventEnum as ProjectEvents, +} from './contracts/Project.js'; + +export { + // Structs + CheckCampaignOwerInput, + CreateCampaignInput, + UpdateCampaignInput, + CreateCampaignProofOutput, + + // Zk Programs & Proofs + CreateCampaign, + CampaignProof, + + // Smart Contract + CampaignContract, + + // Actions & Events + CampaignAction, + EventEnum as CampaignEvents, +} from './contracts/Campaign.js'; + +export { + // Structs + JoinCampaignInput, + CheckParticipationIndexInput, + CreateParticipationProofOutput, + + // Zk Programs & Proofs + JoinCampaign, + ParticipationProof, + + // Smart Contract + ParticipationContract, + + // Actions & Events + ParticipationAction, + EventEnum as ParticipationEvents, +} from './contracts/Participation.js'; + +export { + // Structs + RequestSent, + CustomScalarArray, + FundingInput, + CheckValueInput, + ReduceOutput as ReduceFundingOutput, + RollupActionsOutput as RollupParticipationActionsOutput, + + // Zk Programs & Proofs + ReduceProof, + CreateReduceProof, + ProofRollupAction, + CreateRollupProof, + + // Smart Contract + FundingContract, + + // Actions & Events + FundingAction, + EventEnum as FundingEvents, +} from './contracts/Funding.js'; + +export { + // Structs + InvestVector, + ClaimFundInput, + CheckIfNotClaimedInput, + ClaimFundProofOutput, + + // Zk Programs & Proofs + TreasuryProof, + ClaimFund, + + // Smart Contract + TreasuryContract, + + // Actions & Events + TreasuryAction, + EventEnum as TreasuryEvents, +} from './contracts/Treasury.js';