Skip to content

Commit

Permalink
PKG -- [sdk] Add argument to call getAccount from latest sealed block…
Browse files Browse the repository at this point in the history
… & use this for resolving sequence numbers (#1321)
  • Loading branch information
jribbink authored Jul 15, 2022
1 parent 1f9bd15 commit 422914b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/big-bats-sneeze.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@onflow/transport-http": patch
---

Make sendGetAccountAtLatestBlockRequest execute at latest sealed block instead of latest finalized block
4 changes: 1 addition & 3 deletions packages/transport-http/src/send-get-account.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,11 +31,9 @@ async function sendGetAccountAtBlockHeightRequest(ix, context, opts) {
async function sendGetAccountAtLatestBlockRequest(ix, context, opts) {
const httpRequest = opts.httpRequest || defaultHttpRequest

const height = ix.block?.isSealed ? "sealed" : "final"

const res = await httpRequest({
hostname: opts.node,
path: `/v1/accounts/${ix.account.addr}?block_height=${height}&expand=contracts,keys`,
path: `/v1/accounts/${ix.account.addr}?block_height=sealed&expand=contracts,keys`,
method: "GET",
body: null,
})
Expand Down
2 changes: 1 addition & 1 deletion packages/transport-http/src/send-get-account.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ describe("Send Get Account", () => {

expect(valueSent).toEqual({
hostname: "localhost",
path: "/v1/accounts/1654653399040a61?block_height=final&expand=contracts,keys",
path: "/v1/accounts/1654653399040a61?block_height=sealed&expand=contracts,keys",
method: "GET",
body: null,
})
Expand Down

0 comments on commit 422914b

Please sign in to comment.