From 2745d8a05e94b694e3b1c1057c13193ff2289f0f Mon Sep 17 00:00:00 2001 From: leboiko Date: Sat, 21 Dec 2024 15:33:40 -0300 Subject: [PATCH] Last fixes --- consumer/src/mode/decoded/atom/atom_creation.rs | 8 +++++++- consumer/src/mode/resolver/types.rs | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/consumer/src/mode/decoded/atom/atom_creation.rs b/consumer/src/mode/decoded/atom/atom_creation.rs index 62b9e96..13cdb45 100644 --- a/consumer/src/mode/decoded/atom/atom_creation.rs +++ b/consumer/src/mode/decoded/atom/atom_creation.rs @@ -79,7 +79,13 @@ impl AtomCreated { pg_pool: &PgPool, ) -> Result { // First try to find existing account - if let Some(account) = Account::find_by_id(self.atomWallet.to_string(), pg_pool).await? { + if let Some(mut account) = Account::find_by_id(self.atomWallet.to_string(), pg_pool).await? + { + // We update the account type to `AtomWallet` if it is not already set + if account.account_type != AccountType::AtomWallet { + account.account_type = AccountType::AtomWallet; + account.upsert(pg_pool).await?; + } return Ok(account); } diff --git a/consumer/src/mode/resolver/types.rs b/consumer/src/mode/resolver/types.rs index 61e3ff6..3091c85 100644 --- a/consumer/src/mode/resolver/types.rs +++ b/consumer/src/mode/resolver/types.rs @@ -11,7 +11,7 @@ use crate::{ }; use alloy::primitives::Address; use models::{ - account::{Account, AccountType}, + account::Account, atom::{Atom, AtomType}, traits::SimpleCrud, };