Skip to content
This repository has been archived by the owner on Oct 13, 2023. It is now read-only.

feat(rest): Implement evmos and cometbft all rest interfaces for us to query information about the chain #180

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
5 changes: 4 additions & 1 deletion .markdownlint.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,8 @@
"MD013": false,
"MD042": false,
"MD033": false,
"MD036": false
"MD036": false,
"MD041": false,
"MD046": false,
"MD049": false
}
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ Ref: https://keepachangelog.com/en/1.0.0/
## Unreleased

- (proto)[#166](https://github.com/evmos/evmosjs/pull/166) Expose DynamicFeeExtension Protobuf message
- (rest)[#180](https://github.com/evmos/evmosjs/pull/180) Implement evmos and cometbft all rest interfaces for us to query information about the chain

## evmosjs v0.3.3

Expand Down
21 changes: 5 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,27 +58,16 @@ Note that Yarn v1 is not supported ([see explanation](https://docs.buf.build/bsr
Query the account number, sequence, and pubkey for a given address.

```ts
import { generateEndpointAccount } from '@evmos/provider'
import { App } from '@evmos/provider'

const address = 'evmos1...'
const address = 'evmos1qqqqhe5pnaq5qq39wqkn957aydnrm45sdn8583'

// Find node urls for either mainnet or testnet here:
// https://docs.evmos.org/develop/api/networks.
const nodeUrl = '...'
const queryEndpoint = `${nodeUrl}${generateEndpointAccount(address)}`
const baseURL = 'https://rest.bd.evmos.org:1317'
const app = new App({ baseURL })

const restOptions = {
method: 'GET',
headers: { 'Content-Type': 'application/json' },
}

// Note that the node will return a 400 status code if the account does not exist.
const rawResult = await fetch(
queryEndpoint,
restOptions,
)

const result = await rawResult.json()
const account = await app.auth.account(address)

// The response format is available at @evmos/provider/rest/account/AccountResponse.
// Note that the `pub_key` will be `null` if the address has not sent any transactions.
Expand Down
42 changes: 14 additions & 28 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading