Skip to content

Commit

Permalink
[ABW-3982] Check asset deposit rules before transferring on Delete Ac…
Browse files Browse the repository at this point in the history
…count (#272)

* models

* updates

* fixes and set up to filter non transferable

* final implementation

* version bump

* renames

* missing test

* rename to Outcome

* more tests to increase coverage

* updates after feedback

* ignore items with zero amount
  • Loading branch information
matiasbzurovski authored Nov 20, 2024
1 parent 46d12e5 commit 6a47b62
Show file tree
Hide file tree
Showing 45 changed files with 1,926 additions and 81 deletions.
4 changes: 2 additions & 2 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion crates/sargon-uniffi/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "sargon-uniffi"
# Don't forget to update version in crates/sargon/Cargo.toml
version = "1.1.55"
version = "1.1.56"
edition = "2021"
build = "build.rs"

Expand Down
7 changes: 2 additions & 5 deletions crates/sargon-uniffi/src/core/error/common_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -732,14 +732,11 @@ pub enum CommonError {
#[error("Subintent has already expired")]
SubintentExpired = 10206,

#[error("Unexpected collection item aggregation")]
UnexpectedCollectionItemAggregation = 10207,

#[error("Unable to make {amount} transfers in one single transaction")]
MaxTransfersPerTransactionReached { amount: u64 } = 10208,
MaxTransfersPerTransactionReached { amount: u64 } = 10207,

#[error("Transaction Manifest class is reserved: {class}")]
ReservedManifestClass { class: DetailedManifestClass } = 10209,
ReservedManifestClass { class: DetailedManifestClass } = 10208,
}

#[uniffi::export]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
mod sargon_os_delete_account;
mod support;

pub use sargon_os_delete_account::*;
pub use support::*;
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ impl SargonOS {
&self,
account_address: AccountAddress,
recipient_account_address: Option<AccountAddress>,
) -> Result<TransactionManifest> {
) -> Result<CreateDeleteAccountManifestOutcome> {
self.wrapped
.create_delete_account_manifest(
account_address.into_internal(),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
mod outcome;

pub use outcome::*;
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
use crate::prelude::*;
use sargon::CreateDeleteAccountManifestOutcome as InternalCreateDeleteAccountManifestOutcome;

#[derive(Clone, PartialEq, Eq, InternalConversion, uniffi::Record)]
pub struct CreateDeleteAccountManifestOutcome {
pub manifest: TransactionManifest,
pub non_transferable_resources: Vec<ResourceAddress>,
}
3 changes: 2 additions & 1 deletion crates/sargon-uniffi/src/system/sargon_os/mod.rs
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
mod delete_account;
mod pre_authorization;
mod profile_state_holder;
mod sargon_os;
mod sargon_os_accounts;
mod sargon_os_delete_account;
mod sargon_os_factors;
mod sargon_os_gateway;
mod sargon_os_profile;
mod sargon_os_security_structures;
mod sargon_os_sync_accounts;
mod transactions;

pub use delete_account::*;
pub use profile_state_holder::*;
pub use sargon_os::*;
pub use sargon_os_accounts::*;
Expand Down
2 changes: 1 addition & 1 deletion crates/sargon/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "sargon"
# Don't forget to update version in crates/sargon-uniffi/Cargo.toml
version = "1.1.55"
version = "1.1.56"
edition = "2021"
build = "build.rs"

Expand Down
Loading

0 comments on commit 6a47b62

Please sign in to comment.