I connect trust wallet like this:
//**Connect wallet:**
import WalletConnect from "@walletconnect/client";
import QRCodeModal from "@walletconnect/qrcode-modal";
const connector = new WalletConnect({
bridge: "https://bridge.walletconnect.org", // Required
qrcodeModal: QRCodeModal,
});
document.onreadystatechange = () => {
// Create a connector
// Check if connection is already established
if (!connector.connected) {
// create new session
connector.createSession();
}
}
When wallet connected I tried to sign a transfer message to transfer coins (I've tried with binance chain and thorchain - not working)
This is example how I sign msg:
const network = 931; // thorchain(rune)
const tx = {
fee: {
amounts: [
{
denom: "rune",
amount: "0.01"
}
],
gas: "2000000"
},
memo:"test",
"messages":[{
"sendCoinsMessage": {
fromAddress: 'thor1mkda02h8hsevykxwnnxs93tgtvgtz5djxteat0',
toAddress: "thor1mkda02h8hsevykxwnnxs93tgtvgtz5djxteat0",
amounts: [
{
denom: "rune",
amount: "1"
}
],
}
}]//end
};
Then I format request and sign it:
const request = self.connector._formatRequest({
method: 'trust_signTransaction',
params: [
{
network,
transaction: JSON.stringify(tx),
},
],
});
connector
._sendCallRequest(request)
.then(result => {
// Returns transaction signed in json or encoded format
console.log(result);
})
.catch(error => {
// Error returned when rejected
console.log('error')
console.error(error);
});
},
This is what I see in my trust wallet:
As a response I get from console this:
{"mode":"block","tx":{"fee":{"amount":[],"gas":"0"},"memo":"","msg":[],"signatures":[{"pub_key":{"type":"tendermint/PubKeySecp256k1","value":"A2yB9NhfIeEwTEDbs0ssZQcqtL/OWGuHqooeFllERot3"},"signature":"+kO2W2MfcSBwgLUF3zJUQK4e01YvIGXK8juzojEkE/RrVgrZJPRsthweuto4FJ1QK/MjUWuGlJiC+MjktlBexA=="}]}}
But the transaction is not sent to blockchain (If I go to blockchain exlorer I will not find it) Also as you can notice in the response from console fee and gas always 0
What do I do?
UPD I have also tried method trust_sendTransaction instead of trust_signTransaction but didn't help