Skip to content

Commit b3632c4

Browse files
committed
apiv2 code updates
1 parent 3eb9131 commit b3632c4

File tree

18 files changed

+39
-65
lines changed

18 files changed

+39
-65
lines changed

_code-samples/escrow/js/create-escrow.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ async function main() {
5555
JSON.stringify(escrowCreateTransaction, null, "\t"), "\n"
5656
);
5757
const response = await client.submitAndWait(escrowCreateTransaction, { wallet });
58-
console.log(`Sequence number: ${response.result.Sequence}`);
58+
console.log(`Sequence number: ${response.result.tx_json.Sequence}`);
5959
console.log(`Finished submitting! ${JSON.stringify(response.result, null, "\t")}`);
6060

6161
await client.disconnect();

_code-samples/escrow/py/create_escrow.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@
4444

4545

4646
# Parse result and print out the neccesary info
47-
print(stxn_result["Account"])
48-
print(stxn_result["Sequence"])
47+
print(stxn_result["tx_json"]["Account"])
48+
print(stxn_result["tx_json"]["Sequence"])
4949

5050
print(stxn_result["meta"]["TransactionResult"])
5151
print(stxn_result["hash"])

_code-samples/issue-a-token/js/issue-a-token.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,7 @@ async function main() {
145145
const send_token_tx = {
146146
"TransactionType": "Payment",
147147
"Account": cold_wallet.address,
148-
"Amount": {
148+
"DeliverMax": {
149149
"currency": currency_code,
150150
"value": issue_quantity,
151151
"issuer": cold_wallet.address
@@ -171,7 +171,7 @@ async function main() {
171171
const send_token_tx2 = {
172172
"TransactionType": "Payment",
173173
"Account": hot_wallet.address,
174-
"Amount": {
174+
"DeliverMax": {
175175
"currency": currency_code,
176176
"value": issue_quantity,
177177
"issuer": cold_wallet.address
@@ -197,7 +197,7 @@ async function main() {
197197
const send_token_tx3 = {
198198
"TransactionType": "Payment",
199199
"Account": customer_one_wallet.address,
200-
"Amount": {
200+
"DeliverMax": {
201201
"currency": currency_code,
202202
"value": issue_quantity,
203203
"issuer": cold_wallet.address

_code-samples/monitor-payments-websocket/js/monitor-payments.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,8 +82,8 @@ async function do_subscribe() {
8282
}
8383

8484
const log_tx = function(tx) {
85-
console.log(tx.transaction.TransactionType + " transaction sent by " +
86-
tx.transaction.Account +
85+
console.log(tx.tx_json.TransactionType + " transaction sent by " +
86+
tx.tx_json.Account +
8787
"\n Result: " + tx.meta.TransactionResult +
8888
" in ledger " + tx.ledger_index +
8989
"\n Validated? " + tx.validated)

_code-samples/monitor-payments-websocket/js/read-amount-received.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,8 @@ function CountXRPReceived(tx, address) {
5151
console.log("Transaction failed.")
5252
return
5353
}
54-
if (tx.transaction.TransactionType === "Payment") {
55-
if (tx.transaction.Destination !== address) {
54+
if (tx.tx_json.TransactionType === "Payment") {
55+
if (tx.tx_json.Destination !== address) {
5656
console.log("Not the destination of this payment.")
5757
return
5858
}
@@ -67,10 +67,10 @@ function CountXRPReceived(tx, address) {
6767
}
6868
} else if (["PaymentChannelClaim", "PaymentChannelFund", "OfferCreate",
6969
"CheckCash", "EscrowFinish"].includes(
70-
tx.transaction.TransactionType)) {
70+
tx.tx_json.TransactionType)) {
7171
CountXRPDifference(tx.meta.AffectedNodes, address)
7272
} else {
7373
console.log("Not a currency-delivering transaction type (" +
74-
tx.transaction.TransactionType + ").")
74+
tx.tx_json.TransactionType + ").")
7575
}
7676
}

_code-samples/monitor-payments-websocket/py/read_amount_received.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -53,21 +53,21 @@ def CountXRPReceived(tx, address):
5353
if tx['meta']['TransactionResult'] != 'tesSUCCESS':
5454
print("Transaction failed")
5555
return
56-
if tx['transaction']['TransactionType'] == 'Payment':
57-
if tx['transaction']['Destination'] != address:
56+
if tx['tx_json']['TransactionType'] == 'Payment':
57+
if tx['tx_json']['Destination'] != address:
5858
print("Not the destination of this payment.")
5959
return
6060
if tx['meta']['delivered_amount'] is int or str:
61-
amount_in_drops = int(tx['transaction']['Amount'])
61+
amount_in_drops = int(tx['tx_json']['DeliverMax'])
6262
xrp_amount = (amount_in_drops / 1000000)
6363
print(f"Received {xrp_amount} XRP")
6464
return
6565
else:
6666
print("Received non-XRP currency")
67-
elif tx['transaction']['TransactionType'] == 'PaymentChannelClaim' or 'PaymentChannelFund' or'OfferCreate' or 'CheckCash' or 'EscrowFinish':
67+
elif tx['tx_json']['TransactionType'] == 'PaymentChannelClaim' or 'PaymentChannelFund' or'OfferCreate' or 'CheckCash' or 'EscrowFinish':
6868
FindXRPDifference(tx, address)
6969
else:
70-
print("Not a currency-delivering transaction type", tx['transaction']['TransactionType'])
70+
print("Not a currency-delivering transaction type", tx['tx_json']['TransactionType'])
7171

7272
CountXRPReceived(tx=transaction, address='rPT1Sjq2YGrBMTttX4GZHjKu9dyfzbpAYe')
7373

_code-samples/quickstart/js/1.get-accounts-send-xrp.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
button{font-weight: bold;font-family: "Work Sans", sans-serif;}
1010
td{vertical-align: middle;}
1111
</style>
12-
<script src='https://unpkg.com/xrpl@2.7.0/build/xrpl-latest-min.js'></script>
12+
<script src='https://unpkg.com/xrpl@4.0.0/build/xrpl-latest.js'></script>
1313
<script src='ripplex1-send-xrp.js'></script>
1414
<script>
1515
if (typeof module !== "undefined") {

_code-samples/quickstart/js/2.create-trustline-send-currency.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
button{font-weight: bold;font-family: "Work Sans", sans-serif;}
1010
td{vertical-align: middle;}
1111
</style>
12-
<script src='https://unpkg.com/xrpl@2.7.0/build/xrpl-latest-min.js'></script>
12+
<script src='https://unpkg.com/xrpl@4.0.0/build/xrpl-latest.js'></script>
1313
<script src='ripplex1-send-xrp.js'></script>
1414
<script src='ripplex2-send-currency.js'></script>
1515
<script>

_code-samples/quickstart/js/3a.CreateOffer.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
button{font-weight: bold;font-family: "Work Sans", sans-serif;}
1010
td{vertical-align: middle;}
1111
</style>
12-
<script src='https://unpkg.com/xrpl@2.7.0/build/xrpl-latest-min.js'></script>
12+
<script src='https://unpkg.com/xrpl@4.0.0/build/xrpl-latest.js'></script>
1313
<script src='ripplex2-send-currency.js'></script>
1414
<script src='ripplex3a-create-offers.js'></script>
1515
<script src='ripplex3b-NameFieldSupport.js'></script>

_code-samples/quickstart/js/ripplex1-send-xrp.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ async function sendXRP() {
128128
const prepared = await client.autofill({
129129
"TransactionType": "Payment",
130130
"Account": standby_wallet.address,
131-
"Amount": xrpl.xrpToDrops(sendAmount),
131+
"DeliverMax": xrpl.xrpToDrops(sendAmount),
132132
"Destination": standbyDestinationField.value
133133
})
134134

@@ -178,7 +178,7 @@ async function oPsendXRP() {
178178
const prepared = await client.autofill({
179179
"TransactionType": "Payment",
180180
"Account": operational_wallet.address,
181-
"Amount": xrpl.xrpToDrops(operationalAmountField.value),
181+
"DeliverMax": xrpl.xrpToDrops(operationalAmountField.value),
182182
"Destination": operationalDestinationField.value
183183
})
184184

0 commit comments

Comments
 (0)