Skip to content

Commit

Permalink
Merge pull request #2792 from mDuo13/escrow_update_code
Browse files Browse the repository at this point in the history
Clean up some Escrow code sample issues
  • Loading branch information
mDuo13 authored Oct 15, 2024
2 parents 82ff22a + 5835468 commit 687445e
Show file tree
Hide file tree
Showing 42 changed files with 142 additions and 195 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ XRP LedgerのEscrowが有効期限切れとなるのは、その`CancelAfter`の
{% tabs %}

{% tab label="Websocket" %}
{% code-snippet file="/_code-samples/escrow/websocket/ledger-request-expiration.json" language="json" /%}
{% code-snippet file="/_api-examples/escrow/websocket/ledger-request-expiration.json" language="json" /%}
{% /tab %}

{% /tabs %}
Expand All @@ -28,7 +28,7 @@ XRP LedgerのEscrowが有効期限切れとなるのは、その`CancelAfter`の
{% tabs %}

{% tab label="Websocket" %}
{% code-snippet file="/_code-samples/escrow/websocket/ledger-response-expiration.json" language="json" /%}
{% code-snippet file="/_api-examples/escrow/websocket/ledger-response-expiration.json" language="json" /%}
{% /tab %}

{% /tabs %}
Expand All @@ -41,7 +41,7 @@ XRP LedgerのEscrowが有効期限切れとなるのは、その`CancelAfter`の
{% tabs %}

{% tab label="Websocket" %}
{% code-snippet file="/_code-samples/escrow/websocket/account_objects-request-expiration.json" language="json" /%}
{% code-snippet file="/_api-examples/escrow/websocket/account_objects-request-expiration.json" language="json" /%}
{% /tab %}

{% /tabs %}
Expand All @@ -51,7 +51,7 @@ XRP LedgerのEscrowが有効期限切れとなるのは、その`CancelAfter`の
{% tabs %}

{% tab label="Websocket" %}
{% code-snippet file="/_code-samples/escrow/websocket/account_objects-response-expiration.json" language="json" /%}
{% code-snippet file="/_api-examples/escrow/websocket/account_objects-response-expiration.json" language="json" /%}
{% /tab %}

{% /tabs %}
Expand All @@ -67,7 +67,7 @@ XRP Ledgerでは、[EscrowCancelトランザクション][]に[署名して送
{% tabs %}

{% tab label="Websocket" %}
{% code-snippet file="/_code-samples/escrow/websocket/submit-request-escrowcancel.json" language="json" /%}
{% code-snippet file="/_api-examples/escrow/websocket/submit-request-escrowcancel.json" language="json" /%}
{% /tab %}

{% /tabs %}
Expand All @@ -77,7 +77,7 @@ XRP Ledgerでは、[EscrowCancelトランザクション][]に[署名して送
{% tabs %}

{% tab label="Websocket" %}
{% code-snippet file="/_code-samples/escrow/websocket/submit-response-escrowcancel.json" language="json" /%}
{% code-snippet file="/_api-examples/escrow/websocket/submit-response-escrowcancel.json" language="json" /%}
{% /tab %}

{% /tabs %}
Expand All @@ -97,7 +97,7 @@ EscrowCancelトランザクションの識別用ハッシュを指定した[tx
{% tabs %}

{% tab label="Websocket" %}
{% code-snippet file="/_code-samples/escrow/websocket/tx-request-escrowcancel.json" language="json" /%}
{% code-snippet file="/_api-examples/escrow/websocket/tx-request-escrowcancel.json" language="json" /%}
{% /tab %}

{% /tabs %}
Expand All @@ -107,7 +107,7 @@ EscrowCancelトランザクションの識別用ハッシュを指定した[tx
{% tabs %}

{% tab label="Websocket" %}
{% code-snippet file="/_code-samples/escrow/websocket/tx-response-escrowcancel.json" language="json" /%}
{% code-snippet file="/_api-examples/escrow/websocket/tx-response-escrowcancel.json" language="json" /%}
{% /tab %}

{% /tabs %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Escrowオブジェクトを検索するには、[account_objectsメソッド][]
{% tabs %}

{% tab label="Websocket" %}
{% code-snippet file="/_code-samples/escrow/websocket/account_objects-request.json" language="json" /%}
{% code-snippet file="/_api-examples/escrow/websocket/account_objects-request.json" language="json" /%}
{% /tab %}

{% /tabs %}
Expand All @@ -39,7 +39,7 @@ Escrowオブジェクトを検索するには、[account_objectsメソッド][]
{% tabs %}

{% tab label="Websocket" %}
{% code-snippet file="/_code-samples/escrow/websocket/account_objects-response.json" language="json" /%}
{% code-snippet file="/_api-examples/escrow/websocket/account_objects-response.json" language="json" /%}
{% /tab %}

{% /tabs %}
Expand All @@ -57,7 +57,7 @@ Escrowオブジェクトを検索するには、[account_objectsメソッド][]
{% tabs %}

{% tab label="Websocket" %}
{% code-snippet file="/_code-samples/escrow/websocket/account_objects-request.json" language="json" /%}
{% code-snippet file="/_api-examples/escrow/websocket/account_objects-request.json" language="json" /%}
{% /tab %}

{% /tabs %}
Expand All @@ -72,7 +72,7 @@ Escrowオブジェクトを検索するには、[account_objectsメソッド][]
{% tabs %}

{% tab label="Websocket" %}
{% code-snippet file="/_code-samples/escrow/websocket/account_objects-response.json" language="json" /%}
{% code-snippet file="/_api-examples/escrow/websocket/account_objects-response.json" language="json" /%}
{% /tab %}

{% /tabs %}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ print(cancel_after)
{% tabs %}

{% tab label="Websocket" %}
{% code-snippet file="/_code-samples/escrow/websocket/submit-request-escrowcreate-condition.json" language="json" /%}
{% code-snippet file="/_api-examples/escrow/websocket/submit-request-escrowcreate-condition.json" language="json" /%}
{% /tab %}

{% /tabs %}
Expand All @@ -91,7 +91,7 @@ print(cancel_after)
{% tabs %}

{% tab label="Websocket" %}
{% code-snippet file="/_code-samples/escrow/websocket/submit-response-escrowcreate-condition.json" language="json" /%}
{% code-snippet file="/_api-examples/escrow/websocket/submit-response-escrowcreate-condition.json" language="json" /%}
{% /tab %}

{% /tabs %}
Expand All @@ -109,7 +109,7 @@ print(cancel_after)
{% tabs %}

{% tab label="Websocket" %}
{% code-snippet file="/_code-samples/escrow/websocket/tx-request-escrowcreate-condition.json" language="json" /%}
{% code-snippet file="/_api-examples/escrow/websocket/tx-request-escrowcreate-condition.json" language="json" /%}
{% /tab %}

{% /tabs %}
Expand All @@ -119,7 +119,7 @@ print(cancel_after)
{% tabs %}

{% tab label="Websocket" %}
{% code-snippet file="/_code-samples/escrow/websocket/tx-response-escrowcreate-condition.json" language="json" /%}
{% code-snippet file="/_api-examples/escrow/websocket/tx-response-escrowcreate-condition.json" language="json" /%}
{% /tab %}

{% /tabs %}
Expand All @@ -137,7 +137,7 @@ Escrowが有効期限切れの場合は、[Escrowの取消し](cancel-an-expired
{% tabs %}

{% tab label="Websocket" %}
{% code-snippet file="/_code-samples/escrow/websocket/submit-request-escrowfinish-condition.json" language="json" /%}
{% code-snippet file="/_api-examples/escrow/websocket/submit-request-escrowfinish-condition.json" language="json" /%}
{% /tab %}

{% /tabs %}
Expand All @@ -147,7 +147,7 @@ Escrowが有効期限切れの場合は、[Escrowの取消し](cancel-an-expired
{% tabs %}

{% tab label="Websocket" %}
{% code-snippet file="/_code-samples/escrow/websocket/submit-response-escrowfinish-condition.json" language="json" /%}
{% code-snippet file="/_api-examples/escrow/websocket/submit-response-escrowfinish-condition.json" language="json" /%}
{% /tab %}

{% /tabs %}
Expand All @@ -164,10 +164,10 @@ EscrowFinishトランザクションの識別用ハッシュを指定した[tx

リクエスト:

{% code-snippet file="/_code-samples/escrow/websocket/tx-request-escrowfinish-condition.json" language="json" /%}
{% code-snippet file="/_api-examples/escrow/websocket/tx-request-escrowfinish-condition.json" language="json" /%}

レスポンス:

{% code-snippet file="/_code-samples/escrow/websocket/tx-response-escrowfinish-condition.json" language="json" /%}
{% code-snippet file="/_api-examples/escrow/websocket/tx-response-escrowfinish-condition.json" language="json" /%}

{% raw-partial file="/docs/_snippets/common-links.md" /%}
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ print(release_date_ripple)
{% tabs %}

{% tab label="Websocket" %}
{% code-snippet file="/_code-samples/escrow/websocket/submit-request-escrowcreate-time.json" language="json" /%}
{% code-snippet file="/_api-examples/escrow/websocket/submit-request-escrowcreate-time.json" language="json" /%}
{% /tab %}

{% /tabs %}
Expand All @@ -62,7 +62,7 @@ print(release_date_ripple)
{% tabs %}

{% tab label="Websocket" %}
{% code-snippet file="/_code-samples/escrow/websocket/submit-response-escrowcreate-time.json" language="json" /%}
{% code-snippet file="/_api-examples/escrow/websocket/submit-response-escrowcreate-time.json" language="json" /%}
{% /tab %}

{% /tabs %}
Expand All @@ -83,7 +83,7 @@ print(release_date_ripple)
{% tabs %}

{% tab label="Websocket" %}
{% code-snippet file="/_code-samples/escrow/websocket/tx-request-escrowcreate-time.json" language="json" /%}
{% code-snippet file="/_api-examples/escrow/websocket/tx-request-escrowcreate-time.json" language="json" /%}
{% /tab %}

{% /tabs %}
Expand All @@ -93,7 +93,7 @@ print(release_date_ripple)
{% tabs %}

{% tab label="Websocket" %}
{% code-snippet file="/_code-samples/escrow/websocket/tx-response-escrowcreate-time.json" language="json" /%}
{% code-snippet file="/_api-examples/escrow/websocket/tx-response-escrowcreate-time.json" language="json" /%}
{% /tab %}

{% /tabs %}
Expand All @@ -109,7 +109,7 @@ print(release_date_ripple)
{% tabs %}

{% tab label="Websocket" %}
{% code-snippet file="/_code-samples/escrow/websocket/ledger-request.json" language="json" /%}
{% code-snippet file="/_api-examples/escrow/websocket/ledger-request.json" language="json" /%}
{% /tab %}

{% /tabs %}
Expand All @@ -119,7 +119,7 @@ print(release_date_ripple)
{% tabs %}

{% tab label="Websocket" %}
{% code-snippet file="/_code-samples/escrow/websocket/ledger-response.json" language="json" /%}
{% code-snippet file="/_api-examples/escrow/websocket/ledger-response.json" language="json" /%}
{% /tab %}

{% /tabs %}
Expand All @@ -140,7 +140,7 @@ Escrowが有効期限切れの場合は、[Escrowの取消し](cancel-an-expired
{% tabs %}

{% tab label="Websocket" %}
{% code-snippet file="/_code-samples/escrow/websocket/submit-request-escrowfinish-time.json" language="json" /%}
{% code-snippet file="/_api-examples/escrow/websocket/submit-request-escrowfinish-time.json" language="json" /%}
{% /tab %}

{% /tabs %}
Expand All @@ -150,7 +150,7 @@ Escrowが有効期限切れの場合は、[Escrowの取消し](cancel-an-expired
{% tabs %}

{% tab label="Websocket" %}
{% code-snippet file="/_code-samples/escrow/websocket/submit-response-escrowfinish-time.json" language="json" /%}
{% code-snippet file="/_api-examples/escrow/websocket/submit-response-escrowfinish-time.json" language="json" /%}
{% /tab %}

{% /tabs %}
Expand All @@ -170,7 +170,7 @@ EscrowFinishトランザクションの識別用ハッシュを指定した[tx
{% tabs %}

{% tab label="Websocket" %}
{% code-snippet file="/_code-samples/escrow/websocket/tx-request-escrowfinish-time.json" language="json" /%}
{% code-snippet file="/_api-examples/escrow/websocket/tx-request-escrowfinish-time.json" language="json" /%}
{% /tab %}

{% /tabs %}
Expand All @@ -180,7 +180,7 @@ EscrowFinishトランザクションの識別用ハッシュを指定した[tx
{% tabs %}

{% tab label="Websocket" %}
{% code-snippet file="/_code-samples/escrow/websocket/tx-response-escrowfinish-time.json" language="json" /%}
{% code-snippet file="/_api-examples/escrow/websocket/tx-response-escrowfinish-time.json" language="json" /%}
{% /tab %}

{% /tabs %}
Expand Down
42 changes: 0 additions & 42 deletions _code-samples/escrow/js/cancel-escrow-v2.js

This file was deleted.

17 changes: 7 additions & 10 deletions _code-samples/escrow/js/cancel-escrow.js
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
'use strict'
if (typeof module !== "undefined") {
// Use var here because const/let are block-scoped to the if statement.
var xrpl = require('xrpl')
}
const xrpl = require('xrpl');

// Preqrequisites:
// 1. Create an escrow using the create-escrow.js snippet
// 2. Replace the OfferSequence with the sequence number of the escrow you created
// 3. Paste the seed of the account that created the escrow
// 4. Run the snippet
// 4. Run this snippet

const seed = "sEd7jfWyNG6J71dEojB3W9YdHp2KCjy";
const sequenceNumber = null;
const seed = "sEd7jfWyNG6J71dEojB3W9YdHp2KCjy"; // replace with your seed
const sequenceNumber = 0; // replace with the sequence number of your escrow

const main = async () => {
async function main() {
try {
// Connect -------------------------------------------------------------------
const client = new xrpl.Client('wss://s.altnet.rippletest.net:51233');
await client.connect();

// Prepare wallet to sign the transaction -------------------------------------
const wallet = await xrpl.Wallet.fromSeed(seed);
console.log("Wallet Address: ", wallet.address);
Expand All @@ -45,7 +42,7 @@ const main = async () => {
console.log(`Finished submitting! \n${JSON.stringify(response.result, null, "\t")}`);

await client.disconnect();

} catch (error) {
console.log(error);
}
Expand Down
Loading

0 comments on commit 687445e

Please sign in to comment.