Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: upgrade to docusaurus v3, mdx fixes and gas station #511

Merged
merged 2 commits into from
Nov 10, 2023
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
2 changes: 1 addition & 1 deletion docs/build/Introduction/node_interact.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ sidebar_position: 2

Gaining an understanding of the material covered in this section will allow you to debug quickly and easily, should you run into issues.

Developers can interact with Polkadot and its parachains using the [Polkadot{.js}](https://polkadot.js.org) portal. Let's run through a few simple tasks to help you get accustomed to the interface.
Developers can interact with Polkadot and its parachains using the [Polkadot\{.js\}](https://polkadot.js.org) portal. Let's run through a few simple tasks to help you get accustomed to the interface.

First, visit the Polkadot apps portal, and switch to an Astar node by selecting Astar under **Polkadot & Parachains** and press Switch. You will be able to toggle network selection by clicking on the network name in the top left.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ The Substrate API Sidecar is a REST service that makes it easy to interact with

Instead of having to use the Substrate RPC directly and rely on libraries like `Astar.js` or `Polkadot.js`, you can set up a Substrate API server and interact with the blockchain. For example, you can read block history, listen to events, or submit a transaction, all through a REST API server.

The source code for the Substrate Sidecar API can be found here: <https://github.com/paritytech/substrate-api-sidecar>.
The source code for the Substrate Sidecar API can be found here: [https://github.com/paritytech/substrate-api-sidecar](https://github.com/paritytech/substrate-api-sidecar).
Please refer to the README of the repository for more information.

Below we will quickly walk through setting up a Substrate API Sidecar.
Expand Down
2 changes: 1 addition & 1 deletion docs/build/environment/chopsticks.md
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ npx @acala-network/chopsticks@latest -c shiden
```

and simply examine the local setup by using PJS on it.
<https://polkadot.js.org/apps/?rpc=ws://localhost:8000#/explorer>
[https://polkadot.js.org/apps/?rpc=ws://localhost:8000#/explorer](https://polkadot.js.org/apps/?rpc=ws://localhost:8000#/explorer)

### XCM mode

Expand Down
125 changes: 125 additions & 0 deletions docs/build/environment/gas-station.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
---
sidebar_position: 8
---

# The Astar Gas Station

:::note
Integrate with the Astar Networks Gas Station for optimal priority fee.
:::

## Documentation of the calculations

```mermaid
graph TD
GasPriceOracle -->|RPC + calcs| h
estimate -->|20 blocks + percentiles| h
h{harverster} -->|every 1 minutes| firestore
firestore <--> https
```

### `GasPriceOracle`

- Each EVM RPC is queried using the [GasPriceOracle](https://github.com/peppersec/gas-price-oracle) module

```ts
const oracle = new GasPriceOracle({
defaultRpc: 'https://evm.shibuya.astar.network',
blocksCount: 200,
chainId: 81,
});

/*
{
estimate: {
baseFee: 779.371350051,
maxFeePerGas: 782.371350051,
maxPriorityFeePerGas: 3
},
gasPrices: {
instant: 1013.182755066,
fast: 935.245620061,
standard: 857.308485056,
low: 779.371350051
}
}
*/
```

- The GasPriceOracle Github repo does not mention how it does it’s calculations but from the results I could infer and confirm these results:
1. **Low Gas Price**: is the base fee.
2. **Standard Gas Price**: 110% of the base fee.
3. **Fast Gas Price**: 120% of the base fee.
4. **Instant Gas Price**: 130% of the base fee.

### Estimates

- 8 months ago (October 30, 2022), a change was implemented to gather the `gasPrices` from the last 20 blocks and use percentiles of the results.

```ts
for (let i = latest.number; i > latest.number - 20; i--) {
block = await web3[network].eth.getBlock(i);
for (let j = 0; j < block.transactions.length; j++) {
txn = await web3[network].eth.getTransaction(block.transactions[j]);
gasPrices.push(Number(txn.gasPrice));
}
}

const percentiles = percentile([35, 60, 90, 99], gasPrices);
```

### GasPriceOracle

- As of November 1st, 2023, the `GasPriceOracle`, is bein used as fall back values if an error occurred and the percentiles were undefined.

## Substrate Tip Calculation

- The substrate tip is exactly the EVM price calculations multiplied:
$Tip Value=Gas Price×1000$

## Using the gas station

- Shibuya API: GET [https://gas.astar.network/api/gasnow?network=shibuya&type=tip](https://gas.astar.network/api/gasnow?network=shibuya&type=tip)
- Shiden API: GET [https://gas.astar.network/api/gasnow?network=shiden&type=tip](https://gas.astar.network/api/gasnow?network=shiden&type=tip)
- Astar API: GET [https://gas.astar.network/api/gasnow?network=astar&type=tip](https://gas.astar.network/api/gasnow?network=astar&type=tip)
- Rocstar API: GET [https://gas.astar.network/api/gasnow?network=rocstar&type=tip](https://gas.astar.network/api/gasnow?network=rocstar&type=tip)

### Example output

```json
{
"code":200,
"data":{
"average":"857308485056",
"fast":"935245620061",
"slow":"779371350051",
"fastest":"1013182755066",
"eip1559":{
"priorityFeePerGas":{
"average":"857308485056",
"fast":"935245620061",
"slow":"779371350051",
"fastest":"1013182755066"
},
"maxPriorityFeePerGas":"3000000000",
"baseFeePerGas":"779000000000",
"maxFeePerGas":"782000000000"
},
"tip":{
"average":"857308485056000",
"fast":"935245620061000",
"slow":"779371350051000",
"fastest":"1013182755066000"
},
"timestamp":1699544357434
}
}
```


## Related Documents

Include any links to relevant external documents.

- Repo: https://github.com/AstarNetwork/gas-station
- website: [https://gas.astar.network/](https://gas.astar.network/)
2 changes: 1 addition & 1 deletion docs/build/environment/local-network.md
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ OK! Let's explore your local network now.

Visit the following URL:

<https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9944#/explorer>
[https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9944#/explorer](https://polkadot.js.org/apps/?rpc=ws%3A%2F%2F127.0.0.1%3A9944#/explorer)

There, you will see the following screen:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -234,7 +234,7 @@ Signing message
};
```

Signing a message is as simple as it looks. Pass a message that needs to be signed, and the method will return an object { messageSigned: "", signature: "" }
Signing a message is as simple as it looks. Pass a message that needs to be signed, and the method will return an object \{ messageSigned: "", signature: "" \}

messageSigned: message that was signed.

Expand Down
12 changes: 6 additions & 6 deletions docs/build/integrations/api/gas_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ Tips are used for native transaction. Tips are an optional transaction fee that

## GAS API

- Shibuya: <https://gas.astar.network/api/gasnow?network=shibuya&type=gas>
- Shiden: <https://gas.astar.network/api/gasnow?network=shiden&type=gas>
- Astar: <https://gas.astar.network/api/gasnow?network=astar&type=gas>
- Shibuya: [https://gas.astar.network/api/gasnow?network=shibuya&type=gas](https://gas.astar.network/api/gasnow?network=shibuya&type=gas)
- Shiden: [https://gas.astar.network/api/gasnow?network=shiden&type=gas](https://gas.astar.network/api/gasnow?network=shiden&type=gas)
- Astar: [https://gas.astar.network/api/gasnow?network=astar&type=gas](https://gas.astar.network/api/gasnow?network=astar&type=gas)

## Response

Expand Down Expand Up @@ -63,9 +63,9 @@ EIP-1559's purpose is essentially to make gas fees more transparent and predicta

### Tip API

- Shibuya: <https://gas.astar.network/api/gasnow?network=shibuya&type=tip>
- Shiden: <https://gas.astar.network/api/gasnow?network=shiden&type=tip>
- Astar: <https://gas.astar.network/api/gasnow?network=astar&type=tip>
- Shibuya: [https://gas.astar.network/api/gasnow?network=shibuya&type=tip](https://gas.astar.network/api/gasnow?network=shibuya&type=tip)
- Shiden: [https://gas.astar.network/api/gasnow?network=shiden&type=tip](https://gas.astar.network/api/gasnow?network=shiden&type=tip)
- Astar: [https://gas.astar.network/api/gasnow?network=astar&type=tip](https://gas.astar.network/api/gasnow?network=astar&type=tip)

Response
```
Expand Down
6 changes: 3 additions & 3 deletions docs/build/integrations/bridges/cbridge.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ sidebar_position: 1

A guide on how to transfer assets from Ethereum & Binance Smart Chain to the Astar ecosystem. Make sure you have some ASTR to pay gas fees before bridging. You can buy ASTR token on exchanges.

<https://www.coingecko.com/en/coins/astar>
[https://www.coingecko.com/en/coins/astar](https://www.coingecko.com/en/coins/astar)

## Product Page

<https://cbridge.celer.network/#/transfer>
[https://cbridge.celer.network/#/transfer](https://cbridge.celer.network/#/transfer)


## Contracts
Expand Down Expand Up @@ -48,7 +48,7 @@ This is the address that you should use when you withdraw ASTR tokens from excha

In this tutorial we will demonstrate how to bridge USDC from Ethereum to Astar. By doing so, you will be adding liquidity to our network, which benefits the ecosystem overall, and for which we convey our deepest gratitude.

Visit cBridge <https://cbridge.celer.network/#/transfer> and input a currency you would like to transfer.
Visit cBridge [https://cbridge.celer.network/#/transfer](https://cbridge.celer.network/#/transfer) and input a currency you would like to transfer.

![3](img/3.png)

Expand Down
12 changes: 6 additions & 6 deletions docs/build/integrations/indexers/bluez.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ First, obtain an API key [here](https://docs.google.com/forms/d/e/1FAIpQLSf5Fa3T

### Examples of GET queries available through this API:

/nft/v3/{apiKey}/getNFTsForOwner
/nft/v3/\{apiKey\}/getNFTsForOwner

/nft/v3/{apiKey}/getNFTMetadata
/nft/v3/\{apiKey\}/getNFTMetadata

/nft/v3/{apiKey}/getNFTsForContract
/nft/v3/\{apiKey\}/getNFTsForContract

/nft/v3/{apiKey}/getOwnersForNFT
/nft/v3/\{apiKey\}/getOwnersForNFT

/nft/v3/{apiKey}/getOwnersForContract
/nft/v3/\{apiKey\}/getOwnersForContract

/nft/v3/{apiKey}/getNFTSales
/nft/v3/\{apiKey\}/getNFTSales
4 changes: 2 additions & 2 deletions docs/build/integrations/indexers/subscan.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ A Substrate ecological explorer that not only allows ordinary users to view WASM
## Prerequisites
- [Subscan WASM smart contract dashboard for Astar network](https://astar.subscan.io/wasm_contract_dashboard)
- Basic WASM smart contract knowledge
- polkadot{.js} extension (optional, it's used to call WASM smart contract)
- polkadot\{.js\} extension (optional, it's used to call WASM smart contract)

## Getting started

Expand Down Expand Up @@ -48,7 +48,7 @@ After compiling contract in docker, you need to fill in the Contract Verificatio
![verified_contract](./img/subscan/verified_contract.png)

### Read/Call WASM Smart Contract
Visit [Contract tab in contract detail](https://astar.subscan.io/wasm_contract/aBmKPunRKt9VaW6AuMS8ZUhpSYZqHJHYKhvjdNb1M4VQgqS?tab=contract&contractTab=read). Please note that read/call features only apply to verified WASM smart contract, and you need to connect to polkadot{.js} extension before calling contract.
Visit [Contract tab in contract detail](https://astar.subscan.io/wasm_contract/aBmKPunRKt9VaW6AuMS8ZUhpSYZqHJHYKhvjdNb1M4VQgqS?tab=contract&contractTab=read). Please note that read/call features only apply to verified WASM smart contract, and you need to connect to Polkadot\{.js\} extension before calling contract.

![read_call](./img/subscan/read_call.png)

Expand Down
2 changes: 1 addition & 1 deletion docs/build/integrations/indexers/thegraph.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ After successfully running an [RPC node](https://docs.astar.network/docs/build/n
The first step is to clone the [Graph Node repository](https://github.com/graphprotocol/graph-node/):

```sh
git clone <https://github.com/graphprotocol/graph-node/> \\
git clone [https://github.com/graphprotocol/graph-node/](https://github.com/graphprotocol/graph-node/) \\
&& cd graph-node/docker
```

Expand Down
18 changes: 9 additions & 9 deletions docs/build/integrations/node-providers/blast.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,29 +21,29 @@ Users joining the platform will be able to use the APIs for free within certain

Here are two Public APIs, that include Astar / Shiden and Shibuya (+ one-click add network to MetaMask):

<https://blastapi.io/public-api/astar>
[https://blastapi.io/public-api/astar](https://blastapi.io/public-api/astar)

<https://blastapi.io/public-api/shiden>
[https://blastapi.io/public-api/shiden](https://blastapi.io/public-api/shiden)

### Public RPC Endpoints

<https://astar.public.blastapi.io>
[https://astar.public.blastapi.io](https://astar.public.blastapi.io)

<https://shiden.public.blastapi.io>
[https://shiden.public.blastapi.io](https://shiden.public.blastapi.io)

<https://shibuya.public.blastapi.io>
[https://shibuya.public.blastapi.io](https://shibuya.public.blastapi.io)

### Public WSS Endpoints

<wss://astar.public.blastapi.io>
[wss://astar.public.blastapi.io](wss://astar.public.blastapi.io)

<wss://shiden.public.blastapi.io>
[wss://shiden.public.blastapi.io](wss://shiden.public.blastapi.io)

<wss://shibuya.public.blastapi.io>
[wss://shibuya.public.blastapi.io](wss://shibuya.public.blastapi.io)

## Instructions

1. Launch the app on: <https://blastapi.io/login>
1. Launch the app on: [https://blastapi.io/login](https://blastapi.io/login)
2. Connect the app to MetaMask. This is to prevent users from spamming the network. You will only need to connect MetaMask to create an account, and sign in to their app.
![2](img/2.png)

Expand Down
6 changes: 3 additions & 3 deletions docs/build/integrations/node-providers/pinknode.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ Pinknode provides RPC and WSS endpoints for the Astar ecosystem. You will be abl

| Network | RPC Endpoint | WSS Endpoint|
|----|----|---|
| Astar | <https://public-rpc.pinknode.io/astar> | wss://public-rpc.pinknode.io/astar |
| Shiden | <https://public-rpc.pinknode.io/shiden> | wss://public-rpc.pinknode.io/shiden |
| Shibuya | <https://public-rpc.pinknode.io/shibuya> | wss://public-rpc.pinknode.io/shibuya |
| Astar | [https://public-rpc.pinknode.io/astar](https://public-rpc.pinknode.io/astar) | wss://public-rpc.pinknode.io/astar |
| Shiden | [https://public-rpc.pinknode.io/shiden](https://public-rpc.pinknode.io/shiden) | wss://public-rpc.pinknode.io/shiden |
| Shibuya | [https://public-rpc.pinknode.io/shibuya](https://public-rpc.pinknode.io/shibuya) | wss://public-rpc.pinknode.io/shibuya |

## Instructions

Expand Down
10 changes: 5 additions & 5 deletions docs/build/integrations/wallets/subwallet.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ sidebar_position: 2

## Overview

SubWallet, Polkadot{.js}, and Talisman extensions allow dApps to connect to them via public interaction with the `injectedWeb3` object of the window browser.
SubWallet, Polkadot\{.js\}, and Talisman extensions allow dApps to connect to them via public interaction with the `injectedWeb3` object of the window browser.

- SubWallet (public with properties `subwallet-js`)
- Polkadot{.js} (public with properties `polkadot-js`)
- Polkadot\{.js\} (public with properties `polkadot-js`)
- Talisman (public with properties `talisman`)

![20](img/20.png)
Expand All @@ -23,9 +23,9 @@ You can open the `injectedWeb3` object in your browser's devtools.
:::info
Refer to these examples:

- Github Repository <https://github.com/Koniverse/SubConnect>
- Demo App: <https://connect.subwallet.app/>
- Video Demo: <https://bit.ly/38QhmfI>
- Github Repository [https://github.com/Koniverse/SubConnect](https://github.com/Koniverse/SubConnect)
- Demo App: [https://connect.subwallet.app/](https://connect.subwallet.app/)
- Video Demo: [https://bit.ly/38QhmfI](https://bit.ly/38QhmfI)
:::

- Check the extension is active:
Expand Down
2 changes: 1 addition & 1 deletion docs/build/nodes/archive-node/binary.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ sudo nano /etc/systemd/system/astar.service
## Service parameters

:::tip
Please make sure to change **{NODE_NAME}**
Please make sure to change **\{NODE_NAME\}**
:::

<Tabs>
Expand Down
2 changes: 1 addition & 1 deletion docs/build/nodes/archive-node/docker.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ This guide goes over the process of starting a container with both WS and RPC en
Launch the docker node in detached mode:

:::tip
Make sure to change the {NODE_NAME}
Make sure to change the \{NODE_NAME\}
:::

<Tabs>
Expand Down
Loading
Loading