Skip to content
This repository has been archived by the owner on Feb 23, 2023. It is now read-only.

Commit

Permalink
update docs for stellar/go#3483
Browse files Browse the repository at this point in the history
  • Loading branch information
Paul Bellamy committed Apr 7, 2021
1 parent 1e49ec4 commit f826587
Show file tree
Hide file tree
Showing 6 changed files with 498 additions and 4 deletions.
8 changes: 5 additions & 3 deletions content/api/resources/claimablebalances/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ A Claimable Balance represents the transfer of ownership of some amount of an as
<EndpointsTable title="Endpoints">


| | |
| --- | --------------------------------------------------------- |
| | |
| --- | --- |
| GET | [/claimable_balances](./list.mdx) |
| GET | [/claimable_balances/:claimable_balance_id](./single.mdx) |
| GET | [/claimable_balances](./list.mdx) |
| GET | [/claimable_balances/:claimable_balance_id/transactions](./transactions.mdx) |
| GET | [/claimable_balances/:claimable_balance_id/operations](./operations.mdx) |

</EndpointsTable>

34 changes: 33 additions & 1 deletion content/api/resources/claimablebalances/list.mdx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: List Claimable Balances
order: 30
order: 15
---

import { Endpoint } from "components/Endpoint";
Expand Down Expand Up @@ -96,6 +96,14 @@ server
"_links": {
"self": {
"href": "https://horizon.stellar.org/claimable_balances/00000000929b20b72e5890ab51c24f1cc46fa01c4f318d8d33367d24dd614cfdf5491072"
},
"operations": {
"href": "https://horizon.stellar.org/claimable_balances/00000000929b20b72e5890ab51c24f1cc46fa01c4f318d8d33367d24dd614cfdf5491072/operations{?cursor,limit,order}",
"templated": true
},
"transactions": {
"href": "https://horizon.stellar.org/claimable_balances/00000000929b20b72e5890ab51c24f1cc46fa01c4f318d8d33367d24dd614cfdf5491072/transactions{?cursor,limit,order}",
"templated": true
}
},
"id": "00000000929b20b72e5890ab51c24f1cc46fa01c4f318d8d33367d24dd614cfdf5491072",
Expand All @@ -118,6 +126,14 @@ server
"_links": {
"self": {
"href": "https://horizon.stellar.org/claimable_balances/00000000be7e37b24927c095e2292d5d0e6db8b0f2dbeb1355847c7fccb458cbdd61bfd0"
},
"operations": {
"href": "https://horizon.stellar.org/claimable_balances/00000000be7e37b24927c095e2292d5d0e6db8b0f2dbeb1355847c7fccb458cbdd61bfd0/operations{?cursor,limit,order}",
"templated": true
},
"transactions": {
"href": "https://horizon.stellar.org/claimable_balances/00000000be7e37b24927c095e2292d5d0e6db8b0f2dbeb1355847c7fccb458cbdd61bfd0/transactions{?cursor,limit,order}",
"templated": true
}
},
"id": "00000000be7e37b24927c095e2292d5d0e6db8b0f2dbeb1355847c7fccb458cbdd61bfd0",
Expand All @@ -142,6 +158,14 @@ server
"_links": {
"self": {
"href": "https://horizon.stellar.org/claimable_balances/0000000084ec48a1c44df5396625e4560bdc1d48d2371dece73cbe7e790d2b7b277347b7"
},
"operations": {
"href": "https://horizon.stellar.org/claimable_balances/0000000084ec48a1c44df5396625e4560bdc1d48d2371dece73cbe7e790d2b7b277347b7/operations{?cursor,limit,order}",
"templated": true
},
"transactions": {
"href": "https://horizon.stellar.org/claimable_balances/0000000084ec48a1c44df5396625e4560bdc1d48d2371dece73cbe7e790d2b7b277347b7/transactions{?cursor,limit,order}",
"templated": true
}
},
"id": "0000000084ec48a1c44df5396625e4560bdc1d48d2371dece73cbe7e790d2b7b277347b7",
Expand All @@ -164,6 +188,14 @@ server
"_links": {
"self": {
"href": "https://horizon.stellar.org/claimable_balances/00000000c582697b67cbec7f9ce64f4dc67bfb2bfd26318bb9f964f4d70e3f41f650b1e6"
},
"operations": {
"href": "https://horizon.stellar.org/claimable_balances/00000000c582697b67cbec7f9ce64f4dc67bfb2bfd26318bb9f964f4d70e3f41f650b1e6/operations{?cursor,limit,order}",
"templated": true
},
"transactions": {
"href": "https://horizon.stellar.org/claimable_balances/00000000c582697b67cbec7f9ce64f4dc67bfb2bfd26318bb9f964f4d70e3f41f650b1e6/transactions{?cursor,limit,order}",
"templated": true
}
},
"id": "00000000c582697b67cbec7f9ce64f4dc67bfb2bfd26318bb9f964f4d70e3f41f650b1e6",
Expand Down
8 changes: 8 additions & 0 deletions content/api/resources/claimablebalances/object.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,14 @@ When Horizon returns information about a claimable balance, it uses the followin
"_links": {
"self": {
"href": "https://horizon.stellar.org/claimable_balances/000000000102030000000000000000000000000000000000000000000000000000000000"
},
"operations": {
"href": "https://horizon.stellar.org/claimable_balances/000000000102030000000000000000000000000000000000000000000000000000000000/operations{?cursor,limit,order}",
"templated": true
},
"transactions": {
"href": "https://horizon.stellar.org/claimable_balances/000000000102030000000000000000000000000000000000000000000000000000000000/transactions{?cursor,limit,order}",
"templated": true
}
},
"id": "000000000102030000000000000000000000000000000000000000000000000000000000",
Expand Down
222 changes: 222 additions & 0 deletions content/api/resources/claimablebalances/operations.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,222 @@
---
title: Retrieve a Claimable Balance's Operations
order: 40
---

import { Endpoint } from "components/Endpoint";
import { ExampleResponse } from "components/ExampleResponse";
import { CodeExample } from "components/CodeExample";
import { AttributeTable } from "components/AttributeTable";

This endpoint represents successful operations referencing a given claimable balance and can be used in streaming mode.

Streaming mode allows you to listen for new operations referencing this claimable balance as they are added to the Stellar ledger. If called in streaming mode, Horizon will start at the earliest known operation unless a `cursor` is set, in which case it will start from that `cursor`. By setting the `cursor` value to `now`, you can stream operations created since your request time.

<Endpoint>


| | |
| --- | --- |
| GET | /claimable_balances/:claimable_balance_id/operations?cursor={paging_token}&order={asc,desc}&limit={1-200}&include_failed{true,false}&join={transactions} |

</Endpoint>


<AttributeTable>


- ARGUMENT
- REQUIRED
- DESCRIPTION
- claimable_balance_id
- required
- This claimable balance's id encoded in a hex string representation.
- cursor
- optional
- A number that points to a specific location in a collection of responses and is pulled from the `paging_token` value of a record.
- order
- optional
- A designation of the order in which records should appear. Options include `asc`(ascending) or `desc` (descending). If this argument isn’t set, it defaults to `asc`.
- limit
- optional
- The total number of records returned. The limit can range from 1 to 200 - an upper limit that is hardcoded in Horizon for performance reasons. If this argument isn’t designated, it defaults to 10.
- include_failed
- optional
- Set to true to include failed operations in results. Options include `true` and `false`.
- join
- optional
- Set to `transactions` to include the transactions which created each of the operations in the response.

</AttributeTable>


<CodeExample title="Example Request">


```curl
curl "https://horizon.stellar.org/claimable_balances/00000000178826fbfe339e1f5c53417c6fedfe2c05e8bec14303143ec46b38981b09c3f9/operations?limit=3"
```

```js
var StellarSdk = require("stellar-sdk");
var server = new StellarSdk.Server("https://horizon.stellar.org");

server
.operations()
.forClaimableBalance(
"00000000178826fbfe339e1f5c53417c6fedfe2c05e8bec14303143ec46b38981b09c3f9",
)
.call()
.then(function (resp) {
console.log(resp);
})
.catch(function (err) {
console.error(err);
});
```

</CodeExample>


<ExampleResponse title="Example Response">


```json
{
"_links": {
"self": {
"href": "https://horizon.stellar.org/claimable_balances/00000000178826fbfe339e1f5c53417c6fedfe2c05e8bec14303143ec46b38981b09c3f9/operations?cursor=\u0026limit=3\u0026order=asc"
},
"next": {
"href": "https://horizon.stellar.org/claimable_balances/00000000178826fbfe339e1f5c53417c6fedfe2c05e8bec14303143ec46b38981b09c3f9/operations?cursor=120192452165550081\u0026limit=3\u0026order=asc"
},
"prev": {
"href": "https://horizon.stellar.org/claimable_balances/00000000178826fbfe339e1f5c53417c6fedfe2c05e8bec14303143ec46b38981b09c3f9/operations?cursor=120192344791343105\u0026limit=3\u0026order=desc"
}
},
"_embedded": {
"records": [
{
"_links": {
"self": {
"href": "https://horizon.stellar.org/operations/120192344791343105"
},
"transaction": {
"href": "https://horizon.stellar.org/transactions/ef0fe04ac3c7de7228ca2598886059868ad05c224a041e8b2d9ee2a8a9dd6894"
},
"effects": {
"href": "https://horizon.stellar.org/operations/120192344791343105/effects"
},
"succeeds": {
"href": "https://horizon.stellar.org/effects?order=desc\u0026cursor=120192344791343105"
},
"precedes": {
"href": "https://horizon.stellar.org/effects?order=asc\u0026cursor=120192344791343105"
}
},
"id": "120192344791343105",
"paging_token": "120192344791343105",
"transaction_successful": true,
"source_account": "GBVFTZL5HIPT4PFQVTZVIWR77V7LWYCXU4CLYWWHHOEXB64XPG5LDMTU",
"type": "create_account",
"type_i": 0,
"created_at": "2020-01-29T19:43:59Z",
"transaction_hash": "ef0fe04ac3c7de7228ca2598886059868ad05c224a041e8b2d9ee2a8a9dd6894",
"starting_balance": "2.0000000",
"funder": "GBVFTZL5HIPT4PFQVTZVIWR77V7LWYCXU4CLYWWHHOEXB64XPG5LDMTU",
"account": "00000000178826fbfe339e1f5c53417c6fedfe2c05e8bec14303143ec46b38981b09c3f9"
},
{
"_links": {
"self": {
"href": "https://horizon.stellar.org/operations/120192370561220609"
},
"transaction": {
"href": "https://horizon.stellar.org/transactions/c1cb850f413e4038c4120bd9badc07bb8ef85a46649a4d5c9c16e578a2d30589"
},
"effects": {
"href": "https://horizon.stellar.org/operations/120192370561220609/effects"
},
"succeeds": {
"href": "https://horizon.stellar.org/effects?order=desc\u0026cursor=120192370561220609"
},
"precedes": {
"href": "https://horizon.stellar.org/effects?order=asc\u0026cursor=120192370561220609"
}
},
"id": "120192370561220609",
"paging_token": "120192370561220609",
"transaction_successful": true,
"source_account": "GBVFTZL5HIPT4PFQVTZVIWR77V7LWYCXU4CLYWWHHOEXB64XPG5LDMTU",
"type": "payment",
"type_i": 1,
"created_at": "2020-01-29T19:44:36Z",
"transaction_hash": "c1cb850f413e4038c4120bd9badc07bb8ef85a46649a4d5c9c16e578a2d30589",
"asset_type": "native",
"from": "GBVFTZL5HIPT4PFQVTZVIWR77V7LWYCXU4CLYWWHHOEXB64XPG5LDMTU",
"to": "00000000178826fbfe339e1f5c53417c6fedfe2c05e8bec14303143ec46b38981b09c3f9",
"amount": "200.0000000"
},
{
"_links": {
"self": {
"href": "https://horizon.stellar.org/operations/120192452165550081"
},
"transaction": {
"href": "https://horizon.stellar.org/transactions/0e6bc30f2b2f50ca0ecedef5a527309c74964e7daa6018976cd2c686c5df4be3"
},
"effects": {
"href": "https://horizon.stellar.org/operations/120192452165550081/effects"
},
"succeeds": {
"href": "https://horizon.stellar.org/effects?order=desc\u0026cursor=120192452165550081"
},
"precedes": {
"href": "https://horizon.stellar.org/effects?order=asc\u0026cursor=120192452165550081"
}
},
"id": "120192452165550081",
"paging_token": "120192452165550081",
"transaction_successful": true,
"source_account": "00000000178826fbfe339e1f5c53417c6fedfe2c05e8bec14303143ec46b38981b09c3f9",
"type": "change_trust",
"type_i": 6,
"created_at": "2020-01-29T19:46:20Z",
"transaction_hash": "0e6bc30f2b2f50ca0ecedef5a527309c74964e7daa6018976cd2c686c5df4be3",
"asset_type": "credit_alphanum4",
"asset_code": "USD",
"asset_issuer": "GDUKMGUGDZQK6YHYA5Z6AY2G4XDSZPSZ3SW5UN3ARVMO6QSRDWP5YLEX",
"limit": "922337203685.4775807",
"trustee": "GDUKMGUGDZQK6YHYA5Z6AY2G4XDSZPSZ3SW5UN3ARVMO6QSRDWP5YLEX",
"trustor": "00000000178826fbfe339e1f5c53417c6fedfe2c05e8bec14303143ec46b38981b09c3f9"
}
]
}
}
```

</ExampleResponse>


<CodeExample title="JavaScript Streaming Example">


```js
var StellarSdk = require("stellar-sdk");
var server = new StellarSdk.Server("https://horizon.stellar.org");

var callback = function (resp) {
console.log(resp);
};

var es = server
.operations()
.forClaimableBalance(
"00000000178826fbfe339e1f5c53417c6fedfe2c05e8bec14303143ec46b38981b09c3f9",
)
.cursor("now")
.stream({ onmessage: callback });
```

</CodeExample>

8 changes: 8 additions & 0 deletions content/api/resources/claimablebalances/single.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,14 @@ server
"_links": {
"self": {
"href": "https://horizon.stellar.org/claimable_balances/000000000102030000000000000000000000000000000000000000000000000000000000"
},
"operations": {
"href": "https://horizon.stellar.org/claimable_balances/000000000102030000000000000000000000000000000000000000000000000000000000/operations{?cursor,limit,order}",
"templated": true
},
"transactions": {
"href": "https://horizon.stellar.org/claimable_balances/000000000102030000000000000000000000000000000000000000000000000000000000/transactions{?cursor,limit,order}",
"templated": true
}
},
"id": "000000000102030000000000000000000000000000000000000000000000000000000000",
Expand Down
Loading

0 comments on commit f826587

Please sign in to comment.