diff --git a/packages/docs/Lib/Mock/index.md b/packages/docs/Lib/Mock/index.md index 8c6e0294b..27e2e5144 100644 --- a/packages/docs/Lib/Mock/index.md +++ b/packages/docs/Lib/Mock/index.md @@ -28,9 +28,9 @@ export class Mock { ## Example -The example below shows how a mocked object can be used. Note that in the example, the object `a` is created after the transaction that spends it. Thus the revision of `a` is not known when `tx` is built. Once `a` is created on-chain and its revision becomes known, the code below updated the input of `tx` to spend the revision of `a`. + -```js + + +:::code source="../../../lib/test/mock.test.ts" ::: diff --git a/packages/docs/Node/ancestors.md b/packages/docs/Node/ancestors.md index aaac19a67..b31f0e167 100644 --- a/packages/docs/Node/ancestors.md +++ b/packages/docs/Node/ancestors.md @@ -1,13 +1,25 @@ # ancestors -#### `/v1/CHAIN/NETWORK/tx/:txId/ancestors` +_Returns an array of transaction ids for all transaction that the on-chain object at the given transaction if depends on._ -Returns an array with the transaction IDs of the ancestors of a given transaction. An ancestor is a transaction that is an input to the given transaction. +## Description + +An on-chain object _o_ depends on a transaction _tx_ if _tx_ is a Bitcoin Computer transaction labelled with an expression _exp_ and _exp_ needs to be evaluated in order to compute the the value of _o_. The endpoint returns all ids of such transactions. + +## Endpoint + +`/v1/CHAIN/NETWORK/tx/:txId/ancestors` + +## Example + +### Request ```shell curl -X GET http://localhost:1031/v1/LTC/regtest/tx/e53c1440f547b51343d46a2acaafe127e915c7ed08a7ef2ed0ffc248360c0cca/ancestors ``` +### Response + ```json [ "5a04f3cdb0450fd4708dfcd2fe86f51c6077add296507d69f2620c15e94c8e89", diff --git a/packages/docs/Node/balance.md b/packages/docs/Node/balance.md index 41a91eb1d..885bccfd7 100644 --- a/packages/docs/Node/balance.md +++ b/packages/docs/Node/balance.md @@ -1,13 +1,25 @@ # balance -#### `/v1/CHAIN/NETWORK/address/:address/balance` +_Returns the balance of a given address._ -Returns the confirmed, unconfirmed and total balance for a given address. +## Description + +Returns the confirmed, unconfirmed and total balance. + +## Endpoint + +`/v1/CHAIN/NETWORK/address/:address/balance` + +## Example + +### Request ```shell curl -X GET http://localhost:1031/v1/LTC/regtest/address/mkMUZNoiLh4uuuENU5HNZ4Ssxo8BqEQc5t/balance ``` +### Response + ```json { "confirmed": 99927794, diff --git a/packages/docs/Node/bulk.md b/packages/docs/Node/bulk.md index 13f9466d4..dbdd2bd48 100644 --- a/packages/docs/Node/bulk.md +++ b/packages/docs/Node/bulk.md @@ -1,8 +1,14 @@ # bulk -#### `/v1/CHAIN/NETWORK/tx/bulk` +_Returns the raw transaction hexes for a given list of transaction ids._ -Returns the raw transaction hexes for a given list of transaction IDs. +## Endpoint + +`/v1/CHAIN/NETWORK/tx/bulk` + +## Example + +### Request ```shell curl -X POST http://localhost:1031/v1/LTC/regtest/tx/bulk \ @@ -16,6 +22,8 @@ curl -X POST http://localhost:1031/v1/LTC/regtest/tx/bulk \ }' ``` +### Response + ```json ["0100000002b80e0d87611d...", "0100000001b80e0d87611d...", "0100000000012b087e1832..."] ``` diff --git a/packages/docs/Node/id.md b/packages/docs/Node/id.md index f52d49d3b..8eef6eb41 100644 --- a/packages/docs/Node/id.md +++ b/packages/docs/Node/id.md @@ -1,13 +1,21 @@ # id -#### `/v1/store/:id` +_Get the data stored in the off-chain storage._ -Get the data stored in the offchain storage. +## Endpoint + +`/v1/store/:id` + +## Example + +### Request ```shell curl -X GET http://localhost:1031/v1/store/fcdb882a0b9556a0c6fb2a89efe0633f0c256f24696f465d386a91803838e79a ``` +### Response + ```json { "exp": "class A extends Contract { diff --git a/packages/docs/Node/json.md b/packages/docs/Node/json.md index 69869da51..ac41fdb36 100644 --- a/packages/docs/Node/json.md +++ b/packages/docs/Node/json.md @@ -1,13 +1,21 @@ # json -#### `/v1/CHAIN/NETWORK/tx/:txId/json` +_Returns the JSON representation of a given transaction._ -Returns the JSON representation of a given transaction. +## Endpoint + +`/v1/CHAIN/NETWORK/tx/:txId/json` + +## Example + +### Request ```shell curl -X GET http://localhost:1031/v1/LTC/regtest/tx/e53c1440f547b51343d46a2acaafe127e915c7ed08a7ef2ed0ffc248360c0cca/json ``` +### Response + ```json { "txId": "e53c1440f547b51343d46a2acaafe127e915c7ed08a7ef2ed0ffc248360c0cca", diff --git a/packages/docs/Node/list-txs.md b/packages/docs/Node/list-txs.md index 6ba030deb..233a8a7f6 100644 --- a/packages/docs/Node/list-txs.md +++ b/packages/docs/Node/list-txs.md @@ -1,13 +1,21 @@ # list-txs -#### `/v1/CHAIN/NETWORK/wallet/:address/list-txs` +_Returns the sent and received transactions for a given address._ -Returns the sent and received transactions for a given address. +## Endpoint + +`/v1/CHAIN/NETWORK/wallet/:address/list-txs` + +## Example + +### Request ```shell curl -X GET http://localhost:1031/v1/LTC/regtest/wallet/mkMUZNoiLh4uuuENU5HNZ4Ssxo8BqEQc5t/list-txs ``` +### Response + ```json { "sentTxs": [ diff --git a/packages/docs/Node/next.md b/packages/docs/Node/next.md index 80627dbe1..0dc13a7da 100644 --- a/packages/docs/Node/next.md +++ b/packages/docs/Node/next.md @@ -1,13 +1,21 @@ # next -#### `/v1/CHAIN/NETWORK/next/:rev` +_Get the next revision of a given revision._ -Get the next revision of a given revision. +## Endpoint + +`/v1/CHAIN/NETWORK/next/:rev` + +## Example + +### Request ```shell curl -X GET http://localhost:1031/v1/LTC/regtest/next/032fc7a37e7848f5fb2beb79f773631c6047be0a2e9a699e1355aa8d1c64155e:0 ``` +### Response + ```json { "rev": "44a1e658be5b1fa7b13511979c91497cacf9286aac694bbb75188b875384db98:0" } ``` diff --git a/packages/docs/Node/non-standard-utxos.md b/packages/docs/Node/non-standard-utxos.md index 0f620e278..2cf876191 100644 --- a/packages/docs/Node/non-standard-utxos.md +++ b/packages/docs/Node/non-standard-utxos.md @@ -1,24 +1,38 @@ # non-standard-utxos -#### `/v1/CHAIN/NETWORK/non-standard-utxos` +_Query revisions by module specifier, public key, limit, order, offset and list of transaction ids._ -Query revisions by module specifier, public key, limit, order, offset and list of transaction ids. +## Endpoint + +`/v1/CHAIN/NETWORK/non-standard-utxos` + +## Example + +### Requests ```shell -curl -X GET http://localhost:1031/v1/LTC/regtest/non-standard-utxos?mod=1 curl -X GET http://localhost:1031/v1/LTC/regtest/non-standard-utxos?publicKey=02e3b0... -curl -X GET http://localhost:1031/v1/LTC/regtest/non-standard-utxos?limit=10 -curl -X GET http://localhost:1031/v1/LTC/regtest/non-standard-utxos?order=DESC -curl -X GET http://localhost:1031/v1/LTC/regtest/non-standard-utxos?offset=10 +``` + +```shell +curl -X GET http://localhost:1031/v1/LTC/regtest/non-standard-utxos?publicKey=02e3b0...&mod=af19fa7... +``` -id="4446faf2ea02713580152f2355bc91e2eac3649c85e38d882e1ca795bb7b1494:0" +```shell +curl -X GET http://localhost:1031/v1/LTC/regtest/non-standard-utxos?publicKey=02e3b0...&mod=af19fa7...&limit=10 +``` + +```shell +curl -X GET http://localhost:1031/v1/LTC/regtest/non-standard-utxos?ids=%5B%224446faf2ea02713580152f2355bc91e2eac3649c85e38d882e1ca795bb7b1494%3A0%22%5D +``` + + - +### Response ```json ["4446faf2ea02713580152f2355bc91e2eac3649c85e38d882e1ca795bb7b1494:0"] diff --git a/packages/docs/Node/post.md b/packages/docs/Node/post.md index 1ed75b7a6..b7cd77443 100644 --- a/packages/docs/Node/post.md +++ b/packages/docs/Node/post.md @@ -1,8 +1,14 @@ # post -#### `/v1/CHAIN/NETWORK/tx/post` +_Posts a raw transaction to the network and returns its transaction ID._ -Posts a raw transaction to the network and returns its transaction ID. +## Endpoint + +`/v1/CHAIN/NETWORK/tx/post` + +## Example + +### Request ```shell curl -X POST http://localhost:1031/v1/LTC/regtest/tx/post \ @@ -12,6 +18,8 @@ curl -X POST http://localhost:1031/v1/LTC/regtest/tx/post \ }' ``` +### Response + ```json "e53c1440f547b51343d46a2acaafe127e915c7ed08a7ef2ed0ffc248360c0cca" ``` diff --git a/packages/docs/Node/prev.md b/packages/docs/Node/prev.md index 362c3b948..7c5c626d8 100644 --- a/packages/docs/Node/prev.md +++ b/packages/docs/Node/prev.md @@ -1,13 +1,23 @@ # prev -#### `/v1/CHAIN/NETWORK/prev/:rev` +_Get the previous revision of a given revision._ -Get the previous revision of a given revision. +## Endpoint + +`/v1/CHAIN/NETWORK/prev/:rev` + +## Example + +### Request ```shell curl -X GET http://localhost:1031/v1/LTC/regtest/prev/44a1e658be5b1fa7b13511979c91497cacf9286aac694bbb75188b875384db98:0 ``` +### Response + ```json -{ "rev": "032fc7a37e7848f5fb2beb79f773631c6047be0a2e9a699e1355aa8d1c64155e:0" } +{ + "rev": "032fc7a37e7848f5fb2beb79f773631c6047be0a2e9a699e1355aa8d1c64155e:0" +} ``` diff --git a/packages/docs/Node/received-outputs.md b/packages/docs/Node/received-outputs.md index 7deb65da9..bd5e82350 100644 --- a/packages/docs/Node/received-outputs.md +++ b/packages/docs/Node/received-outputs.md @@ -1,13 +1,21 @@ # received-outputs -#### `/v1/CHAIN/NETWORK/wallet/:address/received-outputs` +_Returns the outputs that were received by a given address._ -Returns the outputs that were received by a given address. +## Endpoint + +`/v1/CHAIN/NETWORK/wallet/:address/received-outputs` + +## Example + +### Request ```shell curl -X GET http://localhost:1031/v1/LTC/regtest/wallet/mkMUZNoiLh4uuuENU5HNZ4Ssxo8BqEQc5t/received-outputs ``` +### Response + ```json [ { diff --git a/packages/docs/Node/revs.md b/packages/docs/Node/revs.md index 90f00832a..dde78c56b 100644 --- a/packages/docs/Node/revs.md +++ b/packages/docs/Node/revs.md @@ -1,8 +1,14 @@ # revs -#### `/v1/CHAIN/NETWORK/revs` +_Get the revisions of a list of transactions._ -Get the revisions of a list of transactions. +## Endpoint + +`/v1/CHAIN/NETWORK/revs` + +## Exampls + +### Request ```shell curl -X POST http://localhost:1031/v1/LTC/regtest/revs \ @@ -15,6 +21,8 @@ curl -X POST http://localhost:1031/v1/LTC/regtest/revs \ }' ``` +### Response + ```json [ "5a04f3cdb0450fd4708dfcd2fe86f51c6077add296507d69f2620c15e94c8e89", diff --git a/packages/docs/Node/revtoid.md b/packages/docs/Node/revtoid.md index 9b85c76b2..390b0b46e 100644 --- a/packages/docs/Node/revtoid.md +++ b/packages/docs/Node/revtoid.md @@ -1,8 +1,14 @@ # revToId -#### `/v1/CHAIN/NETWORK/rev/:revToId` +_Given a revision, returns the id of the smart contract._ -Given a revision, returns the id of the smart contract. +## Endpoint + +`/v1/CHAIN/NETWORK/rev/:revToId` + +## Example + +### Request ```shell curl -X POST http://localhost:1031/v1/LTC/regtest/revToId \ @@ -12,6 +18,8 @@ curl -X POST http://localhost:1031/v1/LTC/regtest/revToId \ }' ``` +### Response + ```json "db98c59f328bb45b14a957ce44546f5bfe2f1bf4394de18e98f32188e76082be:0" ``` diff --git a/packages/docs/Node/rpc.md b/packages/docs/Node/rpc.md index 65be082c8..da73a5ef0 100644 --- a/packages/docs/Node/rpc.md +++ b/packages/docs/Node/rpc.md @@ -1,8 +1,14 @@ # rpc -#### `/v1/CHAIN/NETWORK/rpc` +_Call a Bitcoin RPC method._ -Call a Bitcoin RPC method. +## Endpoint + +`/v1/CHAIN/NETWORK/rpc` + +## Example + +### Request ```shell curl -X POST http://localhost:1031/v1/LTC/regtest/rpc \ @@ -13,6 +19,8 @@ curl -X POST http://localhost:1031/v1/LTC/regtest/rpc \ }' ``` +### Response + ```json { "result": { diff --git a/packages/docs/Node/sent-outputs.md b/packages/docs/Node/sent-outputs.md index 1fb6a6907..65a6d1c6b 100644 --- a/packages/docs/Node/sent-outputs.md +++ b/packages/docs/Node/sent-outputs.md @@ -1,13 +1,21 @@ # sent-outputs -#### `/v1/CHAIN/NETWORK/wallet/:address/sent-outputs` +_Returns the outputs that were sent from a given address._ -Returns the outputs that were sent from a given address. +## Endpooint + +`/v1/CHAIN/NETWORK/wallet/:address/sent-outputs` + +## Example + +### Request ```shell curl -X GET http://localhost:1031/v1/LTC/regtest/wallet/mkMUZNoiLh4uuuENU5HNZ4Ssxo8BqEQc5t/sent-outputs ``` +### Response + ```json [ { diff --git a/packages/docs/Node/store.md b/packages/docs/Node/store.md index 0f2ecfd34..7fbc7be11 100644 --- a/packages/docs/Node/store.md +++ b/packages/docs/Node/store.md @@ -1,8 +1,14 @@ # store -#### `/v1/store` +_Stores the hex of the data in the offchain storage._ -Stores the hex of the data in the offchain storage. +## Endpoint + +`/v1/store` + +## Example + +### Request ```shell curl -X POST http://localhost:1031/v1/store \ diff --git a/packages/docs/Node/utxos.md b/packages/docs/Node/utxos.md index 96c23b1a8..ab320d2ab 100644 --- a/packages/docs/Node/utxos.md +++ b/packages/docs/Node/utxos.md @@ -1,13 +1,21 @@ # utxos -#### `/v1/CHAIN/NETWORK/wallet/:address/utxos` +_Returns the UTXOs for a given address._ -Returns the UTXOs for a given address. +## Endpoint + +`/v1/CHAIN/NETWORK/wallet/:address/utxos` + +## Example + +### Request ```shell curl -X GET http://localhost:1031/v1/LTC/regtest/wallet/mwJn1YPMq7y5F8J3LkC5Hxg9PHyZ5K4cFv/utxos ``` +### Response + ```json [ { diff --git a/packages/docs/start.md b/packages/docs/start.md index 39a12c8ac..9556926e8 100644 --- a/packages/docs/start.md +++ b/packages/docs/start.md @@ -116,11 +116,11 @@ The expected output is: ```js Terminal Counter { n: 1, - _id: '656...024:0', - _rev: '90f...73f:0', - _root: '656...024:0', + _id: :, + _rev: :, + _root: :, _amount: 7860, - _owners: ['037...954'] + _owners: [] } ```