For the complete documentation index, see llms.txt. This page is also available as Markdown.

SDK Reference

Install

npm install @spree-finance/spree-evm-sdk

Configuration

All contract wrappers accept BaseContractConfig:

import type { BaseContractConfig, Hex, TxOverrides } from '@spree-finance/spree-evm-sdk';

interface BaseContractConfig {
  rpcUrl: string;
  chainId: bigint;
  contractAddress: Hex;
  from: Hex;
  defaultGasPriceWei: bigint;
  defaultGasLimit: bigint;
}

Types

type Hex = `0x${string}`;

interface TxOverrides {
  gasPriceWei?: bigint;
  gasLimit?: bigint;
  valueWei?: bigint;
  maxFeePerGasWei?: bigint;           // EIP-1559
  maxPriorityFeePerGasWei?: bigint;   // EIP-1559
  txType?: 'legacy' | 'eip1559';
}

Factory

Mint/redeem SP, manage vaults, whitelists, and rates.

Write Methods

Read Methods

Points

ERC-20 SP token with TWAB tracking and transfer whitelist.

Write Methods

Read Methods

SpreeVault4626

ERC-4626 yield vault with harvest, rebalance, and fee management.

Write Methods

Read Methods

Interfaces

BonusRewardsVault

Epoch-based bonus reward distribution.

Write Methods

Read Methods

Interfaces

PythPriceOracle

Pyth Network price feed integration.

Write Methods

Read Methods

PendingSPVault

Campaign-based pSP distribution and settlement.

Write Methods

Read Methods

SpreeStatusRegistry

Tier and status management for loyalty programs.

Write Methods

Read Methods

BoostEngine

Boost multiplier calculations for campaigns and tiers.

Write Methods

Read Methods

Additional Modules

ClientOnboarding

Deploy brand infrastructure:

ContractRegistry

Query deployed factories and contracts:

ERC20

Generic ERC-20 operations (for stablecoin approvals before minting):

Nonce Caching

Build multiple transactions without repeated RPC calls for nonce:

Manual Nonce

Gas Overrides

Pass per-transaction gas parameters:

Calldata Encoding

Encode function calls without building a full transaction:

Brand Configuration

Error Classes

Additional error classes from the ClientOnboarding module:

Last updated