Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions xrpl-common-stdlib/src/objects/generated/loan_broker.rs
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ pub trait LoanBrokerFields: LedgerObjectCommonFields {
fn cover_rate_liquidation(&self) -> Result<Option<u32>> {
ledger_object::get_field_optional(self.get_slot_num(), sfield::CoverRateLiquidation)
}

/// The DomainID field (Optional).
fn domain_id(&self) -> Result<Option<Hash256>> {
ledger_object::get_field_optional(self.get_slot_num(), sfield::DomainID)
}
}

/// Trait providing access to fields specific to the current LoanBroker object.
Expand Down Expand Up @@ -200,6 +205,11 @@ pub trait CurrentLoanBrokerFields: CurrentLedgerObjectCommonFields {
fn cover_rate_liquidation(&self) -> Result<Option<u32>> {
current_ledger_object::get_field_optional(sfield::CoverRateLiquidation)
}

/// The DomainID field (Optional).
fn domain_id(&self) -> Result<Option<Hash256>> {
current_ledger_object::get_field_optional(sfield::DomainID)
}
}

#[derive(Debug, Clone, Copy, Eq, PartialEq)]
Expand Down Expand Up @@ -254,6 +264,7 @@ mod tests {
assert!(obj.cover_available().is_ok());
assert!(obj.cover_rate_minimum().is_ok());
assert!(obj.cover_rate_liquidation().is_ok());
assert!(obj.domain_id().is_ok());
}

#[test]
Expand All @@ -268,5 +279,6 @@ mod tests {
assert!(obj.owner_count().unwrap().is_none());
assert!(obj.cover_rate_minimum().unwrap().is_none());
assert!(obj.cover_rate_liquidation().unwrap().is_none());
assert!(obj.domain_id().unwrap().is_none());
}
}
4 changes: 4 additions & 0 deletions xrpl-common-stdlib/src/objects/generated/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ mod ripple_state;
mod signer_list;
mod sponsorship;
mod ticket;
mod transaction_proposal;
mod vault;
mod xchain_owned_claim_id;
mod xchain_owned_create_account_claim_id;
Expand Down Expand Up @@ -66,6 +67,9 @@ pub use ripple_state::{CurrentRippleStateFields, RippleState, RippleStateFields}
pub use signer_list::{CurrentSignerListFields, SignerList, SignerListFields};
pub use sponsorship::{CurrentSponsorshipFields, Sponsorship, SponsorshipFields};
pub use ticket::{CurrentTicketFields, Ticket, TicketFields};
pub use transaction_proposal::{
CurrentTransactionProposalFields, TransactionProposal, TransactionProposalFields,
};
pub use vault::{CurrentVaultFields, Vault, VaultFields};
pub use xchain_owned_claim_id::{
CurrentXChainOwnedClaimIDFields, XChainOwnedClaimID, XChainOwnedClaimIDFields,
Expand Down
11 changes: 11 additions & 0 deletions xrpl-common-stdlib/src/objects/generated/mptoken.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,11 @@ pub trait MPTokenFields: LedgerObjectCommonFields {
fn holder_encryption_key(&self) -> Result<Option<StandardBlob>> {
ledger_object::get_field_optional(self.get_slot_num(), sfield::HolderEncryptionKey)
}

/// The RecoveryKey field (Optional).
fn recovery_key(&self) -> Result<Option<StandardBlob>> {
ledger_object::get_field_optional(self.get_slot_num(), sfield::RecoveryKey)
}
}

/// Trait providing access to fields specific to the current MPToken object.
Expand Down Expand Up @@ -187,6 +192,11 @@ pub trait CurrentMPTokenFields: CurrentLedgerObjectCommonFields {
fn holder_encryption_key(&self) -> Result<Option<StandardBlob>> {
current_ledger_object::get_field_optional(sfield::HolderEncryptionKey)
}

/// The RecoveryKey field (Optional).
fn recovery_key(&self) -> Result<Option<StandardBlob>> {
current_ledger_object::get_field_optional(sfield::RecoveryKey)
}
}

#[derive(Debug, Clone, Copy, Eq, PartialEq)]
Expand Down Expand Up @@ -239,6 +249,7 @@ mod tests {
assert!(obj.issuer_key_mirror_epoch().is_ok());
assert!(obj.auditor_key_mirror_epoch().is_ok());
assert!(obj.holder_encryption_key().is_ok());
assert!(obj.recovery_key().is_ok());
}

#[test]
Expand Down
108 changes: 108 additions & 0 deletions xrpl-common-stdlib/src/objects/generated/transaction_proposal.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
// GENERATED -- do not hand-edit. Run scripts/generate-ledger-objects.sh to regenerate.

use crate::host::Result;
use crate::objects::traits::CurrentLedgerObjectCommonFields;
use crate::objects::traits::LedgerObjectCommonFields;
use crate::objects::{current_ledger_object, ledger_object};
use crate::sfield;
use crate::types::account_id::AccountID;
use crate::types::uint::Hash256;

/// Trait providing access to fields specific to TransactionProposal objects in any ledger.
pub trait TransactionProposalFields: LedgerObjectCommonFields {
/// The PreviousTxnID field (Required).
fn previous_txn_id(&self) -> Result<Hash256> {
ledger_object::get_field(self.get_slot_num(), sfield::PreviousTxnID)
}

/// The PreviousTxnLgrSeq field (Required).
fn previous_txn_lgr_seq(&self) -> Result<u32> {
ledger_object::get_field(self.get_slot_num(), sfield::PreviousTxnLgrSeq)
}

/// The Owner field (Required).
fn owner(&self) -> Result<AccountID> {
ledger_object::get_field(self.get_slot_num(), sfield::Owner)
}

/// The Expiration field (Required).
fn expiration(&self) -> Result<u32> {
ledger_object::get_field(self.get_slot_num(), sfield::Expiration)
}

/// The OwnerNode field (Required).
fn owner_node(&self) -> Result<u64> {
ledger_object::get_field(self.get_slot_num(), sfield::OwnerNode)
}
}

/// Trait providing access to fields specific to the current TransactionProposal object.
pub trait CurrentTransactionProposalFields: CurrentLedgerObjectCommonFields {
/// The PreviousTxnID field (Required).
fn previous_txn_id(&self) -> Result<Hash256> {
current_ledger_object::get_field(sfield::PreviousTxnID)
}

/// The PreviousTxnLgrSeq field (Required).
fn previous_txn_lgr_seq(&self) -> Result<u32> {
current_ledger_object::get_field(sfield::PreviousTxnLgrSeq)
}

/// The Owner field (Required).
fn owner(&self) -> Result<AccountID> {
current_ledger_object::get_field(sfield::Owner)
}

/// The Expiration field (Required).
fn expiration(&self) -> Result<u32> {
current_ledger_object::get_field(sfield::Expiration)
}

/// The OwnerNode field (Required).
fn owner_node(&self) -> Result<u64> {
current_ledger_object::get_field(sfield::OwnerNode)
}
}

#[derive(Debug, Clone, Copy, Eq, PartialEq)]
pub struct TransactionProposal {
pub(crate) slot_num: i32,
}

impl TransactionProposal {
/// Binds this handle to a host-managed slot holding a TransactionProposal ledger object.
pub fn new(slot_num: i32) -> Self {
Self { slot_num }
}
}

impl LedgerObjectCommonFields for TransactionProposal {
fn get_slot_num(&self) -> i32 {
self.slot_num
}
}

impl TransactionProposalFields for TransactionProposal {}

#[cfg(test)]
mod tests {
use super::*;
use crate::host::host_bindings_trait::MockHostBindings;
use crate::host::setup_mock;
use crate::objects::test_utils::*;

#[test]
fn read_all_fields() {
let mut mock = MockHostBindings::new();
mock_all_fields_present(&mut mock);
let _guard = setup_mock(mock);

let obj = TransactionProposal::new(0);

assert!(obj.previous_txn_id().is_ok());
assert!(obj.previous_txn_lgr_seq().is_ok());
assert!(obj.owner().is_ok());
assert!(obj.expiration().is_ok());
assert!(obj.owner_node().is_ok());
}
}
8 changes: 6 additions & 2 deletions xrpl-common-stdlib/src/objects/generated/vault.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,9 @@ pub trait VaultFields: LedgerObjectCommonFields {
ledger_object::get_field_optional(self.get_slot_num(), sfield::LossUnrealized)
}

/// The identifier of the share `MPTokenIssuance` object.
/// The identifier of the share MPTokenIssuance object. The `Vault` entry doesn't store a total
/// share count; the `OutstandingAmount` field of the share issuance is the vault's total
/// outstanding shares.
fn share_mpt_id(&self) -> Result<Hash192> {
ledger_object::get_field(self.get_slot_num(), sfield::ShareMPTID)
}
Expand Down Expand Up @@ -197,7 +199,9 @@ pub trait CurrentVaultFields: CurrentLedgerObjectCommonFields {
current_ledger_object::get_field_optional(sfield::LossUnrealized)
}

/// The identifier of the share `MPTokenIssuance` object.
/// The identifier of the share MPTokenIssuance object. The `Vault` entry doesn't store a total
/// share count; the `OutstandingAmount` field of the share issuance is the vault's total
/// outstanding shares.
fn share_mpt_id(&self) -> Result<Hash192> {
current_ledger_object::get_field(sfield::ShareMPTID)
}
Expand Down
21 changes: 11 additions & 10 deletions xrpl-common-stdlib/src/objects/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -59,15 +59,16 @@ pub use generated::{
CurrentNFTokenOfferFields, CurrentNFTokenPageFields, CurrentNegativeUNLFields,
CurrentOfferFields, CurrentOracleFields, CurrentPayChannelFields,
CurrentPermissionedDomainFields, CurrentRippleStateFields, CurrentSignerListFields,
CurrentSponsorshipFields, CurrentTicketFields, CurrentVaultFields,
CurrentXChainOwnedClaimIDFields, CurrentXChainOwnedCreateAccountClaimIDFields, DID, DIDFields,
Delegate, DelegateFields, DepositPreauth, DepositPreauthFields, DirectoryNode,
DirectoryNodeFields, Escrow, EscrowFields, FeeSettings, FeeSettingsFields, LedgerHashes,
LedgerHashesFields, Loan, LoanBroker, LoanBrokerFields, LoanFields, MPToken, MPTokenFields,
MPTokenIssuance, MPTokenIssuanceFields, NFTokenOffer, NFTokenOfferFields, NFTokenPage,
NFTokenPageFields, NegativeUNL, NegativeUNLFields, Offer, OfferFields, Oracle, OracleFields,
PayChannel, PayChannelFields, PermissionedDomain, PermissionedDomainFields, RippleState,
RippleStateFields, SignerList, SignerListFields, Sponsorship, SponsorshipFields, Ticket,
TicketFields, Vault, VaultFields, XChainOwnedClaimID, XChainOwnedClaimIDFields,
CurrentSponsorshipFields, CurrentTicketFields, CurrentTransactionProposalFields,
CurrentVaultFields, CurrentXChainOwnedClaimIDFields,
CurrentXChainOwnedCreateAccountClaimIDFields, DID, DIDFields, Delegate, DelegateFields,
DepositPreauth, DepositPreauthFields, DirectoryNode, DirectoryNodeFields, Escrow, EscrowFields,
FeeSettings, FeeSettingsFields, LedgerHashes, LedgerHashesFields, Loan, LoanBroker,
LoanBrokerFields, LoanFields, MPToken, MPTokenFields, MPTokenIssuance, MPTokenIssuanceFields,
NFTokenOffer, NFTokenOfferFields, NFTokenPage, NFTokenPageFields, NegativeUNL,
NegativeUNLFields, Offer, OfferFields, Oracle, OracleFields, PayChannel, PayChannelFields,
PermissionedDomain, PermissionedDomainFields, RippleState, RippleStateFields, SignerList,
SignerListFields, Sponsorship, SponsorshipFields, Ticket, TicketFields, TransactionProposal,
TransactionProposalFields, Vault, VaultFields, XChainOwnedClaimID, XChainOwnedClaimIDFields,
XChainOwnedCreateAccountClaimID, XChainOwnedCreateAccountClaimIDFields,
};
8 changes: 4 additions & 4 deletions xrpl-common-stdlib/src/sfield.rs
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ pub const LoanID: SField<Hash256, 327718> = SField::new();
pub const ReferenceHolding: SField<Hash256, 327719> = SField::new();
pub const BlindingFactor: SField<Hash256, 327720> = SField::new();
pub const ObjectID: SField<Hash256, 327721> = SField::new();
pub const ContractHash: SField<Hash256, 327722> = SField::new();
pub const ProposalID: SField<Hash256, 327722> = SField::new();
pub const ContractID: SField<Hash256, 327723> = SField::new();
pub const Amount: SField<Amount, 393217> = SField::new();
pub const Balance: SField<Amount, 393218> = SField::new();
Expand Down Expand Up @@ -335,7 +335,7 @@ pub const AuditorEncryptionKey: SField<StandardBlob, 458796> = SField::new();
pub const AmountCommitment: SField<StandardBlob, 458797> = SField::new();
pub const BalanceCommitment: SField<StandardBlob, 458798> = SField::new();
pub const Bytecode: SField<WasmBlob, 458799> = SField::new();
pub const ContractCode: SField<StandardBlob, 458800> = SField::new();
pub const RecoveryKey: SField<StandardBlob, 458800> = SField::new();
pub const FunctionName: SField<StandardBlob, 458801> = SField::new();
pub const Account: SField<AccountID, 524289> = SField::new();
pub const Owner: SField<AccountID, 524290> = SField::new();
Expand All @@ -362,7 +362,7 @@ pub const HighSponsor: SField<AccountID, 524316> = SField::new();
pub const LowSponsor: SField<AccountID, 524317> = SField::new();
pub const CounterpartySponsor: SField<AccountID, 524318> = SField::new();
pub const Sponsee: SField<AccountID, 524319> = SField::new();
pub const ContractAccount: SField<AccountID, 524320> = SField::new();
pub const SigningFor: SField<AccountID, 524320> = SField::new();
pub const Number: SField<Number, 589825> = SField::new();
pub const AssetsAvailable: SField<Number, 589826> = SField::new();
pub const AssetsMaximum: SField<Number, 589827> = SField::new();
Expand Down Expand Up @@ -413,7 +413,7 @@ pub const BatchSigner: SField<Object, 917539> = SField::new();
pub const Book: SField<Object, 917540> = SField::new();
pub const CounterpartySignature: SField<Object, 917541> = SField::new();
pub const SponsorSignature: SField<Object, 917542> = SField::new();
pub const Function: SField<Object, 917543> = SField::new();
pub const ProposedTransaction: SField<Object, 917543> = SField::new();
pub const InstanceParameter: SField<Object, 917544> = SField::new();
pub const InstanceParameterValue: SField<Object, 917545> = SField::new();
pub const Parameter: SField<Object, 917546> = SField::new();
Expand Down
Loading