Releases: stellar/js-stellar-base
Releases · stellar/js-stellar-base
v2.1.5
v2.1.4
v2.1.3
v2.1.2
v2.1.1
v2.1.0
This release adds support for stellar-core protocol 12 release and CAP 24 ("Make PathPayment Symmetrical").
Deprecated ❗️
Operation.pathPayment
is being deprecated in favor ofOperation.pathPaymentStrictReceive
. Both functions take the same arguments and behave the same. (#274).
Add ➕
-
Operation.pathPaymentStrictSend
: Sends a path payments, debiting from the source account exactly a specified amount of one asset, crediting at least a given amount of another asset. (#274).The following operation will debit exactly 10 USD from the source account, crediting at least 9.2 EUR in the destination account 💸:
var sendAsset = new StellarBase.Asset( 'USD', 'GDGU5OAPHNPU5UCLE5RDJHG7PXZFQYWKCFOEXSXNMR6KRQRI5T6XXCD7' ); var sendAmount = '10'; var destination = 'GCEZWKCA5VLDNRLN3RPRJMRZOX3Z6G5CHCGSNFHEYVXM3XOJMDS674JZ'; var destAsset = new StellarBase.Asset( 'USD', 'GDGU5OAPHNPU5UCLE5RDJHG7PXZFQYWKCFOEXSXNMR6KRQRI5T6XXCD7' ); var destMin = '9.2'; var path = [ new StellarBase.Asset( 'USD', 'GBBM6BKZPEHWYO3E3YKREDPQXMS4VK35YLNU7NFBRI26RAN7GI5POFBB' ), new StellarBase.Asset( 'EUR', 'GDTNXRLOJD2YEBPKK7KCMR7J33AAG5VZXHAJTHIG736D6LVEFLLLKPDL' ) ]; let op = StellarBase.Operation.pathPaymentStrictSend({ sendAsset, sendAmount, destination, destAsset, destMin, path });
-
Operation.pathPaymentStrictReceive
: This behaves the same as the formerpathPayments
operation. (#274).The following operation will debit maximum 10 USD from the source account, crediting exactly 9.2 EUR in the destination account 💸:
var sendAsset = new StellarBase.Asset( 'USD', 'GDGU5OAPHNPU5UCLE5RDJHG7PXZFQYWKCFOEXSXNMR6KRQRI5T6XXCD7' ); var sendMax = '10'; var destination = 'GCEZWKCA5VLDNRLN3RPRJMRZOX3Z6G5CHCGSNFHEYVXM3XOJMDS674JZ'; var destAsset = new StellarBase.Asset( 'USD', 'GDGU5OAPHNPU5UCLE5RDJHG7PXZFQYWKCFOEXSXNMR6KRQRI5T6XXCD7' ); var destAmount = '9.2'; var path = [ new StellarBase.Asset( 'USD', 'GBBM6BKZPEHWYO3E3YKREDPQXMS4VK35YLNU7NFBRI26RAN7GI5POFBB' ), new StellarBase.Asset( 'EUR', 'GDTNXRLOJD2YEBPKK7KCMR7J33AAG5VZXHAJTHIG736D6LVEFLLLKPDL' ) ]; let op = StellarBase.Operation.pathPaymentStrictReceive({ sendAsset, sendMax, destination, destAsset, destAmount, path });