@blitchain/blitjs
TypeScript icon, indicating that this package has built-in type declarations

2.0.1 • Public • Published

BlitJS

BlitJS is a library designed to facilitate interactions with Blit using JavaScript. This a guide on how to set up and use the BlitJS library in your project.

Quickstart

Include BlitJS in your project by adding the following script tag in your HTML file:

<script type="module">
  import {
    default as blitjs,
    experimentalHelpers,
  } from "https://cdn.jsdelivr.net/npm/@blitchain/blitjs/+esm";
  let {
    makeKeplrClient,
    runFunction,
    queryFunction
  } = experimentalHelpers;

  let rpcEndpoint = "http://rpc.testnet.blitchain.net";
  let restEndpoint = "http://rest.testnet.blitchain.net";
  
  let msgClient = await makeKeplrClient({ rpcEndpoint, restEndpoint });
  let queryClient = await blitjs.blit.ClientFactory.createLCDClient({ restEndpoint });
  
  let address = (await msgClient.signer.getAccounts())[0].address;
  console.log(address);
  
  let balanceResponse = await queryClient.cosmos.bank.v1beta1.allBalances({
    address,
  });
  console.log(balanceResponse);

  // Optional: If you want console access for debugging
  window.blitjs = blitjs;
  window.runFunction = runFunction;
  window.queryFunction = queryFunction;
  window.msgClient = msgClient;
  window.queryClient = queryClient;
  window.address = address;
</script>

Npm

Install via npm:

npm install @blitchain/blitjs

Import in your project

import {
  default as blitjs,
  experimentalHelpers,
} from "@blitchain/blitjs/dist/index.mjs";

Brower Console

const {default: blitjs, experimentalHelpers} = (await import("https://cdn.jsdelivr.net/npm/@blitchain/blitjs/+esm"));
const { makeKeplrClient, runFunction, queryFunction } = experimentalHelpers;

Querying the chain:

Getting the current Address:

let address = (await msgClient.signer.getAccounts())[0].address;
console.log(address)
// Output blit123someaddress

Get the balance of an address

Here is how to query the balance of an address and an example of using pagination. All querys that return lists can be paginated.

let balanceResponse = await queryClient.cosmos.bank.v1beta1.allBalances({ address, pagination: { limit: "1", offset: 0, countTotal: true } });
console.log(balanceResponse);
/*
{
    "balances": [
        {
            "denom": "ublit",
            "amount": "8419418"
        }
    ],
    "pagination": {
        "next_key": "dG9rZW4=",
        "total": "2"
    }
}
*/

Query the current Blit node

let nodeInfo = await queryClient.cosmos.base.tendermint.v1beta1.getNodeInfo()
console.log(nodeInfo);
// Output {default_node_info: {…}, application_version: {…}}

Update your Script

This is how you can update a script's code using msgClient.signAndBroadcast(address, [message], "auto")

Note: pay attention to indentation for the code.

let code = `
def greet(name):
    print(f"Hello {name}!")
    return {"name": name}
`;

// Make the message with the blitjs ecoder
let message = blitjs.blit.script.MessageComposer.fromPartial.updateScript({ address, code: code })

// == or make the message object directly ==
/*
let message = {
  "typeUrl": "/blit.script.MsgUpdateScript",
  "value": {
    "address": address,
    "code": code,
    "grantee": ""
  }
}
*/
await msgClient.signAndBroadcast(address, [message], "auto")
// Output: {code: 0, height: 1086258, txIndex: 0, events: Array(8), rawLog: '[{"msg_index":0,"events":[{"type":"message","attri…2m02jkt2"},{"key":"module","value":"script"}]}]}]', …}

Update the code of a different script that has given you Authz permission

Using the grantee field

As a convenience, UpdateScriptMsg has a grantee field that will automatically create and execute the Authz Exec message if you have the corresponding /blit.script.MsgUpdateScript permission.

let newCode = `
def greet(name):
    print(f"Hola, {name}!")
    return {"name": name}
`;

// Make the message with the blitjs encoder
let message = blitjs.blit.script.MessageComposer.fromPartial.updateScript({ otherAddress, code: newCode, grantee: address })

// == or make the message object directly ==
/*
let message = {
  "typeUrl": "/blit.script.MsgUpdateScript",
  "value": {
    "address": otherAddress,
    "code": newCode,
    "grantee": address
  }
}
*/
await msgClient.signAndBroadcast(address, [message], "auto")
// Output: {code: 0, height: 1086258, txIndex: 0, events: Array(8), rawLog: '[{"msg_index":0,"events":[{"type":"message","attri…2m02jkt2"},{"key":"module","value":"script"}]}]}]', …}

Manually creating the Authz MsgExe

Alternatively, you can manually create and run the MsgExec and encoded MsgUpdateScript message.

let msg1 = blitjs.blit.script.MsgUpdateScript.toProtoMsg({address, code: "# eazy peezy", grantee:"" })

let execMsg = {
  "typeUrl": "/cosmos.authz.v1beta1.MsgExec",
  "value": {
    "grantee": address,
    "msgs": [msg1]
  }
}
let tx = (await msgClient.signAndBroadcast(address, [execMsg], 1.5));
if (tx.code !== 0) throw new Error("Oh no! " + tx.rawLog)
let decodedResponse = blitjs.cosmos.authz.v1beta1.MsgExecResponse.fromProtoMsg(tx.msgResponses[0]);


// decode the exec responses
blitjs.blit.script.MsgUpdateScriptResponse.decode(decodedResponse.results[0])

// Output: {version: 4n}

Querying a Script object to verify the Update Script worked

This will allow us to verify that the previous command worked and that the code was stored.

let scriptResponse = await queryClient.blit.script.script({ address });
console.log(scriptResponse);
/*
Output: {
    "script": {
        "address": "blit130v2ypunhy9tuurcnjpagpt77e56n72m02jkt2",
        "code": "\ndef greet(name):\n    print(f\"Hello {name}!\")\n    return {\"name\": name}\n",
        "version": "1"
    }
}
*/

How to add a Threshold Decision Policy to a group

Nested messages must be encoded as a proto message like this

let tdpMsg = blitjs.cosmos.group.v1.ThresholdDecisionPolicy.toProtoMsg({
    "threshold": "1",
    "windows": {
        "voting_period": {"seconds": "100"},
        "min_execution_period": {"seconds": "0"}
    }
})

Then it can be embedded like this:

let msg = {
  "typeUrl": "/cosmos.group.v1.MsgCreateGroupPolicy",
  "value": {
    "admin": address,
    "groupId": "1",
    "metadata": "some meta data",
    "decisionPolicy": tdpMsg
  }
}

let tx = (await msgClient.signAndBroadcast(address, [msg], "auto"));
if (tx.code !== 0) throw new Error("Oh no! " + tx.rawLog)


let decodedResponse = blitjs.cosmos.group.v1.MsgCreateGroupPolicyResponse.fromProtoMsg(tx.msgResponses[0]);
console.log(decodedResponse);
// Output: {address: 'blit1c799jddmlz7segvg6jrw6w2k6svwafganjdznard3tc74n7td7rqx9h5jn'}

How to run a function in a transaction

Now it is trivial to call greet(name="Bob") in a transaction. Keplr will prompt to sign the transaction before broadcasting it.

let runResp = await runFunction({
  msgClient,
  caller_address: address,
  script_address: address,
  function_name: "greet",
  kwargs: { name: "Bob" }
});

console.log(runResp); 
/*
Output:
{ 
    tx: { ..raw transaction details }
    result: {
        "exception": null,
        "gas_limit": 100000,
        "nodes_called": 15,
        "result": {
            "name": "Bob"
        },
        "script_gas_consumed": 45281,
        "stdout": "Hello Bob!\n"
    }
*/

Hints

Out of gas

Q: I'm getting an error like out of gas in location: WritePerByte; gasWanted: 47347, gasUsed: 48728: out of gas

A: Try replacing "auto" with 1.5 like this:

await msgClient.signAndBroadcast(address, [message], "auto")
await msgClient.signAndBroadcast(address, [message], 1.5)

How to query a function in a script

This is a read-only callA of the function greet(name="Bob"). Nothing is persisted on-chain.

let queryResp = await queryFunction({
  queryClient,
  caller_address: address,
  script_address: address,
  function_name: "greet",
  kwargs: { name: "Bob" }
});
console.log(queryResp);
/* Output
{
    "exception": null,
    "gas_limit": 10000000,
    "nodes_called": 15,
    "result": {
        "name": "Bob"
    },
    "script_gas_consumed": 1538,
    "stdout": "Hello Bob!\n"
}
*/

How to query Storage:

This will list all Storage for a specific address

let storageResponse = await queryClient.blit.storage.storageAll({ filter_address: address });
console.log(storageResponse);
/* Output
{
    "storage": [],
    "pagination": {
        "next_key": null,
        "total": "0"
    }
}
*/

How to create/update Storage at an index

let message1 = blitjs.blit.storage.MessageComposer.fromPartial.createStorage({
    address,
    index: "foo123",
    data: "some data"
})
await msgClient.signAndBroadcast(address, [message1], "auto")
// Output: {code: 0, height: 1090067, txIndex: 0, events: Array(8), rawLog: '[{"msg_index":0,"events":[{"type":"message","attri…m02jkt2"},{"key":"module","value":"storage"}]}]}]', …}

let message2 = blitjs.blit.storage.MessageComposer.fromPartial.updateStorage({
    address,
    index: "foo123",
    data: "some NEW data",
  })

await msgClient.signAndBroadcast(address, [message2], "auto")
// Output: {code: 0, height: 1090191, txIndex: 0, events: Array(8), rawLog: '[{"msg_index":0,"events":[{"type":"message","attri…m02jkt2"},{"key":"module","value":"storage"}]}]}]', …}

Msg Reference

Here are a list of available Msgs and their useage.

/blit.blit.MsgBurnCoins

let msg = {
  "typeUrl": "/blit.blit.MsgBurnCoins",
  "value": {
    "amount": null,
    "grantee": ""
  }
}
let tx = (await msgClient.signAndBroadcast(address, [msg], "auto"));
if (tx.code !== 0) throw new Error("Oh no! " + tx.rawLog)
let decodedResponse = blitjs.blit.blit.MsgBurnCoinsResponse.fromProtoMsg(tx.msgResponses[0]);
console.log(decodedResponse);

/blit.blit.MsgCreateTask

let msg = {
  "typeUrl": "/blit.blit.MsgCreateTask",
  "value": {
    "address": "",
    "activateAfter": null,
    "expireAfter": null,
    "minimumInterval": null,
    "maxRuns": "0",
    "disableOnError": false,
    "enabled": false,
    "taskGasLimit": "0",
    "taskGasFee": null,
    "messages": [],
    "grantee": ""
  }
}
let tx = (await msgClient.signAndBroadcast(address, [msg], "auto"));
if (tx.code !== 0) throw new Error("Oh no! " + tx.rawLog)
let decodedResponse = blitjs.blit.blit.MsgCreateTaskResponse.fromProtoMsg(tx.msgResponses[0]);
console.log(decodedResponse);

/blit.blit.MsgDeleteTask

let msg = {
  "typeUrl": "/blit.blit.MsgDeleteTask",
  "value": {
    "address": "",
    "id": "0"
  }
}
let tx = (await msgClient.signAndBroadcast(address, [msg], "auto"));
if (tx.code !== 0) throw new Error("Oh no! " + tx.rawLog)
let decodedResponse = blitjs.blit.blit.MsgDeleteTaskResponse.fromProtoMsg(tx.msgResponses[0]);
console.log(decodedResponse);

/blit.blit.MsgForceTransferCoins

let msg = {
  "typeUrl": "/blit.blit.MsgForceTransferCoins",
  "value": {
    "amount": null,
    "fromAddress": "",
    "toAddress": "",
    "grantee": ""
  }
}
let tx = (await msgClient.signAndBroadcast(address, [msg], "auto"));
if (tx.code !== 0) throw new Error("Oh no! " + tx.rawLog)
let decodedResponse = blitjs.blit.blit.MsgForceTransferCoinsResponse.fromProtoMsg(tx.msgResponses[0]);
console.log(decodedResponse);

/blit.blit.MsgMintCoins

let msg = {
  "typeUrl": "/blit.blit.MsgMintCoins",
  "value": {
    "amount": null,
    "grantee": ""
  }
}
let tx = (await msgClient.signAndBroadcast(address, [msg], "auto"));
if (tx.code !== 0) throw new Error("Oh no! " + tx.rawLog)
let decodedResponse = blitjs.blit.blit.MsgMintCoinsResponse.fromProtoMsg(tx.msgResponses[0]);
console.log(decodedResponse);

/blit.blit.MsgSetDenomMetadata

let msg = {
  "typeUrl": "/blit.blit.MsgSetDenomMetadata",
  "value": {
    "authority": "",
    "base": "",
    "display": "",
    "name": "",
    "symbol": "",
    "uri": "",
    "uriHash": "",
    "exponent": 0,
    "description": ""
  }
}
let tx = (await msgClient.signAndBroadcast(address, [msg], "auto"));
if (tx.code !== 0) throw new Error("Oh no! " + tx.rawLog)
let decodedResponse = blitjs.blit.blit.MsgSetDenomMetadataResponse.fromProtoMsg(tx.msgResponses[0]);
console.log(decodedResponse);

/blit.blit.MsgUpdateParams

let msg = {
  "typeUrl": "/blit.blit.MsgUpdateParams",
  "value": {
    "authority": "",
    "params": null
  }
}
let tx = (await msgClient.signAndBroadcast(address, [msg], "auto"));
if (tx.code !== 0) throw new Error("Oh no! " + tx.rawLog)
let decodedResponse = blitjs.blit.blit.MsgUpdateParamsResponse.fromProtoMsg(tx.msgResponses[0]);
console.log(decodedResponse);

/blit.blit.MsgUpdateTask

let msg = {
  "typeUrl": "/blit.blit.MsgUpdateTask",
  "value": {
    "id": "0",
    "address": "",
    "activateAfter": null,
    "expireAfter": null,
    "minimumInterval": null,
    "maxRuns": "0",
    "disableOnError": false,
    "enabled": false,
    "taskGasLimit": "0",
    "taskGasFee": null,
    "messages": [],
    "grantee": ""
  }
}
let tx = (await msgClient.signAndBroadcast(address, [msg], "auto"));
if (tx.code !== 0) throw new Error("Oh no! " + tx.rawLog)
let decodedResponse = blitjs.blit.blit.MsgUpdateTaskResponse.fromProtoMsg(tx.msgResponses[0]);
console.log(decodedResponse);

/blit.script.MsgCreateScript

let msg = {
  "typeUrl": "/blit.script.MsgCreateScript",
  "value": {
    "creator": "",
    "code": "",
    "msgTypePermissions": [],
    "grantee": ""
  }
}
let tx = (await msgClient.signAndBroadcast(address, [msg], "auto"));
if (tx.code !== 0) throw new Error("Oh no! " + tx.rawLog)
let decodedResponse = blitjs.blit.script.MsgCreateScriptResponse.fromProtoMsg(tx.msgResponses[0]);
console.log(decodedResponse);

/blit.script.MsgRun

let msg = {
  "typeUrl": "/blit.script.MsgRun",
  "value": {
    "callerAddress": "",
    "scriptAddress": "",
    "extraCode": "",
    "functionName": "",
    "kwargs": "",
    "grantee": "",
    "attachedMessages": []
  }
}
let tx = (await msgClient.signAndBroadcast(address, [msg], "auto"));
if (tx.code !== 0) throw new Error("Oh no! " + tx.rawLog)
let decodedResponse = blitjs.blit.script.MsgRunResponse.fromProtoMsg(tx.msgResponses[0]);
console.log(decodedResponse);

/blit.script.MsgUpdateParams

let msg = {
  "typeUrl": "/blit.script.MsgUpdateParams",
  "value": {
    "authority": "",
    "params": null
  }
}
let tx = (await msgClient.signAndBroadcast(address, [msg], "auto"));
if (tx.code !== 0) throw new Error("Oh no! " + tx.rawLog)
let decodedResponse = blitjs.blit.script.MsgUpdateParamsResponse.fromProtoMsg(tx.msgResponses[0]);
console.log(decodedResponse);

/blit.script.MsgUpdateScript

let msg = {
  "typeUrl": "/blit.script.MsgUpdateScript",
  "value": {
    "address": "",
    "code": "",
    "grantee": ""
  }
}
let tx = (await msgClient.signAndBroadcast(address, [msg], "auto"));
if (tx.code !== 0) throw new Error("Oh no! " + tx.rawLog)
let decodedResponse = blitjs.blit.script.MsgUpdateScriptResponse.fromProtoMsg(tx.msgResponses[0]);
console.log(decodedResponse);

/blit.storage.MsgCreateStorage

let msg = {
  "typeUrl": "/blit.storage.MsgCreateStorage",
  "value": {
    "address": "",
    "index": "",
    "data": "",
    "grantee": "",
    "force": false
  }
}
let tx = (await msgClient.signAndBroadcast(address, [msg], "auto"));
if (tx.code !== 0) throw new Error("Oh no! " + tx.rawLog)
let decodedResponse = blitjs.blit.storage.MsgCreateStorageResponse.fromProtoMsg(tx.msgResponses[0]);
console.log(decodedResponse);

/blit.storage.MsgDeleteStorage

let msg = {
  "typeUrl": "/blit.storage.MsgDeleteStorage",
  "value": {
    "address": "",
    "index": "",
    "grantee": "",
    "force": false
  }
}
let tx = (await msgClient.signAndBroadcast(address, [msg], "auto"));
if (tx.code !== 0) throw new Error("Oh no! " + tx.rawLog)
let decodedResponse = blitjs.blit.storage.MsgDeleteStorageResponse.fromProtoMsg(tx.msgResponses[0]);
console.log(decodedResponse);

/blit.storage.MsgUpdateParams

let msg = {
  "typeUrl": "/blit.storage.MsgUpdateParams",
  "value": {
    "authority": "",
    "params": null
  }
}
let tx = (await msgClient.signAndBroadcast(address, [msg], "auto"));
if (tx.code !== 0) throw new Error("Oh no! " + tx.rawLog)
let decodedResponse = blitjs.blit.storage.MsgUpdateParamsResponse.fromProtoMsg(tx.msgResponses[0]);
console.log(decodedResponse);

/blit.storage.MsgUpdateStorage

let msg = {
  "typeUrl": "/blit.storage.MsgUpdateStorage",
  "value": {
    "address": "",
    "index": "",
    "data": "",
    "grantee": "",
    "force": false
  }
}
let tx = (await msgClient.signAndBroadcast(address, [msg], "auto"));
if (tx.code !== 0) throw new Error("Oh no! " + tx.rawLog)
let decodedResponse = blitjs.blit.storage.MsgUpdateStorageResponse.fromProtoMsg(tx.msgResponses[0]);
console.log(decodedResponse);

/cosmos.authz.v1beta1.MsgExec

let msg = {
  "typeUrl": "/cosmos.authz.v1beta1.MsgExec",
  "value": {
    "grantee": "",
    "msgs": []
  }
}
let tx = (await msgClient.signAndBroadcast(address, [msg], "auto"));
if (tx.code !== 0) throw new Error("Oh no! " + tx.rawLog)
let decodedResponse = blitjs.cosmos.authz.v1beta1.MsgExecResponse.fromProtoMsg(tx.msgResponses[0]);
console.log(decodedResponse);

/cosmos.authz.v1beta1.MsgGrant

let msg = {
  "typeUrl": "/cosmos.authz.v1beta1.MsgGrant",
  "value": {
    "granter": "",
    "grantee": "",
    "grant": null
  }
}
let tx = (await msgClient.signAndBroadcast(address, [msg], "auto"));
if (tx.code !== 0) throw new Error("Oh no! " + tx.rawLog)
let decodedResponse = blitjs.cosmos.authz.v1beta1.MsgGrantResponse.fromProtoMsg(tx.msgResponses[0]);
console.log(decodedResponse);

/cosmos.authz.v1beta1.MsgRevoke

let msg = {
  "typeUrl": "/cosmos.authz.v1beta1.MsgRevoke",
  "value": {
    "granter": "",
    "grantee": "",
    "msgTypeUrl": ""
  }
}
let tx = (await msgClient.signAndBroadcast(address, [msg], "auto"));
if (tx.code !== 0) throw new Error("Oh no! " + tx.rawLog)
let decodedResponse = blitjs.cosmos.authz.v1beta1.MsgRevokeResponse.fromProtoMsg(tx.msgResponses[0]);
console.log(decodedResponse);

/cosmos.bank.v1beta1.MsgMultiSend

let msg = {
  "typeUrl": "/cosmos.bank.v1beta1.MsgMultiSend",
  "value": {
    "inputs": [],
    "outputs": []
  }
}
let tx = (await msgClient.signAndBroadcast(address, [msg], "auto"));
if (tx.code !== 0) throw new Error("Oh no! " + tx.rawLog)
let decodedResponse = blitjs.cosmos.bank.v1beta1.MsgMultiSendResponse.fromProtoMsg(tx.msgResponses[0]);
console.log(decodedResponse);

/cosmos.bank.v1beta1.MsgSend

let msg = {
  "typeUrl": "/cosmos.bank.v1beta1.MsgSend",
  "value": {
    "fromAddress": "",
    "toAddress": "",
    "amount": []
  }
}
let tx = (await msgClient.signAndBroadcast(address, [msg], "auto"));
if (tx.code !== 0) throw new Error("Oh no! " + tx.rawLog)
let decodedResponse = blitjs.cosmos.bank.v1beta1.MsgSendResponse.fromProtoMsg(tx.msgResponses[0]);
console.log(decodedResponse);

/cosmos.distribution.v1beta1.MsgFundCommunityPool

let msg = {
  "typeUrl": "/cosmos.distribution.v1beta1.MsgFundCommunityPool",
  "value": {
    "amount": [],
    "depositor": ""
  }
}
let tx = (await msgClient.signAndBroadcast(address, [msg], "auto"));
if (tx.code !== 0) throw new Error("Oh no! " + tx.rawLog)
let decodedResponse = blitjs.cosmos.distribution.v1beta1.MsgFundCommunityPoolResponse.fromProtoMsg(tx.msgResponses[0]);
console.log(decodedResponse);

/cosmos.distribution.v1beta1.MsgSetWithdrawAddress

let msg = {
  "typeUrl": "/cosmos.distribution.v1beta1.MsgSetWithdrawAddress",
  "value": {
    "delegatorAddress": "",
    "withdrawAddress": ""
  }
}
let tx = (await msgClient.signAndBroadcast(address, [msg], "auto"));
if (tx.code !== 0) throw new Error("Oh no! " + tx.rawLog)
let decodedResponse = blitjs.cosmos.distribution.v1beta1.MsgSetWithdrawAddressResponse.fromProtoMsg(tx.msgResponses[0]);
console.log(decodedResponse);

/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward

let msg = {
  "typeUrl": "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward",
  "value": {
    "delegatorAddress": "",
    "validatorAddress": ""
  }
}
let tx = (await msgClient.signAndBroadcast(address, [msg], "auto"));
if (tx.code !== 0) throw new Error("Oh no! " + tx.rawLog)
let decodedResponse = blitjs.cosmos.distribution.v1beta1.MsgWithdrawDelegatorRewardResponse.fromProtoMsg(tx.msgResponses[0]);
console.log(decodedResponse);

/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission

let msg = {
  "typeUrl": "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission",
  "value": {
    "validatorAddress": ""
  }
}
let tx = (await msgClient.signAndBroadcast(address, [msg], "auto"));
if (tx.code !== 0) throw new Error("Oh no! " + tx.rawLog)
let decodedResponse = blitjs.cosmos.distribution.v1beta1.MsgWithdrawValidatorCommissionResponse.fromProtoMsg(tx.msgResponses[0]);
console.log(decodedResponse);

/cosmos.feegrant.v1beta1.MsgGrantAllowance

let msg = {
  "typeUrl": "/cosmos.feegrant.v1beta1.MsgGrantAllowance",
  "value": {
    "granter": "",
    "grantee": "",
    "allowance": null
  }
}
let tx = (await msgClient.signAndBroadcast(address, [msg], "auto"));
if (tx.code !== 0) throw new Error("Oh no! " + tx.rawLog)
let decodedResponse = blitjs.cosmos.feegrant.v1beta1.MsgGrantAllowanceResponse.fromProtoMsg(tx.msgResponses[0]);
console.log(decodedResponse);

/cosmos.feegrant.v1beta1.MsgRevokeAllowance

let msg = {
  "typeUrl": "/cosmos.feegrant.v1beta1.MsgRevokeAllowance",
  "value": {
    "granter": "",
    "grantee": ""
  }
}
let tx = (await msgClient.signAndBroadcast(address, [msg], "auto"));
if (tx.code !== 0) throw new Error("Oh no! " + tx.rawLog)
let decodedResponse = blitjs.cosmos.feegrant.v1beta1.MsgRevokeAllowanceResponse.fromProtoMsg(tx.msgResponses[0]);
console.log(decodedResponse);

/cosmos.gov.v1.MsgDeposit

let msg = {
  "typeUrl": "/cosmos.gov.v1.MsgDeposit",
  "value": {
    "proposalId": "0",
    "depositor": "",
    "amount": []
  }
}
let tx = (await msgClient.signAndBroadcast(address, [msg], "auto"));
if (tx.code !== 0) throw new Error("Oh no! " + tx.rawLog)
let decodedResponse = blitjs.cosmos.gov.v1.MsgDepositResponse.fromProtoMsg(tx.msgResponses[0]);
console.log(decodedResponse);

/cosmos.gov.v1.MsgSubmitProposal

let msg = {
  "typeUrl": "/cosmos.gov.v1.MsgSubmitProposal",
  "value": {
    "messages": [],
    "initialDeposit": [],
    "proposer": "",
    "metadata": "",
    "title": "",
    "summary": "",
    "expedited": false
  }
}
let tx = (await msgClient.signAndBroadcast(address, [msg], "auto"));
if (tx.code !== 0) throw new Error("Oh no! " + tx.rawLog)
let decodedResponse = blitjs.cosmos.gov.v1.MsgSubmitProposalResponse.fromProtoMsg(tx.msgResponses[0]);
console.log(decodedResponse);

/cosmos.gov.v1.MsgUpdateParams

let msg = {
  "typeUrl": "/cosmos.gov.v1.MsgUpdateParams",
  "value": {
    "authority": "",
    "params": null
  }
}
let tx = (await msgClient.signAndBroadcast(address, [msg], "auto"));
if (tx.code !== 0) throw new Error("Oh no! " + tx.rawLog)
let decodedResponse = blitjs.cosmos.gov.v1.MsgUpdateParamsResponse.fromProtoMsg(tx.msgResponses[0]);
console.log(decodedResponse);

/cosmos.gov.v1.MsgVote

let msg = {
  "typeUrl": "/cosmos.gov.v1.MsgVote",
  "value": {
    "proposalId": "0",
    "voter": "",
    "option": 0,
    "metadata": ""
  }
}
let tx = (await msgClient.signAndBroadcast(address, [msg], "auto"));
if (tx.code !== 0) throw new Error("Oh no! " + tx.rawLog)
let decodedResponse = blitjs.cosmos.gov.v1.MsgVoteResponse.fromProtoMsg(tx.msgResponses[0]);
console.log(decodedResponse);

/cosmos.gov.v1.MsgVoteWeighted

let msg = {
  "typeUrl": "/cosmos.gov.v1.MsgVoteWeighted",
  "value": {
    "proposalId": "0",
    "voter": "",
    "options": [],
    "metadata": ""
  }
}
let tx = (await msgClient.signAndBroadcast(address, [msg], "auto"));
if (tx.code !== 0) throw new Error("Oh no! " + tx.rawLog)
let decodedResponse = blitjs.cosmos.gov.v1.MsgVoteWeightedResponse.fromProtoMsg(tx.msgResponses[0]);
console.log(decodedResponse);

/cosmos.gov.v1beta1.MsgDeposit

let msg = {
  "typeUrl": "/cosmos.gov.v1beta1.MsgDeposit",
  "value": {
    "proposalId": "0",
    "depositor": "",
    "amount": []
  }
}
let tx = (await msgClient.signAndBroadcast(address, [msg], "auto"));
if (tx.code !== 0) throw new Error("Oh no! " + tx.rawLog)
let decodedResponse = blitjs.cosmos.gov.v1beta1.MsgDepositResponse.fromProtoMsg(tx.msgResponses[0]);
console.log(decodedResponse);

/cosmos.gov.v1beta1.MsgSubmitProposal

let msg = {
  "typeUrl": "/cosmos.gov.v1beta1.MsgSubmitProposal",
  "value": {
    "content": null,
    "initialDeposit": [],
    "proposer": ""
  }
}
let tx = (await msgClient.signAndBroadcast(address, [msg], "auto"));
if (tx.code !== 0) throw new Error("Oh no! " + tx.rawLog)
let decodedResponse = blitjs.cosmos.gov.v1beta1.MsgSubmitProposalResponse.fromProtoMsg(tx.msgResponses[0]);
console.log(decodedResponse);

/cosmos.gov.v1beta1.MsgVote

let msg = {
  "typeUrl": "/cosmos.gov.v1beta1.MsgVote",
  "value": {
    "proposalId": "0",
    "voter": "",
    "option": 0
  }
}
let tx = (await msgClient.signAndBroadcast(address, [msg], "auto"));
if (tx.code !== 0) throw new Error("Oh no! " + tx.rawLog)
let decodedResponse = blitjs.cosmos.gov.v1beta1.MsgVoteResponse.fromProtoMsg(tx.msgResponses[0]);
console.log(decodedResponse);

/cosmos.gov.v1beta1.MsgVoteWeighted

let msg = {
  "typeUrl": "/cosmos.gov.v1beta1.MsgVoteWeighted",
  "value": {
    "proposalId": "0",
    "voter": "",
    "options": []
  }
}
let tx = (await msgClient.signAndBroadcast(address, [msg], "auto"));
if (tx.code !== 0) throw new Error("Oh no! " + tx.rawLog)
let decodedResponse = blitjs.cosmos.gov.v1beta1.MsgVoteWeightedResponse.fromProtoMsg(tx.msgResponses[0]);
console.log(decodedResponse);

/cosmos.group.v1.MsgCreateGroup

let msg = {
  "typeUrl": "/cosmos.group.v1.MsgCreateGroup",
  "value": {
    "admin": "",
    "members": [],
    "metadata": ""
  }
}
let tx = (await msgClient.signAndBroadcast(address, [msg], "auto"));
if (tx.code !== 0) throw new Error("Oh no! " + tx.rawLog)
let decodedResponse = blitjs.cosmos.group.v1.MsgCreateGroupResponse.fromProtoMsg(tx.msgResponses[0]);
console.log(decodedResponse);

/cosmos.group.v1.MsgCreateGroupPolicy

let msg = {
  "typeUrl": "/cosmos.group.v1.MsgCreateGroupPolicy",
  "value": {
    "admin": "",
    "groupId": "0",
    "metadata": "",
    "decisionPolicy": null
  }
}
let tx = (await msgClient.signAndBroadcast(address, [msg], "auto"));
if (tx.code !== 0) throw new Error("Oh no! " + tx.rawLog)
let decodedResponse = blitjs.cosmos.group.v1.MsgCreateGroupPolicyResponse.fromProtoMsg(tx.msgResponses[0]);
console.log(decodedResponse);

/cosmos.group.v1.MsgCreateGroupWithPolicy

let msg = {
  "typeUrl": "/cosmos.group.v1.MsgCreateGroupWithPolicy",
  "value": {
    "admin": "",
    "members": [],
    "groupMetadata": "",
    "groupPolicyMetadata": "",
    "groupPolicyAsAdmin": false,
    "decisionPolicy": null
  }
}
let tx = (await msgClient.signAndBroadcast(address, [msg], "auto"));
if (tx.code !== 0) throw new Error("Oh no! " + tx.rawLog)
let decodedResponse = blitjs.cosmos.group.v1.MsgCreateGroupWithPolicyResponse.fromProtoMsg(tx.msgResponses[0]);
console.log(decodedResponse);

/cosmos.group.v1.MsgExec

let msg = {
  "typeUrl": "/cosmos.group.v1.MsgExec",
  "value": {
    "proposalId": "0",
    "executor": ""
  }
}
let tx = (await msgClient.signAndBroadcast(address, [msg], "auto"));
if (tx.code !== 0) throw new Error("Oh no! " + tx.rawLog)
let decodedResponse = blitjs.cosmos.group.v1.MsgExecResponse.fromProtoMsg(tx.msgResponses[0]);
console.log(decodedResponse);

/cosmos.group.v1.MsgLeaveGroup

let msg = {
  "typeUrl": "/cosmos.group.v1.MsgLeaveGroup",
  "value": {
    "address": "",
    "groupId": "0"
  }
}
let tx = (await msgClient.signAndBroadcast(address, [msg], "auto"));
if (tx.code !== 0) throw new Error("Oh no! " + tx.rawLog)
let decodedResponse = blitjs.cosmos.group.v1.MsgLeaveGroupResponse.fromProtoMsg(tx.msgResponses[0]);
console.log(decodedResponse);

/cosmos.group.v1.MsgSubmitProposal

let msg = {
  "typeUrl": "/cosmos.group.v1.MsgSubmitProposal",
  "value": {
    "groupPolicyAddress": "",
    "proposers": [],
    "metadata": "",
    "messages": [],
    "exec": 0,
    "title": "",
    "summary": ""
  }
}
let tx = (await msgClient.signAndBroadcast(address, [msg], "auto"));
if (tx.code !== 0) throw new Error("Oh no! " + tx.rawLog)
let decodedResponse = blitjs.cosmos.group.v1.MsgSubmitProposalResponse.fromProtoMsg(tx.msgResponses[0]);
console.log(decodedResponse);

/cosmos.group.v1.MsgUpdateGroupAdmin

let msg = {
  "typeUrl": "/cosmos.group.v1.MsgUpdateGroupAdmin",
  "value": {
    "admin": "",
    "groupId": "0",
    "newAdmin": ""
  }
}
let tx = (await msgClient.signAndBroadcast(address, [msg], "auto"));
if (tx.code !== 0) throw new Error("Oh no! " + tx.rawLog)
let decodedResponse = blitjs.cosmos.group.v1.MsgUpdateGroupAdminResponse.fromProtoMsg(tx.msgResponses[0]);
console.log(decodedResponse);

/cosmos.group.v1.MsgUpdateGroupMembers

let msg = {
  "typeUrl": "/cosmos.group.v1.MsgUpdateGroupMembers",
  "value": {
    "admin": "",
    "groupId": "0",
    "memberUpdates": []
  }
}
let tx = (await msgClient.signAndBroadcast(address, [msg], "auto"));
if (tx.code !== 0) throw new Error("Oh no! " + tx.rawLog)
let decodedResponse = blitjs.cosmos.group.v1.MsgUpdateGroupMembersResponse.fromProtoMsg(tx.msgResponses[0]);
console.log(decodedResponse);

/cosmos.group.v1.MsgUpdateGroupMetadata

let msg = {
  "typeUrl": "/cosmos.group.v1.MsgUpdateGroupMetadata",
  "value": {
    "admin": "",
    "groupId": "0",
    "metadata": ""
  }
}
let tx = (await msgClient.signAndBroadcast(address, [msg], "auto"));
if (tx.code !== 0) throw new Error("Oh no! " + tx.rawLog)
let decodedResponse = blitjs.cosmos.group.v1.MsgUpdateGroupMetadataResponse.fromProtoMsg(tx.msgResponses[0]);
console.log(decodedResponse);

/cosmos.group.v1.MsgUpdateGroupPolicyAdmin

let msg = {
  "typeUrl": "/cosmos.group.v1.MsgUpdateGroupPolicyAdmin",
  "value": {
    "admin": "",
    "groupPolicyAddress": "",
    "newAdmin": ""
  }
}
let tx = (await msgClient.signAndBroadcast(address, [msg], "auto"));
if (tx.code !== 0) throw new Error("Oh no! " + tx.rawLog)
let decodedResponse = blitjs.cosmos.group.v1.MsgUpdateGroupPolicyAdminResponse.fromProtoMsg(tx.msgResponses[0]);
console.log(decodedResponse);

/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicy

let msg = {
  "typeUrl": "/cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicy",
  "value": {
    "admin": "",
    "groupPolicyAddress": "",
    "decisionPolicy": null
  }
}
let tx = (await msgClient.signAndBroadcast(address, [msg], "auto"));
if (tx.code !== 0) throw new Error("Oh no! " + tx.rawLog)
let decodedResponse = blitjs.cosmos.group.v1.MsgUpdateGroupPolicyDecisionPolicyResponse.fromProtoMsg(tx.msgResponses[0]);
console.log(decodedResponse);

/cosmos.group.v1.MsgUpdateGroupPolicyMetadata

let msg = {
  "typeUrl": "/cosmos.group.v1.MsgUpdateGroupPolicyMetadata",
  "value": {
    "admin": "",
    "groupPolicyAddress": "",
    "metadata": ""
  }
}
let tx = (await msgClient.signAndBroadcast(address, [msg], "auto"));
if (tx.code !== 0) throw new Error("Oh no! " + tx.rawLog)
let decodedResponse = blitjs.cosmos.group.v1.MsgUpdateGroupPolicyMetadataResponse.fromProtoMsg(tx.msgResponses[0]);
console.log(decodedResponse);

/cosmos.group.v1.MsgVote

let msg = {
  "typeUrl": "/cosmos.group.v1.MsgVote",
  "value": {
    "proposalId": "0",
    "voter": "",
    "option": 0,
    "metadata": "",
    "exec": 0
  }
}
let tx = (await msgClient.signAndBroadcast(address, [msg], "auto"));
if (tx.code !== 0) throw new Error("Oh no! " + tx.rawLog)
let decodedResponse = blitjs.cosmos.group.v1.MsgVoteResponse.fromProtoMsg(tx.msgResponses[0]);
console.log(decodedResponse);

/cosmos.group.v1.MsgWithdrawProposal

let msg = {
  "typeUrl": "/cosmos.group.v1.MsgWithdrawProposal",
  "value": {
    "proposalId": "0",
    "address": ""
  }
}
let tx = (await msgClient.signAndBroadcast(address, [msg], "auto"));
if (tx.code !== 0) throw new Error("Oh no! " + tx.rawLog)
let decodedResponse = blitjs.cosmos.group.v1.MsgWithdrawProposalResponse.fromProtoMsg(tx.msgResponses[0]);
console.log(decodedResponse);

/cosmos.staking.v1beta1.MsgBeginRedelegate

let msg = {
  "typeUrl": "/cosmos.staking.v1beta1.MsgBeginRedelegate",
  "value": {
    "delegatorAddress": "",
    "validatorSrcAddress": "",
    "validatorDstAddress": "",
    "amount": null
  }
}
let tx = (await msgClient.signAndBroadcast(address, [msg], "auto"));
if (tx.code !== 0) throw new Error("Oh no! " + tx.rawLog)
let decodedResponse = blitjs.cosmos.staking.v1beta1.MsgBeginRedelegateResponse.fromProtoMsg(tx.msgResponses[0]);
console.log(decodedResponse);

/cosmos.staking.v1beta1.MsgCreateValidator

let msg = {
  "typeUrl": "/cosmos.staking.v1beta1.MsgCreateValidator",
  "value": {
    "description": null,
    "commission": null,
    "minSelfDelegation": "",
    "delegatorAddress": "",
    "validatorAddress": "",
    "pubkey": null,
    "value": null
  }
}
let tx = (await msgClient.signAndBroadcast(address, [msg], "auto"));
if (tx.code !== 0) throw new Error("Oh no! " + tx.rawLog)
let decodedResponse = blitjs.cosmos.staking.v1beta1.MsgCreateValidatorResponse.fromProtoMsg(tx.msgResponses[0]);
console.log(decodedResponse);

/cosmos.staking.v1beta1.MsgDelegate

let msg = {
  "typeUrl": "/cosmos.staking.v1beta1.MsgDelegate",
  "value": {
    "delegatorAddress": "",
    "validatorAddress": "",
    "amount": null
  }
}
let tx = (await msgClient.signAndBroadcast(address, [msg], "auto"));
if (tx.code !== 0) throw new Error("Oh no! " + tx.rawLog)
let decodedResponse = blitjs.cosmos.staking.v1beta1.MsgDelegateResponse.fromProtoMsg(tx.msgResponses[0]);
console.log(decodedResponse);

/cosmos.staking.v1beta1.MsgEditValidator

let msg = {
  "typeUrl": "/cosmos.staking.v1beta1.MsgEditValidator",
  "value": {
    "description": null,
    "validatorAddress": "",
    "commissionRate": "",
    "minSelfDelegation": ""
  }
}
let tx = (await msgClient.signAndBroadcast(address, [msg], "auto"));
if (tx.code !== 0) throw new Error("Oh no! " + tx.rawLog)
let decodedResponse = blitjs.cosmos.staking.v1beta1.MsgEditValidatorResponse.fromProtoMsg(tx.msgResponses[0]);
console.log(decodedResponse);

/cosmos.staking.v1beta1.MsgUndelegate

let msg = {
  "typeUrl": "/cosmos.staking.v1beta1.MsgUndelegate",
  "value": {
    "delegatorAddress": "",
    "validatorAddress": "",
    "amount": null
  }
}
let tx = (await msgClient.signAndBroadcast(address, [msg], "auto"));
if (tx.code !== 0) throw new Error("Oh no! " + tx.rawLog)
let decodedResponse = blitjs.cosmos.staking.v1beta1.MsgUndelegateResponse.fromProtoMsg(tx.msgResponses[0]);
console.log(decodedResponse);

/cosmos.vesting.v1beta1.MsgCreateVestingAccount

let msg = {
  "typeUrl": "/cosmos.vesting.v1beta1.MsgCreateVestingAccount",
  "value": {
    "fromAddress": "",
    "toAddress": "",
    "amount": [],
    "endTime": "0",
    "delayed": false
  }
}
let tx = (await msgClient.signAndBroadcast(address, [msg], "auto"));
if (tx.code !== 0) throw new Error("Oh no! " + tx.rawLog)
let decodedResponse = blitjs.cosmos.vesting.v1beta1.MsgCreateVestingAccountResponse.fromProtoMsg(tx.msgResponses[0]);
console.log(decodedResponse);

Documentation helper

Source for generating the Msg examples
let items = [...msgClient.registry.types.entries()].sort();
let out = '';
items.map(([k, v]) => {
    if (k.includes('Msg') && !k.includes('ibc.core')) {
        let value = (blitjs.cosmosProtoRegistry.find( ((x ) => {return x[0] == k})) || blitjs.blitProtoRegistry.find(((x ) => {return x[0] == k})))
        if (value !== undefined) out += `
## ${k} 

\`\`\`js
let msg = ${ JSON.stringify({typeUrl:k, value: value[1].fromPartial({})},   function(k, v) { return v === undefined ? null : v}, 2) }
let tx = (await msgClient.signAndBroadcast(address, [msg], "auto"));
if (tx.code !== 0) throw new Error("Oh no! " + tx.rawLog)
let decodedResponse = blitjs${k.replace('/', '.') + "Response"}.fromProtoMsg(tx.msgResponses[0]);
console.log(decodedResponse);
\`\`\`
`;
    }
});
console.log(out);

Query Reference

/blit.blit.Query/AllFutureTask

let params = {
  "prefix": ""
}
await queryClient.blit.blit.allFutureTask(params)

/blit.blit.Query/AllTask

let params = {
  "address": ""
}
await queryClient.blit.blit.allTask(params)

/blit.blit.Query/GetFutureTask

let params = {
  "index": ""
}
await queryClient.blit.blit.getFutureTask(params)

/blit.blit.Query/GetTask

let params = {
  "id": "0"
}
await queryClient.blit.blit.getTask(params)

/blit.blit.Query/Params

let params = {}
await queryClient.blit.blit.params(params)

/blit.script.Query/Eval

let params = {
  "callerAddress": "",
  "scriptAddress": "",
  "extraCode": "",
  "functionName": "",
  "kwargs": "",
  "grantee": "",
  "attachedMessages": ""
}
await queryClient.blit.script.eval(params)

/blit.script.Query/Params

let params = {}
await queryClient.blit.script.params(params)

/blit.script.Query/Script

let params = {
  "address": ""
}
await queryClient.blit.script.script(params)

/blit.script.Query/Scripts

let params = {}
await queryClient.blit.script.scripts(params)

/blit.script.Query/Web

let params = {
  "address": "",
  "httprequest": ""
}
await queryClient.blit.script.web(params)

/blit.storage.Query/FilterStorage

let params = {
  "filterAddress": "",
  "filterIndexPrefix": ""
}
await queryClient.blit.storage.filterStorage(params)

/blit.storage.Query/Params

let params = {}
await queryClient.blit.storage.params(params)

/blit.storage.Query/StorageDetail

let params = {
  "address": "",
  "index": ""
}
await queryClient.blit.storage.storageDetail(params)

/cosmos.auth.v1beta1.Query/AccountAddressByID

let params = {
  "id": "0",
  "accountId": "0"
}
await queryClient.cosmos.auth.v1beta1.accountAddressByID(params)

/cosmos.auth.v1beta1.Query/AccountInfo

let params = {
  "address": ""
}
await queryClient.cosmos.auth.v1beta1.accountInfo(params)

/cosmos.auth.v1beta1.Query/Account

let params = {
  "address": ""
}
await queryClient.cosmos.auth.v1beta1.account(params)

/cosmos.auth.v1beta1.Query/Accounts

let params = {}
await queryClient.cosmos.auth.v1beta1.accounts(params)

/cosmos.auth.v1beta1.Query/ModuleAccountByName

let params = {
  "name": ""
}
await queryClient.cosmos.auth.v1beta1.moduleAccountByName(params)

/cosmos.auth.v1beta1.Query/ModuleAccounts

let params = {}
await queryClient.cosmos.auth.v1beta1.moduleAccounts(params)

/cosmos.auth.v1beta1.Query/Params

let params = {}
await queryClient.cosmos.auth.v1beta1.params(params)

/cosmos.authz.v1beta1.Query/GranteeGrants

let params = {
  "grantee": ""
}
await queryClient.cosmos.authz.v1beta1.granteeGrants(params)

/cosmos.authz.v1beta1.Query/GranterGrants

let params = {
  "granter": ""
}
await queryClient.cosmos.authz.v1beta1.granterGrants(params)

/cosmos.authz.v1beta1.Query/Grants

let params = {
  "granter": "",
  "grantee": "",
  "msgTypeUrl": ""
}
await queryClient.cosmos.authz.v1beta1.grants(params)

/cosmos.bank.v1beta1.Query/AllBalances

let params = {
  "address": "",
  "resolveDenom": false
}
await queryClient.cosmos.bank.v1beta1.allBalances(params)

/cosmos.bank.v1beta1.Query/Balance

let params = {
  "address": "",
  "denom": ""
}
await queryClient.cosmos.bank.v1beta1.balance(params)

/cosmos.bank.v1beta1.Query/DenomMetadataByQueryString

let params = {
  "denom": ""
}
await queryClient.cosmos.bank.v1beta1.denomMetadataByQueryString(params)

/cosmos.bank.v1beta1.Query/DenomMetadata

let params = {
  "denom": ""
}
await queryClient.cosmos.bank.v1beta1.denomMetadata(params)

/cosmos.bank.v1beta1.Query/DenomOwners

let params = {
  "denom": ""
}
await queryClient.cosmos.bank.v1beta1.denomOwners(params)

/cosmos.bank.v1beta1.Query/DenomsMetadata

let params = {}
await queryClient.cosmos.bank.v1beta1.denomsMetadata(params)

/cosmos.bank.v1beta1.Query/Params

let params = {}
await queryClient.cosmos.bank.v1beta1.params(params)

/cosmos.bank.v1beta1.Query/SpendableBalanceByDenom

let params = {
  "address": "",
  "denom": ""
}
await queryClient.cosmos.bank.v1beta1.spendableBalanceByDenom(params)

/cosmos.bank.v1beta1.Query/SpendableBalances

let params = {
  "address": ""
}
await queryClient.cosmos.bank.v1beta1.spendableBalances(params)

/cosmos.bank.v1beta1.Query/SupplyOf

let params = {
  "denom": ""
}
await queryClient.cosmos.bank.v1beta1.supplyOf(params)

/cosmos.bank.v1beta1.Query/TotalSupply

let params = {}
await queryClient.cosmos.bank.v1beta1.totalSupply(params)

/cosmos.base.reflection.v2alpha1.GetQuery/ServicesDescriptor

let params = {}
await queryClient.cosmos.base.reflection.v2alpha1.getServicesDescriptor(params)

/cosmos.base.tendermint.v1beta1.ABCIQuery/

let params = {
  "data": {},
  "path": "",
  "height": "0",
  "prove": false
}
await queryClient.cosmos.base.tendermint.v1beta1.aBCI(params)

/cosmos.circuit.v1.Query/Account

let params = {
  "address": ""
}
await queryClient.cosmos.circuit.v1.account(params)

/cosmos.circuit.v1.Query/Accounts

let params = {}
await queryClient.cosmos.circuit.v1.accounts(params)

/cosmos.circuit.v1.Query/DisabledList

let params = {}
await queryClient.cosmos.circuit.v1.disabledList(params)

/cosmos.consensus.v1.Query/Params

let params = {}
await queryClient.cosmos.consensus.v1.params(params)

/cosmos.distribution.v1beta1.Query/CommunityPool

let params = {}
await queryClient.cosmos.distribution.v1beta1.communityPool(params)

/cosmos.distribution.v1beta1.Query/DelegationRewards

let params = {
  "delegatorAddress": "",
  "validatorAddress": ""
}
await queryClient.cosmos.distribution.v1beta1.delegationRewards(params)

/cosmos.distribution.v1beta1.Query/DelegationTotalRewards

let params = {
  "delegatorAddress": ""
}
await queryClient.cosmos.distribution.v1beta1.delegationTotalRewards(params)

/cosmos.distribution.v1beta1.Query/DelegatorValidators

let params = {
  "delegatorAddress": ""
}
await queryClient.cosmos.distribution.v1beta1.delegatorValidators(params)

/cosmos.distribution.v1beta1.Query/DelegatorWithdrawAddress

let params = {
  "delegatorAddress": ""
}
await queryClient.cosmos.distribution.v1beta1.delegatorWithdrawAddress(params)

/cosmos.distribution.v1beta1.Query/Params

let params = {}
await queryClient.cosmos.distribution.v1beta1.params(params)

/cosmos.distribution.v1beta1.Query/ValidatorCommission

let params = {
  "validatorAddress": ""
}
await queryClient.cosmos.distribution.v1beta1.validatorCommission(params)

/cosmos.distribution.v1beta1.Query/ValidatorDistributionInfo

let params = {
  "validatorAddress": ""
}
await queryClient.cosmos.distribution.v1beta1.validatorDistributionInfo(params)

/cosmos.distribution.v1beta1.Query/ValidatorOutstandingRewards

let params = {
  "validatorAddress": ""
}
await queryClient.cosmos.distribution.v1beta1.validatorOutstandingRewards(params)

/cosmos.distribution.v1beta1.Query/ValidatorSlashes

let params = {
  "validatorAddress": "",
  "startingHeight": "0",
  "endingHeight": "0"
}
await queryClient.cosmos.distribution.v1beta1.validatorSlashes(params)

/cosmos.feegrant.v1beta1.Query/Allowance

let params = {
  "granter": "",
  "grantee": ""
}
await queryClient.cosmos.feegrant.v1beta1.allowance(params)

/cosmos.feegrant.v1beta1.Query/AllowancesByGranter

let params = {
  "granter": ""
}
await queryClient.cosmos.feegrant.v1beta1.allowancesByGranter(params)

/cosmos.feegrant.v1beta1.Query/Allowances

let params = {
  "grantee": ""
}
await queryClient.cosmos.feegrant.v1beta1.allowances(params)

/cosmos.gov.v1.Query/Constitution

let params = {}
await queryClient.cosmos.gov.v1.constitution(params)

/cosmos.gov.v1.Query/Deposit

let params = {
  "proposalId": "0",
  "depositor": ""
}
await queryClient.cosmos.gov.v1.deposit(params)

/cosmos.gov.v1.Query/Deposits

let params = {
  "proposalId": "0"
}
await queryClient.cosmos.gov.v1.deposits(params)

/cosmos.gov.v1.Query/Params

let params = {
  "paramsType": ""
}
await queryClient.cosmos.gov.v1.params(params)

/cosmos.gov.v1.Query/Proposal

let params = {
  "proposalId": "0"
}
await queryClient.cosmos.gov.v1.proposal(params)

/cosmos.gov.v1.Query/Proposals

let params = {
  "proposalStatus": 0,
  "voter": "",
  "depositor": ""
}
await queryClient.cosmos.gov.v1.proposals(params)

/cosmos.gov.v1.Query/TallyResult

let params = {
  "proposalId": "0"
}
await queryClient.cosmos.gov.v1.tallyResult(params)

/cosmos.gov.v1.Query/Vote

let params = {
  "proposalId": "0",
  "voter": ""
}
await queryClient.cosmos.gov.v1.vote(params)

/cosmos.gov.v1.Query/Votes

let params = {
  "proposalId": "0"
}
await queryClient.cosmos.gov.v1.votes(params)

/cosmos.gov.v1beta1.Query/Deposit

let params = {
  "proposalId": "0",
  "depositor": ""
}
await queryClient.cosmos.gov.v1beta1.deposit(params)

/cosmos.gov.v1beta1.Query/Deposits

let params = {
  "proposalId": "0"
}
await queryClient.cosmos.gov.v1beta1.deposits(params)

/cosmos.gov.v1beta1.Query/Params

let params = {
  "paramsType": ""
}
await queryClient.cosmos.gov.v1beta1.params(params)

/cosmos.gov.v1beta1.Query/Proposal

let params = {
  "proposalId": "0"
}
await queryClient.cosmos.gov.v1beta1.proposal(params)

/cosmos.gov.v1beta1.Query/Proposals

let params = {
  "proposalStatus": 0,
  "voter": "",
  "depositor": ""
}
await queryClient.cosmos.gov.v1beta1.proposals(params)

/cosmos.gov.v1beta1.Query/TallyResult

let params = {
  "proposalId": "0"
}
await queryClient.cosmos.gov.v1beta1.tallyResult(params)

/cosmos.gov.v1beta1.Query/Vote

let params = {
  "proposalId": "0",
  "voter": ""
}
await queryClient.cosmos.gov.v1beta1.vote(params)

/cosmos.gov.v1beta1.Query/Votes

let params = {
  "proposalId": "0"
}
await queryClient.cosmos.gov.v1beta1.votes(params)

/cosmos.group.v1.Query/GroupInfo

let params = {
  "groupId": "0"
}
await queryClient.cosmos.group.v1.groupInfo(params)

/cosmos.group.v1.Query/GroupMembers

let params = {
  "groupId": "0"
}
await queryClient.cosmos.group.v1.groupMembers(params)

/cosmos.group.v1.Query/GroupPoliciesByAdmin

let params = {
  "admin": ""
}
await queryClient.cosmos.group.v1.groupPoliciesByAdmin(params)

/cosmos.group.v1.Query/GroupPoliciesByGroup

let params = {
  "groupId": "0"
}
await queryClient.cosmos.group.v1.groupPoliciesByGroup(params)

/cosmos.group.v1.Query/GroupPolicyInfo

let params = {
  "address": ""
}
await queryClient.cosmos.group.v1.groupPolicyInfo(params)

/cosmos.group.v1.Query/GroupsByAdmin

let params = {
  "admin": ""
}
await queryClient.cosmos.group.v1.groupsByAdmin(params)

/cosmos.group.v1.Query/GroupsByMember

let params = {
  "address": ""
}
await queryClient.cosmos.group.v1.groupsByMember(params)

/cosmos.group.v1.Query/Groups

let params = {}
await queryClient.cosmos.group.v1.groups(params)

/cosmos.group.v1.Query/Proposal

let params = {
  "proposalId": "0"
}
await queryClient.cosmos.group.v1.proposal(params)

/cosmos.group.v1.Query/ProposalsByGroupPolicy

let params = {
  "address": ""
}
await queryClient.cosmos.group.v1.proposalsByGroupPolicy(params)

/cosmos.group.v1.Query/TallyResult

let params = {
  "proposalId": "0"
}
await queryClient.cosmos.group.v1.tallyResult(params)

/cosmos.group.v1.Query/VoteByProposalVoter

let params = {
  "proposalId": "0",
  "voter": ""
}
await queryClient.cosmos.group.v1.voteByProposalVoter(params)

/cosmos.group.v1.Query/VotesByProposal

let params = {
  "proposalId": "0"
}
await queryClient.cosmos.group.v1.votesByProposal(params)

/cosmos.group.v1.Query/VotesByVoter

let params = {
  "voter": ""
}
await queryClient.cosmos.group.v1.votesByVoter(params)

/cosmos.mint.v1beta1.Query/AnnualProvisions

let params = {}
await queryClient.cosmos.mint.v1beta1.annualProvisions(params)

/cosmos.mint.v1beta1.Query/Inflation

let params = {}
await queryClient.cosmos.mint.v1beta1.inflation(params)

/cosmos.mint.v1beta1.Query/Params

let params = {}
await queryClient.cosmos.mint.v1beta1.params(params)

/cosmos.nft.v1beta1.Query/Balance

let params = {
  "classId": "",
  "owner": ""
}
await queryClient.cosmos.nft.v1beta1.balance(params)

/cosmos.nft.v1beta1.Query/Class

let params = {
  "classId": ""
}
await queryClient.cosmos.nft.v1beta1.class(params)

/cosmos.nft.v1beta1.Query/Classes

let params = {}
await queryClient.cosmos.nft.v1beta1.classes(params)

/cosmos.nft.v1beta1.Query/NFT

let params = {
  "classId": "",
  "id": ""
}
await queryClient.cosmos.nft.v1beta1.nFT(params)

/cosmos.nft.v1beta1.Query/NFTs

let params = {
  "classId": "",
  "owner": ""
}
await queryClient.cosmos.nft.v1beta1.nFTs(params)

/cosmos.nft.v1beta1.Query/Owner

let params = {
  "classId": "",
  "id": ""
}
await queryClient.cosmos.nft.v1beta1.owner(params)

/cosmos.nft.v1beta1.Query/Supply

let params = {
  "classId": ""
}
await queryClient.cosmos.nft.v1beta1.supply(params)

/cosmos.params.v1beta1.Query/Params

let params = {
  "subspace": "",
  "key": ""
}
await queryClient.cosmos.params.v1beta1.params(params)

/cosmos.params.v1beta1.Query/Subspaces

let params = {}
await queryClient.cosmos.params.v1beta1.subspaces(params)

/cosmos.staking.v1beta1.Query/Delegation

let params = {
  "delegatorAddr": "",
  "validatorAddr": ""
}
await queryClient.cosmos.staking.v1beta1.delegation(params)

/cosmos.staking.v1beta1.Query/DelegatorDelegations

let params = {
  "delegatorAddr": ""
}
await queryClient.cosmos.staking.v1beta1.delegatorDelegations(params)

/cosmos.staking.v1beta1.Query/DelegatorUnbondingDelegations

let params = {
  "delegatorAddr": ""
}
await queryClient.cosmos.staking.v1beta1.delegatorUnbondingDelegations(params)

/cosmos.staking.v1beta1.Query/DelegatorValidator

let params = {
  "delegatorAddr": "",
  "validatorAddr": ""
}
await queryClient.cosmos.staking.v1beta1.delegatorValidator(params)

/cosmos.staking.v1beta1.Query/DelegatorValidators

let params = {
  "delegatorAddr": ""
}
await queryClient.cosmos.staking.v1beta1.delegatorValidators(params)

/cosmos.staking.v1beta1.Query/HistoricalInfo

let params = {
  "height": "0"
}
await queryClient.cosmos.staking.v1beta1.historicalInfo(params)

/cosmos.staking.v1beta1.Query/Params

let params = {}
await queryClient.cosmos.staking.v1beta1.params(params)

/cosmos.staking.v1beta1.Query/Pool

let params = {}
await queryClient.cosmos.staking.v1beta1.pool(params)

/cosmos.staking.v1beta1.Query/Redelegations

let params = {
  "delegatorAddr": "",
  "srcValidatorAddr": "",
  "dstValidatorAddr": ""
}
await queryClient.cosmos.staking.v1beta1.redelegations(params)

/cosmos.staking.v1beta1.Query/UnbondingDelegation

let params = {
  "delegatorAddr": "",
  "validatorAddr": ""
}
await queryClient.cosmos.staking.v1beta1.unbondingDelegation(params)

/cosmos.staking.v1beta1.Query/ValidatorDelegations

let params = {
  "validatorAddr": ""
}
await queryClient.cosmos.staking.v1beta1.validatorDelegations(params)

/cosmos.staking.v1beta1.Query/Validator

let params = {
  "validatorAddr": ""
}
await queryClient.cosmos.staking.v1beta1.validator(params)

/cosmos.staking.v1beta1.Query/ValidatorUnbondingDelegations

let params = {
  "validatorAddr": ""
}
await queryClient.cosmos.staking.v1beta1.validatorUnbondingDelegations(params)

/cosmos.staking.v1beta1.Query/Validators

let params = {
  "status": ""
}
await queryClient.cosmos.staking.v1beta1.validators(params)

/cosmos.upgrade.v1beta1.Query/AppliedPlan

let params = {
  "name": ""
}
await queryClient.cosmos.upgrade.v1beta1.appliedPlan(params)

/cosmos.upgrade.v1beta1.Query/Authority

let params = {}
await queryClient.cosmos.upgrade.v1beta1.authority(params)

/cosmos.upgrade.v1beta1.Query/CurrentPlan

let params = {}
await queryClient.cosmos.upgrade.v1beta1.currentPlan(params)

/cosmos.upgrade.v1beta1.Query/ModuleVersions

let params = {
  "moduleName": ""
}
await queryClient.cosmos.upgrade.v1beta1.moduleVersions(params)

/cosmos.upgrade.v1beta1.Query/UpgradedConsensusState

let params = {
  "lastHeight": "0"
}
await queryClient.cosmos.upgrade.v1beta1.upgradedConsensusState(params)

/ibc.applications.interchain_accounts.controller.v1.Query/InterchainAccount

let params = {
  "owner": "",
  "connectionId": ""
}
await queryClient.ibc.applications.interchain_accounts.controller.v1.interchainAccount(params)

/ibc.applications.interchain_accounts.controller.v1.Query/Params

let params = {}
await queryClient.ibc.applications.interchain_accounts.controller.v1.params(params)

/ibc.applications.interchain_accounts.host.v1.Query/Params

let params = {}
await queryClient.ibc.applications.interchain_accounts.host.v1.params(params)

/ibc.applications.transfer.v1.Query/DenomHash

let params = {
  "trace": ""
}
await queryClient.ibc.applications.transfer.v1.denomHash(params)

/ibc.applications.transfer.v1.Query/DenomTrace

let params = {
  "hash": ""
}
await queryClient.ibc.applications.transfer.v1.denomTrace(params)

/ibc.applications.transfer.v1.Query/DenomTraces

let params = {}
await queryClient.ibc.applications.transfer.v1.denomTraces(params)

/ibc.applications.transfer.v1.Query/EscrowAddress

let params = {
  "portId": "",
  "channelId": ""
}
await queryClient.ibc.applications.transfer.v1.escrowAddress(params)

/ibc.applications.transfer.v1.Query/Params

let params = {}
await queryClient.ibc.applications.transfer.v1.params(params)

/ibc.applications.transfer.v1.Query/TotalEscrowForDenom

let params = {
  "denom": ""
}
await queryClient.ibc.applications.transfer.v1.totalEscrowForDenom(params)

/ibc.core.channel.v1.Query/ChannelClientState

let params = {
  "portId": "",
  "channelId": ""
}
await queryClient.ibc.core.channel.v1.channelClientState(params)

/ibc.core.channel.v1.Query/ChannelConsensusState

let params = {
  "portId": "",
  "channelId": "",
  "revisionNumber": "0",
  "revisionHeight": "0"
}
await queryClient.ibc.core.channel.v1.channelConsensusState(params)

/ibc.core.channel.v1.Query/Channel

let params = {
  "portId": "",
  "channelId": ""
}
await queryClient.ibc.core.channel.v1.channel(params)

/ibc.core.channel.v1.Query/Channels

let params = {}
await queryClient.ibc.core.channel.v1.channels(params)

/ibc.core.channel.v1.Query/ConnectionChannels

let params = {
  "connection": ""
}
await queryClient.ibc.core.channel.v1.connectionChannels(params)

/ibc.core.channel.v1.Query/NextSequenceReceive

let params = {
  "portId": "",
  "channelId": ""
}
await queryClient.ibc.core.channel.v1.nextSequenceReceive(params)

/ibc.core.channel.v1.Query/NextSequenceSend

let params = {
  "portId": "",
  "channelId": ""
}
await queryClient.ibc.core.channel.v1.nextSequenceSend(params)

/ibc.core.channel.v1.Query/PacketAcknowledgement

let params = {
  "portId": "",
  "channelId": "",
  "sequence": "0"
}
await queryClient.ibc.core.channel.v1.packetAcknowledgement(params)

/ibc.core.channel.v1.Query/PacketCommitment

let params = {
  "portId": "",
  "channelId": "",
  "sequence": "0"
}
await queryClient.ibc.core.channel.v1.packetCommitment(params)

/ibc.core.channel.v1.Query/PacketCommitments

let params = {
  "portId": "",
  "channelId": ""
}
await queryClient.ibc.core.channel.v1.packetCommitments(params)

/ibc.core.channel.v1.Query/PacketReceipt

let params = {
  "portId": "",
  "channelId": "",
  "sequence": "0"
}
await queryClient.ibc.core.channel.v1.packetReceipt(params)

/ibc.core.client.v1.Query/ClientParams

let params = {}
await queryClient.ibc.core.client.v1.clientParams(params)

/ibc.core.client.v1.Query/ClientState

let params = {
  "clientId": ""
}
await queryClient.ibc.core.client.v1.clientState(params)

/ibc.core.client.v1.Query/ClientStates

let params = {}
await queryClient.ibc.core.client.v1.clientStates(params)

/ibc.core.client.v1.Query/ClientStatus

let params = {
  "clientId": ""
}
await queryClient.ibc.core.client.v1.clientStatus(params)

/ibc.core.client.v1.Query/ConsensusStateHeights

let params = {
  "clientId": ""
}
await queryClient.ibc.core.client.v1.consensusStateHeights(params)

/ibc.core.client.v1.Query/ConsensusState

let params = {
  "clientId": "",
  "revisionNumber": "0",
  "revisionHeight": "0",
  "latestHeight": false
}
await queryClient.ibc.core.client.v1.consensusState(params)

/ibc.core.client.v1.Query/ConsensusStates

let params = {
  "clientId": ""
}
await queryClient.ibc.core.client.v1.consensusStates(params)

/ibc.core.client.v1.Query/UpgradedClientState

let params = {}
await queryClient.ibc.core.client.v1.upgradedClientState(params)

/ibc.core.client.v1.Query/UpgradedConsensusState

let params = {}
await queryClient.ibc.core.client.v1.upgradedConsensusState(params)

/ibc.core.connection.v1.Query/ClientConnections

let params = {
  "clientId": ""
}
await queryClient.ibc.core.connection.v1.clientConnections(params)

/ibc.core.connection.v1.Query/ConnectionClientState

let params = {
  "connectionId": ""
}
await queryClient.ibc.core.connection.v1.connectionClientState(params)

/ibc.core.connection.v1.Query/ConnectionConsensusState

let params = {
  "connectionId": "",
  "revisionNumber": "0",
  "revisionHeight": "0"
}
await queryClient.ibc.core.connection.v1.connectionConsensusState(params)

/ibc.core.connection.v1.Query/ConnectionParams

let params = {}
await queryClient.ibc.core.connection.v1.connectionParams(params)

/ibc.core.connection.v1.Query/Connection

let params = {
  "connectionId": ""
}
await queryClient.ibc.core.connection.v1.connection(params)

/ibc.core.connection.v1.Query/Connections

let params = {}
await queryClient.ibc.core.connection.v1.connections(params)
# Query doc helper
Source for generating the query examples

BigInt.prototype.toJSON = function() { return this.toString() }

var flatten = (function (isArray, wrapped) {
    return function (table) {
        return reduce("", [], table);
    };

    function reduce(path, accumulator, table) {
        if (isArray(table)) {
        } else {
            var empty = true;

            if (path) {
                for (var property in table) {
                    var item = table[property], property = path + "." + property, empty = false;
                    if (wrapped(item) !== item) {} // accumulator[property] = item;
                    else reduce(property, accumulator, item);
                }
            } else {
                for (var property in table) {
                    var item = table[property], empty = false;
                    if (wrapped(item) !== item) {} //accumulator[property] = item;
                    else reduce(property, accumulator, item);
                }
            }

            if (empty && path.endsWith("Request") && path.includes("Query")) accumulator.push(path);

            
        }

        return accumulator;
    }
}(Array.isArray, Object));


requestStrings = flatten(JSON.parse(JSON.stringify(blitjs)))

function generateQueryCode(queryRequestStrings) {
    let outputString = '';

    for (let i = 0; i < queryRequestStrings.length; i++) {
        let requestString = queryRequestStrings[i];
        let requestTypeUrl = "/" + requestString.replace('Query', 'Query/').replace('Request', '');;
        let parts = requestString.split('.');
        let namespace = parts.slice(0, -1).join('.');
        let requestClass = parts.slice(-1)[0];
        let methodName = requestClass.replace('Query', '').replace('Request', '')
	methodName = methodName[0].toLowerCase() + methodName.slice(1)
        
        // Ensure the methodName resulted in a non-empty string to avoid erroneous method calls
        if (!methodName) {
            console.error(`Unable to derive method name from request string: ${requestString}`);
            continue;  // Skip to next iteration
        }

        let queryData = eval(`JSON.stringify(blitjs.${requestString}.fromPartial({}), null, 2)`);
        let methodCallStatement = `await queryClient.${namespace}.${methodName}(params)`;


        outputString += `
##  ${requestTypeUrl}

\`\`\`js
let params = ${queryData}
${methodCallStatement}
\`\`\`
`;
    }
    return outputString;
}

resultString = generateQueryCode(requestStrings);
console.log(resultString);


License

This project is licensed under the MIT License.

Readme

Keywords

none

Package Sidebar

Install

npm i @blitchain/blitjs

Weekly Downloads

11

Version

2.0.1

License

SEE LICENSE IN LICENSE

Unpacked Size

40.2 MB

Total Files

3816

Last publish

Collaborators

  • sybiling