@zemyth/raise-sdk 0.1.4 → 0.1.7

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.
@@ -138,7 +138,7 @@ declare function approveProject(program: AnyProgram, args: {
138
138
  projectId: BN;
139
139
  /** USDC mint address (for creating lp_usdc_vault) */
140
140
  usdcMint: PublicKey;
141
- }, adminKeypair: Keypair): Promise<string>;
141
+ }, admin: PublicKey | Keypair): Promise<string>;
142
142
  /**
143
143
  * Create a milestone for a project
144
144
  *
@@ -138,7 +138,7 @@ declare function approveProject(program: AnyProgram, args: {
138
138
  projectId: BN;
139
139
  /** USDC mint address (for creating lp_usdc_vault) */
140
140
  usdcMint: PublicKey;
141
- }, adminKeypair: Keypair): Promise<string>;
141
+ }, admin: PublicKey | Keypair): Promise<string>;
142
142
  /**
143
143
  * Create a milestone for a project
144
144
  *
@@ -1,5 +1,5 @@
1
1
  import { BN } from '@coral-xyz/anchor';
2
- import { PublicKey, ComputeBudgetProgram, SystemProgram, SYSVAR_INSTRUCTIONS_PUBKEY, SYSVAR_RENT_PUBKEY, SYSVAR_CLOCK_PUBKEY } from '@solana/web3.js';
2
+ import { PublicKey, Keypair, ComputeBudgetProgram, SystemProgram, SYSVAR_INSTRUCTIONS_PUBKEY, SYSVAR_RENT_PUBKEY, SYSVAR_CLOCK_PUBKEY } from '@solana/web3.js';
3
3
  import { getAssociatedTokenAddressSync, TOKEN_PROGRAM_ID, ASSOCIATED_TOKEN_PROGRAM_ID } from '@solana/spl-token';
4
4
 
5
5
  // src/instructions/index.ts
@@ -445,7 +445,8 @@ async function submitForApproval(program, projectId, founder) {
445
445
  founder
446
446
  }).rpc();
447
447
  }
448
- async function approveProject(program, args, adminKeypair) {
448
+ async function approveProject(program, args, admin) {
449
+ const adminPubkey = admin instanceof Keypair ? admin.publicKey : admin;
449
450
  const projectPda = getProjectPDA(args.projectId, program.programId);
450
451
  const tokenomicsPda = getTokenomicsPDA(projectPda, program.programId);
451
452
  const tokenVaultPda = getTokenVaultPDA(projectPda, program.programId);
@@ -461,7 +462,7 @@ async function approveProject(program, args, adminKeypair) {
461
462
  const computeBudgetIx = ComputeBudgetProgram.setComputeUnitLimit({
462
463
  units: 4e5
463
464
  });
464
- return getMethods(program).approveProject().accountsPartial({
465
+ let builder = getMethods(program).approveProject().accountsPartial({
465
466
  project: projectPda,
466
467
  tokenomics: tokenomicsPda,
467
468
  tokenVault: tokenVaultPda,
@@ -475,9 +476,13 @@ async function approveProject(program, args, adminKeypair) {
475
476
  futureRoundTokenVault: futureRoundTokenVaultPda,
476
477
  futureRoundVault: futureRoundVaultPda,
477
478
  usdcMint: args.usdcMint,
478
- authority: adminKeypair.publicKey,
479
- payer: adminKeypair.publicKey
480
- }).preInstructions([computeBudgetIx]).signers([adminKeypair]).rpc();
479
+ authority: adminPubkey,
480
+ payer: adminPubkey
481
+ }).preInstructions([computeBudgetIx]);
482
+ if (admin instanceof Keypair) {
483
+ builder = builder.signers([admin]);
484
+ }
485
+ return builder.rpc();
481
486
  }
482
487
  async function createMilestone(program, args, founder) {
483
488
  const projectPda = getProjectPDA(args.projectId, program.programId);