The Qubic Connect Snap is a MetaMask extension that has Qubic capabilities such as public key derivation and transaction signing. This Snap is particularly useful when used with Qubic decentralized applications (DApps) that are built on top of the Snaps interface.
-
Install MetaMask: Ensure you have the MetaMask extension installed in your browser.
-
Connect to a Qubic DApp: Visit a Qubic DApp that supports the Qubic Connect Snap. These DApps will prompt you to install and connect the Snap.
-
Grant Permissions: When prompted by MetaMask, grant the necessary permissions to the Qubic Connect Snap. This will allow the Snap to interact with the Qubic DApp.
-
Use Qubic Features: Once connected, you can use the features provided by the Qubic Connect Snap, such as deriving public keys and signing transactions, directly within the Qubic DApp.
Install via NPM:
npm add @qubic-lib/qubic-mm-snap
-
Install the latest version of the Snaps CLI:
pnpm setup pnpm add -g @metamask/snaps-cli
-
Install the dependencies:
pnpm i
-
Build and start the local development server:
pnpm start
The production snap is available as Snap ID npm:@qubic-lib/qubic-mm-snap
.
The locally started snap is available as Snap ID local:http://localhost:8081
.
Returns the wallet's Qubic public key.
Parameters:
accountIdx
- The account index starting with 0.confirm
- Whether to show a confirm dialog.
Returns:
Public ID.
Example:
ethereum.request({
method: 'wallet_invokeSnap',
params: {
snapId: 'npm:@qubic-lib/qubic-mm-snap',
request: {
method: 'getPublicId',
params: {
accountIdx: 0,
confirm: true
}
}
}
});
Signs a transaction and returns the signature encoded as Base64.
Parameters:
base64Tx
- Transaction encoded as Base64.offset
- Offset of the transaction in the message.accountIdx
- Account index starting with 0.confirm
- Boolean whether to show a confirm dialog.
Returns:
An object containing:
signedTx
- Transaction signature encoded as Base64.
Example:
ethereum.request({
method: 'wallet_invokeSnap',
params: {
snapId: 'npm:@qubic-lib/qubic-mm-snap',
request: {
method: 'signTransaction',
params: {
base64Tx: '...',
offset: 96,
accountIdx: 0,
confirm: true
}
}
}
});