Skip to content

Instantly share code, notes, and snippets.

@sebastianscatularo
Last active June 26, 2023 17:50
Show Gist options
  • Save sebastianscatularo/57de13843f4ec86c283e12f6ef15fcf1 to your computer and use it in GitHub Desktop.
Save sebastianscatularo/57de13843f4ec86c283e12f6ef15fcf1 to your computer and use it in GitHub Desktop.

With version "@terra-money/terra.js": "3.1.3", we got the error:

rpc error: code = Unknown desc = unable to resolve type URL /terra.wasm.v1beta1.MsgExecuteContract: tx parse error [cosmos/[email protected]/x/auth/tx/decoder.go:42] With gas wanted: '0' and gas used: '13362' : unknown request

that makes sense, due that terra has updated cosmos-sdk module version

updating to "@terra-money/terra.js": "3.1.9", we got the error:

rpc error: code = Unknown desc = failed to execute message; message index: 0: Generic error: Querier system error: Unsupported query type: unknown terra query variant: execute wasm contract failed [CosmWasm/[email protected]/x/wasm/keeper/keeper.go:428] With gas wanted: '1000000000' and gas used: '377104' : unknown request

that seems to be pointing to:

https://github.com/cosmos/wasmd/blob/e0e6cc4b55b7e7b89e25d5ef445e4a838bf009f0/x/wasm/keeper/keeper.go#L428

import { LCDClient } from "@terra-money/terra.js";
import {
redeemOnTerra,
hexToUint8Array,
CONTRACTS,
} from "@certusone/wormhole-sdk";
(async () => {
try {
const terra = new LCDClient({
URL: "https://terra-classic-lcd.publicnode.com",
name: "mainnet",
chainID: "columbus-5",
isClassic: true, // *set to true to connect terra-classic chain*
});
const account = await terra.auth.accountInfo(
"terra1lh3wpcz9wxqfpzkdtxgyvj0jnkkwwgyvsl3d0z"
);
const vaa =
"01000000030d00f02afdf40ac02d7c414a865452f0ee6fbef829aed7c7edcfca41cdf9be62083867addadb35d77d72cc2652579a5095444c4628b634e0af80d7556556542540f7010145f068def50cc5c184ee11969bfdb37fc5bbc6b9f3c77c3fe64d0bfc8cb7d4ee00973ad1038c7a01b3466dcb62c083c0f272512cca9055aa0a37edfb3fbabb7700021e36a1b12cd9a5ffc750e93b1ad856842be83318693af93725e5a16367901c5f2efb94a32512f70429d3288bf5036aef58872539e28e459a35654520dee284de0103550246be40e28fb13e16557217c0a4b69b6d62a9dabee1491d3922d81c34428557b7be25e159b296babf3c6349fc172ae79ad7a24f3081847f354ea04bbb5d410105e8a3365662f3985533f51cdc3a8e27651b5d50dde3e8340dbbffd7f3349945c063bfd054806e5962a94067ce01de3c1fdf5f0876b2800161d77569c0c5e301c300064bb64e2d3a274501275d5a222f4799b899b568e2e9f13936842ff4efaecd4cbe29f1383cf6a8f7e033ad55f2c4b8296be387a5842fc412db4fcf84d0fd0501a8000adfc580b0b9c55b6969e95250ca53a0cf46cd93a24f310da9b88e571e5ad389440f562ddc012b966d93847bb03d5618c7fef5e1c14d6e1c0c9d6e0628570ab973010b2ebb53c133597cc1ba64cd3bb07dbd35da45bd8cc3c0d5a9d633eaab9cd2fe8a368c3890a141ea9e6f6ff4c22f9bafd0584fe0a66038664977e1ea58c0c0a0b0010c346385df737c9c347699f47e0e83cb5afd9798ff831d8119108cc904457b6f983c34be7b36ae79e01ce90be26a80cbc640f9c25d7a2e0c58aa0a3b31187f8e93000e4c7f4f3c0444fb037058914474272a9293086d6e7436efd799df4dd827f8ff3130b29cfaad7f3aed4a803147e18d642ce37beba05882da0637e1bcbaaa014b36010f910fb3668dd0afcf114d778e7544e7273379db7b45047ad6dce77267fc494b0a29959d9f833d65553c92d3c7bb9519d373af8814904e3e1266acded8026255c60010360c13daee74b2f712eaf756f41c8486b86f88a7c7142b498291837876d0a616714feb7be68fa08915edefeeb747ecb51c2538855d7988c19b365dd4c4071de20112d75e6aaa1a770bfab6eaec7ef1ad8a73d7cee940b1d39de5ff3f7be8878b30304109685197acc8daa56677fbcebfe2de0364cc6ed41c96f51526516d606419a5016489db32a849000000060000000000000000000000000e082f06ff657d94310cb8ce8b0d9a04541d80520000000000017985010100000000000000000000000000000000000000000000000000000004d99fb8720100000000000000000000000000000000000000000000000000000075757364000300000000000000000000000035cb3d90674fec2ca200158e0a6df0173d33a4a600030000000000000000000000000000000000000000000000000000000000000000";
const msg = await redeemOnTerra(
CONTRACTS.MAINNET.terra.token_bridge,
"terra1lh3wpcz9wxqfpzkdtxgyvj0jnkkwwgyvsl3d0z",
hexToUint8Array(vaa)
);
const gasPrices = {
uluna: 28.325,
};
const feeEstimate = await terra.tx.estimateFee(
[
{
sequenceNumber: account.getSequenceNumber(),
publicKey: account.getPublicKey(),
},
],
{
msgs: [msg],
memo: "Wormhole - Complete Transfer",
feeDenoms: ['uluna'],
gasPrices
}
);
console.log(feeEstimate);
} catch (err) {
console.trace(err);
}
})();
{
"dependencies": {
"@certusone/wormhole-sdk": "0.9.18",
"@terra-money/wallet-provider": "3.9.4",
"@terra-money/terra.js": "3.1.9"
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment