Skip to content
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
5 changes: 5 additions & 0 deletions .changeset/nasty-dots-lie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@codama/renderers-rust': patch
---

Use borsh::to_vec in rust renderer
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ impl CreateGuard {
false,
));
accounts.extend_from_slice(remaining_accounts);
let mut data = CreateGuardInstructionData::new().try_to_vec().unwrap();
let mut args = args.try_to_vec().unwrap();
let mut data = borsh::to_vec(&CreateGuardInstructionData::new()).unwrap();
let mut args = borsh::to_vec(&args).unwrap();
data.append(&mut args);

solana_program::instruction::Instruction {
Expand Down Expand Up @@ -429,8 +429,8 @@ impl<'a, 'b> CreateGuardCpi<'a, 'b> {
is_writable: remaining_account.2,
})
});
let mut data = CreateGuardInstructionData::new().try_to_vec().unwrap();
let mut args = self.__args.try_to_vec().unwrap();
let mut data = borsh::to_vec(&CreateGuardInstructionData::new()).unwrap();
let mut args = borsh::to_vec(&self.__args).unwrap();
data.append(&mut args);

let instruction = solana_program::instruction::Instruction {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ impl Execute {
false,
));
accounts.extend_from_slice(remaining_accounts);
let mut data = ExecuteInstructionData::new().try_to_vec().unwrap();
let mut args = args.try_to_vec().unwrap();
let mut data = borsh::to_vec(&ExecuteInstructionData::new()).unwrap();
let mut args = borsh::to_vec(&args).unwrap();
data.append(&mut args);

solana_program::instruction::Instruction {
Expand Down Expand Up @@ -352,8 +352,8 @@ impl<'a, 'b> ExecuteCpi<'a, 'b> {
is_writable: remaining_account.2,
})
});
let mut data = ExecuteInstructionData::new().try_to_vec().unwrap();
let mut args = self.__args.try_to_vec().unwrap();
let mut data = borsh::to_vec(&ExecuteInstructionData::new()).unwrap();
let mut args = borsh::to_vec(&self.__args).unwrap();
data.append(&mut args);

let instruction = solana_program::instruction::Instruction {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ impl Initialize {
self.payer, true,
));
accounts.extend_from_slice(remaining_accounts);
let data = InitializeInstructionData::new().try_to_vec().unwrap();
let data = borsh::to_vec(&InitializeInstructionData::new()).unwrap();

solana_program::instruction::Instruction {
program_id: crate::WEN_TRANSFER_GUARD_ID,
Expand Down Expand Up @@ -300,7 +300,7 @@ impl<'a, 'b> InitializeCpi<'a, 'b> {
is_writable: remaining_account.2,
})
});
let data = InitializeInstructionData::new().try_to_vec().unwrap();
let data = borsh::to_vec(&InitializeInstructionData::new()).unwrap();

let instruction = solana_program::instruction::Instruction {
program_id: crate::WEN_TRANSFER_GUARD_ID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ impl UpdateGuard {
false,
));
accounts.extend_from_slice(remaining_accounts);
let mut data = UpdateGuardInstructionData::new().try_to_vec().unwrap();
let mut args = args.try_to_vec().unwrap();
let mut data = borsh::to_vec(&UpdateGuardInstructionData::new()).unwrap();
let mut args = borsh::to_vec(&args).unwrap();
data.append(&mut args);

solana_program::instruction::Instruction {
Expand Down Expand Up @@ -349,8 +349,8 @@ impl<'a, 'b> UpdateGuardCpi<'a, 'b> {
is_writable: remaining_account.2,
})
});
let mut data = UpdateGuardInstructionData::new().try_to_vec().unwrap();
let mut args = self.__args.try_to_vec().unwrap();
let mut data = borsh::to_vec(&UpdateGuardInstructionData::new()).unwrap();
let mut args = borsh::to_vec(&self.__args).unwrap();
data.append(&mut args);

let instruction = solana_program::instruction::Instruction {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ impl Instruction1 {
) -> solana_program::instruction::Instruction {
let mut accounts = Vec::with_capacity(remaining_accounts.len());
accounts.extend_from_slice(remaining_accounts);
let data = Instruction1InstructionData::new().try_to_vec().unwrap();
let data = borsh::to_vec(&Instruction1InstructionData::new()).unwrap();

solana_program::instruction::Instruction {
program_id: crate::DUMMY_ID,
Expand Down Expand Up @@ -139,7 +139,7 @@ impl<'a, 'b> Instruction1Cpi<'a, 'b> {
is_writable: remaining_account.2,
})
});
let data = Instruction1InstructionData::new().try_to_vec().unwrap();
let data = borsh::to_vec(&Instruction1InstructionData::new()).unwrap();

let instruction = solana_program::instruction::Instruction {
program_id: crate::DUMMY_ID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ impl Instruction2 {
) -> solana_program::instruction::Instruction {
let mut accounts = Vec::with_capacity(remaining_accounts.len());
accounts.extend_from_slice(remaining_accounts);
let data = Instruction2InstructionData::new().try_to_vec().unwrap();
let data = borsh::to_vec(&Instruction2InstructionData::new()).unwrap();

solana_program::instruction::Instruction {
program_id: crate::DUMMY_ID,
Expand Down Expand Up @@ -139,7 +139,7 @@ impl<'a, 'b> Instruction2Cpi<'a, 'b> {
is_writable: remaining_account.2,
})
});
let data = Instruction2InstructionData::new().try_to_vec().unwrap();
let data = borsh::to_vec(&Instruction2InstructionData::new()).unwrap();

let instruction = solana_program::instruction::Instruction {
program_id: crate::DUMMY_ID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ impl Instruction3 {
) -> solana_program::instruction::Instruction {
let mut accounts = Vec::with_capacity(remaining_accounts.len());
accounts.extend_from_slice(remaining_accounts);
let data = Instruction3InstructionData::new().try_to_vec().unwrap();
let data = borsh::to_vec(&Instruction3InstructionData::new()).unwrap();

solana_program::instruction::Instruction {
program_id: crate::DUMMY_ID,
Expand Down Expand Up @@ -141,7 +141,7 @@ impl<'a, 'b> Instruction3Cpi<'a, 'b> {
is_writable: remaining_account.2,
})
});
let data = Instruction3InstructionData::new().try_to_vec().unwrap();
let data = borsh::to_vec(&Instruction3InstructionData::new()).unwrap();

let instruction = solana_program::instruction::Instruction {
program_id: crate::DUMMY_ID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ impl Instruction4 {
) -> solana_program::instruction::Instruction {
let mut accounts = Vec::with_capacity(remaining_accounts.len());
accounts.extend_from_slice(remaining_accounts);
let mut data = Instruction4InstructionData::new().try_to_vec().unwrap();
let mut args = args.try_to_vec().unwrap();
let mut data = borsh::to_vec(&Instruction4InstructionData::new()).unwrap();
let mut args = borsh::to_vec(&args).unwrap();
data.append(&mut args);

solana_program::instruction::Instruction {
Expand Down Expand Up @@ -168,8 +168,8 @@ impl<'a, 'b> Instruction4Cpi<'a, 'b> {
is_writable: remaining_account.2,
})
});
let mut data = Instruction4InstructionData::new().try_to_vec().unwrap();
let mut args = self.__args.try_to_vec().unwrap();
let mut data = borsh::to_vec(&Instruction4InstructionData::new()).unwrap();
let mut args = borsh::to_vec(&self.__args).unwrap();
data.append(&mut args);

let instruction = solana_program::instruction::Instruction {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,8 @@ impl Instruction5 {
) -> solana_program::instruction::Instruction {
let mut accounts = Vec::with_capacity(remaining_accounts.len());
accounts.extend_from_slice(remaining_accounts);
let mut data = Instruction5InstructionData::new().try_to_vec().unwrap();
let mut args = args.try_to_vec().unwrap();
let mut data = borsh::to_vec(&Instruction5InstructionData::new()).unwrap();
let mut args = borsh::to_vec(&args).unwrap();
data.append(&mut args);

solana_program::instruction::Instruction {
Expand Down Expand Up @@ -169,8 +169,8 @@ impl<'a, 'b> Instruction5Cpi<'a, 'b> {
is_writable: remaining_account.2,
})
});
let mut data = Instruction5InstructionData::new().try_to_vec().unwrap();
let mut args = self.__args.try_to_vec().unwrap();
let mut data = borsh::to_vec(&Instruction5InstructionData::new()).unwrap();
let mut args = borsh::to_vec(&self.__args).unwrap();
data.append(&mut args);

let instruction = solana_program::instruction::Instruction {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ impl Instruction6 {
false,
));
accounts.extend_from_slice(remaining_accounts);
let data = Instruction6InstructionData::new().try_to_vec().unwrap();
let data = borsh::to_vec(&Instruction6InstructionData::new()).unwrap();

solana_program::instruction::Instruction {
program_id: crate::DUMMY_ID,
Expand Down Expand Up @@ -171,7 +171,7 @@ impl<'a, 'b> Instruction6Cpi<'a, 'b> {
is_writable: remaining_account.2,
})
});
let data = Instruction6InstructionData::new().try_to_vec().unwrap();
let data = borsh::to_vec(&Instruction6InstructionData::new()).unwrap();

let instruction = solana_program::instruction::Instruction {
program_id: crate::DUMMY_ID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ impl Instruction7 {
));
}
accounts.extend_from_slice(remaining_accounts);
let data = Instruction7InstructionData::new().try_to_vec().unwrap();
let data = borsh::to_vec(&Instruction7InstructionData::new()).unwrap();

solana_program::instruction::Instruction {
program_id: crate::DUMMY_ID,
Expand Down Expand Up @@ -185,7 +185,7 @@ impl<'a, 'b> Instruction7Cpi<'a, 'b> {
is_writable: remaining_account.2,
})
});
let data = Instruction7InstructionData::new().try_to_vec().unwrap();
let data = borsh::to_vec(&Instruction7InstructionData::new()).unwrap();

let instruction = solana_program::instruction::Instruction {
program_id: crate::DUMMY_ID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ impl AddMemo {
) -> solana_program::instruction::Instruction {
let mut accounts = Vec::with_capacity(remaining_accounts.len());
accounts.extend_from_slice(remaining_accounts);
let mut data = AddMemoInstructionData::new().try_to_vec().unwrap();
let mut args = args.try_to_vec().unwrap();
let mut data = borsh::to_vec(&AddMemoInstructionData::new()).unwrap();
let mut args = borsh::to_vec(&args).unwrap();
data.append(&mut args);

solana_program::instruction::Instruction {
Expand Down Expand Up @@ -169,8 +169,8 @@ impl<'a, 'b> AddMemoCpi<'a, 'b> {
is_writable: remaining_account.2,
})
});
let mut data = AddMemoInstructionData::new().try_to_vec().unwrap();
let mut args = self.__args.try_to_vec().unwrap();
let mut data = borsh::to_vec(&AddMemoInstructionData::new()).unwrap();
let mut args = borsh::to_vec(&self.__args).unwrap();
data.append(&mut args);

let instruction = solana_program::instruction::Instruction {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ impl AdvanceNonceAccount {
true,
));
accounts.extend_from_slice(remaining_accounts);
let data = AdvanceNonceAccountInstructionData::new()
.try_to_vec()
.unwrap();
let data = borsh::to_vec(&AdvanceNonceAccountInstructionData::new()).unwrap();

solana_program::instruction::Instruction {
program_id: crate::SYSTEM_ID,
Expand Down Expand Up @@ -230,9 +228,7 @@ impl<'a, 'b> AdvanceNonceAccountCpi<'a, 'b> {
is_writable: remaining_account.2,
})
});
let data = AdvanceNonceAccountInstructionData::new()
.try_to_vec()
.unwrap();
let data = borsh::to_vec(&AdvanceNonceAccountInstructionData::new()).unwrap();

let instruction = solana_program::instruction::Instruction {
program_id: crate::SYSTEM_ID,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ impl Allocate {
true,
));
accounts.extend_from_slice(remaining_accounts);
let mut data = AllocateInstructionData::new().try_to_vec().unwrap();
let mut args = args.try_to_vec().unwrap();
let mut data = borsh::to_vec(&AllocateInstructionData::new()).unwrap();
let mut args = borsh::to_vec(&args).unwrap();
data.append(&mut args);

solana_program::instruction::Instruction {
Expand Down Expand Up @@ -198,8 +198,8 @@ impl<'a, 'b> AllocateCpi<'a, 'b> {
is_writable: remaining_account.2,
})
});
let mut data = AllocateInstructionData::new().try_to_vec().unwrap();
let mut args = self.__args.try_to_vec().unwrap();
let mut data = borsh::to_vec(&AllocateInstructionData::new()).unwrap();
let mut args = borsh::to_vec(&self.__args).unwrap();
data.append(&mut args);

let instruction = solana_program::instruction::Instruction {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ impl AllocateWithSeed {
true,
));
accounts.extend_from_slice(remaining_accounts);
let mut data = AllocateWithSeedInstructionData::new().try_to_vec().unwrap();
let mut args = args.try_to_vec().unwrap();
let mut data = borsh::to_vec(&AllocateWithSeedInstructionData::new()).unwrap();
let mut args = borsh::to_vec(&args).unwrap();
data.append(&mut args);

solana_program::instruction::Instruction {
Expand Down Expand Up @@ -249,8 +249,8 @@ impl<'a, 'b> AllocateWithSeedCpi<'a, 'b> {
is_writable: remaining_account.2,
})
});
let mut data = AllocateWithSeedInstructionData::new().try_to_vec().unwrap();
let mut args = self.__args.try_to_vec().unwrap();
let mut data = borsh::to_vec(&AllocateWithSeedInstructionData::new()).unwrap();
let mut args = borsh::to_vec(&self.__args).unwrap();
data.append(&mut args);

let instruction = solana_program::instruction::Instruction {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ impl Assign {
true,
));
accounts.extend_from_slice(remaining_accounts);
let mut data = AssignInstructionData::new().try_to_vec().unwrap();
let mut args = args.try_to_vec().unwrap();
let mut data = borsh::to_vec(&AssignInstructionData::new()).unwrap();
let mut args = borsh::to_vec(&args).unwrap();
data.append(&mut args);

solana_program::instruction::Instruction {
Expand Down Expand Up @@ -202,8 +202,8 @@ impl<'a, 'b> AssignCpi<'a, 'b> {
is_writable: remaining_account.2,
})
});
let mut data = AssignInstructionData::new().try_to_vec().unwrap();
let mut args = self.__args.try_to_vec().unwrap();
let mut data = borsh::to_vec(&AssignInstructionData::new()).unwrap();
let mut args = borsh::to_vec(&self.__args).unwrap();
data.append(&mut args);

let instruction = solana_program::instruction::Instruction {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ impl AssignWithSeed {
true,
));
accounts.extend_from_slice(remaining_accounts);
let mut data = AssignWithSeedInstructionData::new().try_to_vec().unwrap();
let mut args = args.try_to_vec().unwrap();
let mut data = borsh::to_vec(&AssignWithSeedInstructionData::new()).unwrap();
let mut args = borsh::to_vec(&args).unwrap();
data.append(&mut args);

solana_program::instruction::Instruction {
Expand Down Expand Up @@ -241,8 +241,8 @@ impl<'a, 'b> AssignWithSeedCpi<'a, 'b> {
is_writable: remaining_account.2,
})
});
let mut data = AssignWithSeedInstructionData::new().try_to_vec().unwrap();
let mut args = self.__args.try_to_vec().unwrap();
let mut data = borsh::to_vec(&AssignWithSeedInstructionData::new()).unwrap();
let mut args = borsh::to_vec(&self.__args).unwrap();
data.append(&mut args);

let instruction = solana_program::instruction::Instruction {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,8 @@ impl AuthorizeNonceAccount {
true,
));
accounts.extend_from_slice(remaining_accounts);
let mut data = AuthorizeNonceAccountInstructionData::new()
.try_to_vec()
.unwrap();
let mut args = args.try_to_vec().unwrap();
let mut data = borsh::to_vec(&AuthorizeNonceAccountInstructionData::new()).unwrap();
let mut args = borsh::to_vec(&args).unwrap();
data.append(&mut args);

solana_program::instruction::Instruction {
Expand Down Expand Up @@ -230,10 +228,8 @@ impl<'a, 'b> AuthorizeNonceAccountCpi<'a, 'b> {
is_writable: remaining_account.2,
})
});
let mut data = AuthorizeNonceAccountInstructionData::new()
.try_to_vec()
.unwrap();
let mut args = self.__args.try_to_vec().unwrap();
let mut data = borsh::to_vec(&AuthorizeNonceAccountInstructionData::new()).unwrap();
let mut args = borsh::to_vec(&self.__args).unwrap();
data.append(&mut args);

let instruction = solana_program::instruction::Instruction {
Expand Down
Loading