Skip to content

Commit

Permalink
docs: update tutorials and move ibc relayer to advanced concepts
Browse files Browse the repository at this point in the history
  • Loading branch information
kollegian committed May 30, 2024
1 parent 2309ec3 commit 05d070c
Show file tree
Hide file tree
Showing 10 changed files with 28 additions and 24 deletions.
1 change: 1 addition & 0 deletions pages/dev-advanced-concepts/_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
"execute-multiple": "Execute Multiple Transactions",
"hd-path-coin-types": "HD Path & Coin Types",
"proposals": "Proposals",
"ibc-relayer": "Ibc Relayer",
"evm-rpc-endpoints": "EVM RPC Endpoints",
"interoperability": "Interoperability",
"differences-with-ethereum": "Differences from Ethereum"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

For IBC protocol overview, refer to

[IBC Protocol](https://www.notion.so/IBC-Protocol-61a7d667b530434c8841dde8f3aa2612?pvs=21)
[IBC Protocol](../dev-tutorials/ibc-protocol)

# Overview

Expand Down Expand Up @@ -90,7 +90,6 @@ port = 3001
id = 'ibc-0'
rpc_addr = 'http://localhost:27030'
grpc_addr = 'http://localhost:27032'
websocket_addr = 'ws://localhost:27030/websocket'
rpc_timeout = '15s'
account_prefix = 'cosmos'
key_name = 'wallet'
Expand All @@ -101,12 +100,12 @@ gas_multiplier = 1.5
clock_drift = '5s'
trusting_period = '14days'
trust_threshold = { numerator = '1', denominator = '3' }
event_source = { mode = 'push', url = 'ws://127.0.0.1:27030/websocket', batch_delay = '500ms' }

[[chains]]
id = 'sei-chain'
rpc_addr = 'http://localhost:26657'
grpc_addr = 'http://localhost:9090'
websocket_addr = 'ws://localhost:26657/websocket'
rpc_timeout = '15s'
account_prefix = 'sei'
key_name = 'wallet'
Expand All @@ -117,6 +116,7 @@ gas_multiplier = 2
clock_drift = '5s'
trusting_period = '14days'
trust_threshold = { numerator = '1', denominator = '3' }
event_source = { mode = 'push', url = 'ws://127.0.0.1:26657/websocket', batch_delay = '500ms' }

```

Expand Down
4 changes: 0 additions & 4 deletions pages/dev-advanced-concepts/querying-historical-state.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,3 @@ Querying by block height with seid
## **Using Indexers for Historical Data**

While archive nodes provide the raw historical data, indexers are essential for efficiently querying and analyzing this data. Indexers organize and optimize the data, making it easier to access and analyze.

## **Indexer Providers**:

There are several indexer providers that you can use to query historical data on the Sei blockchain. Refer to the [Indexer Providers](https://www.notion.so/Advanced-concepts-cfcc51a81ede49d186bb9aa36fc73d83?pvs=21) section for more information on available services.
3 changes: 1 addition & 2 deletions pages/dev-tutorials/_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@
"nft-contract-tutorial": "NFT Contracts",
"pointer-contracts": "Pointer Contracts",
"multi-sig-accounts": "Multi-Sig Accounts",
"ibc-protocol": "IBC Protocol",
"ibc-relayer": "IBC Relayer"
"ibc-protocol": "IBC Protocol"
}
6 changes: 3 additions & 3 deletions pages/dev-tutorials/building-a-frontend.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ These values will be used in the app to query and execute a contract.
Replace your main `App` component with the following:

```tsx copy filename="App.tsx"
import { WASM_PRECOMPILE_ADDRESS, SeiChainInfo, getWasmPrecompileEthersV6Contract } from '@sei-js/evm';
import { WASM_PRECOMPILE_ADDRESS, SEI_CHAIN_INFO, getWasmPrecompileEthersV6Contract } from '@sei-js/evm';
import { useEffect, useState } from "react";
import { BrowserProvider, Contract, toUtf8Bytes, toUtf8String } from "ethers";
import "./App.css";
Expand Down Expand Up @@ -115,14 +115,14 @@ function App() {
if (window.ethereum) {
const provider = new BrowserProvider(window.ethereum);
const { chainId } = await provider.getNetwork();
const devnetChainId = SeiChainInfo.devnet.chainId
const devnetChainId = SEI_CHAIN_INFO.devnet.chainId
if (chainId !== BigInt(devnetChainId)) {
alert("Wallet is not connected to Sei EVM devnet");
return;
}

const signer = await provider.getSigner();
const contract = getWasmPrecompileEthersV6Contract(WASM_PRECOMPILE_ADDRESS, signer)
const contract = getWasmPrecompileEthersV6Contract(signer)

setContract(contract);
} else {
Expand Down
16 changes: 13 additions & 3 deletions pages/dev-tutorials/evm-general.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -285,8 +285,11 @@ To call contract from frontend, you could use `ethers` like:
```tsx
import {ethers} from "ethers";

const signer = await getEthSigner();
const provider = await getProvider();
const privateKey = <Your Private Key>;
const evmRpcEndpoint = <Your Evm Rpc Endpoint>
const provider = new ethers.JsonRpcProvider(evmRpcEndpoint);
const signer = new ethers.Wallet(privateKey, provider);

if (!signer) {
console.log('No signer found');
return;
Expand Down Expand Up @@ -331,13 +334,20 @@ To call contract from frontend, you could use `ethers` like:
const contractAddress = 0X_CONTRACT_ADDRESS;

// Create a new instance of the ethers.js Contract object
const contract = new ethers.Contract(contractAddress, abi, provider);
const contract = new ethers.Contract(contractAddress, abi, signer);

// Call the contract's functions
async function getCount() {
const count = await contract.getCount();
console.log(count.toString());
}

async function increment() {
const txResponse = await contract.increment();
const mintedTx = await txResponse.wait();
console.log(mintedTx);
}

await increment();
await getCount();
```
6 changes: 3 additions & 3 deletions pages/dev-tutorials/nft-contract-tutorial.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ forge remappings > remappings.txt
In a new terminal, deploy your contract:

```bash copy
forge create --rpc-url http://localhost:8545 --private-key <test_account_private_key> src/MyNFT.sol:MyNFT
forge create --rpc-url http://localhost:8545 --private-key <test_account_private_key> src/MyNFT.sol:MyNFT --legacy
```

**Flags**
Expand Down Expand Up @@ -143,7 +143,7 @@ forge remappings > remappings.txt
To enable seamless use of this NFT contract in CosmWasm environments, you can create a pointer contract. This process results in an CW721 token that can be imported and used in Sei wallets and applications.

```bash copy
seid tx wasm instantiate 8 '{"erc721_address": "$ERC721_TOKEN_ADDRESS"}' --from=$ACCOUNT --label=$LABEL --chain-id=arctic-1 --broadcast-mode=block --gas=250000 --fees=25000usei --node=https://rpc-arctic-1.sei-apis.com/ --no-admin
seid tx evm register-cw-pointer ERC721 $ERC721_TOKEN_ADDRESS --from $ACCOUNT --chain-id=arctic-1 --fees=25000usei --node=https://rpc-arctic-1.sei-apis.com/
```

**Parameters**
Expand All @@ -165,7 +165,7 @@ Executing this command creates an CW721 NFT contract and outputs the contract ad

<Callout type="info">
Learn more about EVM interoperability and pointer contracts
[here](../interoperability/overview.mdx).
[here](../dev-advanced-concepts/interoperability/introduction.mdx).
</Callout>

</Tabs.Tab>
Expand Down
2 changes: 1 addition & 1 deletion pages/dev-tutorials/pointer-contracts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ This section guides you through the process of deploying a Pointer Contract for

<Callout type="info" emoji="ℹ️">
For an in-depth understanding of Sei token standards, click
[here](/token-standards).
[here](../dev-token-standards).
</Callout>

#### Prerequisites
Expand Down
6 changes: 2 additions & 4 deletions pages/dev-tutorials/tokenfactory-tutorial.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ Create a token metadata `json` file. The file below is an example metadata file
{
"name": "sei",
"description": "The native token of Sei.",
"symbol": "SEI",
"denom_units": [
{
"denom": "usei",
Expand Down Expand Up @@ -148,15 +149,12 @@ Only the token admin has permission to mint and burn tokens. If necessary, you c
To enable seamless use of this token in EVM environments, we can create a pointer contract. This process results in an ERC20 token that can be imported and used in EVM wallets and applications.

```bash copy
seid tx evm deploy-erc20 $DENOM $NAME $SYMBOL $DECIMAL --from=$ACCOUNT --evm-rpc=https://evm-rpc.arctic-1.seinetwork.io/
seid tx evm call-precompile pointer addNativePointer $DENOM --from=$ACCOUNT --fees 20000usei
```

**Parameters**

- `DENOM`: The denomination of the token for which you want to create an ERC20 pointer. This should match the TokenFactory token you created.
- `NAME`: The name you wish to assign to your ERC20 pointer token. It should match the name of the TokenFactory token.
- `SYMBOL`: The symbol for your ERC20 pointer token. It should correspond with the symbol of the TokenFactory token.
- `DECIMAL`: The number of decimals for your ERC20 pointer token. This should align with the decimals of the TokenFactory token (typically 6).

**Flags**

Expand Down
2 changes: 1 addition & 1 deletion pages/dev-validators/register.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
Before you register a validator, ensure that you have completed the following steps:

1. **Install the `seid` CLI**: Follow the [installation guide](../dev-node/intro.mdx) to set up the `seid` command-line interface.
2. **Set Up a Full Node**: Ensure your full node is fully synced with the network. Refer to the [full node setup guide](../dev-node/node-operators.mdx).
2. **Set Up a Full Node**: Ensure your full node is fully synced with the network. Refer to the [full node setup guide](../dev-node/intro.mdx).

## Generate a Validator Key

Expand Down

0 comments on commit 05d070c

Please sign in to comment.