Skip to content
Open
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
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,10 @@ pub struct Redeem<'info> {
#[account(mut)]
pub payer: Signer<'info>,

// NOTE: this works when the contract is paused
#[account(
constraint = config.threshold > 0 @ NTTError::ZeroThreshold
)]
pub config: Account<'info, Config>,
pub config: NotPausedConfig<'info>,

#[account(
seeds = [NttManagerPeer::SEED_PREFIX, ValidatedTransceiverMessage::<NativeTokenTransfer<Payload>>::from_chain(&transceiver_message)?.id.to_be_bytes().as_ref()],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use anchor_lang::{prelude::Pubkey, system_program::System, Id, InstructionData, ToAccountMetas};
use example_native_token_transfers::instructions::RedeemArgs;
use example_native_token_transfers::{accounts::NotPausedConfig, instructions::RedeemArgs};
use solana_sdk::instruction::Instruction;

use crate::sdk::accounts::NTT;
Expand All @@ -20,7 +20,9 @@ pub fn redeem(ntt: &NTT, accs: Redeem, args: RedeemArgs) -> Instruction {

let accounts = example_native_token_transfers::accounts::Redeem {
payer: accs.payer,
config: ntt.config(),
config: NotPausedConfig {
config: ntt.config(),
},
peer: accs.peer,
transceiver_message: accs.transceiver_message,
transceiver: ntt.registered_transceiver(&accs.transceiver),
Expand Down
9 changes: 7 additions & 2 deletions solana/ts/idl/3_0_0/json/example_native_token_transfers.json
Original file line number Diff line number Diff line change
Expand Up @@ -426,8 +426,13 @@
},
{
"name": "config",
"isMut": false,
"isSigner": false
"accounts": [
{
"name": "config",
"isMut": false,
"isSigner": false
}
]
},
{
"name": "peer",
Expand Down
18 changes: 14 additions & 4 deletions solana/ts/idl/3_0_0/ts/example_native_token_transfers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -426,8 +426,13 @@ export type ExampleNativeTokenTransfers = {
},
{
"name": "config",
"isMut": false,
"isSigner": false
"accounts": [
{
"name": "config",
"isMut": false,
"isSigner": false
}
]
},
{
"name": "peer",
Expand Down Expand Up @@ -2916,8 +2921,13 @@ export const IDL: ExampleNativeTokenTransfers = {
},
{
"name": "config",
"isMut": false,
"isSigner": false
"accounts": [
{
"name": "config",
"isMut": false,
"isSigner": false
}
]
},
{
"name": "peer",
Expand Down
7 changes: 6 additions & 1 deletion solana/ts/lib/ntt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1128,6 +1128,8 @@ export namespace NTT {
pdas?: Pdas,
transceiverPdas?: TransceiverPdas
): Promise<TransactionInstruction> {
const [major, , ,] = parseVersion(program.idl.version);

pdas = pdas ?? NTT.pdas(program.programId);
transceiverPdas =
transceiverPdas ?? NTT.transceiverPdas(transceiverProgramId);
Expand All @@ -1140,7 +1142,10 @@ export namespace NTT {
.redeem({})
.accounts({
payer: args.payer,
config: pdas.configAccount(),
// TODO: bump version to properly gate
// NOTE: For versions >= 3.x.x, NotPausedConfig is used
config:
major >= 3 ? { config: pdas.configAccount() } : pdas.configAccount(),
peer: pdas.peerAccount(chain),
transceiverMessage: transceiverPdas.transceiverMessageAccount(
chain,
Expand Down
Loading