proto-signing: Add ts-proto-generated codec
This commit is contained in:
parent
331db2cb9a
commit
53f923baea
650
packages/proto-signing/src/codec/cosmos/bank/v1beta1/bank.ts
Normal file
650
packages/proto-signing/src/codec/cosmos/bank/v1beta1/bank.ts
Normal file
@ -0,0 +1,650 @@
|
||||
/* eslint-disable */
|
||||
import { Coin } from "../../../cosmos/base/v1beta1/coin";
|
||||
import { Writer, Reader } from "protobufjs/minimal";
|
||||
|
||||
/**
|
||||
* Params defines the parameters for the bank module.
|
||||
*/
|
||||
export interface Params {
|
||||
sendEnabled: SendEnabled[];
|
||||
defaultSendEnabled: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* SendEnabled maps coin denom to a send_enabled status (whether a denom is
|
||||
* sendable).
|
||||
*/
|
||||
export interface SendEnabled {
|
||||
denom: string;
|
||||
enabled: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* Input models transaction input.
|
||||
*/
|
||||
export interface Input {
|
||||
address: string;
|
||||
coins: Coin[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Output models transaction outputs.
|
||||
*/
|
||||
export interface Output {
|
||||
address: string;
|
||||
coins: Coin[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Supply represents a struct that passively keeps track of the total supply
|
||||
* amounts in the network.
|
||||
*/
|
||||
export interface Supply {
|
||||
total: Coin[];
|
||||
}
|
||||
|
||||
/**
|
||||
* DenomUnit represents a struct that describes a given
|
||||
* denomination unit of the basic token.
|
||||
*/
|
||||
export interface DenomUnit {
|
||||
/**
|
||||
* denom represents the string name of the given denom unit (e.g uatom).
|
||||
*/
|
||||
denom: string;
|
||||
/**
|
||||
* exponent represents power of 10 exponent that one must
|
||||
* raise the base_denom to in order to equal the given DenomUnit's denom
|
||||
* 1 denom = 1^exponent base_denom
|
||||
* (e.g. with a base_denom of uatom, one can create a DenomUnit of 'atom' with
|
||||
* exponent = 6, thus: 1 atom = 10^6 uatom).
|
||||
*/
|
||||
exponent: number;
|
||||
/**
|
||||
* aliases is a list of string aliases for the given denom
|
||||
*/
|
||||
aliases: string[];
|
||||
}
|
||||
|
||||
/**
|
||||
* Metadata represents a struct that describes
|
||||
* a basic token.
|
||||
*/
|
||||
export interface Metadata {
|
||||
description: string;
|
||||
/**
|
||||
* denom_units represents the list of DenomUnit's for a given coin
|
||||
*/
|
||||
denomUnits: DenomUnit[];
|
||||
/**
|
||||
* base represents the base denom (should be the DenomUnit with exponent = 0).
|
||||
*/
|
||||
base: string;
|
||||
/**
|
||||
* display indicates the suggested denom that should be
|
||||
* displayed in clients.
|
||||
*/
|
||||
display: string;
|
||||
}
|
||||
|
||||
const baseParams: object = {
|
||||
defaultSendEnabled: false,
|
||||
};
|
||||
|
||||
const baseSendEnabled: object = {
|
||||
denom: "",
|
||||
enabled: false,
|
||||
};
|
||||
|
||||
const baseInput: object = {
|
||||
address: "",
|
||||
};
|
||||
|
||||
const baseOutput: object = {
|
||||
address: "",
|
||||
};
|
||||
|
||||
const baseSupply: object = {};
|
||||
|
||||
const baseDenomUnit: object = {
|
||||
denom: "",
|
||||
exponent: 0,
|
||||
aliases: "",
|
||||
};
|
||||
|
||||
const baseMetadata: object = {
|
||||
description: "",
|
||||
base: "",
|
||||
display: "",
|
||||
};
|
||||
|
||||
export const protobufPackage = "cosmos.bank.v1beta1";
|
||||
|
||||
export const Params = {
|
||||
encode(message: Params, writer: Writer = Writer.create()): Writer {
|
||||
for (const v of message.sendEnabled) {
|
||||
SendEnabled.encode(v!, writer.uint32(10).fork()).ldelim();
|
||||
}
|
||||
writer.uint32(16).bool(message.defaultSendEnabled);
|
||||
return writer;
|
||||
},
|
||||
decode(input: Uint8Array | Reader, length?: number): Params {
|
||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = { ...baseParams } as Params;
|
||||
message.sendEnabled = [];
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.sendEnabled.push(SendEnabled.decode(reader, reader.uint32()));
|
||||
break;
|
||||
case 2:
|
||||
message.defaultSendEnabled = reader.bool();
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
fromJSON(object: any): Params {
|
||||
const message = { ...baseParams } as Params;
|
||||
message.sendEnabled = [];
|
||||
if (object.sendEnabled !== undefined && object.sendEnabled !== null) {
|
||||
for (const e of object.sendEnabled) {
|
||||
message.sendEnabled.push(SendEnabled.fromJSON(e));
|
||||
}
|
||||
}
|
||||
if (object.defaultSendEnabled !== undefined && object.defaultSendEnabled !== null) {
|
||||
message.defaultSendEnabled = Boolean(object.defaultSendEnabled);
|
||||
} else {
|
||||
message.defaultSendEnabled = false;
|
||||
}
|
||||
return message;
|
||||
},
|
||||
fromPartial(object: DeepPartial<Params>): Params {
|
||||
const message = { ...baseParams } as Params;
|
||||
message.sendEnabled = [];
|
||||
if (object.sendEnabled !== undefined && object.sendEnabled !== null) {
|
||||
for (const e of object.sendEnabled) {
|
||||
message.sendEnabled.push(SendEnabled.fromPartial(e));
|
||||
}
|
||||
}
|
||||
if (object.defaultSendEnabled !== undefined && object.defaultSendEnabled !== null) {
|
||||
message.defaultSendEnabled = object.defaultSendEnabled;
|
||||
} else {
|
||||
message.defaultSendEnabled = false;
|
||||
}
|
||||
return message;
|
||||
},
|
||||
toJSON(message: Params): unknown {
|
||||
const obj: any = {};
|
||||
if (message.sendEnabled) {
|
||||
obj.sendEnabled = message.sendEnabled.map((e) => (e ? SendEnabled.toJSON(e) : undefined));
|
||||
} else {
|
||||
obj.sendEnabled = [];
|
||||
}
|
||||
message.defaultSendEnabled !== undefined && (obj.defaultSendEnabled = message.defaultSendEnabled);
|
||||
return obj;
|
||||
},
|
||||
};
|
||||
|
||||
export const SendEnabled = {
|
||||
encode(message: SendEnabled, writer: Writer = Writer.create()): Writer {
|
||||
writer.uint32(10).string(message.denom);
|
||||
writer.uint32(16).bool(message.enabled);
|
||||
return writer;
|
||||
},
|
||||
decode(input: Uint8Array | Reader, length?: number): SendEnabled {
|
||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = { ...baseSendEnabled } as SendEnabled;
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.denom = reader.string();
|
||||
break;
|
||||
case 2:
|
||||
message.enabled = reader.bool();
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
fromJSON(object: any): SendEnabled {
|
||||
const message = { ...baseSendEnabled } as SendEnabled;
|
||||
if (object.denom !== undefined && object.denom !== null) {
|
||||
message.denom = String(object.denom);
|
||||
} else {
|
||||
message.denom = "";
|
||||
}
|
||||
if (object.enabled !== undefined && object.enabled !== null) {
|
||||
message.enabled = Boolean(object.enabled);
|
||||
} else {
|
||||
message.enabled = false;
|
||||
}
|
||||
return message;
|
||||
},
|
||||
fromPartial(object: DeepPartial<SendEnabled>): SendEnabled {
|
||||
const message = { ...baseSendEnabled } as SendEnabled;
|
||||
if (object.denom !== undefined && object.denom !== null) {
|
||||
message.denom = object.denom;
|
||||
} else {
|
||||
message.denom = "";
|
||||
}
|
||||
if (object.enabled !== undefined && object.enabled !== null) {
|
||||
message.enabled = object.enabled;
|
||||
} else {
|
||||
message.enabled = false;
|
||||
}
|
||||
return message;
|
||||
},
|
||||
toJSON(message: SendEnabled): unknown {
|
||||
const obj: any = {};
|
||||
message.denom !== undefined && (obj.denom = message.denom);
|
||||
message.enabled !== undefined && (obj.enabled = message.enabled);
|
||||
return obj;
|
||||
},
|
||||
};
|
||||
|
||||
export const Input = {
|
||||
encode(message: Input, writer: Writer = Writer.create()): Writer {
|
||||
writer.uint32(10).string(message.address);
|
||||
for (const v of message.coins) {
|
||||
Coin.encode(v!, writer.uint32(18).fork()).ldelim();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
decode(input: Uint8Array | Reader, length?: number): Input {
|
||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = { ...baseInput } as Input;
|
||||
message.coins = [];
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.address = reader.string();
|
||||
break;
|
||||
case 2:
|
||||
message.coins.push(Coin.decode(reader, reader.uint32()));
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
fromJSON(object: any): Input {
|
||||
const message = { ...baseInput } as Input;
|
||||
message.coins = [];
|
||||
if (object.address !== undefined && object.address !== null) {
|
||||
message.address = String(object.address);
|
||||
} else {
|
||||
message.address = "";
|
||||
}
|
||||
if (object.coins !== undefined && object.coins !== null) {
|
||||
for (const e of object.coins) {
|
||||
message.coins.push(Coin.fromJSON(e));
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
fromPartial(object: DeepPartial<Input>): Input {
|
||||
const message = { ...baseInput } as Input;
|
||||
message.coins = [];
|
||||
if (object.address !== undefined && object.address !== null) {
|
||||
message.address = object.address;
|
||||
} else {
|
||||
message.address = "";
|
||||
}
|
||||
if (object.coins !== undefined && object.coins !== null) {
|
||||
for (const e of object.coins) {
|
||||
message.coins.push(Coin.fromPartial(e));
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
toJSON(message: Input): unknown {
|
||||
const obj: any = {};
|
||||
message.address !== undefined && (obj.address = message.address);
|
||||
if (message.coins) {
|
||||
obj.coins = message.coins.map((e) => (e ? Coin.toJSON(e) : undefined));
|
||||
} else {
|
||||
obj.coins = [];
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
};
|
||||
|
||||
export const Output = {
|
||||
encode(message: Output, writer: Writer = Writer.create()): Writer {
|
||||
writer.uint32(10).string(message.address);
|
||||
for (const v of message.coins) {
|
||||
Coin.encode(v!, writer.uint32(18).fork()).ldelim();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
decode(input: Uint8Array | Reader, length?: number): Output {
|
||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = { ...baseOutput } as Output;
|
||||
message.coins = [];
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.address = reader.string();
|
||||
break;
|
||||
case 2:
|
||||
message.coins.push(Coin.decode(reader, reader.uint32()));
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
fromJSON(object: any): Output {
|
||||
const message = { ...baseOutput } as Output;
|
||||
message.coins = [];
|
||||
if (object.address !== undefined && object.address !== null) {
|
||||
message.address = String(object.address);
|
||||
} else {
|
||||
message.address = "";
|
||||
}
|
||||
if (object.coins !== undefined && object.coins !== null) {
|
||||
for (const e of object.coins) {
|
||||
message.coins.push(Coin.fromJSON(e));
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
fromPartial(object: DeepPartial<Output>): Output {
|
||||
const message = { ...baseOutput } as Output;
|
||||
message.coins = [];
|
||||
if (object.address !== undefined && object.address !== null) {
|
||||
message.address = object.address;
|
||||
} else {
|
||||
message.address = "";
|
||||
}
|
||||
if (object.coins !== undefined && object.coins !== null) {
|
||||
for (const e of object.coins) {
|
||||
message.coins.push(Coin.fromPartial(e));
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
toJSON(message: Output): unknown {
|
||||
const obj: any = {};
|
||||
message.address !== undefined && (obj.address = message.address);
|
||||
if (message.coins) {
|
||||
obj.coins = message.coins.map((e) => (e ? Coin.toJSON(e) : undefined));
|
||||
} else {
|
||||
obj.coins = [];
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
};
|
||||
|
||||
export const Supply = {
|
||||
encode(message: Supply, writer: Writer = Writer.create()): Writer {
|
||||
for (const v of message.total) {
|
||||
Coin.encode(v!, writer.uint32(10).fork()).ldelim();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
decode(input: Uint8Array | Reader, length?: number): Supply {
|
||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = { ...baseSupply } as Supply;
|
||||
message.total = [];
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.total.push(Coin.decode(reader, reader.uint32()));
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
fromJSON(object: any): Supply {
|
||||
const message = { ...baseSupply } as Supply;
|
||||
message.total = [];
|
||||
if (object.total !== undefined && object.total !== null) {
|
||||
for (const e of object.total) {
|
||||
message.total.push(Coin.fromJSON(e));
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
fromPartial(object: DeepPartial<Supply>): Supply {
|
||||
const message = { ...baseSupply } as Supply;
|
||||
message.total = [];
|
||||
if (object.total !== undefined && object.total !== null) {
|
||||
for (const e of object.total) {
|
||||
message.total.push(Coin.fromPartial(e));
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
toJSON(message: Supply): unknown {
|
||||
const obj: any = {};
|
||||
if (message.total) {
|
||||
obj.total = message.total.map((e) => (e ? Coin.toJSON(e) : undefined));
|
||||
} else {
|
||||
obj.total = [];
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
};
|
||||
|
||||
export const DenomUnit = {
|
||||
encode(message: DenomUnit, writer: Writer = Writer.create()): Writer {
|
||||
writer.uint32(10).string(message.denom);
|
||||
writer.uint32(16).uint32(message.exponent);
|
||||
for (const v of message.aliases) {
|
||||
writer.uint32(26).string(v!);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
decode(input: Uint8Array | Reader, length?: number): DenomUnit {
|
||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = { ...baseDenomUnit } as DenomUnit;
|
||||
message.aliases = [];
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.denom = reader.string();
|
||||
break;
|
||||
case 2:
|
||||
message.exponent = reader.uint32();
|
||||
break;
|
||||
case 3:
|
||||
message.aliases.push(reader.string());
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
fromJSON(object: any): DenomUnit {
|
||||
const message = { ...baseDenomUnit } as DenomUnit;
|
||||
message.aliases = [];
|
||||
if (object.denom !== undefined && object.denom !== null) {
|
||||
message.denom = String(object.denom);
|
||||
} else {
|
||||
message.denom = "";
|
||||
}
|
||||
if (object.exponent !== undefined && object.exponent !== null) {
|
||||
message.exponent = Number(object.exponent);
|
||||
} else {
|
||||
message.exponent = 0;
|
||||
}
|
||||
if (object.aliases !== undefined && object.aliases !== null) {
|
||||
for (const e of object.aliases) {
|
||||
message.aliases.push(String(e));
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
fromPartial(object: DeepPartial<DenomUnit>): DenomUnit {
|
||||
const message = { ...baseDenomUnit } as DenomUnit;
|
||||
message.aliases = [];
|
||||
if (object.denom !== undefined && object.denom !== null) {
|
||||
message.denom = object.denom;
|
||||
} else {
|
||||
message.denom = "";
|
||||
}
|
||||
if (object.exponent !== undefined && object.exponent !== null) {
|
||||
message.exponent = object.exponent;
|
||||
} else {
|
||||
message.exponent = 0;
|
||||
}
|
||||
if (object.aliases !== undefined && object.aliases !== null) {
|
||||
for (const e of object.aliases) {
|
||||
message.aliases.push(e);
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
toJSON(message: DenomUnit): unknown {
|
||||
const obj: any = {};
|
||||
message.denom !== undefined && (obj.denom = message.denom);
|
||||
message.exponent !== undefined && (obj.exponent = message.exponent);
|
||||
if (message.aliases) {
|
||||
obj.aliases = message.aliases.map((e) => e);
|
||||
} else {
|
||||
obj.aliases = [];
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
};
|
||||
|
||||
export const Metadata = {
|
||||
encode(message: Metadata, writer: Writer = Writer.create()): Writer {
|
||||
writer.uint32(10).string(message.description);
|
||||
for (const v of message.denomUnits) {
|
||||
DenomUnit.encode(v!, writer.uint32(18).fork()).ldelim();
|
||||
}
|
||||
writer.uint32(26).string(message.base);
|
||||
writer.uint32(34).string(message.display);
|
||||
return writer;
|
||||
},
|
||||
decode(input: Uint8Array | Reader, length?: number): Metadata {
|
||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = { ...baseMetadata } as Metadata;
|
||||
message.denomUnits = [];
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.description = reader.string();
|
||||
break;
|
||||
case 2:
|
||||
message.denomUnits.push(DenomUnit.decode(reader, reader.uint32()));
|
||||
break;
|
||||
case 3:
|
||||
message.base = reader.string();
|
||||
break;
|
||||
case 4:
|
||||
message.display = reader.string();
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
fromJSON(object: any): Metadata {
|
||||
const message = { ...baseMetadata } as Metadata;
|
||||
message.denomUnits = [];
|
||||
if (object.description !== undefined && object.description !== null) {
|
||||
message.description = String(object.description);
|
||||
} else {
|
||||
message.description = "";
|
||||
}
|
||||
if (object.denomUnits !== undefined && object.denomUnits !== null) {
|
||||
for (const e of object.denomUnits) {
|
||||
message.denomUnits.push(DenomUnit.fromJSON(e));
|
||||
}
|
||||
}
|
||||
if (object.base !== undefined && object.base !== null) {
|
||||
message.base = String(object.base);
|
||||
} else {
|
||||
message.base = "";
|
||||
}
|
||||
if (object.display !== undefined && object.display !== null) {
|
||||
message.display = String(object.display);
|
||||
} else {
|
||||
message.display = "";
|
||||
}
|
||||
return message;
|
||||
},
|
||||
fromPartial(object: DeepPartial<Metadata>): Metadata {
|
||||
const message = { ...baseMetadata } as Metadata;
|
||||
message.denomUnits = [];
|
||||
if (object.description !== undefined && object.description !== null) {
|
||||
message.description = object.description;
|
||||
} else {
|
||||
message.description = "";
|
||||
}
|
||||
if (object.denomUnits !== undefined && object.denomUnits !== null) {
|
||||
for (const e of object.denomUnits) {
|
||||
message.denomUnits.push(DenomUnit.fromPartial(e));
|
||||
}
|
||||
}
|
||||
if (object.base !== undefined && object.base !== null) {
|
||||
message.base = object.base;
|
||||
} else {
|
||||
message.base = "";
|
||||
}
|
||||
if (object.display !== undefined && object.display !== null) {
|
||||
message.display = object.display;
|
||||
} else {
|
||||
message.display = "";
|
||||
}
|
||||
return message;
|
||||
},
|
||||
toJSON(message: Metadata): unknown {
|
||||
const obj: any = {};
|
||||
message.description !== undefined && (obj.description = message.description);
|
||||
if (message.denomUnits) {
|
||||
obj.denomUnits = message.denomUnits.map((e) => (e ? DenomUnit.toJSON(e) : undefined));
|
||||
} else {
|
||||
obj.denomUnits = [];
|
||||
}
|
||||
message.base !== undefined && (obj.base = message.base);
|
||||
message.display !== undefined && (obj.display = message.display);
|
||||
return obj;
|
||||
},
|
||||
};
|
||||
|
||||
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>;
|
||||
324
packages/proto-signing/src/codec/cosmos/bank/v1beta1/tx.ts
Normal file
324
packages/proto-signing/src/codec/cosmos/bank/v1beta1/tx.ts
Normal file
@ -0,0 +1,324 @@
|
||||
/* eslint-disable */
|
||||
import { Coin } from "../../../cosmos/base/v1beta1/coin";
|
||||
import { Input, Output } from "../../../cosmos/bank/v1beta1/bank";
|
||||
import { Reader, Writer } from "protobufjs/minimal";
|
||||
|
||||
/**
|
||||
* MsgSend represents a message to send coins from one account to another.
|
||||
*/
|
||||
export interface MsgSend {
|
||||
fromAddress: string;
|
||||
toAddress: string;
|
||||
amount: Coin[];
|
||||
}
|
||||
|
||||
/**
|
||||
* MsgSendResponse defines the Msg/Send response type.
|
||||
*/
|
||||
export interface MsgSendResponse {}
|
||||
|
||||
/**
|
||||
* MsgMultiSend represents an arbitrary multi-in, multi-out send message.
|
||||
*/
|
||||
export interface MsgMultiSend {
|
||||
inputs: Input[];
|
||||
outputs: Output[];
|
||||
}
|
||||
|
||||
/**
|
||||
* MsgMultiSendResponse defines the Msg/MultiSend response type.
|
||||
*/
|
||||
export interface MsgMultiSendResponse {}
|
||||
|
||||
const baseMsgSend: object = {
|
||||
fromAddress: "",
|
||||
toAddress: "",
|
||||
};
|
||||
|
||||
const baseMsgSendResponse: object = {};
|
||||
|
||||
const baseMsgMultiSend: object = {};
|
||||
|
||||
const baseMsgMultiSendResponse: object = {};
|
||||
|
||||
/**
|
||||
* Msg defines the bank Msg service.
|
||||
*/
|
||||
export interface Msg {
|
||||
/**
|
||||
* Send defines a method for sending coins from one account to another account.
|
||||
*/
|
||||
Send(request: MsgSend): Promise<MsgSendResponse>;
|
||||
|
||||
/**
|
||||
* MultiSend defines a method for sending coins from some accounts to other accounts.
|
||||
*/
|
||||
MultiSend(request: MsgMultiSend): Promise<MsgMultiSendResponse>;
|
||||
}
|
||||
|
||||
export class MsgClientImpl implements Msg {
|
||||
private readonly rpc: Rpc;
|
||||
|
||||
constructor(rpc: Rpc) {
|
||||
this.rpc = rpc;
|
||||
}
|
||||
|
||||
Send(request: MsgSend): Promise<MsgSendResponse> {
|
||||
const data = MsgSend.encode(request).finish();
|
||||
const promise = this.rpc.request("cosmos.bank.v1beta1.Msg", "Send", data);
|
||||
return promise.then((data) => MsgSendResponse.decode(new Reader(data)));
|
||||
}
|
||||
|
||||
MultiSend(request: MsgMultiSend): Promise<MsgMultiSendResponse> {
|
||||
const data = MsgMultiSend.encode(request).finish();
|
||||
const promise = this.rpc.request("cosmos.bank.v1beta1.Msg", "MultiSend", data);
|
||||
return promise.then((data) => MsgMultiSendResponse.decode(new Reader(data)));
|
||||
}
|
||||
}
|
||||
|
||||
interface Rpc {
|
||||
request(service: string, method: string, data: Uint8Array): Promise<Uint8Array>;
|
||||
}
|
||||
|
||||
export const protobufPackage = "cosmos.bank.v1beta1";
|
||||
|
||||
export const MsgSend = {
|
||||
encode(message: MsgSend, writer: Writer = Writer.create()): Writer {
|
||||
writer.uint32(10).string(message.fromAddress);
|
||||
writer.uint32(18).string(message.toAddress);
|
||||
for (const v of message.amount) {
|
||||
Coin.encode(v!, writer.uint32(26).fork()).ldelim();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
decode(input: Uint8Array | Reader, length?: number): MsgSend {
|
||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = { ...baseMsgSend } as MsgSend;
|
||||
message.amount = [];
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.fromAddress = reader.string();
|
||||
break;
|
||||
case 2:
|
||||
message.toAddress = reader.string();
|
||||
break;
|
||||
case 3:
|
||||
message.amount.push(Coin.decode(reader, reader.uint32()));
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
fromJSON(object: any): MsgSend {
|
||||
const message = { ...baseMsgSend } as MsgSend;
|
||||
message.amount = [];
|
||||
if (object.fromAddress !== undefined && object.fromAddress !== null) {
|
||||
message.fromAddress = String(object.fromAddress);
|
||||
} else {
|
||||
message.fromAddress = "";
|
||||
}
|
||||
if (object.toAddress !== undefined && object.toAddress !== null) {
|
||||
message.toAddress = String(object.toAddress);
|
||||
} else {
|
||||
message.toAddress = "";
|
||||
}
|
||||
if (object.amount !== undefined && object.amount !== null) {
|
||||
for (const e of object.amount) {
|
||||
message.amount.push(Coin.fromJSON(e));
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
fromPartial(object: DeepPartial<MsgSend>): MsgSend {
|
||||
const message = { ...baseMsgSend } as MsgSend;
|
||||
message.amount = [];
|
||||
if (object.fromAddress !== undefined && object.fromAddress !== null) {
|
||||
message.fromAddress = object.fromAddress;
|
||||
} else {
|
||||
message.fromAddress = "";
|
||||
}
|
||||
if (object.toAddress !== undefined && object.toAddress !== null) {
|
||||
message.toAddress = object.toAddress;
|
||||
} else {
|
||||
message.toAddress = "";
|
||||
}
|
||||
if (object.amount !== undefined && object.amount !== null) {
|
||||
for (const e of object.amount) {
|
||||
message.amount.push(Coin.fromPartial(e));
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
toJSON(message: MsgSend): unknown {
|
||||
const obj: any = {};
|
||||
message.fromAddress !== undefined && (obj.fromAddress = message.fromAddress);
|
||||
message.toAddress !== undefined && (obj.toAddress = message.toAddress);
|
||||
if (message.amount) {
|
||||
obj.amount = message.amount.map((e) => (e ? Coin.toJSON(e) : undefined));
|
||||
} else {
|
||||
obj.amount = [];
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
};
|
||||
|
||||
export const MsgSendResponse = {
|
||||
encode(_: MsgSendResponse, writer: Writer = Writer.create()): Writer {
|
||||
return writer;
|
||||
},
|
||||
decode(input: Uint8Array | Reader, length?: number): MsgSendResponse {
|
||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = { ...baseMsgSendResponse } as MsgSendResponse;
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
fromJSON(_: any): MsgSendResponse {
|
||||
const message = { ...baseMsgSendResponse } as MsgSendResponse;
|
||||
return message;
|
||||
},
|
||||
fromPartial(_: DeepPartial<MsgSendResponse>): MsgSendResponse {
|
||||
const message = { ...baseMsgSendResponse } as MsgSendResponse;
|
||||
return message;
|
||||
},
|
||||
toJSON(_: MsgSendResponse): unknown {
|
||||
const obj: any = {};
|
||||
return obj;
|
||||
},
|
||||
};
|
||||
|
||||
export const MsgMultiSend = {
|
||||
encode(message: MsgMultiSend, writer: Writer = Writer.create()): Writer {
|
||||
for (const v of message.inputs) {
|
||||
Input.encode(v!, writer.uint32(10).fork()).ldelim();
|
||||
}
|
||||
for (const v of message.outputs) {
|
||||
Output.encode(v!, writer.uint32(18).fork()).ldelim();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
decode(input: Uint8Array | Reader, length?: number): MsgMultiSend {
|
||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = { ...baseMsgMultiSend } as MsgMultiSend;
|
||||
message.inputs = [];
|
||||
message.outputs = [];
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.inputs.push(Input.decode(reader, reader.uint32()));
|
||||
break;
|
||||
case 2:
|
||||
message.outputs.push(Output.decode(reader, reader.uint32()));
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
fromJSON(object: any): MsgMultiSend {
|
||||
const message = { ...baseMsgMultiSend } as MsgMultiSend;
|
||||
message.inputs = [];
|
||||
message.outputs = [];
|
||||
if (object.inputs !== undefined && object.inputs !== null) {
|
||||
for (const e of object.inputs) {
|
||||
message.inputs.push(Input.fromJSON(e));
|
||||
}
|
||||
}
|
||||
if (object.outputs !== undefined && object.outputs !== null) {
|
||||
for (const e of object.outputs) {
|
||||
message.outputs.push(Output.fromJSON(e));
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
fromPartial(object: DeepPartial<MsgMultiSend>): MsgMultiSend {
|
||||
const message = { ...baseMsgMultiSend } as MsgMultiSend;
|
||||
message.inputs = [];
|
||||
message.outputs = [];
|
||||
if (object.inputs !== undefined && object.inputs !== null) {
|
||||
for (const e of object.inputs) {
|
||||
message.inputs.push(Input.fromPartial(e));
|
||||
}
|
||||
}
|
||||
if (object.outputs !== undefined && object.outputs !== null) {
|
||||
for (const e of object.outputs) {
|
||||
message.outputs.push(Output.fromPartial(e));
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
toJSON(message: MsgMultiSend): unknown {
|
||||
const obj: any = {};
|
||||
if (message.inputs) {
|
||||
obj.inputs = message.inputs.map((e) => (e ? Input.toJSON(e) : undefined));
|
||||
} else {
|
||||
obj.inputs = [];
|
||||
}
|
||||
if (message.outputs) {
|
||||
obj.outputs = message.outputs.map((e) => (e ? Output.toJSON(e) : undefined));
|
||||
} else {
|
||||
obj.outputs = [];
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
};
|
||||
|
||||
export const MsgMultiSendResponse = {
|
||||
encode(_: MsgMultiSendResponse, writer: Writer = Writer.create()): Writer {
|
||||
return writer;
|
||||
},
|
||||
decode(input: Uint8Array | Reader, length?: number): MsgMultiSendResponse {
|
||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = { ...baseMsgMultiSendResponse } as MsgMultiSendResponse;
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
fromJSON(_: any): MsgMultiSendResponse {
|
||||
const message = { ...baseMsgMultiSendResponse } as MsgMultiSendResponse;
|
||||
return message;
|
||||
},
|
||||
fromPartial(_: DeepPartial<MsgMultiSendResponse>): MsgMultiSendResponse {
|
||||
const message = { ...baseMsgMultiSendResponse } as MsgMultiSendResponse;
|
||||
return message;
|
||||
},
|
||||
toJSON(_: MsgMultiSendResponse): unknown {
|
||||
const obj: any = {};
|
||||
return obj;
|
||||
},
|
||||
};
|
||||
|
||||
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>;
|
||||
287
packages/proto-signing/src/codec/cosmos/base/v1beta1/coin.ts
Normal file
287
packages/proto-signing/src/codec/cosmos/base/v1beta1/coin.ts
Normal file
@ -0,0 +1,287 @@
|
||||
/* eslint-disable */
|
||||
import { Writer, Reader } from "protobufjs/minimal";
|
||||
|
||||
/**
|
||||
* 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: "",
|
||||
};
|
||||
|
||||
const baseDecCoin: object = {
|
||||
denom: "",
|
||||
amount: "",
|
||||
};
|
||||
|
||||
const baseIntProto: object = {
|
||||
int: "",
|
||||
};
|
||||
|
||||
const baseDecProto: object = {
|
||||
dec: "",
|
||||
};
|
||||
|
||||
export const protobufPackage = "cosmos.base.v1beta1";
|
||||
|
||||
export const Coin = {
|
||||
encode(message: Coin, writer: Writer = Writer.create()): Writer {
|
||||
writer.uint32(10).string(message.denom);
|
||||
writer.uint32(18).string(message.amount);
|
||||
return writer;
|
||||
},
|
||||
decode(input: Uint8Array | Reader, 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;
|
||||
},
|
||||
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;
|
||||
},
|
||||
toJSON(message: Coin): unknown {
|
||||
const obj: any = {};
|
||||
message.denom !== undefined && (obj.denom = message.denom);
|
||||
message.amount !== undefined && (obj.amount = message.amount);
|
||||
return obj;
|
||||
},
|
||||
};
|
||||
|
||||
export const DecCoin = {
|
||||
encode(message: DecCoin, writer: Writer = Writer.create()): Writer {
|
||||
writer.uint32(10).string(message.denom);
|
||||
writer.uint32(18).string(message.amount);
|
||||
return writer;
|
||||
},
|
||||
decode(input: Uint8Array | Reader, 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;
|
||||
},
|
||||
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;
|
||||
},
|
||||
toJSON(message: DecCoin): unknown {
|
||||
const obj: any = {};
|
||||
message.denom !== undefined && (obj.denom = message.denom);
|
||||
message.amount !== undefined && (obj.amount = message.amount);
|
||||
return obj;
|
||||
},
|
||||
};
|
||||
|
||||
export const IntProto = {
|
||||
encode(message: IntProto, writer: Writer = Writer.create()): Writer {
|
||||
writer.uint32(10).string(message.int);
|
||||
return writer;
|
||||
},
|
||||
decode(input: Uint8Array | Reader, 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;
|
||||
},
|
||||
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;
|
||||
},
|
||||
toJSON(message: IntProto): unknown {
|
||||
const obj: any = {};
|
||||
message.int !== undefined && (obj.int = message.int);
|
||||
return obj;
|
||||
},
|
||||
};
|
||||
|
||||
export const DecProto = {
|
||||
encode(message: DecProto, writer: Writer = Writer.create()): Writer {
|
||||
writer.uint32(10).string(message.dec);
|
||||
return writer;
|
||||
},
|
||||
decode(input: Uint8Array | Reader, 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;
|
||||
},
|
||||
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;
|
||||
},
|
||||
toJSON(message: DecProto): unknown {
|
||||
const obj: any = {};
|
||||
message.dec !== undefined && (obj.dec = message.dec);
|
||||
return obj;
|
||||
},
|
||||
};
|
||||
|
||||
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>;
|
||||
@ -0,0 +1,183 @@
|
||||
/* eslint-disable */
|
||||
import { Writer, Reader } from "protobufjs/minimal";
|
||||
|
||||
/**
|
||||
* MultiSignature wraps the signatures from a multisig.LegacyAminoPubKey.
|
||||
* See cosmos.tx.v1betata1.ModeInfo.Multi for how to specify which signers
|
||||
* signed and with which modes.
|
||||
*/
|
||||
export interface MultiSignature {
|
||||
signatures: Uint8Array[];
|
||||
}
|
||||
|
||||
/**
|
||||
* CompactBitArray is an implementation of a space efficient bit array.
|
||||
* This is used to ensure that the encoded data takes up a minimal amount of
|
||||
* space after proto encoding.
|
||||
* This is not thread safe, and is not intended for concurrent usage.
|
||||
*/
|
||||
export interface CompactBitArray {
|
||||
extraBitsStored: number;
|
||||
elems: Uint8Array;
|
||||
}
|
||||
|
||||
const baseMultiSignature: object = {};
|
||||
|
||||
const baseCompactBitArray: object = {
|
||||
extraBitsStored: 0,
|
||||
};
|
||||
|
||||
export const protobufPackage = "cosmos.crypto.multisig.v1beta1";
|
||||
|
||||
export const MultiSignature = {
|
||||
encode(message: MultiSignature, writer: Writer = Writer.create()): Writer {
|
||||
for (const v of message.signatures) {
|
||||
writer.uint32(10).bytes(v!);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
decode(input: Uint8Array | Reader, length?: number): MultiSignature {
|
||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = { ...baseMultiSignature } as MultiSignature;
|
||||
message.signatures = [];
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.signatures.push(reader.bytes());
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
fromJSON(object: any): MultiSignature {
|
||||
const message = { ...baseMultiSignature } as MultiSignature;
|
||||
message.signatures = [];
|
||||
if (object.signatures !== undefined && object.signatures !== null) {
|
||||
for (const e of object.signatures) {
|
||||
message.signatures.push(bytesFromBase64(e));
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
fromPartial(object: DeepPartial<MultiSignature>): MultiSignature {
|
||||
const message = { ...baseMultiSignature } as MultiSignature;
|
||||
message.signatures = [];
|
||||
if (object.signatures !== undefined && object.signatures !== null) {
|
||||
for (const e of object.signatures) {
|
||||
message.signatures.push(e);
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
toJSON(message: MultiSignature): unknown {
|
||||
const obj: any = {};
|
||||
if (message.signatures) {
|
||||
obj.signatures = message.signatures.map((e) => base64FromBytes(e !== undefined ? e : new Uint8Array()));
|
||||
} else {
|
||||
obj.signatures = [];
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
};
|
||||
|
||||
export const CompactBitArray = {
|
||||
encode(message: CompactBitArray, writer: Writer = Writer.create()): Writer {
|
||||
writer.uint32(8).uint32(message.extraBitsStored);
|
||||
writer.uint32(18).bytes(message.elems);
|
||||
return writer;
|
||||
},
|
||||
decode(input: Uint8Array | Reader, length?: number): CompactBitArray {
|
||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = { ...baseCompactBitArray } as CompactBitArray;
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.extraBitsStored = reader.uint32();
|
||||
break;
|
||||
case 2:
|
||||
message.elems = reader.bytes();
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
fromJSON(object: any): CompactBitArray {
|
||||
const message = { ...baseCompactBitArray } as CompactBitArray;
|
||||
if (object.extraBitsStored !== undefined && object.extraBitsStored !== null) {
|
||||
message.extraBitsStored = Number(object.extraBitsStored);
|
||||
} else {
|
||||
message.extraBitsStored = 0;
|
||||
}
|
||||
if (object.elems !== undefined && object.elems !== null) {
|
||||
message.elems = bytesFromBase64(object.elems);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
fromPartial(object: DeepPartial<CompactBitArray>): CompactBitArray {
|
||||
const message = { ...baseCompactBitArray } as CompactBitArray;
|
||||
if (object.extraBitsStored !== undefined && object.extraBitsStored !== null) {
|
||||
message.extraBitsStored = object.extraBitsStored;
|
||||
} else {
|
||||
message.extraBitsStored = 0;
|
||||
}
|
||||
if (object.elems !== undefined && object.elems !== null) {
|
||||
message.elems = object.elems;
|
||||
} else {
|
||||
message.elems = new Uint8Array();
|
||||
}
|
||||
return message;
|
||||
},
|
||||
toJSON(message: CompactBitArray): unknown {
|
||||
const obj: any = {};
|
||||
message.extraBitsStored !== undefined && (obj.extraBitsStored = message.extraBitsStored);
|
||||
message.elems !== undefined &&
|
||||
(obj.elems = base64FromBytes(message.elems !== undefined ? message.elems : new Uint8Array()));
|
||||
return obj;
|
||||
},
|
||||
};
|
||||
|
||||
interface WindowBase64 {
|
||||
atob(b64: string): string;
|
||||
btoa(bin: string): string;
|
||||
}
|
||||
|
||||
const windowBase64 = (globalThis as unknown) as WindowBase64;
|
||||
const atob = windowBase64.atob || ((b64: string) => Buffer.from(b64, "base64").toString("binary"));
|
||||
const btoa = windowBase64.btoa || ((bin: string) => Buffer.from(bin, "binary").toString("base64"));
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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>;
|
||||
154
packages/proto-signing/src/codec/cosmos/crypto/secp256k1/keys.ts
Normal file
154
packages/proto-signing/src/codec/cosmos/crypto/secp256k1/keys.ts
Normal file
@ -0,0 +1,154 @@
|
||||
/* eslint-disable */
|
||||
import { Writer, Reader } from "protobufjs/minimal";
|
||||
|
||||
/**
|
||||
* PubKey defines a secp256k1 public key
|
||||
* Key is the compressed form of the pubkey. The first byte depends is a 0x02 byte
|
||||
* if the y-coordinate is the lexicographically largest of the two associated with
|
||||
* the x-coordinate. Otherwise the first byte is a 0x03.
|
||||
* This prefix is followed with the x-coordinate.
|
||||
*/
|
||||
export interface PubKey {
|
||||
key: Uint8Array;
|
||||
}
|
||||
|
||||
/**
|
||||
* PrivKey defines a secp256k1 private key.
|
||||
*/
|
||||
export interface PrivKey {
|
||||
key: Uint8Array;
|
||||
}
|
||||
|
||||
const basePubKey: object = {};
|
||||
|
||||
const basePrivKey: object = {};
|
||||
|
||||
export const protobufPackage = "cosmos.crypto.secp256k1";
|
||||
|
||||
export const PubKey = {
|
||||
encode(message: PubKey, writer: Writer = Writer.create()): Writer {
|
||||
writer.uint32(10).bytes(message.key);
|
||||
return writer;
|
||||
},
|
||||
decode(input: Uint8Array | Reader, length?: number): PubKey {
|
||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = { ...basePubKey } as PubKey;
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.key = reader.bytes();
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
fromJSON(object: any): PubKey {
|
||||
const message = { ...basePubKey } as PubKey;
|
||||
if (object.key !== undefined && object.key !== null) {
|
||||
message.key = bytesFromBase64(object.key);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
fromPartial(object: DeepPartial<PubKey>): PubKey {
|
||||
const message = { ...basePubKey } as PubKey;
|
||||
if (object.key !== undefined && object.key !== null) {
|
||||
message.key = object.key;
|
||||
} else {
|
||||
message.key = new Uint8Array();
|
||||
}
|
||||
return message;
|
||||
},
|
||||
toJSON(message: PubKey): unknown {
|
||||
const obj: any = {};
|
||||
message.key !== undefined &&
|
||||
(obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array()));
|
||||
return obj;
|
||||
},
|
||||
};
|
||||
|
||||
export const PrivKey = {
|
||||
encode(message: PrivKey, writer: Writer = Writer.create()): Writer {
|
||||
writer.uint32(10).bytes(message.key);
|
||||
return writer;
|
||||
},
|
||||
decode(input: Uint8Array | Reader, length?: number): PrivKey {
|
||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = { ...basePrivKey } as PrivKey;
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.key = reader.bytes();
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
fromJSON(object: any): PrivKey {
|
||||
const message = { ...basePrivKey } as PrivKey;
|
||||
if (object.key !== undefined && object.key !== null) {
|
||||
message.key = bytesFromBase64(object.key);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
fromPartial(object: DeepPartial<PrivKey>): PrivKey {
|
||||
const message = { ...basePrivKey } as PrivKey;
|
||||
if (object.key !== undefined && object.key !== null) {
|
||||
message.key = object.key;
|
||||
} else {
|
||||
message.key = new Uint8Array();
|
||||
}
|
||||
return message;
|
||||
},
|
||||
toJSON(message: PrivKey): unknown {
|
||||
const obj: any = {};
|
||||
message.key !== undefined &&
|
||||
(obj.key = base64FromBytes(message.key !== undefined ? message.key : new Uint8Array()));
|
||||
return obj;
|
||||
},
|
||||
};
|
||||
|
||||
interface WindowBase64 {
|
||||
atob(b64: string): string;
|
||||
btoa(bin: string): string;
|
||||
}
|
||||
|
||||
const windowBase64 = (globalThis as unknown) as WindowBase64;
|
||||
const atob = windowBase64.atob || ((b64: string) => Buffer.from(b64, "base64").toString("binary"));
|
||||
const btoa = windowBase64.btoa || ((bin: string) => Buffer.from(bin, "binary").toString("base64"));
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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>;
|
||||
@ -0,0 +1,532 @@
|
||||
/* eslint-disable */
|
||||
import { Any } from "../../../../google/protobuf/any";
|
||||
import * as Long from "long";
|
||||
import { CompactBitArray } from "../../../../cosmos/crypto/multisig/v1beta1/multisig";
|
||||
import { Writer, Reader } from "protobufjs/minimal";
|
||||
|
||||
/**
|
||||
* SignatureDescriptors wraps multiple SignatureDescriptor's.
|
||||
*/
|
||||
export interface SignatureDescriptors {
|
||||
/**
|
||||
* signatures are the signature descriptors
|
||||
*/
|
||||
signatures: SignatureDescriptor[];
|
||||
}
|
||||
|
||||
/**
|
||||
* SignatureDescriptor is a convenience type which represents the full data for
|
||||
* a signature including the public key of the signer, signing modes and the
|
||||
* signature itself. It is primarily used for coordinating signatures between
|
||||
* clients.
|
||||
*/
|
||||
export interface SignatureDescriptor {
|
||||
/**
|
||||
* public_key is the public key of the signer
|
||||
*/
|
||||
publicKey?: Any;
|
||||
data?: SignatureDescriptor_Data;
|
||||
/**
|
||||
* sequence is the sequence of the account, which describes the
|
||||
* number of committed transactions signed by a given address. It is used to prevent
|
||||
* replay attacks.
|
||||
*/
|
||||
sequence: Long;
|
||||
}
|
||||
|
||||
/**
|
||||
* Data represents signature data
|
||||
*/
|
||||
export interface SignatureDescriptor_Data {
|
||||
/**
|
||||
* single represents a single signer
|
||||
*/
|
||||
single?: SignatureDescriptor_Data_Single | undefined;
|
||||
/**
|
||||
* multi represents a multisig signer
|
||||
*/
|
||||
multi?: SignatureDescriptor_Data_Multi | undefined;
|
||||
}
|
||||
|
||||
/**
|
||||
* Single is the signature data for a single signer
|
||||
*/
|
||||
export interface SignatureDescriptor_Data_Single {
|
||||
/**
|
||||
* mode is the signing mode of the single signer
|
||||
*/
|
||||
mode: SignMode;
|
||||
/**
|
||||
* signature is the raw signature bytes
|
||||
*/
|
||||
signature: Uint8Array;
|
||||
}
|
||||
|
||||
/**
|
||||
* Multi is the signature data for a multisig public key
|
||||
*/
|
||||
export interface SignatureDescriptor_Data_Multi {
|
||||
/**
|
||||
* bitarray specifies which keys within the multisig are signing
|
||||
*/
|
||||
bitarray?: CompactBitArray;
|
||||
/**
|
||||
* signatures is the signatures of the multi-signature
|
||||
*/
|
||||
signatures: SignatureDescriptor_Data[];
|
||||
}
|
||||
|
||||
const baseSignatureDescriptors: object = {};
|
||||
|
||||
const baseSignatureDescriptor: object = {
|
||||
sequence: Long.UZERO,
|
||||
};
|
||||
|
||||
const baseSignatureDescriptor_Data: object = {};
|
||||
|
||||
const baseSignatureDescriptor_Data_Single: object = {
|
||||
mode: 0,
|
||||
};
|
||||
|
||||
const baseSignatureDescriptor_Data_Multi: object = {};
|
||||
|
||||
export const protobufPackage = "cosmos.tx.signing.v1beta1";
|
||||
|
||||
/** SignMode represents a signing mode with its own security guarantees.
|
||||
*/
|
||||
export enum SignMode {
|
||||
/** SIGN_MODE_UNSPECIFIED - SIGN_MODE_UNSPECIFIED specifies an unknown signing mode and will be
|
||||
rejected
|
||||
*/
|
||||
SIGN_MODE_UNSPECIFIED = 0,
|
||||
/** SIGN_MODE_DIRECT - SIGN_MODE_DIRECT specifies a signing mode which uses SignDoc and is
|
||||
verified with raw bytes from Tx
|
||||
*/
|
||||
SIGN_MODE_DIRECT = 1,
|
||||
/** SIGN_MODE_TEXTUAL - SIGN_MODE_TEXTUAL is a future signing mode that will verify some
|
||||
human-readable textual representation on top of the binary representation
|
||||
from SIGN_MODE_DIRECT
|
||||
*/
|
||||
SIGN_MODE_TEXTUAL = 2,
|
||||
/** 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_LEGACY_AMINO_JSON = 127,
|
||||
UNRECOGNIZED = -1,
|
||||
}
|
||||
|
||||
export function signModeFromJSON(object: any): SignMode {
|
||||
switch (object) {
|
||||
case 0:
|
||||
case "SIGN_MODE_UNSPECIFIED":
|
||||
return SignMode.SIGN_MODE_UNSPECIFIED;
|
||||
case 1:
|
||||
case "SIGN_MODE_DIRECT":
|
||||
return SignMode.SIGN_MODE_DIRECT;
|
||||
case 2:
|
||||
case "SIGN_MODE_TEXTUAL":
|
||||
return SignMode.SIGN_MODE_TEXTUAL;
|
||||
case 127:
|
||||
case "SIGN_MODE_LEGACY_AMINO_JSON":
|
||||
return SignMode.SIGN_MODE_LEGACY_AMINO_JSON;
|
||||
case -1:
|
||||
case "UNRECOGNIZED":
|
||||
default:
|
||||
return SignMode.UNRECOGNIZED;
|
||||
}
|
||||
}
|
||||
|
||||
export function signModeToJSON(object: SignMode): string {
|
||||
switch (object) {
|
||||
case SignMode.SIGN_MODE_UNSPECIFIED:
|
||||
return "SIGN_MODE_UNSPECIFIED";
|
||||
case SignMode.SIGN_MODE_DIRECT:
|
||||
return "SIGN_MODE_DIRECT";
|
||||
case SignMode.SIGN_MODE_TEXTUAL:
|
||||
return "SIGN_MODE_TEXTUAL";
|
||||
case SignMode.SIGN_MODE_LEGACY_AMINO_JSON:
|
||||
return "SIGN_MODE_LEGACY_AMINO_JSON";
|
||||
default:
|
||||
return "UNKNOWN";
|
||||
}
|
||||
}
|
||||
|
||||
export const SignatureDescriptors = {
|
||||
encode(message: SignatureDescriptors, writer: Writer = Writer.create()): Writer {
|
||||
for (const v of message.signatures) {
|
||||
SignatureDescriptor.encode(v!, writer.uint32(10).fork()).ldelim();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
decode(input: Uint8Array | Reader, length?: number): SignatureDescriptors {
|
||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = { ...baseSignatureDescriptors } as SignatureDescriptors;
|
||||
message.signatures = [];
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.signatures.push(SignatureDescriptor.decode(reader, reader.uint32()));
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
fromJSON(object: any): SignatureDescriptors {
|
||||
const message = { ...baseSignatureDescriptors } as SignatureDescriptors;
|
||||
message.signatures = [];
|
||||
if (object.signatures !== undefined && object.signatures !== null) {
|
||||
for (const e of object.signatures) {
|
||||
message.signatures.push(SignatureDescriptor.fromJSON(e));
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
fromPartial(object: DeepPartial<SignatureDescriptors>): SignatureDescriptors {
|
||||
const message = { ...baseSignatureDescriptors } as SignatureDescriptors;
|
||||
message.signatures = [];
|
||||
if (object.signatures !== undefined && object.signatures !== null) {
|
||||
for (const e of object.signatures) {
|
||||
message.signatures.push(SignatureDescriptor.fromPartial(e));
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
toJSON(message: SignatureDescriptors): unknown {
|
||||
const obj: any = {};
|
||||
if (message.signatures) {
|
||||
obj.signatures = message.signatures.map((e) => (e ? SignatureDescriptor.toJSON(e) : undefined));
|
||||
} else {
|
||||
obj.signatures = [];
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
};
|
||||
|
||||
export const SignatureDescriptor = {
|
||||
encode(message: SignatureDescriptor, writer: Writer = Writer.create()): Writer {
|
||||
if (message.publicKey !== undefined && message.publicKey !== undefined) {
|
||||
Any.encode(message.publicKey, writer.uint32(10).fork()).ldelim();
|
||||
}
|
||||
if (message.data !== undefined && message.data !== undefined) {
|
||||
SignatureDescriptor_Data.encode(message.data, writer.uint32(18).fork()).ldelim();
|
||||
}
|
||||
writer.uint32(24).uint64(message.sequence);
|
||||
return writer;
|
||||
},
|
||||
decode(input: Uint8Array | Reader, length?: number): SignatureDescriptor {
|
||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = { ...baseSignatureDescriptor } as SignatureDescriptor;
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.publicKey = Any.decode(reader, reader.uint32());
|
||||
break;
|
||||
case 2:
|
||||
message.data = SignatureDescriptor_Data.decode(reader, reader.uint32());
|
||||
break;
|
||||
case 3:
|
||||
message.sequence = reader.uint64() as Long;
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
fromJSON(object: any): SignatureDescriptor {
|
||||
const message = { ...baseSignatureDescriptor } as SignatureDescriptor;
|
||||
if (object.publicKey !== undefined && object.publicKey !== null) {
|
||||
message.publicKey = Any.fromJSON(object.publicKey);
|
||||
} else {
|
||||
message.publicKey = undefined;
|
||||
}
|
||||
if (object.data !== undefined && object.data !== null) {
|
||||
message.data = SignatureDescriptor_Data.fromJSON(object.data);
|
||||
} else {
|
||||
message.data = undefined;
|
||||
}
|
||||
if (object.sequence !== undefined && object.sequence !== null) {
|
||||
message.sequence = Long.fromString(object.sequence);
|
||||
} else {
|
||||
message.sequence = Long.UZERO;
|
||||
}
|
||||
return message;
|
||||
},
|
||||
fromPartial(object: DeepPartial<SignatureDescriptor>): SignatureDescriptor {
|
||||
const message = { ...baseSignatureDescriptor } as SignatureDescriptor;
|
||||
if (object.publicKey !== undefined && object.publicKey !== null) {
|
||||
message.publicKey = Any.fromPartial(object.publicKey);
|
||||
} else {
|
||||
message.publicKey = undefined;
|
||||
}
|
||||
if (object.data !== undefined && object.data !== null) {
|
||||
message.data = SignatureDescriptor_Data.fromPartial(object.data);
|
||||
} else {
|
||||
message.data = undefined;
|
||||
}
|
||||
if (object.sequence !== undefined && object.sequence !== null) {
|
||||
message.sequence = object.sequence as Long;
|
||||
} else {
|
||||
message.sequence = Long.UZERO;
|
||||
}
|
||||
return message;
|
||||
},
|
||||
toJSON(message: SignatureDescriptor): unknown {
|
||||
const obj: any = {};
|
||||
message.publicKey !== undefined &&
|
||||
(obj.publicKey = message.publicKey ? Any.toJSON(message.publicKey) : undefined);
|
||||
message.data !== undefined &&
|
||||
(obj.data = message.data ? SignatureDescriptor_Data.toJSON(message.data) : undefined);
|
||||
message.sequence !== undefined && (obj.sequence = (message.sequence || Long.UZERO).toString());
|
||||
return obj;
|
||||
},
|
||||
};
|
||||
|
||||
export const SignatureDescriptor_Data = {
|
||||
encode(message: SignatureDescriptor_Data, writer: Writer = Writer.create()): Writer {
|
||||
if (message.single !== undefined) {
|
||||
SignatureDescriptor_Data_Single.encode(message.single, writer.uint32(10).fork()).ldelim();
|
||||
}
|
||||
if (message.multi !== undefined) {
|
||||
SignatureDescriptor_Data_Multi.encode(message.multi, writer.uint32(18).fork()).ldelim();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
decode(input: Uint8Array | Reader, length?: number): SignatureDescriptor_Data {
|
||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = { ...baseSignatureDescriptor_Data } as SignatureDescriptor_Data;
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.single = SignatureDescriptor_Data_Single.decode(reader, reader.uint32());
|
||||
break;
|
||||
case 2:
|
||||
message.multi = SignatureDescriptor_Data_Multi.decode(reader, reader.uint32());
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
fromJSON(object: any): SignatureDescriptor_Data {
|
||||
const message = { ...baseSignatureDescriptor_Data } as SignatureDescriptor_Data;
|
||||
if (object.single !== undefined && object.single !== null) {
|
||||
message.single = SignatureDescriptor_Data_Single.fromJSON(object.single);
|
||||
} else {
|
||||
message.single = undefined;
|
||||
}
|
||||
if (object.multi !== undefined && object.multi !== null) {
|
||||
message.multi = SignatureDescriptor_Data_Multi.fromJSON(object.multi);
|
||||
} else {
|
||||
message.multi = undefined;
|
||||
}
|
||||
return message;
|
||||
},
|
||||
fromPartial(object: DeepPartial<SignatureDescriptor_Data>): SignatureDescriptor_Data {
|
||||
const message = { ...baseSignatureDescriptor_Data } as SignatureDescriptor_Data;
|
||||
if (object.single !== undefined && object.single !== null) {
|
||||
message.single = SignatureDescriptor_Data_Single.fromPartial(object.single);
|
||||
} else {
|
||||
message.single = undefined;
|
||||
}
|
||||
if (object.multi !== undefined && object.multi !== null) {
|
||||
message.multi = SignatureDescriptor_Data_Multi.fromPartial(object.multi);
|
||||
} else {
|
||||
message.multi = undefined;
|
||||
}
|
||||
return message;
|
||||
},
|
||||
toJSON(message: SignatureDescriptor_Data): unknown {
|
||||
const obj: any = {};
|
||||
message.single !== undefined &&
|
||||
(obj.single = message.single ? SignatureDescriptor_Data_Single.toJSON(message.single) : undefined);
|
||||
message.multi !== undefined &&
|
||||
(obj.multi = message.multi ? SignatureDescriptor_Data_Multi.toJSON(message.multi) : undefined);
|
||||
return obj;
|
||||
},
|
||||
};
|
||||
|
||||
export const SignatureDescriptor_Data_Single = {
|
||||
encode(message: SignatureDescriptor_Data_Single, writer: Writer = Writer.create()): Writer {
|
||||
writer.uint32(8).int32(message.mode);
|
||||
writer.uint32(18).bytes(message.signature);
|
||||
return writer;
|
||||
},
|
||||
decode(input: Uint8Array | Reader, length?: number): SignatureDescriptor_Data_Single {
|
||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = { ...baseSignatureDescriptor_Data_Single } as SignatureDescriptor_Data_Single;
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.mode = reader.int32() as any;
|
||||
break;
|
||||
case 2:
|
||||
message.signature = reader.bytes();
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
fromJSON(object: any): SignatureDescriptor_Data_Single {
|
||||
const message = { ...baseSignatureDescriptor_Data_Single } as SignatureDescriptor_Data_Single;
|
||||
if (object.mode !== undefined && object.mode !== null) {
|
||||
message.mode = signModeFromJSON(object.mode);
|
||||
} else {
|
||||
message.mode = 0;
|
||||
}
|
||||
if (object.signature !== undefined && object.signature !== null) {
|
||||
message.signature = bytesFromBase64(object.signature);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
fromPartial(object: DeepPartial<SignatureDescriptor_Data_Single>): SignatureDescriptor_Data_Single {
|
||||
const message = { ...baseSignatureDescriptor_Data_Single } as SignatureDescriptor_Data_Single;
|
||||
if (object.mode !== undefined && object.mode !== null) {
|
||||
message.mode = object.mode;
|
||||
} else {
|
||||
message.mode = 0;
|
||||
}
|
||||
if (object.signature !== undefined && object.signature !== null) {
|
||||
message.signature = object.signature;
|
||||
} else {
|
||||
message.signature = new Uint8Array();
|
||||
}
|
||||
return message;
|
||||
},
|
||||
toJSON(message: SignatureDescriptor_Data_Single): unknown {
|
||||
const obj: any = {};
|
||||
message.mode !== undefined && (obj.mode = signModeToJSON(message.mode));
|
||||
message.signature !== undefined &&
|
||||
(obj.signature = base64FromBytes(
|
||||
message.signature !== undefined ? message.signature : new Uint8Array(),
|
||||
));
|
||||
return obj;
|
||||
},
|
||||
};
|
||||
|
||||
export const SignatureDescriptor_Data_Multi = {
|
||||
encode(message: SignatureDescriptor_Data_Multi, writer: Writer = Writer.create()): Writer {
|
||||
if (message.bitarray !== undefined && message.bitarray !== undefined) {
|
||||
CompactBitArray.encode(message.bitarray, writer.uint32(10).fork()).ldelim();
|
||||
}
|
||||
for (const v of message.signatures) {
|
||||
SignatureDescriptor_Data.encode(v!, writer.uint32(18).fork()).ldelim();
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
decode(input: Uint8Array | Reader, length?: number): SignatureDescriptor_Data_Multi {
|
||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = { ...baseSignatureDescriptor_Data_Multi } as SignatureDescriptor_Data_Multi;
|
||||
message.signatures = [];
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.bitarray = CompactBitArray.decode(reader, reader.uint32());
|
||||
break;
|
||||
case 2:
|
||||
message.signatures.push(SignatureDescriptor_Data.decode(reader, reader.uint32()));
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
fromJSON(object: any): SignatureDescriptor_Data_Multi {
|
||||
const message = { ...baseSignatureDescriptor_Data_Multi } as SignatureDescriptor_Data_Multi;
|
||||
message.signatures = [];
|
||||
if (object.bitarray !== undefined && object.bitarray !== null) {
|
||||
message.bitarray = CompactBitArray.fromJSON(object.bitarray);
|
||||
} else {
|
||||
message.bitarray = undefined;
|
||||
}
|
||||
if (object.signatures !== undefined && object.signatures !== null) {
|
||||
for (const e of object.signatures) {
|
||||
message.signatures.push(SignatureDescriptor_Data.fromJSON(e));
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
fromPartial(object: DeepPartial<SignatureDescriptor_Data_Multi>): SignatureDescriptor_Data_Multi {
|
||||
const message = { ...baseSignatureDescriptor_Data_Multi } as SignatureDescriptor_Data_Multi;
|
||||
message.signatures = [];
|
||||
if (object.bitarray !== undefined && object.bitarray !== null) {
|
||||
message.bitarray = CompactBitArray.fromPartial(object.bitarray);
|
||||
} else {
|
||||
message.bitarray = undefined;
|
||||
}
|
||||
if (object.signatures !== undefined && object.signatures !== null) {
|
||||
for (const e of object.signatures) {
|
||||
message.signatures.push(SignatureDescriptor_Data.fromPartial(e));
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
toJSON(message: SignatureDescriptor_Data_Multi): unknown {
|
||||
const obj: any = {};
|
||||
message.bitarray !== undefined &&
|
||||
(obj.bitarray = message.bitarray ? CompactBitArray.toJSON(message.bitarray) : undefined);
|
||||
if (message.signatures) {
|
||||
obj.signatures = message.signatures.map((e) => (e ? SignatureDescriptor_Data.toJSON(e) : undefined));
|
||||
} else {
|
||||
obj.signatures = [];
|
||||
}
|
||||
return obj;
|
||||
},
|
||||
};
|
||||
|
||||
interface WindowBase64 {
|
||||
atob(b64: string): string;
|
||||
btoa(bin: string): string;
|
||||
}
|
||||
|
||||
const windowBase64 = (globalThis as unknown) as WindowBase64;
|
||||
const atob = windowBase64.atob || ((b64: string) => Buffer.from(b64, "base64").toString("binary"));
|
||||
const btoa = windowBase64.btoa || ((bin: string) => Buffer.from(bin, "binary").toString("base64"));
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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>;
|
||||
1161
packages/proto-signing/src/codec/cosmos/tx/v1beta1/tx.ts
Normal file
1161
packages/proto-signing/src/codec/cosmos/tx/v1beta1/tx.ts
Normal file
File diff suppressed because it is too large
Load Diff
3
packages/proto-signing/src/codec/cosmos_proto/cosmos.ts
Normal file
3
packages/proto-signing/src/codec/cosmos_proto/cosmos.ts
Normal file
@ -0,0 +1,3 @@
|
||||
/* eslint-disable */
|
||||
|
||||
export const protobufPackage = "cosmos_proto";
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
3
packages/proto-signing/src/codec/gogoproto/gogo.ts
Normal file
3
packages/proto-signing/src/codec/gogoproto/gogo.ts
Normal file
@ -0,0 +1,3 @@
|
||||
/* eslint-disable */
|
||||
|
||||
export const protobufPackage = "gogoproto";
|
||||
225
packages/proto-signing/src/codec/google/protobuf/any.ts
Normal file
225
packages/proto-signing/src/codec/google/protobuf/any.ts
Normal file
@ -0,0 +1,225 @@
|
||||
/* eslint-disable */
|
||||
import { Writer, Reader } from "protobufjs/minimal";
|
||||
|
||||
/**
|
||||
* `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 := ptypes.MarshalAny(foo)
|
||||
* ...
|
||||
* foo := &pb.Foo{}
|
||||
* if err := ptypes.UnmarshalAny(any, 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.
|
||||
*
|
||||
*/
|
||||
typeUrl: string;
|
||||
/**
|
||||
* Must be a valid serialized protocol buffer of the above specified type.
|
||||
*/
|
||||
value: Uint8Array;
|
||||
}
|
||||
|
||||
const baseAny: object = {
|
||||
typeUrl: "",
|
||||
};
|
||||
|
||||
export const protobufPackage = "google.protobuf";
|
||||
|
||||
export const Any = {
|
||||
encode(message: Any, writer: Writer = Writer.create()): Writer {
|
||||
writer.uint32(10).string(message.typeUrl);
|
||||
writer.uint32(18).bytes(message.value);
|
||||
return writer;
|
||||
},
|
||||
decode(input: Uint8Array | Reader, 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.typeUrl = 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.typeUrl !== undefined && object.typeUrl !== null) {
|
||||
message.typeUrl = String(object.typeUrl);
|
||||
} else {
|
||||
message.typeUrl = "";
|
||||
}
|
||||
if (object.value !== undefined && object.value !== null) {
|
||||
message.value = bytesFromBase64(object.value);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
fromPartial(object: DeepPartial<Any>): Any {
|
||||
const message = { ...baseAny } as Any;
|
||||
if (object.typeUrl !== undefined && object.typeUrl !== null) {
|
||||
message.typeUrl = object.typeUrl;
|
||||
} else {
|
||||
message.typeUrl = "";
|
||||
}
|
||||
if (object.value !== undefined && object.value !== null) {
|
||||
message.value = object.value;
|
||||
} else {
|
||||
message.value = new Uint8Array();
|
||||
}
|
||||
return message;
|
||||
},
|
||||
toJSON(message: Any): unknown {
|
||||
const obj: any = {};
|
||||
message.typeUrl !== undefined && (obj.typeUrl = message.typeUrl);
|
||||
message.value !== undefined &&
|
||||
(obj.value = base64FromBytes(message.value !== undefined ? message.value : new Uint8Array()));
|
||||
return obj;
|
||||
},
|
||||
};
|
||||
|
||||
interface WindowBase64 {
|
||||
atob(b64: string): string;
|
||||
btoa(bin: string): string;
|
||||
}
|
||||
|
||||
const windowBase64 = (globalThis as unknown) as WindowBase64;
|
||||
const atob = windowBase64.atob || ((b64: string) => Buffer.from(b64, "base64").toString("binary"));
|
||||
const btoa = windowBase64.btoa || ((bin: string) => Buffer.from(bin, "binary").toString("base64"));
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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>;
|
||||
4559
packages/proto-signing/src/codec/google/protobuf/descriptor.ts
Normal file
4559
packages/proto-signing/src/codec/google/protobuf/descriptor.ts
Normal file
File diff suppressed because it is too large
Load Diff
@ -1,9 +0,0 @@
|
||||
import Long from "long";
|
||||
import protobuf from "protobufjs/minimal";
|
||||
|
||||
// Ensure the protobuf module has a Long implementation, which otherwise only works
|
||||
// in Node.js (see https://github.com/protobufjs/protobuf.js/issues/921#issuecomment-334925145)
|
||||
protobuf.util.Long = Long;
|
||||
protobuf.configure();
|
||||
|
||||
export * from "./generated/codecimpl";
|
||||
114
packages/proto-signing/src/codec/tendermint/crypto/keys.ts
Normal file
114
packages/proto-signing/src/codec/tendermint/crypto/keys.ts
Normal file
@ -0,0 +1,114 @@
|
||||
/* eslint-disable */
|
||||
import { Writer, Reader } from "protobufjs/minimal";
|
||||
|
||||
/**
|
||||
* PublicKey defines the keys available for use with Tendermint Validators
|
||||
*/
|
||||
export interface PublicKey {
|
||||
ed25519: Uint8Array | undefined;
|
||||
secp256k1: Uint8Array | undefined;
|
||||
}
|
||||
|
||||
const basePublicKey: object = {};
|
||||
|
||||
export const protobufPackage = "tendermint.crypto";
|
||||
|
||||
export const PublicKey = {
|
||||
encode(message: PublicKey, writer: Writer = Writer.create()): Writer {
|
||||
if (message.ed25519 !== undefined) {
|
||||
writer.uint32(10).bytes(message.ed25519);
|
||||
}
|
||||
if (message.secp256k1 !== undefined) {
|
||||
writer.uint32(18).bytes(message.secp256k1);
|
||||
}
|
||||
return writer;
|
||||
},
|
||||
decode(input: Uint8Array | Reader, length?: number): PublicKey {
|
||||
const reader = input instanceof Uint8Array ? new Reader(input) : input;
|
||||
let end = length === undefined ? reader.len : reader.pos + length;
|
||||
const message = { ...basePublicKey } as PublicKey;
|
||||
while (reader.pos < end) {
|
||||
const tag = reader.uint32();
|
||||
switch (tag >>> 3) {
|
||||
case 1:
|
||||
message.ed25519 = reader.bytes();
|
||||
break;
|
||||
case 2:
|
||||
message.secp256k1 = reader.bytes();
|
||||
break;
|
||||
default:
|
||||
reader.skipType(tag & 7);
|
||||
break;
|
||||
}
|
||||
}
|
||||
return message;
|
||||
},
|
||||
fromJSON(object: any): PublicKey {
|
||||
const message = { ...basePublicKey } as PublicKey;
|
||||
if (object.ed25519 !== undefined && object.ed25519 !== null) {
|
||||
message.ed25519 = bytesFromBase64(object.ed25519);
|
||||
}
|
||||
if (object.secp256k1 !== undefined && object.secp256k1 !== null) {
|
||||
message.secp256k1 = bytesFromBase64(object.secp256k1);
|
||||
}
|
||||
return message;
|
||||
},
|
||||
fromPartial(object: DeepPartial<PublicKey>): PublicKey {
|
||||
const message = { ...basePublicKey } as PublicKey;
|
||||
if (object.ed25519 !== undefined && object.ed25519 !== null) {
|
||||
message.ed25519 = object.ed25519;
|
||||
} else {
|
||||
message.ed25519 = undefined;
|
||||
}
|
||||
if (object.secp256k1 !== undefined && object.secp256k1 !== null) {
|
||||
message.secp256k1 = object.secp256k1;
|
||||
} else {
|
||||
message.secp256k1 = undefined;
|
||||
}
|
||||
return message;
|
||||
},
|
||||
toJSON(message: PublicKey): unknown {
|
||||
const obj: any = {};
|
||||
message.ed25519 !== undefined &&
|
||||
(obj.ed25519 = message.ed25519 !== undefined ? base64FromBytes(message.ed25519) : undefined);
|
||||
message.secp256k1 !== undefined &&
|
||||
(obj.secp256k1 = message.secp256k1 !== undefined ? base64FromBytes(message.secp256k1) : undefined);
|
||||
return obj;
|
||||
},
|
||||
};
|
||||
|
||||
interface WindowBase64 {
|
||||
atob(b64: string): string;
|
||||
btoa(bin: string): string;
|
||||
}
|
||||
|
||||
const windowBase64 = (globalThis as unknown) as WindowBase64;
|
||||
const atob = windowBase64.atob || ((b64: string) => Buffer.from(b64, "base64").toString("binary"));
|
||||
const btoa = windowBase64.btoa || ((bin: string) => Buffer.from(bin, "binary").toString("base64"));
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
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>;
|
||||
143
packages/proto-signing/types/codec/cosmos/bank/v1beta1/bank.d.ts
vendored
Normal file
143
packages/proto-signing/types/codec/cosmos/bank/v1beta1/bank.d.ts
vendored
Normal file
@ -0,0 +1,143 @@
|
||||
import { Coin } from "../../../cosmos/base/v1beta1/coin";
|
||||
import { Writer, Reader } from "protobufjs/minimal";
|
||||
/**
|
||||
* Params defines the parameters for the bank module.
|
||||
*/
|
||||
export interface Params {
|
||||
sendEnabled: SendEnabled[];
|
||||
defaultSendEnabled: boolean;
|
||||
}
|
||||
/**
|
||||
* SendEnabled maps coin denom to a send_enabled status (whether a denom is
|
||||
* sendable).
|
||||
*/
|
||||
export interface SendEnabled {
|
||||
denom: string;
|
||||
enabled: boolean;
|
||||
}
|
||||
/**
|
||||
* Input models transaction input.
|
||||
*/
|
||||
export interface Input {
|
||||
address: string;
|
||||
coins: Coin[];
|
||||
}
|
||||
/**
|
||||
* Output models transaction outputs.
|
||||
*/
|
||||
export interface Output {
|
||||
address: string;
|
||||
coins: Coin[];
|
||||
}
|
||||
/**
|
||||
* Supply represents a struct that passively keeps track of the total supply
|
||||
* amounts in the network.
|
||||
*/
|
||||
export interface Supply {
|
||||
total: Coin[];
|
||||
}
|
||||
/**
|
||||
* DenomUnit represents a struct that describes a given
|
||||
* denomination unit of the basic token.
|
||||
*/
|
||||
export interface DenomUnit {
|
||||
/**
|
||||
* denom represents the string name of the given denom unit (e.g uatom).
|
||||
*/
|
||||
denom: string;
|
||||
/**
|
||||
* exponent represents power of 10 exponent that one must
|
||||
* raise the base_denom to in order to equal the given DenomUnit's denom
|
||||
* 1 denom = 1^exponent base_denom
|
||||
* (e.g. with a base_denom of uatom, one can create a DenomUnit of 'atom' with
|
||||
* exponent = 6, thus: 1 atom = 10^6 uatom).
|
||||
*/
|
||||
exponent: number;
|
||||
/**
|
||||
* aliases is a list of string aliases for the given denom
|
||||
*/
|
||||
aliases: string[];
|
||||
}
|
||||
/**
|
||||
* Metadata represents a struct that describes
|
||||
* a basic token.
|
||||
*/
|
||||
export interface Metadata {
|
||||
description: string;
|
||||
/**
|
||||
* denom_units represents the list of DenomUnit's for a given coin
|
||||
*/
|
||||
denomUnits: DenomUnit[];
|
||||
/**
|
||||
* base represents the base denom (should be the DenomUnit with exponent = 0).
|
||||
*/
|
||||
base: string;
|
||||
/**
|
||||
* display indicates the suggested denom that should be
|
||||
* displayed in clients.
|
||||
*/
|
||||
display: string;
|
||||
}
|
||||
export declare const protobufPackage = "cosmos.bank.v1beta1";
|
||||
export declare const Params: {
|
||||
encode(message: Params, writer?: Writer): Writer;
|
||||
decode(input: Uint8Array | Reader, length?: number | undefined): Params;
|
||||
fromJSON(object: any): Params;
|
||||
fromPartial(object: DeepPartial<Params>): Params;
|
||||
toJSON(message: Params): unknown;
|
||||
};
|
||||
export declare const SendEnabled: {
|
||||
encode(message: SendEnabled, writer?: Writer): Writer;
|
||||
decode(input: Uint8Array | Reader, length?: number | undefined): SendEnabled;
|
||||
fromJSON(object: any): SendEnabled;
|
||||
fromPartial(object: DeepPartial<SendEnabled>): SendEnabled;
|
||||
toJSON(message: SendEnabled): unknown;
|
||||
};
|
||||
export declare const Input: {
|
||||
encode(message: Input, writer?: Writer): Writer;
|
||||
decode(input: Uint8Array | Reader, length?: number | undefined): Input;
|
||||
fromJSON(object: any): Input;
|
||||
fromPartial(object: DeepPartial<Input>): Input;
|
||||
toJSON(message: Input): unknown;
|
||||
};
|
||||
export declare const Output: {
|
||||
encode(message: Output, writer?: Writer): Writer;
|
||||
decode(input: Uint8Array | Reader, length?: number | undefined): Output;
|
||||
fromJSON(object: any): Output;
|
||||
fromPartial(object: DeepPartial<Output>): Output;
|
||||
toJSON(message: Output): unknown;
|
||||
};
|
||||
export declare const Supply: {
|
||||
encode(message: Supply, writer?: Writer): Writer;
|
||||
decode(input: Uint8Array | Reader, length?: number | undefined): Supply;
|
||||
fromJSON(object: any): Supply;
|
||||
fromPartial(object: DeepPartial<Supply>): Supply;
|
||||
toJSON(message: Supply): unknown;
|
||||
};
|
||||
export declare const DenomUnit: {
|
||||
encode(message: DenomUnit, writer?: Writer): Writer;
|
||||
decode(input: Uint8Array | Reader, length?: number | undefined): DenomUnit;
|
||||
fromJSON(object: any): DenomUnit;
|
||||
fromPartial(object: DeepPartial<DenomUnit>): DenomUnit;
|
||||
toJSON(message: DenomUnit): unknown;
|
||||
};
|
||||
export declare const Metadata: {
|
||||
encode(message: Metadata, writer?: Writer): Writer;
|
||||
decode(input: Uint8Array | Reader, length?: number | undefined): Metadata;
|
||||
fromJSON(object: any): Metadata;
|
||||
fromPartial(object: DeepPartial<Metadata>): Metadata;
|
||||
toJSON(message: Metadata): unknown;
|
||||
};
|
||||
declare type Builtin = Date | Function | Uint8Array | string | number | undefined;
|
||||
export declare 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>;
|
||||
export {};
|
||||
90
packages/proto-signing/types/codec/cosmos/bank/v1beta1/tx.d.ts
vendored
Normal file
90
packages/proto-signing/types/codec/cosmos/bank/v1beta1/tx.d.ts
vendored
Normal file
@ -0,0 +1,90 @@
|
||||
import { Coin } from "../../../cosmos/base/v1beta1/coin";
|
||||
import { Input, Output } from "../../../cosmos/bank/v1beta1/bank";
|
||||
import { Reader, Writer } from "protobufjs/minimal";
|
||||
/**
|
||||
* MsgSend represents a message to send coins from one account to another.
|
||||
*/
|
||||
export interface MsgSend {
|
||||
fromAddress: string;
|
||||
toAddress: string;
|
||||
amount: Coin[];
|
||||
}
|
||||
/**
|
||||
* MsgSendResponse defines the Msg/Send response type.
|
||||
*/
|
||||
export interface MsgSendResponse {}
|
||||
/**
|
||||
* MsgMultiSend represents an arbitrary multi-in, multi-out send message.
|
||||
*/
|
||||
export interface MsgMultiSend {
|
||||
inputs: Input[];
|
||||
outputs: Output[];
|
||||
}
|
||||
/**
|
||||
* MsgMultiSendResponse defines the Msg/MultiSend response type.
|
||||
*/
|
||||
export interface MsgMultiSendResponse {}
|
||||
/**
|
||||
* Msg defines the bank Msg service.
|
||||
*/
|
||||
export interface Msg {
|
||||
/**
|
||||
* Send defines a method for sending coins from one account to another account.
|
||||
*/
|
||||
Send(request: MsgSend): Promise<MsgSendResponse>;
|
||||
/**
|
||||
* MultiSend defines a method for sending coins from some accounts to other accounts.
|
||||
*/
|
||||
MultiSend(request: MsgMultiSend): Promise<MsgMultiSendResponse>;
|
||||
}
|
||||
export declare class MsgClientImpl implements Msg {
|
||||
private readonly rpc;
|
||||
constructor(rpc: Rpc);
|
||||
Send(request: MsgSend): Promise<MsgSendResponse>;
|
||||
MultiSend(request: MsgMultiSend): Promise<MsgMultiSendResponse>;
|
||||
}
|
||||
interface Rpc {
|
||||
request(service: string, method: string, data: Uint8Array): Promise<Uint8Array>;
|
||||
}
|
||||
export declare const protobufPackage = "cosmos.bank.v1beta1";
|
||||
export declare const MsgSend: {
|
||||
encode(message: MsgSend, writer?: Writer): Writer;
|
||||
decode(input: Uint8Array | Reader, length?: number | undefined): MsgSend;
|
||||
fromJSON(object: any): MsgSend;
|
||||
fromPartial(object: DeepPartial<MsgSend>): MsgSend;
|
||||
toJSON(message: MsgSend): unknown;
|
||||
};
|
||||
export declare const MsgSendResponse: {
|
||||
encode(_: MsgSendResponse, writer?: Writer): Writer;
|
||||
decode(input: Uint8Array | Reader, length?: number | undefined): MsgSendResponse;
|
||||
fromJSON(_: any): MsgSendResponse;
|
||||
fromPartial(_: DeepPartial<MsgSendResponse>): MsgSendResponse;
|
||||
toJSON(_: MsgSendResponse): unknown;
|
||||
};
|
||||
export declare const MsgMultiSend: {
|
||||
encode(message: MsgMultiSend, writer?: Writer): Writer;
|
||||
decode(input: Uint8Array | Reader, length?: number | undefined): MsgMultiSend;
|
||||
fromJSON(object: any): MsgMultiSend;
|
||||
fromPartial(object: DeepPartial<MsgMultiSend>): MsgMultiSend;
|
||||
toJSON(message: MsgMultiSend): unknown;
|
||||
};
|
||||
export declare const MsgMultiSendResponse: {
|
||||
encode(_: MsgMultiSendResponse, writer?: Writer): Writer;
|
||||
decode(input: Uint8Array | Reader, length?: number | undefined): MsgMultiSendResponse;
|
||||
fromJSON(_: any): MsgMultiSendResponse;
|
||||
fromPartial(_: DeepPartial<MsgMultiSendResponse>): MsgMultiSendResponse;
|
||||
toJSON(_: MsgMultiSendResponse): unknown;
|
||||
};
|
||||
declare type Builtin = Date | Function | Uint8Array | string | number | undefined;
|
||||
export declare 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>;
|
||||
export {};
|
||||
75
packages/proto-signing/types/codec/cosmos/base/v1beta1/coin.d.ts
vendored
Normal file
75
packages/proto-signing/types/codec/cosmos/base/v1beta1/coin.d.ts
vendored
Normal file
@ -0,0 +1,75 @@
|
||||
import { Writer, Reader } from "protobufjs/minimal";
|
||||
/**
|
||||
* 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;
|
||||
}
|
||||
export declare const protobufPackage = "cosmos.base.v1beta1";
|
||||
export declare const Coin: {
|
||||
encode(message: Coin, writer?: Writer): Writer;
|
||||
decode(input: Uint8Array | Reader, length?: number | undefined): Coin;
|
||||
fromJSON(object: any): Coin;
|
||||
fromPartial(object: DeepPartial<Coin>): Coin;
|
||||
toJSON(message: Coin): unknown;
|
||||
};
|
||||
export declare const DecCoin: {
|
||||
encode(message: DecCoin, writer?: Writer): Writer;
|
||||
decode(input: Uint8Array | Reader, length?: number | undefined): DecCoin;
|
||||
fromJSON(object: any): DecCoin;
|
||||
fromPartial(object: DeepPartial<DecCoin>): DecCoin;
|
||||
toJSON(message: DecCoin): unknown;
|
||||
};
|
||||
export declare const IntProto: {
|
||||
encode(message: IntProto, writer?: Writer): Writer;
|
||||
decode(input: Uint8Array | Reader, length?: number | undefined): IntProto;
|
||||
fromJSON(object: any): IntProto;
|
||||
fromPartial(object: DeepPartial<IntProto>): IntProto;
|
||||
toJSON(message: IntProto): unknown;
|
||||
};
|
||||
export declare const DecProto: {
|
||||
encode(message: DecProto, writer?: Writer): Writer;
|
||||
decode(input: Uint8Array | Reader, length?: number | undefined): DecProto;
|
||||
fromJSON(object: any): DecProto;
|
||||
fromPartial(object: DeepPartial<DecProto>): DecProto;
|
||||
toJSON(message: DecProto): unknown;
|
||||
};
|
||||
declare type Builtin = Date | Function | Uint8Array | string | number | undefined;
|
||||
export declare 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>;
|
||||
export {};
|
||||
47
packages/proto-signing/types/codec/cosmos/crypto/multisig/v1beta1/multisig.d.ts
vendored
Normal file
47
packages/proto-signing/types/codec/cosmos/crypto/multisig/v1beta1/multisig.d.ts
vendored
Normal file
@ -0,0 +1,47 @@
|
||||
import { Writer, Reader } from "protobufjs/minimal";
|
||||
/**
|
||||
* MultiSignature wraps the signatures from a multisig.LegacyAminoPubKey.
|
||||
* See cosmos.tx.v1betata1.ModeInfo.Multi for how to specify which signers
|
||||
* signed and with which modes.
|
||||
*/
|
||||
export interface MultiSignature {
|
||||
signatures: Uint8Array[];
|
||||
}
|
||||
/**
|
||||
* CompactBitArray is an implementation of a space efficient bit array.
|
||||
* This is used to ensure that the encoded data takes up a minimal amount of
|
||||
* space after proto encoding.
|
||||
* This is not thread safe, and is not intended for concurrent usage.
|
||||
*/
|
||||
export interface CompactBitArray {
|
||||
extraBitsStored: number;
|
||||
elems: Uint8Array;
|
||||
}
|
||||
export declare const protobufPackage = "cosmos.crypto.multisig.v1beta1";
|
||||
export declare const MultiSignature: {
|
||||
encode(message: MultiSignature, writer?: Writer): Writer;
|
||||
decode(input: Uint8Array | Reader, length?: number | undefined): MultiSignature;
|
||||
fromJSON(object: any): MultiSignature;
|
||||
fromPartial(object: DeepPartial<MultiSignature>): MultiSignature;
|
||||
toJSON(message: MultiSignature): unknown;
|
||||
};
|
||||
export declare const CompactBitArray: {
|
||||
encode(message: CompactBitArray, writer?: Writer): Writer;
|
||||
decode(input: Uint8Array | Reader, length?: number | undefined): CompactBitArray;
|
||||
fromJSON(object: any): CompactBitArray;
|
||||
fromPartial(object: DeepPartial<CompactBitArray>): CompactBitArray;
|
||||
toJSON(message: CompactBitArray): unknown;
|
||||
};
|
||||
declare type Builtin = Date | Function | Uint8Array | string | number | undefined;
|
||||
export declare 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>;
|
||||
export {};
|
||||
45
packages/proto-signing/types/codec/cosmos/crypto/secp256k1/keys.d.ts
vendored
Normal file
45
packages/proto-signing/types/codec/cosmos/crypto/secp256k1/keys.d.ts
vendored
Normal file
@ -0,0 +1,45 @@
|
||||
import { Writer, Reader } from "protobufjs/minimal";
|
||||
/**
|
||||
* PubKey defines a secp256k1 public key
|
||||
* Key is the compressed form of the pubkey. The first byte depends is a 0x02 byte
|
||||
* if the y-coordinate is the lexicographically largest of the two associated with
|
||||
* the x-coordinate. Otherwise the first byte is a 0x03.
|
||||
* This prefix is followed with the x-coordinate.
|
||||
*/
|
||||
export interface PubKey {
|
||||
key: Uint8Array;
|
||||
}
|
||||
/**
|
||||
* PrivKey defines a secp256k1 private key.
|
||||
*/
|
||||
export interface PrivKey {
|
||||
key: Uint8Array;
|
||||
}
|
||||
export declare const protobufPackage = "cosmos.crypto.secp256k1";
|
||||
export declare const PubKey: {
|
||||
encode(message: PubKey, writer?: Writer): Writer;
|
||||
decode(input: Uint8Array | Reader, length?: number | undefined): PubKey;
|
||||
fromJSON(object: any): PubKey;
|
||||
fromPartial(object: DeepPartial<PubKey>): PubKey;
|
||||
toJSON(message: PubKey): unknown;
|
||||
};
|
||||
export declare const PrivKey: {
|
||||
encode(message: PrivKey, writer?: Writer): Writer;
|
||||
decode(input: Uint8Array | Reader, length?: number | undefined): PrivKey;
|
||||
fromJSON(object: any): PrivKey;
|
||||
fromPartial(object: DeepPartial<PrivKey>): PrivKey;
|
||||
toJSON(message: PrivKey): unknown;
|
||||
};
|
||||
declare type Builtin = Date | Function | Uint8Array | string | number | undefined;
|
||||
export declare 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>;
|
||||
export {};
|
||||
144
packages/proto-signing/types/codec/cosmos/tx/signing/v1beta1/signing.d.ts
vendored
Normal file
144
packages/proto-signing/types/codec/cosmos/tx/signing/v1beta1/signing.d.ts
vendored
Normal file
@ -0,0 +1,144 @@
|
||||
import { Any } from "../../../../google/protobuf/any";
|
||||
import * as Long from "long";
|
||||
import { CompactBitArray } from "../../../../cosmos/crypto/multisig/v1beta1/multisig";
|
||||
import { Writer, Reader } from "protobufjs/minimal";
|
||||
/**
|
||||
* SignatureDescriptors wraps multiple SignatureDescriptor's.
|
||||
*/
|
||||
export interface SignatureDescriptors {
|
||||
/**
|
||||
* signatures are the signature descriptors
|
||||
*/
|
||||
signatures: SignatureDescriptor[];
|
||||
}
|
||||
/**
|
||||
* SignatureDescriptor is a convenience type which represents the full data for
|
||||
* a signature including the public key of the signer, signing modes and the
|
||||
* signature itself. It is primarily used for coordinating signatures between
|
||||
* clients.
|
||||
*/
|
||||
export interface SignatureDescriptor {
|
||||
/**
|
||||
* public_key is the public key of the signer
|
||||
*/
|
||||
publicKey?: Any;
|
||||
data?: SignatureDescriptor_Data;
|
||||
/**
|
||||
* sequence is the sequence of the account, which describes the
|
||||
* number of committed transactions signed by a given address. It is used to prevent
|
||||
* replay attacks.
|
||||
*/
|
||||
sequence: Long;
|
||||
}
|
||||
/**
|
||||
* Data represents signature data
|
||||
*/
|
||||
export interface SignatureDescriptor_Data {
|
||||
/**
|
||||
* single represents a single signer
|
||||
*/
|
||||
single?: SignatureDescriptor_Data_Single | undefined;
|
||||
/**
|
||||
* multi represents a multisig signer
|
||||
*/
|
||||
multi?: SignatureDescriptor_Data_Multi | undefined;
|
||||
}
|
||||
/**
|
||||
* Single is the signature data for a single signer
|
||||
*/
|
||||
export interface SignatureDescriptor_Data_Single {
|
||||
/**
|
||||
* mode is the signing mode of the single signer
|
||||
*/
|
||||
mode: SignMode;
|
||||
/**
|
||||
* signature is the raw signature bytes
|
||||
*/
|
||||
signature: Uint8Array;
|
||||
}
|
||||
/**
|
||||
* Multi is the signature data for a multisig public key
|
||||
*/
|
||||
export interface SignatureDescriptor_Data_Multi {
|
||||
/**
|
||||
* bitarray specifies which keys within the multisig are signing
|
||||
*/
|
||||
bitarray?: CompactBitArray;
|
||||
/**
|
||||
* signatures is the signatures of the multi-signature
|
||||
*/
|
||||
signatures: SignatureDescriptor_Data[];
|
||||
}
|
||||
export declare const protobufPackage = "cosmos.tx.signing.v1beta1";
|
||||
/** SignMode represents a signing mode with its own security guarantees.
|
||||
*/
|
||||
export declare enum SignMode {
|
||||
/** SIGN_MODE_UNSPECIFIED - SIGN_MODE_UNSPECIFIED specifies an unknown signing mode and will be
|
||||
rejected
|
||||
*/
|
||||
SIGN_MODE_UNSPECIFIED = 0,
|
||||
/** SIGN_MODE_DIRECT - SIGN_MODE_DIRECT specifies a signing mode which uses SignDoc and is
|
||||
verified with raw bytes from Tx
|
||||
*/
|
||||
SIGN_MODE_DIRECT = 1,
|
||||
/** SIGN_MODE_TEXTUAL - SIGN_MODE_TEXTUAL is a future signing mode that will verify some
|
||||
human-readable textual representation on top of the binary representation
|
||||
from SIGN_MODE_DIRECT
|
||||
*/
|
||||
SIGN_MODE_TEXTUAL = 2,
|
||||
/** 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_LEGACY_AMINO_JSON = 127,
|
||||
UNRECOGNIZED = -1,
|
||||
}
|
||||
export declare function signModeFromJSON(object: any): SignMode;
|
||||
export declare function signModeToJSON(object: SignMode): string;
|
||||
export declare const SignatureDescriptors: {
|
||||
encode(message: SignatureDescriptors, writer?: Writer): Writer;
|
||||
decode(input: Uint8Array | Reader, length?: number | undefined): SignatureDescriptors;
|
||||
fromJSON(object: any): SignatureDescriptors;
|
||||
fromPartial(object: DeepPartial<SignatureDescriptors>): SignatureDescriptors;
|
||||
toJSON(message: SignatureDescriptors): unknown;
|
||||
};
|
||||
export declare const SignatureDescriptor: {
|
||||
encode(message: SignatureDescriptor, writer?: Writer): Writer;
|
||||
decode(input: Uint8Array | Reader, length?: number | undefined): SignatureDescriptor;
|
||||
fromJSON(object: any): SignatureDescriptor;
|
||||
fromPartial(object: DeepPartial<SignatureDescriptor>): SignatureDescriptor;
|
||||
toJSON(message: SignatureDescriptor): unknown;
|
||||
};
|
||||
export declare const SignatureDescriptor_Data: {
|
||||
encode(message: SignatureDescriptor_Data, writer?: Writer): Writer;
|
||||
decode(input: Uint8Array | Reader, length?: number | undefined): SignatureDescriptor_Data;
|
||||
fromJSON(object: any): SignatureDescriptor_Data;
|
||||
fromPartial(object: DeepPartial<SignatureDescriptor_Data>): SignatureDescriptor_Data;
|
||||
toJSON(message: SignatureDescriptor_Data): unknown;
|
||||
};
|
||||
export declare const SignatureDescriptor_Data_Single: {
|
||||
encode(message: SignatureDescriptor_Data_Single, writer?: Writer): Writer;
|
||||
decode(input: Uint8Array | Reader, length?: number | undefined): SignatureDescriptor_Data_Single;
|
||||
fromJSON(object: any): SignatureDescriptor_Data_Single;
|
||||
fromPartial(object: DeepPartial<SignatureDescriptor_Data_Single>): SignatureDescriptor_Data_Single;
|
||||
toJSON(message: SignatureDescriptor_Data_Single): unknown;
|
||||
};
|
||||
export declare const SignatureDescriptor_Data_Multi: {
|
||||
encode(message: SignatureDescriptor_Data_Multi, writer?: Writer): Writer;
|
||||
decode(input: Uint8Array | Reader, length?: number | undefined): SignatureDescriptor_Data_Multi;
|
||||
fromJSON(object: any): SignatureDescriptor_Data_Multi;
|
||||
fromPartial(object: DeepPartial<SignatureDescriptor_Data_Multi>): SignatureDescriptor_Data_Multi;
|
||||
toJSON(message: SignatureDescriptor_Data_Multi): unknown;
|
||||
};
|
||||
declare type Builtin = Date | Function | Uint8Array | string | number | undefined;
|
||||
export declare 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>;
|
||||
export {};
|
||||
305
packages/proto-signing/types/codec/cosmos/tx/v1beta1/tx.d.ts
vendored
Normal file
305
packages/proto-signing/types/codec/cosmos/tx/v1beta1/tx.d.ts
vendored
Normal file
@ -0,0 +1,305 @@
|
||||
import * as Long from "long";
|
||||
import { Any } from "../../../google/protobuf/any";
|
||||
import { SignMode } from "../../../cosmos/tx/signing/v1beta1/signing";
|
||||
import { CompactBitArray } from "../../../cosmos/crypto/multisig/v1beta1/multisig";
|
||||
import { Coin } from "../../../cosmos/base/v1beta1/coin";
|
||||
import { Writer, Reader } from "protobufjs/minimal";
|
||||
/**
|
||||
* Tx is the standard type used for broadcasting transactions.
|
||||
*/
|
||||
export interface Tx {
|
||||
/**
|
||||
* body is the processable content of the transaction
|
||||
*/
|
||||
body?: TxBody;
|
||||
/**
|
||||
* auth_info is the authorization related content of the transaction,
|
||||
* specifically signers, signer modes and fee
|
||||
*/
|
||||
authInfo?: AuthInfo;
|
||||
/**
|
||||
* signatures is a list of signatures that matches the length and order of
|
||||
* AuthInfo's signer_infos to allow connecting signature meta information like
|
||||
* public key and signing mode by position.
|
||||
*/
|
||||
signatures: Uint8Array[];
|
||||
}
|
||||
/**
|
||||
* TxRaw is a variant of Tx that pins the signer's exact binary representation
|
||||
* of body and auth_info. This is used for signing, broadcasting and
|
||||
* verification. The binary `serialize(tx: TxRaw)` is stored in Tendermint and
|
||||
* the hash `sha256(serialize(tx: TxRaw))` becomes the "txhash", commonly used
|
||||
* as the transaction ID.
|
||||
*/
|
||||
export interface TxRaw {
|
||||
/**
|
||||
* body_bytes is a protobuf serialization of a TxBody that matches the
|
||||
* representation in SignDoc.
|
||||
*/
|
||||
bodyBytes: Uint8Array;
|
||||
/**
|
||||
* auth_info_bytes is a protobuf serialization of an AuthInfo that matches the
|
||||
* representation in SignDoc.
|
||||
*/
|
||||
authInfoBytes: Uint8Array;
|
||||
/**
|
||||
* signatures is a list of signatures that matches the length and order of
|
||||
* AuthInfo's signer_infos to allow connecting signature meta information like
|
||||
* public key and signing mode by position.
|
||||
*/
|
||||
signatures: Uint8Array[];
|
||||
}
|
||||
/**
|
||||
* SignDoc is the type used for generating sign bytes for SIGN_MODE_DIRECT.
|
||||
*/
|
||||
export interface SignDoc {
|
||||
/**
|
||||
* body_bytes is protobuf serialization of a TxBody that matches the
|
||||
* representation in TxRaw.
|
||||
*/
|
||||
bodyBytes: Uint8Array;
|
||||
/**
|
||||
* auth_info_bytes is a protobuf serialization of an AuthInfo that matches the
|
||||
* representation in TxRaw.
|
||||
*/
|
||||
authInfoBytes: Uint8Array;
|
||||
/**
|
||||
* chain_id is the unique identifier of the chain this transaction targets.
|
||||
* It prevents signed transactions from being used on another chain by an
|
||||
* attacker
|
||||
*/
|
||||
chainId: string;
|
||||
/**
|
||||
* account_number is the account number of the account in state
|
||||
*/
|
||||
accountNumber: Long;
|
||||
}
|
||||
/**
|
||||
* TxBody is the body of a transaction that all signers sign over.
|
||||
*/
|
||||
export interface TxBody {
|
||||
/**
|
||||
* messages is a list of messages to be executed. The required signers of
|
||||
* those messages define the number and order of elements in AuthInfo's
|
||||
* signer_infos and Tx's signatures. Each required signer address is added to
|
||||
* the list only the first time it occurs.
|
||||
* By convention, the first required signer (usually from the first message)
|
||||
* is referred to as the primary signer and pays the fee for the whole
|
||||
* transaction.
|
||||
*/
|
||||
messages: Any[];
|
||||
/**
|
||||
* memo is any arbitrary memo to be added to the transaction
|
||||
*/
|
||||
memo: string;
|
||||
/**
|
||||
* timeout is the block height after which this transaction will not
|
||||
* be processed by the chain
|
||||
*/
|
||||
timeoutHeight: Long;
|
||||
/**
|
||||
* extension_options are arbitrary options that can be added by chains
|
||||
* when the default options are not sufficient. If any of these are present
|
||||
* and can't be handled, the transaction will be rejected
|
||||
*/
|
||||
extensionOptions: Any[];
|
||||
/**
|
||||
* extension_options are arbitrary options that can be added by chains
|
||||
* when the default options are not sufficient. If any of these are present
|
||||
* and can't be handled, they will be ignored
|
||||
*/
|
||||
nonCriticalExtensionOptions: Any[];
|
||||
}
|
||||
/**
|
||||
* AuthInfo describes the fee and signer modes that are used to sign a
|
||||
* transaction.
|
||||
*/
|
||||
export interface AuthInfo {
|
||||
/**
|
||||
* signer_infos defines the signing modes for the required signers. The number
|
||||
* and order of elements must match the required signers from TxBody's
|
||||
* messages. The first element is the primary signer and the one which pays
|
||||
* the fee.
|
||||
*/
|
||||
signerInfos: SignerInfo[];
|
||||
/**
|
||||
* Fee is the fee and gas limit for the transaction. The first signer is the
|
||||
* primary signer and the one which pays the fee. The fee can be calculated
|
||||
* based on the cost of evaluating the body and doing signature verification
|
||||
* of the signers. This can be estimated via simulation.
|
||||
*/
|
||||
fee?: Fee;
|
||||
}
|
||||
/**
|
||||
* SignerInfo describes the public key and signing mode of a single top-level
|
||||
* signer.
|
||||
*/
|
||||
export interface SignerInfo {
|
||||
/**
|
||||
* public_key is the public key of the signer. It is optional for accounts
|
||||
* that already exist in state. If unset, the verifier can use the required \
|
||||
* signer address for this position and lookup the public key.
|
||||
*/
|
||||
publicKey?: Any;
|
||||
/**
|
||||
* mode_info describes the signing mode of the signer and is a nested
|
||||
* structure to support nested multisig pubkey's
|
||||
*/
|
||||
modeInfo?: ModeInfo;
|
||||
/**
|
||||
* sequence is the sequence of the account, which describes the
|
||||
* number of committed transactions signed by a given address. It is used to
|
||||
* prevent replay attacks.
|
||||
*/
|
||||
sequence: Long;
|
||||
}
|
||||
/**
|
||||
* ModeInfo describes the signing mode of a single or nested multisig signer.
|
||||
*/
|
||||
export interface ModeInfo {
|
||||
/**
|
||||
* single represents a single signer
|
||||
*/
|
||||
single?: ModeInfo_Single | undefined;
|
||||
/**
|
||||
* multi represents a nested multisig signer
|
||||
*/
|
||||
multi?: ModeInfo_Multi | undefined;
|
||||
}
|
||||
/**
|
||||
* Single is the mode info for a single signer. It is structured as a message
|
||||
* to allow for additional fields such as locale for SIGN_MODE_TEXTUAL in the
|
||||
* future
|
||||
*/
|
||||
export interface ModeInfo_Single {
|
||||
/**
|
||||
* mode is the signing mode of the single signer
|
||||
*/
|
||||
mode: SignMode;
|
||||
}
|
||||
/**
|
||||
* Multi is the mode info for a multisig public key
|
||||
*/
|
||||
export interface ModeInfo_Multi {
|
||||
/**
|
||||
* bitarray specifies which keys within the multisig are signing
|
||||
*/
|
||||
bitarray?: CompactBitArray;
|
||||
/**
|
||||
* mode_infos is the corresponding modes of the signers of the multisig
|
||||
* which could include nested multisig public keys
|
||||
*/
|
||||
modeInfos: ModeInfo[];
|
||||
}
|
||||
/**
|
||||
* Fee includes the amount of coins paid in fees and the maximum
|
||||
* gas to be used by the transaction. The ratio yields an effective "gasprice",
|
||||
* which must be above some miminum to be accepted into the mempool.
|
||||
*/
|
||||
export interface Fee {
|
||||
/**
|
||||
* amount is the amount of coins to be paid as a fee
|
||||
*/
|
||||
amount: Coin[];
|
||||
/**
|
||||
* gas_limit is the maximum gas that can be used in transaction processing
|
||||
* before an out of gas error occurs
|
||||
*/
|
||||
gasLimit: Long;
|
||||
/**
|
||||
* if unset, the first signer is responsible for paying the fees. If set, the specified account must pay the fees.
|
||||
* the payer must be a tx signer (and thus have signed this field in AuthInfo).
|
||||
* setting this field does *not* change the ordering of required signers for the transaction.
|
||||
*/
|
||||
payer: string;
|
||||
/**
|
||||
* if set, the fee payer (either the first signer or the value of the payer field) requests that a fee grant be used
|
||||
* to pay fees instead of the fee payer's own balance. If an appropriate fee grant does not exist or the chain does
|
||||
* not support fee grants, this will fail
|
||||
*/
|
||||
granter: string;
|
||||
}
|
||||
export declare const protobufPackage = "cosmos.tx.v1beta1";
|
||||
export declare const Tx: {
|
||||
encode(message: Tx, writer?: Writer): Writer;
|
||||
decode(input: Uint8Array | Reader, length?: number | undefined): Tx;
|
||||
fromJSON(object: any): Tx;
|
||||
fromPartial(object: DeepPartial<Tx>): Tx;
|
||||
toJSON(message: Tx): unknown;
|
||||
};
|
||||
export declare const TxRaw: {
|
||||
encode(message: TxRaw, writer?: Writer): Writer;
|
||||
decode(input: Uint8Array | Reader, length?: number | undefined): TxRaw;
|
||||
fromJSON(object: any): TxRaw;
|
||||
fromPartial(object: DeepPartial<TxRaw>): TxRaw;
|
||||
toJSON(message: TxRaw): unknown;
|
||||
};
|
||||
export declare const SignDoc: {
|
||||
encode(message: SignDoc, writer?: Writer): Writer;
|
||||
decode(input: Uint8Array | Reader, length?: number | undefined): SignDoc;
|
||||
fromJSON(object: any): SignDoc;
|
||||
fromPartial(object: DeepPartial<SignDoc>): SignDoc;
|
||||
toJSON(message: SignDoc): unknown;
|
||||
};
|
||||
export declare const TxBody: {
|
||||
encode(message: TxBody, writer?: Writer): Writer;
|
||||
decode(input: Uint8Array | Reader, length?: number | undefined): TxBody;
|
||||
fromJSON(object: any): TxBody;
|
||||
fromPartial(object: DeepPartial<TxBody>): TxBody;
|
||||
toJSON(message: TxBody): unknown;
|
||||
};
|
||||
export declare const AuthInfo: {
|
||||
encode(message: AuthInfo, writer?: Writer): Writer;
|
||||
decode(input: Uint8Array | Reader, length?: number | undefined): AuthInfo;
|
||||
fromJSON(object: any): AuthInfo;
|
||||
fromPartial(object: DeepPartial<AuthInfo>): AuthInfo;
|
||||
toJSON(message: AuthInfo): unknown;
|
||||
};
|
||||
export declare const SignerInfo: {
|
||||
encode(message: SignerInfo, writer?: Writer): Writer;
|
||||
decode(input: Uint8Array | Reader, length?: number | undefined): SignerInfo;
|
||||
fromJSON(object: any): SignerInfo;
|
||||
fromPartial(object: DeepPartial<SignerInfo>): SignerInfo;
|
||||
toJSON(message: SignerInfo): unknown;
|
||||
};
|
||||
export declare const ModeInfo: {
|
||||
encode(message: ModeInfo, writer?: Writer): Writer;
|
||||
decode(input: Uint8Array | Reader, length?: number | undefined): ModeInfo;
|
||||
fromJSON(object: any): ModeInfo;
|
||||
fromPartial(object: DeepPartial<ModeInfo>): ModeInfo;
|
||||
toJSON(message: ModeInfo): unknown;
|
||||
};
|
||||
export declare const ModeInfo_Single: {
|
||||
encode(message: ModeInfo_Single, writer?: Writer): Writer;
|
||||
decode(input: Uint8Array | Reader, length?: number | undefined): ModeInfo_Single;
|
||||
fromJSON(object: any): ModeInfo_Single;
|
||||
fromPartial(object: DeepPartial<ModeInfo_Single>): ModeInfo_Single;
|
||||
toJSON(message: ModeInfo_Single): unknown;
|
||||
};
|
||||
export declare const ModeInfo_Multi: {
|
||||
encode(message: ModeInfo_Multi, writer?: Writer): Writer;
|
||||
decode(input: Uint8Array | Reader, length?: number | undefined): ModeInfo_Multi;
|
||||
fromJSON(object: any): ModeInfo_Multi;
|
||||
fromPartial(object: DeepPartial<ModeInfo_Multi>): ModeInfo_Multi;
|
||||
toJSON(message: ModeInfo_Multi): unknown;
|
||||
};
|
||||
export declare const Fee: {
|
||||
encode(message: Fee, writer?: Writer): Writer;
|
||||
decode(input: Uint8Array | Reader, length?: number | undefined): Fee;
|
||||
fromJSON(object: any): Fee;
|
||||
fromPartial(object: DeepPartial<Fee>): Fee;
|
||||
toJSON(message: Fee): unknown;
|
||||
};
|
||||
declare type Builtin = Date | Function | Uint8Array | string | number | undefined;
|
||||
export declare 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>;
|
||||
export {};
|
||||
1
packages/proto-signing/types/codec/cosmos_proto/cosmos.d.ts
vendored
Normal file
1
packages/proto-signing/types/codec/cosmos_proto/cosmos.d.ts
vendored
Normal file
@ -0,0 +1 @@
|
||||
export declare const protobufPackage = "cosmos_proto";
|
||||
File diff suppressed because it is too large
Load Diff
1
packages/proto-signing/types/codec/gogoproto/gogo.d.ts
vendored
Normal file
1
packages/proto-signing/types/codec/gogoproto/gogo.d.ts
vendored
Normal file
@ -0,0 +1 @@
|
||||
export declare const protobufPackage = "gogoproto";
|
||||
141
packages/proto-signing/types/codec/google/protobuf/any.d.ts
vendored
Normal file
141
packages/proto-signing/types/codec/google/protobuf/any.d.ts
vendored
Normal file
@ -0,0 +1,141 @@
|
||||
import { Writer, Reader } from "protobufjs/minimal";
|
||||
/**
|
||||
* `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 := ptypes.MarshalAny(foo)
|
||||
* ...
|
||||
* foo := &pb.Foo{}
|
||||
* if err := ptypes.UnmarshalAny(any, 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.
|
||||
*
|
||||
*/
|
||||
typeUrl: string;
|
||||
/**
|
||||
* Must be a valid serialized protocol buffer of the above specified type.
|
||||
*/
|
||||
value: Uint8Array;
|
||||
}
|
||||
export declare const protobufPackage = "google.protobuf";
|
||||
export declare const Any: {
|
||||
encode(message: Any, writer?: Writer): Writer;
|
||||
decode(input: Uint8Array | Reader, length?: number | undefined): Any;
|
||||
fromJSON(object: any): Any;
|
||||
fromPartial(object: DeepPartial<Any>): Any;
|
||||
toJSON(message: Any): unknown;
|
||||
};
|
||||
declare type Builtin = Date | Function | Uint8Array | string | number | undefined;
|
||||
export declare 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>;
|
||||
export {};
|
||||
1105
packages/proto-signing/types/codec/google/protobuf/descriptor.d.ts
vendored
Normal file
1105
packages/proto-signing/types/codec/google/protobuf/descriptor.d.ts
vendored
Normal file
File diff suppressed because it is too large
Load Diff
@ -1 +0,0 @@
|
||||
export * from "./generated/codecimpl";
|
||||
29
packages/proto-signing/types/codec/tendermint/crypto/keys.d.ts
vendored
Normal file
29
packages/proto-signing/types/codec/tendermint/crypto/keys.d.ts
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
import { Writer, Reader } from "protobufjs/minimal";
|
||||
/**
|
||||
* PublicKey defines the keys available for use with Tendermint Validators
|
||||
*/
|
||||
export interface PublicKey {
|
||||
ed25519: Uint8Array | undefined;
|
||||
secp256k1: Uint8Array | undefined;
|
||||
}
|
||||
export declare const protobufPackage = "tendermint.crypto";
|
||||
export declare const PublicKey: {
|
||||
encode(message: PublicKey, writer?: Writer): Writer;
|
||||
decode(input: Uint8Array | Reader, length?: number | undefined): PublicKey;
|
||||
fromJSON(object: any): PublicKey;
|
||||
fromPartial(object: DeepPartial<PublicKey>): PublicKey;
|
||||
toJSON(message: PublicKey): unknown;
|
||||
};
|
||||
declare type Builtin = Date | Function | Uint8Array | string | number | undefined;
|
||||
export declare 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>;
|
||||
export {};
|
||||
Loading…
Reference in New Issue
Block a user