cosmwasm-stargate: Use coins from stargate package

This commit is contained in:
willclarktech 2021-03-23 15:53:54 +01:00
parent 43e4663f1e
commit cc164cd4c0
No known key found for this signature in database
GPG Key ID: 551A86E2E398ADF7
9 changed files with 33 additions and 33 deletions

View File

@ -1,7 +1,6 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { fromBase64, toUtf8 } from "@cosmjs/encoding";
import { coins } from "@cosmjs/launchpad";
import { AminoTypes } from "@cosmjs/stargate";
import { AminoTypes, coins } from "@cosmjs/stargate";
import Long from "long";
import {

View File

@ -1,7 +1,6 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { fromBase64, fromUtf8, toBase64, toUtf8 } from "@cosmjs/encoding";
import { Coin } from "@cosmjs/launchpad";
import { AminoConverter, coinFromProto } from "@cosmjs/stargate";
import { AminoConverter, Coin, coinFromProto } from "@cosmjs/stargate";
import { assertDefinedAndNotNull } from "@cosmjs/utils";
import Long from "long";

View File

@ -1,6 +1,5 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { fromBase64, toBase64 } from "@cosmjs/encoding";
import { Coin, coins } from "@cosmjs/launchpad";
import {
DirectSecp256k1HdWallet,
encodePubkey,
@ -8,7 +7,13 @@ import {
makeSignDoc,
Registry,
} from "@cosmjs/proto-signing";
import { BroadcastTxResponse, isBroadcastTxFailure, isBroadcastTxSuccess } from "@cosmjs/stargate";
import {
BroadcastTxResponse,
Coin,
coins,
isBroadcastTxFailure,
isBroadcastTxSuccess,
} from "@cosmjs/stargate";
import { Tx, TxRaw } from "@cosmjs/stargate/build/codec/cosmos/tx/v1beta1/tx";
import { assert, sleep } from "@cosmjs/utils";

View File

@ -2,7 +2,7 @@
import { Code } from "@cosmjs/cosmwasm-launchpad";
import { sha256 } from "@cosmjs/crypto";
import { Bech32, fromAscii, fromBase64, fromHex, toAscii, toBase64 } from "@cosmjs/encoding";
import { coins, logs, StdFee } from "@cosmjs/launchpad";
import { StdFee } from "@cosmjs/launchpad";
import { Int53 } from "@cosmjs/math";
import {
DirectSecp256k1HdWallet,
@ -11,7 +11,7 @@ import {
makeSignDoc,
Registry,
} from "@cosmjs/proto-signing";
import { assertIsBroadcastTxSuccess, parseRawLog } from "@cosmjs/stargate";
import { assertIsBroadcastTxSuccess, coins, logs } from "@cosmjs/stargate";
import { TxRaw } from "@cosmjs/stargate/build/codec/cosmos/tx/v1beta1/tx";
import { assert, sleep } from "@cosmjs/utils";
import { ReadonlyDate } from "readonly-date";
@ -210,7 +210,7 @@ describe("CosmWasmClient", () => {
const signedTx = Uint8Array.from(TxRaw.encode(txRaw).finish());
const result = await client.broadcastTx(signedTx);
assertIsBroadcastTxSuccess(result);
const amountAttr = logs.findAttribute(parseRawLog(result.rawLog), "transfer", "amount");
const amountAttr = logs.findAttribute(logs.parseRawLog(result.rawLog), "transfer", "amount");
expect(amountAttr.value).toEqual("1234567ucosm");
expect(result.transactionHash).toMatch(/^[0-9A-F]{64}$/);
});

View File

@ -9,7 +9,6 @@ import {
import { fromAscii, toHex } from "@cosmjs/encoding";
import {
Block,
Coin,
isSearchByHeightQuery,
isSearchBySentFromOrToQuery,
isSearchByTagsQuery,
@ -23,6 +22,7 @@ import {
AuthExtension,
BankExtension,
BroadcastTxResponse,
Coin,
coinFromProto,
IndexedTx,
QueryClient,

View File

@ -1,12 +1,15 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { sha256 } from "@cosmjs/crypto";
import { fromAscii, fromHex, toAscii, toHex } from "@cosmjs/encoding";
import { Coin, coin, coins, logs, StdFee } from "@cosmjs/launchpad";
import { StdFee } from "@cosmjs/launchpad";
import { DirectSecp256k1HdWallet, OfflineDirectSigner, Registry } from "@cosmjs/proto-signing";
import {
assertIsBroadcastTxSuccess,
BroadcastTxResponse,
parseRawLog,
Coin,
coin,
coins,
logs,
SigningStargateClient,
} from "@cosmjs/stargate";
import { assert, assertDefined } from "@cosmjs/utils";
@ -392,7 +395,7 @@ describe("WasmExtension", () => {
{
const result = await uploadContract(wallet, getHackatom());
assertIsBroadcastTxSuccess(result);
const parsedLogs = logs.parseLogs(parseRawLog(result.rawLog));
const parsedLogs = logs.parseLogs(logs.parseRawLog(result.rawLog));
const codeIdAttr = logs.findAttribute(parsedLogs, "message", "code_id");
codeId = Number.parseInt(codeIdAttr.value, 10);
expect(codeId).toBeGreaterThanOrEqual(1);
@ -412,7 +415,7 @@ describe("WasmExtension", () => {
{
const result = await instantiateContract(wallet, codeId, beneficiaryAddress, transferAmount);
assertIsBroadcastTxSuccess(result);
const parsedLogs = logs.parseLogs(parseRawLog(result.rawLog));
const parsedLogs = logs.parseLogs(logs.parseRawLog(result.rawLog));
const contractAddressAttr = logs.findAttribute(parsedLogs, "message", "contract_address");
contractAddress = contractAddressAttr.value;
const amountAttr = logs.findAttribute(parsedLogs, "transfer", "amount");
@ -437,7 +440,7 @@ describe("WasmExtension", () => {
{
const result = await executeContract(wallet, contractAddress, { release: {} });
assertIsBroadcastTxSuccess(result);
const parsedLogs = logs.parseLogs(parseRawLog(result.rawLog));
const parsedLogs = logs.parseLogs(logs.parseRawLog(result.rawLog));
const wasmEvent = parsedLogs.find(() => true)?.events.find((e) => e.type === "wasm");
assert(wasmEvent, "Event of type wasm expected");
expect(wasmEvent.attributes).toContain({ key: "action", value: "release" });

View File

@ -2,15 +2,9 @@
import { UploadMeta } from "@cosmjs/cosmwasm-launchpad";
import { sha256 } from "@cosmjs/crypto";
import { toHex } from "@cosmjs/encoding";
import {
coin,
coins,
GasPrice,
MsgDelegate as LaunchpadMsgDelegate,
Secp256k1HdWallet,
} from "@cosmjs/launchpad";
import { GasPrice, MsgDelegate as LaunchpadMsgDelegate, Secp256k1HdWallet } from "@cosmjs/launchpad";
import { DirectSecp256k1HdWallet, Registry } from "@cosmjs/proto-signing";
import { AminoTypes, assertIsBroadcastTxSuccess } from "@cosmjs/stargate";
import { AminoTypes, assertIsBroadcastTxSuccess, coin, coins } from "@cosmjs/stargate";
import { DeepPartial, MsgSend } from "@cosmjs/stargate/build/codec/cosmos/bank/v1beta1/tx";
import { Coin } from "@cosmjs/stargate/build/codec/cosmos/base/v1beta1/coin";
import { MsgDelegate } from "@cosmjs/stargate/build/codec/cosmos/staking/v1beta1/tx";

View File

@ -15,11 +15,9 @@ import { sha256 } from "@cosmjs/crypto";
import { fromBase64, toHex, toUtf8 } from "@cosmjs/encoding";
import {
buildFeeTable,
Coin,
CosmosFeeTable,
GasLimits,
GasPrice,
logs,
makeSignDoc as makeSignDocAmino,
StdFee,
} from "@cosmjs/launchpad";
@ -37,9 +35,10 @@ import {
AminoTypes,
BroadcastTxFailure,
BroadcastTxResponse,
Coin,
defaultRegistryTypes,
isBroadcastTxFailure,
parseRawLog,
logs,
} from "@cosmjs/stargate";
import { SignMode } from "@cosmjs/stargate/build/codec/cosmos/tx/signing/v1beta1/signing";
import { TxRaw } from "@cosmjs/stargate/build/codec/cosmos/tx/v1beta1/tx";
@ -165,7 +164,7 @@ export class SigningCosmWasmClient extends CosmWasmClient {
if (isBroadcastTxFailure(result)) {
throw new Error(createBroadcastTxErrorMessage(result));
}
const parsedLogs = parseRawLog(result.rawLog);
const parsedLogs = logs.parseRawLog(result.rawLog);
const codeIdAttr = logs.findAttribute(parsedLogs, "message", "code_id");
return {
originalSize: wasmCode.length,
@ -200,7 +199,7 @@ export class SigningCosmWasmClient extends CosmWasmClient {
if (isBroadcastTxFailure(result)) {
throw new Error(createBroadcastTxErrorMessage(result));
}
const parsedLogs = parseRawLog(result.rawLog);
const parsedLogs = logs.parseRawLog(result.rawLog);
const contractAddressAttr = logs.findAttribute(parsedLogs, "message", "contract_address");
return {
contractAddress: contractAddressAttr.value,
@ -228,7 +227,7 @@ export class SigningCosmWasmClient extends CosmWasmClient {
throw new Error(createBroadcastTxErrorMessage(result));
}
return {
logs: parseRawLog(result.rawLog),
logs: logs.parseRawLog(result.rawLog),
transactionHash: result.transactionHash,
};
}
@ -250,7 +249,7 @@ export class SigningCosmWasmClient extends CosmWasmClient {
throw new Error(createBroadcastTxErrorMessage(result));
}
return {
logs: parseRawLog(result.rawLog),
logs: logs.parseRawLog(result.rawLog),
transactionHash: result.transactionHash,
};
}
@ -276,7 +275,7 @@ export class SigningCosmWasmClient extends CosmWasmClient {
throw new Error(createBroadcastTxErrorMessage(result));
}
return {
logs: parseRawLog(result.rawLog),
logs: logs.parseRawLog(result.rawLog),
transactionHash: result.transactionHash,
};
}
@ -302,7 +301,7 @@ export class SigningCosmWasmClient extends CosmWasmClient {
throw new Error(createBroadcastTxErrorMessage(result));
}
return {
logs: parseRawLog(result.rawLog),
logs: logs.parseRawLog(result.rawLog),
transactionHash: result.transactionHash,
};
}

View File

@ -1,7 +1,7 @@
/* eslint-disable @typescript-eslint/naming-convention */
import { Bip39, EnglishMnemonic, Random, Secp256k1, Slip10, Slip10Curve } from "@cosmjs/crypto";
import { Bech32, fromBase64 } from "@cosmjs/encoding";
import { AminoSignResponse, coins, Secp256k1HdWallet, StdSignDoc } from "@cosmjs/launchpad";
import { AminoSignResponse, Secp256k1HdWallet, StdSignDoc } from "@cosmjs/launchpad";
import {
DirectSecp256k1HdWallet,
DirectSignResponse,
@ -11,6 +11,7 @@ import {
import {
AuthExtension,
BankExtension,
coins,
QueryClient,
setupAuthExtension,
setupBankExtension,