Wallet Integration
Currently, we've built a wallet called the Catena Wallet, Catena is the official Chrome extension wallet for OP_CAT Layer, for developers and early adopters to interact with the OP_CAT Layer with ease.
Catena allows you to manage BTC, CAT20 tokens, and CAT721 NFTs, bridge assets between Bitcoin and OP_CAT Layer, and interact with dApps like SatSwap and Catgo etc. We're looking forward to have more web wallets to support the OP_CAT Layer in the near feature.
Catena Wallet
Install the extension
You can download Catena Wallet from the Chrome Extension.
It works on all Chromium-based browsers including Chrome, Brave, Edge, and Opera.
NOTE: Catena Wallet is fully open source. You can review the code, report issues, and contribute at Catena.
Integrate with dApps
To request access to the Catena Wallet, you can use its APIs to create a built-in WalletSigner:
import { WalletSigner, OpcatAPI } from '@opcat-labs/lambit';
declare global {
interface Window {
opcat: OpcatAPI
}
}
const signer = new WalletSigner(window.opcat);
create a provider:
const provider = new MempoolProvider('opcat-testnet')
create a psbt and use signer and provider to sign and broadcast it:
const psbt = new ExtPsbt({network: network})
.spendUTXO(utxos)
for (const recipient of recipients) {
psbt.addOutput({
address: recipient.address,
value: BigInt(Math.round(recipient.amount * 10 ** decimals)),
data: Buffer.alloc(0)
});
}
psbt
.change(await signer.getAddress(), await provider.getFeeRate())
.seal()
const signedPsbt = await signer.signPsbt(psbt.toHex(), psbt.psbtOptions())
psbt.combine(ExtPsbt.fromHex(signedPsbt)).finalizeAllInputs()
const tx = psbt.extractTransaction();
await provider.broadcast(tx.toHex());
The Lambit SDK package @opcat-labs/lambit provides deploy and call features; use them in App.tsx:
import React from 'react';
import logo from './logo.svg';
import './App.css';
import { call, Covenant, deploy, MempoolProvider, sha256, toByteString, UnisatAPI, UnisatSigner } from '@opcat-labs/lambit';
import { AtomicSwap } from './atomic-swap.js';
async function deployAndCall() {
const deployPsbt = await deploy(aliceSigner, provider, contract)
const callPsbt = await call(aliceSigner, provider, contract, (contract: AtomicSwap, psbt: IExtPsbt) => {
const sig = psbt.getSig(0, { publicKey: alicePubKey });
contract.unlock(x, sig)
})
console.log('AtomicSwap contract `unlock` called: ', callTx.getId());
}
function App() {
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<button onClick={deployAndCall}>Deploy and Call</button>
</header>
</div>
);
}
export default App;
Afterwards, you can interact with the contract from the front-end.
You can find more wallet APIs here.