diff --git a/docs/learn/encyclopedia/sdex/README.mdx b/docs/learn/encyclopedia/sdex/README.mdx index e7fe52e39..a7e42ce89 100644 --- a/docs/learn/encyclopedia/sdex/README.mdx +++ b/docs/learn/encyclopedia/sdex/README.mdx @@ -1,12 +1,10 @@ --- -title: Payment Liquidity +title: Conversion Liquidity sidebar_position: 90 --- import DocCardList from "@theme/DocCardList"; -{_/ Opt. do as "Conversion" liquidirty _/} - -Native network markets, liquidity, and conversions for all assets. +Native network markets, liquidity, and exchange for all assets. diff --git a/docs/learn/encyclopedia/sdex/liquidity-on-stellar-sdex-liquidity-pools.mdx b/docs/learn/encyclopedia/sdex/liquidity-on-stellar-sdex-liquidity-pools.mdx index 244996c63..7261e77a1 100644 --- a/docs/learn/encyclopedia/sdex/liquidity-on-stellar-sdex-liquidity-pools.mdx +++ b/docs/learn/encyclopedia/sdex/liquidity-on-stellar-sdex-liquidity-pools.mdx @@ -44,7 +44,7 @@ server = Server("https://horizon-testnet.stellar.org") privateKey = "SAXBT6KO6NJ6SJXHBO6EBC7I5ZB7DZFYNPQOLXZJOKQ2LSGY5FU7ZJZB" publicKey = "GBRPYHIL2CI3R5N4A7WMBETDZQ24DXFQGNCJWHXPFRGFWZHJZZBDTWR2" -# Asset config +# Asset setup astroDollar = Asset("AstroDollar", "GDRM3MK6KMHSYIT4E2AG2S2LWTDBJNYXE4H72C7YTTRWOWX5ZBECFWO7") astroPeso = Asset("AstroPeso", "GBHNGLLIE3KWGKCHIKMHJ5HVZHYIK7WTBE4QF5PLAKL4CJGSEU7HZIW5") @@ -72,7 +72,7 @@ const server = new Server("https://horizon-testnet.stellar.org"); const privateKey = "SAXBT6KO6NJ6SJXHBO6EBC7I5ZB7DZFYNPQOLXZJOKQ2LSGY5FU7ZJZB"; const publicKey = "GBRPYHIL2CI3R5N4A7WMBETDZQ24DXFQGNCJWHXPFRGFWZHJZZBDTWR2"; -// Asset config +// Asset setup const astroDollar = new Asset( "AstroDollar", "GDRM3MK6KMHSYIT4E2AG2S2LWTDBJNYXE4H72C7YTTRWOWX5ZBECFWO7", @@ -82,7 +82,16 @@ const astroPeso = new Asset( "GBHNGLLIE3KWGKCHIKMHJ5HVZHYIK7WTBE4QF5PLAKL4CJGSEU7HZIW5", ); -// pending newTxEnvelope(..) +function newTxBuilder(source, signer, ...ops) { + let tx = new sdk.TransactionBuilder(source, { + fee: sdk.BASE_FEE, + networkPassphrase: sdk.Networks.TESTNET, + }); + ops.forEach((op) => tx.addOperation(op)); + tx = tx.setTimeout(360).build(); + tx.sign(signer); + return tx; +} ``` ```java @@ -90,7 +99,6 @@ import org.stellar.sdk.*; import org.stellar.sdk.responses.AccountResponse; import org.stellar.sdk.responses.SubmitTransactionResponse; - public class Liquidity { static final Server server = new Server("https://horizon-testnet.stellar.org"); @@ -98,9 +106,15 @@ public class Liquidity { static String privateKey = "SAXBT6KO6NJ6SJXHBO6EBC7I5ZB7DZFYNPQOLXZJOKQ2LSGY5FU7ZJZB"; static String publicKey = "GBRPYHIL2CI3R5N4A7WMBETDZQ24DXFQGNCJWHXPFRGFWZHJZZBDTWR2"; - // Asset config - Asset astroDollar = new AssetTypeCreditAlphaNum4("AstroDollar", "GDRM3MK6KMHSYIT4E2AG2S2LWTDBJNYXE4H72C7YTTRWOWX5ZBECFWO7"); - Asset astroPeso = new AssetTypeCreditAlphaNum4("AstroPeso", "GBHNGLLIE3KWGKCHIKMHJ5HVZHYIK7WTBE4QF5PLAKL4CJGSEU7HZIW5"); + // Asset setup + Asset astroDollar = new AssetTypeCreditAlphaNum4( + "AstroDollar", + "GDRM3MK6KMHSYIT4E2AG2S2LWTDBJNYXE4H72C7YTTRWOWX5ZBECFWO7" + ); + Asset astroPeso = new AssetTypeCreditAlphaNum4( + "AstroPeso", + "GBHNGLLIE3KWGKCHIKMHJ5HVZHYIK7WTBE4QF5PLAKL4CJGSEU7HZIW5" + ); public static Transaction.Builder newTxBuilder(KeyPair source) { AccountResponse sourceAccount = server.accounts().account(source.getAccountId()); @@ -112,6 +126,15 @@ public class Liquidity { ``` ```go +import ( + "fmt" + "strconv" + "github.com/stellar/go/keypair" + "github.com/stellar/go/txnbuild" + "github.com/stellar/go/clients/horizonclient" + "github.com/stellar/go/network" +) + func main() { // Account setup privateKey := "SAXBT6KO6NJ6SJXHBO6EBC7I5ZB7DZFYNPQOLXZJOKQ2LSGY5FU7ZJZB" @@ -819,17 +842,6 @@ const [A, B] = orderAssets( new sdk.Asset("B", kp0.publicKey()), ); -function newTxBuilder(source, signer, ...ops) { - let tx = new sdk.TransactionBuilder(source, { - fee: sdk.BASE_FEE, - networkPassphrase: sdk.Networks.TESTNET, - }); - ops.forEach((op) => tx.addOperation(op)); - tx = tx.setTimeout(360).build(); - tx.sign(signer); - return tx; -} - // Establishes trustlines and funds `recipientKps` for all `assets` function distributeAssets(issuerKp, recipientKps, ...assets) { return server.loadAccount(issuerKp.publicKey()).then((issuer) => {