n8n node for SunX Perpetual Futures Trading
npm install n8n-nodes-sunx-perps
n8n-nodes-sunx-perps/
├── credentials/
│ └── SunxPerpsApi.credentials.ts # API authentication
├── nodes/
│ └── SunxPerps/
│ ├── SunxPerps.node.ts # Main node with all operations
│ ├── SunxPerpsUtils.ts # Auth & API utilities
│ └── sunx.svg # Node icon
├── .github/
│ ├── workflows/
│ │ └── ci.yml # CI/CD pipeline
│ └── ISSUE_TEMPLATE/
│ ├── bug_report.md
│ └── feature_request.md
├── package.json # Dependencies & scripts
├── tsconfig.json # TypeScript config
├── gulpfile.js # Build scripts
├── .eslintrc.js # Linting rules
├── .prettierrc.js # Code formatting
├── .gitignore
├── .npmignore
├── README.md # User documentation
├── DEVELOPMENT.md # Developer guide
├── TESTING.md # Testing guide
├── CHANGELOG.md # Version history
├── LICENSE.md # MIT License
└── example-workflow.json # Example n8n workflow
`
🔑 Key Features
$3
- ✅ HMAC SHA256 signature generation
- ✅ Automatic timestamp handling
- ✅ Full SunX API v2 authentication support
- ✅ Secure credential storage
$3
- ✅ Comprehensive error messages
- ✅ API error parsing
- ✅ Continue on fail support
- ✅ Detailed error context
$3
- ✅ All public endpoints (no auth required)
- ✅ All authenticated endpoints
- ✅ Query string parameter support
- ✅ Request body support for POST/PUT
$3
- ✅ TypeScript with full type safety
- ✅ ESLint configuration
- ✅ Prettier formatting
- ✅ Build scripts
- ✅ Development mode (watch)
📦 Files Created
$3
1. credentials/SunxPerpsApi.credentials.ts - API credential configuration
2. nodes/SunxPerps/SunxPerps.node.ts - Main node with all 23 operations
3. nodes/SunxPerps/SunxPerpsUtils.ts - Authentication & HTTP utilities
4. nodes/SunxPerps/sunx.svg - Custom node icon
5. gulpfile.js - Icon build script
$3
1. package.json - NPM package configuration
2. tsconfig.json - TypeScript compiler options
3. .eslintrc.js - ESLint rules
4. .prettierrc.js - Code formatting rules
5. .gitignore - Git exclusions
6. .npmignore - NPM publish exclusions
7. LICENSE.md - MIT License
$3
1. README.md - Installation & usage guide
2. DEVELOPMENT.md - Developer documentation
3. TESTING.md - Comprehensive testing guide
4. CHANGELOG.md - Version history
5. example-workflow.json - Sample n8n workflow
$3
1. .github/workflows/ci.yml - GitHub Actions workflow
2. .github/ISSUE_TEMPLATE/bug_report.md - Bug report template
3. .github/ISSUE_TEMPLATE/feature_request.md - Feature request template
Total: 20 Files Created
🚀 Installation & Usage
$3
1. Install in n8n:
`bash
npm install n8n-nodes-sunx-perps
`
2. Configure Credentials:
- Access Key ID
- Secret Key
- Base URL (default: https://api.sunx.io)
3. Use in Workflow:
- Add "SunX Perps" node
- Select resource (Account, Market Data, Order, Position)
- Select operation
- Configure parameters
- Execute!
$3
Get Funding Rate:
- Resource: Market Data
- Operation: Get Funding Rate
- Contract Code: BTC-USDT
Place Limit Order:
- Resource: Order
- Operation: Place Order
- Contract Code: BTC-USDT
- Direction: buy
- Offset: open
- Order Price Type: limit
- Volume: 1
- Price: 50000
- Leverage Rate: 10
Get Account Balance:
- Resource: Account
- Operation: Get Balance
🔧 Development
$3
`bash
npm run build
`
$3
`bash
npm run dev
`
$3
`bash
npm run lint
npm run lintfix
`
$3
`bash
npm run format
``