forked from cerc-io/registry-sdk
Parse send tx response and update package version (#8)
Part of https://www.notion.so/Create-laconic-registry-SDK-d3a636d4aba44f7cbba3bd99b7146811 - Parse send tx response in the `sendCoins` method - Add the required proto types and regenerate bindings - Bump minor package version Co-authored-by: neeraj <neeraj.rtly@gmail.com> Reviewed-on: #8 Co-authored-by: Prathamesh Musale <prathamesh@noreply.git.vdb.to> Co-committed-by: Prathamesh Musale <prathamesh@noreply.git.vdb.to>
This commit is contained in:
parent
60aacc6543
commit
409e6d5c6f
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
@ -24,7 +24,7 @@ jobs:
|
||||
- name: Build laconicd container
|
||||
working-directory: laconicd/tests/sdk_tests
|
||||
run: ./build-laconicd-container.sh
|
||||
- name: Build laconic-sdk container
|
||||
- name: Build registry-sdk container
|
||||
run: ./scripts/build-sdk-test-container.sh
|
||||
|
||||
- name: Start containers
|
||||
|
@ -18,7 +18,7 @@ Follow these steps to run the tests:
|
||||
cp .env.example .env
|
||||
```
|
||||
|
||||
- Clone the [laconic2d repo](https://git.vdb.to/deep-stack/laconic2d) and change to repo directory.
|
||||
- Clone the [laconic2d repo](https://git.vdb.to/cerc-io/laconic2d) and change to repo directory.
|
||||
|
||||
- Run the chain using `./scripts/init.sh`.
|
||||
|
||||
|
@ -1,9 +1,9 @@
|
||||
{
|
||||
"name": "@cerc-io/laconic-sdk",
|
||||
"version": "0.1.15",
|
||||
"name": "@cerc-io/registry-sdk",
|
||||
"version": "0.2.0",
|
||||
"main": "dist/index.js",
|
||||
"types": "dist/index.d.ts",
|
||||
"repository": "git@github.com:cerc-io/laconic-sdk.git",
|
||||
"repository": "git@github.com:cerc-io/registry-sdk.git",
|
||||
"author": "",
|
||||
"license": "UNLICENSED",
|
||||
"devDependencies": {
|
||||
|
125
proto/cosmos/bank/v1beta1/bank.proto
Normal file
125
proto/cosmos/bank/v1beta1/bank.proto
Normal file
@ -0,0 +1,125 @@
|
||||
syntax = "proto3";
|
||||
package cosmos.bank.v1beta1;
|
||||
|
||||
import "gogoproto/gogo.proto";
|
||||
import "cosmos_proto/cosmos.proto";
|
||||
import "cosmos/base/v1beta1/coin.proto";
|
||||
import "cosmos/msg/v1/msg.proto";
|
||||
import "amino/amino.proto";
|
||||
|
||||
option go_package = "github.com/cosmos/cosmos-sdk/x/bank/types";
|
||||
|
||||
// Params defines the parameters for the bank module.
|
||||
message Params {
|
||||
option (amino.name) = "cosmos-sdk/x/bank/Params";
|
||||
// Deprecated: Use of SendEnabled in params is deprecated.
|
||||
// For genesis, use the newly added send_enabled field in the genesis object.
|
||||
// Storage, lookup, and manipulation of this information is now in the keeper.
|
||||
//
|
||||
// As of cosmos-sdk 0.47, this only exists for backwards compatibility of genesis files.
|
||||
repeated SendEnabled send_enabled = 1 [deprecated = true];
|
||||
bool default_send_enabled = 2;
|
||||
}
|
||||
|
||||
// SendEnabled maps coin denom to a send_enabled status (whether a denom is
|
||||
// sendable).
|
||||
message SendEnabled {
|
||||
option (gogoproto.equal) = true;
|
||||
string denom = 1;
|
||||
bool enabled = 2;
|
||||
}
|
||||
|
||||
// Input models transaction input.
|
||||
message Input {
|
||||
option (cosmos.msg.v1.signer) = "address";
|
||||
|
||||
option (gogoproto.equal) = false;
|
||||
option (gogoproto.goproto_getters) = false;
|
||||
|
||||
string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
repeated cosmos.base.v1beta1.Coin coins = 2 [
|
||||
(gogoproto.nullable) = false,
|
||||
(amino.dont_omitempty) = true,
|
||||
(amino.encoding) = "legacy_coins",
|
||||
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
|
||||
];
|
||||
}
|
||||
|
||||
// Output models transaction outputs.
|
||||
message Output {
|
||||
option (gogoproto.equal) = false;
|
||||
option (gogoproto.goproto_getters) = false;
|
||||
|
||||
string address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
repeated cosmos.base.v1beta1.Coin coins = 2 [
|
||||
(gogoproto.nullable) = false,
|
||||
(amino.dont_omitempty) = true,
|
||||
(amino.encoding) = "legacy_coins",
|
||||
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
|
||||
];
|
||||
}
|
||||
|
||||
// Supply represents a struct that passively keeps track of the total supply
|
||||
// amounts in the network.
|
||||
// This message is deprecated now that supply is indexed by denom.
|
||||
message Supply {
|
||||
option deprecated = true;
|
||||
|
||||
option (gogoproto.equal) = true;
|
||||
option (gogoproto.goproto_getters) = false;
|
||||
|
||||
option (cosmos_proto.implements_interface) = "cosmos.bank.v1beta1.SupplyI";
|
||||
|
||||
repeated cosmos.base.v1beta1.Coin total = 1 [
|
||||
(gogoproto.nullable) = false,
|
||||
(amino.dont_omitempty) = true,
|
||||
(amino.encoding) = "legacy_coins",
|
||||
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
|
||||
];
|
||||
}
|
||||
|
||||
// DenomUnit represents a struct that describes a given
|
||||
// denomination unit of the basic token.
|
||||
message DenomUnit {
|
||||
// denom represents the string name of the given denom unit (e.g uatom).
|
||||
string denom = 1;
|
||||
// exponent represents power of 10 exponent that one must
|
||||
// raise the base_denom to in order to equal the given DenomUnit's denom
|
||||
// 1 denom = 10^exponent base_denom
|
||||
// (e.g. with a base_denom of uatom, one can create a DenomUnit of 'atom' with
|
||||
// exponent = 6, thus: 1 atom = 10^6 uatom).
|
||||
uint32 exponent = 2;
|
||||
// aliases is a list of string aliases for the given denom
|
||||
repeated string aliases = 3;
|
||||
}
|
||||
|
||||
// Metadata represents a struct that describes
|
||||
// a basic token.
|
||||
message Metadata {
|
||||
string description = 1;
|
||||
// denom_units represents the list of DenomUnit's for a given coin
|
||||
repeated DenomUnit denom_units = 2;
|
||||
// base represents the base denom (should be the DenomUnit with exponent = 0).
|
||||
string base = 3;
|
||||
// display indicates the suggested denom that should be
|
||||
// displayed in clients.
|
||||
string display = 4;
|
||||
// name defines the name of the token (eg: Cosmos Atom)
|
||||
//
|
||||
// Since: cosmos-sdk 0.43
|
||||
string name = 5;
|
||||
// symbol is the token symbol usually shown on exchanges (eg: ATOM). This can
|
||||
// be the same as the display.
|
||||
//
|
||||
// Since: cosmos-sdk 0.43
|
||||
string symbol = 6;
|
||||
// URI to a document (on or off-chain) that contains additional information. Optional.
|
||||
//
|
||||
// Since: cosmos-sdk 0.46
|
||||
string uri = 7 [(gogoproto.customname) = "URI"];
|
||||
// URIHash is a sha256 hash of a document pointed by URI. It's used to verify that
|
||||
// the document didn't change. Optional.
|
||||
//
|
||||
// Since: cosmos-sdk 0.46
|
||||
string uri_hash = 8 [(gogoproto.customname) = "URIHash"];
|
||||
}
|
124
proto/cosmos/bank/v1beta1/tx.proto
Normal file
124
proto/cosmos/bank/v1beta1/tx.proto
Normal file
@ -0,0 +1,124 @@
|
||||
syntax = "proto3";
|
||||
package cosmos.bank.v1beta1;
|
||||
|
||||
import "gogoproto/gogo.proto";
|
||||
import "cosmos/base/v1beta1/coin.proto";
|
||||
import "cosmos/bank/v1beta1/bank.proto";
|
||||
import "cosmos_proto/cosmos.proto";
|
||||
import "cosmos/msg/v1/msg.proto";
|
||||
import "amino/amino.proto";
|
||||
|
||||
option go_package = "github.com/cosmos/cosmos-sdk/x/bank/types";
|
||||
|
||||
// Msg defines the bank Msg service.
|
||||
service Msg {
|
||||
option (cosmos.msg.v1.service) = true;
|
||||
|
||||
// Send defines a method for sending coins from one account to another account.
|
||||
rpc Send(MsgSend) returns (MsgSendResponse);
|
||||
|
||||
// MultiSend defines a method for sending coins from some accounts to other accounts.
|
||||
rpc MultiSend(MsgMultiSend) returns (MsgMultiSendResponse);
|
||||
|
||||
// UpdateParams defines a governance operation for updating the x/bank module parameters.
|
||||
// The authority is defined in the keeper.
|
||||
//
|
||||
// Since: cosmos-sdk 0.47
|
||||
rpc UpdateParams(MsgUpdateParams) returns (MsgUpdateParamsResponse);
|
||||
|
||||
// SetSendEnabled is a governance operation for setting the SendEnabled flag
|
||||
// on any number of Denoms. Only the entries to add or update should be
|
||||
// included. Entries that already exist in the store, but that aren't
|
||||
// included in this message, will be left unchanged.
|
||||
//
|
||||
// Since: cosmos-sdk 0.47
|
||||
rpc SetSendEnabled(MsgSetSendEnabled) returns (MsgSetSendEnabledResponse);
|
||||
}
|
||||
|
||||
// MsgSend represents a message to send coins from one account to another.
|
||||
message MsgSend {
|
||||
option (cosmos.msg.v1.signer) = "from_address";
|
||||
option (amino.name) = "cosmos-sdk/MsgSend";
|
||||
|
||||
option (gogoproto.equal) = false;
|
||||
option (gogoproto.goproto_getters) = false;
|
||||
|
||||
string from_address = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
string to_address = 2 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
repeated cosmos.base.v1beta1.Coin amount = 3 [
|
||||
(gogoproto.nullable) = false,
|
||||
(amino.dont_omitempty) = true,
|
||||
(amino.encoding) = "legacy_coins",
|
||||
(gogoproto.castrepeated) = "github.com/cosmos/cosmos-sdk/types.Coins"
|
||||
];
|
||||
}
|
||||
|
||||
// MsgSendResponse defines the Msg/Send response type.
|
||||
message MsgSendResponse {}
|
||||
|
||||
// MsgMultiSend represents an arbitrary multi-in, multi-out send message.
|
||||
message MsgMultiSend {
|
||||
option (cosmos.msg.v1.signer) = "inputs";
|
||||
option (amino.name) = "cosmos-sdk/MsgMultiSend";
|
||||
|
||||
option (gogoproto.equal) = false;
|
||||
|
||||
// Inputs, despite being `repeated`, only allows one sender input. This is
|
||||
// checked in MsgMultiSend's ValidateBasic.
|
||||
repeated Input inputs = 1 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true];
|
||||
repeated Output outputs = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true];
|
||||
}
|
||||
|
||||
// MsgMultiSendResponse defines the Msg/MultiSend response type.
|
||||
message MsgMultiSendResponse {}
|
||||
|
||||
// MsgUpdateParams is the Msg/UpdateParams request type.
|
||||
//
|
||||
// Since: cosmos-sdk 0.47
|
||||
message MsgUpdateParams {
|
||||
option (cosmos.msg.v1.signer) = "authority";
|
||||
|
||||
// authority is the address that controls the module (defaults to x/gov unless overwritten).
|
||||
string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
option (amino.name) = "cosmos-sdk/x/bank/MsgUpdateParams";
|
||||
|
||||
// params defines the x/bank parameters to update.
|
||||
//
|
||||
// NOTE: All parameters must be supplied.
|
||||
Params params = 2 [(gogoproto.nullable) = false, (amino.dont_omitempty) = true];
|
||||
}
|
||||
|
||||
// MsgUpdateParamsResponse defines the response structure for executing a
|
||||
// MsgUpdateParams message.
|
||||
//
|
||||
// Since: cosmos-sdk 0.47
|
||||
message MsgUpdateParamsResponse {}
|
||||
|
||||
// MsgSetSendEnabled is the Msg/SetSendEnabled request type.
|
||||
//
|
||||
// Only entries to add/update/delete need to be included.
|
||||
// Existing SendEnabled entries that are not included in this
|
||||
// message are left unchanged.
|
||||
//
|
||||
// Since: cosmos-sdk 0.47
|
||||
message MsgSetSendEnabled {
|
||||
option (cosmos.msg.v1.signer) = "authority";
|
||||
option (amino.name) = "cosmos-sdk/MsgSetSendEnabled";
|
||||
|
||||
// authority is the address that controls the module.
|
||||
string authority = 1 [(cosmos_proto.scalar) = "cosmos.AddressString"];
|
||||
|
||||
// send_enabled is the list of entries to add or update.
|
||||
repeated SendEnabled send_enabled = 2;
|
||||
|
||||
// use_default_for is a list of denoms that should use the params.default_send_enabled value.
|
||||
// Denoms listed here will have their SendEnabled entries deleted.
|
||||
// If a denom is included that doesn't have a SendEnabled entry,
|
||||
// it will be ignored.
|
||||
repeated string use_default_for = 3;
|
||||
}
|
||||
|
||||
// MsgSetSendEnabledResponse defines the Msg/SetSendEnabled response type.
|
||||
//
|
||||
// Since: cosmos-sdk 0.47
|
||||
message MsgSetSendEnabledResponse {}
|
@ -16,4 +16,5 @@ protoc \
|
||||
--ts_proto_out=$DEST_TS \
|
||||
--proto_path=$I \
|
||||
--ts_proto_opt="esModuleInterop=true,forceLong=long,useOptionals=messages" \
|
||||
$(find $REPO_ROOT/proto/cerc -iname "*.proto")
|
||||
$(find $REPO_ROOT/proto/cerc $REPO_ROOT/proto/cosmos/bank -type f -iname "*.proto"
|
||||
)
|
||||
|
@ -39,6 +39,7 @@ import {
|
||||
import { LaconicClient } from './laconic-client';
|
||||
import { MsgCancelBondResponse, MsgCreateBondResponse, MsgRefillBondResponse, MsgWithdrawBondResponse } from './proto2/cerc/bond/v1/tx';
|
||||
import { Coin } from './proto2/cosmos/base/v1beta1/coin';
|
||||
import { MsgSendResponse } from './proto2/cosmos/bank/v1beta1/tx';
|
||||
|
||||
export const DEFAULT_CHAIN_ID = 'laconic_9000-1';
|
||||
|
||||
@ -190,8 +191,7 @@ export class Registry {
|
||||
],
|
||||
fee);
|
||||
|
||||
// TODO: Register type /cosmos.bank.v1beta1.MsgSendResponse for decoding response
|
||||
return response;
|
||||
return laconicClient.parseResponse<MsgSendResponse>(response);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -20,6 +20,7 @@ import { Util } from './util';
|
||||
import { NAMESERVICE_ERRORS } from './messages/registry';
|
||||
import { MsgCommitBidResponse, MsgRevealBidResponse } from './proto2/cerc/auction/v1/tx';
|
||||
import { MsgCancelBondResponse, MsgCreateBondResponse, MsgRefillBondResponse, MsgWithdrawBondResponse } from './proto2/cerc/bond/v1/tx';
|
||||
import { bankTypes } from './types/cosmos/bank/message';
|
||||
|
||||
const DEFAULT_WRITE_ERROR = 'Unable to write to laconicd.';
|
||||
|
||||
@ -27,7 +28,8 @@ export const laconicDefaultRegistryTypes: ReadonlyArray<[string, GeneratedType]>
|
||||
...defaultRegistryTypes,
|
||||
...bondTypes,
|
||||
...registryTypes,
|
||||
...auctionTypes
|
||||
...auctionTypes,
|
||||
...bankTypes
|
||||
];
|
||||
|
||||
function createDefaultRegistry (): Registry {
|
||||
|
@ -98,7 +98,7 @@ const namingTests = () => {
|
||||
const mnenonic2 = Account.generateMnemonic();
|
||||
const otherAccount2 = await Account.generateFromMnemonic(mnenonic2);
|
||||
await otherAccount2.init();
|
||||
await registry.sendCoins({ denom: DENOM, amount: '10000', destinationAddress: otherAccount2.address }, otherAccount1.getPrivateKey(), fee);
|
||||
await registry.sendCoins({ denom: DENOM, amount: '1000', destinationAddress: otherAccount2.address }, otherAccount1.getPrivateKey(), fee);
|
||||
|
||||
const subAuthority = `halo.${authorityName}`;
|
||||
await registry.reserveAuthority({ name: subAuthority, owner: otherAccount1.address }, privateKey, fee);
|
||||
@ -289,7 +289,6 @@ const namingTests = () => {
|
||||
await expect(registry.deleteName({ lrn: `lrn://${otherAuthorityName}/app/test` }, privateKey, fee)).rejects.toThrow('Access denied.');
|
||||
});
|
||||
|
||||
// TODO: Check later for empty records
|
||||
test('Lookup non existing name', async () => {
|
||||
const records = await registry.lookupNames(['lrn://not-reserved/app/test']);
|
||||
expect(records).toBeDefined();
|
||||
|
690
src/proto2/cosmos/bank/v1beta1/bank.ts
Normal file
690
src/proto2/cosmos/bank/v1beta1/bank.ts
Normal file
@ -0,0 +1,690 @@
|
||||
/* eslint-disable */
|
||||
import Long from "long";
|
||||
import { Coin } from "../../base/v1beta1/coin";
|
||||
import _m0 from "protobufjs/minimal";
|
||||
|
||||
export const protobufPackage = "cosmos.bank.v1beta1";
|
||||
|
||||
/** Params defines the parameters for the bank module. */
|
||||
export interface Params {
|
||||
/**
|
||||
* Deprecated: Use of SendEnabled in params is deprecated.
|
||||
* For genesis, use the newly added send_enabled field in the genesis object.
|
||||
* Storage, lookup, and manipulation of this information is now in the keeper.
|
||||
*
|
||||
* As of cosmos-sdk 0.47, this only exists for backwards compatibility of genesis files.
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
sendEnabled: SendEnabled[];
|
||||
defaultSendEnabled: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* SendEnabled maps coin denom to a send_enabled status (whether a denom is
|
||||
* sendable).
|
||||
*/
|
||||
export interface SendEnabled {
|
||||
denom: string;
|
||||
enabled: boolean;
|
||||
}
|
||||
|
||||
/** Input models transaction input. */
|
||||
export interface Input {
|
||||
address: string;
|
||||
coins: Coin[];
|
||||
}
|
||||
|
||||
/** Output models transaction outputs. */
|
||||
export interface Output {
|
||||
address: string;
|
||||
coins: Coin[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Supply represents a struct that passively keeps track of the total supply
|
||||
* amounts in the network.
|
||||
* This message is deprecated now that supply is indexed by denom.
|
||||
*
|
||||
* @deprecated
|
||||
*/
|
||||
export interface Supply {
|
||||
total: Coin[];
|
||||
}
|
||||
|
||||
/**
|
||||
* DenomUnit represents a struct that describes a given
|
||||
* denomination unit of the basic token.
|
||||
*/
|
||||
export interface DenomUnit {
|
||||
/** denom represents the string name of the given denom unit (e.g uatom). */
|
||||
denom: string;
|
||||
/**
|
||||
* exponent represents power of 10 exponent that one must
|
||||
* raise the base_denom to in order to equal the given DenomUnit's denom
|
||||
* 1 denom = 10^exponent base_denom
|
||||
* (e.g. with a base_denom of uatom, one can create a DenomUnit of 'atom' with
|
||||
* exponent = 6, thus: 1 atom = 10^6 uatom).
|
||||
*/
|
||||
exponent: number;
|
||||
/** aliases is a list of string aliases for the given denom */
|
||||
aliases: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Metadata represents a struct that describes
|
||||
* a basic token.
|
||||
*/
|
||||
export interface Metadata {
|
||||
description: string;
|
||||
/** denom_units represents the list of DenomUnit's for a given coin */
|
||||
denomUnits: DenomUnit[];
|
||||
/** base represents the base denom (should be the DenomUnit with exponent = 0). */
|
||||
base: string;
|
||||
/**
|
||||
* display indicates the suggested denom that should be
|
||||
* displayed in clients.
|
||||
*/
|
||||
display: string;
|
||||
/**
|
||||
* name defines the name of the token (eg: Cosmos Atom)
|
||||
*
|
||||
* Since: cosmos-sdk 0.43
|
||||
*/
|
||||
name: string;
|
||||
/**
|
||||
* symbol is the token symbol usually shown on exchanges (eg: ATOM). This can
|
||||
* be the same as the display.
|
||||
*
|
||||
* Since: cosmos-sdk 0.43
|
||||
*/
|
||||
symbol: string;
|
||||
/**
|
||||
* URI to a document (on or off-chain) that contains additional information. Optional.
|
||||
*
|
||||
* Since: cosmos-sdk 0.46
|
||||
*/
|
||||
uri: string;
|
||||
/**
|
||||
* URIHash is a sha256 hash of a document pointed by URI. It's used to verify that
|
||||
* the document didn't change. Optional.
|
||||
*
|
||||
* Since: cosmos-sdk 0.46
|
||||
*/
|
||||
uriHash: string;
|
||||
}
|
||||
|
||||
function createBaseParams(): Params {
|
||||
return { sendEnabled: [], defaultSendEnabled: false };
|
||||
}
|
||||
|
||||
export const Params = {
|
||||
encode(
|
||||
message: Params,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
for (const v of message.sendEnabled) {
|
||||
SendEnabled.encode(v!, writer.uint32(10).fork()).ldelim();
|
||||
}
|
||||
if (message.defaultSendEnabled === true) {
|
||||
writer.uint32(16).bool(message.defaultSendEnabled);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: _m0.Reader | Uint8Array, length?: number): Params {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseParams();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.sendEnabled.push(SendEnabled.decode(reader, reader.uint32()));
|
||||
break;
|
||||
case 2:
|
||||
message.defaultSendEnabled = reader.bool();
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Params {
|
||||
return {
|
||||
sendEnabled: Array.isArray(object?.sendEnabled)
|
||||
? object.sendEnabled.map((e: any) => SendEnabled.fromJSON(e))
|
||||
: [],
|
||||
defaultSendEnabled: isSet(object.defaultSendEnabled)
|
||||
? Boolean(object.defaultSendEnabled)
|
||||
: false,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Params): unknown {
|
||||
const obj: any = {};
|
||||
if (message.sendEnabled) {
|
||||
obj.sendEnabled = message.sendEnabled.map((e) =>
|
||||
e ? SendEnabled.toJSON(e) : undefined
|
||||
);
|
||||
} else {
|
||||
obj.sendEnabled = [];
|
||||
}
|
||||
message.defaultSendEnabled !== undefined &&
|
||||
(obj.defaultSendEnabled = message.defaultSendEnabled);
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<Params>, I>>(object: I): Params {
|
||||
const message = createBaseParams();
|
||||
message.sendEnabled =
|
||||
object.sendEnabled?.map((e) => SendEnabled.fromPartial(e)) || [];
|
||||
message.defaultSendEnabled = object.defaultSendEnabled ?? false;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseSendEnabled(): SendEnabled {
|
||||
return { denom: "", enabled: false };
|
||||
}
|
||||
|
||||
export const SendEnabled = {
|
||||
encode(
|
||||
message: SendEnabled,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
if (message.denom !== "") {
|
||||
writer.uint32(10).string(message.denom);
|
||||
}
|
||||
if (message.enabled === true) {
|
||||
writer.uint32(16).bool(message.enabled);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: _m0.Reader | Uint8Array, length?: number): SendEnabled {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseSendEnabled();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.denom = reader.string();
|
||||
break;
|
||||
case 2:
|
||||
message.enabled = reader.bool();
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): SendEnabled {
|
||||
return {
|
||||
denom: isSet(object.denom) ? String(object.denom) : "",
|
||||
enabled: isSet(object.enabled) ? Boolean(object.enabled) : false,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: SendEnabled): unknown {
|
||||
const obj: any = {};
|
||||
message.denom !== undefined && (obj.denom = message.denom);
|
||||
message.enabled !== undefined && (obj.enabled = message.enabled);
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<SendEnabled>, I>>(
|
||||
object: I
|
||||
): SendEnabled {
|
||||
const message = createBaseSendEnabled();
|
||||
message.denom = object.denom ?? "";
|
||||
message.enabled = object.enabled ?? false;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseInput(): Input {
|
||||
return { address: "", coins: [] };
|
||||
}
|
||||
|
||||
export const Input = {
|
||||
encode(message: Input, writer: _m0.Writer = _m0.Writer.create()): _m0.Writer {
|
||||
if (message.address !== "") {
|
||||
writer.uint32(10).string(message.address);
|
||||
}
|
||||
for (const v of message.coins) {
|
||||
Coin.encode(v!, writer.uint32(18).fork()).ldelim();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: _m0.Reader | Uint8Array, length?: number): Input {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseInput();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.address = reader.string();
|
||||
break;
|
||||
case 2:
|
||||
message.coins.push(Coin.decode(reader, reader.uint32()));
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Input {
|
||||
return {
|
||||
address: isSet(object.address) ? String(object.address) : "",
|
||||
coins: Array.isArray(object?.coins)
|
||||
? object.coins.map((e: any) => Coin.fromJSON(e))
|
||||
: [],
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Input): unknown {
|
||||
const obj: any = {};
|
||||
message.address !== undefined && (obj.address = message.address);
|
||||
if (message.coins) {
|
||||
obj.coins = message.coins.map((e) => (e ? Coin.toJSON(e) : undefined));
|
||||
} else {
|
||||
obj.coins = [];
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<Input>, I>>(object: I): Input {
|
||||
const message = createBaseInput();
|
||||
message.address = object.address ?? "";
|
||||
message.coins = object.coins?.map((e) => Coin.fromPartial(e)) || [];
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseOutput(): Output {
|
||||
return { address: "", coins: [] };
|
||||
}
|
||||
|
||||
export const Output = {
|
||||
encode(
|
||||
message: Output,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
if (message.address !== "") {
|
||||
writer.uint32(10).string(message.address);
|
||||
}
|
||||
for (const v of message.coins) {
|
||||
Coin.encode(v!, writer.uint32(18).fork()).ldelim();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: _m0.Reader | Uint8Array, length?: number): Output {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseOutput();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.address = reader.string();
|
||||
break;
|
||||
case 2:
|
||||
message.coins.push(Coin.decode(reader, reader.uint32()));
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Output {
|
||||
return {
|
||||
address: isSet(object.address) ? String(object.address) : "",
|
||||
coins: Array.isArray(object?.coins)
|
||||
? object.coins.map((e: any) => Coin.fromJSON(e))
|
||||
: [],
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Output): unknown {
|
||||
const obj: any = {};
|
||||
message.address !== undefined && (obj.address = message.address);
|
||||
if (message.coins) {
|
||||
obj.coins = message.coins.map((e) => (e ? Coin.toJSON(e) : undefined));
|
||||
} else {
|
||||
obj.coins = [];
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<Output>, I>>(object: I): Output {
|
||||
const message = createBaseOutput();
|
||||
message.address = object.address ?? "";
|
||||
message.coins = object.coins?.map((e) => Coin.fromPartial(e)) || [];
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseSupply(): Supply {
|
||||
return { total: [] };
|
||||
}
|
||||
|
||||
export const Supply = {
|
||||
encode(
|
||||
message: Supply,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
for (const v of message.total) {
|
||||
Coin.encode(v!, writer.uint32(10).fork()).ldelim();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: _m0.Reader | Uint8Array, length?: number): Supply {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseSupply();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.total.push(Coin.decode(reader, reader.uint32()));
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Supply {
|
||||
return {
|
||||
total: Array.isArray(object?.total)
|
||||
? object.total.map((e: any) => Coin.fromJSON(e))
|
||||
: [],
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Supply): unknown {
|
||||
const obj: any = {};
|
||||
if (message.total) {
|
||||
obj.total = message.total.map((e) => (e ? Coin.toJSON(e) : undefined));
|
||||
} else {
|
||||
obj.total = [];
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<Supply>, I>>(object: I): Supply {
|
||||
const message = createBaseSupply();
|
||||
message.total = object.total?.map((e) => Coin.fromPartial(e)) || [];
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseDenomUnit(): DenomUnit {
|
||||
return { denom: "", exponent: 0, aliases: [] };
|
||||
}
|
||||
|
||||
export const DenomUnit = {
|
||||
encode(
|
||||
message: DenomUnit,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
if (message.denom !== "") {
|
||||
writer.uint32(10).string(message.denom);
|
||||
}
|
||||
if (message.exponent !== 0) {
|
||||
writer.uint32(16).uint32(message.exponent);
|
||||
}
|
||||
for (const v of message.aliases) {
|
||||
writer.uint32(26).string(v!);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: _m0.Reader | Uint8Array, length?: number): DenomUnit {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseDenomUnit();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.denom = reader.string();
|
||||
break;
|
||||
case 2:
|
||||
message.exponent = reader.uint32();
|
||||
break;
|
||||
case 3:
|
||||
message.aliases.push(reader.string());
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): DenomUnit {
|
||||
return {
|
||||
denom: isSet(object.denom) ? String(object.denom) : "",
|
||||
exponent: isSet(object.exponent) ? Number(object.exponent) : 0,
|
||||
aliases: Array.isArray(object?.aliases)
|
||||
? object.aliases.map((e: any) => String(e))
|
||||
: [],
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: DenomUnit): unknown {
|
||||
const obj: any = {};
|
||||
message.denom !== undefined && (obj.denom = message.denom);
|
||||
message.exponent !== undefined &&
|
||||
(obj.exponent = Math.round(message.exponent));
|
||||
if (message.aliases) {
|
||||
obj.aliases = message.aliases.map((e) => e);
|
||||
} else {
|
||||
obj.aliases = [];
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<DenomUnit>, I>>(
|
||||
object: I
|
||||
): DenomUnit {
|
||||
const message = createBaseDenomUnit();
|
||||
message.denom = object.denom ?? "";
|
||||
message.exponent = object.exponent ?? 0;
|
||||
message.aliases = object.aliases?.map((e) => e) || [];
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseMetadata(): Metadata {
|
||||
return {
|
||||
description: "",
|
||||
denomUnits: [],
|
||||
base: "",
|
||||
display: "",
|
||||
name: "",
|
||||
symbol: "",
|
||||
uri: "",
|
||||
uriHash: "",
|
||||
};
|
||||
}
|
||||
|
||||
export const Metadata = {
|
||||
encode(
|
||||
message: Metadata,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
if (message.description !== "") {
|
||||
writer.uint32(10).string(message.description);
|
||||
}
|
||||
for (const v of message.denomUnits) {
|
||||
DenomUnit.encode(v!, writer.uint32(18).fork()).ldelim();
|
||||
}
|
||||
if (message.base !== "") {
|
||||
writer.uint32(26).string(message.base);
|
||||
}
|
||||
if (message.display !== "") {
|
||||
writer.uint32(34).string(message.display);
|
||||
}
|
||||
if (message.name !== "") {
|
||||
writer.uint32(42).string(message.name);
|
||||
}
|
||||
if (message.symbol !== "") {
|
||||
writer.uint32(50).string(message.symbol);
|
||||
}
|
||||
if (message.uri !== "") {
|
||||
writer.uint32(58).string(message.uri);
|
||||
}
|
||||
if (message.uriHash !== "") {
|
||||
writer.uint32(66).string(message.uriHash);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: _m0.Reader | Uint8Array, length?: number): Metadata {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseMetadata();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.description = reader.string();
|
||||
break;
|
||||
case 2:
|
||||
message.denomUnits.push(DenomUnit.decode(reader, reader.uint32()));
|
||||
break;
|
||||
case 3:
|
||||
message.base = reader.string();
|
||||
break;
|
||||
case 4:
|
||||
message.display = reader.string();
|
||||
break;
|
||||
case 5:
|
||||
message.name = reader.string();
|
||||
break;
|
||||
case 6:
|
||||
message.symbol = reader.string();
|
||||
break;
|
||||
case 7:
|
||||
message.uri = reader.string();
|
||||
break;
|
||||
case 8:
|
||||
message.uriHash = reader.string();
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): Metadata {
|
||||
return {
|
||||
description: isSet(object.description) ? String(object.description) : "",
|
||||
denomUnits: Array.isArray(object?.denomUnits)
|
||||
? object.denomUnits.map((e: any) => DenomUnit.fromJSON(e))
|
||||
: [],
|
||||
base: isSet(object.base) ? String(object.base) : "",
|
||||
display: isSet(object.display) ? String(object.display) : "",
|
||||
name: isSet(object.name) ? String(object.name) : "",
|
||||
symbol: isSet(object.symbol) ? String(object.symbol) : "",
|
||||
uri: isSet(object.uri) ? String(object.uri) : "",
|
||||
uriHash: isSet(object.uriHash) ? String(object.uriHash) : "",
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: Metadata): unknown {
|
||||
const obj: any = {};
|
||||
message.description !== undefined &&
|
||||
(obj.description = message.description);
|
||||
if (message.denomUnits) {
|
||||
obj.denomUnits = message.denomUnits.map((e) =>
|
||||
e ? DenomUnit.toJSON(e) : undefined
|
||||
);
|
||||
} else {
|
||||
obj.denomUnits = [];
|
||||
}
|
||||
message.base !== undefined && (obj.base = message.base);
|
||||
message.display !== undefined && (obj.display = message.display);
|
||||
message.name !== undefined && (obj.name = message.name);
|
||||
message.symbol !== undefined && (obj.symbol = message.symbol);
|
||||
message.uri !== undefined && (obj.uri = message.uri);
|
||||
message.uriHash !== undefined && (obj.uriHash = message.uriHash);
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<Metadata>, I>>(object: I): Metadata {
|
||||
const message = createBaseMetadata();
|
||||
message.description = object.description ?? "";
|
||||
message.denomUnits =
|
||||
object.denomUnits?.map((e) => DenomUnit.fromPartial(e)) || [];
|
||||
message.base = object.base ?? "";
|
||||
message.display = object.display ?? "";
|
||||
message.name = object.name ?? "";
|
||||
message.symbol = object.symbol ?? "";
|
||||
message.uri = object.uri ?? "";
|
||||
message.uriHash = object.uriHash ?? "";
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
type Builtin =
|
||||
| Date
|
||||
| Function
|
||||
| Uint8Array
|
||||
| string
|
||||
| number
|
||||
| boolean
|
||||
| undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin
|
||||
? T
|
||||
: T extends Long
|
||||
? string | number | Long
|
||||
: T extends Array<infer U>
|
||||
? Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U>
|
||||
? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {}
|
||||
? { [K in keyof T]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
||||
export type Exact<P, I extends P> = P extends Builtin
|
||||
? P
|
||||
: P & { [K in keyof P]: Exact<P[K], I[K]> } & {
|
||||
[K in Exclude<keyof I, KeysOfUnion<P>>]: never;
|
||||
};
|
||||
|
||||
if (_m0.util.Long !== Long) {
|
||||
_m0.util.Long = Long as any;
|
||||
_m0.configure();
|
||||
}
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
702
src/proto2/cosmos/bank/v1beta1/tx.ts
Normal file
702
src/proto2/cosmos/bank/v1beta1/tx.ts
Normal file
@ -0,0 +1,702 @@
|
||||
/* eslint-disable */
|
||||
import { Params, Input, Output, SendEnabled } from "./bank";
|
||||
import Long from "long";
|
||||
import { Coin } from "../../base/v1beta1/coin";
|
||||
import _m0 from "protobufjs/minimal";
|
||||
|
||||
export const protobufPackage = "cosmos.bank.v1beta1";
|
||||
|
||||
/** MsgSend represents a message to send coins from one account to another. */
|
||||
export interface MsgSend {
|
||||
fromAddress: string;
|
||||
toAddress: string;
|
||||
amount: Coin[];
|
||||
}
|
||||
|
||||
/** MsgSendResponse defines the Msg/Send response type. */
|
||||
export interface MsgSendResponse {}
|
||||
|
||||
/** MsgMultiSend represents an arbitrary multi-in, multi-out send message. */
|
||||
export interface MsgMultiSend {
|
||||
/**
|
||||
* Inputs, despite being `repeated`, only allows one sender input. This is
|
||||
* checked in MsgMultiSend's ValidateBasic.
|
||||
*/
|
||||
inputs: Input[];
|
||||
outputs: Output[];
|
||||
}
|
||||
|
||||
/** MsgMultiSendResponse defines the Msg/MultiSend response type. */
|
||||
export interface MsgMultiSendResponse {}
|
||||
|
||||
/**
|
||||
* MsgUpdateParams is the Msg/UpdateParams request type.
|
||||
*
|
||||
* Since: cosmos-sdk 0.47
|
||||
*/
|
||||
export interface MsgUpdateParams {
|
||||
/** authority is the address that controls the module (defaults to x/gov unless overwritten). */
|
||||
authority: string;
|
||||
/**
|
||||
* params defines the x/bank parameters to update.
|
||||
*
|
||||
* NOTE: All parameters must be supplied.
|
||||
*/
|
||||
params?: Params;
|
||||
}
|
||||
|
||||
/**
|
||||
* MsgUpdateParamsResponse defines the response structure for executing a
|
||||
* MsgUpdateParams message.
|
||||
*
|
||||
* Since: cosmos-sdk 0.47
|
||||
*/
|
||||
export interface MsgUpdateParamsResponse {}
|
||||
|
||||
/**
|
||||
* MsgSetSendEnabled is the Msg/SetSendEnabled request type.
|
||||
*
|
||||
* Only entries to add/update/delete need to be included.
|
||||
* Existing SendEnabled entries that are not included in this
|
||||
* message are left unchanged.
|
||||
*
|
||||
* Since: cosmos-sdk 0.47
|
||||
*/
|
||||
export interface MsgSetSendEnabled {
|
||||
/** authority is the address that controls the module. */
|
||||
authority: string;
|
||||
/** send_enabled is the list of entries to add or update. */
|
||||
sendEnabled: SendEnabled[];
|
||||
/**
|
||||
* use_default_for is a list of denoms that should use the params.default_send_enabled value.
|
||||
* Denoms listed here will have their SendEnabled entries deleted.
|
||||
* If a denom is included that doesn't have a SendEnabled entry,
|
||||
* it will be ignored.
|
||||
*/
|
||||
useDefaultFor: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* MsgSetSendEnabledResponse defines the Msg/SetSendEnabled response type.
|
||||
*
|
||||
* Since: cosmos-sdk 0.47
|
||||
*/
|
||||
export interface MsgSetSendEnabledResponse {}
|
||||
|
||||
function createBaseMsgSend(): MsgSend {
|
||||
return { fromAddress: "", toAddress: "", amount: [] };
|
||||
}
|
||||
|
||||
export const MsgSend = {
|
||||
encode(
|
||||
message: MsgSend,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
if (message.fromAddress !== "") {
|
||||
writer.uint32(10).string(message.fromAddress);
|
||||
}
|
||||
if (message.toAddress !== "") {
|
||||
writer.uint32(18).string(message.toAddress);
|
||||
}
|
||||
for (const v of message.amount) {
|
||||
Coin.encode(v!, writer.uint32(26).fork()).ldelim();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: _m0.Reader | Uint8Array, length?: number): MsgSend {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseMsgSend();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.fromAddress = reader.string();
|
||||
break;
|
||||
case 2:
|
||||
message.toAddress = reader.string();
|
||||
break;
|
||||
case 3:
|
||||
message.amount.push(Coin.decode(reader, reader.uint32()));
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): MsgSend {
|
||||
return {
|
||||
fromAddress: isSet(object.fromAddress) ? String(object.fromAddress) : "",
|
||||
toAddress: isSet(object.toAddress) ? String(object.toAddress) : "",
|
||||
amount: Array.isArray(object?.amount)
|
||||
? object.amount.map((e: any) => Coin.fromJSON(e))
|
||||
: [],
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: MsgSend): unknown {
|
||||
const obj: any = {};
|
||||
message.fromAddress !== undefined &&
|
||||
(obj.fromAddress = message.fromAddress);
|
||||
message.toAddress !== undefined && (obj.toAddress = message.toAddress);
|
||||
if (message.amount) {
|
||||
obj.amount = message.amount.map((e) => (e ? Coin.toJSON(e) : undefined));
|
||||
} else {
|
||||
obj.amount = [];
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<MsgSend>, I>>(object: I): MsgSend {
|
||||
const message = createBaseMsgSend();
|
||||
message.fromAddress = object.fromAddress ?? "";
|
||||
message.toAddress = object.toAddress ?? "";
|
||||
message.amount = object.amount?.map((e) => Coin.fromPartial(e)) || [];
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseMsgSendResponse(): MsgSendResponse {
|
||||
return {};
|
||||
}
|
||||
|
||||
export const MsgSendResponse = {
|
||||
encode(
|
||||
_: MsgSendResponse,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: _m0.Reader | Uint8Array, length?: number): MsgSendResponse {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseMsgSendResponse();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(_: any): MsgSendResponse {
|
||||
return {};
|
||||
},
|
||||
|
||||
toJSON(_: MsgSendResponse): unknown {
|
||||
const obj: any = {};
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<MsgSendResponse>, I>>(
|
||||
_: I
|
||||
): MsgSendResponse {
|
||||
const message = createBaseMsgSendResponse();
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseMsgMultiSend(): MsgMultiSend {
|
||||
return { inputs: [], outputs: [] };
|
||||
}
|
||||
|
||||
export const MsgMultiSend = {
|
||||
encode(
|
||||
message: MsgMultiSend,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
for (const v of message.inputs) {
|
||||
Input.encode(v!, writer.uint32(10).fork()).ldelim();
|
||||
}
|
||||
for (const v of message.outputs) {
|
||||
Output.encode(v!, writer.uint32(18).fork()).ldelim();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: _m0.Reader | Uint8Array, length?: number): MsgMultiSend {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseMsgMultiSend();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.inputs.push(Input.decode(reader, reader.uint32()));
|
||||
break;
|
||||
case 2:
|
||||
message.outputs.push(Output.decode(reader, reader.uint32()));
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): MsgMultiSend {
|
||||
return {
|
||||
inputs: Array.isArray(object?.inputs)
|
||||
? object.inputs.map((e: any) => Input.fromJSON(e))
|
||||
: [],
|
||||
outputs: Array.isArray(object?.outputs)
|
||||
? object.outputs.map((e: any) => Output.fromJSON(e))
|
||||
: [],
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: MsgMultiSend): unknown {
|
||||
const obj: any = {};
|
||||
if (message.inputs) {
|
||||
obj.inputs = message.inputs.map((e) => (e ? Input.toJSON(e) : undefined));
|
||||
} else {
|
||||
obj.inputs = [];
|
||||
}
|
||||
if (message.outputs) {
|
||||
obj.outputs = message.outputs.map((e) =>
|
||||
e ? Output.toJSON(e) : undefined
|
||||
);
|
||||
} else {
|
||||
obj.outputs = [];
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<MsgMultiSend>, I>>(
|
||||
object: I
|
||||
): MsgMultiSend {
|
||||
const message = createBaseMsgMultiSend();
|
||||
message.inputs = object.inputs?.map((e) => Input.fromPartial(e)) || [];
|
||||
message.outputs = object.outputs?.map((e) => Output.fromPartial(e)) || [];
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseMsgMultiSendResponse(): MsgMultiSendResponse {
|
||||
return {};
|
||||
}
|
||||
|
||||
export const MsgMultiSendResponse = {
|
||||
encode(
|
||||
_: MsgMultiSendResponse,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(
|
||||
input: _m0.Reader | Uint8Array,
|
||||
length?: number
|
||||
): MsgMultiSendResponse {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseMsgMultiSendResponse();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(_: any): MsgMultiSendResponse {
|
||||
return {};
|
||||
},
|
||||
|
||||
toJSON(_: MsgMultiSendResponse): unknown {
|
||||
const obj: any = {};
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<MsgMultiSendResponse>, I>>(
|
||||
_: I
|
||||
): MsgMultiSendResponse {
|
||||
const message = createBaseMsgMultiSendResponse();
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseMsgUpdateParams(): MsgUpdateParams {
|
||||
return { authority: "", params: undefined };
|
||||
}
|
||||
|
||||
export const MsgUpdateParams = {
|
||||
encode(
|
||||
message: MsgUpdateParams,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
if (message.authority !== "") {
|
||||
writer.uint32(10).string(message.authority);
|
||||
}
|
||||
if (message.params !== undefined) {
|
||||
Params.encode(message.params, writer.uint32(18).fork()).ldelim();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: _m0.Reader | Uint8Array, length?: number): MsgUpdateParams {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseMsgUpdateParams();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.authority = reader.string();
|
||||
break;
|
||||
case 2:
|
||||
message.params = Params.decode(reader, reader.uint32());
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): MsgUpdateParams {
|
||||
return {
|
||||
authority: isSet(object.authority) ? String(object.authority) : "",
|
||||
params: isSet(object.params) ? Params.fromJSON(object.params) : undefined,
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: MsgUpdateParams): unknown {
|
||||
const obj: any = {};
|
||||
message.authority !== undefined && (obj.authority = message.authority);
|
||||
message.params !== undefined &&
|
||||
(obj.params = message.params ? Params.toJSON(message.params) : undefined);
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<MsgUpdateParams>, I>>(
|
||||
object: I
|
||||
): MsgUpdateParams {
|
||||
const message = createBaseMsgUpdateParams();
|
||||
message.authority = object.authority ?? "";
|
||||
message.params =
|
||||
object.params !== undefined && object.params !== null
|
||||
? Params.fromPartial(object.params)
|
||||
: undefined;
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseMsgUpdateParamsResponse(): MsgUpdateParamsResponse {
|
||||
return {};
|
||||
}
|
||||
|
||||
export const MsgUpdateParamsResponse = {
|
||||
encode(
|
||||
_: MsgUpdateParamsResponse,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(
|
||||
input: _m0.Reader | Uint8Array,
|
||||
length?: number
|
||||
): MsgUpdateParamsResponse {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseMsgUpdateParamsResponse();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(_: any): MsgUpdateParamsResponse {
|
||||
return {};
|
||||
},
|
||||
|
||||
toJSON(_: MsgUpdateParamsResponse): unknown {
|
||||
const obj: any = {};
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<MsgUpdateParamsResponse>, I>>(
|
||||
_: I
|
||||
): MsgUpdateParamsResponse {
|
||||
const message = createBaseMsgUpdateParamsResponse();
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseMsgSetSendEnabled(): MsgSetSendEnabled {
|
||||
return { authority: "", sendEnabled: [], useDefaultFor: [] };
|
||||
}
|
||||
|
||||
export const MsgSetSendEnabled = {
|
||||
encode(
|
||||
message: MsgSetSendEnabled,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
if (message.authority !== "") {
|
||||
writer.uint32(10).string(message.authority);
|
||||
}
|
||||
for (const v of message.sendEnabled) {
|
||||
SendEnabled.encode(v!, writer.uint32(18).fork()).ldelim();
|
||||
}
|
||||
for (const v of message.useDefaultFor) {
|
||||
writer.uint32(26).string(v!);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(input: _m0.Reader | Uint8Array, length?: number): MsgSetSendEnabled {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseMsgSetSendEnabled();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.authority = reader.string();
|
||||
break;
|
||||
case 2:
|
||||
message.sendEnabled.push(SendEnabled.decode(reader, reader.uint32()));
|
||||
break;
|
||||
case 3:
|
||||
message.useDefaultFor.push(reader.string());
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(object: any): MsgSetSendEnabled {
|
||||
return {
|
||||
authority: isSet(object.authority) ? String(object.authority) : "",
|
||||
sendEnabled: Array.isArray(object?.sendEnabled)
|
||||
? object.sendEnabled.map((e: any) => SendEnabled.fromJSON(e))
|
||||
: [],
|
||||
useDefaultFor: Array.isArray(object?.useDefaultFor)
|
||||
? object.useDefaultFor.map((e: any) => String(e))
|
||||
: [],
|
||||
};
|
||||
},
|
||||
|
||||
toJSON(message: MsgSetSendEnabled): unknown {
|
||||
const obj: any = {};
|
||||
message.authority !== undefined && (obj.authority = message.authority);
|
||||
if (message.sendEnabled) {
|
||||
obj.sendEnabled = message.sendEnabled.map((e) =>
|
||||
e ? SendEnabled.toJSON(e) : undefined
|
||||
);
|
||||
} else {
|
||||
obj.sendEnabled = [];
|
||||
}
|
||||
if (message.useDefaultFor) {
|
||||
obj.useDefaultFor = message.useDefaultFor.map((e) => e);
|
||||
} else {
|
||||
obj.useDefaultFor = [];
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<MsgSetSendEnabled>, I>>(
|
||||
object: I
|
||||
): MsgSetSendEnabled {
|
||||
const message = createBaseMsgSetSendEnabled();
|
||||
message.authority = object.authority ?? "";
|
||||
message.sendEnabled =
|
||||
object.sendEnabled?.map((e) => SendEnabled.fromPartial(e)) || [];
|
||||
message.useDefaultFor = object.useDefaultFor?.map((e) => e) || [];
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
function createBaseMsgSetSendEnabledResponse(): MsgSetSendEnabledResponse {
|
||||
return {};
|
||||
}
|
||||
|
||||
export const MsgSetSendEnabledResponse = {
|
||||
encode(
|
||||
_: MsgSetSendEnabledResponse,
|
||||
writer: _m0.Writer = _m0.Writer.create()
|
||||
): _m0.Writer {
|
||||
return writer;
|
||||
},
|
||||
|
||||
decode(
|
||||
input: _m0.Reader | Uint8Array,
|
||||
length?: number
|
||||
): MsgSetSendEnabledResponse {
|
||||
const reader = input instanceof _m0.Reader ? input : new _m0.Reader(input);
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = createBaseMsgSetSendEnabledResponse();
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
|
||||
fromJSON(_: any): MsgSetSendEnabledResponse {
|
||||
return {};
|
||||
},
|
||||
|
||||
toJSON(_: MsgSetSendEnabledResponse): unknown {
|
||||
const obj: any = {};
|
||||
return obj;
|
||||
},
|
||||
|
||||
fromPartial<I extends Exact<DeepPartial<MsgSetSendEnabledResponse>, I>>(
|
||||
_: I
|
||||
): MsgSetSendEnabledResponse {
|
||||
const message = createBaseMsgSetSendEnabledResponse();
|
||||
return message;
|
||||
},
|
||||
};
|
||||
|
||||
/** Msg defines the bank Msg service. */
|
||||
export interface Msg {
|
||||
/** Send defines a method for sending coins from one account to another account. */
|
||||
Send(request: MsgSend): Promise<MsgSendResponse>;
|
||||
/** MultiSend defines a method for sending coins from some accounts to other accounts. */
|
||||
MultiSend(request: MsgMultiSend): Promise<MsgMultiSendResponse>;
|
||||
/**
|
||||
* UpdateParams defines a governance operation for updating the x/bank module parameters.
|
||||
* The authority is defined in the keeper.
|
||||
*
|
||||
* Since: cosmos-sdk 0.47
|
||||
*/
|
||||
UpdateParams(request: MsgUpdateParams): Promise<MsgUpdateParamsResponse>;
|
||||
/**
|
||||
* SetSendEnabled is a governance operation for setting the SendEnabled flag
|
||||
* on any number of Denoms. Only the entries to add or update should be
|
||||
* included. Entries that already exist in the store, but that aren't
|
||||
* included in this message, will be left unchanged.
|
||||
*
|
||||
* Since: cosmos-sdk 0.47
|
||||
*/
|
||||
SetSendEnabled(
|
||||
request: MsgSetSendEnabled
|
||||
): Promise<MsgSetSendEnabledResponse>;
|
||||
}
|
||||
|
||||
export class MsgClientImpl implements Msg {
|
||||
private readonly rpc: Rpc;
|
||||
constructor(rpc: Rpc) {
|
||||
this.rpc = rpc;
|
||||
this.Send = this.Send.bind(this);
|
||||
this.MultiSend = this.MultiSend.bind(this);
|
||||
this.UpdateParams = this.UpdateParams.bind(this);
|
||||
this.SetSendEnabled = this.SetSendEnabled.bind(this);
|
||||
}
|
||||
Send(request: MsgSend): Promise<MsgSendResponse> {
|
||||
const data = MsgSend.encode(request).finish();
|
||||
const promise = this.rpc.request("cosmos.bank.v1beta1.Msg", "Send", data);
|
||||
return promise.then((data) => MsgSendResponse.decode(new _m0.Reader(data)));
|
||||
}
|
||||
|
||||
MultiSend(request: MsgMultiSend): Promise<MsgMultiSendResponse> {
|
||||
const data = MsgMultiSend.encode(request).finish();
|
||||
const promise = this.rpc.request(
|
||||
"cosmos.bank.v1beta1.Msg",
|
||||
"MultiSend",
|
||||
data
|
||||
);
|
||||
return promise.then((data) =>
|
||||
MsgMultiSendResponse.decode(new _m0.Reader(data))
|
||||
);
|
||||
}
|
||||
|
||||
UpdateParams(request: MsgUpdateParams): Promise<MsgUpdateParamsResponse> {
|
||||
const data = MsgUpdateParams.encode(request).finish();
|
||||
const promise = this.rpc.request(
|
||||
"cosmos.bank.v1beta1.Msg",
|
||||
"UpdateParams",
|
||||
data
|
||||
);
|
||||
return promise.then((data) =>
|
||||
MsgUpdateParamsResponse.decode(new _m0.Reader(data))
|
||||
);
|
||||
}
|
||||
|
||||
SetSendEnabled(
|
||||
request: MsgSetSendEnabled
|
||||
): Promise<MsgSetSendEnabledResponse> {
|
||||
const data = MsgSetSendEnabled.encode(request).finish();
|
||||
const promise = this.rpc.request(
|
||||
"cosmos.bank.v1beta1.Msg",
|
||||
"SetSendEnabled",
|
||||
data
|
||||
);
|
||||
return promise.then((data) =>
|
||||
MsgSetSendEnabledResponse.decode(new _m0.Reader(data))
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
interface Rpc {
|
||||
request(
|
||||
service: string,
|
||||
method: string,
|
||||
data: Uint8Array
|
||||
): Promise<Uint8Array>;
|
||||
}
|
||||
|
||||
type Builtin =
|
||||
| Date
|
||||
| Function
|
||||
| Uint8Array
|
||||
| string
|
||||
| number
|
||||
| boolean
|
||||
| undefined;
|
||||
|
||||
export type DeepPartial<T> = T extends Builtin
|
||||
? T
|
||||
: T extends Long
|
||||
? string | number | Long
|
||||
: T extends Array<infer U>
|
||||
? Array<DeepPartial<U>>
|
||||
: T extends ReadonlyArray<infer U>
|
||||
? ReadonlyArray<DeepPartial<U>>
|
||||
: T extends {}
|
||||
? { [K in keyof T]?: DeepPartial<T[K]> }
|
||||
: Partial<T>;
|
||||
|
||||
type KeysOfUnion<T> = T extends T ? keyof T : never;
|
||||
export type Exact<P, I extends P> = P extends Builtin
|
||||
? P
|
||||
: P & { [K in keyof P]: Exact<P[K], I[K]> } & {
|
||||
[K in Exclude<keyof I, KeysOfUnion<P>>]: never;
|
||||
};
|
||||
|
||||
if (_m0.util.Long !== Long) {
|
||||
_m0.util.Long = Long as any;
|
||||
_m0.configure();
|
||||
}
|
||||
|
||||
function isSet(value: any): boolean {
|
||||
return value !== null && value !== undefined;
|
||||
}
|
@ -36,8 +36,7 @@ describe('Querying', () => {
|
||||
expect(registry.chainID).toBe(chainId);
|
||||
});
|
||||
|
||||
// TODO: Unskip
|
||||
xtest('Get status.', async () => {
|
||||
test('Get status.', async () => {
|
||||
const status = await registry.getStatus();
|
||||
expect(status).toBeDefined();
|
||||
expect(status.version).toBeDefined();
|
||||
|
11
src/types/cosmos/bank/message.ts
Normal file
11
src/types/cosmos/bank/message.ts
Normal file
@ -0,0 +1,11 @@
|
||||
import { GeneratedType } from '@cosmjs/proto-signing';
|
||||
|
||||
import {
|
||||
MsgSendResponse
|
||||
} from '../../../proto2/cosmos/bank/v1beta1/tx';
|
||||
|
||||
export const typeUrlMsgSendResponse = '/cosmos.bank.v1beta1.MsgSendResponse';
|
||||
|
||||
export const bankTypes: ReadonlyArray<[string, GeneratedType]> = [
|
||||
[typeUrlMsgSendResponse, MsgSendResponse]
|
||||
];
|
Loading…
Reference in New Issue
Block a user