This function accepts a transaction envelope-XDR plus network type(mainnet or testnet), When you put an XDR string and network type inside this method and call it, Rabet decodes it and shows its details to the user, and if the user confirms and signs it, you receive a signed XDR.

You should only call the sign function after calling the connect function. Otherwise, it would return the not-connected error.

// Connect before signing
const xdr = 'AAAAAL...'; // Only string
const network = 'mainnet'; // mainnet / testnet
rabet.sign(xdr, network)
.then(result => console.log(`Signed xdr: ${result.xdr}`))
.catch(error => console.error(`Error: ${error.message}`));

After receiving the signed transaction, you must send it to the network.

It is an example of how you might submit this signed transaction to Horizon using stellar-sdk (

Example of the message that the user will receive when calling the sign function: