_ __ ____ __ ______ | | / /___ _/ / /__ / /_ / ____/___ ________ | | /| / / __ `/ / / _ \/ __/ / / / __ \/ ___/ _ \ | |/ |/ / /_/ / / / __/ /_ / /___/ /_/ / / / __/ |__/|__/\__,_/_/_/\___/\__/ \____/\____/_/ \___/
Wallet Core is a cryptocurrency wallet library in Typescript. It provides an abstracted interface that handles all the necessary internals of a muilti chain wallet. Featuring:
- State management
- Seed management and security
- Account management
- Blockchain communication under a common interface, powered by Chainify
- Retriving balances
- Sending transactions
- Intra and cross chain swaps supporting a host of decentralised exchanges - Liquality, Thorchain, Uniswap, 1inch, Sovryn, Astroport etc.
- Hardware wallet support
npm install @liquality/wallet-core
yarn add @liquality/wallet-core
import { setupWallet } from '@liquality/wallet-core';
import defaultOptions from '@liquality/wallet-core/dist/walletOptions/defaultOptions'; // Default options
const wallet = setupWallet({
...defaultOptions,
});
(async () => {
await wallet.dispatch.createWallet({
key: 'satoshi',
mnemonic: 'never gonna give you up never gonna let you down never gonna',
imported: true,
});
await wallet.dispatch.unlockWallet({ key: 'satoshi' });
await wallet.dispatch.changeActiveNetwork({ network: 'mainnet' });
console.log(wallet.state); // State will include default accounts
})();
See WalletOptions
in types
{
initialState?: RootState; // The initial state of the wallet
crypto: { // Implmenetation for platform specific crypto
pbkdf2(password: string, salt: string, iterations: number, length: number, digest: string): Promise<string>;
encrypt(value: string, key: string): Promise<any>;
decrypt(value: any, key: string): Promise<any>;
};
// Handle notifications
createNotification(notification: Notification): void;
...
}
Integration tests are written in Jest.
yarn test
- GitHub actions will publish to NPM automatically after a successful pull request merge, follow the below steps to publish to NPM.
yarn changeset
Under changeset you will notice a new markdown file (its name is randomly generated), with the change-type and summary.
Push the file along with the rest of the changes, and let the GitHub actions do the heavy-lifting for you. As for the markdown file, it will be deleted by our GitHub action when the entry that's referencing is added to the changelog.
How to do prerelease version from a branch
- Create a changed file with the version you want to release, for example
v0.1.0-alpha.1
yarn changeset
Note: Ensure pre.json
file is present in the .changeset
directory of the project, then create a pull request with the changeset file and merge it to the develop branch.
If pre.json
file is not present, create a new file with the following command & it will to the .changeset
directory of the project,push the changes and create a pull request with the changeset file and merge it to the develop branch.
yarn changeset pre enter next