multiquery
On-chain query batcher for CosmWasm. Similar to SCB 10X's multicall contract, but supports any serializable query request, not limited to WASM queries.
Example
Query:
const response = await terra.wasm.contractQuery(MULTIQUERY, [
{
bank: {
all_balances: {
address: RED_BANK,
},
},
},
{
wasm: {
smart: {
contract_addr: MARS_TOKEN,
msg: encodeBase64({ token_info: {} }),
},
},
},
]);
const responseParsed = response.map((item) => { return decodeBase64(item.data); });
console.log(responseParsed);
Response:
[
{
"amount": [
{
"denom": "uluna",
"amount": "622641301593"
},
{
"denom": "uusd",
"amount": "169517320897682"
}
]
},
{
"name": "MARS",
"symbol": "MARS",
"decimals": 6,
"total_supply": "1000000000000000"
}
]
See ./scripts/3_query_example.ts
for details.
Deployment
Network | Address |
---|---|
Columbus-5 | terra1swrywzkphty20e2uzpy582xu836luw0e5yp25m |
Bombay-12 | terra1t5twwglq9vlmf0pz8yadmd6gr6es2gfc4fkjww |
License
Contents of this repository are open source under GNU General Public License v3 or later.