Skip to content

Commit

Permalink
Merge pull request #22 from sunrise-stake/fund-sender-program-id
Browse files Browse the repository at this point in the history
Update fund sender program with actual ID
  • Loading branch information
dankelleher committed Oct 25, 2023
2 parents 8bbf1a7 + 7363123 commit 6a298c8
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 18 deletions.
2 changes: 1 addition & 1 deletion Anchor.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ skip-lint = false
buy_burn_fixed = "stcGmoLCBsr2KSu2vvcSuqMiEZx36F32ySUtCXjab5B"
buy_burn_switchboard = "sbnbpcN3HVfcj9jTwzncwLeNvCzSwbfMwNmdAgX36VW"
yield_router = "syriqUnUPcFQjRSaxdFo2wPnXXPjbRsLmhiWUVoGdTo"
fund_sender = "rodTth5pXjkUfQpqMp7tEFdN1sdv2JwqhXg8RH9YrWD"
fund_sender = "sfsH2CVS2SaXwnrGwgTVrG7ytZAxSCsTnW82BvjWTGz"

[registry]
url = "https://api.apr.dev"
Expand Down
2 changes: 1 addition & 1 deletion packages/fund-sender/client/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import BN from "bn.js";
import { FundSender, IDL } from "../../types/fund_sender";

export const PROGRAM_ID = new PublicKey(
"rodTth5pXjkUfQpqMp7tEFdN1sdv2JwqhXg8RH9YrWD"
"sfsH2CVS2SaXwnrGwgTVrG7ytZAxSCsTnW82BvjWTGz"
);

/**
Expand Down
23 changes: 8 additions & 15 deletions packages/fund-sender/scripts/storeCertificates.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
/* eslint-disable @typescript-eslint/no-var-requires */
import { AnchorProvider } from "@coral-xyz/anchor";
import { FundSenderClient } from "../client";
import { logSplBalance } from "./lib/util";
import { Keypair, PublicKey } from "@solana/web3.js";
import { PublicKey } from "@solana/web3.js";
import {
getOrCreateAssociatedTokenAccount,
getAssociatedTokenAddressSync,
TOKEN_PROGRAM_ID,
} from "@solana/spl-token";

Expand All @@ -29,11 +28,6 @@ const destinationName = process.argv[2];

console.log("state address", stateAddress.toBase58());
console.log("state account data", client.config);
const provider = AnchorProvider.local();
const connection = provider.connection;
const anchorWallet = Keypair.fromSecretKey(
Buffer.from(require(process.env.ANCHOR_WALLET as string))
);
const allInputTokenAccountsResponse =
await client.provider.connection.getParsedTokenAccountsByOwner(
client.getInputAccount(),
Expand All @@ -54,26 +48,25 @@ const destinationName = process.argv[2];
inputTokenAccount.pubkey.toBase58()
);

const mint = inputTokenAccount.account.data.parsed.info.mint;
const mint = new PublicKey(inputTokenAccount.account.data.parsed.info.mint);
console.log(mint);

const certificateVaultAta = await getOrCreateAssociatedTokenAccount(
connection,
anchorWallet,
const certificateVaultAta = getAssociatedTokenAddressSync(
mint,
client.config.certificateVault,
false
true
);

await client.storeCertificates(
inputTokenAccount.pubkey,
certificateVaultAta.address,
certificateVaultAta,
mint
);

await log(
"remaining input certificate token in account",
inputTokenAccount.pubkey
);
await log("token in certificate vault ATA", certificateVaultAta.address);
await log("token in certificate vault ATA", certificateVaultAta);
}
})().catch(console.error);
2 changes: 1 addition & 1 deletion programs/fund-sender/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use anchor_lang::prelude::*;
mod utils;

// how to write it to leave it to be filled with new id for each deployed program for each climate project?
declare_id!("rodTth5pXjkUfQpqMp7tEFdN1sdv2JwqhXg8RH9YrWD");
declare_id!("sfsH2CVS2SaXwnrGwgTVrG7ytZAxSCsTnW82BvjWTGz");

#[program]
pub mod fund_sender {
Expand Down

0 comments on commit 6a298c8

Please sign in to comment.