Copy amino interface definitions to package - need some cleanup
This commit is contained in:
parent
34a74286b7
commit
b68fe1aa6a
@ -1,8 +1,59 @@
|
||||
import amino from "@tendermint/amino-js";
|
||||
|
||||
export type AminoTx = amino.Tx & { readonly value: amino.StdTx };
|
||||
// We will move all needed *interfaces* from amino-js here
|
||||
// This means bcp can just import them from here (if needed at all)
|
||||
export interface Tx {
|
||||
type: string;
|
||||
value: any;
|
||||
}
|
||||
|
||||
export function isAminoStdTx(txValue: amino.TxValue): txValue is amino.StdTx {
|
||||
export interface StdTx {
|
||||
readonly msg: ReadonlyArray<Msg>;
|
||||
readonly fee: StdFee;
|
||||
readonly signatures: ReadonlyArray<StdSignature>;
|
||||
readonly memo: string | undefined;
|
||||
}
|
||||
|
||||
export interface Msg {
|
||||
type: string;
|
||||
// TODO: make better union type
|
||||
readonly value: MsgSend;
|
||||
}
|
||||
|
||||
export interface MsgSend {
|
||||
/** Bech32 account address */
|
||||
readonly from_address: string;
|
||||
/** Bech32 account address */
|
||||
readonly to_address: string;
|
||||
readonly amount: ReadonlyArray<Coin>;
|
||||
}
|
||||
|
||||
|
||||
export interface StdFee {
|
||||
readonly amount: ReadonlyArray<Coin>;
|
||||
readonly gas: string;
|
||||
}
|
||||
|
||||
export interface Coin {
|
||||
denom: string;
|
||||
amount: string;
|
||||
}
|
||||
|
||||
export interface StdSignature {
|
||||
pub_key: PubKey;
|
||||
signature: string;
|
||||
}
|
||||
|
||||
export interface PubKey {
|
||||
/** Amino registered name, e.g. `"tendermint/PubKeySecp256k1"` */
|
||||
type: string;
|
||||
/** Base64-encoded key bytes */
|
||||
value: string;
|
||||
}
|
||||
|
||||
export type AminoTx = Tx & { readonly value: StdTx };
|
||||
|
||||
export function isAminoStdTx(txValue: unknown): txValue is amino.StdTx {
|
||||
const { memo, msg, fee, signatures } = txValue as amino.StdTx;
|
||||
return (
|
||||
typeof memo === "string" && Array.isArray(msg) && typeof fee === "object" && Array.isArray(signatures)
|
||||
|
||||
45
packages/sdk/types/types.d.ts
vendored
45
packages/sdk/types/types.d.ts
vendored
@ -1,8 +1,47 @@
|
||||
import amino from "@tendermint/amino-js";
|
||||
export declare type AminoTx = amino.Tx & {
|
||||
readonly value: amino.StdTx;
|
||||
export interface Tx {
|
||||
type: string;
|
||||
value: any;
|
||||
}
|
||||
export interface StdTx {
|
||||
readonly msg: ReadonlyArray<Msg>;
|
||||
readonly fee: StdFee;
|
||||
readonly signatures: ReadonlyArray<StdSignature>;
|
||||
readonly memo: string | undefined;
|
||||
}
|
||||
export interface Msg {
|
||||
type: string;
|
||||
readonly value: MsgSend;
|
||||
}
|
||||
export interface MsgSend {
|
||||
/** Bech32 account address */
|
||||
readonly from_address: string;
|
||||
/** Bech32 account address */
|
||||
readonly to_address: string;
|
||||
readonly amount: ReadonlyArray<Coin>;
|
||||
}
|
||||
export interface StdFee {
|
||||
readonly amount: ReadonlyArray<Coin>;
|
||||
readonly gas: string;
|
||||
}
|
||||
export interface Coin {
|
||||
denom: string;
|
||||
amount: string;
|
||||
}
|
||||
export interface StdSignature {
|
||||
pub_key: PubKey;
|
||||
signature: string;
|
||||
}
|
||||
export interface PubKey {
|
||||
/** Amino registered name, e.g. `"tendermint/PubKeySecp256k1"` */
|
||||
type: string;
|
||||
/** Base64-encoded key bytes */
|
||||
value: string;
|
||||
}
|
||||
export declare type AminoTx = Tx & {
|
||||
readonly value: StdTx;
|
||||
};
|
||||
export declare function isAminoStdTx(txValue: amino.TxValue): txValue is amino.StdTx;
|
||||
export declare function isAminoStdTx(txValue: unknown): txValue is amino.StdTx;
|
||||
export interface TokenInfo {
|
||||
readonly denom: string;
|
||||
readonly ticker: string;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user