Skip to content

Commit

Permalink
Fix types error
Browse files Browse the repository at this point in the history
  • Loading branch information
iKapitonau committed Jun 10, 2024
1 parent 31f7dfe commit 7f2cc35
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 12 deletions.
2 changes: 1 addition & 1 deletion src/query/ibc_packet_forward.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import {
Query,
QueryParamsRequest,
QueryParamsResponse,
} from "../grpc_gateway/ibc/applications/packetforward/v1/query.pb";
} from "../grpc_gateway/ibc-apps/packetforward/v1/query.pb";

export class IbcPacketForwardQuerier {
constructor(private url: string) {}
Expand Down
10 changes: 9 additions & 1 deletion src/tx/authz.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,10 +78,18 @@ function isGenericAuthorization(object: any): object is GenericAuthorization {
}

/**
* SendAuthorization allows the grantee to spend up to spend_limit coins from the granter's account.
* SendAuthorization allows the grantee to spend up to spend_limit coins from
* the granter's account.
*/
export interface SendAuthorization {
spend_limit: Coin[];
/**
* allow_list specifies an optional list of addresses to whom the grantee can send tokens on behalf of the
* granter. If omitted, any recipient is allowed.
*
* Since: cosmos-sdk 0.47
*/
allow_list: string[];
}

function isSendAuthorization(object: any): object is SendAuthorization {
Expand Down
18 changes: 11 additions & 7 deletions src/tx/compute.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { AminoMsg, Coin, Msg, ProtoMsg } from "./types";

export interface MsgInstantiateContractParams extends MsgParams {
/** The actor that signed the messages */
sender: string;
sender: Uint8Array;
/** The id of the contract's WASM code */
code_id: number | string;
/** A unique label across all contracts */
Expand All @@ -30,6 +30,7 @@ export interface MsgInstantiateContractParams extends MsgParams {
code_hash?: string;
/** Admin is an optional address that can execute migrations */
admin?: string;
sender_address: string;
}

export function getMissingCodeHashWarning(method: string): string {
Expand All @@ -38,7 +39,7 @@ export function getMissingCodeHashWarning(method: string): string {

/** Instantiate a contract from code id */
export class MsgInstantiateContract implements Msg {
public sender: string;
public sender: Uint8Array;
public codeId: string;
public label: string;
public initMsg: object;
Expand Down Expand Up @@ -88,7 +89,8 @@ export class MsgInstantiateContract implements Msg {
}

const msgContent = {
sender: addressToBytes(this.sender),
sender: this.sender,
sender_address: new TextDecoder().decode(this.sender),
code_id: this.codeId,
label: this.label,
init_msg: this.initMsgEncrypted,
Expand Down Expand Up @@ -137,7 +139,7 @@ export class MsgInstantiateContract implements Msg {

export interface MsgExecuteContractParams<T> extends MsgParams {
/** The actor that signed the messages */
sender: string;
sender: Uint8Array;
/** The contract's address */
contract_address: string;
/** The input message */
Expand All @@ -157,11 +159,12 @@ export interface MsgExecuteContractParams<T> extends MsgParams {
* - "0xAF74387E276BE8874F07BEC3A87023EE49B0E7EBE08178C49D0A49C3C98ED60E"
*/
code_hash?: string;
sender_address: string;
}

/** Execute a function on a contract */
export class MsgExecuteContract<T extends object> implements Msg {
public sender: string;
public sender: Uint8Array;
public contractAddress: string;
public msg: T;
private msgEncrypted: Uint8Array | null;
Expand Down Expand Up @@ -205,7 +208,8 @@ export class MsgExecuteContract<T extends object> implements Msg {
}

const msgContent = {
sender: addressToBytes(this.sender),
sender: this.sender,
sender_address: new TextDecoder().decode(this.sender),
contract: addressToBytes(this.contractAddress),
msg: this.msgEncrypted,
sent_funds: this.sentFunds,
Expand Down Expand Up @@ -288,7 +292,7 @@ export class MsgStoreCode implements Msg {
await this.gzipWasm();

const msgContent = {
sender: addressToBytes(this.sender),
sender: this.sender,
wasm_byte_code: this.wasmByteCode,
source: this.source,
builder: this.builder,
Expand Down
8 changes: 5 additions & 3 deletions src/tx/registration.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
import { toBase64 } from "@cosmjs/encoding";
import { MsgParams } from ".";
import { addressToBytes } from "..";
// import { addressToBytes } from "..";
import { AminoMsg, Msg, ProtoMsg } from "./types";

export interface RaAuthenticateParams extends MsgParams {
sender: string;
sender: Uint8Array;
certificate: Uint8Array;
sender_address: string;
}

/** RaAuthenticate defines a message to register an new node. */
Expand All @@ -14,8 +15,9 @@ export class RaAuthenticate implements Msg {

async toProto(): Promise<ProtoMsg> {
const msgContent = {
sender: addressToBytes(this.params.sender),
sender: this.params.sender,
certificate: this.params.certificate,
sender_address: new TextDecoder().decode(this.params.sender),
};

return {
Expand Down

0 comments on commit 7f2cc35

Please sign in to comment.