Skip to content

Commit

Permalink
Return value from array on subscription (#262)
Browse files Browse the repository at this point in the history
  • Loading branch information
jacogr authored and amaury1093 committed Oct 12, 2018
1 parent dc5802a commit a47485c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/api/src/promise/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,8 @@ export default class ApiPromise extends ApiBase<Rpc, QueryableStorage, Submittab

return this.rpc.state.storage(
[[method, args.length === 1 ? undefined : args[0]]],
args[args.length - 1]
(result: Array<Base | null | undefined> = []) =>
args[args.length - 1](result[0])
);
};

Expand Down
6 changes: 6 additions & 0 deletions packages/types/src/codec/UInt.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,12 @@ export default class UInt extends Base<BN> {
: this.raw.div(bnToBn(other));
}

eq (other: UInt | BN | number): boolean {
return other instanceof UInt
? this.raw.eq(other.raw)
: this.raw.eq(bnToBn(other));
}

isZero (): boolean {
return this.raw.isZero();
}
Expand Down

0 comments on commit a47485c

Please sign in to comment.