Controllers

Every chain which is integrated with the vault is created as a separate package.

This is done keeping the modularity aspect in mind along with the thought process of open source contribution. Any developer can contribute to our code base by creating a controller of a chain keeping the developer guidelines in mind and integrating the controller with the Vault SDK.

Some controller examples

Guidelines for creating a controller

Every controller needs to expose methods to :

  1. Generate wallet

  2. Add Account

  3. Get Accounts

  4. Sign Message

  5. Sign Transactions

  6. Broadcast Transaction

  7. Export Private Key

  8. Import wallet from the private key

Controllers should manage multiple accounts through a Keyring implementation and proper state management. Every new account should get generated within the same keyring.

Integrations

Once the chain specific wallet controller is complete, it can be integrated with the vault SDK in a few lines of code

  1. Install safle-vault by running npm install --save @getsafle/safle-vault.

  2. Install the controller, import and export the controller in the chains directory like the examples given here

  3. Now transactions can be signed and sent from the Keyless SDK by just calling the signTransaction(rawTx, pin, chain) function and passing the chain name as the parameter along with the raw transaction and pin.

Last updated