To install the hedera-custodians-library from NPM, run the following command in your terminal:
npm install @hashgraph/hedera-custodians-integration
This command will install the hedera-custodians-library along with all its necessary dependencies. Ensure you are in your project’s root directory or the appropriate subdirectory where you wish to add the library.
To create a custodial wallet service:
- Choose the appropriate configuration (
FireblocksConfig
orDFNSConfig
). - Instantiate the configuration with the required parameters.
- Create a
CustodialWalletService
instance using the configuration.
import { CustodialWalletService, FireblocksConfig } from '@hashgraph/hedera-custodians-integration';
const config = new FireblocksConfig(
FIREBLOCKS_API_KEY,
FIREBLOCKS_API_SECRET_KEY,
FIREBLOCKS_BASE_URL,
FIREBLOCKS_VAULT_ACCOUNT_ID,
FIREBLOCKS_ASSET_ID
);
const service = new CustodialWalletService(config);
To sign a transaction:
- Create a
SignatureRequest
with the transaction bytes. - Use the signTransaction method of the
CustodialWalletService
.
import { SignatureRequest } from '@hashgraph/hedera-custodians-integration';
const transactionBytes = new Uint8Array([/* your transaction bytes */]);
const request = new SignatureRequest(transactionBytes);
const signature = await service.signTransaction(request);
To manage multiple wallets:
- Create separate configurations for each wallet.
- Instantiate a
CustodialWalletService
for each configuration.
const fireblocksConfig = new FireblocksConfig(/* Fireblocks parameters */);
const dfnsConfig = new DFNSConfig(/* DFNS parameters */);
const fireblocksService = new CustodialWalletService(fireblocksConfig);
const dfnsService = new CustodialWalletService(dfnsConfig);