-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feat: usePSP22Balances ignores active chain #47
Conversation
🦋 Changeset detectedLatest commit: ca9ce54 The changes in this PR will be included in the next version bump. Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
a717d90
to
c4caf85
Compare
d0c9881
to
25883e8
Compare
src/helpers/getPSP22Balances.ts
Outdated
let balance = new BN(0) | ||
|
||
const contract = psp22ContractMap[slug] | ||
const _balanceOf = await contract.query['psp22::balanceOf']( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When testing getPSP22Balance
(without hook) it throws:
TypeError: Cannot read properties of undefined (reading 'query')
I expect this happens here because it seems you never initialized the ContractPromise
's. Or do I miss something?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fixed.
src/helpers/getPSP22Balances.ts
Outdated
let balance = new BN(0) | ||
|
||
const contract = psp22ContractMap[slug] | ||
const _balanceOf = await contract.query['psp22::balanceOf']( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you not using our contractQuery
helper?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Replaced contract.query
with contractQuery
helper.
src/helpers/getPSP22Balances.ts
Outdated
let balance = new BN(0) | ||
|
||
const contract = psp22ContractMap[slug] | ||
const _balanceOf = await contract.query['psp22::balanceOf']( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are you not using our contractQuery
helper?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same as above.
…activeChain` before fetching PSP22 tokens balance. - Improve formats and add INW testnet contract address on `PSP22_ASSETS.json`.
…pplicable for the active chain.
… `contractQuery`
493022d
to
f1a00ae
Compare
Closes #42