a477b007e1
* Squashed clients/validator content from old branch * fix up tests fix up linting * add bundle script * add build prod script to package json update tests * update readme + copy to dist output update global types update types and tests! * update package build * move types and tests into src * Squashed clients/validator content from old branch fix up tests fix up linting * add bundle script * add build prod script to package json update tests * update readme + copy to dist output update global types update types and tests! update package build * move types and tests into src * build to sub-dir * Fixing the few broken tests --------- Co-authored-by: Jon Häggblad <jon.haggblad@gmail.com> Co-authored-by: benedettadavico <benedetta.davico@gmail.com>
40 lines
893 B
Markdown
40 lines
893 B
Markdown
# Nym Validator Client (Typescript)
|
|
|
|
A TypeScript client for interacting with CosmWasm smart contracts in Nym validators.
|
|
|
|
Include the Nym Validator in your project:
|
|
|
|
```
|
|
yarn add @nymproject/nym-validator-client
|
|
```
|
|
|
|
Connect to validator and make queries
|
|
|
|
```
|
|
import Validator from '@nymproject/nym-validator-client'
|
|
|
|
const main = async () => {
|
|
|
|
const client = await Validator.connectForQuery(rpcAddress, validatorAddress, prefix, mixnetContractAddress, vestingContractAddress, denom)
|
|
|
|
client.getBalance(address)
|
|
|
|
}
|
|
|
|
```
|
|
|
|
Connect to validator for performing actions
|
|
|
|
```
|
|
import Validator from '@nymproject/nym-validator-client'
|
|
|
|
const main = async () => {
|
|
|
|
const client = await Validator.connect(mnemonic, rpcAddress, validatorAddress, prefix, mixnetContractAddress, vestingContractAddress, denom)
|
|
|
|
const res = await client.send(address, [{ amount: '10000000', denom: 'unym' }]);
|
|
|
|
}
|
|
|
|
```
|