Split arguments to handlers for cleaner API
Change-Id: If8995bbb61775040d8e666e6af3cccae39f57919
This commit is contained in:
parent
482666b3fa
commit
21de7a58af
|
@ -1,6 +1,11 @@
|
|||
use crate::{accounts, Initialize, InitializeData};
|
||||
use crate::{accounts, types::BridgeConfig, Initialize, InitializeData, MAX_LEN_GUARDIAN_KEYS};
|
||||
use anchor_lang::{prelude::*, solana_program};
|
||||
|
||||
pub fn initialize(ctx: Context<Initialize>, data: InitializeData) -> ProgramResult {
|
||||
pub fn initialize(
|
||||
ctx: Context<Initialize>,
|
||||
len_guardians: u8,
|
||||
initial_guardian_key: [[u8; 20]; MAX_LEN_GUARDIAN_KEYS],
|
||||
config: BridgeConfig,
|
||||
) -> ProgramResult {
|
||||
Ok(())
|
||||
}
|
||||
|
|
|
@ -48,7 +48,7 @@ pub struct InitializeData {
|
|||
/// number of initial guardians
|
||||
pub len_guardians: u8,
|
||||
/// guardians that are allowed to sign mints
|
||||
pub initial_guardian: [[u8; 20]; MAX_LEN_GUARDIAN_KEYS],
|
||||
pub initial_guardian_keys: [[u8; 20]; MAX_LEN_GUARDIAN_KEYS],
|
||||
/// config for the bridge
|
||||
pub config: BridgeConfig,
|
||||
}
|
||||
|
@ -58,7 +58,12 @@ pub mod anchor_bridge {
|
|||
use super::*;
|
||||
|
||||
pub fn initialize(ctx: Context<Initialize>, data: InitializeData) -> ProgramResult {
|
||||
api::initialize(ctx, data)
|
||||
api::initialize(
|
||||
ctx,
|
||||
data.len_guardians,
|
||||
data.initial_guardian_keys,
|
||||
data.config,
|
||||
)
|
||||
}
|
||||
|
||||
pub fn verify_signatures(ctx: Context<VerifySig>, data: VerifySigsData) -> ProgramResult {
|
||||
|
|
|
@ -8,4 +8,3 @@ pub struct BridgeConfig {
|
|||
/// this period we still trust the old guardian set.
|
||||
pub guardian_set_expiration_time: u32,
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue