Skip to content

Commit

Permalink
sdk/js-query: fix SolanaPda mock for bad rentEpoch parsing
Browse files Browse the repository at this point in the history
  • Loading branch information
evan-gray committed Mar 11, 2024
1 parent 2d141a1 commit 405bd58
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
8 changes: 8 additions & 0 deletions sdk/js-query/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## 0.0.12

Fix SolanaPda mock for bad rentEpoch parsing

## 0.0.11

Add Solana PDA support

## 0.0.10

Fix SolanaAccount mock for bad rentEpoch parsing
Expand Down
4 changes: 2 additions & 2 deletions sdk/js-query/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 sdk/js-query/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@wormhole-foundation/wormhole-query-sdk",
"version": "0.0.11",
"version": "0.0.12",
"description": "Wormhole cross-chain query SDK",
"homepage": "https://wormhole.com",
"main": "./lib/cjs/index.js",
Expand Down
9 changes: 8 additions & 1 deletion sdk/js-query/src/mock/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -559,11 +559,18 @@ export class QueryProxyMock {
let results: SolanaPdaResult[] = [];
let idx = 0;
response.data.result.value.forEach((val) => {
const rentEpoch = BigInt(val.rentEpoch);
results.push({
account: Uint8Array.from(base58.decode(accounts[idx].toString())),
bump: bumps[idx],
lamports: BigInt(val.lamports),
rentEpoch: BigInt(val.rentEpoch),
rentEpoch:
// this is a band-aid for an axios / JSON.parse effect where numbers > Number.MAX_SAFE_INTEGER are not parsed correctly
// e.g. 18446744073709551615 becomes 18446744073709552000
// https://github.com/axios/axios/issues/4846
rentEpoch > SOLANA_MAX_RENT_EPOCH
? SOLANA_MAX_RENT_EPOCH
: rentEpoch,
executable: Boolean(val.executable),
owner: Uint8Array.from(base58.decode(val.owner.toString())),
data: Uint8Array.from(
Expand Down

0 comments on commit 405bd58

Please sign in to comment.