An open API service indexing awesome lists of open source software.

https://github.com/chicunic/xrpl-stablecoin-flow


https://github.com/chicunic/xrpl-stablecoin-flow

Last synced: 10 months ago
JSON representation

Awesome Lists containing this project

README

          

# XRPL Stablecoin Flow

A comprehensive TypeScript testing framework for XRPL (XRP Ledger) stablecoin operations, featuring extensive integration tests for various XRPL account flags and features.

## Overview

This project provides a robust testing environment for XRPL stablecoin flows, focusing on account configuration, trust line management, token issuance, and payment operations. It includes automated testing for critical XRPL features like RequireAuth, DepositAuth, GlobalFreeze, and other account flags.

## Features

- **Comprehensive XRPL Integration Testing**: Test suites covering all major XRPL stablecoin operations
- **Account Flag Testing**: RequireAuth, DepositAuth, GlobalFreeze, DisallowXRP, and more
- **Trust Line Management**: Creation, authorization, and clawback functionality
- **Payment Flow Testing**: Token transfers, XRP payments, and check operations
- **Automated Wallet Funding**: Smart wallet funding with balance checking and faucet integration
- **Parallel Operation Optimization**: Optimized async operations using Promise.all
- **Network Flexibility**: Support for devnet, testnet, and custom XRPL endpoints

## Project Structure

```
xrpl-stablecoin-flow/
├── src/
│ ├── config/
│ │ └── xrpl.config.ts # XRPL client configuration
│ └── services/
│ └── fund.service.ts # Wallet funding service
├── tests/
│ ├── specs/integration/ # Integration test suites
│ │ ├── allow-trustline-clawback.test.ts
│ │ ├── check.test.ts
│ │ ├── default-ripple.test.ts
│ │ ├── deposit-auth-check-flow.test.ts
│ │ ├── deposit-auth.test.ts
│ │ ├── disallow-xrp.test.ts
│ │ ├── global-freeze.test.ts
│ │ ├── no-ripple-flow.test.ts
│ │ └── require-auth.test.ts
│ └── utils/
│ ├── data.ts # Shared test constants
│ ├── helpers.ts # Test helper functions
│ └── mock.factory.ts # Mock data factory
├── jest.config.js # Jest configuration
├── tsconfig.json # TypeScript configuration
└── package.json # Package dependencies and scripts
```

## Prerequisites

- **Node.js**: ≥22.0.0
- **pnpm**: Package manager
- **TypeScript**: ^5.9.2
- **XRPL**: ^4.4.0

## Test Suites

### 1. Account Flag Tests

#### AllowTrustLineClawback (`allow-trustline-clawback.test.ts`)

Tests [clawback functionality](https://xrpl.org/docs/references/protocol/transactions/types/clawback):

- Enabling clawback on issuer accounts
- Executing token clawbacks
- Balance adjustments and validations

**Run test:**

```bash
pnpm test allow-trustline-clawback
```

#### DefaultRipple (`default-ripple.test.ts`)

Tests [DefaultRipple flag](https://xrpl.org/docs/concepts/tokens/fungible-tokens/rippling) account configuration:

- Setting DefaultRipple flag
- Automatic rippling behavior
- Multi-hop payment scenarios

**Run test:**

```bash
pnpm test default-ripple
```

#### DepositAuth (`deposit-auth.test.ts`)

Tests [DepositAuth flag](https://xrpl.org/docs/concepts/accounts/depositauth) requirements:

- Setting DepositAuth flag on recipient accounts
- Authorized deposit flows
- Payment authorization mechanisms

**Run test:**

```bash
pnpm test deposit-auth
```

#### DisallowXRP (`disallow-xrp.test.ts`)

Tests [DisallowXRP flag](https://xrpl.org/docs/concepts/accounts/depositauth) restrictions:

- Setting DisallowXRP flag
- Preventing XRP payments to flagged accounts
- Token-only transaction flows

**Run test:**

```bash
pnpm test disallow-xrp
```

#### GlobalFreeze (`global-freeze.test.ts`)

Tests [GlobalFreeze flag](https://xrpl.org/docs/concepts/tokens/fungible-tokens/freezes#global-freeze) functionality:

- Applying global freeze on issuer accounts
- Preventing token transfers during freeze
- Unfreezing and resuming operations

**Run test:**

```bash
pnpm test global-freeze
```

#### RequireAuth (`require-auth.test.ts`)

Tests the [RequireAuth flag](https://xrpl.org/docs/concepts/tokens/fungible-tokens/authorized-trust-lines) functionality for token issuers:

- Setting RequireAuth flag on issuer accounts
- Trust line creation requiring authorization
- Token transfer authorization process
- Unauthorized transfer prevention

**Run test:**

```bash
pnpm test require-auth
```

### 2. Payment Flow Tests

#### NoRipple Flow (`no-ripple-flow.test.ts`)

Tests [NoRipple flag](https://xrpl.org/docs/concepts/tokens/fungible-tokens/rippling) configurations:

- Setting NoRipple flags on trust lines
- Preventing rippling through accounts
- Direct payment paths

**Run test:**

```bash
pnpm test no-ripple-flow
```

#### Deposit Auth Check Flow (`deposit-auth-check-flow.test.ts`)

Tests check operations with [deposit authorization](https://xrpl.org/docs/concepts/accounts/depositauth):

- Check creation with deposit auth requirements
- Authorization workflows
- Authorized check cashing

**Run test:**

```bash
pnpm test deposit-auth-check-flow
```

### 3. Payment Tests

#### Check Operations (`check.test.ts`)

Tests [XRPL Check](https://xrpl.org/docs/concepts/payment-types/checks) functionality:

- Creating payment checks
- Check authorization and cashing
- Check cancellation flows

**Run test:**

```bash
pnpm test check
```

## License

MIT

## Keywords

- XRP
- XRPL
- Stablecoin
- TypeScript
- Testing
- Integration Tests
- Blockchain
- Cryptocurrency