bug: Create Pair page cannot query contract info for valid contracts #13

Closed
opened 2026-03-12 05:09:22 +00:00 by Brouie · 11 comments
Brouie commented 2026-03-12 05:09:22 +00:00 (Migrated from gitlab.com)

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

  1. Go to Create Pair page
  2. Enter a valid deployed token address (e.g. EMBER)
  3. 'COULD NOT QUERY CONTRACT INFO' shown

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.

## 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 1. Go to Create Pair page 2. Enter a valid deployed token address (e.g. EMBER) 3. 'COULD NOT QUERY CONTRACT INFO' shown ## 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.
Brouie commented 2026-03-12 05:10:04 +00:00 (Migrated from gitlab.com)

Root cause: CW20 mintable contracts don't support the contract_info smart 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 reads contract_info.code_id from the response.

Root cause: CW20 mintable contracts don't support the `contract_info` smart 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 reads `contract_info.code_id` from the response.
PlasticDigits commented 2026-03-12 07:03:26 +00:00 (Migrated from gitlab.com)

Fix committed in 409eb4c on main:

  • Added getChainContractInfo() in queries.ts that calls the chain-level endpoint GET /cosmwasm/wasm/v1/contract/{address} instead of sending a smart query through the contract's QueryMsg handler.
  • Updated CreatePairPage.tsx to 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.

Fix committed in 409eb4c on `main`: - Added `getChainContractInfo()` in `queries.ts` that calls the chain-level endpoint `GET /cosmwasm/wasm/v1/contract/{address}` instead of sending a smart query through the contract's QueryMsg handler. - Updated `CreatePairPage.tsx` to 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.
PlasticDigits commented 2026-03-12 11:49:16 +00:00 (Migrated from gitlab.com)

mentioned in commit 409eb4c50c

mentioned in commit 409eb4c50ccf9021fe7e0b0dd6246379a6951117
Brouie (Migrated from gitlab.com) closed this issue 2026-03-13 01:56:43 +00:00
Brouie commented 2026-03-13 01:56:45 +00:00 (Migrated from gitlab.com)

Verified fixed — contract info query now uses chain-level endpoint, shows Code ID whitelisted.

Verified fixed — contract info query now uses chain-level endpoint, shows Code ID whitelisted.
Brouie commented 2026-03-13 02:02:26 +00:00 (Migrated from gitlab.com)

mentioned in issue #1

mentioned in issue #1
Brouie commented 2026-03-13 04:22:44 +00:00 (Migrated from gitlab.com)

mentioned in issue #18

mentioned in issue #18
ghost1 commented 2026-06-05 04:40:24 +00:00 (Migrated from gitlab.com)

mentioned in commit 25f8b8faa7

mentioned in commit 25f8b8faa7cfaf9644639e6070a429a5ca019859
PlasticDigits commented 2026-06-05 04:41:22 +00:00 (Migrated from gitlab.com)

mentioned in merge request !767

mentioned in merge request !767
PlasticDigits commented 2026-06-05 11:03:56 +00:00 (Migrated from gitlab.com)

mentioned in issue #297

mentioned in issue #297
PlasticDigits commented 2026-08-15 12:02:23 +00:00 (Migrated from gitlab.com)

mentioned in issue #512

mentioned in issue #512
PlasticDigits commented 2026-08-26 04:08:01 +00:00 (Migrated from gitlab.com)

mentioned in issue #658

mentioned in issue #658
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
code/cl8y-dex-terraclassic#13
No description provided.