Deduplicate and sort some types

This commit is contained in:
Simon Warta
2020-06-02 16:13:34 +02:00
parent 0fe3e5eb4a
commit 5da7bbc93c
24 changed files with 111 additions and 164 deletions
+2 -2
View File
@@ -50,7 +50,7 @@ const { account_number, sequence } = (await client.authAccounts(faucetAddress)).
// Craft a send transaction
const emptyAddress = Bech32.encode("cosmos", Random.getBytes(20));
const memo = "My first contract on chain";
const sendTokensMsg: types.MsgSend = {
const sendTokensMsg: MsgSend = {
type: "cosmos-sdk/MsgSend",
value: {
from_address: faucetAddress,
@@ -66,7 +66,7 @@ const sendTokensMsg: types.MsgSend = {
const signBytes = makeSignBytes([sendTokensMsg], defaultFee, defaultNetworkId, memo, account_number, sequence);
const signature = await pen.sign(signBytes);
const signedTx: types.StdTx = {
const signedTx: StdTx = {
msg: [sendTokensMsg],
fee: defaultFee,
memo: memo,
+1 -1
View File
@@ -1,6 +1,6 @@
const defaultHttpUrl = "http://localhost:1317";
const defaultNetworkId = "testing";
const defaultFee: types.StdFee = {
const defaultFee: StdFee = {
amount: [
{
amount: "5000",
+4 -4
View File
@@ -5,7 +5,7 @@ export type HandleMsg =
msgs: (
| {
send: {
amount: types.Coin[];
amount: Coin[];
from_address: string;
to_address: string;
};
@@ -15,7 +15,7 @@ export type HandleMsg =
contract_addr: string;
// this had to be changed - is Base64 encoded string
msg: string;
send: types.Coin[] | null;
send: Coin[] | null;
};
}
| {
@@ -53,7 +53,7 @@ export interface State {
const base64Msg = (msg: object): string => toBase64(toUtf8(JSON.stringify(msg)));
const sendMsg = (from_address: string, to_address: string, amount: types.Coin[]) => {
const sendMsg = (from_address: string, to_address: string, amount: Coin[]) => {
return {
send: {
from_address,
@@ -63,7 +63,7 @@ const sendMsg = (from_address: string, to_address: string, amount: types.Coin[])
};
}
const contractMsg = (contract_addr: string, msg: object, amount?: types.Coin[]) => {
const contractMsg = (contract_addr: string, msg: object, amount?: Coin[]) => {
return {
contract: {
contract_addr,
+8 -2
View File
@@ -62,18 +62,24 @@ export function main(originalArgs: readonly string[]): void {
[
"@cosmwasm/sdk38",
[
"coin",
"coins",
"encodeSecp256k1Pubkey",
"encodeSecp256k1Signature",
"logs",
"makeCosmoshubPath",
"makeSignBytes",
"marshalTx",
"IndexedTx",
"Coin",
"MsgSend",
"Pen",
"PubKey",
"pubkeyToAddress",
"RestClient",
"Secp256k1Pen",
"types",
"IndexedTx",
"StdFee",
"StdTx",
],
],
[