Mobile Wallets
Integration
WalletConnect 1.0(Deprecated)
Sign Transaction

Sign Transactions

Sign transaction using Cosmostation Mobile Wallet via WalletConnect.

export function getSignTxRequest(chainId, signer, signDoc) {
  return {
    id: payloadId(),
    jsonrpc: "2.0",
    method: "cosmostation_wc_sign_tx_v1",
    params: [chainId, signer, signDoc],
  };
}
Example
const signDoc = makeAminoSignDoc(
  [message],
  fee,
  CHAIN_ID,
  "",
  accountNumber,
  sequence
);
 
const request = getSignAminoRequest(CHAIN_ID, address, signDoc);
 
connector
  .sendCustomRequest(request)
  .then((response) => {
    const signed = _.get(response, "0.signed");
    const signature = _.get(response, "0.signature");
    return broadcastTx(signed, signature);
  })
  .then((result) => {
    const code = _.get(result, "code");
    if (code === 0) {
      const txHash = _.get(result, "txhash");
      console.log(txHash);
    } else {
      const rawLog = _.get(result, "raw_log");
      console.error(rawLog);
    }
  });
Model
type SignTxResponse = {
  signed: StdSignDoc;
  signature: { signature: string; pub_key: { type: string; value: string } };
};