Skip to content
This repository has been archived by the owner on Oct 13, 2023. It is now read-only.

Keplr wallet signing. #106

Open
SuperVenus0725 opened this issue Feb 11, 2023 · 0 comments
Open

Keplr wallet signing. #106

SuperVenus0725 opened this issue Feb 11, 2023 · 0 comments

Comments

@SuperVenus0725
Copy link

let sign = await window?.keplr?.signDirect(
chain.cosmosChainId,
sender.accountAddress,
{
bodyBytes: msg.signDirect.body.serializeBinary(),
authInfoBytes: msg.signDirect.authInfo.serializeBinary(),
chainId: chain.cosmosChainId,
accountNumber: new Long(sender.accountNumber),
},
// @ts-expect-error the types are not updated on Keplr side
{ isEthereum: true },
)

if (sign !== undefined) {
let rawTx = createTxRaw(sign.signed.bodyBytes, sign.signed.authInfoBytes, [
new Uint8Array(Buffer.from(sign.signature.signature, 'base64')),
])

// Broadcast it
const postOptions = {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: generatePostBodyBroadcast(rawTx),
}

let broadcastPost = await fetch(
https://rest.cosmos.directory/evmos${generateEndpointBroadcast()},
postOptions,
)
let response = await broadcastPost.json()
console.log("response", response)
};

This is the code which I tried to run ibc transfer.
but how can we use this code on mobile version?
because there is no window.keplr on the mobile.
Please help me how can we run the transactions using keplr mobile,

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants
@SuperVenus0725 and others