Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migrate Charisma to New Dexterity SDK Package #4

Open
59 tasks
r0zar opened this issue Dec 20, 2024 · 0 comments
Open
59 tasks

Migrate Charisma to New Dexterity SDK Package #4

r0zar opened this issue Dec 20, 2024 · 0 comments

Comments

@r0zar
Copy link
Owner

r0zar commented Dec 20, 2024

Title: Migrate Charisma to New Dexterity SDK Package

Description

Update Charisma to use the new NPM package version of the Dexterity SDK, replacing the current direct integration. This migration will ensure Charisma benefits from ongoing SDK improvements and standardized updates.

Technical Overview

Replace existing Dexterity integration code with the new SDK package, update all trading and liquidity management functions, and ensure backward compatibility with existing features.

Implementation Details

Package Integration

  • Add new dependency:
    npm install dexterity-sdk@latest
  • Update package.json:
    {
      "dependencies": {
        "dexterity-sdk": "^0.1.0-rc.6"
        // ... other dependencies
      }
    }
  • Remove old integration code:
    • Identify deprecated files
    • Document removal plan
    • Archive if needed

SDK Initialization

  • Update SDK initialization:
    import { DexteritySDK } from 'dexterity-sdk';
    
    const sdk = new DexteritySDK({
      network,
      stxAddress,
      defaultSlippage: 0.5
    });
    
    await sdk.initialize({
      excludePools: [...],
      limit: 50
    });

Trading Integration

  • Update swap functionality:
    async function executeSwap(
      amount: number,
      tokenIn: string,
      tokenOut: string,
      options: SwapOptions
    ) {
      const tx = await sdk.buildSwap(
        amount,
        tokenIn,
        tokenOut,
        options
      );
      return doContractCall(tx);
    }

Liquidity Management

  • Update liquidity functions:
    async function addLiquidity(
      poolId: string,
      amount: number,
      options: LiquidityOptions
    ) {
      const tx = await sdk.buildAddLiquidity(
        poolId,
        amount,
        options
      );
      return doContractCall(tx);
    }
    
    async function removeLiquidity(
      poolId: string,
      amount: number,
      options: LiquidityOptions
    ) {
      const tx = await sdk.buildRemoveLiquidity(
        poolId,
        amount,
        options
      );
      return doContractCall(tx);
    }

UI Updates

  • Update trading interface:
    • Token selection
    • Price quotes
    • Slippage settings
    • Transaction confirmation
  • Update pool interface:
    • Liquidity display
    • Pool stats
    • User positions

State Management

  • Update Redux/state management:
    interface DexterityState {
      sdk: DexteritySDK;
      initialized: boolean;
      pools: LPToken[];
      tokens: Token[];
      userPositions: Position[];
    }

Testing Updates

  • Create test suite:
    • SDK initialization
    • Trading functions
    • Liquidity management
    • UI interactions
  • Add integration tests
  • Update E2E tests

Acceptance Criteria

  • All existing Dexterity functionality works with new SDK
  • No regression in features or performance
  • All tests passing
  • Documentation updated
  • Successful deployment to staging
  • Performance metrics maintained or improved

Migration Strategy

  1. Development Phase:

    • Create feature branch
    • Implement changes
    • Run tests
    • Document changes
  2. Testing Phase:

    • Deploy to staging
    • Run E2E tests
    • Performance testing
    • User testing
  3. Deployment Phase:

    • Create deployment plan
    • Schedule maintenance window
    • Execute deployment
    • Monitor metrics

Performance Requirements

  • SDK initialization < 2s
  • Swap quote response < 500ms
  • UI updates < 100ms
  • No memory leaks

Testing Requirements

  • Unit tests:
    • SDK initialization
    • Trading functions
    • UI components
  • Integration tests:
    • Complete trading flow
    • Liquidity management
  • E2E tests:
    • User journeys
    • Error scenarios

Documentation Updates

  • Update integration docs
  • Update API references
  • Add migration guide
  • Update troubleshooting guide

Monitoring & Analytics

  • Update metrics tracking:
    • SDK initialization time
    • Quote response time
    • Transaction success rate
    • Error rates
  • Add new SDK-specific metrics
  • Update dashboards
  • Configure alerts

Rollback Plan

  1. Keep old integration code in separate branch
  2. Maintain backup of state management
  3. Document rollback procedures
  4. Test rollback process

Related Issues

  • Depends on: SDK package publish
  • Blocked by: None
  • Related to: Trading UI updates

Security Considerations

  • Audit new integration
  • Review error handling
  • Check transaction safety
  • Validate input sanitization

Notes

  • Consider feature flags for gradual rollout
  • Plan for version upgrade process
  • Document any breaking changes
  • Consider adding sandbox environment for testing
  • Monitor SDK updates for future migrations
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant