From 37bc02f6fca5b8553fe7d08fbee5500e60ec0e57 Mon Sep 17 00:00:00 2001 From: Unique Divine <51418232+Unique-Divine@users.noreply.github.com> Date: Sat, 27 May 2023 11:26:25 -0500 Subject: [PATCH] test(nibijs): make runs more consistent + fix export of dist/msg (#154) * fix(nibij): exports for dist/msg + make test runs more consistent * build(nibijs): docs --- packages/nibijs/CHANGELOG.md | 4 +- packages/nibijs/docs/classes/CustomChain.md | 26 +-- .../nibijs/docs/classes/NibiruQueryClient.md | 14 +- .../docs/classes/NibiruSigningClient.md | 14 +- packages/nibijs/docs/enums/BECH32_PREFIX.md | 14 +- packages/nibijs/docs/enums/Signer.md | 6 +- packages/nibijs/docs/interfaces/Attribute.md | 6 +- packages/nibijs/docs/interfaces/Chain.md | 14 +- .../nibijs/docs/interfaces/ChainIdParts.md | 8 +- packages/nibijs/docs/interfaces/CoinMap.md | 2 +- packages/nibijs/docs/interfaces/Event.md | 6 +- packages/nibijs/docs/interfaces/TxLog.md | 4 +- packages/nibijs/docs/intro.md | 2 +- packages/nibijs/docs/modules.md | 50 +++--- packages/nibijs/package.json | 2 +- packages/nibijs/src/msg/encode-types.ts | 5 + packages/nibijs/src/msg/perp.ts | 2 +- packages/nibijs/src/test/helpers.ts | 6 + packages/nibijs/src/tx/signingClient.test.ts | 153 ++++++++++-------- 19 files changed, 181 insertions(+), 157 deletions(-) diff --git a/packages/nibijs/CHANGELOG.md b/packages/nibijs/CHANGELOG.md index 01e034f1..cb892a55 100644 --- a/packages/nibijs/CHANGELOG.md +++ b/packages/nibijs/CHANGELOG.md @@ -7,9 +7,11 @@ See [Conventional Commits](https://conventionalcommits.org) for commit guideline - . -## v0.19.11 +## v0.19.13 - feat(msg): implement msg factory for type parsing +- fix: exports for nibijs/dist/msg +- test: Make nibijs test runs more consistent counting account sequence mismatch as a non-failure - test: Fix all nibijs tests. - ci,test: Use a `nibid` localnet in CI tests. (2) Fix all nibijs tests. diff --git a/packages/nibijs/docs/classes/CustomChain.md b/packages/nibijs/docs/classes/CustomChain.md index 9fd2af78..d1e4dffe 100644 --- a/packages/nibijs/docs/classes/CustomChain.md +++ b/packages/nibijs/docs/classes/CustomChain.md @@ -1,4 +1,4 @@ -[NibiJS Documentation - v0.19.12](../intro.md) / [Exports](../modules.md) / CustomChain +[NibiJS Documentation - v0.19.13](../intro.md) / [Exports](../modules.md) / CustomChain # Class: CustomChain @@ -56,7 +56,7 @@ export const TEST_CHAIN = new CustomChain({ #### Defined in -[chain/chain.ts:67](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/chain/chain.ts#L67) +[chain/chain.ts:67](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/chain/chain.ts#L67) ## Properties @@ -72,7 +72,7 @@ chainId: identifier for the chain #### Defined in -[chain/chain.ts:58](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/chain/chain.ts#L58) +[chain/chain.ts:58](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/chain/chain.ts#L58) ___ @@ -82,7 +82,7 @@ ___ #### Defined in -[chain/chain.ts:65](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/chain/chain.ts#L65) +[chain/chain.ts:65](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/chain/chain.ts#L65) ___ @@ -98,7 +98,7 @@ chainName: the name of the chain to display to the user #### Defined in -[chain/chain.ts:59](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/chain/chain.ts#L59) +[chain/chain.ts:59](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/chain/chain.ts#L59) ___ @@ -114,7 +114,7 @@ endptGrpc: endpoint for the gRPC gateway. Usually on port 9090. #### Defined in -[chain/chain.ts:62](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/chain/chain.ts#L62) +[chain/chain.ts:62](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/chain/chain.ts#L62) ___ @@ -130,7 +130,7 @@ endptRest: endpoint for the REST server. Also, the LCD endpoint. #### Defined in -[chain/chain.ts:61](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/chain/chain.ts#L61) +[chain/chain.ts:61](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/chain/chain.ts#L61) ___ @@ -146,7 +146,7 @@ endptTm: endpoint for the Tendermint RPC server. Usually on port 26657. #### Defined in -[chain/chain.ts:60](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/chain/chain.ts#L60) +[chain/chain.ts:60](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/chain/chain.ts#L60) ___ @@ -162,7 +162,7 @@ feeDenom: the denomination of the fee to be paid for transactions. #### Defined in -[chain/chain.ts:63](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/chain/chain.ts#L63) +[chain/chain.ts:63](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/chain/chain.ts#L63) ## Methods @@ -176,7 +176,7 @@ feeDenom: the denomination of the fee to be paid for transactions. #### Defined in -[chain/chain.ts:77](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/chain/chain.ts#L77) +[chain/chain.ts:77](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/chain/chain.ts#L77) ___ @@ -190,7 +190,7 @@ ___ #### Defined in -[chain/chain.ts:92](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/chain/chain.ts#L92) +[chain/chain.ts:92](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/chain/chain.ts#L92) ___ @@ -204,7 +204,7 @@ ___ #### Defined in -[chain/chain.ts:87](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/chain/chain.ts#L87) +[chain/chain.ts:87](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/chain/chain.ts#L87) ___ @@ -218,4 +218,4 @@ ___ #### Defined in -[chain/chain.ts:82](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/chain/chain.ts#L82) +[chain/chain.ts:82](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/chain/chain.ts#L82) diff --git a/packages/nibijs/docs/classes/NibiruQueryClient.md b/packages/nibijs/docs/classes/NibiruQueryClient.md index e94f7d74..82e65bad 100644 --- a/packages/nibijs/docs/classes/NibiruQueryClient.md +++ b/packages/nibijs/docs/classes/NibiruQueryClient.md @@ -1,4 +1,4 @@ -[NibiJS Documentation - v0.19.12](../intro.md) / [Exports](../modules.md) / NibiruQueryClient +[NibiJS Documentation - v0.19.13](../intro.md) / [Exports](../modules.md) / NibiruQueryClient # Class: NibiruQueryClient @@ -45,7 +45,7 @@ StargateClient.constructor #### Defined in -[query/query.ts:56](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/query/query.ts#L56) +[query/query.ts:56](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/query/query.ts#L56) ## Properties @@ -55,7 +55,7 @@ StargateClient.constructor #### Defined in -[query/query.ts:44](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/query/query.ts#L44) +[query/query.ts:44](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/query/query.ts#L44) ___ @@ -65,7 +65,7 @@ ___ #### Defined in -[query/query.ts:45](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/query/query.ts#L45) +[query/query.ts:45](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/query/query.ts#L45) ## Methods @@ -85,7 +85,7 @@ ___ #### Defined in -[query/query.ts:80](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/query/query.ts#L80) +[query/query.ts:80](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/query/query.ts#L80) ___ @@ -99,7 +99,7 @@ ___ #### Defined in -[query/query.ts:88](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/query/query.ts#L88) +[query/query.ts:88](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/query/query.ts#L88) ___ @@ -124,4 +124,4 @@ StargateClient.connect #### Defined in -[query/query.ts:47](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/query/query.ts#L47) +[query/query.ts:47](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/query/query.ts#L47) diff --git a/packages/nibijs/docs/classes/NibiruSigningClient.md b/packages/nibijs/docs/classes/NibiruSigningClient.md index 6f5265b5..95cd3d1e 100644 --- a/packages/nibijs/docs/classes/NibiruSigningClient.md +++ b/packages/nibijs/docs/classes/NibiruSigningClient.md @@ -1,4 +1,4 @@ -[NibiJS Documentation - v0.19.12](../intro.md) / [Exports](../modules.md) / NibiruSigningClient +[NibiJS Documentation - v0.19.13](../intro.md) / [Exports](../modules.md) / NibiruSigningClient # Class: NibiruSigningClient @@ -46,7 +46,7 @@ SigningStargateClient.constructor #### Defined in -[tx/signingClient.ts:64](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/tx/signingClient.ts#L64) +[tx/signingClient.ts:64](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/tx/signingClient.ts#L64) ## Properties @@ -56,7 +56,7 @@ SigningStargateClient.constructor #### Defined in -[tx/signingClient.ts:37](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/tx/signingClient.ts#L37) +[tx/signingClient.ts:37](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/tx/signingClient.ts#L37) ___ @@ -66,7 +66,7 @@ ___ #### Defined in -[tx/signingClient.ts:38](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/tx/signingClient.ts#L38) +[tx/signingClient.ts:38](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/tx/signingClient.ts#L38) ## Methods @@ -86,7 +86,7 @@ ___ #### Defined in -[tx/signingClient.ts:89](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/tx/signingClient.ts#L89) +[tx/signingClient.ts:89](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/tx/signingClient.ts#L89) ___ @@ -100,7 +100,7 @@ ___ #### Defined in -[tx/signingClient.ts:97](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/tx/signingClient.ts#L97) +[tx/signingClient.ts:97](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/tx/signingClient.ts#L97) ___ @@ -127,4 +127,4 @@ SigningStargateClient.connectWithSigner #### Defined in -[tx/signingClient.ts:40](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/tx/signingClient.ts#L40) +[tx/signingClient.ts:40](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/tx/signingClient.ts#L40) diff --git a/packages/nibijs/docs/enums/BECH32_PREFIX.md b/packages/nibijs/docs/enums/BECH32_PREFIX.md index a3a2ccd0..d121994c 100644 --- a/packages/nibijs/docs/enums/BECH32_PREFIX.md +++ b/packages/nibijs/docs/enums/BECH32_PREFIX.md @@ -1,4 +1,4 @@ -[NibiJS Documentation - v0.19.12](../intro.md) / [Exports](../modules.md) / BECH32\_PREFIX +[NibiJS Documentation - v0.19.13](../intro.md) / [Exports](../modules.md) / BECH32\_PREFIX # Enumeration: BECH32\_PREFIX @@ -23,7 +23,7 @@ ADDR defines the Bech32 prefix of an account address #### Defined in -[tx/signer.ts:12](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/tx/signer.ts#L12) +[tx/signer.ts:12](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/tx/signer.ts#L12) ___ @@ -35,7 +35,7 @@ ADDR_VAL defines the Bech32 prefix of an validator's operator address #### Defined in -[tx/signer.ts:14](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/tx/signer.ts#L14) +[tx/signer.ts:14](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/tx/signer.ts#L14) ___ @@ -47,7 +47,7 @@ ADDR_VALCONS defines the Bech32 prefix of a consensus node address #### Defined in -[tx/signer.ts:16](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/tx/signer.ts#L16) +[tx/signer.ts:16](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/tx/signer.ts#L16) ___ @@ -59,7 +59,7 @@ PUB defines the Bech32 prefix of an account's public key #### Defined in -[tx/signer.ts:18](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/tx/signer.ts#L18) +[tx/signer.ts:18](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/tx/signer.ts#L18) ___ @@ -71,7 +71,7 @@ PUB_VAL defines the Bech32 prefix of an validator's operator public key #### Defined in -[tx/signer.ts:20](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/tx/signer.ts#L20) +[tx/signer.ts:20](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/tx/signer.ts#L20) ___ @@ -83,4 +83,4 @@ PUB_VALCONS defines the Bech32 prefix of a consensus node public key #### Defined in -[tx/signer.ts:22](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/tx/signer.ts#L22) +[tx/signer.ts:22](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/tx/signer.ts#L22) diff --git a/packages/nibijs/docs/enums/Signer.md b/packages/nibijs/docs/enums/Signer.md index d6e0f5ec..29975dc4 100644 --- a/packages/nibijs/docs/enums/Signer.md +++ b/packages/nibijs/docs/enums/Signer.md @@ -1,4 +1,4 @@ -[NibiJS Documentation - v0.19.12](../intro.md) / [Exports](../modules.md) / Signer +[NibiJS Documentation - v0.19.13](../intro.md) / [Exports](../modules.md) / Signer # Enumeration: Signer @@ -17,7 +17,7 @@ #### Defined in -[tx/signer.ts:71](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/tx/signer.ts#L71) +[tx/signer.ts:71](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/tx/signer.ts#L71) ___ @@ -27,4 +27,4 @@ ___ #### Defined in -[tx/signer.ts:70](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/tx/signer.ts#L70) +[tx/signer.ts:70](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/tx/signer.ts#L70) diff --git a/packages/nibijs/docs/interfaces/Attribute.md b/packages/nibijs/docs/interfaces/Attribute.md index 32dc88fc..5e3767d1 100644 --- a/packages/nibijs/docs/interfaces/Attribute.md +++ b/packages/nibijs/docs/interfaces/Attribute.md @@ -1,4 +1,4 @@ -[NibiJS Documentation - v0.19.12](../intro.md) / [Exports](../modules.md) / Attribute +[NibiJS Documentation - v0.19.13](../intro.md) / [Exports](../modules.md) / Attribute # Interface: Attribute @@ -17,7 +17,7 @@ #### Defined in -[chain/types.ts:53](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/chain/types.ts#L53) +[chain/types.ts:53](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/chain/types.ts#L53) ___ @@ -27,4 +27,4 @@ ___ #### Defined in -[chain/types.ts:54](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/chain/types.ts#L54) +[chain/types.ts:54](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/chain/types.ts#L54) diff --git a/packages/nibijs/docs/interfaces/Chain.md b/packages/nibijs/docs/interfaces/Chain.md index e644ed76..170d3610 100644 --- a/packages/nibijs/docs/interfaces/Chain.md +++ b/packages/nibijs/docs/interfaces/Chain.md @@ -1,4 +1,4 @@ -[NibiJS Documentation - v0.19.12](../intro.md) / [Exports](../modules.md) / Chain +[NibiJS Documentation - v0.19.13](../intro.md) / [Exports](../modules.md) / Chain # Interface: Chain @@ -40,7 +40,7 @@ chainId: identifier for the chain #### Defined in -[chain/chain.ts:22](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/chain/chain.ts#L22) +[chain/chain.ts:22](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/chain/chain.ts#L22) ___ @@ -52,7 +52,7 @@ chainName: the name of the chain to display to the user #### Defined in -[chain/chain.ts:24](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/chain/chain.ts#L24) +[chain/chain.ts:24](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/chain/chain.ts#L24) ___ @@ -64,7 +64,7 @@ endptGrpc: endpoint for the gRPC gateway. Usually on port 9090. #### Defined in -[chain/chain.ts:20](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/chain/chain.ts#L20) +[chain/chain.ts:20](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/chain/chain.ts#L20) ___ @@ -76,7 +76,7 @@ endptRest: endpoint for the REST server. Also, the LCD endpoint. #### Defined in -[chain/chain.ts:18](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/chain/chain.ts#L18) +[chain/chain.ts:18](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/chain/chain.ts#L18) ___ @@ -88,7 +88,7 @@ endptTm: endpoint for the Tendermint RPC server. Usually on port 26657. #### Defined in -[chain/chain.ts:16](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/chain/chain.ts#L16) +[chain/chain.ts:16](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/chain/chain.ts#L16) ___ @@ -100,4 +100,4 @@ feeDenom: the denomination of the fee to be paid for transactions. #### Defined in -[chain/chain.ts:26](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/chain/chain.ts#L26) +[chain/chain.ts:26](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/chain/chain.ts#L26) diff --git a/packages/nibijs/docs/interfaces/ChainIdParts.md b/packages/nibijs/docs/interfaces/ChainIdParts.md index eef1279d..023caf16 100644 --- a/packages/nibijs/docs/interfaces/ChainIdParts.md +++ b/packages/nibijs/docs/interfaces/ChainIdParts.md @@ -1,4 +1,4 @@ -[NibiJS Documentation - v0.19.12](../intro.md) / [Exports](../modules.md) / ChainIdParts +[NibiJS Documentation - v0.19.13](../intro.md) / [Exports](../modules.md) / ChainIdParts # Interface: ChainIdParts @@ -18,7 +18,7 @@ #### Defined in -[chain/chain.ts:42](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/chain/chain.ts#L42) +[chain/chain.ts:42](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/chain/chain.ts#L42) ___ @@ -28,7 +28,7 @@ ___ #### Defined in -[chain/chain.ts:40](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/chain/chain.ts#L40) +[chain/chain.ts:40](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/chain/chain.ts#L40) ___ @@ -38,4 +38,4 @@ ___ #### Defined in -[chain/chain.ts:41](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/chain/chain.ts#L41) +[chain/chain.ts:41](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/chain/chain.ts#L41) diff --git a/packages/nibijs/docs/interfaces/CoinMap.md b/packages/nibijs/docs/interfaces/CoinMap.md index c36211ee..e29f29d5 100644 --- a/packages/nibijs/docs/interfaces/CoinMap.md +++ b/packages/nibijs/docs/interfaces/CoinMap.md @@ -1,4 +1,4 @@ -[NibiJS Documentation - v0.19.12](../intro.md) / [Exports](../modules.md) / CoinMap +[NibiJS Documentation - v0.19.13](../intro.md) / [Exports](../modules.md) / CoinMap # Interface: CoinMap diff --git a/packages/nibijs/docs/interfaces/Event.md b/packages/nibijs/docs/interfaces/Event.md index e5f2f002..d9f3fb47 100644 --- a/packages/nibijs/docs/interfaces/Event.md +++ b/packages/nibijs/docs/interfaces/Event.md @@ -1,4 +1,4 @@ -[NibiJS Documentation - v0.19.12](../intro.md) / [Exports](../modules.md) / Event +[NibiJS Documentation - v0.19.13](../intro.md) / [Exports](../modules.md) / Event # Interface: Event @@ -17,7 +17,7 @@ #### Defined in -[chain/types.ts:49](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/chain/types.ts#L49) +[chain/types.ts:49](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/chain/types.ts#L49) ___ @@ -27,4 +27,4 @@ ___ #### Defined in -[chain/types.ts:48](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/chain/types.ts#L48) +[chain/types.ts:48](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/chain/types.ts#L48) diff --git a/packages/nibijs/docs/interfaces/TxLog.md b/packages/nibijs/docs/interfaces/TxLog.md index 8de25710..c63d8ba4 100644 --- a/packages/nibijs/docs/interfaces/TxLog.md +++ b/packages/nibijs/docs/interfaces/TxLog.md @@ -1,4 +1,4 @@ -[NibiJS Documentation - v0.19.12](../intro.md) / [Exports](../modules.md) / TxLog +[NibiJS Documentation - v0.19.13](../intro.md) / [Exports](../modules.md) / TxLog # Interface: TxLog @@ -16,4 +16,4 @@ #### Defined in -[chain/types.ts:58](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/chain/types.ts#L58) +[chain/types.ts:58](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/chain/types.ts#L58) diff --git a/packages/nibijs/docs/intro.md b/packages/nibijs/docs/intro.md index 7461b2c6..3a498403 100644 --- a/packages/nibijs/docs/intro.md +++ b/packages/nibijs/docs/intro.md @@ -1,4 +1,4 @@ -NibiJS Documentation - v0.19.12 / [Exports](modules.md) +NibiJS Documentation - v0.19.13 / [Exports](modules.md)
diff --git a/packages/nibijs/docs/modules.md b/packages/nibijs/docs/modules.md index eff32253..694b5258 100644 --- a/packages/nibijs/docs/modules.md +++ b/packages/nibijs/docs/modules.md @@ -1,6 +1,6 @@ -[NibiJS Documentation - v0.19.12](intro.md) / Exports +[NibiJS Documentation - v0.19.13](intro.md) / Exports -# NibiJS Documentation - v0.19.12 +# NibiJS Documentation - v0.19.13 ## Table of contents @@ -64,7 +64,7 @@ #### Defined in -[query/query.ts:29](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/query/query.ts#L29) +[query/query.ts:29](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/query/query.ts#L29) ## Variables @@ -74,7 +74,7 @@ #### Defined in -[chain/parse.ts:2](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/chain/parse.ts#L2) +[chain/parse.ts:2](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/chain/parse.ts#L2) ___ @@ -84,7 +84,7 @@ ___ #### Defined in -[chain/chain.ts:98](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/chain/chain.ts#L98) +[chain/chain.ts:98](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/chain/chain.ts#L98) ___ @@ -94,7 +94,7 @@ ___ #### Defined in -[tx/signingClient.ts:30](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/tx/signingClient.ts#L30) +[tx/signingClient.ts:30](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/tx/signingClient.ts#L30) ## Functions @@ -114,7 +114,7 @@ ___ #### Defined in -[chain/chain.ts:115](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/chain/chain.ts#L115) +[chain/chain.ts:115](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/chain/chain.ts#L115) ___ @@ -134,7 +134,7 @@ ___ #### Defined in -[chain/chain.ts:107](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/chain/chain.ts#L107) +[chain/chain.ts:107](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/chain/chain.ts#L107) ___ @@ -155,7 +155,7 @@ ___ #### Defined in -[chain/types.ts:27](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/chain/types.ts#L27) +[chain/types.ts:27](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/chain/types.ts#L27) ___ @@ -175,7 +175,7 @@ ___ #### Defined in -[chain/parse.ts:97](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/chain/parse.ts#L97) +[chain/parse.ts:97](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/chain/parse.ts#L97) ___ @@ -195,7 +195,7 @@ ___ #### Defined in -[chain/parse.ts:156](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/chain/parse.ts#L156) +[chain/parse.ts:156](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/chain/parse.ts#L156) ___ @@ -215,7 +215,7 @@ ___ #### Defined in -[chain/parse.ts:150](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/chain/parse.ts#L150) +[chain/parse.ts:150](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/chain/parse.ts#L150) ___ @@ -235,7 +235,7 @@ ___ #### Defined in -[wallet/keplr.ts:9](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/wallet/keplr.ts#L9) +[wallet/keplr.ts:9](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/wallet/keplr.ts#L9) ___ @@ -249,7 +249,7 @@ ___ #### Defined in -[tx/signer.ts:28](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/tx/signer.ts#L28) +[tx/signer.ts:28](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/tx/signer.ts#L28) ___ @@ -275,7 +275,7 @@ ___ #### Defined in -[chain/types.ts:13](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/chain/types.ts#L13) +[chain/types.ts:13](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/chain/types.ts#L13) ___ @@ -298,7 +298,7 @@ obj is Chain #### Defined in -[chain/chain.ts:33](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/chain/chain.ts#L33) +[chain/chain.ts:33](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/chain/chain.ts#L33) ___ @@ -318,7 +318,7 @@ ___ #### Defined in -[chain/chain.ts:134](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/chain/chain.ts#L134) +[chain/chain.ts:134](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/chain/chain.ts#L134) ___ @@ -338,7 +338,7 @@ ___ #### Defined in -[chain/types.ts:39](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/chain/types.ts#L39) +[chain/types.ts:39](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/chain/types.ts#L39) ___ @@ -365,7 +365,7 @@ A wallet for protobuf based signing using SIGN_MODE_DIRECT. #### Defined in -[tx/signer.ts:62](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/tx/signer.ts#L62) +[tx/signer.ts:62](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/tx/signer.ts#L62) ___ @@ -386,7 +386,7 @@ ___ #### Defined in -[tx/signer.ts:47](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/tx/signer.ts#L47) +[tx/signer.ts:47](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/tx/signer.ts#L47) ___ @@ -413,7 +413,7 @@ A wallet for protobuf based signing using SIGN_MODE_DIRECT #### Defined in -[tx/signer.ts:40](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/tx/signer.ts#L40) +[tx/signer.ts:40](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/tx/signer.ts#L40) ___ @@ -433,7 +433,7 @@ ___ #### Defined in -[chain/chain.ts:123](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/chain/chain.ts#L123) +[chain/chain.ts:123](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/chain/chain.ts#L123) ___ @@ -462,7 +462,7 @@ ref: Reimplementation of cosmos-sdk/types/decimal.go #### Defined in -[chain/parse.ts:23](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/chain/parse.ts#L23) +[chain/parse.ts:23](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/chain/parse.ts#L23) ___ @@ -482,7 +482,7 @@ ___ #### Defined in -[chain/parse.ts:146](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/chain/parse.ts#L146) +[chain/parse.ts:146](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/chain/parse.ts#L146) ___ @@ -511,4 +511,4 @@ Sends 10 NIBI and 100 NUSD to the given address from the testnet faucet. #### Defined in -[chain/useFaucet.ts:7](https://github.com/NibiruChain/ts-sdk/blob/c64b2f8/packages/nibijs/src/chain/useFaucet.ts#L7) +[chain/useFaucet.ts:7](https://github.com/NibiruChain/ts-sdk/blob/6bec800/packages/nibijs/src/chain/useFaucet.ts#L7) diff --git a/packages/nibijs/package.json b/packages/nibijs/package.json index 230bf60e..0eaed562 100644 --- a/packages/nibijs/package.json +++ b/packages/nibijs/package.json @@ -1,7 +1,7 @@ { "name": "@nibiruchain/nibijs", "description": "The TypeScript SDK for the Nibiru blockchain.", - "version": "0.19.12", + "version": "0.19.13", "license": "MIT", "main": "dist/index.js", "types": "dist/index.d.ts", diff --git a/packages/nibijs/src/msg/encode-types.ts b/packages/nibijs/src/msg/encode-types.ts index 0afaafa9..13f471f3 100644 --- a/packages/nibijs/src/msg/encode-types.ts +++ b/packages/nibijs/src/msg/encode-types.ts @@ -4,4 +4,9 @@ export interface MsgTypeUrls { [msg: string]: string } +/** TxMessage: a message contained within a transaction. + * + * @field typeUrl: registered identifier for the proto message + * @field value: proto-able message body + */ export interface TxMessage extends EncodeObject {} diff --git a/packages/nibijs/src/msg/perp.ts b/packages/nibijs/src/msg/perp.ts index cb345f55..3c85d51f 100644 --- a/packages/nibijs/src/msg/perp.ts +++ b/packages/nibijs/src/msg/perp.ts @@ -8,7 +8,7 @@ import { MsgRemoveMargin, protobufPackage, } from "@nibiruchain/protojs/dist/perp/v1/tx" -import { Side } from "@nibiruchain/protojs/src/perp/v1/state" +import { Side } from "@nibiruchain/protojs/dist/perp/v1/state" import { toSdkDec, toSdkInt } from "../chain" import { TxMessage } from "./encode-types" diff --git a/packages/nibijs/src/test/helpers.ts b/packages/nibijs/src/test/helpers.ts index ea51cc0a..00e3a6c8 100644 --- a/packages/nibijs/src/test/helpers.ts +++ b/packages/nibijs/src/test/helpers.ts @@ -22,6 +22,12 @@ export const TEST_MNEMONIC = export const TEST_ADDRESS = process.env.VALIDATOR_ADDRESS ?? "nibi1zaavvzxez0elundtn32qnk9lkm8kmcsz44g7xl" +export const ERR = { + collections: "collections: not found", + sequence: "account sequence mismatch", + noPrices: "no valid prices available", +} + export function validateBlockFromJsonRpc(blockJson: any) { const blockSchema = { header: ["version", "chain_id", "height", "last_block_id"].concat( diff --git a/packages/nibijs/src/tx/signingClient.test.ts b/packages/nibijs/src/tx/signingClient.test.ts index 31123402..b55c4ea6 100644 --- a/packages/nibijs/src/tx/signingClient.test.ts +++ b/packages/nibijs/src/tx/signingClient.test.ts @@ -5,15 +5,16 @@ import { DirectSecp256k1HdWallet, parseCoins, } from "@cosmjs/proto-signing" -import { assertIsDeliverTxSuccess } from "@cosmjs/stargate" +import { assertIsDeliverTxSuccess, DeliverTxResponse } from "@cosmjs/stargate" import { MsgAddMargin, MsgClosePosition, MsgOpenPosition, MsgRemoveMargin, } from "@nibiruchain/protojs/dist/perp/v1/tx" -import { Side } from "@nibiruchain/protojs/src/perp/v1/state" +import { Side } from "@nibiruchain/protojs/dist/perp/v1/state" import { TxLog } from "../chain/types" +import { Msg, TxMessage } from "../msg" import { PERP_MSG_TYPE_URLS } from "../msg/perp" import { NibiruQueryClient } from "../query/query" import { @@ -23,6 +24,7 @@ import { TEST_CHAIN, TEST_ADDRESS, TEST_MNEMONIC, + ERR, } from "../test/helpers" import { newRandomWallet, newSignerFromMnemonic } from "./signer" import { NibiruSigningClient } from "./signingClient" @@ -74,70 +76,82 @@ describe("nibid tx perp", () => { gas: "400000", } - const result = await signingClient.signAndBroadcast( - sender, - [ - { - typeUrl: PERP_MSG_TYPE_URLS.MsgOpenPosition, - value: MsgOpenPosition.fromPartial({ - pair, - baseAssetAmountLimit: "0", - leverage: "10", - quoteAssetAmount: "1000", - sender, - side: Side.BUY, - }), - }, - { - typeUrl: PERP_MSG_TYPE_URLS.MsgAddMargin, - value: MsgAddMargin.fromPartial({ - margin: coin(20, "unusd"), - pair, - sender, - }), - }, - { - typeUrl: PERP_MSG_TYPE_URLS.MsgRemoveMargin, - value: MsgRemoveMargin.fromPartial({ - margin: coin(5, "unusd"), - pair, - sender, - }), - }, - ], - fee, - ) - - const assertHappyPath = () => { + const msgs: TxMessage[] = [ + { + typeUrl: PERP_MSG_TYPE_URLS.MsgOpenPosition, + value: MsgOpenPosition.fromPartial({ + pair, + baseAssetAmountLimit: "0", + leverage: "10", + quoteAssetAmount: "1000", + sender, + side: Side.BUY, + }), + }, + { + typeUrl: PERP_MSG_TYPE_URLS.MsgAddMargin, + value: MsgAddMargin.fromPartial({ + margin: coin(20, "unusd"), + pair, + sender, + }), + }, + { + typeUrl: PERP_MSG_TYPE_URLS.MsgRemoveMargin, + value: MsgRemoveMargin.fromPartial({ + margin: coin(5, "unusd"), + pair, + sender, + }), + }, + Msg.perp.openPosition({ + sender, + pair, + goLong: false, + quoteAssetAmount: 200, + leverage: 4, + }), + ] + + const assertHappyPath = (result: DeliverTxResponse) => { const txLogs: TxLog[] = JSON.parse(result.rawLog!) - expect(txLogs).toHaveLength(3) + expect(txLogs).toHaveLength(4) // perp tx open-position events - assertHasMsgType(PERP_MSG_TYPE_URLS.MsgOpenPosition, txLogs[0].events) - assertHasEventType("nibiru.perp.v1.PositionChangedEvent", txLogs[0].events) - assertHasEventType("nibiru.vpool.v1.SwapOnVpoolEvent", txLogs[0].events) - assertHasEventType("nibiru.vpool.v1.MarkPriceChangedEvent", txLogs[0].events) - assertHasEventType("transfer", txLogs[0].events) + let idx = 0 + assertHasMsgType(PERP_MSG_TYPE_URLS.MsgOpenPosition, txLogs[idx].events) + assertHasEventType("nibiru.perp.v1.PositionChangedEvent", txLogs[idx].events) + assertHasEventType("nibiru.vpool.v1.SwapOnVpoolEvent", txLogs[idx].events) + assertHasEventType("nibiru.vpool.v1.MarkPriceChangedEvent", txLogs[idx].events) + assertHasEventType("transfer", txLogs[idx].events) // perp tx add-margin events - assertHasMsgType(PERP_MSG_TYPE_URLS.MsgAddMargin, txLogs[1].events) - assertHasEventType("nibiru.perp.v1.PositionChangedEvent", txLogs[1].events) - assertHasEventType("transfer", txLogs[1].events) + idx = 1 + assertHasMsgType(PERP_MSG_TYPE_URLS.MsgAddMargin, txLogs[idx].events) + assertHasEventType("nibiru.perp.v1.PositionChangedEvent", txLogs[idx].events) + assertHasEventType("transfer", txLogs[idx].events) // perp tx remove-margin events - assertHasMsgType(PERP_MSG_TYPE_URLS.MsgRemoveMargin, txLogs[2].events) - assertHasEventType("nibiru.perp.v1.PositionChangedEvent", txLogs[2].events) - assertHasEventType("transfer", txLogs[2].events) + idx = 2 + assertHasMsgType(PERP_MSG_TYPE_URLS.MsgRemoveMargin, txLogs[idx].events) + assertHasEventType("nibiru.perp.v1.PositionChangedEvent", txLogs[idx].events) + assertHasEventType("transfer", txLogs[idx].events) + + // perp tx open-position events + idx = 3 + assertHasMsgType(PERP_MSG_TYPE_URLS.MsgOpenPosition, txLogs[idx].events) + assertHasEventType("nibiru.perp.v1.PositionChangedEvent", txLogs[idx].events) + assertHasEventType("nibiru.vpool.v1.SwapOnVpoolEvent", txLogs[idx].events) + assertHasEventType("nibiru.vpool.v1.MarkPriceChangedEvent", txLogs[idx].events) + assertHasEventType("transfer", txLogs[idx].events) } try { + const result = await signingClient.signAndBroadcast(sender, msgs, fee) assertIsDeliverTxSuccess(result) - assertHappyPath() + assertHappyPath(result) } catch (error) { - const okErrors: string[] = [ - "no valid prices available", - "account sequence mismatch", - ] + const okErrors: string[] = [ERR.noPrices, ERR.sequence] assertExpectedError(error, okErrors) } }, 40_000 /* default timeout is not sufficient. */) @@ -173,21 +187,17 @@ describe("nibid tx perp", () => { gas: "500000", } - const result = await signingClient.signAndBroadcast( - sender, - [ - { - typeUrl: PERP_MSG_TYPE_URLS.MsgClosePosition, - value: MsgClosePosition.fromPartial({ - pair, - sender, - }), - }, - ], - fee, - ) - - const assertHappyPath = () => { + const msgs: TxMessage[] = [ + { + typeUrl: PERP_MSG_TYPE_URLS.MsgClosePosition, + value: MsgClosePosition.fromPartial({ + pair, + sender, + }), + }, + ] + + const assertHappyPath = (result: DeliverTxResponse) => { const txLogs: TxLog[] = JSON.parse(result.rawLog!) expect(txLogs).toHaveLength(1) @@ -200,10 +210,11 @@ describe("nibid tx perp", () => { } try { + const result = await signingClient.signAndBroadcast(sender, msgs, fee) assertIsDeliverTxSuccess(result) - assertHappyPath() + assertHappyPath(result) } catch (error) { - const okErrors: string[] = ["collections: not found", "account sequence mismatch"] + const okErrors: string[] = [ERR.collections, ERR.sequence] assertExpectedError(error, okErrors) } })