Last updated
Signing
Signing can be done in various ways. Either manually, by signing the hash of the
transaction or with a wallet. There's currently two options in @kadena/client
to sign with a wallet:
Manually signing the transaction
The unsignedTransaction can be pasted into the SigData
of Chainweaver.
The createTransaction
function will return the transaction. The hash will be
calculated and the command will be serialized.
Integrated sign request to Chainweaver desktop
Using the transaction
we can send a sign request to Chainweaver.
Note: This can only be done using the desktop version, not the web version, as it's exposing port 9467 .
ts
import { signWithChainweaver } from '@kadena/client'; // use the transaction, and sign it with Chainweaverconst signedTransaction = signWithChainweaver(unsignedTransaction) .then(console.log) .catch(console.error);
ts
import { signWithChainweaver } from '@kadena/client'; // use the transaction, and sign it with Chainweaverconst signedTransaction = signWithChainweaver(unsignedTransaction) .then(console.log) .catch(console.error);
To send the transaction to the blockchain, continue with Send a request to the blockchain
Signing with a WalletConnect compatible wallet
There's several steps to setup a WalletConnect connections and sign with WalletConnect.
- Setting up the connection using
ClientContextProvider.tsx
- Use
signWithWalletConnect
to request a signature from the wallet (Transaction.tsx
)[https://github.com/kadena-io/wallet-connect-example/blob/2efc34296f845aea75f37ab401a5c49081f75b47/src/components/Transaction.tsx#L104 ]