stargate: Export some types and functions

This commit is contained in:
willclarktech 2020-12-02 18:03:15 +00:00
parent e61675f5ce
commit 17a433646a
No known key found for this signature in database
GPG Key ID: 551A86E2E398ADF7
4 changed files with 33 additions and 4 deletions

View File

@ -1,4 +1,5 @@
export * as codec from "./codec";
export { getMsgType, getMsgTypeUrl } from "./encoding";
export {
AuthExtension,
BankExtension,
@ -8,5 +9,17 @@ export {
setupBankExtension,
setupIbcExtension,
} from "./queries";
export { assertIsBroadcastTxSuccess, StargateClient } from "./stargateclient";
export {
Account,
accountFromProto,
assertIsBroadcastTxSuccess,
BroadcastTxFailure,
BroadcastTxResponse,
BroadcastTxSuccess,
coinFromProto,
IndexedTx,
isBroadcastTxFailure,
SequenceResponse,
StargateClient,
} from "./stargateclient";
export { SigningStargateClient } from "./signingstargateclient";

View File

@ -92,7 +92,7 @@ function uint64FromProto(input: number | Long | null | undefined): Uint64 {
return Uint64.fromString(input.toString());
}
function accountFromProto(input: cosmos.auth.v1beta1.IBaseAccount): Account {
export function accountFromProto(input: cosmos.auth.v1beta1.IBaseAccount): Account {
const { address, pubKey, accountNumber, sequence } = input;
const pubkey = decodePubkey(pubKey);
assert(address);
@ -104,7 +104,7 @@ function accountFromProto(input: cosmos.auth.v1beta1.IBaseAccount): Account {
};
}
function coinFromProto(input: cosmos.base.v1beta1.ICoin): Coin {
export function coinFromProto(input: cosmos.base.v1beta1.ICoin): Coin {
assertDefined(input.amount);
assertDefined(input.denom);
assert(input.amount !== null);

View File

@ -1,4 +1,5 @@
export * as codec from "./codec";
export { getMsgType, getMsgTypeUrl } from "./encoding";
export {
AuthExtension,
BankExtension,
@ -8,5 +9,17 @@ export {
setupBankExtension,
setupIbcExtension,
} from "./queries";
export { assertIsBroadcastTxSuccess, StargateClient } from "./stargateclient";
export {
Account,
accountFromProto,
assertIsBroadcastTxSuccess,
BroadcastTxFailure,
BroadcastTxResponse,
BroadcastTxSuccess,
coinFromProto,
IndexedTx,
isBroadcastTxFailure,
SequenceResponse,
StargateClient,
} from "./stargateclient";
export { SigningStargateClient } from "./signingstargateclient";

View File

@ -1,5 +1,6 @@
import { Block, Coin, PubKey, SearchTxFilter, SearchTxQuery } from "@cosmjs/launchpad";
import { Client as TendermintClient } from "@cosmjs/tendermint-rpc";
import { cosmos } from "./codec";
/** A transaction that is indexed as part of the transaction history */
export interface IndexedTx {
readonly height: number;
@ -43,6 +44,8 @@ export declare function isBroadcastTxSuccess(result: BroadcastTxResponse): resul
export declare function assertIsBroadcastTxSuccess(
result: BroadcastTxResponse,
): asserts result is BroadcastTxSuccess;
export declare function accountFromProto(input: cosmos.auth.v1beta1.IBaseAccount): Account;
export declare function coinFromProto(input: cosmos.base.v1beta1.ICoin): Coin;
/** Use for testing only */
export interface PrivateStargateClient {
readonly tmClient: TendermintClient;