Update governance.rs: Fixup anchor return types (#1582)
This commit is contained in:
parent
5c5fa7927f
commit
552789a072
|
@ -19,6 +19,7 @@ incremented for features.
|
|||
### Fixes
|
||||
|
||||
* ts: Fix the loss of strict typing using the `methods` namespace on builder functions ([#1539](https://github.com/project-serum/anchor/pull/1539)).
|
||||
* spl: Update `spl/governance` to use new errors ([#1582](https://github.com/project-serum/anchor/pull/1582)).
|
||||
|
||||
### Breaking
|
||||
|
||||
|
|
|
@ -7,7 +7,7 @@ macro_rules! vote_weight_record {
|
|||
pub struct VoterWeightRecord(spl_governance_addin_api::voter_weight::VoterWeightRecord);
|
||||
|
||||
impl anchor_lang::AccountDeserialize for VoterWeightRecord {
|
||||
fn try_deserialize(buf: &mut &[u8]) -> std::result::Result<Self, ProgramError> {
|
||||
fn try_deserialize(buf: &mut &[u8]) -> anchor_lang::Result<Self> {
|
||||
let mut data = buf;
|
||||
let vwr: spl_governance_addin_api::voter_weight::VoterWeightRecord =
|
||||
anchor_lang::AnchorDeserialize::deserialize(&mut data)
|
||||
|
@ -18,9 +18,7 @@ macro_rules! vote_weight_record {
|
|||
Ok(VoterWeightRecord(vwr))
|
||||
}
|
||||
|
||||
fn try_deserialize_unchecked(
|
||||
buf: &mut &[u8],
|
||||
) -> std::result::Result<Self, ProgramError> {
|
||||
fn try_deserialize_unchecked(buf: &mut &[u8]) -> anchor_lang::Result<Self> {
|
||||
let mut data = buf;
|
||||
let vwr: spl_governance_addin_api::voter_weight::VoterWeightRecord =
|
||||
anchor_lang::AnchorDeserialize::deserialize(&mut data)
|
||||
|
@ -30,10 +28,7 @@ macro_rules! vote_weight_record {
|
|||
}
|
||||
|
||||
impl anchor_lang::AccountSerialize for VoterWeightRecord {
|
||||
fn try_serialize<W: std::io::Write>(
|
||||
&self,
|
||||
writer: &mut W,
|
||||
) -> std::result::Result<(), ProgramError> {
|
||||
fn try_serialize<W: std::io::Write>(&self, writer: &mut W) -> anchor_lang::Result<()> {
|
||||
anchor_lang::AnchorSerialize::serialize(&self.0, writer)
|
||||
.map_err(|_| anchor_lang::error::ErrorCode::AccountDidNotSerialize)?;
|
||||
Ok(())
|
||||
|
|
Loading…
Reference in New Issue