bug: Create Pair page cannot query contract info for valid contracts #13
Labels
No labels
agent:fix_bugfix
agent:fix_conflicts
agent:fix_security
agent:gap_analysis
agent:implement
agent:implement
agent:implement
agent:open_issues
agent:ready
agent:research
agent:security_audit
agent:verify
architecture
backend
blocker:hybrid
blocker:launch
blocker:limit-orders
blocker:v2
block:log_only
block:security
bug
ci
contracts
correctness
deploy
dev
devops
docs
documentation
duplicate
e2e
enhancement
epic
feature
frontend
functional-completion
gas
good first issue
governance
help wanted
high-risk
hooks
hybrid
indexer
infra
infrastructure
integrators
invalid
launch-blocker
limit-orders
localnet
localterra
low priority
missing-implementation
needs-design
ops
performance
priority
high
priority
medium
product
qa
QA
question
ready
ready
research
scripts
security
security-hardening
smartcontracts
tech-debt
testing
ux
UX
v2
verification
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
code/cl8y-dex-terraclassic#13
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Description
On the Create Pair page, entering valid deployed CW20 token addresses shows 'COULD NOT QUERY CONTRACT INFO' for both tokens. The query to the LCD endpoint for contract_info fails even though the contracts are deployed and functional (swaps work fine).
Expected
Valid CW20 contract addresses should return contract info including code_id, allowing the whitelist check to proceed.
Steps to Reproduce
Technical
Query goes to TERRA_LCD_URL/cosmwasm/wasm/v1/contract/{addr}/smart/{base64 of contract_info}
The LCD may not support this query on localterra, or CORS may be blocking the browser request.
Impact
Users cannot verify if token contracts are valid or whitelisted before creating pairs.
Root cause: CW20 mintable contracts don't support the
contract_infosmart query. The frontend should use the chain-level contract info endpoint instead:GET /cosmwasm/wasm/v1/contract/{address}This returns code_id, creator, admin, etc. without going through the contract's QueryMsg handler. The current code in CreatePairPage.tsx queries
{ contract_info: {} }as a smart query which the CW20 contract rejects.Fix: In queries.ts or CreatePairPage.tsx, add a function that fetches
TERRA_LCD_URL/cosmwasm/wasm/v1/contract/{address}and readscontract_info.code_idfrom the response.Fix committed in
409eb4conmain:getChainContractInfo()inqueries.tsthat calls the chain-level endpointGET /cosmwasm/wasm/v1/contract/{address}instead of sending a smart query through the contract's QueryMsg handler.CreatePairPage.tsxto use this new function for the whitelist code_id check.This avoids the
{ contract_info: {} }smart query that CW20 contracts don't support.@Brouie — could you verify this works on your end? Leaving the issue open until confirmed.
mentioned in commit
409eb4c50cVerified fixed — contract info query now uses chain-level endpoint, shows Code ID whitelisted.
mentioned in issue #1
mentioned in issue #18
mentioned in commit
25f8b8faa7mentioned in merge request !767
mentioned in issue #297
mentioned in issue #512
mentioned in issue #658