Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions packages/docs/Lib/Mock/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`.
<!-- The example below shows how a mocked object can be used. Note that 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
<!-- ```js
import { Mock, Contract } from '@bitcoin-computer/lib'

class M extends Mock {
Expand Down Expand Up @@ -84,4 +84,6 @@ tx.updateInput(0, { txId, index })
await computer.fund(tx)
await computer.sign(tx)
await computer.broadcast(tx)
```
``` -->

:::code source="../../../lib/test/mock.test.ts" :::
16 changes: 14 additions & 2 deletions packages/docs/Node/ancestors.md
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
16 changes: 14 additions & 2 deletions packages/docs/Node/balance.md
Original file line number Diff line number Diff line change
@@ -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,
Expand Down
12 changes: 10 additions & 2 deletions packages/docs/Node/bulk.md
Original file line number Diff line number Diff line change
@@ -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 \
Expand All @@ -16,6 +22,8 @@ curl -X POST http://localhost:1031/v1/LTC/regtest/tx/bulk \
}'
```

### Response

```json
["0100000002b80e0d87611d...", "0100000001b80e0d87611d...", "0100000000012b087e1832..."]
```
12 changes: 10 additions & 2 deletions packages/docs/Node/id.md
Original file line number Diff line number Diff line change
@@ -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 {
Expand Down
12 changes: 10 additions & 2 deletions packages/docs/Node/json.md
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
12 changes: 10 additions & 2 deletions packages/docs/Node/list-txs.md
Original file line number Diff line number Diff line change
@@ -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": [
Expand Down
12 changes: 10 additions & 2 deletions packages/docs/Node/next.md
Original file line number Diff line number Diff line change
@@ -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" }
```
34 changes: 24 additions & 10 deletions packages/docs/Node/non-standard-utxos.md
Original file line number Diff line number Diff line change
@@ -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
```

<!-- id="4446faf2ea02713580152f2355bc91e2eac3649c85e38d882e1ca795bb7b1494:0"
json_array=$(jq -n --arg id "$id" '[$id]')
encoded_json=$(echo "$json_array" | jq -r @uri)
url="http://localhost:1031/v1/LTC/regtest/non-standard-utxos?ids=$encoded_json"
curl -X GET "$url"
```
curl -X GET "$url" -->

<!-- curl -X GET http://localhost:1031/v1/LTC/regtest/non-standard-utxos?ids=%5B%224446faf2ea02713580152f2355bc91e2eac3649c85e38d882e1ca795bb7b1494%3A0%22%5D -->
### Response

```json
["4446faf2ea02713580152f2355bc91e2eac3649c85e38d882e1ca795bb7b1494:0"]
Expand Down
12 changes: 10 additions & 2 deletions packages/docs/Node/post.md
Original file line number Diff line number Diff line change
@@ -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 \
Expand All @@ -12,6 +18,8 @@ curl -X POST http://localhost:1031/v1/LTC/regtest/tx/post \
}'
```

### Response

```json
"e53c1440f547b51343d46a2acaafe127e915c7ed08a7ef2ed0ffc248360c0cca"
```
16 changes: 13 additions & 3 deletions packages/docs/Node/prev.md
Original file line number Diff line number Diff line change
@@ -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"
}
```
12 changes: 10 additions & 2 deletions packages/docs/Node/received-outputs.md
Original file line number Diff line number Diff line change
@@ -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
[
{
Expand Down
12 changes: 10 additions & 2 deletions packages/docs/Node/revs.md
Original file line number Diff line number Diff line change
@@ -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 \
Expand All @@ -15,6 +21,8 @@ curl -X POST http://localhost:1031/v1/LTC/regtest/revs \
}'
```

### Response

```json
[
"5a04f3cdb0450fd4708dfcd2fe86f51c6077add296507d69f2620c15e94c8e89",
Expand Down
12 changes: 10 additions & 2 deletions packages/docs/Node/revtoid.md
Original file line number Diff line number Diff line change
@@ -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 \
Expand All @@ -12,6 +18,8 @@ curl -X POST http://localhost:1031/v1/LTC/regtest/revToId \
}'
```

### Response

```json
"db98c59f328bb45b14a957ce44546f5bfe2f1bf4394de18e98f32188e76082be:0"
```
Loading