Skip to content

Commit 9887f1b

Browse files
committed
refactor(solana-solvers): move swap instructions into the solution instead of cloning
1 parent 7385b72 commit 9887f1b

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

crates/solana-solvers/src/domain/solution.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ impl Solution {
120120
}],
121121
interactions: swap
122122
.instructions
123-
.iter()
123+
.into_iter()
124124
.map(Instruction::from_sdk)
125125
.collect(),
126126
cu_estimate: None,
@@ -130,19 +130,19 @@ impl Solution {
130130
}
131131

132132
impl Instruction {
133-
fn from_sdk(instruction: &SolInstruction) -> Self {
133+
fn from_sdk(instruction: SolInstruction) -> Self {
134134
Self {
135135
program_id: instruction.program_id,
136136
accounts: instruction
137137
.accounts
138-
.iter()
138+
.into_iter()
139139
.map(|meta| AccountMeta {
140140
pubkey: meta.pubkey,
141141
is_signer: meta.is_signer,
142142
is_writable: meta.is_writable,
143143
})
144144
.collect(),
145-
instruction_data: instruction.data.clone(),
145+
instruction_data: instruction.data,
146146
}
147147
}
148148
}

0 commit comments

Comments
 (0)