{"id":19259309,"url":"https://github.com/hyperweb-io/interchain-js-query","last_synced_at":"2025-04-21T16:30:53.905Z","repository":{"id":57686874,"uuid":"520141837","full_name":"hyperweb-io/interchain-js-query","owner":"hyperweb-io","description":"Interchain makes it easy to compose and broadcast Cosmos messages, with all of the proto and amino encoding handled for you ⚛️","archived":false,"fork":false,"pushed_at":"2023-08-08T19:04:16.000Z","size":3353,"stargazers_count":3,"open_issues_count":1,"forks_count":3,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-04-01T14:21:16.485Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/hyperweb-io.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-08-01T14:24:36.000Z","updated_at":"2025-01-18T00:50:25.000Z","dependencies_parsed_at":"2024-11-09T19:16:04.833Z","dependency_job_id":"734fb34b-ceeb-4215-93db-f2bdffd7dadb","html_url":"https://github.com/hyperweb-io/interchain-js-query","commit_stats":null,"previous_names":["cosmology-tech/interchain-js-query","hyperweb-io/interchain-js-query"],"tags_count":24,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperweb-io%2Finterchain-js-query","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperweb-io%2Finterchain-js-query/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperweb-io%2Finterchain-js-query/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/hyperweb-io%2Finterchain-js-query/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/hyperweb-io","download_url":"https://codeload.github.com/hyperweb-io/interchain-js-query/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250090709,"owners_count":21373239,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-09T19:16:04.934Z","updated_at":"2025-04-21T16:30:53.280Z","avatar_url":"https://github.com/hyperweb-io.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# interchain\n\n\u003cp align=\"center\"\u003e\n  \u003ca href=\"https://github.com/cosmology-tech/interchain\"\u003e\n    \u003cimg width=\"150\" src=\"https://user-images.githubusercontent.com/545047/186588059-736cc25a-c849-4c30-a2d6-f779bcb6e305.svg\"\u003e\n  \u003c/a\u003e\n\u003c/p\u003e\n\n\u003cp align=\"center\" width=\"100%\"\u003e\n   \u003ca href=\"https://github.com/cosmology-tech/interchain/blob/main/LICENSE\"\u003e\u003cimg height=\"20\" src=\"https://img.shields.io/badge/license-MIT-blue.svg\"\u003e\u003c/a\u003e\n   \u003ca href=\"https://www.npmjs.com/package/interchain\"\u003e\u003cimg height=\"20\" src=\"https://img.shields.io/github/package-json/v/cosmology-tech/interchain?filename=package.json\"\u003e\u003c/a\u003e\n\u003c/p\u003e\n\n[interchain](https://github.com/cosmology-tech/interchain) makes it easy to compose and broadcast Cosmos messages, with all of the proto and amino encoding handled for you.\n\n## usage\n\n```sh\nnpm install interchain\n```\n\n### Cosmos Messages\n\n```js\nimport { cosmos } from 'interchain';\n\nconst {\n    fundCommunityPool,\n    setWithdrawAddress,\n    withdrawDelegatorReward,\n    withdrawValidatorCommission\n} = cosmos.distribution.v1beta1.MessageComposer.fromPartial;\n\nconst {\n    multiSend,\n    send\n} = cosmos.bank.v1beta1.MessageComposer.fromPartial;\n\nconst {\n    beginRedelegate,\n    createValidator,\n    delegate,\n    editValidator,\n    undelegate\n} = cosmos.staking.v1beta1.MessageComposer.fromPartial;\n\nconst {\n    deposit,\n    submitProposal,\n    vote,\n    voteWeighted\n} = cosmos.gov.v1beta1.MessageComposer.fromPartial;\n```\n\n### CosmWasm Messages\n\n```js\nimport { cosmwasm } from \"interchain\";\n\nconst {\n    clearAdmin,\n    executeContract,\n    instantiateContract,\n    migrateContract,\n    storeCode,\n    updateAdmin\n} = cosmwasm.wasm.v1.MessageComposer.withTypeUrl;\n```\n\n### IBC Messages\n\n```js\nimport { ibc } from 'interchain';\n\nconst {\n    transfer\n} = ibc.applications.transfer.v1.MessageComposer.withTypeUrl\n```\n\n### Initializing the Stargate Client\n\nUse `getSigningCosmosClient` to get your `SigningStargateClient`, with the Cosmos proto/amino messages full-loaded. No need to manually add amino types, just require and initialize the client:\n\n```js\nimport { getSigningCosmosClient } from 'interchain';\n\nconst client = await getSigningCosmosClient({\n  rpcEndpoint,\n  signer // OfflineSigner\n});\n```\n\n### Stargate Client Options\n\nIf you need the options in scenarios where you're using tools like [cosmos-kit](https://github.com/cosmology-tech/cosmos-kit), you can get the options to pass into the provider:\n\n```js\nimport { getSigningCosmosClientOptions } from 'interchain';\n```\n\n## Creating Signers\n\nTo broadcast messages, you can create signers with a variety of options:\n\n* [cosmos-kit](https://github.com/cosmology-tech/cosmos-kit/tree/main/packages/react#signing-clients) (recommended)\n* [keplr](https://docs.keplr.app/api/cosmjs.html)\n* [cosmjs](https://gist.github.com/webmaster128/8444d42a7eceeda2544c8a59fbd7e1d9)\n### Cosmos Kit\n\nWe recommend using [cosmos-kit](https://github.com/cosmology-tech/cosmos-kit/tree/main/packages/react#signing-clients) for creating signers that work with Keplr and other wallets.\n\n### Amino Signer\n\nLikely you'll want to use the Amino, so unless you need proto, you should use this one:\n\n```js\nimport { getOfflineSignerAmino as getOfflineSigner } from 'cosmjs-utils';\n```\n### Proto Signer\n\n```js\nimport { getOfflineSignerProto as getOfflineSigner } from 'cosmjs-utils';\n```\n\nWARNING: NOT RECOMMENDED TO USE PLAIN-TEXT MNEMONICS. Please take care of your security and use best practices such as AES encryption and/or methods from 12factor applications.\n\n```js\nimport { chains } from 'chain-registry';\n\nconst mnemonic =\n  'unfold client turtle either pilot stock floor glow toward bullet car science';\n  const chain = chains.find(({ chain_name }) =\u003e chain_name === 'cosmoshub');\n  const signer = await getOfflineSigner({\n    mnemonic,\n    chain\n  });\n```\n### Broadcasting messages\n\nNow that you have your `client`, you can broadcast messages:\n\n```js\nimport { signAndBroadcast } from 'cosmjs-utils';\n\nconst res = await signAndBroadcast({\n  client, // SigningStargateClient\n  chainId: 'cosmoshub-4',\n  address,\n  msgs: [msg],\n  fee,\n  memo: ''\n});\n```\n\n## Credits\n\nBuilt by Cosmology — if you like our tools, please consider delegating to [our validator ⚛️](https://cosmology.tech/validator)\n\nCode built with the help of these related projects:\n\n* [@cosmology/telescope](https://github.com/cosmology-tech/telescope) a \"babel for the Cosmos\", Telescope is a TypeScript Transpiler for Cosmos Protobufs.\n* [cosmos-kit](https://github.com/cosmology-tech/cosmos-kit) A wallet connector for the Cosmos ⚛️\n\n## Disclaimer\n\nAS DESCRIBED IN THE LICENSES, THE SOFTWARE IS PROVIDED “AS IS”, AT YOUR OWN RISK, AND WITHOUT WARRANTIES OF ANY KIND.\n\nNo developer or entity involved in creating this software will be liable for any claims or damages whatsoever associated with your use, inability to use, or your interaction with other users of the code, including any direct, indirect, incidental, special, exemplary, punitive or consequential damages, or loss of profits, cryptocurrencies, tokens, or anything else of value.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyperweb-io%2Finterchain-js-query","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhyperweb-io%2Finterchain-js-query","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhyperweb-io%2Finterchain-js-query/lists"}