-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wip: refactor(cw): converting to @hackbg/borshest
- Loading branch information
Showing
9 changed files
with
832 additions
and
837 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
import * as Borsher from 'borsher' | ||
import { decode, struct, u64 } from '@hackbg/borshest' | ||
|
||
const Schema = Borsher.BorshSchema | ||
|
||
type Connection = { abciQuery: (path: string) => Promise<Uint8Array> } | ||
|
||
export async function getCurrentEpoch (connection: Connection) { | ||
const binary = await connection.abciQuery("/shell/epoch") | ||
return Borsher.borshDeserialize(epochSchema, binary) | ||
return decode(epochSchema, binary) | ||
} | ||
|
||
const epochSchema = Schema.Struct({ | ||
epoch: Schema.u64 | ||
}) | ||
const epochSchema = struct(["epoch", u64]) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.