@sunriselayer/client
v0.3.0
Published
## Install
Downloads
215
Readme
Sunrise Client JS
Install
npm i @sunriselayer/client
Example
Query
import { SunriseClient } from "@sunriselayer/client";
async function main() {
// See
// https://docs.cosmos.network/main/learn/advanced/grpc_rest
// https://github.com/cosmos/chain-registry
const cometRpc = "http://localhost:26657";
const client = await SunriseClient.create(cometRpc);
const queryClient = client.getQueryClient();
if (!queryClient) {
return;
}
await queryClient.da.params({});
await queryClient.fee.params({});
await queryClient.liquidityincentive.params({});
await queryClient.liquiditypool.params({});
await queryClient.swap.params({});
await queryClient.tokenconverter.params({});
}
Tx
import { SigningStargateClient } from "@cosmjs/stargate";
import { createEncodeObject, sunriseTypesRegistry } from "@sunriselayer/client";
import { MsgSwapExactAmountInSchema } from "@sunriselayer/client/types/swap";
const address = "sunrise...";
const client = await SigningStargateClient.connectWithSigner(
"http://localhost:26657",
{} as any, // Change here
{
registry: sunriseTypesRegistry,
},
);
const msgSwapExactAmountIn = createEncodeObject(MsgSwapExactAmountInSchema, {
sender: address,
});
const txHash = await client.signAndBroadcastSync(address, [msgSwapExactAmountIn], "auto");