Coder Social home page Coder Social logo

Add Cross-Currency Payments about xrpl-py HOT 5 CLOSED

xrplf avatar xrplf commented on August 24, 2024
Add Cross-Currency Payments

from xrpl-py.

Comments (5)

ledhed2222 avatar ledhed2222 commented on August 24, 2024 1

You have it opposite. Check out the documentation for the payment transaction - https://xrpl.org/payment.html#main_content_wrapper especially the payment types section on cross currency payments - https://xrpl.org/payment.html#types-of-payments

To clarify, anything we add in this domain would just potentially simplify this operation for a common use case. You can do full cross currency payments using this library already, so there's nothing "missing" in xrpl-py around this functionality.

from xrpl-py.

ledhed2222 avatar ledhed2222 commented on August 24, 2024 1

closing - please open another issue if you have more questions! feel free!

from xrpl-py.

ledhed2222 avatar ledhed2222 commented on August 24, 2024

(edited for version 1.1.0 to show easier imports)

hey there @wojakkk, adding helper functions for cross currency payments is in our backlog. we'll be likely tackling it after the 1.1 release (coming soon!). in the meantime, you can still use the full capabilities of the ledger to make cross currency payments by submitting Payment and Offer transactions directly, so you don't have to wait for any helper functions to do this. below code would send a cross currency MXN -> JPY payment as you describe

from xrpl.models import IssuedCurrencyAmount, Payment
from xrpl.transaction import safe_sign_and_submit_transaction
from xrpl.clients import JsonRpcClient
from xrpl.wallet import Wallet

wallet = Wallet(seed, 0)
client = JsonRpcClient(url)
safe_sign_and_submit_transaction(
  Payment(
    account=wallet.classic_address,
    amount=IssuedCurrencyAmount(
      currency="JPY",
      issuer="11231",  # you would need to know a JPY issuer to use
      value="100",
    ),
    send_max=IssuedCurrencyAmount(
      currency="MXN",
      issuer="11231",  # whatever the issuer is of the MXN you want to send
      value="1",
    ),
    destination="1231231",  # address of receiver
  ),
  wallet,
  client,
)

from xrpl-py.

 avatar commented on August 24, 2024

Thanks @ledhed2222, great to hear that its being developed soon!

from xrpl-py.

 avatar commented on August 24, 2024

@ledhed2222 So is this how the code that you linked me works? :

amount var = the currency/amount being used in the transaction
send_max var = the currency/amount that will be exchanged for amount_var and sent to destination address

Me -> "amount" currency -> (exchanged for send_max, market price)-> "send_max" currency -> destination

How does this particularly work, im quite confused.

from xrpl-py.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.