Skip to content

Commit

Permalink
Fix ABCI params
Browse files Browse the repository at this point in the history
  • Loading branch information
joon9823 committed May 14, 2024
1 parent e132268 commit 3ba32c3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 13 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@initia/initia.js",
"version": "0.1.49",
"version": "0.1.50",
"description": "The JavaScript SDK for Initia",
"license": "MIT",
"author": "InitiaLabs",
Expand Down
28 changes: 18 additions & 10 deletions src/core/consensus/ABCIParams.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,29 +10,37 @@ export class ABCIParams extends JSONSerializable<
/**
* @param vote_extensions_enable_height
*/
constructor(public vote_extensions_enable_height: number) {
constructor(public vote_extensions_enable_height?: number) {
super();
}

public static fromAmino(data: ABCIParams.Amino): ABCIParams {
return new ABCIParams(Number.parseInt(data.vote_extensions_enable_height));
return new ABCIParams(
data.vote_extensions_enable_height
? Number.parseInt(data.vote_extensions_enable_height)
: undefined
);
}

public toAmino(): ABCIParams.Amino {
return {
vote_extensions_enable_height:
this.vote_extensions_enable_height.toString(),
this.vote_extensions_enable_height?.toString(),
};
}

public static fromData(data: ABCIParams.Data): ABCIParams {
return new ABCIParams(Number.parseInt(data.vote_extensions_enable_height));
return new ABCIParams(
data.vote_extensions_enable_height
? Number.parseInt(data.vote_extensions_enable_height)
: undefined
);
}

public toData(): ABCIParams.Data {
return {
vote_extensions_enable_height:
this.vote_extensions_enable_height.toString(),
this.vote_extensions_enable_height?.toString(),
};
}

Expand All @@ -42,20 +50,20 @@ export class ABCIParams extends JSONSerializable<

public toProto(): ABCIParams.Proto {
return ABCIParams_pb.fromPartial({
voteExtensionsEnableHeight: Long.fromNumber(
this.vote_extensions_enable_height
),
voteExtensionsEnableHeight: this.vote_extensions_enable_height
? Long.fromNumber(this.vote_extensions_enable_height)
: undefined,
});
}
}

export namespace ABCIParams {
export interface Amino {
vote_extensions_enable_height: string;
vote_extensions_enable_height?: string;
}

export interface Data {
vote_extensions_enable_height: string;
vote_extensions_enable_height?: string;
}

export type Proto = ABCIParams_pb;
Expand Down

0 comments on commit 3ba32c3

Please sign in to comment.