@spool.fi/spool-v2-sdk v1.0.15
Spool v2 SDK
Spool v2 SDK is a TypeScript npm package that provides a convenient way to interact with the Spool smart contracts and subgraph. It encapsulates RPC calls to the Spool smart contract as well as API calls to the subgraph, making it easier for developers to integrate Spool functionality into their applications.
Installation
To install the Spool v2 SDK, use the following npm command:
npm install "@spool.fi/spool-v2-sdk"
Getting Started
To use the Spool v2 SDK, you need to create an instance of the SpoolSdk class. Here's how you can do it:
import { SpoolSdk } from '@spool.fi/spool-v2-sdk';
const spoolSDK = new SpoolSdk(
config: SDKConfig,
signerOrProvider: Signer | Provider
)
The first parameter is the SDK config, which includes the subgraph URL, price feed URL, rewards URL, and ContractAddresses.
The second parameter, signerOrProvider, is a bit more intricate and calls for additional clarification. Before delving into the specifics, it's important to highlight that the SpoolSDK accommodates both view-only functions and state-changing functions. The nature of this parameter hinges on your intended SDK usage. If your intention is solely to employ the SDK for view-only functions, the Provider class suffices. However, if you intend to use state-changing functions, you will need a Signer or Fireblocks provider to execute transactions.
Usage
Below is a straightforward illustration on how to use an SDK.
const vaultDetailsQuery: VaultDetailsQuery = {
vaultAddress: 'vault_address',
};
const result: Number = await spoolSDK.getVaultTVRInUSD(vaultDetailsQuery);
3 days ago
17 days ago
21 days ago
26 days ago
1 month ago
1 month ago
1 month ago
1 month ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
2 months ago
3 months ago
3 months ago
6 months ago
7 months ago
8 months ago
8 months ago
9 months ago
9 months ago
9 months ago
9 months ago
9 months ago