Skip to content

Commit

Permalink
remove deps in helpers
Browse files Browse the repository at this point in the history
  • Loading branch information
Zetazzz committed Oct 7, 2024
1 parent 9f12f72 commit 1ee8781
Showing 1 changed file with 82 additions and 3 deletions.
85 changes: 82 additions & 3 deletions examples/interchainjs/src/codegen/helpers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
*/

import { BinaryReader, BinaryWriter } from "./binary";
import { StdFee, DeliverTxResponse } from '@interchainjs/cosmos-types/types';
import { AminoConverter, Encoder, Message } from '@interchainjs/cosmos/types/signer';


declare var self: any | undefined;
declare var window: any | undefined;
Expand Down Expand Up @@ -335,4 +332,86 @@ export function buildTx<TMsg>(opts: TxBuilderOptions) {
];
return client.signAndBroadcast!(signerAddress, data, fee, memo);
};
}

export interface Coin {
denom: string;
amount: string;
}

export interface StdFee {
amount: Coin[];
gas: string;
/** The granter address that is used for paying with feegrants */
granter?: string;
/** The fee payer address. The payer must have signed the transaction. */
payer?: string;
}

/**
* The response after successfully broadcasting a transaction.
* Success or failure refer to the execution result.
*/
export interface DeliverTxResponse {
height: number;
/** The position of the transaction within the block. This is a 0-based index. */
txIndex: number;
/** Error code. The transaction suceeded if and only if code is 0. */
code: number;
transactionHash: string;
events: Event[];
/**
* A string-based log document.
*
* This currently seems to merge attributes of multiple events into one event per type
* (https://github.com/tendermint/tendermint/issues/9595). You might want to use the `events`
* field instead.
*/
rawLog?: string;
/** @deprecated Use `msgResponses` instead. */
data?: MsgData[];
/**
* The message responses of the [TxMsgData](https://github.com/cosmos/cosmos-sdk/blob/v0.46.3/proto/cosmos/base/abci/v1beta1/abci.proto#L128-L140)
* as `Any`s.
* This field is an empty list for chains running Cosmos SDK < 0.46.
*/
msgResponses: Array<{
typeUrl: string;
value: Uint8Array;
}>;
gasUsed: bigint;
gasWanted: bigint;
}

export interface MsgData {
msgType: string;
data: Uint8Array;
}

export interface Attribute {
key: string;
value: string;
index: boolean;
}
export interface Event {
type: string;
attributes: Attribute[];
}

export interface Message<T = any> {
typeUrl: string;
value: T;
}

export interface Encoder {
typeUrl: string;
fromPartial: (data: any) => any;
encode: (data: any) => Uint8Array;
}

export interface AminoConverter {
typeUrl: string;
aminoType: string;
fromAmino: (data: any) => any;
toAmino: (data: any) => any;
}

0 comments on commit 1ee8781

Please sign in to comment.