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(nibijs): functions for humans + getTxByHash (exchange integration) #260

Merged
merged 16 commits into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from 14 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 package.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"lint": "eslint -c './.eslintrc.js' './packages/**/*.{ts,js}'",
"lint:ci": "yarn lint . --format junit",
"lint:md": "markdownlint --ignore node_modules --ignore .git",
"localnet": "sh scripts/localnet.sh",
"localnet": "bash scripts/localnet.sh",
"format": "yarn lint --fix",
"format:md": "yarn lint:md --fix",
"proto-gen": "yarn exec ./scripts/protocgen.sh",
Expand Down
44 changes: 22 additions & 22 deletions packages/nibijs/docs/classes/CustomChain.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ export const TEST_CHAIN = new CustomChain({

#### Parameters

| Name | Type |
| :------------- | :---------------------------------------------- |
| Name | Type |
| :------ | :------ |
| `chainIdParts` | [`ChainIdParts`](../interfaces/ChainIdParts.md) |

#### Defined in

[chain/chain.ts:56](https://github.com/NibiruChain/ts-sdk/blob/d2a4311/packages/nibijs/src/chain/chain.ts#L56)
[chain/chain.ts:56](https://github.com/NibiruChain/ts-sdk/blob/c08edb6/packages/nibijs/src/chain/chain.ts#L56)

## Properties

Expand All @@ -70,19 +70,19 @@ chainId: identifier for the chain

#### Defined in

[chain/chain.ts:47](https://github.com/NibiruChain/ts-sdk/blob/d2a4311/packages/nibijs/src/chain/chain.ts#L47)
[chain/chain.ts:47](https://github.com/NibiruChain/ts-sdk/blob/c08edb6/packages/nibijs/src/chain/chain.ts#L47)

---
___

### chainIdParts

• `Private` `Readonly` **chainIdParts**: [`ChainIdParts`](../interfaces/ChainIdParts.md)

#### Defined in

[chain/chain.ts:54](https://github.com/NibiruChain/ts-sdk/blob/d2a4311/packages/nibijs/src/chain/chain.ts#L54)
[chain/chain.ts:54](https://github.com/NibiruChain/ts-sdk/blob/c08edb6/packages/nibijs/src/chain/chain.ts#L54)

---
___

### chainName

Expand All @@ -96,9 +96,9 @@ chainName: the name of the chain to display to the user

#### Defined in

[chain/chain.ts:48](https://github.com/NibiruChain/ts-sdk/blob/d2a4311/packages/nibijs/src/chain/chain.ts#L48)
[chain/chain.ts:48](https://github.com/NibiruChain/ts-sdk/blob/c08edb6/packages/nibijs/src/chain/chain.ts#L48)

---
___

### endptGrpc

Expand All @@ -112,9 +112,9 @@ endptGrpc: endpoint for the gRPC gateway. Usually on port 9090.

#### Defined in

[chain/chain.ts:51](https://github.com/NibiruChain/ts-sdk/blob/d2a4311/packages/nibijs/src/chain/chain.ts#L51)
[chain/chain.ts:51](https://github.com/NibiruChain/ts-sdk/blob/c08edb6/packages/nibijs/src/chain/chain.ts#L51)

---
___

### endptRest

Expand All @@ -128,9 +128,9 @@ endptRest: endpoint for the REST server. Also, the LCD endpoint.

#### Defined in

[chain/chain.ts:50](https://github.com/NibiruChain/ts-sdk/blob/d2a4311/packages/nibijs/src/chain/chain.ts#L50)
[chain/chain.ts:50](https://github.com/NibiruChain/ts-sdk/blob/c08edb6/packages/nibijs/src/chain/chain.ts#L50)

---
___

### endptTm

Expand All @@ -144,13 +144,13 @@ endptTm: endpoint for the Tendermint RPC server. Usually on port 26657.

#### Defined in

[chain/chain.ts:49](https://github.com/NibiruChain/ts-sdk/blob/d2a4311/packages/nibijs/src/chain/chain.ts#L49)
[chain/chain.ts:49](https://github.com/NibiruChain/ts-sdk/blob/c08edb6/packages/nibijs/src/chain/chain.ts#L49)

---
___

### feeDenom

• `Readonly` **feeDenom**: `"unibi"`
• `Readonly` **feeDenom**: ``"unibi"``

feeDenom: the denomination of the fee to be paid for transactions.

Expand All @@ -160,7 +160,7 @@ feeDenom: the denomination of the fee to be paid for transactions.

#### Defined in

[chain/chain.ts:52](https://github.com/NibiruChain/ts-sdk/blob/d2a4311/packages/nibijs/src/chain/chain.ts#L52)
[chain/chain.ts:52](https://github.com/NibiruChain/ts-sdk/blob/c08edb6/packages/nibijs/src/chain/chain.ts#L52)

## Methods

Expand All @@ -174,18 +174,18 @@ feeDenom: the denomination of the fee to be paid for transactions.

#### Defined in

[chain/chain.ts:75](https://github.com/NibiruChain/ts-sdk/blob/d2a4311/packages/nibijs/src/chain/chain.ts#L75)
[chain/chain.ts:75](https://github.com/NibiruChain/ts-sdk/blob/c08edb6/packages/nibijs/src/chain/chain.ts#L75)

---
___

### fromChainId

▸ `Static` **fromChainId**(`chainId`): [`Chain`](../interfaces/Chain.md)

#### Parameters

| Name | Type |
| :-------- | :------- |
| Name | Type |
| :------ | :------ |
| `chainId` | `string` |

#### Returns
Expand All @@ -194,4 +194,4 @@ feeDenom: the denomination of the fee to be paid for transactions.

#### Defined in

[chain/chain.ts:65](https://github.com/NibiruChain/ts-sdk/blob/d2a4311/packages/nibijs/src/chain/chain.ts#L65)
[chain/chain.ts:65](https://github.com/NibiruChain/ts-sdk/blob/c08edb6/packages/nibijs/src/chain/chain.ts#L65)
6 changes: 3 additions & 3 deletions packages/nibijs/docs/classes/MsgFactory.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@

#### Defined in

[msg/index.ts:6](https://github.com/NibiruChain/ts-sdk/blob/d2a4311/packages/nibijs/src/msg/index.ts#L6)
[msg/index.ts:6](https://github.com/NibiruChain/ts-sdk/blob/c08edb6/packages/nibijs/src/msg/index.ts#L6)

---
___

### spot

• **spot**: typeof [`SpotMsgFactory`](SpotMsgFactory.md) = `SpotMsgFactory`

#### Defined in

[msg/index.ts:5](https://github.com/NibiruChain/ts-sdk/blob/d2a4311/packages/nibijs/src/msg/index.ts#L5)
[msg/index.ts:5](https://github.com/NibiruChain/ts-sdk/blob/c08edb6/packages/nibijs/src/msg/index.ts#L5)
109 changes: 87 additions & 22 deletions packages/nibijs/docs/classes/NibiruQueryClient.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ const querier = await NibiruQueryClient.connect(chain.endptTm)

### Methods

- [getTxByHash](NibiruQueryClient.md#gettxbyhash)
- [getTxByHashBytes](NibiruQueryClient.md#gettxbyhashbytes)
- [waitForHeight](NibiruQueryClient.md#waitforheight)
- [waitForNextBlock](NibiruQueryClient.md#waitfornextblock)
- [connect](NibiruQueryClient.md#connect)
Expand All @@ -44,19 +46,19 @@ const querier = await NibiruQueryClient.connect(chain.endptTm)

#### Parameters

| Name | Type |
| :----------- | :---------------------- |
| `tmClient` | `Tendermint37Client` |
| `options` | `StargateClientOptions` |
| `wasmClient` | `CosmWasmClient` |
| Name | Type |
| :------ | :------ |
| `tmClient` | `Tendermint37Client` |
| `options` | `StargateClientOptions` |
| `wasmClient` | `CosmWasmClient` |

#### Overrides

StargateClient.constructor

#### Defined in

[query/query.ts:63](https://github.com/NibiruChain/ts-sdk/blob/d2a4311/packages/nibijs/src/query/query.ts#L63)
[query/query.ts:66](https://github.com/NibiruChain/ts-sdk/blob/c08edb6/packages/nibijs/src/query/query.ts#L66)

## Properties

Expand All @@ -66,38 +68,101 @@ StargateClient.constructor

#### Defined in

[query/query.ts:50](https://github.com/NibiruChain/ts-sdk/blob/d2a4311/packages/nibijs/src/query/query.ts#L50)
[query/query.ts:53](https://github.com/NibiruChain/ts-sdk/blob/c08edb6/packages/nibijs/src/query/query.ts#L53)

---
___

### tm

• `Readonly` **tm**: `Tendermint37Client`

#### Defined in

[query/query.ts:52](https://github.com/NibiruChain/ts-sdk/blob/d2a4311/packages/nibijs/src/query/query.ts#L52)
[query/query.ts:55](https://github.com/NibiruChain/ts-sdk/blob/c08edb6/packages/nibijs/src/query/query.ts#L55)

---
___

### wasmClient

• `Readonly` **wasmClient**: `CosmWasmClient`

#### Defined in

[query/query.ts:51](https://github.com/NibiruChain/ts-sdk/blob/d2a4311/packages/nibijs/src/query/query.ts#L51)
[query/query.ts:54](https://github.com/NibiruChain/ts-sdk/blob/c08edb6/packages/nibijs/src/query/query.ts#L54)

## Methods

### getTxByHash

▸ **getTxByHash**(`txHashHex`): `Promise`<[`Result`](Result.md)<`TxResponse`\>\>

getTxByHash: Query a transaction (tx) using its hexadecial encoded tx hash.
A tx hash uniquely identifies a tx on the blockchain.

The hex-encoded tx hash is:
- An unambiguous representation of the SHA-256 cryptographic hash in the
consensus layer.
- Well-suited for human-facing applications, as it is easier to work with
than bytes.

#### Parameters

| Name | Type |
| :------ | :------ |
| `txHashHex` | `string` |

#### Returns

`Promise`<[`Result`](Result.md)<`TxResponse`\>\>

**`Example`**

```ts
const txHash = "7A919F2CC9A51B139444F7D8E84A46EEF307E839C6CA914C1A1C594FEF5C1562"
const txRespResult = await getTxByHash(txHash)
```

#### Defined in

[query/query.ts:122](https://github.com/NibiruChain/ts-sdk/blob/c08edb6/packages/nibijs/src/query/query.ts#L122)

___

### getTxByHashBytes

▸ **getTxByHashBytes**(`txHash`): `Promise`<[`Result`](Result.md)<`TxResponse`\>\>

getTxByHashBytes: Query a transaction (tx) using its SHA-256 tx hash (bytes).
A tx hash uniquely identifies a tx on the blockchain.

#### Parameters

| Name | Type |
| :------ | :------ |
| `txHash` | `Uint8Array` |

#### Returns

`Promise`<[`Result`](Result.md)<`TxResponse`\>\>

**`See`**

getTxByHash - Equivalent query using the hex-encoded tx hash string.

#### Defined in

[query/query.ts:136](https://github.com/NibiruChain/ts-sdk/blob/c08edb6/packages/nibijs/src/query/query.ts#L136)

___

### waitForHeight

▸ **waitForHeight**(`height`): `Promise`<`void`\>

#### Parameters

| Name | Type |
| :------- | :------- |
| Name | Type |
| :------ | :------ |
| `height` | `number` |

#### Returns
Expand All @@ -106,9 +171,9 @@ StargateClient.constructor

#### Defined in

[query/query.ts:89](https://github.com/NibiruChain/ts-sdk/blob/d2a4311/packages/nibijs/src/query/query.ts#L89)
[query/query.ts:92](https://github.com/NibiruChain/ts-sdk/blob/c08edb6/packages/nibijs/src/query/query.ts#L92)

---
___

### waitForNextBlock

Expand All @@ -120,20 +185,20 @@ StargateClient.constructor

#### Defined in

[query/query.ts:97](https://github.com/NibiruChain/ts-sdk/blob/d2a4311/packages/nibijs/src/query/query.ts#L97)
[query/query.ts:100](https://github.com/NibiruChain/ts-sdk/blob/c08edb6/packages/nibijs/src/query/query.ts#L100)

---
___

### connect

▸ `Static` **connect**(`endpoint`, `options?`): `Promise`<[`NibiruQueryClient`](NibiruQueryClient.md)\>

#### Parameters

| Name | Type |
| :--------- | :---------------------- |
| `endpoint` | `string` |
| `options` | `StargateClientOptions` |
| Name | Type |
| :------ | :------ |
| `endpoint` | `string` |
| `options` | `StargateClientOptions` |

#### Returns

Expand All @@ -145,4 +210,4 @@ StargateClient.connect

#### Defined in

[query/query.ts:54](https://github.com/NibiruChain/ts-sdk/blob/d2a4311/packages/nibijs/src/query/query.ts#L54)
[query/query.ts:57](https://github.com/NibiruChain/ts-sdk/blob/c08edb6/packages/nibijs/src/query/query.ts#L57)
Loading