@blocklet/hooks
TypeScript icon, indicating that this package has built-in type declarations

0.1.11 • Public • Published

@blocklet/hooks

@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

Usage

Installation

npm install @blocklet/hooks

Implementation

// 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 });

Package Sidebar

Install

npm i @blocklet/hooks

Weekly Downloads

11

Version

0.1.11

License

ISC

Unpacked Size

12.6 kB

Total Files

6

Last publish

Collaborators

  • wangshijun
  • gxw