Skip to content

Instantly share code, notes, and snippets.

@vl-dev
vl-dev / rent_return.rs
Last active November 11, 2023 13:38
An Anchor program demonstrating a way how to return rent to the original payer on Solana
use anchor_lang::prelude::*;
declare_id!("F3cfJcsELoKqwXFViEMPS3MAUSUjwrgLExpwSqLLEphf");
#[program]
pub mod rent_return {
use super::*;
pub fn initialize(ctx: Context<Initialize>) -> Result<()> {
ctx.accounts.acc.rent_payer = *ctx.accounts.fee_payer.key;
@vl-dev
vl-dev / rent_return.ts
Last active November 11, 2023 13:36
This is a typescript test for the Anchor program demonstrating a way how to return rent to the original payer on Solana
import * as anchor from "@coral-xyz/anchor";
import { Program } from "@coral-xyz/anchor";
import { RentReturn } from "../target/types/rent_return";
import { expect } from "chai";
const { SystemProgram, PublicKey } = anchor.web3;
describe("rent_return", () => {
// Configure the client to use the local cluster.
const provider = anchor.AnchorProvider.env()
@vl-dev
vl-dev / gist:d9aedb8dbd8a1f694b3f8c26bf289eb0
Created October 24, 2023 14:36
Failing Anchor CPI to Bubblegum
use anchor_lang::prelude::*;
use mpl_bubblegum::program::Bubblegum;
use solana_program::pubkey::Pubkey;
use spl_account_compression::{
Noop, program::SplAccountCompression,
};
declare_id!("BtuqD66LQtfASw12jDfKGNUSf5g3GwNk9jZFnMwXFruC");
#[program]