From 9411304732bb8d6df71edacbf1911b07c73d793b Mon Sep 17 00:00:00 2001 From: Paul Schaaf Date: Mon, 20 Dec 2021 11:04:43 +0100 Subject: [PATCH 1/2] lang: add 'set_inner' function to Account<'a, T> --- lang/src/accounts/account.rs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lang/src/accounts/account.rs b/lang/src/accounts/account.rs index f182d2e401..7ce20e36de 100644 --- a/lang/src/accounts/account.rs +++ b/lang/src/accounts/account.rs @@ -73,6 +73,10 @@ impl<'a, T: AccountSerialize + AccountDeserialize + Owner + Clone> Account<'a, T pub fn into_inner(self) -> T { self.account } + + pub fn set_inner(&mut self, inner: T) { + self.account = inner; + } } impl<'info, T: AccountSerialize + AccountDeserialize + Owner + Clone> Accounts<'info> From 260b3aca5e00a017b3c6818921edc08c875cd9ef Mon Sep 17 00:00:00 2001 From: Paul Schaaf Date: Mon, 20 Dec 2021 11:10:25 +0100 Subject: [PATCH 2/2] docs: add changelog entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9df4351507..b8be5881d4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ incremented for features. * lang: Add `programdata_address: Option` field to `Program` account. Will be populated if account is a program owned by the upgradable bpf loader ([#1125](https://github.com/project-serum/anchor/pull/1125)) * lang,ts,ci,cli,docs: update solana toolchain to version 1.8.5([#1133](https://github.com/project-serum/anchor/pull/1133)) * ts: Add optional commitment argument to `fetch` and `fetchMultiple` ([#1171](https://github.com/project-serum/anchor/pull/1171)) +* lang: Add `set_inner` method to `Account<'a, T>` to enable easy updates ([#1177](https://github.com/project-serum/anchor/pull/1177)) ### Breaking