Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: payment quotes #981

Merged
merged 4 commits into from Nov 20, 2023
Merged

feat: payment quotes #981

merged 4 commits into from Nov 20, 2023

Conversation

grumbach
Copy link
Member

@grumbach grumbach commented Nov 20, 2023

Description

Summary generated by Reviewpad on 20 Nov 23 06:58 UTC

This pull request includes changes in multiple files:

  1. The response.rs file:

    • Renamed the store_cost field to quote and changed its type from Result<NanoTokens> to Result<PaymentQuote>.
    • Updated the debug implementation of the QueryResponse enum.
  2. The offline_transfer.rs file:

    • Removed imports for CashNoteRedemption, UniquePubkey, and ContentPaymentsMap.
    • Removed struct definitions for PaymentDetails and ContentPaymentsMap.
    • Updated the OfflineTransfer struct by replacing the all_extended_data_payments field with all_spend_requests.
  3. The data_payments.rs file:

    • Introduced new struct definitions: Payment, PaymentDetails, and PaymentQuote.
    • Defined type aliases: ContentPaymentsMap and QuoteSignature.
    • Added utility methods to the PaymentDetails and PaymentQuote structs.
    • Added module-level documentation, file header, and license information.
    • Imported necessary modules and types from other files.
  4. The sn_client/src/wallet.rs file:

    • Renamed the get_payment_transfers function to get_payment_for_addr.
    • Modified the return type of get_payment_for_addr from Vec<Transfer> to Payment.
    • Changed the return type of get_store_cost_at_address from (MainPubkey, NanoTokens) to (MainPubkey, PaymentQuote).
    • Updated the argument type of the pay_for_records function to use BTreeMap<XorName, (MainPubkey, PaymentQuote)>.
  5. The sn_client/src/api.rs file:

    • Imported the Payment struct from the sn_transfers module.
    • Changed the payment parameter type in the store_chunk method to Payment.
  6. The wallet.rs file in the wallet module:

    • Updated imports for Payment, PaymentQuote, CashNoteRedemption, and ContentPaymentsMap.
    • Modified function signatures and logic related to payment transfers and storage payments.
  7. The quote.rs file:

    • Added a new file implementing payment quote functionality, including quote creation and verification.
  8. The lib.rs file:

    • Added a new module called quote.
  9. Other miscellaneous changes in various files related to imports, function names, and code logic.

Please review these changes for correctness, compatibility, and adherence to requirements.

@reviewpad reviewpad bot added the Large Large sized PR label Nov 20, 2023
@grumbach grumbach force-pushed the payment_quotes branch 3 times, most recently from 9eb73d7 to fb17dc7 Compare November 20, 2023 09:35
@grumbach grumbach marked this pull request as ready for review November 20, 2023 10:31
@reviewpad reviewpad bot requested a review from joshuef November 20, 2023 10:31
const QUOTE_EXPIRATION_SECS: u64 = 3600;

impl Node {
pub(crate) fn create_quote_for_storecost(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets get some more docs/info around these. How the quotes are envisaged to be used etc. (here and below)

use crate::node::Node;

/// The time in seconds that a quote is valid for
const QUOTE_EXPIRATION_SECS: u64 = 3600;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lets add a comment as to how/why this was chosen too 🙇

@grumbach grumbach added this pull request to the merge queue Nov 20, 2023
Merged via the queue into maidsafe:main with commit 9f55149 Nov 20, 2023
28 checks passed
@grumbach grumbach deleted the payment_quotes branch November 20, 2023 11:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Large Large sized PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants