Coder Social home page Coder Social logo

aura-nw / aurajs-types Goto Github PK

View Code? Open in Web Editor NEW

This project forked from confio/cosmjs-types

0.0 1.0 0.0 6.33 MB

JS and TS types relating to Protocol Buffers used by Cosmos-SDK and other related projects: Aura + Wasm + IBC + Cosmos SDK

License: Apache License 2.0

Shell 0.02% JavaScript 0.15% TypeScript 99.83%

aurajs-types's Introduction

aurajs-types

Typescript libraries for the Aura ecosystem. This repository was generated by Telescope, is a TypeScript Transpiler for SmartContract/Aura/Cosmos/IBC Protobufs. This tool is used to generate libraries for Cosmos blockchains. Simply, you can import aurajs to interact with Aura node.

Provide all typescript types which be converted from protobuf in these modules, all rpc/lcd client for interacting

Developers could add more modules for aurajs by adding more submodules then codegen. If you want new tx interact, you also must register its types to client's registry

Query

const tendermintClient = await Tendermint34Client.connect(rpcEndpoint);
# The generic Stargate query client knows how to use the Tendermint client to submit unverified ABCI queries
const queryClient = new QueryClient(tendermintClient);
# This helper function wraps the generic Stargate query client for use by the specific generated query client
const rpcClient = createProtobufRpcClient(queryClient);
# Here we instantiate a specific query client which will have the custom methods defined in the .proto file
const queryService = new QueryClientImpl(rpcClient);
# Now you can use this service to submit queries
const queryResult = await queryService.Balance({
    address: 'aura1ucp33srru7g45ku6w207kc4hy6xd6psvq5le7h',
    denom: 'ueaura'
});

Tx

const client = await getClient(mnemonic, rpcEndpoint)
const myAddress = "aura1yges2jkc7gnpgejzkq8jag3m87vqtmnpm979ll";
const message = {
    typeUrl: "/cosmos.bank.v1beta1.MsgSend",
        value: MsgSend.fromPartial({
        fromAddress: 'aura1yges2jkc7gnpgejzkq8jag3m87vqtmnpm979ll',
        toAddress: 'aura1yff0ajuunnvejwkjktp38p8fhya9d6e72uh8rm',
        amount: [{
            denom: 'ueaura',
            amount: "200"
        }]
    }),
};
const fee = {
    amount: [
        {
            denom: "ueaura", // Use the appropriate fee denom for your chain
            amount: "200",
        },
    ],
    gas: "100000",
};
const response = await client.signAndBroadcast(myAddress, [message], fee);

aurajs-types's People

Contributors

boz avatar phamphong9981 avatar pyramation avatar webmaster128 avatar willclarktech avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.