pub struct WebLedger {
pub context: String,
pub ledger_type: String,
pub id: Option<String>,
pub name: String,
pub description: String,
pub default_currency: String,
pub created: u64,
pub updated: u64,
pub entries: Vec<LedgerEntry>,
}Expand description
The full Web Ledger document at /.well-known/webledgers/webledgers.json.
Fields§
§context: String§ledger_type: String§id: Option<String>§name: String§description: String§default_currency: String§created: u64§updated: u64§entries: Vec<LedgerEntry>Implementations§
Source§impl WebLedger
Extension methods on WebLedger for currency-specific operations.
impl WebLedger
Extension methods on WebLedger for currency-specific operations.
The base WebLedger API (credit, debit, get_balance) operates on
the default satoshi balance. Trading requires per-currency balances, so
these helpers work through the LedgerAmount::Multi representation.
Sourcepub fn get_currency_balance(&self, did: &str, currency: &str) -> u64
pub fn get_currency_balance(&self, did: &str, currency: &str) -> u64
Get a DID’s balance in a specific currency.
Sourcepub fn credit_currency(&mut self, did: &str, currency: &str, amount: u64)
pub fn credit_currency(&mut self, did: &str, currency: &str, amount: u64)
Credit a DID in a specific currency.
Sourcepub fn debit_currency(
&mut self,
did: &str,
currency: &str,
amount: u64,
) -> Result<u64, PaymentError>
pub fn debit_currency( &mut self, did: &str, currency: &str, amount: u64, ) -> Result<u64, PaymentError>
Debit a DID in a specific currency.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for WebLedger
impl<'de> Deserialize<'de> for WebLedger
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>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for WebLedger
impl RefUnwindSafe for WebLedger
impl Send for WebLedger
impl Sync for WebLedger
impl Unpin for WebLedger
impl UnsafeUnpin for WebLedger
impl UnwindSafe for WebLedger
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
Mutably borrows from an owned value. Read more