pub struct Vault<'a> {Show 16 fields
pub common_fields: CommonFields<'a, VaultFlag>,
pub owner: Cow<'a, str>,
pub account: Cow<'a, str>,
pub asset: Currency<'a>,
pub assets_total: Option<Cow<'a, str>>,
pub assets_available: Option<Cow<'a, str>>,
pub assets_maximum: Option<Cow<'a, str>>,
pub loss_unrealized: Option<Cow<'a, str>>,
pub share_mpt_id: Cow<'a, str>,
pub withdrawal_policy: u8,
pub scale: Option<u8>,
pub sequence: u32,
pub data: Option<Cow<'a, str>>,
pub owner_node: Cow<'a, str>,
pub previous_txn_id: Cow<'a, str>,
pub previous_txn_lgr_seq: u32,
}Expand description
The Vault object type describes a single-asset vault instance (XLS-65).
All string fields use Cow<'a, str>. Vault objects are constructed by the
server; callers should treat all fields as read-only.
Note: the ideal field type for server-read-only strings is &'a str
(zero-copy, immutable). However, switching to &'a str with
#[serde(borrow)] requires the 'de: 'a lifetime constraint to propagate
through the entire LedgerEntry → BaseLedger → LedgerV1 chain, which
affects all other ledger objects. A follow-up PR should migrate Vault,
AccountRoot, MPToken, and MPTokenIssuance to &'a str together as
part of a codebase-wide ledger-object cleanup.
<https://github.com/XRPLF/XRPL-Standards/tree/master/XLS-0065-single-asset-vault>
Fields§
§common_fields: CommonFields<'a, VaultFlag>The base fields for all ledger object models.
See Ledger Object Common Fields:
<https://xrpl.org/ledger-entry-common-fields.html>
owner: Cow<'a, str>The account address of the Vault Owner. (SoeRequired)
account: Cow<'a, str>The address of the Vault’s pseudo-account. (SoeRequired)
asset: Currency<'a>The asset of the vault (XRP, IOU or MPT). (SoeRequired)
assets_total: Option<Cow<'a, str>>The total value of the vault. (SoeDefault)
assets_available: Option<Cow<'a, str>>The asset amount that is available in the vault. (SoeDefault)
assets_maximum: Option<Cow<'a, str>>The maximum asset amount that can be held in the vault. Zero means no cap. (SoeOptional)
loss_unrealized: Option<Cow<'a, str>>The potential loss amount that is not yet realized, expressed as the vault’s asset. (SoeDefault)
The identifier of the share MPTokenIssuance object. (SoeRequired)
withdrawal_policy: u8Indicates the withdrawal strategy used by the Vault. (SoeRequired)
scale: Option<u8>The Scale specifies the power of 10 to multiply an asset’s value by when converting it into an integer-based number of shares. (SoeDefault)
sequence: u32The transaction sequence number that created the vault. (SoeRequired)
data: Option<Cow<'a, str>>Arbitrary metadata about the Vault. Limited to 256 bytes. (SoeOptional)
owner_node: Cow<'a, str>A hint indicating which page of the owner’s directory links to this object. (SoeRequired)
previous_txn_id: Cow<'a, str>The identifying hash of the transaction that most recently modified this object.
previous_txn_lgr_seq: u32The index of the ledger that contains the transaction that most recently modified this object.
Implementations§
Source§impl<'a> Vault<'a>
impl<'a> Vault<'a>
Sourcepub fn new(
flags: FlagCollection<VaultFlag>,
index: Option<Cow<'a, str>>,
owner: Cow<'a, str>,
account: Cow<'a, str>,
asset: Currency<'a>,
share_mpt_id: Cow<'a, str>,
withdrawal_policy: u8,
sequence: u32,
owner_node: Cow<'a, str>,
previous_txn_id: Cow<'a, str>,
previous_txn_lgr_seq: u32,
) -> Self
pub fn new( flags: FlagCollection<VaultFlag>, index: Option<Cow<'a, str>>, owner: Cow<'a, str>, account: Cow<'a, str>, asset: Currency<'a>, share_mpt_id: Cow<'a, str>, withdrawal_policy: u8, sequence: u32, owner_node: Cow<'a, str>, previous_txn_id: Cow<'a, str>, previous_txn_lgr_seq: u32, ) -> Self
Create a new Vault with required fields; optional fields default to None.
Trait Implementations§
Source§impl<'de, 'a> Deserialize<'de> for Vault<'a>
impl<'de, 'a> Deserialize<'de> for Vault<'a>
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl<'a> Eq for Vault<'a>
Source§impl<'a> LedgerObject<VaultFlag> for Vault<'a>
impl<'a> LedgerObject<VaultFlag> for Vault<'a>
fn get_ledger_entry_type(&self) -> LedgerEntryType
fn has_flag(&self, flag: &T) -> bool
Source§impl<'a> Model for Vault<'a>
impl<'a> Model for Vault<'a>
Source§fn get_errors(&self) -> XRPLModelResult<()>
fn get_errors(&self) -> XRPLModelResult<()>
Source§fn validate(&self) -> XRPLModelResult<()>
fn validate(&self) -> XRPLModelResult<()>
get_errors if there was one.impl<'a> StructuralPartialEq for Vault<'a>
Auto Trait Implementations§
impl<'a> Freeze for Vault<'a>
impl<'a> RefUnwindSafe for Vault<'a>
impl<'a> Send for Vault<'a>
impl<'a> Sync for Vault<'a>
impl<'a> Unpin for Vault<'a>
impl<'a> UnsafeUnpin for Vault<'a>
impl<'a> UnwindSafe for Vault<'a>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.