@blocklet/hooks provides common functions needed during blocklet hook period (such as post-install, pre-start). It mainly includes:
- ensureSqliteInstalled: Ensure that sqlite is installed correctly
- ensureAccountDeclared: Ensure that the account corresponding to the application is successfully initialized on the chain
- ensureAccountStaked: Ensure that the account corresponding to the application is staked to waive transaction fees
npm install @blocklet/hooks
// Path to the example file: blocklets/core/server/hooks/pre-start.js
const { ensureSqliteInstalled, ensureAccountDeclared, ensureAccountStaked } = require('@blocklet/hooks');
const getWallet = require('@blocklet/sdk/lib/wallet');
// Assuming this is the wallet you want to operate on
const wallet = getWallet();
await ensureSqliteInstalled();
await ensureAccountDeclared({ wallet });
await ensureAccountStaked({ wallet });