Update imports from bcp to sdk

This commit is contained in:
Ethan Frey 2020-02-03 17:11:44 +01:00
parent b68fe1aa6a
commit 8b262e6b12
9 changed files with 20 additions and 19 deletions

View File

@ -1,5 +1,5 @@
/* eslint-disable @typescript-eslint/camelcase */
import { RestClient, TokenInfo, TxsResponse } from "@cosmwasm/sdk";
import { RestClient, TxsResponse, types } from "@cosmwasm/sdk";
import {
Account,
AccountQuery,
@ -68,7 +68,7 @@ function buildQueryString({
return components.filter(Boolean).join("&");
}
export type TokenConfiguration = readonly (TokenInfo & { readonly name: string })[];
export type TokenConfiguration = readonly (types.TokenInfo & { readonly name: string })[];
export class CosmWasmConnection implements BlockchainConnection {
// we must know prefix and tokens a priori to understand the chain
@ -90,7 +90,7 @@ export class CosmWasmConnection implements BlockchainConnection {
private readonly restClient: RestClient;
private readonly chainData: ChainData;
private readonly _prefix: CosmosBech32Prefix;
private readonly tokenInfo: readonly TokenInfo[];
private readonly tokenInfo: readonly types.TokenInfo[];
// these are derived from arguments (cached for use in multiple functions)
private readonly primaryToken: Token;

View File

@ -1,4 +1,4 @@
import { coinToDecimal, isAminoStdTx, TxsResponse } from "@cosmwasm/sdk";
import { coinToDecimal, TxsResponse, types } from "@cosmwasm/sdk";
import {
Address,
Algorithm,
@ -96,7 +96,7 @@ export function parseFee(fee: amino.StdFee, tokens: TokenInfos): Fee {
export function parseTx(tx: amino.Tx, chainId: ChainId, nonce: Nonce, tokens: TokenInfos): SignedTransaction {
const txValue = tx.value;
if (!isAminoStdTx(txValue)) {
if (!types.isAminoStdTx(txValue)) {
throw new Error("Only Amino StdTx is supported");
}
if (txValue.msg.length !== 1) {

View File

@ -1,5 +1,5 @@
/* eslint-disable @typescript-eslint/camelcase */
import { AminoTx, decimalToCoin } from "@cosmwasm/sdk";
import { decimalToCoin, types } from "@cosmwasm/sdk";
import {
Algorithm,
Amount,
@ -67,7 +67,7 @@ export function encodeFullSignature(fullSignature: FullSignature): amino.StdSign
};
}
export function buildUnsignedTx(tx: UnsignedTransaction, tokens: TokenInfos): AminoTx {
export function buildUnsignedTx(tx: UnsignedTransaction, tokens: TokenInfos): types.AminoTx {
if (!isSendTransaction(tx)) {
throw new Error("Received transaction of unsupported kind");
}
@ -96,7 +96,7 @@ export function buildUnsignedTx(tx: UnsignedTransaction, tokens: TokenInfos): Am
};
}
export function buildSignedTx(tx: SignedTransaction, tokens: TokenInfos): AminoTx {
export function buildSignedTx(tx: SignedTransaction, tokens: TokenInfos): types.AminoTx {
const built = buildUnsignedTx(tx.transaction, tokens);
return {
...built,

View File

@ -1,7 +1,7 @@
import { TokenInfo } from "@cosmwasm/sdk";
import { types } from "@cosmwasm/sdk";
import { Nonce } from "@iov/bcp";
export type TokenInfos = ReadonlyArray<TokenInfo>;
export type TokenInfos = ReadonlyArray<types.TokenInfo>;
// tslint:disable-next-line:no-bitwise
const maxAcct = 1 << 23;

View File

@ -1,4 +1,4 @@
import { TokenInfo } from "@cosmwasm/sdk";
import { types } from "@cosmwasm/sdk";
import {
Account,
AccountQuery,
@ -22,7 +22,7 @@ import {
} from "@iov/bcp";
import { Stream } from "xstream";
import { CosmosBech32Prefix } from "./address";
export declare type TokenConfiguration = readonly (TokenInfo & {
export declare type TokenConfiguration = readonly (types.TokenInfo & {
readonly name: string;
})[];
export declare class CosmWasmConnection implements BlockchainConnection {

View File

@ -1,4 +1,4 @@
import { AminoTx } from "@cosmwasm/sdk";
import { types } from "@cosmwasm/sdk";
import { Amount, Fee, FullSignature, PubkeyBundle, SignedTransaction, UnsignedTransaction } from "@iov/bcp";
import amino from "@tendermint/amino-js";
import { TokenInfos } from "./types";
@ -6,5 +6,5 @@ export declare function encodePubkey(pubkey: PubkeyBundle): amino.PubKey;
export declare function encodeAmount(amount: Amount, tokens: TokenInfos): amino.Coin;
export declare function encodeFee(fee: Fee, tokens: TokenInfos): amino.StdFee;
export declare function encodeFullSignature(fullSignature: FullSignature): amino.StdSignature;
export declare function buildUnsignedTx(tx: UnsignedTransaction, tokens: TokenInfos): AminoTx;
export declare function buildSignedTx(tx: SignedTransaction, tokens: TokenInfos): AminoTx;
export declare function buildUnsignedTx(tx: UnsignedTransaction, tokens: TokenInfos): types.AminoTx;
export declare function buildSignedTx(tx: SignedTransaction, tokens: TokenInfos): types.AminoTx;

View File

@ -1,6 +1,6 @@
import { TokenInfo } from "@cosmwasm/sdk";
import { types } from "@cosmwasm/sdk";
import { Nonce } from "@iov/bcp";
export declare type TokenInfos = ReadonlyArray<TokenInfo>;
export declare type TokenInfos = ReadonlyArray<types.TokenInfo>;
export interface NonceInfo {
readonly account_number: string;
readonly sequence: string;

View File

@ -1,4 +1,5 @@
export { coinToDecimal } from "./decoding";
export { decimalToCoin } from "./encoding";
export { RestClient, TxsResponse } from "./restclient";
export { AminoTx, isAminoStdTx, TokenInfo } from "./types";
// export { AminoTx, isAminoStdTx, TokenInfo } from "./types";
export { default as types } from "./types";

View File

@ -1,4 +1,4 @@
export { coinToDecimal } from "./decoding";
export { decimalToCoin } from "./encoding";
export { RestClient, TxsResponse } from "./restclient";
export { AminoTx, isAminoStdTx, TokenInfo } from "./types";
export { default as types } from "./types";