Migrate BCP to @cosmwasm/cosmwasm and @cosmwasm/sdk38

This commit is contained in:
Simon Warta 2020-06-02 13:45:44 +02:00
parent efb90d1f65
commit ec9bae9028
10 changed files with 25 additions and 16 deletions

View File

@ -36,7 +36,8 @@
"pack-web": "yarn build-or-skip && webpack --mode development --config webpack.web.config.js"
},
"dependencies": {
"@cosmwasm/sdk": "^0.8.0",
"@cosmwasm/cosmwasm": "^0.8.0",
"@cosmwasm/sdk38": "^0.8.0",
"@iov/bcp": "^2.1.0",
"@iov/crypto": "^2.1.0",
"@iov/encoding": "^2.1.0",

View File

@ -1,4 +1,4 @@
import { pubkeyToAddress as sdkPubkeyToAddress, types } from "@cosmwasm/sdk";
import { pubkeyToAddress as sdkPubkeyToAddress, types } from "@cosmwasm/sdk38";
import { Address, Algorithm, PubkeyBundle } from "@iov/bcp";
import { Secp256k1 } from "@iov/crypto";
import { Encoding } from "@iov/encoding";

View File

@ -1,5 +1,5 @@
/* eslint-disable @typescript-eslint/camelcase */
import { makeSignBytes, marshalTx, unmarshalTx } from "@cosmwasm/sdk";
import { makeSignBytes, marshalTx, unmarshalTx } from "@cosmwasm/sdk38";
import {
Address,
ChainId,

View File

@ -1,4 +1,4 @@
import { decodeSignature } from "@cosmwasm/sdk";
import { decodeSignature } from "@cosmwasm/sdk38";
import {
Account,
Address,

View File

@ -1,4 +1,10 @@
import { CosmWasmClient, findSequenceForSignedTx, IndexedTx, SearchTxFilter, types } from "@cosmwasm/sdk";
import {
CosmWasmClient,
isMsgExecuteContract,
isMsgInstantiateContract,
isMsgStoreCode,
} from "@cosmwasm/cosmwasm";
import { findSequenceForSignedTx, IndexedTx, SearchTxFilter, types } from "@cosmwasm/sdk38";
import {
Account,
AccountQuery,
@ -476,9 +482,9 @@ export class CosmWasmConnection implements BlockchainConnection {
if (types.isMsgSend(firstMsg)) {
senderAddress = firstMsg.value.from_address;
} else if (
types.isMsgStoreCode(firstMsg) ||
types.isMsgInstantiateContract(firstMsg) ||
types.isMsgExecuteContract(firstMsg)
isMsgStoreCode(firstMsg) ||
isMsgInstantiateContract(firstMsg) ||
isMsgExecuteContract(firstMsg)
) {
senderAddress = firstMsg.value.sender;
} else {

View File

@ -1,5 +1,6 @@
/* eslint-disable @typescript-eslint/camelcase */
import { Coin, IndexedTx, types } from "@cosmwasm/sdk";
import { MsgExecuteContract } from "@cosmwasm/cosmwasm";
import { Coin, IndexedTx, types } from "@cosmwasm/sdk38";
import { Address, Algorithm, isSendTransaction, SendTransaction, TokenTicker } from "@iov/bcp";
import { Encoding } from "@iov/encoding";
import { assert } from "@iov/utils";
@ -164,7 +165,7 @@ describe("decode", () => {
});
it("works for ERC20 send transaction", () => {
const msg: types.MsgExecuteContract = {
const msg: MsgExecuteContract = {
type: "wasm/execute",
value: {
sender: "cosmos1h806c7khnvmjlywdrkdgk2vrayy2mmvf9rxk2r",
@ -218,7 +219,7 @@ describe("decode", () => {
});
it("works for ERC20 send transaction", () => {
const msg: types.MsgExecuteContract = {
const msg: MsgExecuteContract = {
type: "wasm/execute",
value: {
sender: "cosmos1h806c7khnvmjlywdrkdgk2vrayy2mmvf9rxk2r",

View File

@ -1,4 +1,5 @@
import { Coin, IndexedTx, types } from "@cosmwasm/sdk";
import { isMsgExecuteContract } from "@cosmwasm/cosmwasm";
import { Coin, IndexedTx, types } from "@cosmwasm/sdk38";
import {
Address,
Algorithm,
@ -92,7 +93,7 @@ export function parseMsg(
memo: memo,
};
return send;
} else if (types.isMsgExecuteContract(msg)) {
} else if (isMsgExecuteContract(msg)) {
const matchingTokenContract = erc20Tokens.find((t) => t.contractAddress === msg.value.contract);
if (!matchingTokenContract) {
return {

View File

@ -1,5 +1,5 @@
/* eslint-disable @typescript-eslint/camelcase */
import { Coin, encodeSecp256k1Pubkey, encodeSecp256k1Signature, types } from "@cosmwasm/sdk";
import { Coin, encodeSecp256k1Pubkey, encodeSecp256k1Signature, types } from "@cosmwasm/sdk38";
import {
Algorithm,
Amount,

View File

@ -1,4 +1,4 @@
import { Coin, IndexedTx, types } from "@cosmwasm/sdk";
import { Coin, IndexedTx, types } from "@cosmwasm/sdk38";
import {
Amount,
ChainId,

View File

@ -1,4 +1,4 @@
import { Coin, types } from "@cosmwasm/sdk";
import { Coin, types } from "@cosmwasm/sdk38";
import { Amount, Fee, FullSignature, PubkeyBundle, SignedTransaction, UnsignedTransaction } from "@iov/bcp";
import { BankToken, Erc20Token } from "./types";
export declare function encodePubkey(pubkey: PubkeyBundle): types.PubKey;