Skip to content

Commit

Permalink
fix broken link
Browse files Browse the repository at this point in the history
  • Loading branch information
xhliu committed Jul 18, 2024
1 parent 25acfd4 commit c15416b
Show file tree
Hide file tree
Showing 47 changed files with 132 additions and 132 deletions.
2 changes: 1 addition & 1 deletion docs/advanced/sighash-type.md
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ Sighash here only affects contracts that access `ScriptContext` in their public

Let us use the [Counter](../how-to-write-a-contract/stateful-contract.md) contract as an example. It simply records how many times it has been called since deployment.

Noted that the `@method` [decorator](../how-to-write-a-contract/how-to-write-a-contract.md#method-decorator) takes a sighash type as a parameter, whose default is `ALL`. According to the [doc](../how-to-write-a-contract/scriptcontext.md#sighash-type), `hashOutputs` is the double SHA256 of the serialization of **all outputs** when the sighash type is `ALL`. The [default calling transaction builder](../how-to-deploy-and-call-a-contract/how-to-customize-a-contract-tx.md#default-1) adds a change output when necessary. That's why we need to add a change output when building outputs of the spending transaction in the public method: we need to build all the outputs that are included in `hashOutputs`. Otherwise, contract call will fail.
Noted that the `@method` [decorator](../how-to-write-a-contract/basics#method-decorator) takes a sighash type as a parameter, whose default is `ALL`. According to the [doc](../how-to-write-a-contract/scriptcontext.md#sighash-type), `hashOutputs` is the double SHA256 of the serialization of **all outputs** when the sighash type is `ALL`. The [default calling transaction builder](../how-to-deploy-and-call-a-contract/how-to-customize-a-contract-tx.md#default-1) adds a change output when necessary. That's why we need to add a change output when building outputs of the spending transaction in the public method: we need to build all the outputs that are included in `hashOutputs`. Otherwise, contract call will fail.

The following [transaction](https://test.whatsonchain.com/tx/845f22b728deb23acacbc6f58f23ffde9c3e2be976e08c57f2bdcb417e3eacc5) is a contract calling transaction of `Counter`. As you can see, it contains two outputs: one for the new state, the other for change.

Expand Down
2 changes: 1 addition & 1 deletion docs/bitcoin-basics/bitcoin-basics.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ sidebar_position: 1

If you are new to Bitcoin development, we recommend exploring the resources listed in this section. While not a required prerequisite, going over these guides will help you develop a better understanding of key concepts and make it easier to begin developing sCrypt smart contracts.

If you are already familiar with the basics of Bitcoin, feel free to skip ahead to the [How to Write a Contract](../how-to-write-a-contract/how-to-write-a-contract.md) section.
If you are already familiar with Bitcoin, feel free to skip ahead to the [Basics](../how-to-write-a-contract/basics.md) section.

## Resources

Expand Down
2 changes: 1 addition & 1 deletion docs/how-to-publish-a-contract.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class MyLib extends SmartContractLib {
}
```

A smart contract library can be declared as a class that extends `SmartContractLib`. It may also have `@prop`s and `@method`s like smart contracts which have the same rules [introduced before](./how-to-write-a-contract). A smart contract library can be used within `@method`s like this:
A smart contract library can be declared as a class that extends `SmartContractLib`. It may also have `@prop`s and `@method`s like smart contracts which have the same rules [introduced before](./how-to-write-a-contract/basics.md). A smart contract library can be used within `@method`s like this:

```ts
class MyContract extends SmartContract {
Expand Down
6 changes: 3 additions & 3 deletions docs/how-to-write-a-contract/built-ins.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ assert(false, 'hello') // throws Error('Execution failed, hello')
- `fill(value: T, length: number): T[length] ` Returns an `FixedArray` with all `size` elements set to `value`, where `value` can be any type.

:::note
`length` must be a [compiled-time constant](./how-to-write-a-contract.md#compile-time-constant).
`length` must be a [compiled-time constant](./basics#compile-time-constant).
:::


Expand Down Expand Up @@ -118,7 +118,7 @@ len(s2) // 5
- `reverseByteString(b: ByteString, size: number): ByteString` Returns reversed bytes of `b` which is of `size` bytes. It is often useful when converting a number between little-endian and big-endian.

:::note
`size` must be a [compiled-time constant](./how-to-write-a-contract.md#compile-time-constant).
`size` must be a [compiled-time constant](./basics#compile-time-constant).
:::

```ts
Expand Down Expand Up @@ -595,7 +595,7 @@ Utils.buildOpreturnScript(data) // '006a0b68656c6c6f20776f726c64'

#### On-chain

The main difference between `HashedMap` and other data types we’ve [previously introduced](../how-to-write-a-contract/#data-types) is that it does NOT store raw data (i.e., keys and values) in the contract on the blockchain. It stores their hashed values instead, to minimize on-chain storage, which is expensive.
The main difference between `HashedMap` and other data types we’ve [previously introduced](./basics#data-types) is that it does NOT store raw data (i.e., keys and values) in the contract on the blockchain. It stores their hashed values instead, to minimize on-chain storage, which is expensive.

These guidelines must be followed when using `HashedMap` in a contract `@method`, i.e., on-chain context.

Expand Down
2 changes: 1 addition & 1 deletion docs/how-to-write-a-contract/stateful-contract.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ Let's take a look at the contract source file `/src/contracts/counter.ts`.

### Stateful properties

As shown [before](how-to-write-a-contract.md#properties), a `@prop(true)` decorator is used to make a property part of the contract stateful, meaning it can be mutated when the contract gets called.
As shown [before](basics#properties), a `@prop(true)` decorator is used to make a property part of the contract stateful, meaning it can be mutated when the contract gets called.

```ts
@prop(true)
Expand Down
4 changes: 2 additions & 2 deletions docs/tutorials/hello-world.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ This `Helloworld` contract stores the sha256 hash of a message in the contract p
Now let’s look at what is in the smart contract.

- `SmartContract`: all smart contracts must extend the `SmartContract` base class.
- `@prop`: the [`@prop` decorator](../how-to-write-a-contract/how-to-write-a-contract.md#properties) marks a contract property.
- `@method`: the [`@method` decorator](../how-to-write-a-contract/how-to-write-a-contract.md#method-decorator) marks a contract method. A [public method](../how-to-write-a-contract/#public-methods) is an entry point to a contract.
- `@prop`: the [`@prop` decorator](../how-to-write-a-contract/basics#properties) marks a contract property.
- `@method`: the [`@method` decorator](../how-to-write-a-contract/basics#method-decorator) marks a contract method. A [public method](../how-to-write-a-contract/basics#public-methods) is an entry point to a contract.
- `assert`: throws an error and makes the method call fail if its first argument is `false`. Here it ensures the passed message hashed to the expected digest.

## Compile Contract
Expand Down
6 changes: 3 additions & 3 deletions open-api/btc-blockchain/get-address-balance.api.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ import TabItem from "@theme/TabItem";

Get balance of an address.

## Request

<details style={{"marginBottom":"1rem"}} className={"openapi-markdown__details"} data-collapsed={false} open={true}><summary style={{}}><h3 className={"openapi-markdown__details-summary-header-params"}>Path Parameters</h3></summary><div><ul><ParamsItem className={"paramsItem"} param={{"name":"network","in":"path","description":"BTC chain network (mainnet | testnet | signet)","required":true,"schema":{"type":"string"}}}></ParamsItem><ParamsItem className={"paramsItem"} param={{"name":"address","in":"path","description":"BTC address","required":true,"schema":{"type":"string"}}}></ParamsItem></ul></div></details><div><div><ApiTabs label={undefined} id={undefined}><TabItem label={"200"} value={"200"}><div>

<div><div><ApiTabs label={undefined} id={undefined}><TabItem label={"200"} value={"200"}><div>

successful operation

</div><div><MimeTabs className={"openapi-tabs__mime"} schemaType={"response"}><TabItem label={"application/json"} value={"application/json"}><SchemaTabs className={"openapi-tabs__schema"}><TabItem label={"Schema"} value={"Schema"}><details style={{}} className={"openapi-markdown__details response"} data-collapsed={false} open={true}><summary style={{}} className={"openapi-markdown__details-summary-response"}><strong>Schema</strong></summary><div style={{"textAlign":"left","marginLeft":"1rem"}}></div><ul style={{"marginLeft":"1rem"}}>any</ul></details></TabItem><TabItem label={"Example (from schema)"} value={"Example (from schema)"}><ResponseSamples responseExample={"{\n \"statusCode\": 0,\n \"data\": {\n \"address\": \"tb1ppvndcdvhjelakr420r9zqfwecke5utl5ug8p7czg0vq8rwd7a4rs4qhmlz\",\n \"chain_stats\": {\n \"funded_txo_count\": 3,\n \"funded_txo_sum\": 9457147,\n \"spent_txo_count\": 1,\n \"spent_txo_sum\": 270329,\n \"tx_count\": 3\n },\n \"mempool_stats\": {\n \"funded_txo_count\": 0,\n \"funded_txo_sum\": 0,\n \"spent_txo_count\": 0,\n \"spent_txo_sum\": 0,\n \"tx_count\": 0\n }\n }\n}"} language={"json"}></ResponseSamples></TabItem><TabItem label={"Example"} value={"Example"}><ResponseSamples responseExample={"{\n \"statusCode\": 0,\n \"data\": {\n \"address\": \"tb1ppvndcdvhjelakr420r9zqfwecke5utl5ug8p7czg0vq8rwd7a4rs4qhmlz\",\n \"chain_stats\": {\n \"funded_txo_count\": 3,\n \"funded_txo_sum\": 9457147,\n \"spent_txo_count\": 1,\n \"spent_txo_sum\": 270329,\n \"tx_count\": 3\n },\n \"mempool_stats\": {\n \"funded_txo_count\": 0,\n \"funded_txo_sum\": 0,\n \"spent_txo_count\": 0,\n \"spent_txo_sum\": 0,\n \"tx_count\": 0\n }\n }\n}"} language={"json"}></ResponseSamples></TabItem></SchemaTabs></TabItem></MimeTabs></div></TabItem><TabItem label={"400"} value={"400"}><div>
</div><div><MimeTabs className={"openapi-tabs__mime"} schemaType={"response"}><TabItem label={"application/json"} value={"application/json"}><SchemaTabs className={"openapi-tabs__schema"}><TabItem label={"Example"} value={"Example"}><ResponseSamples responseExample={"{\n \"statusCode\": 0,\n \"data\": {\n \"address\": \"tb1ppvndcdvhjelakr420r9zqfwecke5utl5ug8p7czg0vq8rwd7a4rs4qhmlz\",\n \"chain_stats\": {\n \"funded_txo_count\": 3,\n \"funded_txo_sum\": 9457147,\n \"spent_txo_count\": 1,\n \"spent_txo_sum\": 270329,\n \"tx_count\": 3\n },\n \"mempool_stats\": {\n \"funded_txo_count\": 0,\n \"funded_txo_sum\": 0,\n \"spent_txo_count\": 0,\n \"spent_txo_sum\": 0,\n \"tx_count\": 0\n }\n }\n}"} language={"json"}></ResponseSamples></TabItem></SchemaTabs></TabItem></MimeTabs></div></TabItem><TabItem label={"400"} value={"400"}><div>

Bad Request

Expand Down
Loading

0 comments on commit c15416b

Please sign in to comment.