Integration Guide

Table of Content

Table of Content

Table of Content

Testing

Instructions for running StakePay in sandbox mode with test tokens and mock validators.

Local Development

# Use devnet
export STAKEFY_NETWORK=devnet

# Run test suite
npm run test

# Simulate stake
npx stakefy-cli simulate-stake \
  --amount 1000 \
  --token USDC \
  --service your-service-id

Integration Tests

import { StakefyTestHelper } from '@stakefy/testing';

describe('Subscription Flow', () => {
  const helper = new StakefyTestHelper({ network: 'devnet' });
  
  it('should grant access after staking', async () => {
    // Create test user
    const user = await helper.createTestUser();
    
    // Fund with devnet tokens
    await helper.fundUser(user, { USDC: 1000 });
    
    // Simulate stake
    const tx = await helper.stake({
      user,
      amount: 1000,
      token: 'USDC',
      serviceId: 'test-service'
    });
    
    // Verify access granted
    const hasAccess = await helper.verifyAccess(user, 'test-service');
    expect(hasAccess).toBe(true);
  });
});

Deployment Checklist

Before going to mainnet:

  • Tested on devnet with real stake flows

  • Configured webhooks and verified signatures

  • Set up backend access verification

  • Defined clear access tiers and stake requirements

  • Prepared user communication (emails, FAQs)

  • Set up monitoring (Sentry, Datadog, etc.)

  • Reviewed smart contract interactions

  • Tested unstaking and edge cases

  • Coordinated with Stakefy team (support@stakefy.io)