
Product
Introducing Socket Firewall Enterprise: Flexible, Configurable Protection for Modern Package Ecosystems
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.
@agoric/cosmic-proto
Advanced tools
Protobuf interfaces for Agoric on Cosmos
npm install @agoric/cosmic-proto
TODO #9200
Import the agoric object from the Agoric bundle.
import { agoric } from '@agoric/cosmic-proto/agoric/bundle.js';
const {
installBundle,
} = agoric.swingset.MessageComposer.withTypeUrl;
⚡️ For web interfaces, we recommend using cosmos-kit. Continue below to see how to manually construct signers and clients.
Here are the docs on creating signers in cosmos-kit that can be used with Keplr and other wallets.
To broadcast messages, you can create signers with a variety of options:
Likely you'll want to use the Amino, so unless you need proto, you should use this one:
import { getOfflineSignerAmino as getOfflineSigner } from 'cosmjs-utils';
import { getOfflineSignerProto as getOfflineSigner } from 'cosmjs-utils';
WARNING: 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.
import { chains } from 'chain-registry';
const mnemonic =
'unfold client turtle either pilot stock floor glow toward bullet car science';
const chain = chains.find(({ chain_name }) => chain_name === 'agoric');
const signer = await getOfflineSigner({
mnemonic,
chain
});
Now that you have your stargateClient, you can broadcast messages:
const { send } = cosmos.bank.v1beta1.MessageComposer.withTypeUrl;
const msg = send({
amount: [
{
denom: 'coin',
amount: '1000'
}
],
toAddress: address,
fromAddress: address
});
const fee: StdFee = {
amount: [
{
denom: 'coin',
amount: '864'
}
],
gas: '86364'
};
const response = await stargateClient.signAndBroadcast(address, [msg], fee);
If you want to manually construct a stargate client
import { OfflineSigner, GeneratedType, Registry } from "@cosmjs/proto-signing";
import { AminoTypes, SigningStargateClient } from "@cosmjs/stargate";
import {
cosmosAminoConverters,
cosmosProtoRegistry,
ibcProtoRegistry,
ibcAminoConverters,
agoricAminoConverters,
agoricProtoRegistry
} from '@agoric/cosmic-proto';
const signer: OfflineSigner = /* create your signer (see above) */
const rpcEndpint = 'https://rpc.cosmos.directory/agoric'; // or another URL
const protoRegistry: ReadonlyArray<[string, GeneratedType]> = [
...cosmosProtoRegistry,
...ibcProtoRegistry,
...agoricProtoRegistry
];
const aminoConverters = {
...cosmosAminoConverters,
...ibcAminoConverters,
...agoricAminoConverters
};
const registry = new Registry(protoRegistry);
const aminoTypes = new AminoTypes(aminoConverters);
const stargateClient = await SigningStargateClient.connectWithSigner(rpcEndpoint, signer, {
registry,
aminoTypes
});
When first cloning the repo:
yarn
yarn build
For very basic unit tests:
yarn test
To test with a real network,
yarn test:live
Protos live in ./proto. Look inside of scripts/codegen.cjs and configure the settings for bundling your SDK into @agoric/cosmic-proto:
yarn codegen
Build the types and then publish:
yarn build
yarn publish
Checkout these related projects:
FAQs
Protobuf stubs for the Agoric cosmos-sdk module
The npm package @agoric/cosmic-proto receives a total of 8,943 weekly downloads. As such, @agoric/cosmic-proto popularity was classified as popular.
We found that @agoric/cosmic-proto demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 10 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Product
Socket Firewall Enterprise is now available with flexible deployment, configurable policies, and expanded language support.

Security News
Open source dashboard CNAPulse tracks CVE Numbering Authorities’ publishing activity, highlighting trends and transparency across the CVE ecosystem.

Product
Detect malware, unsafe data flows, and license issues in GitHub Actions with Socket’s new workflow scanning support.