# @gotabit/client

> The client for Gotabit

Latest version **1.1.28** (published 2023-07-20) · MIT license · 0 weekly downloads

## Install

```sh
npm install @gotabit/client
pnpm add @gotabit/client
yarn add @gotabit/client
bun add @gotabit/client
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.28 |
| Published | 2023-07-20 |
| First published | 2022-11-19 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 4 |
| Unpacked size | 2.6 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Maintainers | new_sunflower, wuchendi, roy_gotabit |

## Links

- npm: https://www.npmjs.com/package/@gotabit/client
- Repository: https://github.com/gotabit/sdk-ts
- Homepage: https://github.com/gotabit/tree/main/packages/client
- Issues: https://github.com/gotabit/sdk-ts/issues
- npm.io page: https://npm.io/package/@gotabit/client

## Dependencies (4)

- [fast-deep-equal](https://npm.io/package/fast-deep-equal.md) ^3.1.3
- [@cosmjs/stargate](https://npm.io/package/@cosmjs/stargate.md) ^0.31.0
- [@gotabit/wallet-core](https://npm.io/package/@gotabit/wallet-core.md) ^1.1.24
- [@cosmjs/cosmwasm-stargate](https://npm.io/package/@cosmjs/cosmwasm-stargate.md) ^0.31.0

## Recent versions

- 1.1.28 (latest) — 2023-07-20
- 1.1.27 — 2023-07-19
- 1.1.24 — 2023-04-01
- 1.1.23 — 2023-01-12
- 1.1.22 — 2022-12-01
- 1.1.21 — 2022-11-25
- 1.1.20 — 2022-11-21
- 1.1.19 — 2022-11-19

## README

# Client

Client for Gotabit.

### Install

npm install

```
npm i @gotabit/client
```

yarn install

```
yarn add @gotabit/client
```

### Sign with client and broadcast

After creating the transaction message we need to send the payload to wallet so it can be signed. With the signature we can broadcast the transaction.

```ts
import { GotabitClient } from '@gotabit/client'
import { KeplrWallet } from '@gotabit/wallet-keplr'

const wallet = await KeplrWallet.init('test')

const gotabit = await GotabitClient.init(wallet, 'test')
const accounts = await gotabit.wallet.getAccounts()

const account = accounts[0].address

const client = await gotabit.signStargateClient()

const toAddress = 'gio1qdgzfy4vta5p43l4urdtmawka3qv2ldh4h0jay'
const msgSendtoken = createMsgSend(account, toAddress, '3', 'ugtb')

const result = await client.signAndBroadcast(account, [msgSendtoken], 'auto')
```

Init client without wallet. You can only use stargateClient and wasmClient without wallet.

```ts
const gotabit = await GotabitClient.init(null, 'test')
const wasmClient = await gotabit.wasmClient()

const response = await wasmClient.queryContractSmart(contractAddress, queryMsg)
```

### Sign Arbitary message

This is an experimental implementation of [ADR-36](https://github.com/cosmos/cosmos-sdk/blob/main/docs/architecture/adr-036-arbitrary-signature.md). Use this feature at your own risk.

```ts
import { verifyArbitrary } from '@gotabit/wallet-core'
import { KeplrWallet } from '@gotabit/wallet-keplr'
const wallet = await KeplrWallet.init('test')

const data = JSON.stringify({ title: 'Hello Gotabit' })
const signature = await wallet.signArbitrary(account, data)
const ok = verifyArbitrary(account, data, signature)
```

### Query with extensions

Query base extensions

```ts
const client = await gotabit.stargateClient()
const queryClient = client.makeQueryClient()

const response = await queryClient.distribution.delegationRewards(
  delegatorAddress,
  validatorAddress,
)
```

Query with additional extensions. You can pass multiple extensions as params.

```ts
import { setupGovExtension } from '@cosmjs/stargate'

const client = await gotabit.stargateClient()
const queryClient = client.makeQueryClient(setupGovExtension)

const response = await queryClient.gov.vote(proposalId, voterAddress)
```

## Credits

Code built with the help of these related projects:

- [cosmos/cosmjs](https://github.com/cosmos/cosmjs) CosmJS is the Swiss Army knife to power JavaScript based client solutions ranging from Web apps/explorers over browser extensions to server-side clients like faucets/scrapers in the Cosmos ecosystem.

---
_Source: https://npm.io/package/@gotabit/client · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
