Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update fund sender program with actual ID #22

Merged
merged 2 commits into from
Oct 25, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading