CRA v5 + Lisk SDK update

With the release of Lisk SDK v5.2.2 it is now possible to use the package in CRA v5 without too much shenanigans.

  • Bootstrap a React app with npx create-react-app my-app --template typescript
  • Install the latest Lisk Client with npm install --save @liskhq/lisk-client
  • Create a module.d.ts file in the src folder of your project, containing:
declare module '@liskhq/lisk-client/browser' {
  export const apiClient: typeof import('@liskhq/lisk-api-client');
  export const cryptography: typeof import('@liskhq/lisk-cryptography');
  export const passphrase: typeof import('@liskhq/lisk-passphrase');
  export const transactions: typeof import('@liskhq/lisk-transactions');
  export const utils: typeof import('@liskhq/lisk-utils');
  export const tree: typeof import('@liskhq/lisk-tree');
  export const validator: typeof import('@liskhq/lisk-validator');
  export const codec: typeof import('@liskhq/lisk-codec');
}
  • Import any package using the /browser version, eg: import { cryptography } from '@liskhq/lisk-client/browser';

I haven’t tested all packages in the client, but from what I’ve seen before it all seems to work nicely.

1 Like