wormchain: update ts sdk

This commit is contained in:
Evan Gray 2023-01-24 22:26:33 +00:00 committed by Evan Gray
parent 145ba6df0f
commit a9373d54fa
85 changed files with 18003 additions and 559 deletions

View File

@ -6,10 +6,11 @@ const { execSync } = require("child_process");
const fs = require("fs");
const path = require("path");
const CERTUS_DIRECTORY = "../vue/src/store/generated/wormhole-foundation/wormchain/";
const CERTUS_DIRECTORY =
"../vue/src/store/generated/wormhole-foundation/wormchain/";
const COSMOS_DIRECTORY = "../vue/src/store/generated/cosmos/cosmos-sdk/";
const WASMD_DIRECTORY = "../vue/src/store/generated/CosmWasm/wasmd/";
const MODULE_DIRECTORY = "../ts-sdk/src/modules/";
const VUE_DIRECTORY = "../vue";
function execWrapper(command) {
execSync(command, (error, stdout, stderr) => {
@ -29,6 +30,7 @@ function execWrapper(command) {
const certusFiles = fs.readdirSync(CERTUS_DIRECTORY, { withFileTypes: true }); //should only contain directories for the modules
const cosmosFiles = fs.readdirSync(COSMOS_DIRECTORY, { withFileTypes: true });
const wasmdFiles = fs.readdirSync(WASMD_DIRECTORY, { withFileTypes: true });
certusFiles.forEach((directory) => {
execWrapper(`mkdir -p ${MODULE_DIRECTORY + directory.name}/`);
@ -48,6 +50,15 @@ cosmosFiles.forEach((directory) => {
); //move all the files from the vue module into the sdk
});
wasmdFiles.forEach((directory) => {
execWrapper(`mkdir -p ${MODULE_DIRECTORY + directory.name}/`);
execWrapper(
`cp -R ${WASMD_DIRECTORY + directory.name}/module/* ${
MODULE_DIRECTORY + directory.name
}/`
); //move all the files from the vue module into the sdk
});
//As of 19.5 javascript isn't emitted
//execWrapper(`find ${MODULE_DIRECTORY} -name "*.js" | xargs rm `); //delete all javascript files, so they can be cleanly created based on our tsconfig

View File

@ -10,7 +10,7 @@ import {
setupTxExtension,
} from "@cosmjs/stargate";
import { Tendermint34Client } from "@cosmjs/tendermint-rpc";
import { Api as coreApi } from "../modules/certusone.wormholechain.wormhole/rest";
import { Api as coreApi } from "../modules/wormhole_foundation.wormchain.wormhole/rest";
import { Api as authApi } from "../modules/cosmos.auth.v1beta1/rest";
import { Api as bankApi } from "../modules/cosmos.bank.v1beta1/rest";
import { Api as baseApi } from "../modules/cosmos.base.tendermint.v1beta1/rest";

View File

@ -26,14 +26,14 @@ import { Tendermint34Client } from "@cosmjs/tendermint-rpc";
import {
RpcStatus,
HttpResponse,
} from "../modules/certusone.wormholechain.wormhole/rest";
} from "../modules/wormhole_foundation.wormchain.wormhole/rest";
import {
txClient,
queryClient,
} from "../modules/certusone.wormholechain.wormhole";
} from "../modules/wormhole_foundation.wormchain.wormhole";
import { keccak256 } from "ethers/lib/utils";
import { MsgRegisterAccountAsGuardian } from "../modules/certusone.wormholechain.wormhole/types/wormhole/tx";
import { GuardianKey } from "../modules/certusone.wormholechain.wormhole/types/wormhole/guardian_key";
import { MsgRegisterAccountAsGuardian } from "../modules/wormhole_foundation.wormchain.wormhole/types/wormhole/tx";
import { GuardianKey } from "../modules/wormhole_foundation.wormchain.wormhole/types/wormhole/guardian_key";
let elliptic = require("elliptic"); //No TS defs?
//https://tutorials.cosmos.network/academy/4-my-own-chain/cosmjs.html
@ -183,7 +183,7 @@ export async function registerGuardianValidator(
const args: MsgRegisterAccountAsGuardian = {
signer: await getAddress(wallet),
guardianPubkey: GuardianKey.fromJSON(guardianPubkeyBase64), //TODO fix this type, it's bad
// guardianPubkey: GuardianKey.fromJSON(guardianPubkeyBase64), //TODO fix this type, it's bad
signature: signature,
};

View File

@ -6,7 +6,7 @@ import {
StargateClient,
} from "@cosmjs/stargate";
import { getTypeParameterOwner } from "typescript";
import * as coreModule from "../modules/certusone.wormholechain.wormhole";
import * as coreModule from "../modules/wormhole_foundation.wormchain.wormhole";
import * as authModule from "../modules/cosmos.auth.v1beta1";
import * as bankModule from "../modules/cosmos.bank.v1beta1";
import * as baseModule from "../modules/cosmos.base.tendermint.v1beta1";

View File

@ -1,416 +0,0 @@
//@ts-nocheck
/* eslint-disable */
import { Reader, Writer } from "protobufjs/minimal";
import { GuardianKey } from "../wormhole/guardian_key";
export const protobufPackage = "certusone.wormholechain.wormhole";
export interface MsgExecuteGovernanceVAA {
vaa: Uint8Array;
signer: string;
}
export interface MsgExecuteGovernanceVAAResponse {}
export interface MsgRegisterAccountAsGuardian {
signer: string;
guardianPubkey: GuardianKey | undefined;
signature: Uint8Array;
}
export interface MsgRegisterAccountAsGuardianResponse {}
const baseMsgExecuteGovernanceVAA: object = { signer: "" };
export const MsgExecuteGovernanceVAA = {
encode(
message: MsgExecuteGovernanceVAA,
writer: Writer = Writer.create()
): Writer {
if (message.vaa.length !== 0) {
writer.uint32(10).bytes(message.vaa);
}
if (message.signer !== "") {
writer.uint32(18).string(message.signer);
}
return writer;
},
decode(input: Reader | Uint8Array, length?: number): MsgExecuteGovernanceVAA {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = {
...baseMsgExecuteGovernanceVAA,
} as MsgExecuteGovernanceVAA;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.vaa = reader.bytes();
break;
case 2:
message.signer = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): MsgExecuteGovernanceVAA {
const message = {
...baseMsgExecuteGovernanceVAA,
} as MsgExecuteGovernanceVAA;
if (object.vaa !== undefined && object.vaa !== null) {
message.vaa = bytesFromBase64(object.vaa);
}
if (object.signer !== undefined && object.signer !== null) {
message.signer = String(object.signer);
} else {
message.signer = "";
}
return message;
},
toJSON(message: MsgExecuteGovernanceVAA): unknown {
const obj: any = {};
message.vaa !== undefined &&
(obj.vaa = base64FromBytes(
message.vaa !== undefined ? message.vaa : new Uint8Array()
));
message.signer !== undefined && (obj.signer = message.signer);
return obj;
},
fromPartial(
object: DeepPartial<MsgExecuteGovernanceVAA>
): MsgExecuteGovernanceVAA {
const message = {
...baseMsgExecuteGovernanceVAA,
} as MsgExecuteGovernanceVAA;
if (object.vaa !== undefined && object.vaa !== null) {
message.vaa = object.vaa;
} else {
message.vaa = new Uint8Array();
}
if (object.signer !== undefined && object.signer !== null) {
message.signer = object.signer;
} else {
message.signer = "";
}
return message;
},
};
const baseMsgExecuteGovernanceVAAResponse: object = {};
export const MsgExecuteGovernanceVAAResponse = {
encode(
_: MsgExecuteGovernanceVAAResponse,
writer: Writer = Writer.create()
): Writer {
return writer;
},
decode(
input: Reader | Uint8Array,
length?: number
): MsgExecuteGovernanceVAAResponse {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = {
...baseMsgExecuteGovernanceVAAResponse,
} as MsgExecuteGovernanceVAAResponse;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(_: any): MsgExecuteGovernanceVAAResponse {
const message = {
...baseMsgExecuteGovernanceVAAResponse,
} as MsgExecuteGovernanceVAAResponse;
return message;
},
toJSON(_: MsgExecuteGovernanceVAAResponse): unknown {
const obj: any = {};
return obj;
},
fromPartial(
_: DeepPartial<MsgExecuteGovernanceVAAResponse>
): MsgExecuteGovernanceVAAResponse {
const message = {
...baseMsgExecuteGovernanceVAAResponse,
} as MsgExecuteGovernanceVAAResponse;
return message;
},
};
const baseMsgRegisterAccountAsGuardian: object = { signer: "" };
export const MsgRegisterAccountAsGuardian = {
encode(
message: MsgRegisterAccountAsGuardian,
writer: Writer = Writer.create()
): Writer {
if (message.signer !== "") {
writer.uint32(10).string(message.signer);
}
if (message.guardianPubkey !== undefined) {
GuardianKey.encode(
message.guardianPubkey,
writer.uint32(18).fork()
).ldelim();
}
if (message.signature.length !== 0) {
writer.uint32(26).bytes(message.signature);
}
return writer;
},
decode(
input: Reader | Uint8Array,
length?: number
): MsgRegisterAccountAsGuardian {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = {
...baseMsgRegisterAccountAsGuardian,
} as MsgRegisterAccountAsGuardian;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.signer = reader.string();
break;
case 2:
message.guardianPubkey = GuardianKey.decode(reader, reader.uint32());
break;
case 3:
message.signature = reader.bytes();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): MsgRegisterAccountAsGuardian {
const message = {
...baseMsgRegisterAccountAsGuardian,
} as MsgRegisterAccountAsGuardian;
if (object.signer !== undefined && object.signer !== null) {
message.signer = String(object.signer);
} else {
message.signer = "";
}
if (object.guardianPubkey !== undefined && object.guardianPubkey !== null) {
message.guardianPubkey = GuardianKey.fromJSON(object.guardianPubkey);
} else {
message.guardianPubkey = undefined;
}
if (object.signature !== undefined && object.signature !== null) {
message.signature = bytesFromBase64(object.signature);
}
return message;
},
toJSON(message: MsgRegisterAccountAsGuardian): unknown {
const obj: any = {};
message.signer !== undefined && (obj.signer = message.signer);
message.guardianPubkey !== undefined &&
(obj.guardianPubkey = message.guardianPubkey
? GuardianKey.toJSON(message.guardianPubkey)
: undefined);
message.signature !== undefined &&
(obj.signature = base64FromBytes(
message.signature !== undefined ? message.signature : new Uint8Array()
));
return obj;
},
fromPartial(
object: DeepPartial<MsgRegisterAccountAsGuardian>
): MsgRegisterAccountAsGuardian {
const message = {
...baseMsgRegisterAccountAsGuardian,
} as MsgRegisterAccountAsGuardian;
if (object.signer !== undefined && object.signer !== null) {
message.signer = object.signer;
} else {
message.signer = "";
}
if (object.guardianPubkey !== undefined && object.guardianPubkey !== null) {
message.guardianPubkey = GuardianKey.fromPartial(object.guardianPubkey);
} else {
message.guardianPubkey = undefined;
}
if (object.signature !== undefined && object.signature !== null) {
message.signature = object.signature;
} else {
message.signature = new Uint8Array();
}
return message;
},
};
const baseMsgRegisterAccountAsGuardianResponse: object = {};
export const MsgRegisterAccountAsGuardianResponse = {
encode(
_: MsgRegisterAccountAsGuardianResponse,
writer: Writer = Writer.create()
): Writer {
return writer;
},
decode(
input: Reader | Uint8Array,
length?: number
): MsgRegisterAccountAsGuardianResponse {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = {
...baseMsgRegisterAccountAsGuardianResponse,
} as MsgRegisterAccountAsGuardianResponse;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(_: any): MsgRegisterAccountAsGuardianResponse {
const message = {
...baseMsgRegisterAccountAsGuardianResponse,
} as MsgRegisterAccountAsGuardianResponse;
return message;
},
toJSON(_: MsgRegisterAccountAsGuardianResponse): unknown {
const obj: any = {};
return obj;
},
fromPartial(
_: DeepPartial<MsgRegisterAccountAsGuardianResponse>
): MsgRegisterAccountAsGuardianResponse {
const message = {
...baseMsgRegisterAccountAsGuardianResponse,
} as MsgRegisterAccountAsGuardianResponse;
return message;
},
};
/** Msg defines the Msg service. */
export interface Msg {
ExecuteGovernanceVAA(
request: MsgExecuteGovernanceVAA
): Promise<MsgExecuteGovernanceVAAResponse>;
/** this line is used by starport scaffolding # proto/tx/rpc */
RegisterAccountAsGuardian(
request: MsgRegisterAccountAsGuardian
): Promise<MsgRegisterAccountAsGuardianResponse>;
}
export class MsgClientImpl implements Msg {
private readonly rpc: Rpc;
constructor(rpc: Rpc) {
this.rpc = rpc;
}
ExecuteGovernanceVAA(
request: MsgExecuteGovernanceVAA
): Promise<MsgExecuteGovernanceVAAResponse> {
const data = MsgExecuteGovernanceVAA.encode(request).finish();
const promise = this.rpc.request(
"certusone.wormholechain.wormhole.Msg",
"ExecuteGovernanceVAA",
data
);
return promise.then((data) =>
MsgExecuteGovernanceVAAResponse.decode(new Reader(data))
);
}
RegisterAccountAsGuardian(
request: MsgRegisterAccountAsGuardian
): Promise<MsgRegisterAccountAsGuardianResponse> {
const data = MsgRegisterAccountAsGuardian.encode(request).finish();
const promise = this.rpc.request(
"certusone.wormholechain.wormhole.Msg",
"RegisterAccountAsGuardian",
data
);
return promise.then((data) =>
MsgRegisterAccountAsGuardianResponse.decode(new Reader(data))
);
}
}
interface Rpc {
request(
service: string,
method: string,
data: Uint8Array
): Promise<Uint8Array>;
}
declare var self: any | undefined;
declare var window: any | undefined;
var globalThis: any = (() => {
if (typeof globalThis !== "undefined") return globalThis;
if (typeof self !== "undefined") return self;
if (typeof window !== "undefined") return window;
if (typeof global !== "undefined") return global;
throw "Unable to locate global object";
})();
const atob: (b64: string) => string =
globalThis.atob ||
((b64) => globalThis.Buffer.from(b64, "base64").toString("binary"));
function bytesFromBase64(b64: string): Uint8Array {
const bin = atob(b64);
const arr = new Uint8Array(bin.length);
for (let i = 0; i < bin.length; ++i) {
arr[i] = bin.charCodeAt(i);
}
return arr;
}
const btoa: (bin: string) => string =
globalThis.btoa ||
((bin) => globalThis.Buffer.from(bin, "binary").toString("base64"));
function base64FromBytes(arr: Uint8Array): string {
const bin: string[] = [];
for (let i = 0; i < arr.byteLength; ++i) {
bin.push(String.fromCharCode(arr[i]));
}
return btoa(bin.join(""));
}
type Builtin = Date | Function | Uint8Array | string | number | undefined;
export type DeepPartial<T> = T extends Builtin
? T
: 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>;

View File

@ -172,7 +172,11 @@ export interface V1Beta1PageRequest {
*/
count_total?: boolean;
/** reverse is set to true if results are to be returned in the descending order. */
/**
* reverse is set to true if results are to be returned in the descending order.
*
* Since: cosmos-sdk 0.43
*/
reverse?: boolean;
}
@ -222,8 +226,10 @@ export interface V1Beta1QueryAccountResponse {
}
/**
* QueryAccountsResponse is the response type for the Query/Accounts RPC method.
*/
* QueryAccountsResponse is the response type for the Query/Accounts RPC method.
Since: cosmos-sdk 0.43
*/
export interface V1Beta1QueryAccountsResponse {
accounts?: ProtobufAny[];
@ -436,7 +442,7 @@ export class HttpClient<SecurityDataType = unknown> {
*/
export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDataType> {
/**
* No description
* @description Since: cosmos-sdk 0.43
*
* @tags Query
* @name QueryAccounts

View File

@ -10,13 +10,21 @@ import { Params } from "../../../cosmos/auth/v1beta1/auth";
export const protobufPackage = "cosmos.auth.v1beta1";
/** QueryAccountsRequest is the request type for the Query/Accounts RPC method. */
/**
* QueryAccountsRequest is the request type for the Query/Accounts RPC method.
*
* Since: cosmos-sdk 0.43
*/
export interface QueryAccountsRequest {
/** pagination defines an optional pagination for the request. */
pagination: PageRequest | undefined;
}
/** QueryAccountsResponse is the response type for the Query/Accounts RPC method. */
/**
* QueryAccountsResponse is the response type for the Query/Accounts RPC method.
*
* Since: cosmos-sdk 0.43
*/
export interface QueryAccountsResponse {
/** accounts are the existing accounts */
accounts: Any[];
@ -414,7 +422,11 @@ export const QueryParamsResponse = {
/** Query defines the gRPC querier service. */
export interface Query {
/** Accounts returns all the existing accounts */
/**
* Accounts returns all the existing accounts
*
* Since: cosmos-sdk 0.43
*/
Accounts(request: QueryAccountsRequest): Promise<QueryAccountsResponse>;
/** Account returns account details based on address. */
Account(request: QueryAccountRequest): Promise<QueryAccountResponse>;

View File

@ -39,7 +39,11 @@ export interface PageRequest {
* is set.
*/
count_total: boolean;
/** reverse is set to true if results are to be returned in the descending order. */
/**
* reverse is set to true if results are to be returned in the descending order.
*
* Since: cosmos-sdk 0.43
*/
reverse: boolean;
}

View File

@ -76,11 +76,15 @@ export interface V1Beta1Metadata {
* displayed in clients.
*/
display?: string;
/** 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;
}
@ -141,7 +145,11 @@ export interface V1Beta1PageRequest {
*/
count_total?: boolean;
/** reverse is set to true if results are to be returned in the descending order. */
/**
* reverse is set to true if results are to be returned in the descending order.
*
* Since: cosmos-sdk 0.43
*/
reverse?: boolean;
}
@ -219,6 +227,18 @@ export interface V1Beta1QueryParamsResponse {
params?: V1Beta1Params;
}
/**
* QuerySpendableBalancesResponse defines the gRPC response structure for querying
an account's spendable balances.
*/
export interface V1Beta1QuerySpendableBalancesResponse {
/** balances is the spendable balances of all the coins. */
balances?: V1Beta1Coin[];
/** pagination defines the pagination in the response. */
pagination?: V1Beta1PageResponse;
}
/**
* QuerySupplyOfResponse is the response type for the Query/SupplyOf RPC method.
*/
@ -230,7 +250,11 @@ export interface V1Beta1QuerySupplyOfResponse {
export interface V1Beta1QueryTotalSupplyResponse {
supply?: V1Beta1Coin[];
/** pagination defines the pagination in the response. */
/**
* pagination defines the pagination in the response.
*
* Since: cosmos-sdk 0.43
*/
pagination?: V1Beta1PageResponse;
}
@ -472,12 +496,13 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
* @tags Query
* @name QueryBalance
* @summary Balance queries the balance of a single coin for a single account.
* @request GET:/cosmos/bank/v1beta1/balances/{address}/{denom}
* @request GET:/cosmos/bank/v1beta1/balances/{address}/by_denom
*/
queryBalance = (address: string, denom: string, params: RequestParams = {}) =>
queryBalance = (address: string, query?: { denom?: string }, params: RequestParams = {}) =>
this.request<V1Beta1QueryBalanceResponse, RpcStatus>({
path: `/cosmos/bank/v1beta1/balances/${address}/${denom}`,
path: `/cosmos/bank/v1beta1/balances/${address}/by_denom`,
method: "GET",
query: query,
format: "json",
...params,
});
@ -540,6 +565,34 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
...params,
});
/**
* No description
*
* @tags Query
* @name QuerySpendableBalances
* @summary SpendableBalances queries the spenable balance of all coins for a single
account.
* @request GET:/cosmos/bank/v1beta1/spendable_balances/{address}
*/
querySpendableBalances = (
address: string,
query?: {
"pagination.key"?: string;
"pagination.offset"?: string;
"pagination.limit"?: string;
"pagination.count_total"?: boolean;
"pagination.reverse"?: boolean;
},
params: RequestParams = {},
) =>
this.request<V1Beta1QuerySpendableBalancesResponse, RpcStatus>({
path: `/cosmos/bank/v1beta1/spendable_balances/${address}`,
method: "GET",
query: query,
format: "json",
...params,
});
/**
* No description
*

View File

@ -8,6 +8,8 @@ export const protobufPackage = "cosmos.bank.v1beta1";
/**
* SendAuthorization allows the grantee to spend up to spend_limit coins from
* the granter's account.
*
* Since: cosmos-sdk 0.43
*/
export interface SendAuthorization {
spend_limit: Coin[];

View File

@ -77,11 +77,17 @@ export interface Metadata {
* displayed in clients.
*/
display: string;
/** name defines the name of the token (eg: Cosmos Atom) */
/**
* 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;
}

View File

@ -43,12 +43,38 @@ export interface QueryAllBalancesResponse {
pagination: PageResponse | undefined;
}
/**
* QuerySpendableBalancesRequest defines the gRPC request structure for querying
* an account's spendable balances.
*/
export interface QuerySpendableBalancesRequest {
/** address is the address to query spendable balances for. */
address: string;
/** pagination defines an optional pagination for the request. */
pagination: PageRequest | undefined;
}
/**
* QuerySpendableBalancesResponse defines the gRPC response structure for querying
* an account's spendable balances.
*/
export interface QuerySpendableBalancesResponse {
/** balances is the spendable balances of all the coins. */
balances: Coin[];
/** pagination defines the pagination in the response. */
pagination: PageResponse | undefined;
}
/**
* QueryTotalSupplyRequest is the request type for the Query/TotalSupply RPC
* method.
*/
export interface QueryTotalSupplyRequest {
/** pagination defines an optional pagination for the request. */
/**
* pagination defines an optional pagination for the request.
*
* Since: cosmos-sdk 0.43
*/
pagination: PageRequest | undefined;
}
@ -59,7 +85,11 @@ export interface QueryTotalSupplyRequest {
export interface QueryTotalSupplyResponse {
/** supply is the supply of the coins */
supply: Coin[];
/** pagination defines the pagination in the response. */
/**
* pagination defines the pagination in the response.
*
* Since: cosmos-sdk 0.43
*/
pagination: PageResponse | undefined;
}
@ -438,6 +468,196 @@ export const QueryAllBalancesResponse = {
},
};
const baseQuerySpendableBalancesRequest: object = { address: "" };
export const QuerySpendableBalancesRequest = {
encode(
message: QuerySpendableBalancesRequest,
writer: Writer = Writer.create()
): Writer {
if (message.address !== "") {
writer.uint32(10).string(message.address);
}
if (message.pagination !== undefined) {
PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim();
}
return writer;
},
decode(
input: Reader | Uint8Array,
length?: number
): QuerySpendableBalancesRequest {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = {
...baseQuerySpendableBalancesRequest,
} as QuerySpendableBalancesRequest;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.address = reader.string();
break;
case 2:
message.pagination = PageRequest.decode(reader, reader.uint32());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): QuerySpendableBalancesRequest {
const message = {
...baseQuerySpendableBalancesRequest,
} as QuerySpendableBalancesRequest;
if (object.address !== undefined && object.address !== null) {
message.address = String(object.address);
} else {
message.address = "";
}
if (object.pagination !== undefined && object.pagination !== null) {
message.pagination = PageRequest.fromJSON(object.pagination);
} else {
message.pagination = undefined;
}
return message;
},
toJSON(message: QuerySpendableBalancesRequest): unknown {
const obj: any = {};
message.address !== undefined && (obj.address = message.address);
message.pagination !== undefined &&
(obj.pagination = message.pagination
? PageRequest.toJSON(message.pagination)
: undefined);
return obj;
},
fromPartial(
object: DeepPartial<QuerySpendableBalancesRequest>
): QuerySpendableBalancesRequest {
const message = {
...baseQuerySpendableBalancesRequest,
} as QuerySpendableBalancesRequest;
if (object.address !== undefined && object.address !== null) {
message.address = object.address;
} else {
message.address = "";
}
if (object.pagination !== undefined && object.pagination !== null) {
message.pagination = PageRequest.fromPartial(object.pagination);
} else {
message.pagination = undefined;
}
return message;
},
};
const baseQuerySpendableBalancesResponse: object = {};
export const QuerySpendableBalancesResponse = {
encode(
message: QuerySpendableBalancesResponse,
writer: Writer = Writer.create()
): Writer {
for (const v of message.balances) {
Coin.encode(v!, writer.uint32(10).fork()).ldelim();
}
if (message.pagination !== undefined) {
PageResponse.encode(
message.pagination,
writer.uint32(18).fork()
).ldelim();
}
return writer;
},
decode(
input: Reader | Uint8Array,
length?: number
): QuerySpendableBalancesResponse {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = {
...baseQuerySpendableBalancesResponse,
} as QuerySpendableBalancesResponse;
message.balances = [];
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.balances.push(Coin.decode(reader, reader.uint32()));
break;
case 2:
message.pagination = PageResponse.decode(reader, reader.uint32());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): QuerySpendableBalancesResponse {
const message = {
...baseQuerySpendableBalancesResponse,
} as QuerySpendableBalancesResponse;
message.balances = [];
if (object.balances !== undefined && object.balances !== null) {
for (const e of object.balances) {
message.balances.push(Coin.fromJSON(e));
}
}
if (object.pagination !== undefined && object.pagination !== null) {
message.pagination = PageResponse.fromJSON(object.pagination);
} else {
message.pagination = undefined;
}
return message;
},
toJSON(message: QuerySpendableBalancesResponse): unknown {
const obj: any = {};
if (message.balances) {
obj.balances = message.balances.map((e) =>
e ? Coin.toJSON(e) : undefined
);
} else {
obj.balances = [];
}
message.pagination !== undefined &&
(obj.pagination = message.pagination
? PageResponse.toJSON(message.pagination)
: undefined);
return obj;
},
fromPartial(
object: DeepPartial<QuerySpendableBalancesResponse>
): QuerySpendableBalancesResponse {
const message = {
...baseQuerySpendableBalancesResponse,
} as QuerySpendableBalancesResponse;
message.balances = [];
if (object.balances !== undefined && object.balances !== null) {
for (const e of object.balances) {
message.balances.push(Coin.fromPartial(e));
}
}
if (object.pagination !== undefined && object.pagination !== null) {
message.pagination = PageResponse.fromPartial(object.pagination);
} else {
message.pagination = undefined;
}
return message;
},
};
const baseQueryTotalSupplyRequest: object = {};
export const QueryTotalSupplyRequest = {
@ -1144,6 +1364,13 @@ export interface Query {
AllBalances(
request: QueryAllBalancesRequest
): Promise<QueryAllBalancesResponse>;
/**
* SpendableBalances queries the spenable balance of all coins for a single
* account.
*/
SpendableBalances(
request: QuerySpendableBalancesRequest
): Promise<QuerySpendableBalancesResponse>;
/** TotalSupply queries the total supply of all coins. */
TotalSupply(
request: QueryTotalSupplyRequest
@ -1193,6 +1420,20 @@ export class QueryClientImpl implements Query {
);
}
SpendableBalances(
request: QuerySpendableBalancesRequest
): Promise<QuerySpendableBalancesResponse> {
const data = QuerySpendableBalancesRequest.encode(request).finish();
const promise = this.rpc.request(
"cosmos.bank.v1beta1.Query",
"SpendableBalances",
data
);
return promise.then((data) =>
QuerySpendableBalancesResponse.decode(new Reader(data))
);
}
TotalSupply(
request: QueryTotalSupplyRequest
): Promise<QueryTotalSupplyResponse> {

View File

@ -39,7 +39,11 @@ export interface PageRequest {
* is set.
*/
count_total: boolean;
/** reverse is set to true if results are to be returned in the descending order. */
/**
* reverse is set to true if results are to be returned in the descending order.
*
* Since: cosmos-sdk 0.43
*/
reverse: boolean;
}

View File

@ -400,13 +400,19 @@ export interface TypesHeader {
time?: string;
last_block_id?: TypesBlockID;
/** @format byte */
/**
* commit from validators from the last block
* @format byte
*/
last_commit_hash?: string;
/** @format byte */
data_hash?: string;
/** @format byte */
/**
* validators for the current block
* @format byte
*/
validators_hash?: string;
/** @format byte */
@ -421,7 +427,10 @@ export interface TypesHeader {
/** @format byte */
last_results_hash?: string;
/** @format byte */
/**
* evidence included in the block
* @format byte
*/
evidence_hash?: string;
/** @format byte */
@ -505,6 +514,8 @@ export interface TypesVote {
/** @format int32 */
round?: number;
/** zero if vote is nil. */
block_id?: TypesBlockID;
/** @format date-time */
@ -621,7 +632,11 @@ export interface V1Beta1PageRequest {
*/
count_total?: boolean;
/** reverse is set to true if results are to be returned in the descending order. */
/**
* reverse is set to true if results are to be returned in the descending order.
*
* Since: cosmos-sdk 0.43
*/
reverse?: boolean;
}

View File

@ -39,7 +39,11 @@ export interface PageRequest {
* is set.
*/
count_total: boolean;
/** reverse is set to true if results are to be returned in the descending order. */
/**
* reverse is set to true if results are to be returned in the descending order.
*
* Since: cosmos-sdk 0.43
*/
reverse: boolean;
}

View File

@ -96,6 +96,7 @@ export interface VersionInfo {
build_tags: string;
go_version: string;
build_deps: Module[];
/** Since: cosmos-sdk 0.43 */
cosmos_sdk_version: string;
}

View File

@ -7,15 +7,15 @@ import { Registry, OfflineSigner, EncodeObject, DirectSecp256k1HdWallet } from "
import { Api } from "./rest";
import { MsgSetWithdrawAddress } from "./types/cosmos/distribution/v1beta1/tx";
import { MsgFundCommunityPool } from "./types/cosmos/distribution/v1beta1/tx";
import { MsgWithdrawValidatorCommission } from "./types/cosmos/distribution/v1beta1/tx";
import { MsgWithdrawDelegatorReward } from "./types/cosmos/distribution/v1beta1/tx";
import { MsgWithdrawValidatorCommission } from "./types/cosmos/distribution/v1beta1/tx";
const types = [
["/cosmos.distribution.v1beta1.MsgSetWithdrawAddress", MsgSetWithdrawAddress],
["/cosmos.distribution.v1beta1.MsgFundCommunityPool", MsgFundCommunityPool],
["/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", MsgWithdrawValidatorCommission],
["/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", MsgWithdrawDelegatorReward],
["/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", MsgWithdrawValidatorCommission],
];
export const MissingWalletError = new Error("wallet is required");
@ -50,8 +50,8 @@ const txClient = async (wallet: OfflineSigner, { addr: addr }: TxClientOptions =
signAndBroadcast: (msgs: EncodeObject[], { fee, memo }: SignAndBroadcastOptions = {fee: defaultFee, memo: ""}) => client.signAndBroadcast(address, msgs, fee,memo),
msgSetWithdrawAddress: (data: MsgSetWithdrawAddress): EncodeObject => ({ typeUrl: "/cosmos.distribution.v1beta1.MsgSetWithdrawAddress", value: MsgSetWithdrawAddress.fromPartial( data ) }),
msgFundCommunityPool: (data: MsgFundCommunityPool): EncodeObject => ({ typeUrl: "/cosmos.distribution.v1beta1.MsgFundCommunityPool", value: MsgFundCommunityPool.fromPartial( data ) }),
msgWithdrawValidatorCommission: (data: MsgWithdrawValidatorCommission): EncodeObject => ({ typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", value: MsgWithdrawValidatorCommission.fromPartial( data ) }),
msgWithdrawDelegatorReward: (data: MsgWithdrawDelegatorReward): EncodeObject => ({ typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawDelegatorReward", value: MsgWithdrawDelegatorReward.fromPartial( data ) }),
msgWithdrawValidatorCommission: (data: MsgWithdrawValidatorCommission): EncodeObject => ({ typeUrl: "/cosmos.distribution.v1beta1.MsgWithdrawValidatorCommission", value: MsgWithdrawValidatorCommission.fromPartial( data ) }),
};
};

View File

@ -110,7 +110,11 @@ export interface V1Beta1PageRequest {
*/
count_total?: boolean;
/** reverse is set to true if results are to be returned in the descending order. */
/**
* reverse is set to true if results are to be returned in the descending order.
*
* Since: cosmos-sdk 0.43
*/
reverse?: boolean;
}

View File

@ -39,7 +39,11 @@ export interface PageRequest {
* is set.
*/
count_total: boolean;
/** reverse is set to true if results are to be returned in the descending order. */
/**
* reverse is set to true if results are to be returned in the descending order.
*
* Since: cosmos-sdk 0.43
*/
reverse: boolean;
}

View File

@ -183,7 +183,11 @@ export interface V1Beta1PageRequest {
*/
count_total?: boolean;
/** reverse is set to true if results are to be returned in the descending order. */
/**
* reverse is set to true if results are to be returned in the descending order.
*
* Since: cosmos-sdk 0.43
*/
reverse?: boolean;
}

View File

@ -39,7 +39,11 @@ export interface PageRequest {
* is set.
*/
count_total: boolean;
/** reverse is set to true if results are to be returned in the descending order. */
/**
* reverse is set to true if results are to be returned in the descending order.
*
* Since: cosmos-sdk 0.43
*/
reverse: boolean;
}

View File

@ -5,13 +5,13 @@ import { StdFee } from "@cosmjs/launchpad";
import { SigningStargateClient } from "@cosmjs/stargate";
import { Registry, OfflineSigner, EncodeObject, DirectSecp256k1HdWallet } from "@cosmjs/proto-signing";
import { Api } from "./rest";
import { MsgGrantAllowance } from "./types/cosmos/feegrant/v1beta1/tx";
import { MsgRevokeAllowance } from "./types/cosmos/feegrant/v1beta1/tx";
import { MsgGrantAllowance } from "./types/cosmos/feegrant/v1beta1/tx";
const types = [
["/cosmos.feegrant.v1beta1.MsgGrantAllowance", MsgGrantAllowance],
["/cosmos.feegrant.v1beta1.MsgRevokeAllowance", MsgRevokeAllowance],
["/cosmos.feegrant.v1beta1.MsgGrantAllowance", MsgGrantAllowance],
];
export const MissingWalletError = new Error("wallet is required");
@ -44,8 +44,8 @@ const txClient = async (wallet: OfflineSigner, { addr: addr }: TxClientOptions =
return {
signAndBroadcast: (msgs: EncodeObject[], { fee, memo }: SignAndBroadcastOptions = {fee: defaultFee, memo: ""}) => client.signAndBroadcast(address, msgs, fee,memo),
msgGrantAllowance: (data: MsgGrantAllowance): EncodeObject => ({ typeUrl: "/cosmos.feegrant.v1beta1.MsgGrantAllowance", value: MsgGrantAllowance.fromPartial( data ) }),
msgRevokeAllowance: (data: MsgRevokeAllowance): EncodeObject => ({ typeUrl: "/cosmos.feegrant.v1beta1.MsgRevokeAllowance", value: MsgRevokeAllowance.fromPartial( data ) }),
msgGrantAllowance: (data: MsgGrantAllowance): EncodeObject => ({ typeUrl: "/cosmos.feegrant.v1beta1.MsgGrantAllowance", value: MsgGrantAllowance.fromPartial( data ) }),
};
};

View File

@ -193,7 +193,11 @@ export interface V1Beta1PageRequest {
*/
count_total?: boolean;
/** reverse is set to true if results are to be returned in the descending order. */
/**
* reverse is set to true if results are to be returned in the descending order.
*
* Since: cosmos-sdk 0.43
*/
reverse?: boolean;
}
@ -222,6 +226,17 @@ export interface V1Beta1QueryAllowanceResponse {
allowance?: V1Beta1Grant;
}
/**
* QueryAllowancesByGranterResponse is the response type for the Query/AllowancesByGranter RPC method.
*/
export interface V1Beta1QueryAllowancesByGranterResponse {
/** allowances that have been issued by the granter. */
allowances?: V1Beta1Grant[];
/** pagination defines an pagination for the response. */
pagination?: V1Beta1PageResponse;
}
/**
* QueryAllowancesResponse is the response type for the Query/Allowances RPC method.
*/
@ -471,4 +486,32 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
format: "json",
...params,
});
/**
* No description
*
* @tags Query
* @name QueryAllowancesByGranter
* @summary AllowancesByGranter returns all the grants given by an address
Since v0.46
* @request GET:/cosmos/feegrant/v1beta1/issued/{granter}
*/
queryAllowancesByGranter = (
granter: string,
query?: {
"pagination.key"?: string;
"pagination.offset"?: string;
"pagination.limit"?: string;
"pagination.count_total"?: boolean;
"pagination.reverse"?: boolean;
},
params: RequestParams = {},
) =>
this.request<V1Beta1QueryAllowancesByGranterResponse, RpcStatus>({
path: `/cosmos/feegrant/v1beta1/issued/${granter}`,
method: "GET",
query: query,
format: "json",
...params,
});
}

View File

@ -39,7 +39,11 @@ export interface PageRequest {
* is set.
*/
count_total: boolean;
/** reverse is set to true if results are to be returned in the descending order. */
/**
* reverse is set to true if results are to be returned in the descending order.
*
* Since: cosmos-sdk 0.43
*/
reverse: boolean;
}

View File

@ -8,6 +8,8 @@ import { Writer, Reader } from "protobufjs/minimal";
export const protobufPackage = "cosmos.feegrant.v1beta1";
/** Since: cosmos-sdk 0.43 */
/**
* BasicAllowance implements Allowance with a one-time grant of tokens
* that optionally expires. The grantee can use up to SpendLimit to cover fees.

View File

@ -5,6 +5,8 @@ import { Writer, Reader } from "protobufjs/minimal";
export const protobufPackage = "cosmos.feegrant.v1beta1";
/** Since: cosmos-sdk 0.43 */
/** GenesisState contains a set of fee allowances, persisted from the store */
export interface GenesisState {
allowances: Grant[];

View File

@ -9,6 +9,8 @@ import {
export const protobufPackage = "cosmos.feegrant.v1beta1";
/** Since: cosmos-sdk 0.43 */
/** QueryAllowanceRequest is the request type for the Query/Allowance RPC method. */
export interface QueryAllowanceRequest {
/** granter is the address of the user granting an allowance of their funds. */
@ -38,6 +40,21 @@ export interface QueryAllowancesResponse {
pagination: PageResponse | undefined;
}
/** QueryAllowancesByGranterRequest is the request type for the Query/AllowancesByGranter RPC method. */
export interface QueryAllowancesByGranterRequest {
granter: string;
/** pagination defines an pagination for the request. */
pagination: PageRequest | undefined;
}
/** QueryAllowancesByGranterResponse is the response type for the Query/AllowancesByGranter RPC method. */
export interface QueryAllowancesByGranterResponse {
/** allowances that have been issued by the granter. */
allowances: Grant[];
/** pagination defines an pagination for the response. */
pagination: PageResponse | undefined;
}
const baseQueryAllowanceRequest: object = { granter: "", grantee: "" };
export const QueryAllowanceRequest = {
@ -356,12 +373,209 @@ export const QueryAllowancesResponse = {
},
};
const baseQueryAllowancesByGranterRequest: object = { granter: "" };
export const QueryAllowancesByGranterRequest = {
encode(
message: QueryAllowancesByGranterRequest,
writer: Writer = Writer.create()
): Writer {
if (message.granter !== "") {
writer.uint32(10).string(message.granter);
}
if (message.pagination !== undefined) {
PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim();
}
return writer;
},
decode(
input: Reader | Uint8Array,
length?: number
): QueryAllowancesByGranterRequest {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = {
...baseQueryAllowancesByGranterRequest,
} as QueryAllowancesByGranterRequest;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.granter = reader.string();
break;
case 2:
message.pagination = PageRequest.decode(reader, reader.uint32());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): QueryAllowancesByGranterRequest {
const message = {
...baseQueryAllowancesByGranterRequest,
} as QueryAllowancesByGranterRequest;
if (object.granter !== undefined && object.granter !== null) {
message.granter = String(object.granter);
} else {
message.granter = "";
}
if (object.pagination !== undefined && object.pagination !== null) {
message.pagination = PageRequest.fromJSON(object.pagination);
} else {
message.pagination = undefined;
}
return message;
},
toJSON(message: QueryAllowancesByGranterRequest): unknown {
const obj: any = {};
message.granter !== undefined && (obj.granter = message.granter);
message.pagination !== undefined &&
(obj.pagination = message.pagination
? PageRequest.toJSON(message.pagination)
: undefined);
return obj;
},
fromPartial(
object: DeepPartial<QueryAllowancesByGranterRequest>
): QueryAllowancesByGranterRequest {
const message = {
...baseQueryAllowancesByGranterRequest,
} as QueryAllowancesByGranterRequest;
if (object.granter !== undefined && object.granter !== null) {
message.granter = object.granter;
} else {
message.granter = "";
}
if (object.pagination !== undefined && object.pagination !== null) {
message.pagination = PageRequest.fromPartial(object.pagination);
} else {
message.pagination = undefined;
}
return message;
},
};
const baseQueryAllowancesByGranterResponse: object = {};
export const QueryAllowancesByGranterResponse = {
encode(
message: QueryAllowancesByGranterResponse,
writer: Writer = Writer.create()
): Writer {
for (const v of message.allowances) {
Grant.encode(v!, writer.uint32(10).fork()).ldelim();
}
if (message.pagination !== undefined) {
PageResponse.encode(
message.pagination,
writer.uint32(18).fork()
).ldelim();
}
return writer;
},
decode(
input: Reader | Uint8Array,
length?: number
): QueryAllowancesByGranterResponse {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = {
...baseQueryAllowancesByGranterResponse,
} as QueryAllowancesByGranterResponse;
message.allowances = [];
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.allowances.push(Grant.decode(reader, reader.uint32()));
break;
case 2:
message.pagination = PageResponse.decode(reader, reader.uint32());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): QueryAllowancesByGranterResponse {
const message = {
...baseQueryAllowancesByGranterResponse,
} as QueryAllowancesByGranterResponse;
message.allowances = [];
if (object.allowances !== undefined && object.allowances !== null) {
for (const e of object.allowances) {
message.allowances.push(Grant.fromJSON(e));
}
}
if (object.pagination !== undefined && object.pagination !== null) {
message.pagination = PageResponse.fromJSON(object.pagination);
} else {
message.pagination = undefined;
}
return message;
},
toJSON(message: QueryAllowancesByGranterResponse): unknown {
const obj: any = {};
if (message.allowances) {
obj.allowances = message.allowances.map((e) =>
e ? Grant.toJSON(e) : undefined
);
} else {
obj.allowances = [];
}
message.pagination !== undefined &&
(obj.pagination = message.pagination
? PageResponse.toJSON(message.pagination)
: undefined);
return obj;
},
fromPartial(
object: DeepPartial<QueryAllowancesByGranterResponse>
): QueryAllowancesByGranterResponse {
const message = {
...baseQueryAllowancesByGranterResponse,
} as QueryAllowancesByGranterResponse;
message.allowances = [];
if (object.allowances !== undefined && object.allowances !== null) {
for (const e of object.allowances) {
message.allowances.push(Grant.fromPartial(e));
}
}
if (object.pagination !== undefined && object.pagination !== null) {
message.pagination = PageResponse.fromPartial(object.pagination);
} else {
message.pagination = undefined;
}
return message;
},
};
/** Query defines the gRPC querier service. */
export interface Query {
/** Allowance returns fee granted to the grantee by the granter. */
Allowance(request: QueryAllowanceRequest): Promise<QueryAllowanceResponse>;
/** Allowances returns all the grants for address. */
Allowances(request: QueryAllowancesRequest): Promise<QueryAllowancesResponse>;
/**
* AllowancesByGranter returns all the grants given by an address
* Since v0.46
*/
AllowancesByGranter(
request: QueryAllowancesByGranterRequest
): Promise<QueryAllowancesByGranterResponse>;
}
export class QueryClientImpl implements Query {
@ -394,6 +608,20 @@ export class QueryClientImpl implements Query {
QueryAllowancesResponse.decode(new Reader(data))
);
}
AllowancesByGranter(
request: QueryAllowancesByGranterRequest
): Promise<QueryAllowancesByGranterResponse> {
const data = QueryAllowancesByGranterRequest.encode(request).finish();
const promise = this.rpc.request(
"cosmos.feegrant.v1beta1.Query",
"AllowancesByGranter",
data
);
return promise.then((data) =>
QueryAllowancesByGranterResponse.decode(new Reader(data))
);
}
}
interface Rpc {

View File

@ -5,6 +5,8 @@ import { Any } from "../../../google/protobuf/any";
export const protobufPackage = "cosmos.feegrant.v1beta1";
/** Since: cosmos-sdk 0.43 */
/**
* MsgGrantAllowance adds permission for Grantee to spend up to Allowance
* of fees from the account of Granter.

View File

@ -5,17 +5,17 @@ import { StdFee } from "@cosmjs/launchpad";
import { SigningStargateClient } from "@cosmjs/stargate";
import { Registry, OfflineSigner, EncodeObject, DirectSecp256k1HdWallet } from "@cosmjs/proto-signing";
import { Api } from "./rest";
import { MsgVoteWeighted } from "./types/cosmos/gov/v1beta1/tx";
import { MsgSubmitProposal } from "./types/cosmos/gov/v1beta1/tx";
import { MsgVote } from "./types/cosmos/gov/v1beta1/tx";
import { MsgDeposit } from "./types/cosmos/gov/v1beta1/tx";
import { MsgVoteWeighted } from "./types/cosmos/gov/v1beta1/tx";
import { MsgVote } from "./types/cosmos/gov/v1beta1/tx";
const types = [
["/cosmos.gov.v1beta1.MsgVoteWeighted", MsgVoteWeighted],
["/cosmos.gov.v1beta1.MsgSubmitProposal", MsgSubmitProposal],
["/cosmos.gov.v1beta1.MsgVote", MsgVote],
["/cosmos.gov.v1beta1.MsgDeposit", MsgDeposit],
["/cosmos.gov.v1beta1.MsgVoteWeighted", MsgVoteWeighted],
["/cosmos.gov.v1beta1.MsgVote", MsgVote],
];
export const MissingWalletError = new Error("wallet is required");
@ -48,10 +48,10 @@ const txClient = async (wallet: OfflineSigner, { addr: addr }: TxClientOptions =
return {
signAndBroadcast: (msgs: EncodeObject[], { fee, memo }: SignAndBroadcastOptions = {fee: defaultFee, memo: ""}) => client.signAndBroadcast(address, msgs, fee,memo),
msgVoteWeighted: (data: MsgVoteWeighted): EncodeObject => ({ typeUrl: "/cosmos.gov.v1beta1.MsgVoteWeighted", value: MsgVoteWeighted.fromPartial( data ) }),
msgSubmitProposal: (data: MsgSubmitProposal): EncodeObject => ({ typeUrl: "/cosmos.gov.v1beta1.MsgSubmitProposal", value: MsgSubmitProposal.fromPartial( data ) }),
msgVote: (data: MsgVote): EncodeObject => ({ typeUrl: "/cosmos.gov.v1beta1.MsgVote", value: MsgVote.fromPartial( data ) }),
msgDeposit: (data: MsgDeposit): EncodeObject => ({ typeUrl: "/cosmos.gov.v1beta1.MsgDeposit", value: MsgDeposit.fromPartial( data ) }),
msgVoteWeighted: (data: MsgVoteWeighted): EncodeObject => ({ typeUrl: "/cosmos.gov.v1beta1.MsgVoteWeighted", value: MsgVoteWeighted.fromPartial( data ) }),
msgVote: (data: MsgVote): EncodeObject => ({ typeUrl: "/cosmos.gov.v1beta1.MsgVote", value: MsgVote.fromPartial( data ) }),
};
};

View File

@ -189,8 +189,10 @@ export interface V1Beta1MsgSubmitProposalResponse {
export type V1Beta1MsgVoteResponse = object;
/**
* MsgVoteWeightedResponse defines the Msg/VoteWeighted response type.
*/
* MsgVoteWeightedResponse defines the Msg/VoteWeighted response type.
Since: cosmos-sdk 0.43
*/
export type V1Beta1MsgVoteWeightedResponse = object;
/**
@ -231,7 +233,11 @@ export interface V1Beta1PageRequest {
*/
count_total?: boolean;
/** reverse is set to true if results are to be returned in the descending order. */
/**
* reverse is set to true if results are to be returned in the descending order.
*
* Since: cosmos-sdk 0.43
*/
reverse?: boolean;
}
@ -560,8 +566,10 @@ export interface V1Beta1VotingParams {
}
/**
* WeightedVoteOption defines a unit of vote for vote split.
*/
* WeightedVoteOption defines a unit of vote for vote split.
Since: cosmos-sdk 0.43
*/
export interface V1Beta1WeightedVoteOption {
/**
* VoteOption enumerates the valid vote options for a given governance proposal.

View File

@ -39,7 +39,11 @@ export interface PageRequest {
* is set.
*/
count_total: boolean;
/** reverse is set to true if results are to be returned in the descending order. */
/**
* reverse is set to true if results are to be returned in the descending order.
*
* Since: cosmos-sdk 0.43
*/
reverse: boolean;
}

View File

@ -143,7 +143,11 @@ export function proposalStatusToJSON(object: ProposalStatus): string {
}
}
/** WeightedVoteOption defines a unit of vote for vote split. */
/**
* WeightedVoteOption defines a unit of vote for vote split.
*
* Since: cosmos-sdk 0.43
*/
export interface WeightedVoteOption {
option: VoteOption;
weight: string;
@ -204,6 +208,7 @@ export interface Vote {
* @deprecated
*/
option: VoteOption;
/** Since: cosmos-sdk 0.43 */
options: WeightedVoteOption[];
}

View File

@ -38,14 +38,22 @@ export interface MsgVote {
/** MsgVoteResponse defines the Msg/Vote response type. */
export interface MsgVoteResponse {}
/** MsgVoteWeighted defines a message to cast a vote. */
/**
* MsgVoteWeighted defines a message to cast a vote.
*
* Since: cosmos-sdk 0.43
*/
export interface MsgVoteWeighted {
proposal_id: number;
voter: string;
options: WeightedVoteOption[];
}
/** MsgVoteWeightedResponse defines the Msg/VoteWeighted response type. */
/**
* MsgVoteWeightedResponse defines the Msg/VoteWeighted response type.
*
* Since: cosmos-sdk 0.43
*/
export interface MsgVoteWeightedResponse {}
/** MsgDeposit defines a message to submit a deposit to an existing proposal. */
@ -652,7 +660,11 @@ export interface Msg {
): Promise<MsgSubmitProposalResponse>;
/** Vote defines a method to add a vote on a specific proposal. */
Vote(request: MsgVote): Promise<MsgVoteResponse>;
/** VoteWeighted defines a method to add a weighted vote on a specific proposal. */
/**
* VoteWeighted defines a method to add a weighted vote on a specific proposal.
*
* Since: cosmos-sdk 0.43
*/
VoteWeighted(request: MsgVoteWeighted): Promise<MsgVoteWeightedResponse>;
/** Deposit defines a method to add deposit on a specific proposal. */
Deposit(request: MsgDeposit): Promise<MsgDepositResponse>;

View File

@ -61,7 +61,11 @@ export interface V1Beta1PageRequest {
*/
count_total?: boolean;
/** reverse is set to true if results are to be returned in the descending order. */
/**
* reverse is set to true if results are to be returned in the descending order.
*
* Since: cosmos-sdk 0.43
*/
reverse?: boolean;
}

View File

@ -39,7 +39,11 @@ export interface PageRequest {
* is set.
*/
count_total: boolean;
/** reverse is set to true if results are to be returned in the descending order. */
/**
* reverse is set to true if results are to be returned in the descending order.
*
* Since: cosmos-sdk 0.43
*/
reverse: boolean;
}

View File

@ -6,18 +6,18 @@ import { SigningStargateClient } from "@cosmjs/stargate";
import { Registry, OfflineSigner, EncodeObject, DirectSecp256k1HdWallet } from "@cosmjs/proto-signing";
import { Api } from "./rest";
import { MsgCreateValidator } from "./types/cosmos/staking/v1beta1/tx";
import { MsgDelegate } from "./types/cosmos/staking/v1beta1/tx";
import { MsgEditValidator } from "./types/cosmos/staking/v1beta1/tx";
import { MsgBeginRedelegate } from "./types/cosmos/staking/v1beta1/tx";
import { MsgUndelegate } from "./types/cosmos/staking/v1beta1/tx";
import { MsgEditValidator } from "./types/cosmos/staking/v1beta1/tx";
import { MsgDelegate } from "./types/cosmos/staking/v1beta1/tx";
const types = [
["/cosmos.staking.v1beta1.MsgCreateValidator", MsgCreateValidator],
["/cosmos.staking.v1beta1.MsgDelegate", MsgDelegate],
["/cosmos.staking.v1beta1.MsgEditValidator", MsgEditValidator],
["/cosmos.staking.v1beta1.MsgBeginRedelegate", MsgBeginRedelegate],
["/cosmos.staking.v1beta1.MsgUndelegate", MsgUndelegate],
["/cosmos.staking.v1beta1.MsgEditValidator", MsgEditValidator],
["/cosmos.staking.v1beta1.MsgDelegate", MsgDelegate],
];
export const MissingWalletError = new Error("wallet is required");
@ -51,10 +51,10 @@ const txClient = async (wallet: OfflineSigner, { addr: addr }: TxClientOptions =
return {
signAndBroadcast: (msgs: EncodeObject[], { fee, memo }: SignAndBroadcastOptions = {fee: defaultFee, memo: ""}) => client.signAndBroadcast(address, msgs, fee,memo),
msgCreateValidator: (data: MsgCreateValidator): EncodeObject => ({ typeUrl: "/cosmos.staking.v1beta1.MsgCreateValidator", value: MsgCreateValidator.fromPartial( data ) }),
msgDelegate: (data: MsgDelegate): EncodeObject => ({ typeUrl: "/cosmos.staking.v1beta1.MsgDelegate", value: MsgDelegate.fromPartial( data ) }),
msgEditValidator: (data: MsgEditValidator): EncodeObject => ({ typeUrl: "/cosmos.staking.v1beta1.MsgEditValidator", value: MsgEditValidator.fromPartial( data ) }),
msgBeginRedelegate: (data: MsgBeginRedelegate): EncodeObject => ({ typeUrl: "/cosmos.staking.v1beta1.MsgBeginRedelegate", value: MsgBeginRedelegate.fromPartial( data ) }),
msgUndelegate: (data: MsgUndelegate): EncodeObject => ({ typeUrl: "/cosmos.staking.v1beta1.MsgUndelegate", value: MsgUndelegate.fromPartial( data ) }),
msgEditValidator: (data: MsgEditValidator): EncodeObject => ({ typeUrl: "/cosmos.staking.v1beta1.MsgEditValidator", value: MsgEditValidator.fromPartial( data ) }),
msgDelegate: (data: MsgDelegate): EncodeObject => ({ typeUrl: "/cosmos.staking.v1beta1.MsgDelegate", value: MsgDelegate.fromPartial( data ) }),
};
};

View File

@ -210,13 +210,19 @@ export interface TypesHeader {
time?: string;
last_block_id?: TypesBlockID;
/** @format byte */
/**
* commit from validators from the last block
* @format byte
*/
last_commit_hash?: string;
/** @format byte */
data_hash?: string;
/** @format byte */
/**
* validators for the current block
* @format byte
*/
validators_hash?: string;
/** @format byte */
@ -231,7 +237,10 @@ export interface TypesHeader {
/** @format byte */
last_results_hash?: string;
/** @format byte */
/**
* evidence included in the block
* @format byte
*/
evidence_hash?: string;
/** @format byte */
@ -439,7 +448,11 @@ export interface V1Beta1PageRequest {
*/
count_total?: boolean;
/** reverse is set to true if results are to be returned in the descending order. */
/**
* reverse is set to true if results are to be returned in the descending order.
*
* Since: cosmos-sdk 0.43
*/
reverse?: boolean;
}
@ -640,7 +653,11 @@ export interface V1Beta1Redelegation {
/** validator_dst_address is the validator redelegation destination operator address. */
validator_dst_address?: string;
/** entries are the redelegation entries. */
/**
* entries are the redelegation entries.
*
* redelegation entries
*/
entries?: V1Beta1RedelegationEntry[];
}
@ -703,7 +720,11 @@ export interface V1Beta1UnbondingDelegation {
/** validator_address is the bech32-encoded address of the validator. */
validator_address?: string;
/** entries are the unbonding delegation entries. */
/**
* entries are the unbonding delegation entries.
*
* unbonding delegation entries
*/
entries?: V1Beta1UnbondingDelegationEntry[];
}

View File

@ -39,7 +39,11 @@ export interface PageRequest {
* is set.
*/
count_total: boolean;
/** reverse is set to true if results are to be returned in the descending order. */
/**
* reverse is set to true if results are to be returned in the descending order.
*
* Since: cosmos-sdk 0.43
*/
reverse: boolean;
}

View File

@ -5,7 +5,11 @@ import { Writer, Reader } from "protobufjs/minimal";
export const protobufPackage = "cosmos.staking.v1beta1";
/** AuthorizationType defines the type of staking module authorization type */
/**
* AuthorizationType defines the type of staking module authorization type
*
* Since: cosmos-sdk 0.43
*/
export enum AuthorizationType {
/** AUTHORIZATION_TYPE_UNSPECIFIED - AUTHORIZATION_TYPE_UNSPECIFIED specifies an unknown authorization type */
AUTHORIZATION_TYPE_UNSPECIFIED = 0,
@ -54,7 +58,11 @@ export function authorizationTypeToJSON(object: AuthorizationType): string {
}
}
/** StakeAuthorization defines authorization for delegate/undelegate/redelegate. */
/**
* StakeAuthorization defines authorization for delegate/undelegate/redelegate.
*
* Since: cosmos-sdk 0.43
*/
export interface StakeAuthorization {
/**
* max_tokens specifies the maximum amount of tokens can be delegate to a validator. If it is

View File

@ -53,6 +53,14 @@ export interface Abciv1Beta1Result {
events?: AbciEvent[];
}
export interface CryptoPublicKey {
/** @format byte */
ed25519?: string;
/** @format byte */
secp256k1?: string;
}
/**
* `Any` contains an arbitrary serialized protocol buffer message along with a
URL that describes the type of the serialized message.
@ -177,6 +185,267 @@ export interface RpcStatus {
details?: ProtobufAny[];
}
export interface TenderminttypesData {
/**
* Txs that will be applied by state @ block.Height+1.
* NOTE: not all txs here are valid. We're just agreeing on the order first.
* This means that block.AppHash does not include these txs.
*/
txs?: string[];
}
export interface TenderminttypesEvidence {
/** DuplicateVoteEvidence contains evidence of a validator signed two conflicting votes. */
duplicate_vote_evidence?: TypesDuplicateVoteEvidence;
/** LightClientAttackEvidence contains evidence of a set of validators attempting to mislead a light client. */
light_client_attack_evidence?: TypesLightClientAttackEvidence;
}
export interface TenderminttypesValidator {
/** @format byte */
address?: string;
pub_key?: CryptoPublicKey;
/** @format int64 */
voting_power?: string;
/** @format int64 */
proposer_priority?: string;
}
export interface TypesBlock {
/** Header defines the structure of a Tendermint block header. */
header?: TypesHeader;
data?: TenderminttypesData;
evidence?: TypesEvidenceList;
/** Commit contains the evidence that a block was committed by a set of validators. */
last_commit?: TypesCommit;
}
export interface TypesBlockID {
/** @format byte */
hash?: string;
part_set_header?: TypesPartSetHeader;
}
export enum TypesBlockIDFlag {
BLOCK_ID_FLAG_UNKNOWN = "BLOCK_ID_FLAG_UNKNOWN",
BLOCK_ID_FLAG_ABSENT = "BLOCK_ID_FLAG_ABSENT",
BLOCK_ID_FLAG_COMMIT = "BLOCK_ID_FLAG_COMMIT",
BLOCK_ID_FLAG_NIL = "BLOCK_ID_FLAG_NIL",
}
/**
* Commit contains the evidence that a block was committed by a set of validators.
*/
export interface TypesCommit {
/** @format int64 */
height?: string;
/** @format int32 */
round?: number;
block_id?: TypesBlockID;
signatures?: TypesCommitSig[];
}
/**
* CommitSig is a part of the Vote included in a Commit.
*/
export interface TypesCommitSig {
block_id_flag?: TypesBlockIDFlag;
/** @format byte */
validator_address?: string;
/** @format date-time */
timestamp?: string;
/** @format byte */
signature?: string;
}
/**
* DuplicateVoteEvidence contains evidence of a validator signed two conflicting votes.
*/
export interface TypesDuplicateVoteEvidence {
/**
* Vote represents a prevote, precommit, or commit vote from validators for
* consensus.
*/
vote_a?: TypesVote;
/**
* Vote represents a prevote, precommit, or commit vote from validators for
* consensus.
*/
vote_b?: TypesVote;
/** @format int64 */
total_voting_power?: string;
/** @format int64 */
validator_power?: string;
/** @format date-time */
timestamp?: string;
}
export interface TypesEvidenceList {
evidence?: TenderminttypesEvidence[];
}
/**
* Header defines the structure of a Tendermint block header.
*/
export interface TypesHeader {
/**
* Consensus captures the consensus rules for processing a block in the blockchain,
* including all blockchain data structures and the rules of the application's
* state transition machine.
*/
version?: VersionConsensus;
chain_id?: string;
/** @format int64 */
height?: string;
/** @format date-time */
time?: string;
last_block_id?: TypesBlockID;
/**
* commit from validators from the last block
* @format byte
*/
last_commit_hash?: string;
/** @format byte */
data_hash?: string;
/**
* validators for the current block
* @format byte
*/
validators_hash?: string;
/** @format byte */
next_validators_hash?: string;
/** @format byte */
consensus_hash?: string;
/** @format byte */
app_hash?: string;
/** @format byte */
last_results_hash?: string;
/**
* evidence included in the block
* @format byte
*/
evidence_hash?: string;
/** @format byte */
proposer_address?: string;
}
export interface TypesLightBlock {
signed_header?: TypesSignedHeader;
validator_set?: TypesValidatorSet;
}
/**
* LightClientAttackEvidence contains evidence of a set of validators attempting to mislead a light client.
*/
export interface TypesLightClientAttackEvidence {
conflicting_block?: TypesLightBlock;
/** @format int64 */
common_height?: string;
byzantine_validators?: TenderminttypesValidator[];
/** @format int64 */
total_voting_power?: string;
/** @format date-time */
timestamp?: string;
}
export interface TypesPartSetHeader {
/** @format int64 */
total?: number;
/** @format byte */
hash?: string;
}
export interface TypesSignedHeader {
/** Header defines the structure of a Tendermint block header. */
header?: TypesHeader;
/** Commit contains the evidence that a block was committed by a set of validators. */
commit?: TypesCommit;
}
/**
* SignedMsgType is a type of signed message in the consensus.
- SIGNED_MSG_TYPE_PREVOTE: Votes
- SIGNED_MSG_TYPE_PROPOSAL: Proposals
*/
export enum TypesSignedMsgType {
SIGNED_MSG_TYPE_UNKNOWN = "SIGNED_MSG_TYPE_UNKNOWN",
SIGNED_MSG_TYPE_PREVOTE = "SIGNED_MSG_TYPE_PREVOTE",
SIGNED_MSG_TYPE_PRECOMMIT = "SIGNED_MSG_TYPE_PRECOMMIT",
SIGNED_MSG_TYPE_PROPOSAL = "SIGNED_MSG_TYPE_PROPOSAL",
}
export interface TypesValidatorSet {
validators?: TenderminttypesValidator[];
proposer?: TenderminttypesValidator;
/** @format int64 */
total_voting_power?: string;
}
/**
* Vote represents a prevote, precommit, or commit vote from validators for
consensus.
*/
export interface TypesVote {
/**
* SignedMsgType is a type of signed message in the consensus.
*
* - SIGNED_MSG_TYPE_PREVOTE: Votes
* - SIGNED_MSG_TYPE_PROPOSAL: Proposals
*/
type?: TypesSignedMsgType;
/** @format int64 */
height?: string;
/** @format int32 */
round?: number;
/** zero if vote is nil. */
block_id?: TypesBlockID;
/** @format date-time */
timestamp?: string;
/** @format byte */
validator_address?: string;
/** @format int32 */
validator_index?: number;
/** @format byte */
signature?: string;
}
/**
* ABCIMessageLog defines a structure containing an indexed tx ABCI message log.
*/
@ -337,6 +606,21 @@ export interface V1Beta1GasInfo {
gas_used?: string;
}
/**
* GetBlockWithTxsResponse is the response type for the Service.GetBlockWithTxs method.
Since: cosmos-sdk 0.45.2
*/
export interface V1Beta1GetBlockWithTxsResponse {
/** txs are the transactions in the block. */
txs?: V1Beta1Tx[];
block_id?: TypesBlockID;
block?: TypesBlock;
/** pagination defines a pagination for the response. */
pagination?: V1Beta1PageResponse;
}
/**
* GetTxResponse is the response type for the Service.GetTx method.
*/
@ -359,7 +643,7 @@ export interface V1Beta1GetTxsEventResponse {
/** tx_responses is the list of queried TxResponses. */
tx_responses?: V1Beta1TxResponse[];
/** pagination defines an pagination for the response. */
/** pagination defines a pagination for the response. */
pagination?: V1Beta1PageResponse;
}
@ -395,6 +679,16 @@ export interface V1Beta1ModeInfoSingle {
* from SIGN_MODE_DIRECT
* - SIGN_MODE_LEGACY_AMINO_JSON: SIGN_MODE_LEGACY_AMINO_JSON is a backwards compatibility mode which uses
* Amino JSON and will be removed in the future
* - SIGN_MODE_EIP_191: SIGN_MODE_EIP_191 specifies the sign mode for EIP 191 signing on the Cosmos
* SDK. Ref: https://eips.ethereum.org/EIPS/eip-191
*
* Currently, SIGN_MODE_EIP_191 is registered as a SignMode enum variant,
* but is not implemented on the SDK by default. To enable EIP-191, you need
* to pass a custom `TxConfig` that has an implementation of
* `SignModeHandler` for EIP-191. The SDK may decide to fully support
* EIP-191 in the future.
*
* Since: cosmos-sdk 0.45.2
*/
mode?: V1Beta1SignMode;
}
@ -448,7 +742,11 @@ export interface V1Beta1PageRequest {
*/
count_total?: boolean;
/** reverse is set to true if results are to be returned in the descending order. */
/**
* reverse is set to true if results are to be returned in the descending order.
*
* Since: cosmos-sdk 0.43
*/
reverse?: boolean;
}
@ -481,12 +779,23 @@ human-readable textual representation on top of the binary representation
from SIGN_MODE_DIRECT
- SIGN_MODE_LEGACY_AMINO_JSON: SIGN_MODE_LEGACY_AMINO_JSON is a backwards compatibility mode which uses
Amino JSON and will be removed in the future
- SIGN_MODE_EIP_191: SIGN_MODE_EIP_191 specifies the sign mode for EIP 191 signing on the Cosmos
SDK. Ref: https://eips.ethereum.org/EIPS/eip-191
Currently, SIGN_MODE_EIP_191 is registered as a SignMode enum variant,
but is not implemented on the SDK by default. To enable EIP-191, you need
to pass a custom `TxConfig` that has an implementation of
`SignModeHandler` for EIP-191. The SDK may decide to fully support
EIP-191 in the future.
Since: cosmos-sdk 0.45.2
*/
export enum V1Beta1SignMode {
SIGN_MODE_UNSPECIFIED = "SIGN_MODE_UNSPECIFIED",
SIGN_MODE_DIRECT = "SIGN_MODE_DIRECT",
SIGN_MODE_TEXTUAL = "SIGN_MODE_TEXTUAL",
SIGN_MODE_LEGACY_AMINO_JSON = "SIGN_MODE_LEGACY_AMINO_JSON",
SIGNMODEEIP191 = "SIGN_MODE_EIP_191",
}
/**
@ -526,6 +835,8 @@ export interface V1Beta1SimulateRequest {
/**
* tx_bytes is the raw transaction.
*
* Since: cosmos-sdk 0.43
* @format byte
*/
tx_bytes?: string;
@ -655,6 +966,29 @@ export interface V1Beta1TxResponse {
* it's genesis time.
*/
timestamp?: string;
/**
* Events defines all the events emitted by processing a transaction. Note,
* these events include those emitted by processing all the messages and those
* emitted from the ante handler. Whereas Logs contains the events, with
* additional metadata, emitted only by processing the messages.
*
* Since: cosmos-sdk 0.42.11, 0.44.5, 0.45
*/
events?: AbciEvent[];
}
/**
* Consensus captures the consensus rules for processing a block in the blockchain,
including all blockchain data structures and the rules of the application's
state transition machine.
*/
export interface VersionConsensus {
/** @format uint64 */
block?: string;
/** @format uint64 */
app?: string;
}
export type QueryParamsType = Record<string | number, any>;
@ -917,6 +1251,33 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
...params,
});
/**
* @description Since: cosmos-sdk 0.45.2
*
* @tags Service
* @name ServiceGetBlockWithTxs
* @summary GetBlockWithTxs fetches a block with decoded txs.
* @request GET:/cosmos/tx/v1beta1/txs/block/{height}
*/
serviceGetBlockWithTxs = (
height: string,
query?: {
"pagination.key"?: string;
"pagination.offset"?: string;
"pagination.limit"?: string;
"pagination.count_total"?: boolean;
"pagination.reverse"?: boolean;
},
params: RequestParams = {},
) =>
this.request<V1Beta1GetBlockWithTxsResponse, RpcStatus>({
path: `/cosmos/tx/v1beta1/txs/block/${height}`,
method: "GET",
query: query,
format: "json",
...params,
});
/**
* No description
*

View File

@ -43,6 +43,15 @@ export interface TxResponse {
* it's genesis time.
*/
timestamp: string;
/**
* Events defines all the events emitted by processing a transaction. Note,
* these events include those emitted by processing all the messages and those
* emitted from the ante handler. Whereas Logs contains the events, with
* additional metadata, emitted only by processing the messages.
*
* Since: cosmos-sdk 0.42.11, 0.44.5, 0.45
*/
events: Event[];
}
/** ABCIMessageLog defines a structure containing an indexed tx ABCI message log. */
@ -191,6 +200,9 @@ export const TxResponse = {
if (message.timestamp !== "") {
writer.uint32(98).string(message.timestamp);
}
for (const v of message.events) {
Event.encode(v!, writer.uint32(106).fork()).ldelim();
}
return writer;
},
@ -199,6 +211,7 @@ export const TxResponse = {
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseTxResponse } as TxResponse;
message.logs = [];
message.events = [];
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
@ -238,6 +251,9 @@ export const TxResponse = {
case 12:
message.timestamp = reader.string();
break;
case 13:
message.events.push(Event.decode(reader, reader.uint32()));
break;
default:
reader.skipType(tag & 7);
break;
@ -249,6 +265,7 @@ export const TxResponse = {
fromJSON(object: any): TxResponse {
const message = { ...baseTxResponse } as TxResponse;
message.logs = [];
message.events = [];
if (object.height !== undefined && object.height !== null) {
message.height = Number(object.height);
} else {
@ -309,6 +326,11 @@ export const TxResponse = {
} else {
message.timestamp = "";
}
if (object.events !== undefined && object.events !== null) {
for (const e of object.events) {
message.events.push(Event.fromJSON(e));
}
}
return message;
},
@ -333,12 +355,18 @@ export const TxResponse = {
message.tx !== undefined &&
(obj.tx = message.tx ? Any.toJSON(message.tx) : undefined);
message.timestamp !== undefined && (obj.timestamp = message.timestamp);
if (message.events) {
obj.events = message.events.map((e) => (e ? Event.toJSON(e) : undefined));
} else {
obj.events = [];
}
return obj;
},
fromPartial(object: DeepPartial<TxResponse>): TxResponse {
const message = { ...baseTxResponse } as TxResponse;
message.logs = [];
message.events = [];
if (object.height !== undefined && object.height !== null) {
message.height = object.height;
} else {
@ -399,6 +427,11 @@ export const TxResponse = {
} else {
message.timestamp = "";
}
if (object.events !== undefined && object.events !== null) {
for (const e of object.events) {
message.events.push(Event.fromPartial(e));
}
}
return message;
},
};

View File

@ -39,7 +39,11 @@ export interface PageRequest {
* is set.
*/
count_total: boolean;
/** reverse is set to true if results are to be returned in the descending order. */
/**
* reverse is set to true if results are to be returned in the descending order.
*
* Since: cosmos-sdk 0.43
*/
reverse: boolean;
}

View File

@ -30,6 +30,19 @@ export enum SignMode {
* Amino JSON and will be removed in the future
*/
SIGN_MODE_LEGACY_AMINO_JSON = 127,
/**
* SIGN_MODE_EIP_191 - SIGN_MODE_EIP_191 specifies the sign mode for EIP 191 signing on the Cosmos
* SDK. Ref: https://eips.ethereum.org/EIPS/eip-191
*
* Currently, SIGN_MODE_EIP_191 is registered as a SignMode enum variant,
* but is not implemented on the SDK by default. To enable EIP-191, you need
* to pass a custom `TxConfig` that has an implementation of
* `SignModeHandler` for EIP-191. The SDK may decide to fully support
* EIP-191 in the future.
*
* Since: cosmos-sdk 0.45.2
*/
SIGN_MODE_EIP_191 = 191,
UNRECOGNIZED = -1,
}
@ -47,6 +60,9 @@ export function signModeFromJSON(object: any): SignMode {
case 127:
case "SIGN_MODE_LEGACY_AMINO_JSON":
return SignMode.SIGN_MODE_LEGACY_AMINO_JSON;
case 191:
case "SIGN_MODE_EIP_191":
return SignMode.SIGN_MODE_EIP_191;
case -1:
case "UNRECOGNIZED":
default:
@ -64,6 +80,8 @@ export function signModeToJSON(object: SignMode): string {
return "SIGN_MODE_TEXTUAL";
case SignMode.SIGN_MODE_LEGACY_AMINO_JSON:
return "SIGN_MODE_LEGACY_AMINO_JSON";
case SignMode.SIGN_MODE_EIP_191:
return "SIGN_MODE_EIP_191";
default:
return "UNKNOWN";
}

View File

@ -1,6 +1,7 @@
//@ts-nocheck
/* eslint-disable */
import { Reader, Writer } from "protobufjs/minimal";
import { Reader, util, configure, Writer } from "protobufjs/minimal";
import * as Long from "long";
import {
PageRequest,
PageResponse,
@ -11,6 +12,8 @@ import {
GasInfo,
Result,
} from "../../../cosmos/base/abci/v1beta1/abci";
import { BlockID } from "../../../tendermint/types/types";
import { Block } from "../../../tendermint/types/block";
export const protobufPackage = "cosmos.tx.v1beta1";
@ -121,7 +124,7 @@ export function broadcastModeToJSON(object: BroadcastMode): string {
export interface GetTxsEventRequest {
/** events is the list of transaction event type. */
events: string[];
/** pagination defines an pagination for the request. */
/** pagination defines a pagination for the request. */
pagination: PageRequest | undefined;
order_by: OrderBy;
}
@ -135,7 +138,7 @@ export interface GetTxsEventResponse {
txs: Tx[];
/** tx_responses is the list of queried TxResponses. */
tx_responses: TxResponse[];
/** pagination defines an pagination for the response. */
/** pagination defines a pagination for the response. */
pagination: PageResponse | undefined;
}
@ -170,7 +173,11 @@ export interface SimulateRequest {
* @deprecated
*/
tx: Tx | undefined;
/** tx_bytes is the raw transaction. */
/**
* tx_bytes is the raw transaction.
*
* Since: cosmos-sdk 0.43
*/
tx_bytes: Uint8Array;
}
@ -202,6 +209,33 @@ export interface GetTxResponse {
tx_response: TxResponse | undefined;
}
/**
* GetBlockWithTxsRequest is the request type for the Service.GetBlockWithTxs
* RPC method.
*
* Since: cosmos-sdk 0.45.2
*/
export interface GetBlockWithTxsRequest {
/** height is the height of the block to query. */
height: number;
/** pagination defines a pagination for the request. */
pagination: PageRequest | undefined;
}
/**
* GetBlockWithTxsResponse is the response type for the Service.GetBlockWithTxs method.
*
* Since: cosmos-sdk 0.45.2
*/
export interface GetBlockWithTxsResponse {
/** txs are the transactions in the block. */
txs: Tx[];
block_id: BlockID | undefined;
block: Block | undefined;
/** pagination defines a pagination for the response. */
pagination: PageResponse | undefined;
}
const baseGetTxsEventRequest: object = { events: "", order_by: 0 };
export const GetTxsEventRequest = {
@ -838,6 +872,220 @@ export const GetTxResponse = {
},
};
const baseGetBlockWithTxsRequest: object = { height: 0 };
export const GetBlockWithTxsRequest = {
encode(
message: GetBlockWithTxsRequest,
writer: Writer = Writer.create()
): Writer {
if (message.height !== 0) {
writer.uint32(8).int64(message.height);
}
if (message.pagination !== undefined) {
PageRequest.encode(message.pagination, writer.uint32(18).fork()).ldelim();
}
return writer;
},
decode(input: Reader | Uint8Array, length?: number): GetBlockWithTxsRequest {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseGetBlockWithTxsRequest } as GetBlockWithTxsRequest;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.height = longToNumber(reader.int64() as Long);
break;
case 2:
message.pagination = PageRequest.decode(reader, reader.uint32());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): GetBlockWithTxsRequest {
const message = { ...baseGetBlockWithTxsRequest } as GetBlockWithTxsRequest;
if (object.height !== undefined && object.height !== null) {
message.height = Number(object.height);
} else {
message.height = 0;
}
if (object.pagination !== undefined && object.pagination !== null) {
message.pagination = PageRequest.fromJSON(object.pagination);
} else {
message.pagination = undefined;
}
return message;
},
toJSON(message: GetBlockWithTxsRequest): unknown {
const obj: any = {};
message.height !== undefined && (obj.height = message.height);
message.pagination !== undefined &&
(obj.pagination = message.pagination
? PageRequest.toJSON(message.pagination)
: undefined);
return obj;
},
fromPartial(
object: DeepPartial<GetBlockWithTxsRequest>
): GetBlockWithTxsRequest {
const message = { ...baseGetBlockWithTxsRequest } as GetBlockWithTxsRequest;
if (object.height !== undefined && object.height !== null) {
message.height = object.height;
} else {
message.height = 0;
}
if (object.pagination !== undefined && object.pagination !== null) {
message.pagination = PageRequest.fromPartial(object.pagination);
} else {
message.pagination = undefined;
}
return message;
},
};
const baseGetBlockWithTxsResponse: object = {};
export const GetBlockWithTxsResponse = {
encode(
message: GetBlockWithTxsResponse,
writer: Writer = Writer.create()
): Writer {
for (const v of message.txs) {
Tx.encode(v!, writer.uint32(10).fork()).ldelim();
}
if (message.block_id !== undefined) {
BlockID.encode(message.block_id, writer.uint32(18).fork()).ldelim();
}
if (message.block !== undefined) {
Block.encode(message.block, writer.uint32(26).fork()).ldelim();
}
if (message.pagination !== undefined) {
PageResponse.encode(
message.pagination,
writer.uint32(34).fork()
).ldelim();
}
return writer;
},
decode(input: Reader | Uint8Array, length?: number): GetBlockWithTxsResponse {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = {
...baseGetBlockWithTxsResponse,
} as GetBlockWithTxsResponse;
message.txs = [];
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.txs.push(Tx.decode(reader, reader.uint32()));
break;
case 2:
message.block_id = BlockID.decode(reader, reader.uint32());
break;
case 3:
message.block = Block.decode(reader, reader.uint32());
break;
case 4:
message.pagination = PageResponse.decode(reader, reader.uint32());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): GetBlockWithTxsResponse {
const message = {
...baseGetBlockWithTxsResponse,
} as GetBlockWithTxsResponse;
message.txs = [];
if (object.txs !== undefined && object.txs !== null) {
for (const e of object.txs) {
message.txs.push(Tx.fromJSON(e));
}
}
if (object.block_id !== undefined && object.block_id !== null) {
message.block_id = BlockID.fromJSON(object.block_id);
} else {
message.block_id = undefined;
}
if (object.block !== undefined && object.block !== null) {
message.block = Block.fromJSON(object.block);
} else {
message.block = undefined;
}
if (object.pagination !== undefined && object.pagination !== null) {
message.pagination = PageResponse.fromJSON(object.pagination);
} else {
message.pagination = undefined;
}
return message;
},
toJSON(message: GetBlockWithTxsResponse): unknown {
const obj: any = {};
if (message.txs) {
obj.txs = message.txs.map((e) => (e ? Tx.toJSON(e) : undefined));
} else {
obj.txs = [];
}
message.block_id !== undefined &&
(obj.block_id = message.block_id
? BlockID.toJSON(message.block_id)
: undefined);
message.block !== undefined &&
(obj.block = message.block ? Block.toJSON(message.block) : undefined);
message.pagination !== undefined &&
(obj.pagination = message.pagination
? PageResponse.toJSON(message.pagination)
: undefined);
return obj;
},
fromPartial(
object: DeepPartial<GetBlockWithTxsResponse>
): GetBlockWithTxsResponse {
const message = {
...baseGetBlockWithTxsResponse,
} as GetBlockWithTxsResponse;
message.txs = [];
if (object.txs !== undefined && object.txs !== null) {
for (const e of object.txs) {
message.txs.push(Tx.fromPartial(e));
}
}
if (object.block_id !== undefined && object.block_id !== null) {
message.block_id = BlockID.fromPartial(object.block_id);
} else {
message.block_id = undefined;
}
if (object.block !== undefined && object.block !== null) {
message.block = Block.fromPartial(object.block);
} else {
message.block = undefined;
}
if (object.pagination !== undefined && object.pagination !== null) {
message.pagination = PageResponse.fromPartial(object.pagination);
} else {
message.pagination = undefined;
}
return message;
},
};
/** Service defines a gRPC service for interacting with transactions. */
export interface Service {
/** Simulate simulates executing a transaction for estimating gas usage. */
@ -848,6 +1096,14 @@ export interface Service {
BroadcastTx(request: BroadcastTxRequest): Promise<BroadcastTxResponse>;
/** GetTxsEvent fetches txs by event. */
GetTxsEvent(request: GetTxsEventRequest): Promise<GetTxsEventResponse>;
/**
* GetBlockWithTxs fetches a block with decoded txs.
*
* Since: cosmos-sdk 0.45.2
*/
GetBlockWithTxs(
request: GetBlockWithTxsRequest
): Promise<GetBlockWithTxsResponse>;
}
export class ServiceClientImpl implements Service {
@ -894,6 +1150,20 @@ export class ServiceClientImpl implements Service {
);
return promise.then((data) => GetTxsEventResponse.decode(new Reader(data)));
}
GetBlockWithTxs(
request: GetBlockWithTxsRequest
): Promise<GetBlockWithTxsResponse> {
const data = GetBlockWithTxsRequest.encode(request).finish();
const promise = this.rpc.request(
"cosmos.tx.v1beta1.Service",
"GetBlockWithTxs",
data
);
return promise.then((data) =>
GetBlockWithTxsResponse.decode(new Reader(data))
);
}
}
interface Rpc {
@ -947,3 +1217,15 @@ export type DeepPartial<T> = T extends Builtin
: T extends {}
? { [K in keyof T]?: DeepPartial<T[K]> }
: Partial<T>;
function longToNumber(long: Long): number {
if (long.gt(Number.MAX_SAFE_INTEGER)) {
throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
}
return long.toNumber();
}
if (util.Long !== Long) {
util.Long = Long as any;
configure();
}

View File

@ -0,0 +1,139 @@
//@ts-nocheck
/* eslint-disable */
import { Header, Data, Commit } from "../../tendermint/types/types";
import { EvidenceList } from "../../tendermint/types/evidence";
import { Writer, Reader } from "protobufjs/minimal";
export const protobufPackage = "tendermint.types";
export interface Block {
header: Header | undefined;
data: Data | undefined;
evidence: EvidenceList | undefined;
last_commit: Commit | undefined;
}
const baseBlock: object = {};
export const Block = {
encode(message: Block, writer: Writer = Writer.create()): Writer {
if (message.header !== undefined) {
Header.encode(message.header, writer.uint32(10).fork()).ldelim();
}
if (message.data !== undefined) {
Data.encode(message.data, writer.uint32(18).fork()).ldelim();
}
if (message.evidence !== undefined) {
EvidenceList.encode(message.evidence, writer.uint32(26).fork()).ldelim();
}
if (message.last_commit !== undefined) {
Commit.encode(message.last_commit, writer.uint32(34).fork()).ldelim();
}
return writer;
},
decode(input: Reader | Uint8Array, length?: number): Block {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseBlock } as Block;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.header = Header.decode(reader, reader.uint32());
break;
case 2:
message.data = Data.decode(reader, reader.uint32());
break;
case 3:
message.evidence = EvidenceList.decode(reader, reader.uint32());
break;
case 4:
message.last_commit = Commit.decode(reader, reader.uint32());
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): Block {
const message = { ...baseBlock } as Block;
if (object.header !== undefined && object.header !== null) {
message.header = Header.fromJSON(object.header);
} else {
message.header = undefined;
}
if (object.data !== undefined && object.data !== null) {
message.data = Data.fromJSON(object.data);
} else {
message.data = undefined;
}
if (object.evidence !== undefined && object.evidence !== null) {
message.evidence = EvidenceList.fromJSON(object.evidence);
} else {
message.evidence = undefined;
}
if (object.last_commit !== undefined && object.last_commit !== null) {
message.last_commit = Commit.fromJSON(object.last_commit);
} else {
message.last_commit = undefined;
}
return message;
},
toJSON(message: Block): unknown {
const obj: any = {};
message.header !== undefined &&
(obj.header = message.header ? Header.toJSON(message.header) : undefined);
message.data !== undefined &&
(obj.data = message.data ? Data.toJSON(message.data) : undefined);
message.evidence !== undefined &&
(obj.evidence = message.evidence
? EvidenceList.toJSON(message.evidence)
: undefined);
message.last_commit !== undefined &&
(obj.last_commit = message.last_commit
? Commit.toJSON(message.last_commit)
: undefined);
return obj;
},
fromPartial(object: DeepPartial<Block>): Block {
const message = { ...baseBlock } as Block;
if (object.header !== undefined && object.header !== null) {
message.header = Header.fromPartial(object.header);
} else {
message.header = undefined;
}
if (object.data !== undefined && object.data !== null) {
message.data = Data.fromPartial(object.data);
} else {
message.data = undefined;
}
if (object.evidence !== undefined && object.evidence !== null) {
message.evidence = EvidenceList.fromPartial(object.evidence);
} else {
message.evidence = undefined;
}
if (object.last_commit !== undefined && object.last_commit !== null) {
message.last_commit = Commit.fromPartial(object.last_commit);
} else {
message.last_commit = undefined;
}
return message;
},
};
type Builtin = Date | Function | Uint8Array | string | number | undefined;
export type DeepPartial<T> = T extends Builtin
? T
: 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>;

View File

@ -0,0 +1,612 @@
//@ts-nocheck
/* eslint-disable */
import { Timestamp } from "../../google/protobuf/timestamp";
import * as Long from "long";
import { util, configure, Writer, Reader } from "protobufjs/minimal";
import { Vote, LightBlock } from "../../tendermint/types/types";
import { Validator } from "../../tendermint/types/validator";
export const protobufPackage = "tendermint.types";
export interface Evidence {
duplicate_vote_evidence: DuplicateVoteEvidence | undefined;
light_client_attack_evidence: LightClientAttackEvidence | undefined;
}
/** DuplicateVoteEvidence contains evidence of a validator signed two conflicting votes. */
export interface DuplicateVoteEvidence {
vote_a: Vote | undefined;
vote_b: Vote | undefined;
total_voting_power: number;
validator_power: number;
timestamp: Date | undefined;
}
/** LightClientAttackEvidence contains evidence of a set of validators attempting to mislead a light client. */
export interface LightClientAttackEvidence {
conflicting_block: LightBlock | undefined;
common_height: number;
byzantine_validators: Validator[];
total_voting_power: number;
timestamp: Date | undefined;
}
export interface EvidenceList {
evidence: Evidence[];
}
const baseEvidence: object = {};
export const Evidence = {
encode(message: Evidence, writer: Writer = Writer.create()): Writer {
if (message.duplicate_vote_evidence !== undefined) {
DuplicateVoteEvidence.encode(
message.duplicate_vote_evidence,
writer.uint32(10).fork()
).ldelim();
}
if (message.light_client_attack_evidence !== undefined) {
LightClientAttackEvidence.encode(
message.light_client_attack_evidence,
writer.uint32(18).fork()
).ldelim();
}
return writer;
},
decode(input: Reader | Uint8Array, length?: number): Evidence {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseEvidence } as Evidence;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.duplicate_vote_evidence = DuplicateVoteEvidence.decode(
reader,
reader.uint32()
);
break;
case 2:
message.light_client_attack_evidence = LightClientAttackEvidence.decode(
reader,
reader.uint32()
);
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): Evidence {
const message = { ...baseEvidence } as Evidence;
if (
object.duplicate_vote_evidence !== undefined &&
object.duplicate_vote_evidence !== null
) {
message.duplicate_vote_evidence = DuplicateVoteEvidence.fromJSON(
object.duplicate_vote_evidence
);
} else {
message.duplicate_vote_evidence = undefined;
}
if (
object.light_client_attack_evidence !== undefined &&
object.light_client_attack_evidence !== null
) {
message.light_client_attack_evidence = LightClientAttackEvidence.fromJSON(
object.light_client_attack_evidence
);
} else {
message.light_client_attack_evidence = undefined;
}
return message;
},
toJSON(message: Evidence): unknown {
const obj: any = {};
message.duplicate_vote_evidence !== undefined &&
(obj.duplicate_vote_evidence = message.duplicate_vote_evidence
? DuplicateVoteEvidence.toJSON(message.duplicate_vote_evidence)
: undefined);
message.light_client_attack_evidence !== undefined &&
(obj.light_client_attack_evidence = message.light_client_attack_evidence
? LightClientAttackEvidence.toJSON(message.light_client_attack_evidence)
: undefined);
return obj;
},
fromPartial(object: DeepPartial<Evidence>): Evidence {
const message = { ...baseEvidence } as Evidence;
if (
object.duplicate_vote_evidence !== undefined &&
object.duplicate_vote_evidence !== null
) {
message.duplicate_vote_evidence = DuplicateVoteEvidence.fromPartial(
object.duplicate_vote_evidence
);
} else {
message.duplicate_vote_evidence = undefined;
}
if (
object.light_client_attack_evidence !== undefined &&
object.light_client_attack_evidence !== null
) {
message.light_client_attack_evidence = LightClientAttackEvidence.fromPartial(
object.light_client_attack_evidence
);
} else {
message.light_client_attack_evidence = undefined;
}
return message;
},
};
const baseDuplicateVoteEvidence: object = {
total_voting_power: 0,
validator_power: 0,
};
export const DuplicateVoteEvidence = {
encode(
message: DuplicateVoteEvidence,
writer: Writer = Writer.create()
): Writer {
if (message.vote_a !== undefined) {
Vote.encode(message.vote_a, writer.uint32(10).fork()).ldelim();
}
if (message.vote_b !== undefined) {
Vote.encode(message.vote_b, writer.uint32(18).fork()).ldelim();
}
if (message.total_voting_power !== 0) {
writer.uint32(24).int64(message.total_voting_power);
}
if (message.validator_power !== 0) {
writer.uint32(32).int64(message.validator_power);
}
if (message.timestamp !== undefined) {
Timestamp.encode(
toTimestamp(message.timestamp),
writer.uint32(42).fork()
).ldelim();
}
return writer;
},
decode(input: Reader | Uint8Array, length?: number): DuplicateVoteEvidence {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseDuplicateVoteEvidence } as DuplicateVoteEvidence;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.vote_a = Vote.decode(reader, reader.uint32());
break;
case 2:
message.vote_b = Vote.decode(reader, reader.uint32());
break;
case 3:
message.total_voting_power = longToNumber(reader.int64() as Long);
break;
case 4:
message.validator_power = longToNumber(reader.int64() as Long);
break;
case 5:
message.timestamp = fromTimestamp(
Timestamp.decode(reader, reader.uint32())
);
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): DuplicateVoteEvidence {
const message = { ...baseDuplicateVoteEvidence } as DuplicateVoteEvidence;
if (object.vote_a !== undefined && object.vote_a !== null) {
message.vote_a = Vote.fromJSON(object.vote_a);
} else {
message.vote_a = undefined;
}
if (object.vote_b !== undefined && object.vote_b !== null) {
message.vote_b = Vote.fromJSON(object.vote_b);
} else {
message.vote_b = undefined;
}
if (
object.total_voting_power !== undefined &&
object.total_voting_power !== null
) {
message.total_voting_power = Number(object.total_voting_power);
} else {
message.total_voting_power = 0;
}
if (
object.validator_power !== undefined &&
object.validator_power !== null
) {
message.validator_power = Number(object.validator_power);
} else {
message.validator_power = 0;
}
if (object.timestamp !== undefined && object.timestamp !== null) {
message.timestamp = fromJsonTimestamp(object.timestamp);
} else {
message.timestamp = undefined;
}
return message;
},
toJSON(message: DuplicateVoteEvidence): unknown {
const obj: any = {};
message.vote_a !== undefined &&
(obj.vote_a = message.vote_a ? Vote.toJSON(message.vote_a) : undefined);
message.vote_b !== undefined &&
(obj.vote_b = message.vote_b ? Vote.toJSON(message.vote_b) : undefined);
message.total_voting_power !== undefined &&
(obj.total_voting_power = message.total_voting_power);
message.validator_power !== undefined &&
(obj.validator_power = message.validator_power);
message.timestamp !== undefined &&
(obj.timestamp =
message.timestamp !== undefined
? message.timestamp.toISOString()
: null);
return obj;
},
fromPartial(
object: DeepPartial<DuplicateVoteEvidence>
): DuplicateVoteEvidence {
const message = { ...baseDuplicateVoteEvidence } as DuplicateVoteEvidence;
if (object.vote_a !== undefined && object.vote_a !== null) {
message.vote_a = Vote.fromPartial(object.vote_a);
} else {
message.vote_a = undefined;
}
if (object.vote_b !== undefined && object.vote_b !== null) {
message.vote_b = Vote.fromPartial(object.vote_b);
} else {
message.vote_b = undefined;
}
if (
object.total_voting_power !== undefined &&
object.total_voting_power !== null
) {
message.total_voting_power = object.total_voting_power;
} else {
message.total_voting_power = 0;
}
if (
object.validator_power !== undefined &&
object.validator_power !== null
) {
message.validator_power = object.validator_power;
} else {
message.validator_power = 0;
}
if (object.timestamp !== undefined && object.timestamp !== null) {
message.timestamp = object.timestamp;
} else {
message.timestamp = undefined;
}
return message;
},
};
const baseLightClientAttackEvidence: object = {
common_height: 0,
total_voting_power: 0,
};
export const LightClientAttackEvidence = {
encode(
message: LightClientAttackEvidence,
writer: Writer = Writer.create()
): Writer {
if (message.conflicting_block !== undefined) {
LightBlock.encode(
message.conflicting_block,
writer.uint32(10).fork()
).ldelim();
}
if (message.common_height !== 0) {
writer.uint32(16).int64(message.common_height);
}
for (const v of message.byzantine_validators) {
Validator.encode(v!, writer.uint32(26).fork()).ldelim();
}
if (message.total_voting_power !== 0) {
writer.uint32(32).int64(message.total_voting_power);
}
if (message.timestamp !== undefined) {
Timestamp.encode(
toTimestamp(message.timestamp),
writer.uint32(42).fork()
).ldelim();
}
return writer;
},
decode(
input: Reader | Uint8Array,
length?: number
): LightClientAttackEvidence {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = {
...baseLightClientAttackEvidence,
} as LightClientAttackEvidence;
message.byzantine_validators = [];
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.conflicting_block = LightBlock.decode(
reader,
reader.uint32()
);
break;
case 2:
message.common_height = longToNumber(reader.int64() as Long);
break;
case 3:
message.byzantine_validators.push(
Validator.decode(reader, reader.uint32())
);
break;
case 4:
message.total_voting_power = longToNumber(reader.int64() as Long);
break;
case 5:
message.timestamp = fromTimestamp(
Timestamp.decode(reader, reader.uint32())
);
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): LightClientAttackEvidence {
const message = {
...baseLightClientAttackEvidence,
} as LightClientAttackEvidence;
message.byzantine_validators = [];
if (
object.conflicting_block !== undefined &&
object.conflicting_block !== null
) {
message.conflicting_block = LightBlock.fromJSON(object.conflicting_block);
} else {
message.conflicting_block = undefined;
}
if (object.common_height !== undefined && object.common_height !== null) {
message.common_height = Number(object.common_height);
} else {
message.common_height = 0;
}
if (
object.byzantine_validators !== undefined &&
object.byzantine_validators !== null
) {
for (const e of object.byzantine_validators) {
message.byzantine_validators.push(Validator.fromJSON(e));
}
}
if (
object.total_voting_power !== undefined &&
object.total_voting_power !== null
) {
message.total_voting_power = Number(object.total_voting_power);
} else {
message.total_voting_power = 0;
}
if (object.timestamp !== undefined && object.timestamp !== null) {
message.timestamp = fromJsonTimestamp(object.timestamp);
} else {
message.timestamp = undefined;
}
return message;
},
toJSON(message: LightClientAttackEvidence): unknown {
const obj: any = {};
message.conflicting_block !== undefined &&
(obj.conflicting_block = message.conflicting_block
? LightBlock.toJSON(message.conflicting_block)
: undefined);
message.common_height !== undefined &&
(obj.common_height = message.common_height);
if (message.byzantine_validators) {
obj.byzantine_validators = message.byzantine_validators.map((e) =>
e ? Validator.toJSON(e) : undefined
);
} else {
obj.byzantine_validators = [];
}
message.total_voting_power !== undefined &&
(obj.total_voting_power = message.total_voting_power);
message.timestamp !== undefined &&
(obj.timestamp =
message.timestamp !== undefined
? message.timestamp.toISOString()
: null);
return obj;
},
fromPartial(
object: DeepPartial<LightClientAttackEvidence>
): LightClientAttackEvidence {
const message = {
...baseLightClientAttackEvidence,
} as LightClientAttackEvidence;
message.byzantine_validators = [];
if (
object.conflicting_block !== undefined &&
object.conflicting_block !== null
) {
message.conflicting_block = LightBlock.fromPartial(
object.conflicting_block
);
} else {
message.conflicting_block = undefined;
}
if (object.common_height !== undefined && object.common_height !== null) {
message.common_height = object.common_height;
} else {
message.common_height = 0;
}
if (
object.byzantine_validators !== undefined &&
object.byzantine_validators !== null
) {
for (const e of object.byzantine_validators) {
message.byzantine_validators.push(Validator.fromPartial(e));
}
}
if (
object.total_voting_power !== undefined &&
object.total_voting_power !== null
) {
message.total_voting_power = object.total_voting_power;
} else {
message.total_voting_power = 0;
}
if (object.timestamp !== undefined && object.timestamp !== null) {
message.timestamp = object.timestamp;
} else {
message.timestamp = undefined;
}
return message;
},
};
const baseEvidenceList: object = {};
export const EvidenceList = {
encode(message: EvidenceList, writer: Writer = Writer.create()): Writer {
for (const v of message.evidence) {
Evidence.encode(v!, writer.uint32(10).fork()).ldelim();
}
return writer;
},
decode(input: Reader | Uint8Array, length?: number): EvidenceList {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseEvidenceList } as EvidenceList;
message.evidence = [];
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.evidence.push(Evidence.decode(reader, reader.uint32()));
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): EvidenceList {
const message = { ...baseEvidenceList } as EvidenceList;
message.evidence = [];
if (object.evidence !== undefined && object.evidence !== null) {
for (const e of object.evidence) {
message.evidence.push(Evidence.fromJSON(e));
}
}
return message;
},
toJSON(message: EvidenceList): unknown {
const obj: any = {};
if (message.evidence) {
obj.evidence = message.evidence.map((e) =>
e ? Evidence.toJSON(e) : undefined
);
} else {
obj.evidence = [];
}
return obj;
},
fromPartial(object: DeepPartial<EvidenceList>): EvidenceList {
const message = { ...baseEvidenceList } as EvidenceList;
message.evidence = [];
if (object.evidence !== undefined && object.evidence !== null) {
for (const e of object.evidence) {
message.evidence.push(Evidence.fromPartial(e));
}
}
return message;
},
};
declare var self: any | undefined;
declare var window: any | undefined;
var globalThis: any = (() => {
if (typeof globalThis !== "undefined") return globalThis;
if (typeof self !== "undefined") return self;
if (typeof window !== "undefined") return window;
if (typeof global !== "undefined") return global;
throw "Unable to locate global object";
})();
type Builtin = Date | Function | Uint8Array | string | number | undefined;
export type DeepPartial<T> = T extends Builtin
? T
: 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>;
function toTimestamp(date: Date): Timestamp {
const seconds = date.getTime() / 1_000;
const nanos = (date.getTime() % 1_000) * 1_000_000;
return { seconds, nanos };
}
function fromTimestamp(t: Timestamp): Date {
let millis = t.seconds * 1_000;
millis += t.nanos / 1_000_000;
return new Date(millis);
}
function fromJsonTimestamp(o: any): Date {
if (o instanceof Date) {
return o;
} else if (typeof o === "string") {
return new Date(o);
} else {
return fromTimestamp(Timestamp.fromJSON(o));
}
}
function longToNumber(long: Long): number {
if (long.gt(Number.MAX_SAFE_INTEGER)) {
throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
}
return long.toNumber();
}
if (util.Long !== Long) {
util.Long = Long as any;
configure();
}

View File

@ -135,8 +135,10 @@ export interface RpcStatus {
}
/**
* ModuleVersion specifies a module and its consensus version.
*/
* ModuleVersion specifies a module and its consensus version.
Since: cosmos-sdk 0.43
*/
export interface V1Beta1ModuleVersion {
name?: string;
@ -207,6 +209,8 @@ export interface V1Beta1QueryCurrentPlanResponse {
/**
* QueryModuleVersionsResponse is the response type for the Query/ModuleVersions
RPC method.
Since: cosmos-sdk 0.43
*/
export interface V1Beta1QueryModuleVersionsResponse {
/** module_versions is a list of module names with their consensus versions. */
@ -451,7 +455,7 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
});
/**
* No description
* @description Since: cosmos-sdk 0.43
*
* @tags Query
* @name QueryModuleVersions

View File

@ -60,12 +60,15 @@ export interface QueryUpgradedConsensusStateRequest {
* @deprecated
*/
export interface QueryUpgradedConsensusStateResponse {
/** Since: cosmos-sdk 0.43 */
upgraded_consensus_state: Uint8Array;
}
/**
* QueryModuleVersionsRequest is the request type for the Query/ModuleVersions
* RPC method.
*
* Since: cosmos-sdk 0.43
*/
export interface QueryModuleVersionsRequest {
/**
@ -79,6 +82,8 @@ export interface QueryModuleVersionsRequest {
/**
* QueryModuleVersionsResponse is the response type for the Query/ModuleVersions
* RPC method.
*
* Since: cosmos-sdk 0.43
*/
export interface QueryModuleVersionsResponse {
/** module_versions is a list of module names with their consensus versions. */
@ -665,7 +670,11 @@ export interface Query {
UpgradedConsensusState(
request: QueryUpgradedConsensusStateRequest
): Promise<QueryUpgradedConsensusStateResponse>;
/** ModuleVersions queries the list of module versions from state. */
/**
* ModuleVersions queries the list of module versions from state.
*
* Since: cosmos-sdk 0.43
*/
ModuleVersions(
request: QueryModuleVersionsRequest
): Promise<QueryModuleVersionsResponse>;

View File

@ -66,7 +66,11 @@ export interface CancelSoftwareUpgradeProposal {
description: string;
}
/** ModuleVersion specifies a module and its consensus version. */
/**
* ModuleVersion specifies a module and its consensus version.
*
* Since: cosmos-sdk 0.43
*/
export interface ModuleVersion {
/** name of the app module */
name: string;

View File

@ -57,6 +57,8 @@ export interface PeriodicVestingAccount {
* PermanentLockedAccount implements the VestingAccount interface. It does
* not ever release coins, locking them indefinitely. Coins in this account can
* still be used for delegating and for governance votes even while locked.
*
* Since: cosmos-sdk 0.43
*/
export interface PermanentLockedAccount {
base_vesting_account: BaseVestingAccount | undefined;

View File

@ -0,0 +1,82 @@
//@ts-nocheck
// THIS FILE IS GENERATED AUTOMATICALLY. DO NOT MODIFY.
import { StdFee } from "@cosmjs/launchpad";
import { SigningStargateClient } from "@cosmjs/stargate";
import { Registry, OfflineSigner, EncodeObject, DirectSecp256k1HdWallet } from "@cosmjs/proto-signing";
import { Api } from "./rest";
import { MsgIBCCloseChannel } from "./types/cosmwasm/wasm/v1/ibc";
import { MsgIBCSend } from "./types/cosmwasm/wasm/v1/ibc";
import { MsgExecuteContract } from "./types/cosmwasm/wasm/v1/tx";
import { MsgMigrateContract } from "./types/cosmwasm/wasm/v1/tx";
import { MsgStoreCode } from "./types/cosmwasm/wasm/v1/tx";
import { MsgInstantiateContract } from "./types/cosmwasm/wasm/v1/tx";
import { MsgClearAdmin } from "./types/cosmwasm/wasm/v1/tx";
import { MsgUpdateAdmin } from "./types/cosmwasm/wasm/v1/tx";
const types = [
["/cosmwasm.wasm.v1.MsgIBCCloseChannel", MsgIBCCloseChannel],
["/cosmwasm.wasm.v1.MsgIBCSend", MsgIBCSend],
["/cosmwasm.wasm.v1.MsgExecuteContract", MsgExecuteContract],
["/cosmwasm.wasm.v1.MsgMigrateContract", MsgMigrateContract],
["/cosmwasm.wasm.v1.MsgStoreCode", MsgStoreCode],
["/cosmwasm.wasm.v1.MsgInstantiateContract", MsgInstantiateContract],
["/cosmwasm.wasm.v1.MsgClearAdmin", MsgClearAdmin],
["/cosmwasm.wasm.v1.MsgUpdateAdmin", MsgUpdateAdmin],
];
export const MissingWalletError = new Error("wallet is required");
export const registry = new Registry(<any>types);
const defaultFee = {
amount: [],
gas: "200000",
};
interface TxClientOptions {
addr: string
}
interface SignAndBroadcastOptions {
fee: StdFee,
memo?: string
}
const txClient = async (wallet: OfflineSigner, { addr: addr }: TxClientOptions = { addr: "http://localhost:26657" }) => {
if (!wallet) throw MissingWalletError;
let client;
if (addr) {
client = await SigningStargateClient.connectWithSigner(addr, wallet, { registry });
}else{
client = await SigningStargateClient.offline( wallet, { registry });
}
const { address } = (await wallet.getAccounts())[0];
return {
signAndBroadcast: (msgs: EncodeObject[], { fee, memo }: SignAndBroadcastOptions = {fee: defaultFee, memo: ""}) => client.signAndBroadcast(address, msgs, fee,memo),
msgIBCCloseChannel: (data: MsgIBCCloseChannel): EncodeObject => ({ typeUrl: "/cosmwasm.wasm.v1.MsgIBCCloseChannel", value: MsgIBCCloseChannel.fromPartial( data ) }),
msgIBCSend: (data: MsgIBCSend): EncodeObject => ({ typeUrl: "/cosmwasm.wasm.v1.MsgIBCSend", value: MsgIBCSend.fromPartial( data ) }),
msgExecuteContract: (data: MsgExecuteContract): EncodeObject => ({ typeUrl: "/cosmwasm.wasm.v1.MsgExecuteContract", value: MsgExecuteContract.fromPartial( data ) }),
msgMigrateContract: (data: MsgMigrateContract): EncodeObject => ({ typeUrl: "/cosmwasm.wasm.v1.MsgMigrateContract", value: MsgMigrateContract.fromPartial( data ) }),
msgStoreCode: (data: MsgStoreCode): EncodeObject => ({ typeUrl: "/cosmwasm.wasm.v1.MsgStoreCode", value: MsgStoreCode.fromPartial( data ) }),
msgInstantiateContract: (data: MsgInstantiateContract): EncodeObject => ({ typeUrl: "/cosmwasm.wasm.v1.MsgInstantiateContract", value: MsgInstantiateContract.fromPartial( data ) }),
msgClearAdmin: (data: MsgClearAdmin): EncodeObject => ({ typeUrl: "/cosmwasm.wasm.v1.MsgClearAdmin", value: MsgClearAdmin.fromPartial( data ) }),
msgUpdateAdmin: (data: MsgUpdateAdmin): EncodeObject => ({ typeUrl: "/cosmwasm.wasm.v1.MsgUpdateAdmin", value: MsgUpdateAdmin.fromPartial( data ) }),
};
};
interface QueryClientOptions {
addr: string
}
const queryClient = async ({ addr: addr }: QueryClientOptions = { addr: "http://localhost:1317" }) => {
return new Api({ baseUrl: addr });
};
export {
txClient,
queryClient,
};

View File

@ -0,0 +1,813 @@
//@ts-nocheck
/* eslint-disable */
/* tslint:disable */
/*
* ---------------------------------------------------------------
* ## THIS FILE WAS GENERATED VIA SWAGGER-TYPESCRIPT-API ##
* ## ##
* ## AUTHOR: acacode ##
* ## SOURCE: https://github.com/acacode/swagger-typescript-api ##
* ---------------------------------------------------------------
*/
/**
* `Any` contains an arbitrary serialized protocol buffer message along with a
URL that describes the type of the serialized message.
Protobuf library provides support to pack/unpack Any values in the form
of utility functions or additional generated methods of the Any type.
Example 1: Pack and unpack a message in C++.
Foo foo = ...;
Any any;
any.PackFrom(foo);
...
if (any.UnpackTo(&foo)) {
...
}
Example 2: Pack and unpack a message in Java.
Foo foo = ...;
Any any = Any.pack(foo);
...
if (any.is(Foo.class)) {
foo = any.unpack(Foo.class);
}
Example 3: Pack and unpack a message in Python.
foo = Foo(...)
any = Any()
any.Pack(foo)
...
if any.Is(Foo.DESCRIPTOR):
any.Unpack(foo)
...
Example 4: Pack and unpack a message in Go
foo := &pb.Foo{...}
any, err := anypb.New(foo)
if err != nil {
...
}
...
foo := &pb.Foo{}
if err := any.UnmarshalTo(foo); err != nil {
...
}
The pack methods provided by protobuf library will by default use
'type.googleapis.com/full.type.name' as the type URL and the unpack
methods only use the fully qualified type name after the last '/'
in the type URL, for example "foo.bar.com/x/y.z" will yield type
name "y.z".
JSON
====
The JSON representation of an `Any` value uses the regular
representation of the deserialized, embedded message, with an
additional field `@type` which contains the type URL. Example:
package google.profile;
message Person {
string first_name = 1;
string last_name = 2;
}
{
"@type": "type.googleapis.com/google.profile.Person",
"firstName": <string>,
"lastName": <string>
}
If the embedded message type is well-known and has a custom JSON
representation, that representation will be embedded adding a field
`value` which holds the custom JSON in addition to the `@type`
field. Example (for message [google.protobuf.Duration][]):
{
"@type": "type.googleapis.com/google.protobuf.Duration",
"value": "1.212s"
}
*/
export interface ProtobufAny {
/**
* A URL/resource name that uniquely identifies the type of the serialized
* protocol buffer message. This string must contain at least
* one "/" character. The last segment of the URL's path must represent
* the fully qualified name of the type (as in
* `path/google.protobuf.Duration`). The name should be in a canonical form
* (e.g., leading "." is not accepted).
*
* In practice, teams usually precompile into the binary all types that they
* expect it to use in the context of Any. However, for URLs which use the
* scheme `http`, `https`, or no scheme, one can optionally set up a type
* server that maps type URLs to message definitions as follows:
*
* * If no scheme is provided, `https` is assumed.
* * An HTTP GET on the URL must yield a [google.protobuf.Type][]
* value in binary format, or produce an error.
* * Applications are allowed to cache lookup results based on the
* URL, or have them precompiled into a binary to avoid any
* lookup. Therefore, binary compatibility needs to be preserved
* on changes to types. (Use versioned type names to manage
* breaking changes.)
*
* Note: this functionality is not currently available in the official
* protobuf release, and it is not used for type URLs beginning with
* type.googleapis.com.
*
* Schemes other than `http`, `https` (or the empty scheme) might be
* used with implementation specific semantics.
*/
"@type"?: string;
}
export interface RpcStatus {
/** @format int32 */
code?: number;
message?: string;
details?: ProtobufAny[];
}
/**
* AbsoluteTxPosition is a unique transaction position that allows for global
ordering of transactions.
*/
export interface V1AbsoluteTxPosition {
/** @format uint64 */
block_height?: string;
/** @format uint64 */
tx_index?: string;
}
/**
* AccessConfig access control type.
*/
export interface V1AccessConfig {
/**
* - ACCESS_TYPE_UNSPECIFIED: AccessTypeUnspecified placeholder for empty value
* - ACCESS_TYPE_NOBODY: AccessTypeNobody forbidden
* - ACCESS_TYPE_ONLY_ADDRESS: AccessTypeOnlyAddress restricted to an address
* - ACCESS_TYPE_EVERYBODY: AccessTypeEverybody unrestricted
*/
permission?: V1AccessType;
address?: string;
}
/**
* - ACCESS_TYPE_UNSPECIFIED: AccessTypeUnspecified placeholder for empty value
- ACCESS_TYPE_NOBODY: AccessTypeNobody forbidden
- ACCESS_TYPE_ONLY_ADDRESS: AccessTypeOnlyAddress restricted to an address
- ACCESS_TYPE_EVERYBODY: AccessTypeEverybody unrestricted
*/
export enum V1AccessType {
ACCESS_TYPE_UNSPECIFIED = "ACCESS_TYPE_UNSPECIFIED",
ACCESS_TYPE_NOBODY = "ACCESS_TYPE_NOBODY",
ACCESS_TYPE_ONLY_ADDRESS = "ACCESS_TYPE_ONLY_ADDRESS",
ACCESS_TYPE_EVERYBODY = "ACCESS_TYPE_EVERYBODY",
}
export interface V1CodeInfoResponse {
/** @format uint64 */
code_id?: string;
creator?: string;
/** @format byte */
data_hash?: string;
/** AccessConfig access control type. */
instantiate_permission?: V1AccessConfig;
}
/**
* ContractCodeHistoryEntry metadata to a contract.
*/
export interface V1ContractCodeHistoryEntry {
/**
* - CONTRACT_CODE_HISTORY_OPERATION_TYPE_UNSPECIFIED: ContractCodeHistoryOperationTypeUnspecified placeholder for empty value
* - CONTRACT_CODE_HISTORY_OPERATION_TYPE_INIT: ContractCodeHistoryOperationTypeInit on chain contract instantiation
* - CONTRACT_CODE_HISTORY_OPERATION_TYPE_MIGRATE: ContractCodeHistoryOperationTypeMigrate code migration
* - CONTRACT_CODE_HISTORY_OPERATION_TYPE_GENESIS: ContractCodeHistoryOperationTypeGenesis based on genesis data
*/
operation?: V1ContractCodeHistoryOperationType;
/** @format uint64 */
code_id?: string;
/** Updated Tx position when the operation was executed. */
updated?: V1AbsoluteTxPosition;
/** @format byte */
msg?: string;
}
/**
* - CONTRACT_CODE_HISTORY_OPERATION_TYPE_UNSPECIFIED: ContractCodeHistoryOperationTypeUnspecified placeholder for empty value
- CONTRACT_CODE_HISTORY_OPERATION_TYPE_INIT: ContractCodeHistoryOperationTypeInit on chain contract instantiation
- CONTRACT_CODE_HISTORY_OPERATION_TYPE_MIGRATE: ContractCodeHistoryOperationTypeMigrate code migration
- CONTRACT_CODE_HISTORY_OPERATION_TYPE_GENESIS: ContractCodeHistoryOperationTypeGenesis based on genesis data
*/
export enum V1ContractCodeHistoryOperationType {
CONTRACT_CODE_HISTORY_OPERATION_TYPE_UNSPECIFIED = "CONTRACT_CODE_HISTORY_OPERATION_TYPE_UNSPECIFIED",
CONTRACT_CODE_HISTORY_OPERATION_TYPE_INIT = "CONTRACT_CODE_HISTORY_OPERATION_TYPE_INIT",
CONTRACT_CODE_HISTORY_OPERATION_TYPE_MIGRATE = "CONTRACT_CODE_HISTORY_OPERATION_TYPE_MIGRATE",
CONTRACT_CODE_HISTORY_OPERATION_TYPE_GENESIS = "CONTRACT_CODE_HISTORY_OPERATION_TYPE_GENESIS",
}
export interface V1ContractInfo {
/** @format uint64 */
code_id?: string;
creator?: string;
admin?: string;
/** Label is optional metadata to be stored with a contract instance. */
label?: string;
/**
* AbsoluteTxPosition is a unique transaction position that allows for global
* ordering of transactions.
*/
created?: V1AbsoluteTxPosition;
ibc_port_id?: string;
/**
* Extension is an extension point to store custom metadata within the
* persistence model.
*/
extension?: ProtobufAny;
}
export interface V1Model {
/** @format byte */
key?: string;
/** @format byte */
value?: string;
}
export type V1MsgClearAdminResponse = object;
/**
* MsgExecuteContractResponse returns execution result data.
*/
export interface V1MsgExecuteContractResponse {
/** @format byte */
data?: string;
}
export interface V1MsgInstantiateContractResponse {
/** Address is the bech32 address of the new contract instance. */
address?: string;
/** @format byte */
data?: string;
}
/**
* MsgMigrateContractResponse returns contract migration result data.
*/
export interface V1MsgMigrateContractResponse {
/** @format byte */
data?: string;
}
/**
* MsgStoreCodeResponse returns store result data.
*/
export interface V1MsgStoreCodeResponse {
/** @format uint64 */
code_id?: string;
}
export type V1MsgUpdateAdminResponse = object;
export interface V1QueryAllContractStateResponse {
models?: V1Model[];
/** pagination defines the pagination in the response. */
pagination?: V1Beta1PageResponse;
}
export interface V1QueryCodeResponse {
code_info?: V1CodeInfoResponse;
/** @format byte */
data?: string;
}
export interface V1QueryCodesResponse {
code_infos?: V1CodeInfoResponse[];
/** pagination defines the pagination in the response. */
pagination?: V1Beta1PageResponse;
}
export interface V1QueryContractHistoryResponse {
entries?: V1ContractCodeHistoryEntry[];
/** pagination defines the pagination in the response. */
pagination?: V1Beta1PageResponse;
}
export interface V1QueryContractInfoResponse {
address?: string;
contract_info?: V1ContractInfo;
}
export interface V1QueryContractsByCodeResponse {
contracts?: string[];
/** pagination defines the pagination in the response. */
pagination?: V1Beta1PageResponse;
}
export interface V1QueryPinnedCodesResponse {
code_ids?: string[];
/** pagination defines the pagination in the response. */
pagination?: V1Beta1PageResponse;
}
export interface V1QueryRawContractStateResponse {
/** @format byte */
data?: string;
}
export interface V1QuerySmartContractStateResponse {
/** @format byte */
data?: string;
}
/**
* Coin defines a token with a denomination and an amount.
NOTE: The amount field is an Int which implements the custom method
signatures required by gogoproto.
*/
export interface V1Beta1Coin {
denom?: string;
amount?: string;
}
/**
* message SomeRequest {
Foo some_parameter = 1;
PageRequest pagination = 2;
}
*/
export interface V1Beta1PageRequest {
/**
* key is a value returned in PageResponse.next_key to begin
* querying the next page most efficiently. Only one of offset or key
* should be set.
* @format byte
*/
key?: string;
/**
* offset is a numeric offset that can be used when key is unavailable.
* It is less efficient than using key. Only one of offset or key should
* be set.
* @format uint64
*/
offset?: string;
/**
* limit is the total number of results to be returned in the result page.
* If left empty it will default to a value to be set by each app.
* @format uint64
*/
limit?: string;
/**
* count_total is set to true to indicate that the result set should include
* a count of the total number of items available for pagination in UIs.
* count_total is only respected when offset is used. It is ignored when key
* is set.
*/
count_total?: boolean;
/**
* reverse is set to true if results are to be returned in the descending order.
*
* Since: cosmos-sdk 0.43
*/
reverse?: boolean;
}
/**
* PageResponse is to be embedded in gRPC response messages where the
corresponding request message has used PageRequest.
message SomeResponse {
repeated Bar results = 1;
PageResponse page = 2;
}
*/
export interface V1Beta1PageResponse {
/** @format byte */
next_key?: string;
/** @format uint64 */
total?: string;
}
export type QueryParamsType = Record<string | number, any>;
export type ResponseFormat = keyof Omit<Body, "body" | "bodyUsed">;
export interface FullRequestParams extends Omit<RequestInit, "body"> {
/** set parameter to `true` for call `securityWorker` for this request */
secure?: boolean;
/** request path */
path: string;
/** content type of request body */
type?: ContentType;
/** query params */
query?: QueryParamsType;
/** format of response (i.e. response.json() -> format: "json") */
format?: keyof Omit<Body, "body" | "bodyUsed">;
/** request body */
body?: unknown;
/** base url */
baseUrl?: string;
/** request cancellation token */
cancelToken?: CancelToken;
}
export type RequestParams = Omit<FullRequestParams, "body" | "method" | "query" | "path">;
export interface ApiConfig<SecurityDataType = unknown> {
baseUrl?: string;
baseApiParams?: Omit<RequestParams, "baseUrl" | "cancelToken" | "signal">;
securityWorker?: (securityData: SecurityDataType) => RequestParams | void;
}
export interface HttpResponse<D extends unknown, E extends unknown = unknown> extends Response {
data: D;
error: E;
}
type CancelToken = Symbol | string | number;
export enum ContentType {
Json = "application/json",
FormData = "multipart/form-data",
UrlEncoded = "application/x-www-form-urlencoded",
}
export class HttpClient<SecurityDataType = unknown> {
public baseUrl: string = "";
private securityData: SecurityDataType = null as any;
private securityWorker: null | ApiConfig<SecurityDataType>["securityWorker"] = null;
private abortControllers = new Map<CancelToken, AbortController>();
private baseApiParams: RequestParams = {
credentials: "same-origin",
headers: {},
redirect: "follow",
referrerPolicy: "no-referrer",
};
constructor(apiConfig: ApiConfig<SecurityDataType> = {}) {
Object.assign(this, apiConfig);
}
public setSecurityData = (data: SecurityDataType) => {
this.securityData = data;
};
private addQueryParam(query: QueryParamsType, key: string) {
const value = query[key];
return (
encodeURIComponent(key) +
"=" +
encodeURIComponent(Array.isArray(value) ? value.join(",") : typeof value === "number" ? value : `${value}`)
);
}
protected toQueryString(rawQuery?: QueryParamsType): string {
const query = rawQuery || {};
const keys = Object.keys(query).filter((key) => "undefined" !== typeof query[key]);
return keys
.map((key) =>
typeof query[key] === "object" && !Array.isArray(query[key])
? this.toQueryString(query[key] as QueryParamsType)
: this.addQueryParam(query, key),
)
.join("&");
}
protected addQueryParams(rawQuery?: QueryParamsType): string {
const queryString = this.toQueryString(rawQuery);
return queryString ? `?${queryString}` : "";
}
private contentFormatters: Record<ContentType, (input: any) => any> = {
[ContentType.Json]: (input: any) =>
input !== null && (typeof input === "object" || typeof input === "string") ? JSON.stringify(input) : input,
[ContentType.FormData]: (input: any) =>
Object.keys(input || {}).reduce((data, key) => {
data.append(key, input[key]);
return data;
}, new FormData()),
[ContentType.UrlEncoded]: (input: any) => this.toQueryString(input),
};
private mergeRequestParams(params1: RequestParams, params2?: RequestParams): RequestParams {
return {
...this.baseApiParams,
...params1,
...(params2 || {}),
headers: {
...(this.baseApiParams.headers || {}),
...(params1.headers || {}),
...((params2 && params2.headers) || {}),
},
};
}
private createAbortSignal = (cancelToken: CancelToken): AbortSignal | undefined => {
if (this.abortControllers.has(cancelToken)) {
const abortController = this.abortControllers.get(cancelToken);
if (abortController) {
return abortController.signal;
}
return void 0;
}
const abortController = new AbortController();
this.abortControllers.set(cancelToken, abortController);
return abortController.signal;
};
public abortRequest = (cancelToken: CancelToken) => {
const abortController = this.abortControllers.get(cancelToken);
if (abortController) {
abortController.abort();
this.abortControllers.delete(cancelToken);
}
};
public request = <T = any, E = any>({
body,
secure,
path,
type,
query,
format = "json",
baseUrl,
cancelToken,
...params
}: FullRequestParams): Promise<HttpResponse<T, E>> => {
const secureParams = (secure && this.securityWorker && this.securityWorker(this.securityData)) || {};
const requestParams = this.mergeRequestParams(params, secureParams);
const queryString = query && this.toQueryString(query);
const payloadFormatter = this.contentFormatters[type || ContentType.Json];
return fetch(`${baseUrl || this.baseUrl || ""}${path}${queryString ? `?${queryString}` : ""}`, {
...requestParams,
headers: {
...(type && type !== ContentType.FormData ? { "Content-Type": type } : {}),
...(requestParams.headers || {}),
},
signal: cancelToken ? this.createAbortSignal(cancelToken) : void 0,
body: typeof body === "undefined" || body === null ? null : payloadFormatter(body),
}).then(async (response) => {
const r = response as HttpResponse<T, E>;
r.data = (null as unknown) as T;
r.error = (null as unknown) as E;
const data = await response[format]()
.then((data) => {
if (r.ok) {
r.data = data;
} else {
r.error = data;
}
return r;
})
.catch((e) => {
r.error = e;
return r;
});
if (cancelToken) {
this.abortControllers.delete(cancelToken);
}
if (!response.ok) throw data;
return data;
});
};
}
/**
* @title cosmwasm/wasm/v1/genesis.proto
* @version version not set
*/
export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDataType> {
/**
* No description
*
* @tags Query
* @name QueryCodes
* @summary Codes gets the metadata for all stored wasm codes
* @request GET:/cosmwasm/wasm/v1/code
*/
queryCodes = (
query?: {
"pagination.key"?: string;
"pagination.offset"?: string;
"pagination.limit"?: string;
"pagination.count_total"?: boolean;
"pagination.reverse"?: boolean;
},
params: RequestParams = {},
) =>
this.request<V1QueryCodesResponse, RpcStatus>({
path: `/cosmwasm/wasm/v1/code`,
method: "GET",
query: query,
format: "json",
...params,
});
/**
* No description
*
* @tags Query
* @name QueryCode
* @summary Code gets the binary code and metadata for a singe wasm code
* @request GET:/cosmwasm/wasm/v1/code/{code_id}
*/
queryCode = (code_id: string, params: RequestParams = {}) =>
this.request<V1QueryCodeResponse, RpcStatus>({
path: `/cosmwasm/wasm/v1/code/${code_id}`,
method: "GET",
format: "json",
...params,
});
/**
* No description
*
* @tags Query
* @name QueryContractsByCode
* @summary ContractsByCode lists all smart contracts for a code id
* @request GET:/cosmwasm/wasm/v1/code/{code_id}/contracts
*/
queryContractsByCode = (
code_id: string,
query?: {
"pagination.key"?: string;
"pagination.offset"?: string;
"pagination.limit"?: string;
"pagination.count_total"?: boolean;
"pagination.reverse"?: boolean;
},
params: RequestParams = {},
) =>
this.request<V1QueryContractsByCodeResponse, RpcStatus>({
path: `/cosmwasm/wasm/v1/code/${code_id}/contracts`,
method: "GET",
query: query,
format: "json",
...params,
});
/**
* No description
*
* @tags Query
* @name QueryPinnedCodes
* @summary PinnedCodes gets the pinned code ids
* @request GET:/cosmwasm/wasm/v1/codes/pinned
*/
queryPinnedCodes = (
query?: {
"pagination.key"?: string;
"pagination.offset"?: string;
"pagination.limit"?: string;
"pagination.count_total"?: boolean;
"pagination.reverse"?: boolean;
},
params: RequestParams = {},
) =>
this.request<V1QueryPinnedCodesResponse, RpcStatus>({
path: `/cosmwasm/wasm/v1/codes/pinned`,
method: "GET",
query: query,
format: "json",
...params,
});
/**
* No description
*
* @tags Query
* @name QueryContractInfo
* @summary ContractInfo gets the contract meta data
* @request GET:/cosmwasm/wasm/v1/contract/{address}
*/
queryContractInfo = (address: string, params: RequestParams = {}) =>
this.request<V1QueryContractInfoResponse, RpcStatus>({
path: `/cosmwasm/wasm/v1/contract/${address}`,
method: "GET",
format: "json",
...params,
});
/**
* No description
*
* @tags Query
* @name QueryContractHistory
* @summary ContractHistory gets the contract code history
* @request GET:/cosmwasm/wasm/v1/contract/{address}/history
*/
queryContractHistory = (
address: string,
query?: {
"pagination.key"?: string;
"pagination.offset"?: string;
"pagination.limit"?: string;
"pagination.count_total"?: boolean;
"pagination.reverse"?: boolean;
},
params: RequestParams = {},
) =>
this.request<V1QueryContractHistoryResponse, RpcStatus>({
path: `/cosmwasm/wasm/v1/contract/${address}/history`,
method: "GET",
query: query,
format: "json",
...params,
});
/**
* No description
*
* @tags Query
* @name QueryRawContractState
* @summary RawContractState gets single key from the raw store data of a contract
* @request GET:/cosmwasm/wasm/v1/contract/{address}/raw/{query_data}
*/
queryRawContractState = (address: string, query_data: string, params: RequestParams = {}) =>
this.request<V1QueryRawContractStateResponse, RpcStatus>({
path: `/cosmwasm/wasm/v1/contract/${address}/raw/${query_data}`,
method: "GET",
format: "json",
...params,
});
/**
* No description
*
* @tags Query
* @name QuerySmartContractState
* @summary SmartContractState get smart query result from the contract
* @request GET:/cosmwasm/wasm/v1/contract/{address}/smart/{query_data}
*/
querySmartContractState = (address: string, query_data: string, params: RequestParams = {}) =>
this.request<V1QuerySmartContractStateResponse, RpcStatus>({
path: `/cosmwasm/wasm/v1/contract/${address}/smart/${query_data}`,
method: "GET",
format: "json",
...params,
});
/**
* No description
*
* @tags Query
* @name QueryAllContractState
* @summary AllContractState gets all raw store data for a single contract
* @request GET:/cosmwasm/wasm/v1/contract/{address}/state
*/
queryAllContractState = (
address: string,
query?: {
"pagination.key"?: string;
"pagination.offset"?: string;
"pagination.limit"?: string;
"pagination.count_total"?: boolean;
"pagination.reverse"?: boolean;
},
params: RequestParams = {},
) =>
this.request<V1QueryAllContractStateResponse, RpcStatus>({
path: `/cosmwasm/wasm/v1/contract/${address}/state`,
method: "GET",
query: query,
format: "json",
...params,
});
}

View File

@ -39,7 +39,11 @@ export interface PageRequest {
* is set.
*/
count_total: boolean;
/** reverse is set to true if results are to be returned in the descending order. */
/**
* reverse is set to true if results are to be returned in the descending order.
*
* Since: cosmos-sdk 0.43
*/
reverse: boolean;
}

View File

@ -0,0 +1,302 @@
//@ts-nocheck
/* eslint-disable */
import { Writer, Reader } from "protobufjs/minimal";
export const protobufPackage = "cosmos.base.v1beta1";
/**
* Coin defines a token with a denomination and an amount.
*
* NOTE: The amount field is an Int which implements the custom method
* signatures required by gogoproto.
*/
export interface Coin {
denom: string;
amount: string;
}
/**
* DecCoin defines a token with a denomination and a decimal amount.
*
* NOTE: The amount field is an Dec which implements the custom method
* signatures required by gogoproto.
*/
export interface DecCoin {
denom: string;
amount: string;
}
/** IntProto defines a Protobuf wrapper around an Int object. */
export interface IntProto {
int: string;
}
/** DecProto defines a Protobuf wrapper around a Dec object. */
export interface DecProto {
dec: string;
}
const baseCoin: object = { denom: "", amount: "" };
export const Coin = {
encode(message: Coin, writer: Writer = Writer.create()): Writer {
if (message.denom !== "") {
writer.uint32(10).string(message.denom);
}
if (message.amount !== "") {
writer.uint32(18).string(message.amount);
}
return writer;
},
decode(input: Reader | Uint8Array, length?: number): Coin {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseCoin } as Coin;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.denom = reader.string();
break;
case 2:
message.amount = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): Coin {
const message = { ...baseCoin } as Coin;
if (object.denom !== undefined && object.denom !== null) {
message.denom = String(object.denom);
} else {
message.denom = "";
}
if (object.amount !== undefined && object.amount !== null) {
message.amount = String(object.amount);
} else {
message.amount = "";
}
return message;
},
toJSON(message: Coin): unknown {
const obj: any = {};
message.denom !== undefined && (obj.denom = message.denom);
message.amount !== undefined && (obj.amount = message.amount);
return obj;
},
fromPartial(object: DeepPartial<Coin>): Coin {
const message = { ...baseCoin } as Coin;
if (object.denom !== undefined && object.denom !== null) {
message.denom = object.denom;
} else {
message.denom = "";
}
if (object.amount !== undefined && object.amount !== null) {
message.amount = object.amount;
} else {
message.amount = "";
}
return message;
},
};
const baseDecCoin: object = { denom: "", amount: "" };
export const DecCoin = {
encode(message: DecCoin, writer: Writer = Writer.create()): Writer {
if (message.denom !== "") {
writer.uint32(10).string(message.denom);
}
if (message.amount !== "") {
writer.uint32(18).string(message.amount);
}
return writer;
},
decode(input: Reader | Uint8Array, length?: number): DecCoin {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseDecCoin } as DecCoin;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.denom = reader.string();
break;
case 2:
message.amount = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): DecCoin {
const message = { ...baseDecCoin } as DecCoin;
if (object.denom !== undefined && object.denom !== null) {
message.denom = String(object.denom);
} else {
message.denom = "";
}
if (object.amount !== undefined && object.amount !== null) {
message.amount = String(object.amount);
} else {
message.amount = "";
}
return message;
},
toJSON(message: DecCoin): unknown {
const obj: any = {};
message.denom !== undefined && (obj.denom = message.denom);
message.amount !== undefined && (obj.amount = message.amount);
return obj;
},
fromPartial(object: DeepPartial<DecCoin>): DecCoin {
const message = { ...baseDecCoin } as DecCoin;
if (object.denom !== undefined && object.denom !== null) {
message.denom = object.denom;
} else {
message.denom = "";
}
if (object.amount !== undefined && object.amount !== null) {
message.amount = object.amount;
} else {
message.amount = "";
}
return message;
},
};
const baseIntProto: object = { int: "" };
export const IntProto = {
encode(message: IntProto, writer: Writer = Writer.create()): Writer {
if (message.int !== "") {
writer.uint32(10).string(message.int);
}
return writer;
},
decode(input: Reader | Uint8Array, length?: number): IntProto {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseIntProto } as IntProto;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.int = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): IntProto {
const message = { ...baseIntProto } as IntProto;
if (object.int !== undefined && object.int !== null) {
message.int = String(object.int);
} else {
message.int = "";
}
return message;
},
toJSON(message: IntProto): unknown {
const obj: any = {};
message.int !== undefined && (obj.int = message.int);
return obj;
},
fromPartial(object: DeepPartial<IntProto>): IntProto {
const message = { ...baseIntProto } as IntProto;
if (object.int !== undefined && object.int !== null) {
message.int = object.int;
} else {
message.int = "";
}
return message;
},
};
const baseDecProto: object = { dec: "" };
export const DecProto = {
encode(message: DecProto, writer: Writer = Writer.create()): Writer {
if (message.dec !== "") {
writer.uint32(10).string(message.dec);
}
return writer;
},
decode(input: Reader | Uint8Array, length?: number): DecProto {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseDecProto } as DecProto;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.dec = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): DecProto {
const message = { ...baseDecProto } as DecProto;
if (object.dec !== undefined && object.dec !== null) {
message.dec = String(object.dec);
} else {
message.dec = "";
}
return message;
},
toJSON(message: DecProto): unknown {
const obj: any = {};
message.dec !== undefined && (obj.dec = message.dec);
return obj;
},
fromPartial(object: DeepPartial<DecProto>): DecProto {
const message = { ...baseDecProto } as DecProto;
if (object.dec !== undefined && object.dec !== null) {
message.dec = object.dec;
} else {
message.dec = "";
}
return message;
},
};
type Builtin = Date | Function | Uint8Array | string | number | undefined;
export type DeepPartial<T> = T extends Builtin
? T
: 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>;

View File

@ -0,0 +1,3 @@
//@ts-nocheck
/* eslint-disable */
export const protobufPackage = "cosmos_proto";

View File

@ -0,0 +1,704 @@
//@ts-nocheck
/* eslint-disable */
import * as Long from "long";
import { util, configure, Writer, Reader } from "protobufjs/minimal";
import {
Params,
CodeInfo,
ContractInfo,
Model,
} from "../../../cosmwasm/wasm/v1/types";
import {
MsgStoreCode,
MsgInstantiateContract,
MsgExecuteContract,
} from "../../../cosmwasm/wasm/v1/tx";
export const protobufPackage = "cosmwasm.wasm.v1";
/** GenesisState - genesis state of x/wasm */
export interface GenesisState {
params: Params | undefined;
codes: Code[];
contracts: Contract[];
sequences: Sequence[];
gen_msgs: GenesisState_GenMsgs[];
}
/**
* GenMsgs define the messages that can be executed during genesis phase in
* order. The intention is to have more human readable data that is auditable.
*/
export interface GenesisState_GenMsgs {
store_code: MsgStoreCode | undefined;
instantiate_contract: MsgInstantiateContract | undefined;
execute_contract: MsgExecuteContract | undefined;
}
/** Code struct encompasses CodeInfo and CodeBytes */
export interface Code {
code_id: number;
code_info: CodeInfo | undefined;
code_bytes: Uint8Array;
/** Pinned to wasmvm cache */
pinned: boolean;
}
/** Contract struct encompasses ContractAddress, ContractInfo, and ContractState */
export interface Contract {
contract_address: string;
contract_info: ContractInfo | undefined;
contract_state: Model[];
}
/** Sequence key and value of an id generation counter */
export interface Sequence {
id_key: Uint8Array;
value: number;
}
const baseGenesisState: object = {};
export const GenesisState = {
encode(message: GenesisState, writer: Writer = Writer.create()): Writer {
if (message.params !== undefined) {
Params.encode(message.params, writer.uint32(10).fork()).ldelim();
}
for (const v of message.codes) {
Code.encode(v!, writer.uint32(18).fork()).ldelim();
}
for (const v of message.contracts) {
Contract.encode(v!, writer.uint32(26).fork()).ldelim();
}
for (const v of message.sequences) {
Sequence.encode(v!, writer.uint32(34).fork()).ldelim();
}
for (const v of message.gen_msgs) {
GenesisState_GenMsgs.encode(v!, writer.uint32(42).fork()).ldelim();
}
return writer;
},
decode(input: Reader | Uint8Array, length?: number): GenesisState {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseGenesisState } as GenesisState;
message.codes = [];
message.contracts = [];
message.sequences = [];
message.gen_msgs = [];
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.params = Params.decode(reader, reader.uint32());
break;
case 2:
message.codes.push(Code.decode(reader, reader.uint32()));
break;
case 3:
message.contracts.push(Contract.decode(reader, reader.uint32()));
break;
case 4:
message.sequences.push(Sequence.decode(reader, reader.uint32()));
break;
case 5:
message.gen_msgs.push(
GenesisState_GenMsgs.decode(reader, reader.uint32())
);
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): GenesisState {
const message = { ...baseGenesisState } as GenesisState;
message.codes = [];
message.contracts = [];
message.sequences = [];
message.gen_msgs = [];
if (object.params !== undefined && object.params !== null) {
message.params = Params.fromJSON(object.params);
} else {
message.params = undefined;
}
if (object.codes !== undefined && object.codes !== null) {
for (const e of object.codes) {
message.codes.push(Code.fromJSON(e));
}
}
if (object.contracts !== undefined && object.contracts !== null) {
for (const e of object.contracts) {
message.contracts.push(Contract.fromJSON(e));
}
}
if (object.sequences !== undefined && object.sequences !== null) {
for (const e of object.sequences) {
message.sequences.push(Sequence.fromJSON(e));
}
}
if (object.gen_msgs !== undefined && object.gen_msgs !== null) {
for (const e of object.gen_msgs) {
message.gen_msgs.push(GenesisState_GenMsgs.fromJSON(e));
}
}
return message;
},
toJSON(message: GenesisState): unknown {
const obj: any = {};
message.params !== undefined &&
(obj.params = message.params ? Params.toJSON(message.params) : undefined);
if (message.codes) {
obj.codes = message.codes.map((e) => (e ? Code.toJSON(e) : undefined));
} else {
obj.codes = [];
}
if (message.contracts) {
obj.contracts = message.contracts.map((e) =>
e ? Contract.toJSON(e) : undefined
);
} else {
obj.contracts = [];
}
if (message.sequences) {
obj.sequences = message.sequences.map((e) =>
e ? Sequence.toJSON(e) : undefined
);
} else {
obj.sequences = [];
}
if (message.gen_msgs) {
obj.gen_msgs = message.gen_msgs.map((e) =>
e ? GenesisState_GenMsgs.toJSON(e) : undefined
);
} else {
obj.gen_msgs = [];
}
return obj;
},
fromPartial(object: DeepPartial<GenesisState>): GenesisState {
const message = { ...baseGenesisState } as GenesisState;
message.codes = [];
message.contracts = [];
message.sequences = [];
message.gen_msgs = [];
if (object.params !== undefined && object.params !== null) {
message.params = Params.fromPartial(object.params);
} else {
message.params = undefined;
}
if (object.codes !== undefined && object.codes !== null) {
for (const e of object.codes) {
message.codes.push(Code.fromPartial(e));
}
}
if (object.contracts !== undefined && object.contracts !== null) {
for (const e of object.contracts) {
message.contracts.push(Contract.fromPartial(e));
}
}
if (object.sequences !== undefined && object.sequences !== null) {
for (const e of object.sequences) {
message.sequences.push(Sequence.fromPartial(e));
}
}
if (object.gen_msgs !== undefined && object.gen_msgs !== null) {
for (const e of object.gen_msgs) {
message.gen_msgs.push(GenesisState_GenMsgs.fromPartial(e));
}
}
return message;
},
};
const baseGenesisState_GenMsgs: object = {};
export const GenesisState_GenMsgs = {
encode(
message: GenesisState_GenMsgs,
writer: Writer = Writer.create()
): Writer {
if (message.store_code !== undefined) {
MsgStoreCode.encode(
message.store_code,
writer.uint32(10).fork()
).ldelim();
}
if (message.instantiate_contract !== undefined) {
MsgInstantiateContract.encode(
message.instantiate_contract,
writer.uint32(18).fork()
).ldelim();
}
if (message.execute_contract !== undefined) {
MsgExecuteContract.encode(
message.execute_contract,
writer.uint32(26).fork()
).ldelim();
}
return writer;
},
decode(input: Reader | Uint8Array, length?: number): GenesisState_GenMsgs {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseGenesisState_GenMsgs } as GenesisState_GenMsgs;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.store_code = MsgStoreCode.decode(reader, reader.uint32());
break;
case 2:
message.instantiate_contract = MsgInstantiateContract.decode(
reader,
reader.uint32()
);
break;
case 3:
message.execute_contract = MsgExecuteContract.decode(
reader,
reader.uint32()
);
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): GenesisState_GenMsgs {
const message = { ...baseGenesisState_GenMsgs } as GenesisState_GenMsgs;
if (object.store_code !== undefined && object.store_code !== null) {
message.store_code = MsgStoreCode.fromJSON(object.store_code);
} else {
message.store_code = undefined;
}
if (
object.instantiate_contract !== undefined &&
object.instantiate_contract !== null
) {
message.instantiate_contract = MsgInstantiateContract.fromJSON(
object.instantiate_contract
);
} else {
message.instantiate_contract = undefined;
}
if (
object.execute_contract !== undefined &&
object.execute_contract !== null
) {
message.execute_contract = MsgExecuteContract.fromJSON(
object.execute_contract
);
} else {
message.execute_contract = undefined;
}
return message;
},
toJSON(message: GenesisState_GenMsgs): unknown {
const obj: any = {};
message.store_code !== undefined &&
(obj.store_code = message.store_code
? MsgStoreCode.toJSON(message.store_code)
: undefined);
message.instantiate_contract !== undefined &&
(obj.instantiate_contract = message.instantiate_contract
? MsgInstantiateContract.toJSON(message.instantiate_contract)
: undefined);
message.execute_contract !== undefined &&
(obj.execute_contract = message.execute_contract
? MsgExecuteContract.toJSON(message.execute_contract)
: undefined);
return obj;
},
fromPartial(object: DeepPartial<GenesisState_GenMsgs>): GenesisState_GenMsgs {
const message = { ...baseGenesisState_GenMsgs } as GenesisState_GenMsgs;
if (object.store_code !== undefined && object.store_code !== null) {
message.store_code = MsgStoreCode.fromPartial(object.store_code);
} else {
message.store_code = undefined;
}
if (
object.instantiate_contract !== undefined &&
object.instantiate_contract !== null
) {
message.instantiate_contract = MsgInstantiateContract.fromPartial(
object.instantiate_contract
);
} else {
message.instantiate_contract = undefined;
}
if (
object.execute_contract !== undefined &&
object.execute_contract !== null
) {
message.execute_contract = MsgExecuteContract.fromPartial(
object.execute_contract
);
} else {
message.execute_contract = undefined;
}
return message;
},
};
const baseCode: object = { code_id: 0, pinned: false };
export const Code = {
encode(message: Code, writer: Writer = Writer.create()): Writer {
if (message.code_id !== 0) {
writer.uint32(8).uint64(message.code_id);
}
if (message.code_info !== undefined) {
CodeInfo.encode(message.code_info, writer.uint32(18).fork()).ldelim();
}
if (message.code_bytes.length !== 0) {
writer.uint32(26).bytes(message.code_bytes);
}
if (message.pinned === true) {
writer.uint32(32).bool(message.pinned);
}
return writer;
},
decode(input: Reader | Uint8Array, length?: number): Code {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseCode } as Code;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.code_id = longToNumber(reader.uint64() as Long);
break;
case 2:
message.code_info = CodeInfo.decode(reader, reader.uint32());
break;
case 3:
message.code_bytes = reader.bytes();
break;
case 4:
message.pinned = reader.bool();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): Code {
const message = { ...baseCode } as Code;
if (object.code_id !== undefined && object.code_id !== null) {
message.code_id = Number(object.code_id);
} else {
message.code_id = 0;
}
if (object.code_info !== undefined && object.code_info !== null) {
message.code_info = CodeInfo.fromJSON(object.code_info);
} else {
message.code_info = undefined;
}
if (object.code_bytes !== undefined && object.code_bytes !== null) {
message.code_bytes = bytesFromBase64(object.code_bytes);
}
if (object.pinned !== undefined && object.pinned !== null) {
message.pinned = Boolean(object.pinned);
} else {
message.pinned = false;
}
return message;
},
toJSON(message: Code): unknown {
const obj: any = {};
message.code_id !== undefined && (obj.code_id = message.code_id);
message.code_info !== undefined &&
(obj.code_info = message.code_info
? CodeInfo.toJSON(message.code_info)
: undefined);
message.code_bytes !== undefined &&
(obj.code_bytes = base64FromBytes(
message.code_bytes !== undefined ? message.code_bytes : new Uint8Array()
));
message.pinned !== undefined && (obj.pinned = message.pinned);
return obj;
},
fromPartial(object: DeepPartial<Code>): Code {
const message = { ...baseCode } as Code;
if (object.code_id !== undefined && object.code_id !== null) {
message.code_id = object.code_id;
} else {
message.code_id = 0;
}
if (object.code_info !== undefined && object.code_info !== null) {
message.code_info = CodeInfo.fromPartial(object.code_info);
} else {
message.code_info = undefined;
}
if (object.code_bytes !== undefined && object.code_bytes !== null) {
message.code_bytes = object.code_bytes;
} else {
message.code_bytes = new Uint8Array();
}
if (object.pinned !== undefined && object.pinned !== null) {
message.pinned = object.pinned;
} else {
message.pinned = false;
}
return message;
},
};
const baseContract: object = { contract_address: "" };
export const Contract = {
encode(message: Contract, writer: Writer = Writer.create()): Writer {
if (message.contract_address !== "") {
writer.uint32(10).string(message.contract_address);
}
if (message.contract_info !== undefined) {
ContractInfo.encode(
message.contract_info,
writer.uint32(18).fork()
).ldelim();
}
for (const v of message.contract_state) {
Model.encode(v!, writer.uint32(26).fork()).ldelim();
}
return writer;
},
decode(input: Reader | Uint8Array, length?: number): Contract {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseContract } as Contract;
message.contract_state = [];
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.contract_address = reader.string();
break;
case 2:
message.contract_info = ContractInfo.decode(reader, reader.uint32());
break;
case 3:
message.contract_state.push(Model.decode(reader, reader.uint32()));
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): Contract {
const message = { ...baseContract } as Contract;
message.contract_state = [];
if (
object.contract_address !== undefined &&
object.contract_address !== null
) {
message.contract_address = String(object.contract_address);
} else {
message.contract_address = "";
}
if (object.contract_info !== undefined && object.contract_info !== null) {
message.contract_info = ContractInfo.fromJSON(object.contract_info);
} else {
message.contract_info = undefined;
}
if (object.contract_state !== undefined && object.contract_state !== null) {
for (const e of object.contract_state) {
message.contract_state.push(Model.fromJSON(e));
}
}
return message;
},
toJSON(message: Contract): unknown {
const obj: any = {};
message.contract_address !== undefined &&
(obj.contract_address = message.contract_address);
message.contract_info !== undefined &&
(obj.contract_info = message.contract_info
? ContractInfo.toJSON(message.contract_info)
: undefined);
if (message.contract_state) {
obj.contract_state = message.contract_state.map((e) =>
e ? Model.toJSON(e) : undefined
);
} else {
obj.contract_state = [];
}
return obj;
},
fromPartial(object: DeepPartial<Contract>): Contract {
const message = { ...baseContract } as Contract;
message.contract_state = [];
if (
object.contract_address !== undefined &&
object.contract_address !== null
) {
message.contract_address = object.contract_address;
} else {
message.contract_address = "";
}
if (object.contract_info !== undefined && object.contract_info !== null) {
message.contract_info = ContractInfo.fromPartial(object.contract_info);
} else {
message.contract_info = undefined;
}
if (object.contract_state !== undefined && object.contract_state !== null) {
for (const e of object.contract_state) {
message.contract_state.push(Model.fromPartial(e));
}
}
return message;
},
};
const baseSequence: object = { value: 0 };
export const Sequence = {
encode(message: Sequence, writer: Writer = Writer.create()): Writer {
if (message.id_key.length !== 0) {
writer.uint32(10).bytes(message.id_key);
}
if (message.value !== 0) {
writer.uint32(16).uint64(message.value);
}
return writer;
},
decode(input: Reader | Uint8Array, length?: number): Sequence {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseSequence } as Sequence;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.id_key = reader.bytes();
break;
case 2:
message.value = longToNumber(reader.uint64() as Long);
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): Sequence {
const message = { ...baseSequence } as Sequence;
if (object.id_key !== undefined && object.id_key !== null) {
message.id_key = bytesFromBase64(object.id_key);
}
if (object.value !== undefined && object.value !== null) {
message.value = Number(object.value);
} else {
message.value = 0;
}
return message;
},
toJSON(message: Sequence): unknown {
const obj: any = {};
message.id_key !== undefined &&
(obj.id_key = base64FromBytes(
message.id_key !== undefined ? message.id_key : new Uint8Array()
));
message.value !== undefined && (obj.value = message.value);
return obj;
},
fromPartial(object: DeepPartial<Sequence>): Sequence {
const message = { ...baseSequence } as Sequence;
if (object.id_key !== undefined && object.id_key !== null) {
message.id_key = object.id_key;
} else {
message.id_key = new Uint8Array();
}
if (object.value !== undefined && object.value !== null) {
message.value = object.value;
} else {
message.value = 0;
}
return message;
},
};
declare var self: any | undefined;
declare var window: any | undefined;
var globalThis: any = (() => {
if (typeof globalThis !== "undefined") return globalThis;
if (typeof self !== "undefined") return self;
if (typeof window !== "undefined") return window;
if (typeof global !== "undefined") return global;
throw "Unable to locate global object";
})();
const atob: (b64: string) => string =
globalThis.atob ||
((b64) => globalThis.Buffer.from(b64, "base64").toString("binary"));
function bytesFromBase64(b64: string): Uint8Array {
const bin = atob(b64);
const arr = new Uint8Array(bin.length);
for (let i = 0; i < bin.length; ++i) {
arr[i] = bin.charCodeAt(i);
}
return arr;
}
const btoa: (bin: string) => string =
globalThis.btoa ||
((bin) => globalThis.Buffer.from(bin, "binary").toString("base64"));
function base64FromBytes(arr: Uint8Array): string {
const bin: string[] = [];
for (let i = 0; i < arr.byteLength; ++i) {
bin.push(String.fromCharCode(arr[i]));
}
return btoa(bin.join(""));
}
type Builtin = Date | Function | Uint8Array | string | number | undefined;
export type DeepPartial<T> = T extends Builtin
? T
: 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>;
function longToNumber(long: Long): number {
if (long.gt(Number.MAX_SAFE_INTEGER)) {
throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
}
return long.toNumber();
}
if (util.Long !== Long) {
util.Long = Long as any;
configure();
}

View File

@ -0,0 +1,265 @@
//@ts-nocheck
/* eslint-disable */
import * as Long from "long";
import { util, configure, Writer, Reader } from "protobufjs/minimal";
export const protobufPackage = "cosmwasm.wasm.v1";
/** MsgIBCSend */
export interface MsgIBCSend {
/** the channel by which the packet will be sent */
channel: string;
/**
* Timeout height relative to the current block height.
* The timeout is disabled when set to 0.
*/
timeout_height: number;
/**
* Timeout timestamp (in nanoseconds) relative to the current block timestamp.
* The timeout is disabled when set to 0.
*/
timeout_timestamp: number;
/**
* Data is the payload to transfer. We must not make assumption what format or
* content is in here.
*/
data: Uint8Array;
}
/** MsgIBCCloseChannel port and channel need to be owned by the contract */
export interface MsgIBCCloseChannel {
channel: string;
}
const baseMsgIBCSend: object = {
channel: "",
timeout_height: 0,
timeout_timestamp: 0,
};
export const MsgIBCSend = {
encode(message: MsgIBCSend, writer: Writer = Writer.create()): Writer {
if (message.channel !== "") {
writer.uint32(18).string(message.channel);
}
if (message.timeout_height !== 0) {
writer.uint32(32).uint64(message.timeout_height);
}
if (message.timeout_timestamp !== 0) {
writer.uint32(40).uint64(message.timeout_timestamp);
}
if (message.data.length !== 0) {
writer.uint32(50).bytes(message.data);
}
return writer;
},
decode(input: Reader | Uint8Array, length?: number): MsgIBCSend {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseMsgIBCSend } as MsgIBCSend;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 2:
message.channel = reader.string();
break;
case 4:
message.timeout_height = longToNumber(reader.uint64() as Long);
break;
case 5:
message.timeout_timestamp = longToNumber(reader.uint64() as Long);
break;
case 6:
message.data = reader.bytes();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): MsgIBCSend {
const message = { ...baseMsgIBCSend } as MsgIBCSend;
if (object.channel !== undefined && object.channel !== null) {
message.channel = String(object.channel);
} else {
message.channel = "";
}
if (object.timeout_height !== undefined && object.timeout_height !== null) {
message.timeout_height = Number(object.timeout_height);
} else {
message.timeout_height = 0;
}
if (
object.timeout_timestamp !== undefined &&
object.timeout_timestamp !== null
) {
message.timeout_timestamp = Number(object.timeout_timestamp);
} else {
message.timeout_timestamp = 0;
}
if (object.data !== undefined && object.data !== null) {
message.data = bytesFromBase64(object.data);
}
return message;
},
toJSON(message: MsgIBCSend): unknown {
const obj: any = {};
message.channel !== undefined && (obj.channel = message.channel);
message.timeout_height !== undefined &&
(obj.timeout_height = message.timeout_height);
message.timeout_timestamp !== undefined &&
(obj.timeout_timestamp = message.timeout_timestamp);
message.data !== undefined &&
(obj.data = base64FromBytes(
message.data !== undefined ? message.data : new Uint8Array()
));
return obj;
},
fromPartial(object: DeepPartial<MsgIBCSend>): MsgIBCSend {
const message = { ...baseMsgIBCSend } as MsgIBCSend;
if (object.channel !== undefined && object.channel !== null) {
message.channel = object.channel;
} else {
message.channel = "";
}
if (object.timeout_height !== undefined && object.timeout_height !== null) {
message.timeout_height = object.timeout_height;
} else {
message.timeout_height = 0;
}
if (
object.timeout_timestamp !== undefined &&
object.timeout_timestamp !== null
) {
message.timeout_timestamp = object.timeout_timestamp;
} else {
message.timeout_timestamp = 0;
}
if (object.data !== undefined && object.data !== null) {
message.data = object.data;
} else {
message.data = new Uint8Array();
}
return message;
},
};
const baseMsgIBCCloseChannel: object = { channel: "" };
export const MsgIBCCloseChannel = {
encode(
message: MsgIBCCloseChannel,
writer: Writer = Writer.create()
): Writer {
if (message.channel !== "") {
writer.uint32(18).string(message.channel);
}
return writer;
},
decode(input: Reader | Uint8Array, length?: number): MsgIBCCloseChannel {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseMsgIBCCloseChannel } as MsgIBCCloseChannel;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 2:
message.channel = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): MsgIBCCloseChannel {
const message = { ...baseMsgIBCCloseChannel } as MsgIBCCloseChannel;
if (object.channel !== undefined && object.channel !== null) {
message.channel = String(object.channel);
} else {
message.channel = "";
}
return message;
},
toJSON(message: MsgIBCCloseChannel): unknown {
const obj: any = {};
message.channel !== undefined && (obj.channel = message.channel);
return obj;
},
fromPartial(object: DeepPartial<MsgIBCCloseChannel>): MsgIBCCloseChannel {
const message = { ...baseMsgIBCCloseChannel } as MsgIBCCloseChannel;
if (object.channel !== undefined && object.channel !== null) {
message.channel = object.channel;
} else {
message.channel = "";
}
return message;
},
};
declare var self: any | undefined;
declare var window: any | undefined;
var globalThis: any = (() => {
if (typeof globalThis !== "undefined") return globalThis;
if (typeof self !== "undefined") return self;
if (typeof window !== "undefined") return window;
if (typeof global !== "undefined") return global;
throw "Unable to locate global object";
})();
const atob: (b64: string) => string =
globalThis.atob ||
((b64) => globalThis.Buffer.from(b64, "base64").toString("binary"));
function bytesFromBase64(b64: string): Uint8Array {
const bin = atob(b64);
const arr = new Uint8Array(bin.length);
for (let i = 0; i < bin.length; ++i) {
arr[i] = bin.charCodeAt(i);
}
return arr;
}
const btoa: (bin: string) => string =
globalThis.btoa ||
((bin) => globalThis.Buffer.from(bin, "binary").toString("base64"));
function base64FromBytes(arr: Uint8Array): string {
const bin: string[] = [];
for (let i = 0; i < arr.byteLength; ++i) {
bin.push(String.fromCharCode(arr[i]));
}
return btoa(bin.join(""));
}
type Builtin = Date | Function | Uint8Array | string | number | undefined;
export type DeepPartial<T> = T extends Builtin
? T
: 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>;
function longToNumber(long: Long): number {
if (long.gt(Number.MAX_SAFE_INTEGER)) {
throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
}
return long.toNumber();
}
if (util.Long !== Long) {
util.Long = Long as any;
configure();
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,241 @@
//@ts-nocheck
/* eslint-disable */
import { Writer, Reader } from "protobufjs/minimal";
export const protobufPackage = "google.protobuf";
/**
* `Any` contains an arbitrary serialized protocol buffer message along with a
* URL that describes the type of the serialized message.
*
* Protobuf library provides support to pack/unpack Any values in the form
* of utility functions or additional generated methods of the Any type.
*
* Example 1: Pack and unpack a message in C++.
*
* Foo foo = ...;
* Any any;
* any.PackFrom(foo);
* ...
* if (any.UnpackTo(&foo)) {
* ...
* }
*
* Example 2: Pack and unpack a message in Java.
*
* Foo foo = ...;
* Any any = Any.pack(foo);
* ...
* if (any.is(Foo.class)) {
* foo = any.unpack(Foo.class);
* }
*
* Example 3: Pack and unpack a message in Python.
*
* foo = Foo(...)
* any = Any()
* any.Pack(foo)
* ...
* if any.Is(Foo.DESCRIPTOR):
* any.Unpack(foo)
* ...
*
* Example 4: Pack and unpack a message in Go
*
* foo := &pb.Foo{...}
* any, err := anypb.New(foo)
* if err != nil {
* ...
* }
* ...
* foo := &pb.Foo{}
* if err := any.UnmarshalTo(foo); err != nil {
* ...
* }
*
* The pack methods provided by protobuf library will by default use
* 'type.googleapis.com/full.type.name' as the type URL and the unpack
* methods only use the fully qualified type name after the last '/'
* in the type URL, for example "foo.bar.com/x/y.z" will yield type
* name "y.z".
*
*
* JSON
* ====
* The JSON representation of an `Any` value uses the regular
* representation of the deserialized, embedded message, with an
* additional field `@type` which contains the type URL. Example:
*
* package google.profile;
* message Person {
* string first_name = 1;
* string last_name = 2;
* }
*
* {
* "@type": "type.googleapis.com/google.profile.Person",
* "firstName": <string>,
* "lastName": <string>
* }
*
* If the embedded message type is well-known and has a custom JSON
* representation, that representation will be embedded adding a field
* `value` which holds the custom JSON in addition to the `@type`
* field. Example (for message [google.protobuf.Duration][]):
*
* {
* "@type": "type.googleapis.com/google.protobuf.Duration",
* "value": "1.212s"
* }
*/
export interface Any {
/**
* A URL/resource name that uniquely identifies the type of the serialized
* protocol buffer message. This string must contain at least
* one "/" character. The last segment of the URL's path must represent
* the fully qualified name of the type (as in
* `path/google.protobuf.Duration`). The name should be in a canonical form
* (e.g., leading "." is not accepted).
*
* In practice, teams usually precompile into the binary all types that they
* expect it to use in the context of Any. However, for URLs which use the
* scheme `http`, `https`, or no scheme, one can optionally set up a type
* server that maps type URLs to message definitions as follows:
*
* * If no scheme is provided, `https` is assumed.
* * An HTTP GET on the URL must yield a [google.protobuf.Type][]
* value in binary format, or produce an error.
* * Applications are allowed to cache lookup results based on the
* URL, or have them precompiled into a binary to avoid any
* lookup. Therefore, binary compatibility needs to be preserved
* on changes to types. (Use versioned type names to manage
* breaking changes.)
*
* Note: this functionality is not currently available in the official
* protobuf release, and it is not used for type URLs beginning with
* type.googleapis.com.
*
* Schemes other than `http`, `https` (or the empty scheme) might be
* used with implementation specific semantics.
*/
type_url: string;
/** Must be a valid serialized protocol buffer of the above specified type. */
value: Uint8Array;
}
const baseAny: object = { type_url: "" };
export const Any = {
encode(message: Any, writer: Writer = Writer.create()): Writer {
if (message.type_url !== "") {
writer.uint32(10).string(message.type_url);
}
if (message.value.length !== 0) {
writer.uint32(18).bytes(message.value);
}
return writer;
},
decode(input: Reader | Uint8Array, length?: number): Any {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseAny } as Any;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.type_url = reader.string();
break;
case 2:
message.value = reader.bytes();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): Any {
const message = { ...baseAny } as Any;
if (object.type_url !== undefined && object.type_url !== null) {
message.type_url = String(object.type_url);
} else {
message.type_url = "";
}
if (object.value !== undefined && object.value !== null) {
message.value = bytesFromBase64(object.value);
}
return message;
},
toJSON(message: Any): unknown {
const obj: any = {};
message.type_url !== undefined && (obj.type_url = message.type_url);
message.value !== undefined &&
(obj.value = base64FromBytes(
message.value !== undefined ? message.value : new Uint8Array()
));
return obj;
},
fromPartial(object: DeepPartial<Any>): Any {
const message = { ...baseAny } as Any;
if (object.type_url !== undefined && object.type_url !== null) {
message.type_url = object.type_url;
} else {
message.type_url = "";
}
if (object.value !== undefined && object.value !== null) {
message.value = object.value;
} else {
message.value = new Uint8Array();
}
return message;
},
};
declare var self: any | undefined;
declare var window: any | undefined;
var globalThis: any = (() => {
if (typeof globalThis !== "undefined") return globalThis;
if (typeof self !== "undefined") return self;
if (typeof window !== "undefined") return window;
if (typeof global !== "undefined") return global;
throw "Unable to locate global object";
})();
const atob: (b64: string) => string =
globalThis.atob ||
((b64) => globalThis.Buffer.from(b64, "base64").toString("binary"));
function bytesFromBase64(b64: string): Uint8Array {
const bin = atob(b64);
const arr = new Uint8Array(bin.length);
for (let i = 0; i < bin.length; ++i) {
arr[i] = bin.charCodeAt(i);
}
return arr;
}
const btoa: (bin: string) => string =
globalThis.btoa ||
((bin) => globalThis.Buffer.from(bin, "binary").toString("base64"));
function base64FromBytes(arr: Uint8Array): string {
const bin: string[] = [];
for (let i = 0; i < arr.byteLength; ++i) {
bin.push(String.fromCharCode(arr[i]));
}
return btoa(bin.join(""));
}
type Builtin = Date | Function | Uint8Array | string | number | undefined;
export type DeepPartial<T> = T extends Builtin
? T
: 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>;

View File

@ -6,12 +6,16 @@ import { SigningStargateClient } from "@cosmjs/stargate";
import { Registry, OfflineSigner, EncodeObject, DirectSecp256k1HdWallet } from "@cosmjs/proto-signing";
import { Api } from "./rest";
import { MsgExecuteGovernanceVAA } from "./types/wormhole/tx";
import { MsgStoreCode } from "./types/wormhole/tx";
import { MsgRegisterAccountAsGuardian } from "./types/wormhole/tx";
import { MsgInstantiateContract } from "./types/wormhole/tx";
const types = [
["/certusone.wormholechain.wormhole.MsgExecuteGovernanceVAA", MsgExecuteGovernanceVAA],
["/certusone.wormholechain.wormhole.MsgRegisterAccountAsGuardian", MsgRegisterAccountAsGuardian],
["/wormhole_foundation.wormchain.wormhole.MsgExecuteGovernanceVAA", MsgExecuteGovernanceVAA],
["/wormhole_foundation.wormchain.wormhole.MsgStoreCode", MsgStoreCode],
["/wormhole_foundation.wormchain.wormhole.MsgRegisterAccountAsGuardian", MsgRegisterAccountAsGuardian],
["/wormhole_foundation.wormchain.wormhole.MsgInstantiateContract", MsgInstantiateContract],
];
export const MissingWalletError = new Error("wallet is required");
@ -44,8 +48,10 @@ const txClient = async (wallet: OfflineSigner, { addr: addr }: TxClientOptions =
return {
signAndBroadcast: (msgs: EncodeObject[], { fee, memo }: SignAndBroadcastOptions = {fee: defaultFee, memo: ""}) => client.signAndBroadcast(address, msgs, fee,memo),
msgExecuteGovernanceVAA: (data: MsgExecuteGovernanceVAA): EncodeObject => ({ typeUrl: "/certusone.wormholechain.wormhole.MsgExecuteGovernanceVAA", value: MsgExecuteGovernanceVAA.fromPartial( data ) }),
msgRegisterAccountAsGuardian: (data: MsgRegisterAccountAsGuardian): EncodeObject => ({ typeUrl: "/certusone.wormholechain.wormhole.MsgRegisterAccountAsGuardian", value: MsgRegisterAccountAsGuardian.fromPartial( data ) }),
msgExecuteGovernanceVAA: (data: MsgExecuteGovernanceVAA): EncodeObject => ({ typeUrl: "/wormhole_foundation.wormchain.wormhole.MsgExecuteGovernanceVAA", value: MsgExecuteGovernanceVAA.fromPartial( data ) }),
msgStoreCode: (data: MsgStoreCode): EncodeObject => ({ typeUrl: "/wormhole_foundation.wormchain.wormhole.MsgStoreCode", value: MsgStoreCode.fromPartial( data ) }),
msgRegisterAccountAsGuardian: (data: MsgRegisterAccountAsGuardian): EncodeObject => ({ typeUrl: "/wormhole_foundation.wormchain.wormhole.MsgRegisterAccountAsGuardian", value: MsgRegisterAccountAsGuardian.fromPartial( data ) }),
msgInstantiateContract: (data: MsgInstantiateContract): EncodeObject => ({ typeUrl: "/wormhole_foundation.wormchain.wormhole.MsgInstantiateContract", value: MsgInstantiateContract.fromPartial( data ) }),
};
};

View File

@ -59,7 +59,11 @@ export interface V1Beta1PageRequest {
*/
count_total?: boolean;
/** reverse is set to true if results are to be returned in the descending order. */
/**
* reverse is set to true if results are to be returned in the descending order.
*
* Since: cosmos-sdk 0.43
*/
reverse?: boolean;
}
@ -99,11 +103,6 @@ export interface WormholeConsensusGuardianSetIndex {
index?: number;
}
export interface WormholeGuardianKey {
/** @format byte */
key?: string;
}
export interface WormholeGuardianSet {
/** @format int64 */
index?: number;
@ -123,8 +122,21 @@ export interface WormholeGuardianValidator {
export type WormholeMsgExecuteGovernanceVAAResponse = object;
export interface WormholeMsgInstantiateContractResponse {
/** Address is the bech32 address of the new contract instance. */
address?: string;
/** @format byte */
data?: string;
}
export type WormholeMsgRegisterAccountAsGuardianResponse = object;
export interface WormholeMsgStoreCodeResponse {
/** @format uint64 */
code_id?: string;
}
export interface WormholeQueryAllGuardianSetResponse {
GuardianSet?: WormholeGuardianSet[];
@ -427,11 +439,11 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
* @tags Query
* @name QueryConfig
* @summary Queries a config by index.
* @request GET:/certusone/wormholechain/wormhole/config
* @request GET:/wormhole_foundation/wormchain/wormhole/config
*/
queryConfig = (params: RequestParams = {}) =>
this.request<WormholeQueryGetConfigResponse, RpcStatus>({
path: `/certusone/wormholechain/wormhole/config`,
path: `/wormhole_foundation/wormchain/wormhole/config`,
method: "GET",
format: "json",
...params,
@ -443,11 +455,11 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
* @tags Query
* @name QueryConsensusGuardianSetIndex
* @summary Queries a ConsensusGuardianSetIndex by index.
* @request GET:/certusone/wormholechain/wormhole/consensus_guardian_set_index
* @request GET:/wormhole_foundation/wormchain/wormhole/consensus_guardian_set_index
*/
queryConsensusGuardianSetIndex = (params: RequestParams = {}) =>
this.request<WormholeQueryGetConsensusGuardianSetIndexResponse, RpcStatus>({
path: `/certusone/wormholechain/wormhole/consensus_guardian_set_index`,
path: `/wormhole_foundation/wormchain/wormhole/consensus_guardian_set_index`,
method: "GET",
format: "json",
...params,
@ -459,7 +471,7 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
* @tags Query
* @name QueryGuardianSetAll
* @summary Queries a list of guardianSet items.
* @request GET:/certusone/wormholechain/wormhole/guardianSet
* @request GET:/wormhole_foundation/wormchain/wormhole/guardianSet
*/
queryGuardianSetAll = (
query?: {
@ -472,7 +484,7 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
params: RequestParams = {},
) =>
this.request<WormholeQueryAllGuardianSetResponse, RpcStatus>({
path: `/certusone/wormholechain/wormhole/guardianSet`,
path: `/wormhole_foundation/wormchain/wormhole/guardianSet`,
method: "GET",
query: query,
format: "json",
@ -485,11 +497,11 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
* @tags Query
* @name QueryGuardianSet
* @summary Queries a guardianSet by index.
* @request GET:/certusone/wormholechain/wormhole/guardianSet/{index}
* @request GET:/wormhole_foundation/wormchain/wormhole/guardianSet/{index}
*/
queryGuardianSet = (index: number, params: RequestParams = {}) =>
this.request<WormholeQueryGetGuardianSetResponse, RpcStatus>({
path: `/certusone/wormholechain/wormhole/guardianSet/${index}`,
path: `/wormhole_foundation/wormchain/wormhole/guardianSet/${index}`,
method: "GET",
format: "json",
...params,
@ -501,7 +513,7 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
* @tags Query
* @name QueryGuardianValidatorAll
* @summary Queries a list of GuardianValidator items.
* @request GET:/certusone/wormholechain/wormhole/guardian_validator
* @request GET:/wormhole_foundation/wormchain/wormhole/guardian_validator
*/
queryGuardianValidatorAll = (
query?: {
@ -514,7 +526,7 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
params: RequestParams = {},
) =>
this.request<WormholeQueryAllGuardianValidatorResponse, RpcStatus>({
path: `/certusone/wormholechain/wormhole/guardian_validator`,
path: `/wormhole_foundation/wormchain/wormhole/guardian_validator`,
method: "GET",
query: query,
format: "json",
@ -527,11 +539,11 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
* @tags Query
* @name QueryGuardianValidator
* @summary Queries a GuardianValidator by index.
* @request GET:/certusone/wormholechain/wormhole/guardian_validator/{guardianKey}
* @request GET:/wormhole_foundation/wormchain/wormhole/guardian_validator/{guardianKey}
*/
queryGuardianValidator = (guardianKey: string, params: RequestParams = {}) =>
this.request<WormholeQueryGetGuardianValidatorResponse, RpcStatus>({
path: `/certusone/wormholechain/wormhole/guardian_validator/${guardianKey}`,
path: `/wormhole_foundation/wormchain/wormhole/guardian_validator/${guardianKey}`,
method: "GET",
format: "json",
...params,
@ -543,11 +555,11 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
* @tags Query
* @name QueryLatestGuardianSetIndex
* @summary Queries a list of LatestGuardianSetIndex items.
* @request GET:/certusone/wormholechain/wormhole/latest_guardian_set_index
* @request GET:/wormhole_foundation/wormchain/wormhole/latest_guardian_set_index
*/
queryLatestGuardianSetIndex = (params: RequestParams = {}) =>
this.request<WormholeQueryLatestGuardianSetIndexResponse, RpcStatus>({
path: `/certusone/wormholechain/wormhole/latest_guardian_set_index`,
path: `/wormhole_foundation/wormchain/wormhole/latest_guardian_set_index`,
method: "GET",
format: "json",
...params,
@ -559,7 +571,7 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
* @tags Query
* @name QueryReplayProtectionAll
* @summary Queries a list of replayProtection items.
* @request GET:/certusone/wormholechain/wormhole/replayProtection
* @request GET:/wormhole_foundation/wormchain/wormhole/replayProtection
*/
queryReplayProtectionAll = (
query?: {
@ -572,7 +584,7 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
params: RequestParams = {},
) =>
this.request<WormholeQueryAllReplayProtectionResponse, RpcStatus>({
path: `/certusone/wormholechain/wormhole/replayProtection`,
path: `/wormhole_foundation/wormchain/wormhole/replayProtection`,
method: "GET",
query: query,
format: "json",
@ -585,11 +597,11 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
* @tags Query
* @name QueryReplayProtection
* @summary Queries a replayProtection by index.
* @request GET:/certusone/wormholechain/wormhole/replayProtection/{index}
* @request GET:/wormhole_foundation/wormchain/wormhole/replayProtection/{index}
*/
queryReplayProtection = (index: string, params: RequestParams = {}) =>
this.request<WormholeQueryGetReplayProtectionResponse, RpcStatus>({
path: `/certusone/wormholechain/wormhole/replayProtection/${index}`,
path: `/wormhole_foundation/wormchain/wormhole/replayProtection/${index}`,
method: "GET",
format: "json",
...params,
@ -601,7 +613,7 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
* @tags Query
* @name QuerySequenceCounterAll
* @summary Queries a list of sequenceCounter items.
* @request GET:/certusone/wormholechain/wormhole/sequenceCounter
* @request GET:/wormhole_foundation/wormchain/wormhole/sequenceCounter
*/
querySequenceCounterAll = (
query?: {
@ -614,7 +626,7 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
params: RequestParams = {},
) =>
this.request<WormholeQueryAllSequenceCounterResponse, RpcStatus>({
path: `/certusone/wormholechain/wormhole/sequenceCounter`,
path: `/wormhole_foundation/wormchain/wormhole/sequenceCounter`,
method: "GET",
query: query,
format: "json",
@ -627,11 +639,11 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
* @tags Query
* @name QuerySequenceCounter
* @summary Queries a sequenceCounter by index.
* @request GET:/certusone/wormholechain/wormhole/sequenceCounter/{index}
* @request GET:/wormhole_foundation/wormchain/wormhole/sequenceCounter/{index}
*/
querySequenceCounter = (index: string, params: RequestParams = {}) =>
this.request<WormholeQueryGetSequenceCounterResponse, RpcStatus>({
path: `/certusone/wormholechain/wormhole/sequenceCounter/${index}`,
path: `/wormhole_foundation/wormchain/wormhole/sequenceCounter/${index}`,
method: "GET",
format: "json",
...params,

View File

@ -0,0 +1,329 @@
//@ts-nocheck
/* eslint-disable */
import * as Long from "long";
import { util, configure, Writer, Reader } from "protobufjs/minimal";
export const protobufPackage = "cosmos.base.query.v1beta1";
/**
* PageRequest is to be embedded in gRPC request messages for efficient
* pagination. Ex:
*
* message SomeRequest {
* Foo some_parameter = 1;
* PageRequest pagination = 2;
* }
*/
export interface PageRequest {
/**
* key is a value returned in PageResponse.next_key to begin
* querying the next page most efficiently. Only one of offset or key
* should be set.
*/
key: Uint8Array;
/**
* offset is a numeric offset that can be used when key is unavailable.
* It is less efficient than using key. Only one of offset or key should
* be set.
*/
offset: number;
/**
* limit is the total number of results to be returned in the result page.
* If left empty it will default to a value to be set by each app.
*/
limit: number;
/**
* count_total is set to true to indicate that the result set should include
* a count of the total number of items available for pagination in UIs.
* count_total is only respected when offset is used. It is ignored when key
* is set.
*/
count_total: boolean;
/**
* reverse is set to true if results are to be returned in the descending order.
*
* Since: cosmos-sdk 0.43
*/
reverse: boolean;
}
/**
* PageResponse is to be embedded in gRPC response messages where the
* corresponding request message has used PageRequest.
*
* message SomeResponse {
* repeated Bar results = 1;
* PageResponse page = 2;
* }
*/
export interface PageResponse {
/**
* next_key is the key to be passed to PageRequest.key to
* query the next page most efficiently
*/
next_key: Uint8Array;
/**
* total is total number of results available if PageRequest.count_total
* was set, its value is undefined otherwise
*/
total: number;
}
const basePageRequest: object = {
offset: 0,
limit: 0,
count_total: false,
reverse: false,
};
export const PageRequest = {
encode(message: PageRequest, writer: Writer = Writer.create()): Writer {
if (message.key.length !== 0) {
writer.uint32(10).bytes(message.key);
}
if (message.offset !== 0) {
writer.uint32(16).uint64(message.offset);
}
if (message.limit !== 0) {
writer.uint32(24).uint64(message.limit);
}
if (message.count_total === true) {
writer.uint32(32).bool(message.count_total);
}
if (message.reverse === true) {
writer.uint32(40).bool(message.reverse);
}
return writer;
},
decode(input: Reader | Uint8Array, length?: number): PageRequest {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...basePageRequest } as PageRequest;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.key = reader.bytes();
break;
case 2:
message.offset = longToNumber(reader.uint64() as Long);
break;
case 3:
message.limit = longToNumber(reader.uint64() as Long);
break;
case 4:
message.count_total = reader.bool();
break;
case 5:
message.reverse = reader.bool();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): PageRequest {
const message = { ...basePageRequest } as PageRequest;
if (object.key !== undefined && object.key !== null) {
message.key = bytesFromBase64(object.key);
}
if (object.offset !== undefined && object.offset !== null) {
message.offset = Number(object.offset);
} else {
message.offset = 0;
}
if (object.limit !== undefined && object.limit !== null) {
message.limit = Number(object.limit);
} else {
message.limit = 0;
}
if (object.count_total !== undefined && object.count_total !== null) {
message.count_total = Boolean(object.count_total);
} else {
message.count_total = false;
}
if (object.reverse !== undefined && object.reverse !== null) {
message.reverse = Boolean(object.reverse);
} else {
message.reverse = false;
}
return message;
},
toJSON(message: PageRequest): unknown {
const obj: any = {};
message.key !== undefined &&
(obj.key = base64FromBytes(
message.key !== undefined ? message.key : new Uint8Array()
));
message.offset !== undefined && (obj.offset = message.offset);
message.limit !== undefined && (obj.limit = message.limit);
message.count_total !== undefined &&
(obj.count_total = message.count_total);
message.reverse !== undefined && (obj.reverse = message.reverse);
return obj;
},
fromPartial(object: DeepPartial<PageRequest>): PageRequest {
const message = { ...basePageRequest } as PageRequest;
if (object.key !== undefined && object.key !== null) {
message.key = object.key;
} else {
message.key = new Uint8Array();
}
if (object.offset !== undefined && object.offset !== null) {
message.offset = object.offset;
} else {
message.offset = 0;
}
if (object.limit !== undefined && object.limit !== null) {
message.limit = object.limit;
} else {
message.limit = 0;
}
if (object.count_total !== undefined && object.count_total !== null) {
message.count_total = object.count_total;
} else {
message.count_total = false;
}
if (object.reverse !== undefined && object.reverse !== null) {
message.reverse = object.reverse;
} else {
message.reverse = false;
}
return message;
},
};
const basePageResponse: object = { total: 0 };
export const PageResponse = {
encode(message: PageResponse, writer: Writer = Writer.create()): Writer {
if (message.next_key.length !== 0) {
writer.uint32(10).bytes(message.next_key);
}
if (message.total !== 0) {
writer.uint32(16).uint64(message.total);
}
return writer;
},
decode(input: Reader | Uint8Array, length?: number): PageResponse {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...basePageResponse } as PageResponse;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.next_key = reader.bytes();
break;
case 2:
message.total = longToNumber(reader.uint64() as Long);
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): PageResponse {
const message = { ...basePageResponse } as PageResponse;
if (object.next_key !== undefined && object.next_key !== null) {
message.next_key = bytesFromBase64(object.next_key);
}
if (object.total !== undefined && object.total !== null) {
message.total = Number(object.total);
} else {
message.total = 0;
}
return message;
},
toJSON(message: PageResponse): unknown {
const obj: any = {};
message.next_key !== undefined &&
(obj.next_key = base64FromBytes(
message.next_key !== undefined ? message.next_key : new Uint8Array()
));
message.total !== undefined && (obj.total = message.total);
return obj;
},
fromPartial(object: DeepPartial<PageResponse>): PageResponse {
const message = { ...basePageResponse } as PageResponse;
if (object.next_key !== undefined && object.next_key !== null) {
message.next_key = object.next_key;
} else {
message.next_key = new Uint8Array();
}
if (object.total !== undefined && object.total !== null) {
message.total = object.total;
} else {
message.total = 0;
}
return message;
},
};
declare var self: any | undefined;
declare var window: any | undefined;
var globalThis: any = (() => {
if (typeof globalThis !== "undefined") return globalThis;
if (typeof self !== "undefined") return self;
if (typeof window !== "undefined") return window;
if (typeof global !== "undefined") return global;
throw "Unable to locate global object";
})();
const atob: (b64: string) => string =
globalThis.atob ||
((b64) => globalThis.Buffer.from(b64, "base64").toString("binary"));
function bytesFromBase64(b64: string): Uint8Array {
const bin = atob(b64);
const arr = new Uint8Array(bin.length);
for (let i = 0; i < bin.length; ++i) {
arr[i] = bin.charCodeAt(i);
}
return arr;
}
const btoa: (bin: string) => string =
globalThis.btoa ||
((bin) => globalThis.Buffer.from(bin, "binary").toString("base64"));
function base64FromBytes(arr: Uint8Array): string {
const bin: string[] = [];
for (let i = 0; i < arr.byteLength; ++i) {
bin.push(String.fromCharCode(arr[i]));
}
return btoa(bin.join(""));
}
type Builtin = Date | Function | Uint8Array | string | number | undefined;
export type DeepPartial<T> = T extends Builtin
? T
: 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>;
function longToNumber(long: Long): number {
if (long.gt(Number.MAX_SAFE_INTEGER)) {
throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
}
return long.toNumber();
}
if (util.Long !== Long) {
util.Long = Long as any;
configure();
}

View File

@ -0,0 +1,3 @@
//@ts-nocheck
/* eslint-disable */
export const protobufPackage = "gogoproto";

View File

@ -0,0 +1,3 @@
//@ts-nocheck
/* eslint-disable */
export const protobufPackage = "google.api";

View File

@ -0,0 +1,707 @@
//@ts-nocheck
/* eslint-disable */
import { Writer, Reader } from "protobufjs/minimal";
export const protobufPackage = "google.api";
/**
* Defines the HTTP configuration for an API service. It contains a list of
* [HttpRule][google.api.HttpRule], each specifying the mapping of an RPC method
* to one or more HTTP REST API methods.
*/
export interface Http {
/**
* A list of HTTP configuration rules that apply to individual API methods.
*
* **NOTE:** All service configuration rules follow "last one wins" order.
*/
rules: HttpRule[];
/**
* When set to true, URL path parmeters will be fully URI-decoded except in
* cases of single segment matches in reserved expansion, where "%2F" will be
* left encoded.
*
* The default behavior is to not decode RFC 6570 reserved characters in multi
* segment matches.
*/
fully_decode_reserved_expansion: boolean;
}
/**
* `HttpRule` defines the mapping of an RPC method to one or more HTTP
* REST API methods. The mapping specifies how different portions of the RPC
* request message are mapped to URL path, URL query parameters, and
* HTTP request body. The mapping is typically specified as an
* `google.api.http` annotation on the RPC method,
* see "google/api/annotations.proto" for details.
*
* The mapping consists of a field specifying the path template and
* method kind. The path template can refer to fields in the request
* message, as in the example below which describes a REST GET
* operation on a resource collection of messages:
*
*
* service Messaging {
* rpc GetMessage(GetMessageRequest) returns (Message) {
* option (google.api.http).get = "/v1/messages/{message_id}/{sub.subfield}";
* }
* }
* message GetMessageRequest {
* message SubMessage {
* string subfield = 1;
* }
* string message_id = 1; // mapped to the URL
* SubMessage sub = 2; // `sub.subfield` is url-mapped
* }
* message Message {
* string text = 1; // content of the resource
* }
*
* The same http annotation can alternatively be expressed inside the
* `GRPC API Configuration` YAML file.
*
* http:
* rules:
* - selector: <proto_package_name>.Messaging.GetMessage
* get: /v1/messages/{message_id}/{sub.subfield}
*
* This definition enables an automatic, bidrectional mapping of HTTP
* JSON to RPC. Example:
*
* HTTP | RPC
* -----|-----
* `GET /v1/messages/123456/foo` | `GetMessage(message_id: "123456" sub: SubMessage(subfield: "foo"))`
*
* In general, not only fields but also field paths can be referenced
* from a path pattern. Fields mapped to the path pattern cannot be
* repeated and must have a primitive (non-message) type.
*
* Any fields in the request message which are not bound by the path
* pattern automatically become (optional) HTTP query
* parameters. Assume the following definition of the request message:
*
*
* service Messaging {
* rpc GetMessage(GetMessageRequest) returns (Message) {
* option (google.api.http).get = "/v1/messages/{message_id}";
* }
* }
* message GetMessageRequest {
* message SubMessage {
* string subfield = 1;
* }
* string message_id = 1; // mapped to the URL
* int64 revision = 2; // becomes a parameter
* SubMessage sub = 3; // `sub.subfield` becomes a parameter
* }
*
*
* This enables a HTTP JSON to RPC mapping as below:
*
* HTTP | RPC
* -----|-----
* `GET /v1/messages/123456?revision=2&sub.subfield=foo` | `GetMessage(message_id: "123456" revision: 2 sub: SubMessage(subfield: "foo"))`
*
* Note that fields which are mapped to HTTP parameters must have a
* primitive type or a repeated primitive type. Message types are not
* allowed. In the case of a repeated type, the parameter can be
* repeated in the URL, as in `...?param=A&param=B`.
*
* For HTTP method kinds which allow a request body, the `body` field
* specifies the mapping. Consider a REST update method on the
* message resource collection:
*
*
* service Messaging {
* rpc UpdateMessage(UpdateMessageRequest) returns (Message) {
* option (google.api.http) = {
* put: "/v1/messages/{message_id}"
* body: "message"
* };
* }
* }
* message UpdateMessageRequest {
* string message_id = 1; // mapped to the URL
* Message message = 2; // mapped to the body
* }
*
*
* The following HTTP JSON to RPC mapping is enabled, where the
* representation of the JSON in the request body is determined by
* protos JSON encoding:
*
* HTTP | RPC
* -----|-----
* `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" message { text: "Hi!" })`
*
* The special name `*` can be used in the body mapping to define that
* every field not bound by the path template should be mapped to the
* request body. This enables the following alternative definition of
* the update method:
*
* service Messaging {
* rpc UpdateMessage(Message) returns (Message) {
* option (google.api.http) = {
* put: "/v1/messages/{message_id}"
* body: "*"
* };
* }
* }
* message Message {
* string message_id = 1;
* string text = 2;
* }
*
*
* The following HTTP JSON to RPC mapping is enabled:
*
* HTTP | RPC
* -----|-----
* `PUT /v1/messages/123456 { "text": "Hi!" }` | `UpdateMessage(message_id: "123456" text: "Hi!")`
*
* Note that when using `*` in the body mapping, it is not possible to
* have HTTP parameters, as all fields not bound by the path end in
* the body. This makes this option more rarely used in practice of
* defining REST APIs. The common usage of `*` is in custom methods
* which don't use the URL at all for transferring data.
*
* It is possible to define multiple HTTP methods for one RPC by using
* the `additional_bindings` option. Example:
*
* service Messaging {
* rpc GetMessage(GetMessageRequest) returns (Message) {
* option (google.api.http) = {
* get: "/v1/messages/{message_id}"
* additional_bindings {
* get: "/v1/users/{user_id}/messages/{message_id}"
* }
* };
* }
* }
* message GetMessageRequest {
* string message_id = 1;
* string user_id = 2;
* }
*
*
* This enables the following two alternative HTTP JSON to RPC
* mappings:
*
* HTTP | RPC
* -----|-----
* `GET /v1/messages/123456` | `GetMessage(message_id: "123456")`
* `GET /v1/users/me/messages/123456` | `GetMessage(user_id: "me" message_id: "123456")`
*
* # Rules for HTTP mapping
*
* The rules for mapping HTTP path, query parameters, and body fields
* to the request message are as follows:
*
* 1. The `body` field specifies either `*` or a field path, or is
* omitted. If omitted, it indicates there is no HTTP request body.
* 2. Leaf fields (recursive expansion of nested messages in the
* request) can be classified into three types:
* (a) Matched in the URL template.
* (b) Covered by body (if body is `*`, everything except (a) fields;
* else everything under the body field)
* (c) All other fields.
* 3. URL query parameters found in the HTTP request are mapped to (c) fields.
* 4. Any body sent with an HTTP request can contain only (b) fields.
*
* The syntax of the path template is as follows:
*
* Template = "/" Segments [ Verb ] ;
* Segments = Segment { "/" Segment } ;
* Segment = "*" | "**" | LITERAL | Variable ;
* Variable = "{" FieldPath [ "=" Segments ] "}" ;
* FieldPath = IDENT { "." IDENT } ;
* Verb = ":" LITERAL ;
*
* The syntax `*` matches a single path segment. The syntax `**` matches zero
* or more path segments, which must be the last part of the path except the
* `Verb`. The syntax `LITERAL` matches literal text in the path.
*
* The syntax `Variable` matches part of the URL path as specified by its
* template. A variable template must not contain other variables. If a variable
* matches a single path segment, its template may be omitted, e.g. `{var}`
* is equivalent to `{var=*}`.
*
* If a variable contains exactly one path segment, such as `"{var}"` or
* `"{var=*}"`, when such a variable is expanded into a URL path, all characters
* except `[-_.~0-9a-zA-Z]` are percent-encoded. Such variables show up in the
* Discovery Document as `{var}`.
*
* If a variable contains one or more path segments, such as `"{var=foo/*}"`
* or `"{var=**}"`, when such a variable is expanded into a URL path, all
* characters except `[-_.~/0-9a-zA-Z]` are percent-encoded. Such variables
* show up in the Discovery Document as `{+var}`.
*
* NOTE: While the single segment variable matches the semantics of
* [RFC 6570](https://tools.ietf.org/html/rfc6570) Section 3.2.2
* Simple String Expansion, the multi segment variable **does not** match
* RFC 6570 Reserved Expansion. The reason is that the Reserved Expansion
* does not expand special characters like `?` and `#`, which would lead
* to invalid URLs.
*
* NOTE: the field paths in variables and in the `body` must not refer to
* repeated fields or map fields.
*/
export interface HttpRule {
/**
* Selects methods to which this rule applies.
*
* Refer to [selector][google.api.DocumentationRule.selector] for syntax details.
*/
selector: string;
/** Used for listing and getting information about resources. */
get: string | undefined;
/** Used for updating a resource. */
put: string | undefined;
/** Used for creating a resource. */
post: string | undefined;
/** Used for deleting a resource. */
delete: string | undefined;
/** Used for updating a resource. */
patch: string | undefined;
/**
* The custom pattern is used for specifying an HTTP method that is not
* included in the `pattern` field, such as HEAD, or "*" to leave the
* HTTP method unspecified for this rule. The wild-card rule is useful
* for services that provide content to Web (HTML) clients.
*/
custom: CustomHttpPattern | undefined;
/**
* The name of the request field whose value is mapped to the HTTP body, or
* `*` for mapping all fields not captured by the path pattern to the HTTP
* body. NOTE: the referred field must not be a repeated field and must be
* present at the top-level of request message type.
*/
body: string;
/**
* Optional. The name of the response field whose value is mapped to the HTTP
* body of response. Other response fields are ignored. When
* not set, the response message will be used as HTTP body of response.
*/
response_body: string;
/**
* Additional HTTP bindings for the selector. Nested bindings must
* not contain an `additional_bindings` field themselves (that is,
* the nesting may only be one level deep).
*/
additional_bindings: HttpRule[];
}
/** A custom pattern is used for defining custom HTTP verb. */
export interface CustomHttpPattern {
/** The name of this custom HTTP verb. */
kind: string;
/** The path matched by this custom verb. */
path: string;
}
const baseHttp: object = { fully_decode_reserved_expansion: false };
export const Http = {
encode(message: Http, writer: Writer = Writer.create()): Writer {
for (const v of message.rules) {
HttpRule.encode(v!, writer.uint32(10).fork()).ldelim();
}
if (message.fully_decode_reserved_expansion === true) {
writer.uint32(16).bool(message.fully_decode_reserved_expansion);
}
return writer;
},
decode(input: Reader | Uint8Array, length?: number): Http {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseHttp } as Http;
message.rules = [];
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.rules.push(HttpRule.decode(reader, reader.uint32()));
break;
case 2:
message.fully_decode_reserved_expansion = reader.bool();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): Http {
const message = { ...baseHttp } as Http;
message.rules = [];
if (object.rules !== undefined && object.rules !== null) {
for (const e of object.rules) {
message.rules.push(HttpRule.fromJSON(e));
}
}
if (
object.fully_decode_reserved_expansion !== undefined &&
object.fully_decode_reserved_expansion !== null
) {
message.fully_decode_reserved_expansion = Boolean(
object.fully_decode_reserved_expansion
);
} else {
message.fully_decode_reserved_expansion = false;
}
return message;
},
toJSON(message: Http): unknown {
const obj: any = {};
if (message.rules) {
obj.rules = message.rules.map((e) =>
e ? HttpRule.toJSON(e) : undefined
);
} else {
obj.rules = [];
}
message.fully_decode_reserved_expansion !== undefined &&
(obj.fully_decode_reserved_expansion =
message.fully_decode_reserved_expansion);
return obj;
},
fromPartial(object: DeepPartial<Http>): Http {
const message = { ...baseHttp } as Http;
message.rules = [];
if (object.rules !== undefined && object.rules !== null) {
for (const e of object.rules) {
message.rules.push(HttpRule.fromPartial(e));
}
}
if (
object.fully_decode_reserved_expansion !== undefined &&
object.fully_decode_reserved_expansion !== null
) {
message.fully_decode_reserved_expansion =
object.fully_decode_reserved_expansion;
} else {
message.fully_decode_reserved_expansion = false;
}
return message;
},
};
const baseHttpRule: object = { selector: "", body: "", response_body: "" };
export const HttpRule = {
encode(message: HttpRule, writer: Writer = Writer.create()): Writer {
if (message.selector !== "") {
writer.uint32(10).string(message.selector);
}
if (message.get !== undefined) {
writer.uint32(18).string(message.get);
}
if (message.put !== undefined) {
writer.uint32(26).string(message.put);
}
if (message.post !== undefined) {
writer.uint32(34).string(message.post);
}
if (message.delete !== undefined) {
writer.uint32(42).string(message.delete);
}
if (message.patch !== undefined) {
writer.uint32(50).string(message.patch);
}
if (message.custom !== undefined) {
CustomHttpPattern.encode(
message.custom,
writer.uint32(66).fork()
).ldelim();
}
if (message.body !== "") {
writer.uint32(58).string(message.body);
}
if (message.response_body !== "") {
writer.uint32(98).string(message.response_body);
}
for (const v of message.additional_bindings) {
HttpRule.encode(v!, writer.uint32(90).fork()).ldelim();
}
return writer;
},
decode(input: Reader | Uint8Array, length?: number): HttpRule {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseHttpRule } as HttpRule;
message.additional_bindings = [];
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.selector = reader.string();
break;
case 2:
message.get = reader.string();
break;
case 3:
message.put = reader.string();
break;
case 4:
message.post = reader.string();
break;
case 5:
message.delete = reader.string();
break;
case 6:
message.patch = reader.string();
break;
case 8:
message.custom = CustomHttpPattern.decode(reader, reader.uint32());
break;
case 7:
message.body = reader.string();
break;
case 12:
message.response_body = reader.string();
break;
case 11:
message.additional_bindings.push(
HttpRule.decode(reader, reader.uint32())
);
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): HttpRule {
const message = { ...baseHttpRule } as HttpRule;
message.additional_bindings = [];
if (object.selector !== undefined && object.selector !== null) {
message.selector = String(object.selector);
} else {
message.selector = "";
}
if (object.get !== undefined && object.get !== null) {
message.get = String(object.get);
} else {
message.get = undefined;
}
if (object.put !== undefined && object.put !== null) {
message.put = String(object.put);
} else {
message.put = undefined;
}
if (object.post !== undefined && object.post !== null) {
message.post = String(object.post);
} else {
message.post = undefined;
}
if (object.delete !== undefined && object.delete !== null) {
message.delete = String(object.delete);
} else {
message.delete = undefined;
}
if (object.patch !== undefined && object.patch !== null) {
message.patch = String(object.patch);
} else {
message.patch = undefined;
}
if (object.custom !== undefined && object.custom !== null) {
message.custom = CustomHttpPattern.fromJSON(object.custom);
} else {
message.custom = undefined;
}
if (object.body !== undefined && object.body !== null) {
message.body = String(object.body);
} else {
message.body = "";
}
if (object.response_body !== undefined && object.response_body !== null) {
message.response_body = String(object.response_body);
} else {
message.response_body = "";
}
if (
object.additional_bindings !== undefined &&
object.additional_bindings !== null
) {
for (const e of object.additional_bindings) {
message.additional_bindings.push(HttpRule.fromJSON(e));
}
}
return message;
},
toJSON(message: HttpRule): unknown {
const obj: any = {};
message.selector !== undefined && (obj.selector = message.selector);
message.get !== undefined && (obj.get = message.get);
message.put !== undefined && (obj.put = message.put);
message.post !== undefined && (obj.post = message.post);
message.delete !== undefined && (obj.delete = message.delete);
message.patch !== undefined && (obj.patch = message.patch);
message.custom !== undefined &&
(obj.custom = message.custom
? CustomHttpPattern.toJSON(message.custom)
: undefined);
message.body !== undefined && (obj.body = message.body);
message.response_body !== undefined &&
(obj.response_body = message.response_body);
if (message.additional_bindings) {
obj.additional_bindings = message.additional_bindings.map((e) =>
e ? HttpRule.toJSON(e) : undefined
);
} else {
obj.additional_bindings = [];
}
return obj;
},
fromPartial(object: DeepPartial<HttpRule>): HttpRule {
const message = { ...baseHttpRule } as HttpRule;
message.additional_bindings = [];
if (object.selector !== undefined && object.selector !== null) {
message.selector = object.selector;
} else {
message.selector = "";
}
if (object.get !== undefined && object.get !== null) {
message.get = object.get;
} else {
message.get = undefined;
}
if (object.put !== undefined && object.put !== null) {
message.put = object.put;
} else {
message.put = undefined;
}
if (object.post !== undefined && object.post !== null) {
message.post = object.post;
} else {
message.post = undefined;
}
if (object.delete !== undefined && object.delete !== null) {
message.delete = object.delete;
} else {
message.delete = undefined;
}
if (object.patch !== undefined && object.patch !== null) {
message.patch = object.patch;
} else {
message.patch = undefined;
}
if (object.custom !== undefined && object.custom !== null) {
message.custom = CustomHttpPattern.fromPartial(object.custom);
} else {
message.custom = undefined;
}
if (object.body !== undefined && object.body !== null) {
message.body = object.body;
} else {
message.body = "";
}
if (object.response_body !== undefined && object.response_body !== null) {
message.response_body = object.response_body;
} else {
message.response_body = "";
}
if (
object.additional_bindings !== undefined &&
object.additional_bindings !== null
) {
for (const e of object.additional_bindings) {
message.additional_bindings.push(HttpRule.fromPartial(e));
}
}
return message;
},
};
const baseCustomHttpPattern: object = { kind: "", path: "" };
export const CustomHttpPattern = {
encode(message: CustomHttpPattern, writer: Writer = Writer.create()): Writer {
if (message.kind !== "") {
writer.uint32(10).string(message.kind);
}
if (message.path !== "") {
writer.uint32(18).string(message.path);
}
return writer;
},
decode(input: Reader | Uint8Array, length?: number): CustomHttpPattern {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseCustomHttpPattern } as CustomHttpPattern;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.kind = reader.string();
break;
case 2:
message.path = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): CustomHttpPattern {
const message = { ...baseCustomHttpPattern } as CustomHttpPattern;
if (object.kind !== undefined && object.kind !== null) {
message.kind = String(object.kind);
} else {
message.kind = "";
}
if (object.path !== undefined && object.path !== null) {
message.path = String(object.path);
} else {
message.path = "";
}
return message;
},
toJSON(message: CustomHttpPattern): unknown {
const obj: any = {};
message.kind !== undefined && (obj.kind = message.kind);
message.path !== undefined && (obj.path = message.path);
return obj;
},
fromPartial(object: DeepPartial<CustomHttpPattern>): CustomHttpPattern {
const message = { ...baseCustomHttpPattern } as CustomHttpPattern;
if (object.kind !== undefined && object.kind !== null) {
message.kind = object.kind;
} else {
message.kind = "";
}
if (object.path !== undefined && object.path !== null) {
message.path = object.path;
} else {
message.path = "";
}
return message;
},
};
type Builtin = Date | Function | Uint8Array | string | number | undefined;
export type DeepPartial<T> = T extends Builtin
? T
: 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>;

View File

@ -3,7 +3,7 @@
import * as Long from "long";
import { util, configure, Writer, Reader } from "protobufjs/minimal";
export const protobufPackage = "certusone.wormholechain.wormhole";
export const protobufPackage = "wormhole_foundation.wormchain.wormhole";
export interface Config {
guardian_set_expiration: number;

View File

@ -2,7 +2,7 @@
/* eslint-disable */
import { Writer, Reader } from "protobufjs/minimal";
export const protobufPackage = "certusone.wormholechain.wormhole";
export const protobufPackage = "wormhole_foundation.wormchain.wormhole";
export interface ConsensusGuardianSetIndex {
index: number;

View File

@ -3,7 +3,7 @@
import * as Long from "long";
import { util, configure, Writer, Reader } from "protobufjs/minimal";
export const protobufPackage = "certusone.wormholechain.wormhole";
export const protobufPackage = "wormhole_foundation.wormchain.wormhole";
export interface EventGuardianSetUpdate {
old_index: number;

View File

@ -8,7 +8,7 @@ import { ConsensusGuardianSetIndex } from "../wormhole/consensus_guardian_set_in
import { GuardianValidator } from "../wormhole/guardian_validator";
import { Writer, Reader } from "protobufjs/minimal";
export const protobufPackage = "certusone.wormholechain.wormhole";
export const protobufPackage = "wormhole_foundation.wormchain.wormhole";
/** GenesisState defines the wormhole module's genesis state. */
export interface GenesisState {

View File

@ -3,7 +3,7 @@
import { GuardianSet } from "../wormhole/guardian_set";
import { Writer, Reader } from "protobufjs/minimal";
export const protobufPackage = "certusone.wormholechain.wormhole";
export const protobufPackage = "wormhole_foundation.wormchain.wormhole";
/** GuardianSetUpdateProposal defines a guardian set update governance proposal */
export interface GuardianSetUpdateProposal {

View File

@ -2,7 +2,7 @@
/* eslint-disable */
import { Writer, Reader } from "protobufjs/minimal";
export const protobufPackage = "certusone.wormholechain.wormhole";
export const protobufPackage = "wormhole_foundation.wormchain.wormhole";
export interface GuardianKey {
key: Uint8Array;

View File

@ -3,7 +3,7 @@
import * as Long from "long";
import { util, configure, Writer, Reader } from "protobufjs/minimal";
export const protobufPackage = "certusone.wormholechain.wormhole";
export const protobufPackage = "wormhole_foundation.wormchain.wormhole";
export interface GuardianSet {
index: number;

View File

@ -2,7 +2,7 @@
/* eslint-disable */
import { Writer, Reader } from "protobufjs/minimal";
export const protobufPackage = "certusone.wormholechain.wormhole";
export const protobufPackage = "wormhole_foundation.wormchain.wormhole";
export interface GuardianValidator {
guardianKey: Uint8Array;

View File

@ -12,7 +12,7 @@ import { SequenceCounter } from "../wormhole/sequence_counter";
import { ConsensusGuardianSetIndex } from "../wormhole/consensus_guardian_set_index";
import { GuardianValidator } from "../wormhole/guardian_validator";
export const protobufPackage = "certusone.wormholechain.wormhole";
export const protobufPackage = "wormhole_foundation.wormchain.wormhole";
export interface QueryGetGuardianSetRequest {
index: number;
@ -1859,7 +1859,7 @@ export class QueryClientImpl implements Query {
): Promise<QueryGetGuardianSetResponse> {
const data = QueryGetGuardianSetRequest.encode(request).finish();
const promise = this.rpc.request(
"certusone.wormholechain.wormhole.Query",
"wormhole_foundation.wormchain.wormhole.Query",
"GuardianSet",
data
);
@ -1873,7 +1873,7 @@ export class QueryClientImpl implements Query {
): Promise<QueryAllGuardianSetResponse> {
const data = QueryAllGuardianSetRequest.encode(request).finish();
const promise = this.rpc.request(
"certusone.wormholechain.wormhole.Query",
"wormhole_foundation.wormchain.wormhole.Query",
"GuardianSetAll",
data
);
@ -1885,7 +1885,7 @@ export class QueryClientImpl implements Query {
Config(request: QueryGetConfigRequest): Promise<QueryGetConfigResponse> {
const data = QueryGetConfigRequest.encode(request).finish();
const promise = this.rpc.request(
"certusone.wormholechain.wormhole.Query",
"wormhole_foundation.wormchain.wormhole.Query",
"Config",
data
);
@ -1899,7 +1899,7 @@ export class QueryClientImpl implements Query {
): Promise<QueryGetReplayProtectionResponse> {
const data = QueryGetReplayProtectionRequest.encode(request).finish();
const promise = this.rpc.request(
"certusone.wormholechain.wormhole.Query",
"wormhole_foundation.wormchain.wormhole.Query",
"ReplayProtection",
data
);
@ -1913,7 +1913,7 @@ export class QueryClientImpl implements Query {
): Promise<QueryAllReplayProtectionResponse> {
const data = QueryAllReplayProtectionRequest.encode(request).finish();
const promise = this.rpc.request(
"certusone.wormholechain.wormhole.Query",
"wormhole_foundation.wormchain.wormhole.Query",
"ReplayProtectionAll",
data
);
@ -1927,7 +1927,7 @@ export class QueryClientImpl implements Query {
): Promise<QueryGetSequenceCounterResponse> {
const data = QueryGetSequenceCounterRequest.encode(request).finish();
const promise = this.rpc.request(
"certusone.wormholechain.wormhole.Query",
"wormhole_foundation.wormchain.wormhole.Query",
"SequenceCounter",
data
);
@ -1941,7 +1941,7 @@ export class QueryClientImpl implements Query {
): Promise<QueryAllSequenceCounterResponse> {
const data = QueryAllSequenceCounterRequest.encode(request).finish();
const promise = this.rpc.request(
"certusone.wormholechain.wormhole.Query",
"wormhole_foundation.wormchain.wormhole.Query",
"SequenceCounterAll",
data
);
@ -1957,7 +1957,7 @@ export class QueryClientImpl implements Query {
request
).finish();
const promise = this.rpc.request(
"certusone.wormholechain.wormhole.Query",
"wormhole_foundation.wormchain.wormhole.Query",
"ConsensusGuardianSetIndex",
data
);
@ -1971,7 +1971,7 @@ export class QueryClientImpl implements Query {
): Promise<QueryGetGuardianValidatorResponse> {
const data = QueryGetGuardianValidatorRequest.encode(request).finish();
const promise = this.rpc.request(
"certusone.wormholechain.wormhole.Query",
"wormhole_foundation.wormchain.wormhole.Query",
"GuardianValidator",
data
);
@ -1985,7 +1985,7 @@ export class QueryClientImpl implements Query {
): Promise<QueryAllGuardianValidatorResponse> {
const data = QueryAllGuardianValidatorRequest.encode(request).finish();
const promise = this.rpc.request(
"certusone.wormholechain.wormhole.Query",
"wormhole_foundation.wormchain.wormhole.Query",
"GuardianValidatorAll",
data
);
@ -1999,7 +1999,7 @@ export class QueryClientImpl implements Query {
): Promise<QueryLatestGuardianSetIndexResponse> {
const data = QueryLatestGuardianSetIndexRequest.encode(request).finish();
const promise = this.rpc.request(
"certusone.wormholechain.wormhole.Query",
"wormhole_foundation.wormchain.wormhole.Query",
"LatestGuardianSetIndex",
data
);

View File

@ -2,7 +2,7 @@
/* eslint-disable */
import { Writer, Reader } from "protobufjs/minimal";
export const protobufPackage = "certusone.wormholechain.wormhole";
export const protobufPackage = "wormhole_foundation.wormchain.wormhole";
export interface ReplayProtection {
index: string;

View File

@ -3,7 +3,7 @@
import * as Long from "long";
import { util, configure, Writer, Reader } from "protobufjs/minimal";
export const protobufPackage = "certusone.wormholechain.wormhole";
export const protobufPackage = "wormhole_foundation.wormchain.wormhole";
export interface SequenceCounter {
index: string;

View File

@ -0,0 +1,843 @@
//@ts-nocheck
/* eslint-disable */
import { Reader, util, configure, Writer } from "protobufjs/minimal";
import * as Long from "long";
export const protobufPackage = "wormhole_foundation.wormchain.wormhole";
export interface MsgExecuteGovernanceVAA {
vaa: Uint8Array;
signer: string;
}
export interface MsgExecuteGovernanceVAAResponse {}
export interface MsgRegisterAccountAsGuardian {
signer: string;
signature: Uint8Array;
}
export interface MsgRegisterAccountAsGuardianResponse {}
/** Same as from x/wasmd but with vaa auth */
export interface MsgStoreCode {
/** Signer is the that actor that signed the messages */
signer: string;
/** WASMByteCode can be raw or gzip compressed */
wasm_byte_code: Uint8Array;
/** vaa must be governance msg with payload containing sha3 256 hash of `wasm_byte_code` */
vaa: Uint8Array;
}
export interface MsgStoreCodeResponse {
/** CodeID is the reference to the stored WASM code */
code_id: number;
}
/** Same as from x/wasmd but with vaa auth */
export interface MsgInstantiateContract {
/** Signer is the that actor that signed the messages */
signer: string;
/** CodeID is the reference to the stored WASM code */
code_id: number;
/** Label is optional metadata to be stored with a contract instance. */
label: string;
/** Msg json encoded message to be passed to the contract on instantiation */
msg: Uint8Array;
/** vaa must be governance msg with payload containing sha3 256 hash of `bigEndian(code_id) || label || msg` */
vaa: Uint8Array;
}
export interface MsgInstantiateContractResponse {
/** Address is the bech32 address of the new contract instance. */
address: string;
/** Data contains base64-encoded bytes to returned from the contract */
data: Uint8Array;
}
const baseMsgExecuteGovernanceVAA: object = { signer: "" };
export const MsgExecuteGovernanceVAA = {
encode(
message: MsgExecuteGovernanceVAA,
writer: Writer = Writer.create()
): Writer {
if (message.vaa.length !== 0) {
writer.uint32(10).bytes(message.vaa);
}
if (message.signer !== "") {
writer.uint32(18).string(message.signer);
}
return writer;
},
decode(input: Reader | Uint8Array, length?: number): MsgExecuteGovernanceVAA {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = {
...baseMsgExecuteGovernanceVAA,
} as MsgExecuteGovernanceVAA;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.vaa = reader.bytes();
break;
case 2:
message.signer = reader.string();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): MsgExecuteGovernanceVAA {
const message = {
...baseMsgExecuteGovernanceVAA,
} as MsgExecuteGovernanceVAA;
if (object.vaa !== undefined && object.vaa !== null) {
message.vaa = bytesFromBase64(object.vaa);
}
if (object.signer !== undefined && object.signer !== null) {
message.signer = String(object.signer);
} else {
message.signer = "";
}
return message;
},
toJSON(message: MsgExecuteGovernanceVAA): unknown {
const obj: any = {};
message.vaa !== undefined &&
(obj.vaa = base64FromBytes(
message.vaa !== undefined ? message.vaa : new Uint8Array()
));
message.signer !== undefined && (obj.signer = message.signer);
return obj;
},
fromPartial(
object: DeepPartial<MsgExecuteGovernanceVAA>
): MsgExecuteGovernanceVAA {
const message = {
...baseMsgExecuteGovernanceVAA,
} as MsgExecuteGovernanceVAA;
if (object.vaa !== undefined && object.vaa !== null) {
message.vaa = object.vaa;
} else {
message.vaa = new Uint8Array();
}
if (object.signer !== undefined && object.signer !== null) {
message.signer = object.signer;
} else {
message.signer = "";
}
return message;
},
};
const baseMsgExecuteGovernanceVAAResponse: object = {};
export const MsgExecuteGovernanceVAAResponse = {
encode(
_: MsgExecuteGovernanceVAAResponse,
writer: Writer = Writer.create()
): Writer {
return writer;
},
decode(
input: Reader | Uint8Array,
length?: number
): MsgExecuteGovernanceVAAResponse {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = {
...baseMsgExecuteGovernanceVAAResponse,
} as MsgExecuteGovernanceVAAResponse;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(_: any): MsgExecuteGovernanceVAAResponse {
const message = {
...baseMsgExecuteGovernanceVAAResponse,
} as MsgExecuteGovernanceVAAResponse;
return message;
},
toJSON(_: MsgExecuteGovernanceVAAResponse): unknown {
const obj: any = {};
return obj;
},
fromPartial(
_: DeepPartial<MsgExecuteGovernanceVAAResponse>
): MsgExecuteGovernanceVAAResponse {
const message = {
...baseMsgExecuteGovernanceVAAResponse,
} as MsgExecuteGovernanceVAAResponse;
return message;
},
};
const baseMsgRegisterAccountAsGuardian: object = { signer: "" };
export const MsgRegisterAccountAsGuardian = {
encode(
message: MsgRegisterAccountAsGuardian,
writer: Writer = Writer.create()
): Writer {
if (message.signer !== "") {
writer.uint32(10).string(message.signer);
}
if (message.signature.length !== 0) {
writer.uint32(26).bytes(message.signature);
}
return writer;
},
decode(
input: Reader | Uint8Array,
length?: number
): MsgRegisterAccountAsGuardian {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = {
...baseMsgRegisterAccountAsGuardian,
} as MsgRegisterAccountAsGuardian;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.signer = reader.string();
break;
case 3:
message.signature = reader.bytes();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): MsgRegisterAccountAsGuardian {
const message = {
...baseMsgRegisterAccountAsGuardian,
} as MsgRegisterAccountAsGuardian;
if (object.signer !== undefined && object.signer !== null) {
message.signer = String(object.signer);
} else {
message.signer = "";
}
if (object.signature !== undefined && object.signature !== null) {
message.signature = bytesFromBase64(object.signature);
}
return message;
},
toJSON(message: MsgRegisterAccountAsGuardian): unknown {
const obj: any = {};
message.signer !== undefined && (obj.signer = message.signer);
message.signature !== undefined &&
(obj.signature = base64FromBytes(
message.signature !== undefined ? message.signature : new Uint8Array()
));
return obj;
},
fromPartial(
object: DeepPartial<MsgRegisterAccountAsGuardian>
): MsgRegisterAccountAsGuardian {
const message = {
...baseMsgRegisterAccountAsGuardian,
} as MsgRegisterAccountAsGuardian;
if (object.signer !== undefined && object.signer !== null) {
message.signer = object.signer;
} else {
message.signer = "";
}
if (object.signature !== undefined && object.signature !== null) {
message.signature = object.signature;
} else {
message.signature = new Uint8Array();
}
return message;
},
};
const baseMsgRegisterAccountAsGuardianResponse: object = {};
export const MsgRegisterAccountAsGuardianResponse = {
encode(
_: MsgRegisterAccountAsGuardianResponse,
writer: Writer = Writer.create()
): Writer {
return writer;
},
decode(
input: Reader | Uint8Array,
length?: number
): MsgRegisterAccountAsGuardianResponse {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = {
...baseMsgRegisterAccountAsGuardianResponse,
} as MsgRegisterAccountAsGuardianResponse;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(_: any): MsgRegisterAccountAsGuardianResponse {
const message = {
...baseMsgRegisterAccountAsGuardianResponse,
} as MsgRegisterAccountAsGuardianResponse;
return message;
},
toJSON(_: MsgRegisterAccountAsGuardianResponse): unknown {
const obj: any = {};
return obj;
},
fromPartial(
_: DeepPartial<MsgRegisterAccountAsGuardianResponse>
): MsgRegisterAccountAsGuardianResponse {
const message = {
...baseMsgRegisterAccountAsGuardianResponse,
} as MsgRegisterAccountAsGuardianResponse;
return message;
},
};
const baseMsgStoreCode: object = { signer: "" };
export const MsgStoreCode = {
encode(message: MsgStoreCode, writer: Writer = Writer.create()): Writer {
if (message.signer !== "") {
writer.uint32(10).string(message.signer);
}
if (message.wasm_byte_code.length !== 0) {
writer.uint32(18).bytes(message.wasm_byte_code);
}
if (message.vaa.length !== 0) {
writer.uint32(26).bytes(message.vaa);
}
return writer;
},
decode(input: Reader | Uint8Array, length?: number): MsgStoreCode {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseMsgStoreCode } as MsgStoreCode;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.signer = reader.string();
break;
case 2:
message.wasm_byte_code = reader.bytes();
break;
case 3:
message.vaa = reader.bytes();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): MsgStoreCode {
const message = { ...baseMsgStoreCode } as MsgStoreCode;
if (object.signer !== undefined && object.signer !== null) {
message.signer = String(object.signer);
} else {
message.signer = "";
}
if (object.wasm_byte_code !== undefined && object.wasm_byte_code !== null) {
message.wasm_byte_code = bytesFromBase64(object.wasm_byte_code);
}
if (object.vaa !== undefined && object.vaa !== null) {
message.vaa = bytesFromBase64(object.vaa);
}
return message;
},
toJSON(message: MsgStoreCode): unknown {
const obj: any = {};
message.signer !== undefined && (obj.signer = message.signer);
message.wasm_byte_code !== undefined &&
(obj.wasm_byte_code = base64FromBytes(
message.wasm_byte_code !== undefined
? message.wasm_byte_code
: new Uint8Array()
));
message.vaa !== undefined &&
(obj.vaa = base64FromBytes(
message.vaa !== undefined ? message.vaa : new Uint8Array()
));
return obj;
},
fromPartial(object: DeepPartial<MsgStoreCode>): MsgStoreCode {
const message = { ...baseMsgStoreCode } as MsgStoreCode;
if (object.signer !== undefined && object.signer !== null) {
message.signer = object.signer;
} else {
message.signer = "";
}
if (object.wasm_byte_code !== undefined && object.wasm_byte_code !== null) {
message.wasm_byte_code = object.wasm_byte_code;
} else {
message.wasm_byte_code = new Uint8Array();
}
if (object.vaa !== undefined && object.vaa !== null) {
message.vaa = object.vaa;
} else {
message.vaa = new Uint8Array();
}
return message;
},
};
const baseMsgStoreCodeResponse: object = { code_id: 0 };
export const MsgStoreCodeResponse = {
encode(
message: MsgStoreCodeResponse,
writer: Writer = Writer.create()
): Writer {
if (message.code_id !== 0) {
writer.uint32(8).uint64(message.code_id);
}
return writer;
},
decode(input: Reader | Uint8Array, length?: number): MsgStoreCodeResponse {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseMsgStoreCodeResponse } as MsgStoreCodeResponse;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.code_id = longToNumber(reader.uint64() as Long);
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): MsgStoreCodeResponse {
const message = { ...baseMsgStoreCodeResponse } as MsgStoreCodeResponse;
if (object.code_id !== undefined && object.code_id !== null) {
message.code_id = Number(object.code_id);
} else {
message.code_id = 0;
}
return message;
},
toJSON(message: MsgStoreCodeResponse): unknown {
const obj: any = {};
message.code_id !== undefined && (obj.code_id = message.code_id);
return obj;
},
fromPartial(object: DeepPartial<MsgStoreCodeResponse>): MsgStoreCodeResponse {
const message = { ...baseMsgStoreCodeResponse } as MsgStoreCodeResponse;
if (object.code_id !== undefined && object.code_id !== null) {
message.code_id = object.code_id;
} else {
message.code_id = 0;
}
return message;
},
};
const baseMsgInstantiateContract: object = {
signer: "",
code_id: 0,
label: "",
};
export const MsgInstantiateContract = {
encode(
message: MsgInstantiateContract,
writer: Writer = Writer.create()
): Writer {
if (message.signer !== "") {
writer.uint32(10).string(message.signer);
}
if (message.code_id !== 0) {
writer.uint32(24).uint64(message.code_id);
}
if (message.label !== "") {
writer.uint32(34).string(message.label);
}
if (message.msg.length !== 0) {
writer.uint32(42).bytes(message.msg);
}
if (message.vaa.length !== 0) {
writer.uint32(50).bytes(message.vaa);
}
return writer;
},
decode(input: Reader | Uint8Array, length?: number): MsgInstantiateContract {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = { ...baseMsgInstantiateContract } as MsgInstantiateContract;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.signer = reader.string();
break;
case 3:
message.code_id = longToNumber(reader.uint64() as Long);
break;
case 4:
message.label = reader.string();
break;
case 5:
message.msg = reader.bytes();
break;
case 6:
message.vaa = reader.bytes();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): MsgInstantiateContract {
const message = { ...baseMsgInstantiateContract } as MsgInstantiateContract;
if (object.signer !== undefined && object.signer !== null) {
message.signer = String(object.signer);
} else {
message.signer = "";
}
if (object.code_id !== undefined && object.code_id !== null) {
message.code_id = Number(object.code_id);
} else {
message.code_id = 0;
}
if (object.label !== undefined && object.label !== null) {
message.label = String(object.label);
} else {
message.label = "";
}
if (object.msg !== undefined && object.msg !== null) {
message.msg = bytesFromBase64(object.msg);
}
if (object.vaa !== undefined && object.vaa !== null) {
message.vaa = bytesFromBase64(object.vaa);
}
return message;
},
toJSON(message: MsgInstantiateContract): unknown {
const obj: any = {};
message.signer !== undefined && (obj.signer = message.signer);
message.code_id !== undefined && (obj.code_id = message.code_id);
message.label !== undefined && (obj.label = message.label);
message.msg !== undefined &&
(obj.msg = base64FromBytes(
message.msg !== undefined ? message.msg : new Uint8Array()
));
message.vaa !== undefined &&
(obj.vaa = base64FromBytes(
message.vaa !== undefined ? message.vaa : new Uint8Array()
));
return obj;
},
fromPartial(
object: DeepPartial<MsgInstantiateContract>
): MsgInstantiateContract {
const message = { ...baseMsgInstantiateContract } as MsgInstantiateContract;
if (object.signer !== undefined && object.signer !== null) {
message.signer = object.signer;
} else {
message.signer = "";
}
if (object.code_id !== undefined && object.code_id !== null) {
message.code_id = object.code_id;
} else {
message.code_id = 0;
}
if (object.label !== undefined && object.label !== null) {
message.label = object.label;
} else {
message.label = "";
}
if (object.msg !== undefined && object.msg !== null) {
message.msg = object.msg;
} else {
message.msg = new Uint8Array();
}
if (object.vaa !== undefined && object.vaa !== null) {
message.vaa = object.vaa;
} else {
message.vaa = new Uint8Array();
}
return message;
},
};
const baseMsgInstantiateContractResponse: object = { address: "" };
export const MsgInstantiateContractResponse = {
encode(
message: MsgInstantiateContractResponse,
writer: Writer = Writer.create()
): Writer {
if (message.address !== "") {
writer.uint32(10).string(message.address);
}
if (message.data.length !== 0) {
writer.uint32(18).bytes(message.data);
}
return writer;
},
decode(
input: Reader | Uint8Array,
length?: number
): MsgInstantiateContractResponse {
const reader = input instanceof Uint8Array ? new Reader(input) : input;
let end = length === undefined ? reader.len : reader.pos + length;
const message = {
...baseMsgInstantiateContractResponse,
} as MsgInstantiateContractResponse;
while (reader.pos < end) {
const tag = reader.uint32();
switch (tag >>> 3) {
case 1:
message.address = reader.string();
break;
case 2:
message.data = reader.bytes();
break;
default:
reader.skipType(tag & 7);
break;
}
}
return message;
},
fromJSON(object: any): MsgInstantiateContractResponse {
const message = {
...baseMsgInstantiateContractResponse,
} as MsgInstantiateContractResponse;
if (object.address !== undefined && object.address !== null) {
message.address = String(object.address);
} else {
message.address = "";
}
if (object.data !== undefined && object.data !== null) {
message.data = bytesFromBase64(object.data);
}
return message;
},
toJSON(message: MsgInstantiateContractResponse): unknown {
const obj: any = {};
message.address !== undefined && (obj.address = message.address);
message.data !== undefined &&
(obj.data = base64FromBytes(
message.data !== undefined ? message.data : new Uint8Array()
));
return obj;
},
fromPartial(
object: DeepPartial<MsgInstantiateContractResponse>
): MsgInstantiateContractResponse {
const message = {
...baseMsgInstantiateContractResponse,
} as MsgInstantiateContractResponse;
if (object.address !== undefined && object.address !== null) {
message.address = object.address;
} else {
message.address = "";
}
if (object.data !== undefined && object.data !== null) {
message.data = object.data;
} else {
message.data = new Uint8Array();
}
return message;
},
};
/** Msg defines the Msg service. */
export interface Msg {
ExecuteGovernanceVAA(
request: MsgExecuteGovernanceVAA
): Promise<MsgExecuteGovernanceVAAResponse>;
RegisterAccountAsGuardian(
request: MsgRegisterAccountAsGuardian
): Promise<MsgRegisterAccountAsGuardianResponse>;
/** StoreCode to submit Wasm code to the system */
StoreCode(request: MsgStoreCode): Promise<MsgStoreCodeResponse>;
/** Instantiate creates a new smart contract instance for the given code id. */
InstantiateContract(
request: MsgInstantiateContract
): Promise<MsgInstantiateContractResponse>;
}
export class MsgClientImpl implements Msg {
private readonly rpc: Rpc;
constructor(rpc: Rpc) {
this.rpc = rpc;
}
ExecuteGovernanceVAA(
request: MsgExecuteGovernanceVAA
): Promise<MsgExecuteGovernanceVAAResponse> {
const data = MsgExecuteGovernanceVAA.encode(request).finish();
const promise = this.rpc.request(
"wormhole_foundation.wormchain.wormhole.Msg",
"ExecuteGovernanceVAA",
data
);
return promise.then((data) =>
MsgExecuteGovernanceVAAResponse.decode(new Reader(data))
);
}
RegisterAccountAsGuardian(
request: MsgRegisterAccountAsGuardian
): Promise<MsgRegisterAccountAsGuardianResponse> {
const data = MsgRegisterAccountAsGuardian.encode(request).finish();
const promise = this.rpc.request(
"wormhole_foundation.wormchain.wormhole.Msg",
"RegisterAccountAsGuardian",
data
);
return promise.then((data) =>
MsgRegisterAccountAsGuardianResponse.decode(new Reader(data))
);
}
StoreCode(request: MsgStoreCode): Promise<MsgStoreCodeResponse> {
const data = MsgStoreCode.encode(request).finish();
const promise = this.rpc.request(
"wormhole_foundation.wormchain.wormhole.Msg",
"StoreCode",
data
);
return promise.then((data) =>
MsgStoreCodeResponse.decode(new Reader(data))
);
}
InstantiateContract(
request: MsgInstantiateContract
): Promise<MsgInstantiateContractResponse> {
const data = MsgInstantiateContract.encode(request).finish();
const promise = this.rpc.request(
"wormhole_foundation.wormchain.wormhole.Msg",
"InstantiateContract",
data
);
return promise.then((data) =>
MsgInstantiateContractResponse.decode(new Reader(data))
);
}
}
interface Rpc {
request(
service: string,
method: string,
data: Uint8Array
): Promise<Uint8Array>;
}
declare var self: any | undefined;
declare var window: any | undefined;
var globalThis: any = (() => {
if (typeof globalThis !== "undefined") return globalThis;
if (typeof self !== "undefined") return self;
if (typeof window !== "undefined") return window;
if (typeof global !== "undefined") return global;
throw "Unable to locate global object";
})();
const atob: (b64: string) => string =
globalThis.atob ||
((b64) => globalThis.Buffer.from(b64, "base64").toString("binary"));
function bytesFromBase64(b64: string): Uint8Array {
const bin = atob(b64);
const arr = new Uint8Array(bin.length);
for (let i = 0; i < bin.length; ++i) {
arr[i] = bin.charCodeAt(i);
}
return arr;
}
const btoa: (bin: string) => string =
globalThis.btoa ||
((bin) => globalThis.Buffer.from(bin, "binary").toString("base64"));
function base64FromBytes(arr: Uint8Array): string {
const bin: string[] = [];
for (let i = 0; i < arr.byteLength; ++i) {
bin.push(String.fromCharCode(arr[i]));
}
return btoa(bin.join(""));
}
type Builtin = Date | Function | Uint8Array | string | number | undefined;
export type DeepPartial<T> = T extends Builtin
? T
: 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>;
function longToNumber(long: Long): number {
if (long.gt(Number.MAX_SAFE_INTEGER)) {
throw new globalThis.Error("Value is larger than Number.MAX_SAFE_INTEGER");
}
return long.toNumber();
}
if (util.Long !== Long) {
util.Long = Long as any;
configure();
}