@metahubwallet/wallet-plugin-metahub
v1.0.0
Published
A WalletPlugin for the Metahub wallet for use with @wharfkit/session.
Readme
@metahubwallet/wallet-plugin-metahub
A Session Kit wallet plugin for the Metahub wallet extension. Built directly on @metahubwallet/sdk without the Scatter protocol layer.
Usage
import {SessionKit} from '@wharfkit/session'
import {WalletPluginMetahub} from '@metahubwallet/wallet-plugin-metahub'
const kit = new SessionKit({
// ... other options
walletPlugins: [new WalletPluginMetahub()],
})This plugin will only work in a browser environment where the Metahub extension is installed.
How it works
logincallsMetahubClient.login({appName, chainId})and returns the account whosechainIdmatches the selected chain, as aPermissionLevel.signhands the resolved transaction to the extension as plain JSON (Antelope types serializeBytesfields to hex viatoJSON, so no ABI lookup is needed on this side).- The extension may transform the transaction before signing — e.g. Metahub's smooth mode prepends a
metahubpower::noopaction for CPU cosigning. When the returnedserializedTransactiondiffers from what was submitted, the plugin rebuilds aResolvedSigningRequestfrom the wallet's bytes (and reuses the wallet's decodedtransactionforresolvedTransaction) and returns it asresponse.resolved, so Session Kit broadcasts the transformed tx that the signatures actually cover.
Developing
yarn install
make test
make libRequires Node >= 18 and yarn classic.
License
MIT
