From a4bdaeb52e39a3420b619fc9ae20947a6b84a1fc Mon Sep 17 00:00:00 2001
From: "john.xlm" <60260750+JFWooten4@users.noreply.github.com>
Date: Tue, 26 Nov 2024 14:05:31 -0500
Subject: [PATCH] =?UTF-8?q?=F0=9F=92=B1=20Optimize,=20clarify=20global=20d?=
=?UTF-8?q?eclarations=20It=20could=20be=20prudent=20to=20globalize=20the?=
=?UTF-8?q?=20accounts=20so=20that=20we=20can=20walk=20through=20the=20oth?=
=?UTF-8?q?er=20limit=20order=20examples?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
docs/learn/encyclopedia/sdex/README.mdx | 4 ++-
...uidity-on-stellar-sdex-liquidity-pools.mdx | 30 +++++++------------
2 files changed, 14 insertions(+), 20 deletions(-)
diff --git a/docs/learn/encyclopedia/sdex/README.mdx b/docs/learn/encyclopedia/sdex/README.mdx
index fd15ebfe5..e7fe52e39 100644
--- a/docs/learn/encyclopedia/sdex/README.mdx
+++ b/docs/learn/encyclopedia/sdex/README.mdx
@@ -1,10 +1,12 @@
---
-title: Trading Liquidity
+title: Payment Liquidity
sidebar_position: 90
---
import DocCardList from "@theme/DocCardList";
+{_/ Opt. do as "Conversion" liquidirty _/}
+
Native network markets, liquidity, and conversions 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 584bf28af..244996c63 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
@@ -90,6 +90,7 @@ 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");
@@ -111,20 +112,6 @@ public class Liquidity {
```
```go
-package main
-
-import (
- "fmt"
- "github.com/stellar/go/build"
- "github.com/stellar/go/clients/horizonclient"
- "github.com/stellar/go/keypair"
- "github.com/stellar/go/network"
- "github.com/stellar/go/protocols/horizon"
- "github.com/stellar/go/txnbuild"
-)
-
-var server = horizonclient.DefaultTestNetClient
-
func main() {
// Account setup
privateKey := "SAXBT6KO6NJ6SJXHBO6EBC7I5ZB7DZFYNPQOLXZJOKQ2LSGY5FU7ZJZB"
@@ -159,6 +146,7 @@ func newTxBuilder(pubKey string) (*txnbuild.Transaction, error) {
```python
+# rpl with the txBuilderHerlperEnv
transaction = TransactionBuilder(
source_account = account,
network_passphrase = Network.TESTNET_NETWORK_PASSPHRASE,
@@ -170,8 +158,8 @@ transaction = TransactionBuilder(
price = "20.0" # 20 Pesos per Dollar
).set_timeout(360).build()
-keypair = Keypair.from_secret(privateKey) transaction.sign(keypair)
-
+keypair = Keypair.from_secret(privateKey)
+transaction.sign(keypair)
response = server.submit_transaction(transaction)
print(f"Transaction successful: {response['successful']}")
@@ -214,6 +202,8 @@ print(f"Offer ID: {response['result_xdr']}")
```java
+
+main{{
AccountResponse account = server.accounts().account(publicKey);
Transaction transaction = new TransactionBuilder(account, Network.TESTNET)
@@ -238,6 +228,8 @@ print(f"Offer ID: {response['result_xdr']}")
```
```go
+
+main {{?
request := horizonclient.AccountRequest{AccountID: publicKey}
account, err := server.AccountDetail(request)
check(err)
@@ -1142,7 +1134,7 @@ public static SubmitTransactionResponse addLiquidity(
KeyPair source,
String poolId,
String maxReserveA,
- String maxReserveB
+ String maxReserveB,
) throws Exception {
double exactPrice = Double.parseDouble(maxReserveA) / Double.parseDouble(maxReserveB);
double minPrice = exactPrice - exactPrice * 0.1;
@@ -1546,12 +1538,12 @@ public static void main(String[] args) throws Exception {
balance ->
"liquidity_pool_shares".equals(balance.getAssetType()) &&
poolId.equals(balance.getLiquidityPoolId())
- )å
+ )
.mapToDouble(balance -> Double.parseDouble(balance.getBalance()))
.findFirst();
if (!balance.isPresent()) {
throw new Exception("No liquidity pool shares found for kp1");
-
+ }
removeLiquidity(kp1, poolId, balance);
getSpotPrice();
}