skillpp 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/COMPATIBILITY.md +58 -0
- package/LICENSE +21 -0
- package/README.md +307 -0
- package/README.zh-CN.md +307 -0
- package/SKILL.md +490 -0
- package/adapters/binance-ai.md +22 -0
- package/adapters/claude.md +21 -0
- package/adapters/gemini.md +26 -0
- package/adapters/gpt.md +28 -0
- package/adapters/kimi.md +26 -0
- package/adapters/mimo.md +22 -0
- package/adapters/openclaw.md +29 -0
- package/assets/skillpp-banner.png +0 -0
- package/package.json +59 -0
- package/pipelines.md +310 -0
- package/prompts/newbie-mode.md +48 -0
- package/prompts/router-prompt.md +32 -0
- package/prompts/universal-system-prompt.md +41 -0
- package/registry.md +209 -0
- package/rules.md +323 -0
- package/schemas/audit.schema.json +67 -0
- package/schemas/checkpoint.schema.json +86 -0
- package/schemas/handoff.schema.json +82 -0
- package/schemas/token.schema.json +36 -0
- package/scripts/compatibility-check.mjs +130 -0
- package/scripts/selftest.mjs +384 -0
- package/scripts/skillpp.mjs +448 -0
- package/scripts/validate-skillpp.mjs +140 -0
- package/skillpp.manifest.json +714 -0
- package/skills/audit-plus/SKILL.md +612 -0
- package/skills/binance/binance/CHANGELOG.md +112 -0
- package/skills/binance/binance/LICENSE.md +9 -0
- package/skills/binance/binance/SKILL.md +69 -0
- package/skills/binance/binance/references/algo.md +21 -0
- package/skills/binance/binance/references/alpha.md +9 -0
- package/skills/binance/binance/references/auth.md +32 -0
- package/skills/binance/binance/references/c2c.md +5 -0
- package/skills/binance/binance/references/convert.md +19 -0
- package/skills/binance/binance/references/copy-trading.md +6 -0
- package/skills/binance/binance/references/crypto-loan.md +27 -0
- package/skills/binance/binance/references/derivatives-options-streams.md +25 -0
- package/skills/binance/binance/references/derivatives-options.md +85 -0
- package/skills/binance/binance/references/derivatives-portfolio-margin-pro-streams.md +5 -0
- package/skills/binance/binance/references/derivatives-portfolio-margin-pro.md +34 -0
- package/skills/binance/binance/references/derivatives-portfolio-margin-streams.md +5 -0
- package/skills/binance/binance/references/derivatives-portfolio-margin.md +146 -0
- package/skills/binance/binance/references/dual-investment.md +15 -0
- package/skills/binance/binance/references/fiat.md +9 -0
- package/skills/binance/binance/references/futures-coin-streams.md +29 -0
- package/skills/binance/binance/references/futures-coin.md +109 -0
- package/skills/binance/binance/references/futures-usds-streams.md +35 -0
- package/skills/binance/binance/references/futures-usds.md +144 -0
- package/skills/binance/binance/references/gift-card.md +10 -0
- package/skills/binance/binance/references/margin-trading-streams.md +6 -0
- package/skills/binance/binance/references/margin-trading.md +101 -0
- package/skills/binance/binance/references/mining.md +17 -0
- package/skills/binance/binance/references/pay.md +5 -0
- package/skills/binance/binance/references/rebate.md +5 -0
- package/skills/binance/binance/references/simple-earn.md +56 -0
- package/skills/binance/binance/references/spot-streams.md +25 -0
- package/skills/binance/binance/references/spot.md +114 -0
- package/skills/binance/binance/references/staking.md +59 -0
- package/skills/binance/binance/references/sub-account.md +67 -0
- package/skills/binance/binance/references/vip-loan.md +27 -0
- package/skills/binance/binance/references/wallet.md +75 -0
- package/skills/binance/fiat/CHANGELOG.md +11 -0
- package/skills/binance/fiat/LICENSE.md +9 -0
- package/skills/binance/fiat/SKILL.md +169 -0
- package/skills/binance/fiat/references/authentication.md +126 -0
- package/skills/binance/fiat/references/sapi-endpoints.md +217 -0
- package/skills/binance/onchain-pay/.local.md.example +10 -0
- package/skills/binance/onchain-pay/CHANGELOG.md +20 -0
- package/skills/binance/onchain-pay/LICENSE.md +9 -0
- package/skills/binance/onchain-pay/SKILL.md +466 -0
- package/skills/binance/onchain-pay/references/authentication.md +92 -0
- package/skills/binance/onchain-pay/scripts/sign_and_call.sh +52 -0
- package/skills/binance/p2p/CHANGELOG.md +33 -0
- package/skills/binance/p2p/LICENSE.md +9 -0
- package/skills/binance/p2p/SKILL.md +1082 -0
- package/skills/binance/p2p/references/agent-sapi-api.md +795 -0
- package/skills/binance/p2p/references/authentication.md +100 -0
- package/skills/binance/payment/SKILL.md +824 -0
- package/skills/binance/payment/common.py +560 -0
- package/skills/binance/payment/payment_skill.py +86 -0
- package/skills/binance/payment/receive.py +109 -0
- package/skills/binance/payment/references/setup-guide.md +77 -0
- package/skills/binance/payment/requirements.txt +4 -0
- package/skills/binance/payment/send.py +952 -0
- package/skills/binance/payment/send_extension/__init__.py +43 -0
- package/skills/binance/payment/send_extension/base.py +48 -0
- package/skills/binance/payment/send_extension/c2c.py +193 -0
- package/skills/binance/payment/send_extension/pix.py +316 -0
- package/skills/binance/square-post/README.md +62 -0
- package/skills/binance/square-post/SKILL.md +171 -0
- package/skills/binance/square-post/scripts/lib.mjs +175 -0
- package/skills/binance/square-post/scripts/post-image.mjs +80 -0
- package/skills/binance/square-post/scripts/post-text.mjs +41 -0
- package/skills/binance/square-post/scripts/post-video.mjs +110 -0
- package/skills/binance/square-post/scripts/save-key.mjs +34 -0
- package/skills/binance-web3/binance-agentic-wallet/SKILL.md +150 -0
- package/skills/binance-web3/binance-agentic-wallet/references/authentication.md +136 -0
- package/skills/binance-web3/binance-agentic-wallet/references/limit-order.md +204 -0
- package/skills/binance-web3/binance-agentic-wallet/references/market-order.md +179 -0
- package/skills/binance-web3/binance-agentic-wallet/references/prediction.md +489 -0
- package/skills/binance-web3/binance-agentic-wallet/references/preflight.md +66 -0
- package/skills/binance-web3/binance-agentic-wallet/references/security.md +47 -0
- package/skills/binance-web3/binance-agentic-wallet/references/send.md +53 -0
- package/skills/binance-web3/binance-agentic-wallet/references/wallet-setting.md +86 -0
- package/skills/binance-web3/binance-agentic-wallet/references/wallet-view.md +312 -0
- package/skills/binance-web3/binance-agentic-wallet/references/x402-payment.md +259 -0
- package/skills/binance-web3/binance-tokenized-securities-info/SKILL.md +613 -0
- package/skills/binance-web3/crypto-market-rank/SKILL.md +91 -0
- package/skills/binance-web3/crypto-market-rank/references/cli.md +219 -0
- package/skills/binance-web3/crypto-market-rank/scripts/cli.mjs +149 -0
- package/skills/binance-web3/meme-rush/SKILL.md +72 -0
- package/skills/binance-web3/meme-rush/references/cli.md +158 -0
- package/skills/binance-web3/meme-rush/scripts/cli.mjs +101 -0
- package/skills/binance-web3/query-address-info/SKILL.md +61 -0
- package/skills/binance-web3/query-address-info/references/cli.md +56 -0
- package/skills/binance-web3/query-address-info/scripts/cli.mjs +132 -0
- package/skills/binance-web3/query-token-audit/SKILL.md +162 -0
- package/skills/binance-web3/query-token-info/SKILL.md +83 -0
- package/skills/binance-web3/query-token-info/references/cli.md +135 -0
- package/skills/binance-web3/query-token-info/scripts/cli.mjs +112 -0
- package/skills/binance-web3/trading-signal/SKILL.md +66 -0
- package/skills/binance-web3/trading-signal/references/cli.md +90 -0
- package/skills/binance-web3/trading-signal/scripts/cli.mjs +92 -0
- package/skills/four-meme/four-guard/API-Contract-TaxToken.md +277 -0
- package/skills/four-meme/four-guard/API-CreateToken.02-02-2026.md +285 -0
- package/skills/four-meme/four-guard/API-Documents.03-03-2026.md +789 -0
- package/skills/four-meme/four-guard/AgentIdentifier.abi +585 -0
- package/skills/four-meme/four-guard/README.md +21 -0
- package/skills/four-meme/four-guard/SKILL.md +31 -0
- package/skills/four-meme/four-guard/TaxToken.abi +969 -0
- package/skills/four-meme/four-guard/TokenIdentifierSample.js_ +81 -0
- package/skills/four-meme/four-guard/TokenIdentifierSample.sol +69 -0
- package/skills/four-meme/four-guard/TokenManager.lite.abi +836 -0
- package/skills/four-meme/four-guard/TokenManager2.lite.abi +2325 -0
- package/skills/four-meme/four-guard/TokenManagerHelper3.abi +999 -0
- package/skills/four-meme/four-guard/go.mod +36 -0
- package/skills/four-meme/four-guard/go.sum +127 -0
- package/skills/four-meme/four-guard/main.go +183 -0
- package/skills/four-meme/four-meme-ai/SKILL.md +31 -0
- package/skills/four-meme/four-meme-ai/references/agent-creator-and-wallets.md +87 -0
- package/skills/four-meme/four-meme-ai/references/api-create-token.md +55 -0
- package/skills/four-meme/four-meme-ai/references/contract-addresses.md +47 -0
- package/skills/four-meme/four-meme-ai/references/create-token-scripts.md +131 -0
- package/skills/four-meme/four-meme-ai/references/errors.md +29 -0
- package/skills/four-meme/four-meme-ai/references/event-listening.md +75 -0
- package/skills/four-meme/four-meme-ai/references/execute-trade.md +31 -0
- package/skills/four-meme/four-meme-ai/references/tax-token-query.md +38 -0
- package/skills/four-meme/four-meme-ai/references/token-query-api.md +44 -0
- package/skills/four-meme/four-meme-ai/references/token-tax-info.md +77 -0
- package/skills/four-meme/four-meme-ai/scripts/8004-balance.ts +52 -0
- package/skills/four-meme/four-meme-ai/scripts/8004-register.ts +108 -0
- package/skills/four-meme/four-meme-ai/scripts/create-token-api.ts +321 -0
- package/skills/four-meme/four-meme-ai/scripts/create-token-chain.ts +102 -0
- package/skills/four-meme/four-meme-ai/scripts/create-token-instant.ts +106 -0
- package/skills/four-meme/four-meme-ai/scripts/execute-buy.ts +198 -0
- package/skills/four-meme/four-meme-ai/scripts/execute-sell.ts +150 -0
- package/skills/four-meme/four-meme-ai/scripts/get-public-config.ts +25 -0
- package/skills/four-meme/four-meme-ai/scripts/get-recent-events.ts +76 -0
- package/skills/four-meme/four-meme-ai/scripts/get-tax-token-info.ts +69 -0
- package/skills/four-meme/four-meme-ai/scripts/get-token-info.ts +94 -0
- package/skills/four-meme/four-meme-ai/scripts/quote-buy.ts +85 -0
- package/skills/four-meme/four-meme-ai/scripts/quote-sell.ts +66 -0
- package/skills/four-meme/four-meme-ai/scripts/send-token.ts +98 -0
- package/skills/four-meme/four-meme-ai/scripts/token-get.ts +31 -0
- package/skills/four-meme/four-meme-ai/scripts/token-list.ts +134 -0
- package/skills/four-meme/four-meme-ai/scripts/token-rankings.ts +162 -0
- package/skills/four-meme/four-meme-ai/scripts/verify-events.ts +47 -0
- package/skills/four-meme/four-meme-integration/SKILL.md +374 -0
- package/skills/four-meme/four-meme-integration/references/agent-creator-and-wallets.md +87 -0
- package/skills/four-meme/four-meme-integration/references/api-create-token.md +55 -0
- package/skills/four-meme/four-meme-integration/references/contract-addresses.md +47 -0
- package/skills/four-meme/four-meme-integration/references/create-token-scripts.md +131 -0
- package/skills/four-meme/four-meme-integration/references/errors.md +29 -0
- package/skills/four-meme/four-meme-integration/references/event-listening.md +75 -0
- package/skills/four-meme/four-meme-integration/references/execute-trade.md +31 -0
- package/skills/four-meme/four-meme-integration/references/tax-token-query.md +38 -0
- package/skills/four-meme/four-meme-integration/references/token-query-api.md +44 -0
- package/skills/four-meme/four-meme-integration/references/token-tax-info.md +77 -0
- package/skills/four-meme/four-meme-integration/scripts/8004-balance.ts +52 -0
- package/skills/four-meme/four-meme-integration/scripts/8004-register.ts +108 -0
- package/skills/four-meme/four-meme-integration/scripts/create-token-api.ts +321 -0
- package/skills/four-meme/four-meme-integration/scripts/create-token-chain.ts +102 -0
- package/skills/four-meme/four-meme-integration/scripts/create-token-instant.ts +106 -0
- package/skills/four-meme/four-meme-integration/scripts/execute-buy.ts +198 -0
- package/skills/four-meme/four-meme-integration/scripts/execute-sell.ts +150 -0
- package/skills/four-meme/four-meme-integration/scripts/get-public-config.ts +25 -0
- package/skills/four-meme/four-meme-integration/scripts/get-recent-events.ts +76 -0
- package/skills/four-meme/four-meme-integration/scripts/get-tax-token-info.ts +69 -0
- package/skills/four-meme/four-meme-integration/scripts/get-token-info.ts +94 -0
- package/skills/four-meme/four-meme-integration/scripts/quote-buy.ts +85 -0
- package/skills/four-meme/four-meme-integration/scripts/quote-sell.ts +66 -0
- package/skills/four-meme/four-meme-integration/scripts/send-token.ts +98 -0
- package/skills/four-meme/four-meme-integration/scripts/token-get.ts +31 -0
- package/skills/four-meme/four-meme-integration/scripts/token-list.ts +134 -0
- package/skills/four-meme/four-meme-integration/scripts/token-rankings.ts +162 -0
- package/skills/four-meme/four-meme-integration/scripts/verify-events.ts +47 -0
- package/skills/skillpp/contract-profiler/SKILL.md +118 -0
- package/skills/skillpp/newbie-tutor/SKILL.md +85 -0
- package/skills/skillpp/opportunity-board/SKILL.md +87 -0
- package/skills/skillpp/risk-fusion/SKILL.md +146 -0
- package/skills/skillpp/scam-pattern-lab/SKILL.md +115 -0
- package/skills/skillpp/wallet-doctor/SKILL.md +119 -0
- package/skills/skillpp/watchtower/SKILL.md +72 -0
- package/tests/compatibility/v0.1.0.json +117 -0
|
@@ -0,0 +1,466 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: onchain-pay-open-api
|
|
3
|
+
description: |
|
|
4
|
+
Binance Onchain Pay enables users to buy cryptocurrency with fiat (e.g., EUR, USD) or send existing crypto from their Binance account directly to any external on-chain wallet address in a single flow—no manual withdrawal needed.
|
|
5
|
+
|
|
6
|
+
Enables partners to integrate crypto buying services:
|
|
7
|
+
- payment-method-list: Get available payment methods (Card, P2P, Google Pay, Apple Pay, etc.) with limits for a fiat/crypto pair
|
|
8
|
+
- trading-pairs: List all supported fiat currencies and cryptocurrencies
|
|
9
|
+
- estimated-quote: Get real-time price quote including exchange rate, fees, and estimated crypto amount
|
|
10
|
+
- pre-order: Create a buy order and get redirect URL to Binance payment flow
|
|
11
|
+
- order: Query order status and details (processing, completed, failed, etc.)
|
|
12
|
+
- crypto-network: Get supported blockchain networks with withdraw fees and limits
|
|
13
|
+
- p2p/trading-pairs: List P2P-specific trading pairs
|
|
14
|
+
metadata:
|
|
15
|
+
version: 0.1.1
|
|
16
|
+
author: onchain-pay-team
|
|
17
|
+
license: MIT
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
# Binance Onchain-Pay Open API Skill
|
|
21
|
+
|
|
22
|
+
Call Binance Onchain-Pay Open API endpoints with automatic RSA SHA256 request signing.
|
|
23
|
+
|
|
24
|
+
## Use Cases & Scenarios
|
|
25
|
+
|
|
26
|
+
This skill is designed for the following scenarios:
|
|
27
|
+
|
|
28
|
+
### 1. 💳 Fiat-to-Crypto Purchase & Send
|
|
29
|
+
**When to use**: User wants to buy crypto with fiat currency and send directly to an external on-chain wallet address
|
|
30
|
+
- Buy USDT with USD/EUR/TWD using credit card → Send to MetaMask address on BSC
|
|
31
|
+
- Purchase BTC with Google Pay → Transfer to hardware wallet
|
|
32
|
+
- Buy USDC with P2P → Send to DeFi protocol contract address
|
|
33
|
+
|
|
34
|
+
**Key APIs**: `trading-pairs` → `payment-method-list` → `estimated-quote` → `pre-order`
|
|
35
|
+
|
|
36
|
+
### 2. 🔄 Direct Crypto Transfer (Send Primary)
|
|
37
|
+
**When to use**: User has crypto in Binance account and wants to send to external address
|
|
38
|
+
- Send existing USDT from Binance Spot to friend's wallet address
|
|
39
|
+
- Transfer ETH to Uniswap contract for trading
|
|
40
|
+
- Move crypto from Binance to self-custodial wallet (Trust Wallet, Ledger, etc.)
|
|
41
|
+
|
|
42
|
+
**Key APIs**: `pre-order` with `SEND_PRIMARY` customization
|
|
43
|
+
|
|
44
|
+
### 3. 🔗 Cross-Chain Bridge Operations
|
|
45
|
+
**When to use**: User needs to buy crypto on one chain and transfer to another network
|
|
46
|
+
- Buy USDC on Ethereum → Bridge to Polygon for lower fees
|
|
47
|
+
- Purchase tokens on BSC → Transfer to Base network
|
|
48
|
+
- Fiat to crypto on Solana → Send to Arbitrum for DeFi
|
|
49
|
+
|
|
50
|
+
**Key APIs**: `crypto-network` → `pre-order` with network selection
|
|
51
|
+
|
|
52
|
+
### 4. 🏪 Merchant Payment Integration
|
|
53
|
+
**When to use**: Integrate crypto payment gateway for e-commerce or services
|
|
54
|
+
- Accept fiat payments and auto-convert to crypto
|
|
55
|
+
- Enable "Pay with Crypto" checkout flow
|
|
56
|
+
- Process subscription payments with crypto
|
|
57
|
+
|
|
58
|
+
**Key APIs**: `pre-order` with `externalOrderId` tracking
|
|
59
|
+
|
|
60
|
+
### 5. 🤖 Smart Contract Interaction (Onchain-Pay Easy)
|
|
61
|
+
**When to use**: Buy crypto and execute smart contract in one transaction
|
|
62
|
+
- Buy USDT and deposit to lending protocol
|
|
63
|
+
- Purchase tokens and stake in DeFi pool
|
|
64
|
+
- Fiat on-ramp directly to GameFi or NFT marketplace
|
|
65
|
+
|
|
66
|
+
**Key APIs**: `pre-order` with `ON_CHAIN_PROXY_MODE` customization
|
|
67
|
+
|
|
68
|
+
### 6. 📊 Query & Monitoring
|
|
69
|
+
**When to use**: Check order status, available networks, or payment methods
|
|
70
|
+
- Monitor order processing status (pending, completed, failed)
|
|
71
|
+
- List supported fiat currencies and cryptocurrencies
|
|
72
|
+
- Check available payment methods for specific country/amount
|
|
73
|
+
- Verify network fees and limits
|
|
74
|
+
|
|
75
|
+
**Key APIs**: `order`, `crypto-network`, `trading-pairs`, `payment-method-list`
|
|
76
|
+
|
|
77
|
+
---
|
|
78
|
+
|
|
79
|
+
## Quick Reference
|
|
80
|
+
|
|
81
|
+
| Endpoint | API Path | Required Params | Optional Params |
|
|
82
|
+
|----------|----------|-----------------|-----------------|
|
|
83
|
+
| Payment Method List (v1) | `papi/v1/ramp/connect/buy/payment-method-list` | fiatCurrency, cryptoCurrency, totalAmount, amountType | network, contractAddress |
|
|
84
|
+
| Payment Method List (v2) | `papi/v2/ramp/connect/buy/payment-method-list` | (none) | lang |
|
|
85
|
+
| Trading Pairs | `papi/v1/ramp/connect/buy/trading-pairs` | (none) | (none) |
|
|
86
|
+
| Estimated Quote | `papi/v1/ramp/connect/buy/estimated-quote` | fiatCurrency, requestedAmount, payMethodCode, amountType | cryptoCurrency, contractAddress, address, network |
|
|
87
|
+
| Pre-order | `papi/v1/ramp/connect/gray/buy/pre-order` | externalOrderId, merchantCode, merchantName, ts | fiatCurrency, fiatAmount, cryptoCurrency, requestedAmount, amountType, address, network, payMethodCode, payMethodSubCode, redirectUrl, failRedirectUrl, redirectDeepLink, failRedirectDeepLink, customization, destContractAddress, destContractABI, destContractParams, affiliateCode, gtrTemplateCode, contractAddress |
|
|
88
|
+
| Get Order | `papi/v1/ramp/connect/order` | externalOrderId | (none) |
|
|
89
|
+
| Crypto Network | `papi/v1/ramp/connect/crypto-network` | (none) | (none) |
|
|
90
|
+
| P2P Trading Pairs | `papi/v1/ramp/connect/buy/p2p/trading-pairs` | (none) | fiatCurrency |
|
|
91
|
+
|
|
92
|
+
---
|
|
93
|
+
|
|
94
|
+
## How to Execute a Request
|
|
95
|
+
|
|
96
|
+
### Step 1: Gather credentials
|
|
97
|
+
|
|
98
|
+
Use the default account (prod) unless the user specifies otherwise. You need:
|
|
99
|
+
|
|
100
|
+
- **BASE_URL**: API base URL
|
|
101
|
+
- **CLIENT_ID**: Client identifier
|
|
102
|
+
- **API_KEY**: The sign access token
|
|
103
|
+
- **PEM_PATH**: Absolute path to the RSA private key PEM file
|
|
104
|
+
|
|
105
|
+
Use the account marked `(default)` in `.local.md`.
|
|
106
|
+
|
|
107
|
+
### Step 2: Build the JSON body
|
|
108
|
+
|
|
109
|
+
Build a compact JSON body from user-specified parameters. Remove any parameters the user did not provide.
|
|
110
|
+
|
|
111
|
+
**IMPORTANT: Address and Network Validation**
|
|
112
|
+
- `address` (destination wallet address) and `network` (blockchain network) are REQUIRED for all pre-order requests
|
|
113
|
+
- If the user has configured `Default Address` and `Default Network` in `.local.md`, use them automatically
|
|
114
|
+
- If not configured or not provided by user, ASK the user to provide both values before proceeding
|
|
115
|
+
|
|
116
|
+
### Step 3: Sign and call using the bundled script
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
bash <skill_path>/scripts/sign_and_call.sh \
|
|
120
|
+
"<BASE_URL>" \
|
|
121
|
+
"<API_PATH>" \
|
|
122
|
+
"<CLIENT_ID>" \
|
|
123
|
+
"<API_KEY>" \
|
|
124
|
+
"<PEM_PATH>" \
|
|
125
|
+
'<JSON_BODY>'
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
### Step 4: Return results
|
|
129
|
+
|
|
130
|
+
Display the JSON response to the user in a readable format.
|
|
131
|
+
|
|
132
|
+
---
|
|
133
|
+
|
|
134
|
+
## Authentication
|
|
135
|
+
|
|
136
|
+
See [`references/authentication.md`](./references/authentication.md) for full signing details.
|
|
137
|
+
|
|
138
|
+
Summary:
|
|
139
|
+
1. Payload = `JSON_BODY` + `TIMESTAMP` (milliseconds)
|
|
140
|
+
2. Sign payload with RSA SHA256 using PEM private key
|
|
141
|
+
3. Base64 encode the signature (single line)
|
|
142
|
+
4. Send as POST with headers: `X-Tesla-ClientId`, `X-Tesla-SignAccessToken`, `X-Tesla-Signature`, `X-Tesla-Timestamp`, `Content-Type: application/json`
|
|
143
|
+
|
|
144
|
+
---
|
|
145
|
+
|
|
146
|
+
## Parameters Reference
|
|
147
|
+
|
|
148
|
+
### Payment Method List v1 (`buy/payment-method-list`)
|
|
149
|
+
|
|
150
|
+
| Parameter | Type | Required | Description |
|
|
151
|
+
|-----------|------|----------|-------------|
|
|
152
|
+
| fiatCurrency | string | Yes | Fiat currency code (e.g., `USD`, `EUR`, `BRL`, `UGX`) |
|
|
153
|
+
| cryptoCurrency | string | Yes | Crypto currency code (e.g., `BTC`, `USDT`, `USDC`, `SEI`) |
|
|
154
|
+
| totalAmount | number | Yes | Amount value |
|
|
155
|
+
| amountType | number | Yes | `1` = fiat amount, `2` = crypto amount |
|
|
156
|
+
| network | string | No | Blockchain network (e.g., `BSC`, `ETH`, `SOL`, `BASE`, `SEI`) |
|
|
157
|
+
| contractAddress | string | No | Token contract address (required for non-native tokens) |
|
|
158
|
+
|
|
159
|
+
### Payment Method List v2 (`v2/buy/payment-method-list`)
|
|
160
|
+
|
|
161
|
+
Get all available payment methods without specifying fiat/crypto parameters. Simplified version of v1.
|
|
162
|
+
|
|
163
|
+
| Parameter | Type | Required | Description |
|
|
164
|
+
|-----------|------|----------|-------------|
|
|
165
|
+
| lang | string | No | Language code for localized payment method names (e.g., `en`, `cn`, `es`) |
|
|
166
|
+
|
|
167
|
+
**Differences from v1**:
|
|
168
|
+
- **Simpler**: No need to specify fiatCurrency, cryptoCurrency, or amount
|
|
169
|
+
- **Comprehensive**: Returns all available payment methods for the merchant
|
|
170
|
+
- **Use case**: Useful for displaying all options before user input
|
|
171
|
+
|
|
172
|
+
**Response Format**: Same as v1, returns list of payment methods with their limits and properties.
|
|
173
|
+
|
|
174
|
+
### Estimated Quote (`buy/estimated-quote`)
|
|
175
|
+
|
|
176
|
+
| Parameter | Type | Required | Description |
|
|
177
|
+
|-----------|------|----------|-------------|
|
|
178
|
+
| fiatCurrency | string | Yes | Fiat currency code |
|
|
179
|
+
| cryptoCurrency | string | No | Crypto currency code (optional if contractAddress provided) |
|
|
180
|
+
| requestedAmount | number | Yes | Amount value |
|
|
181
|
+
| payMethodCode | string | Yes | Payment method (e.g., `BUY_CARD`, `BUY_GOOGLE_PAY`, `BUY_P2P`, `BUY_WALLET`) |
|
|
182
|
+
| amountType | number | Yes | `1` = fiat amount, `2` = crypto amount |
|
|
183
|
+
| network | string | **Yes*** | Blockchain network (can use default from `.local.md`) |
|
|
184
|
+
| contractAddress | string | No | Token contract address |
|
|
185
|
+
| address | string | **Yes*** | Destination wallet address for receiving crypto |
|
|
186
|
+
|
|
187
|
+
\* Recommended: These parameters should be provided. If not specified by user, check `.local.md` for defaults. If no defaults exist, ask user before proceeding.
|
|
188
|
+
|
|
189
|
+
### Pre-order (`buy/pre-order`)
|
|
190
|
+
|
|
191
|
+
Create a buy pre-order and return the redirect link for payment.
|
|
192
|
+
|
|
193
|
+
| Parameter | Type | Required | Description |
|
|
194
|
+
|-----------|------|----------|-------------|
|
|
195
|
+
| externalOrderId | string | Yes | Partner's unique order ID (must be unique) |
|
|
196
|
+
| merchantCode | string | Yes | Merchant code (e.g., `connect-gray`) |
|
|
197
|
+
| merchantName | string | Yes | Merchant display name (e.g., `GrayTest`) |
|
|
198
|
+
| ts | number | Yes | Current timestamp in milliseconds |
|
|
199
|
+
| fiatCurrency | string | No* | Fiat currency code (e.g., `TWD`, `USD`, `EUR`) |
|
|
200
|
+
| fiatAmount | number | No* | Fiat amount to spend |
|
|
201
|
+
| cryptoCurrency | string | No* | Crypto currency to buy (e.g., `USDT`, `BTC`, `ETH`) |
|
|
202
|
+
| requestedAmount | number | No* | Amount value (fiat or crypto based on amountType) |
|
|
203
|
+
| amountType | number | No* | `1` = fiat amount, `2` = crypto amount |
|
|
204
|
+
| address | string | No | Destination wallet address for receiving crypto |
|
|
205
|
+
| network | string | No | Blockchain network (e.g., `BSC`, `ETH`, `SOL`) |
|
|
206
|
+
| payMethodCode | string | No | Payment method code (e.g., `BUY_CARD`, `BUY_P2P`, `BUY_GOOGLE_PAY`, `BUY_APPLE_PAY`, `BUY_PAYPAL`, `BUY_WALLET`, `BUY_REVOLUT`) |
|
|
207
|
+
| payMethodSubCode | string | No | Payment method sub-code (e.g., `card`, `GOOGLE_PAY`, `WECHAT`) |
|
|
208
|
+
| redirectUrl | string | No | Success redirect URL |
|
|
209
|
+
| failRedirectUrl | string | No | Failure redirect URL |
|
|
210
|
+
| redirectDeepLink | string | No | Deep link for success (mobile apps) |
|
|
211
|
+
| failRedirectDeepLink | string | No | Deep link for failure (mobile apps) |
|
|
212
|
+
| customization | object | No | Custom configuration object (see Customization section below) |
|
|
213
|
+
| destContractAddress | string | No | Destination contract address (for Onchain-Pay Easy mode) |
|
|
214
|
+
| destContractABI | string | No | Contract ABI name (for Onchain-Pay Easy mode) |
|
|
215
|
+
| destContractParams | object | No | Contract parameters (for Onchain-Pay Easy mode) |
|
|
216
|
+
| affiliateCode | string | No | Affiliate code for commission tracking |
|
|
217
|
+
| gtrTemplateCode | string | No | GTR template code (e.g., `OTHERS`) |
|
|
218
|
+
| contractAddress | string | No | Token contract address (for non-native tokens) |
|
|
219
|
+
|
|
220
|
+
\* Either `fiatAmount` or (`requestedAmount` + `amountType`) should be provided. If `fiatCurrency` is not provided, the system will auto-select available fiat currencies.
|
|
221
|
+
|
|
222
|
+
**Response Example**:
|
|
223
|
+
```json
|
|
224
|
+
{
|
|
225
|
+
"code": "000000",
|
|
226
|
+
"message": "success",
|
|
227
|
+
"data": {
|
|
228
|
+
"link": "https://app.binance.com/uni-qr/ccnt?...",
|
|
229
|
+
"linkExpireTime": 1772852565045
|
|
230
|
+
},
|
|
231
|
+
"success": true
|
|
232
|
+
}
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
### Get Order (`order`)
|
|
236
|
+
|
|
237
|
+
| Parameter | Type | Required | Description |
|
|
238
|
+
|-----------|------|----------|-------------|
|
|
239
|
+
| externalOrderId | string | Yes | The external order ID to query |
|
|
240
|
+
|
|
241
|
+
---
|
|
242
|
+
|
|
243
|
+
## Customization Options
|
|
244
|
+
|
|
245
|
+
The `customization` field in pre-order API accepts various flags to customize the buy flow behavior. Each merchant must have the corresponding permission configured in `db.merchant_info` table.
|
|
246
|
+
|
|
247
|
+
### Available Customization Flags
|
|
248
|
+
|
|
249
|
+
| Flag | Code | Type | Availability | Description | Use Case |
|
|
250
|
+
|------|------|------|--------------|-------------|----------|
|
|
251
|
+
| `LOCK_ORDER_ATTRIBUTES` | 1 | array | Open API ✓ | Lock specific order attributes so users cannot modify them. Values: `1`=fiat currency, `2`=crypto currency, `3`=amount, `4`=payment method, `5`=network, `6`=address, `7`=fiat amount, `8`=crypto amount | Fixed-parameter orders |
|
|
252
|
+
| `SKIP_CASHIER` | 2 | boolean | Open API ✓ | Skip the cashier page and proceed directly to payment. Reduces user friction in the checkout flow. | Streamlined payment experience |
|
|
253
|
+
| `AUTO_REDIRECTION` | 3 | boolean | Open API ✓ | Automatically redirect to `redirectUrl` after order completion without showing success page. | Seamless user experience |
|
|
254
|
+
| `HIDE_SEND` | 6 | boolean | Open API ✓ | Hide the "Send" tab in the UI. Useful when only buy flow is needed. | Buy-only integration |
|
|
255
|
+
| `SEND_PRIMARY` | 7 | boolean | Open API ✓ | Enable Send Crypto feature. If user's Binance balance is insufficient, auto-trigger buy flow first. | Send crypto to external address |
|
|
256
|
+
| `MERCHANT_DISPLAY_NAME` | 8 | string | Open API ✓ | Override the display name shown to users in the UI. | Custom branding |
|
|
257
|
+
| `NET_RECEIVE` | 9 | boolean | Open API ✓ | User receives net amount after deducting all fees. Total cost is more transparent. | Better UX for showing final received amount |
|
|
258
|
+
| `P2P_EXPRESS` | 10 | boolean | Open API ✓ | Enable P2P Express mode for faster P2P order matching. | Quick P2P transactions |
|
|
259
|
+
| `OPEN_NETWORK` | 11 | boolean | Web3 only | Allow users to select different networks. Default is locked to pre-selected network. **Note**: Currently only available for Web3 entrance, not available for Open API. | Multi-network support (Web3 only) |
|
|
260
|
+
| `ON_CHAIN_PROXY_MODE` | 12 | boolean | Open API ✓ | Enable Onchain-Pay Easy mode. After buying crypto, Onchain-Pay will execute smart contract interaction instead of direct withdrawal to user wallet. Requires `destContractAddress`, `destContractABI`, and `destContractParams`. | Fiat to Smart Contract integration |
|
|
261
|
+
| `SEND_PRIMARY_FLEXIBLE` | 13 | boolean | Open API ✓ | Flexible Send Primary mode with more options. | Advanced send crypto scenarios |
|
|
262
|
+
|
|
263
|
+
### Customization Examples
|
|
264
|
+
|
|
265
|
+
**Example 1: Basic Card Payment**
|
|
266
|
+
```json
|
|
267
|
+
{
|
|
268
|
+
"customization": {}
|
|
269
|
+
}
|
|
270
|
+
```
|
|
271
|
+
|
|
272
|
+
**Example 2: Onchain-Pay Easy (On-Chain Proxy)**
|
|
273
|
+
```json
|
|
274
|
+
{
|
|
275
|
+
"customization": {
|
|
276
|
+
"ON_CHAIN_PROXY_MODE": true,
|
|
277
|
+
"NET_RECEIVE": true,
|
|
278
|
+
"SEND_PRIMARY": true
|
|
279
|
+
},
|
|
280
|
+
"destContractAddress": "0x128...974",
|
|
281
|
+
"destContractABI": "depositFor",
|
|
282
|
+
"destContractParams": {
|
|
283
|
+
"accountType": 2
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
**Example 3: Send Crypto**
|
|
289
|
+
```json
|
|
290
|
+
{
|
|
291
|
+
"customization": {
|
|
292
|
+
"SEND_PRIMARY_FLEXIBLE": true,
|
|
293
|
+
"SEND_PRIMARY": true
|
|
294
|
+
}
|
|
295
|
+
}
|
|
296
|
+
```
|
|
297
|
+
|
|
298
|
+
**Example 4: P2P with Auto Redirection**
|
|
299
|
+
```json
|
|
300
|
+
{
|
|
301
|
+
"customization": {
|
|
302
|
+
"AUTO_REDIRECTION": true,
|
|
303
|
+
"P2P_EXPRESS": true
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
```
|
|
307
|
+
|
|
308
|
+
**Example 5: Lock Order Attributes**
|
|
309
|
+
```json
|
|
310
|
+
{
|
|
311
|
+
"customization": {
|
|
312
|
+
"LOCK_ORDER_ATTRIBUTES": [2, 3, 6, 7, 8],
|
|
313
|
+
"MERCHANT_DISPLAY_NAME": "My Custom Brand"
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
```
|
|
317
|
+
Lock attribute codes:
|
|
318
|
+
- `2` = Crypto currency
|
|
319
|
+
- `3` = Amount
|
|
320
|
+
- `6` = Address
|
|
321
|
+
- `7` = Fiat amount
|
|
322
|
+
- `8` = Crypto amount
|
|
323
|
+
|
|
324
|
+
**Example 6: Net Receive Mode**
|
|
325
|
+
```json
|
|
326
|
+
{
|
|
327
|
+
"customization": {
|
|
328
|
+
"NET_RECEIVE": true,
|
|
329
|
+
"SEND_PRIMARY": true
|
|
330
|
+
}
|
|
331
|
+
}
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
**Example 7: Hide Send Tab**
|
|
335
|
+
```json
|
|
336
|
+
{
|
|
337
|
+
"customization": {
|
|
338
|
+
"HIDE_SEND": true
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
```
|
|
342
|
+
|
|
343
|
+
**Example 8: Skip Cashier (Direct Payment)**
|
|
344
|
+
```json
|
|
345
|
+
{
|
|
346
|
+
"customization": {
|
|
347
|
+
"SKIP_CASHIER": true
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
### Important Notes
|
|
353
|
+
|
|
354
|
+
1. **Permission Required**: Each customization flag requires merchant permission. Check with admin if a flag is not working.
|
|
355
|
+
2. **Onchain-Pay Easy**: Only supported on BSC network currently. Requires contract integration.
|
|
356
|
+
3. **Validation**: Invalid customization values (e.g., `null` for `MERCHANT_DISPLAY_NAME`) will return `ILLEGAL_CUSTOMIZATION_VALUE` error.
|
|
357
|
+
4. **Combinations**: Some flags work together (e.g., `NET_RECEIVE` + `SEND_PRIMARY`), while others are independent.
|
|
358
|
+
5. **Testing**: Use test accounts (`connect-gray`) for testing customization flags before production.
|
|
359
|
+
6. **Internal Flags**: `OPERATION` (code 4) and `SKIP_WITHDRAW` (code 5) are internal use only and should NOT be passed from merchant side.
|
|
360
|
+
7. **OPEN_NETWORK**: Currently only available for Web3 entrance, not available for Open API. Do not use this flag in Open API pre-order requests.
|
|
361
|
+
8. **Flag Order**: Flags are ordered by their internal code (1-13). The code number is used internally for identification.
|
|
362
|
+
|
|
363
|
+
---
|
|
364
|
+
|
|
365
|
+
## Security
|
|
366
|
+
|
|
367
|
+
### Credential Display Rules
|
|
368
|
+
|
|
369
|
+
- **API Key**: Show first 5 + last 4 characters only (e.g., `2zefb...06h`)
|
|
370
|
+
- **PEM Private Key**: NEVER display content. NEVER display the file path.
|
|
371
|
+
- **Client ID**: Can be displayed in full.
|
|
372
|
+
- **Outbound Requests**: NEVER send API Key, Private Key, or any credentials to URLs outside the Base URL configured in `.local.md`.
|
|
373
|
+
- **File Path Privacy**: NEVER display the PEM private key file path to the user in any output or logs.
|
|
374
|
+
|
|
375
|
+
### Credential Storage
|
|
376
|
+
|
|
377
|
+
Credentials are stored in a `.local.md` file in the skill directory. This file is **user-specific** and should NOT be distributed.
|
|
378
|
+
|
|
379
|
+
Read the `.local.md` file from the same directory as this SKILL.md to load credentials.
|
|
380
|
+
|
|
381
|
+
If `.local.md` does not exist or the requested account is not found, ask the user to provide:
|
|
382
|
+
1. Base URL
|
|
383
|
+
2. Client ID
|
|
384
|
+
3. API Key
|
|
385
|
+
4. PEM file path (absolute path)
|
|
386
|
+
|
|
387
|
+
Then offer to save them to `.local.md` for future use.
|
|
388
|
+
|
|
389
|
+
#### `.local.md` Format
|
|
390
|
+
|
|
391
|
+
```markdown
|
|
392
|
+
## Onchain-Pay Accounts
|
|
393
|
+
|
|
394
|
+
### prod (default)
|
|
395
|
+
- Base URL: https://api.commonservice.io
|
|
396
|
+
- Client ID: your-client-id
|
|
397
|
+
- API Key: your-api-key
|
|
398
|
+
- PEM Path: /absolute/path/to/your/private.pem
|
|
399
|
+
- Default Network: your-preferred-network
|
|
400
|
+
- Default Address: your-wallet-address
|
|
401
|
+
- Description: Production account
|
|
402
|
+
```
|
|
403
|
+
|
|
404
|
+
The account marked `(default)` is used automatically. You can define multiple accounts and switch by telling Claude the account name.
|
|
405
|
+
|
|
406
|
+
---
|
|
407
|
+
|
|
408
|
+
## User Agent Header
|
|
409
|
+
|
|
410
|
+
Include `User-Agent` header with the following string: `onchain-pay-open-api/0.1.0 (Skill)`
|
|
411
|
+
|
|
412
|
+
---
|
|
413
|
+
|
|
414
|
+
## Agent Behavior
|
|
415
|
+
|
|
416
|
+
1. If the user asks to call an Onchain-Pay API endpoint, identify which endpoint from the Quick Reference table
|
|
417
|
+
2. Ask for any missing required parameters
|
|
418
|
+
3. Use stored credentials if available, otherwise ask the user
|
|
419
|
+
4. Execute the request using the bundled `scripts/sign_and_call.sh`
|
|
420
|
+
5. Display the response in a readable format
|
|
421
|
+
6. If the request fails, show the error and suggest fixes
|
|
422
|
+
|
|
423
|
+
---
|
|
424
|
+
|
|
425
|
+
## Important Notes for Pre-order API
|
|
426
|
+
|
|
427
|
+
### Timestamp Generation (Cross-platform)
|
|
428
|
+
|
|
429
|
+
When generating timestamps for the `ts` parameter and `externalOrderId`, use the following approach for cross-platform compatibility:
|
|
430
|
+
|
|
431
|
+
```bash
|
|
432
|
+
# Generate millisecond timestamp (works on macOS, Linux, BSD)
|
|
433
|
+
TIMESTAMP=$(($(date +%s) * 1000))
|
|
434
|
+
|
|
435
|
+
# Generate unique order ID
|
|
436
|
+
ORDER_ID="order$(date +%s)"
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
**DO NOT USE** `date +%s%3N` or `date +%s000` as these are not portable:
|
|
440
|
+
- `date +%s%3N` doesn't work on macOS (outputs literal 'N')
|
|
441
|
+
- `date +%s000` just appends '000' without actual millisecond precision
|
|
442
|
+
|
|
443
|
+
### Order ID Format
|
|
444
|
+
|
|
445
|
+
The `externalOrderId` must be a valid string without special characters. Recommended formats:
|
|
446
|
+
- `order1773744500` (simple numeric suffix)
|
|
447
|
+
- `order_1773744500` (with underscore separator)
|
|
448
|
+
- `txn-abc123` (custom prefix with alphanumeric)
|
|
449
|
+
|
|
450
|
+
**Avoid**: `order_${TIMESTAMP}` where TIMESTAMP contains shell variable syntax errors
|
|
451
|
+
|
|
452
|
+
### Example Pre-order Request
|
|
453
|
+
|
|
454
|
+
```bash
|
|
455
|
+
# Correct way to create a pre-order
|
|
456
|
+
TIMESTAMP=$(($(date +%s) * 1000))
|
|
457
|
+
ORDER_ID="order$(date +%s)"
|
|
458
|
+
|
|
459
|
+
bash /path/to/scripts/sign_and_call.sh \
|
|
460
|
+
"https://api.commonservice.io" \
|
|
461
|
+
"papi/v1/ramp/connect/gray/buy/pre-order" \
|
|
462
|
+
"connect-gray" \
|
|
463
|
+
"your-api-key" \
|
|
464
|
+
"/path/to/private.pem" \
|
|
465
|
+
"{\"externalOrderId\":\"$ORDER_ID\",\"merchantCode\":\"connect-gray\",\"merchantName\":\"YourMerchant\",\"ts\":$TIMESTAMP,\"fiatCurrency\":\"USD\",\"requestedAmount\":100,\"cryptoCurrency\":\"BNB\",\"amountType\":1,\"address\":\"0x...\",\"network\":\"BSC\",\"payMethodCode\":\"BUY_CARD\"}"
|
|
466
|
+
```
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
# Binance Onchain-Pay Open API Authentication
|
|
2
|
+
|
|
3
|
+
## Signing Process
|
|
4
|
+
|
|
5
|
+
All Onchain-Pay Open API requests use **RSA SHA256** signature with a PEM private key.
|
|
6
|
+
|
|
7
|
+
### Step 1: Build the Signing Payload
|
|
8
|
+
|
|
9
|
+
```
|
|
10
|
+
payload = JSON_BODY + TIMESTAMP
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
- `JSON_BODY`: The raw JSON request body string (compact, no trailing newline). If no body is needed, use empty string.
|
|
14
|
+
- `TIMESTAMP`: Current Unix timestamp in **milliseconds** (e.g., `1709654400000`)
|
|
15
|
+
|
|
16
|
+
Example:
|
|
17
|
+
```
|
|
18
|
+
{"fiatCurrency":"USD","cryptoCurrency":"BTC","totalAmount":100,"amountType":1}1709654400000
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Step 2: Sign with RSA SHA256
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
signature=$(echo -n "$payload" \
|
|
25
|
+
| openssl dgst -sha256 -sign "$PRIVATE_KEY_PATH" \
|
|
26
|
+
| openssl enc -base64 -A)
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
- Uses the RSA private key in PEM format
|
|
30
|
+
- SHA256 digest
|
|
31
|
+
- Base64 encoded (single line, no wrapping)
|
|
32
|
+
|
|
33
|
+
### Step 3: Send Request with Headers
|
|
34
|
+
|
|
35
|
+
All requests are **POST** with these headers:
|
|
36
|
+
|
|
37
|
+
| Header | Value |
|
|
38
|
+
|--------|-------|
|
|
39
|
+
| `X-Tesla-ClientId` | Your client ID (e.g., `your-client-id`) |
|
|
40
|
+
| `X-Tesla-SignAccessToken` | Your API key |
|
|
41
|
+
| `X-Tesla-Signature` | The RSA signature from Step 2 |
|
|
42
|
+
| `X-Tesla-Timestamp` | The timestamp used in signing |
|
|
43
|
+
| `Content-Type` | `application/json` |
|
|
44
|
+
| `x-trace-id` | (Optional) Trace ID for debugging |
|
|
45
|
+
|
|
46
|
+
### Complete Example
|
|
47
|
+
|
|
48
|
+
```bash
|
|
49
|
+
# Generate timestamp in milliseconds (cross-platform compatible)
|
|
50
|
+
timestamp=$(($(date +%s) * 1000))
|
|
51
|
+
api_params='{"fiatCurrency":"USD","cryptoCurrency":"BTC","totalAmount":100,"amountType":1}'
|
|
52
|
+
payload="${api_params}${timestamp}"
|
|
53
|
+
|
|
54
|
+
signature=$(echo -n "$payload" \
|
|
55
|
+
| openssl dgst -sha256 -sign "test.pem" \
|
|
56
|
+
| openssl enc -base64 -A)
|
|
57
|
+
|
|
58
|
+
curl --location --request POST "https://api.commonservice.io/papi/v1/ramp/connect/buy/payment-method-list" \
|
|
59
|
+
--header "X-Tesla-ClientId: your-client-id" \
|
|
60
|
+
--header "X-Tesla-SignAccessToken: your-api-key" \
|
|
61
|
+
--header "X-Tesla-Signature: $signature" \
|
|
62
|
+
--header "X-Tesla-Timestamp: $timestamp" \
|
|
63
|
+
--header "Content-Type: application/json" \
|
|
64
|
+
--data-raw "$api_params"
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### Important: Cross-platform Timestamp Generation
|
|
68
|
+
|
|
69
|
+
**Correct (works on macOS, Linux, BSD):**
|
|
70
|
+
```bash
|
|
71
|
+
timestamp=$(($(date +%s) * 1000))
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
**Incorrect (do not use):**
|
|
75
|
+
```bash
|
|
76
|
+
# ❌ Doesn't work on macOS - outputs literal 'N'
|
|
77
|
+
timestamp=$(date +%s%3N)
|
|
78
|
+
|
|
79
|
+
# ❌ Just appends '000', not true milliseconds
|
|
80
|
+
timestamp=$(date +%s000)
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
On macOS, `date` doesn't support `%N` (nanoseconds), which causes `date +%s%3N` to output something like `1773744478N`. This breaks JSON parsing with error:
|
|
84
|
+
```
|
|
85
|
+
Unexpected character ('N' (code 78)): was expecting comma to separate Object entries
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
## Security Notes
|
|
89
|
+
|
|
90
|
+
- Never expose the PEM private key content
|
|
91
|
+
- Never display the full API key; show first 5 + last 4 characters only (e.g., `2zefb...06h`)
|
|
92
|
+
- The PEM file path should be absolute or relative to the working directory
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
#!/usr/bin/env bash
|
|
2
|
+
set -euo pipefail
|
|
3
|
+
|
|
4
|
+
# Binance Onchain-Pay Open API - Sign & Call
|
|
5
|
+
# Usage: sign_and_call.sh <base_url> <api_path> <client_id> <api_key> <pem_path> <json_body>
|
|
6
|
+
#
|
|
7
|
+
# Example:
|
|
8
|
+
# sign_and_call.sh "https://api.commonservice.io" \
|
|
9
|
+
# "papi/v1/ramp/connect/buy/payment-method-list" \
|
|
10
|
+
# "your-client-id" \
|
|
11
|
+
# "your-api-key" \
|
|
12
|
+
# "/path/to/private.pem" \
|
|
13
|
+
# '{"fiatCurrency":"USD","cryptoCurrency":"BTC","totalAmount":100,"amountType":1}'
|
|
14
|
+
|
|
15
|
+
BASE_URL="$1"
|
|
16
|
+
API_PATH="$2"
|
|
17
|
+
CLIENT_ID="$3"
|
|
18
|
+
API_KEY="$4"
|
|
19
|
+
PEM_PATH="$5"
|
|
20
|
+
JSON_BODY="${6:-}"
|
|
21
|
+
|
|
22
|
+
# Generate timestamp (milliseconds) - cross-platform compatible
|
|
23
|
+
# Using arithmetic expansion works on macOS, Linux, and BSD
|
|
24
|
+
timestamp=$(($(date +%s) * 1000))
|
|
25
|
+
|
|
26
|
+
# Build signing payload: JSON body + timestamp
|
|
27
|
+
payload="${JSON_BODY}${timestamp}"
|
|
28
|
+
|
|
29
|
+
# RSA SHA256 sign with PEM private key, base64 encode
|
|
30
|
+
signature=$(echo -n "$payload" \
|
|
31
|
+
| openssl dgst -sha256 -sign "$PEM_PATH" \
|
|
32
|
+
| openssl enc -base64 -A)
|
|
33
|
+
|
|
34
|
+
# Build curl command
|
|
35
|
+
curl_args=(
|
|
36
|
+
--silent
|
|
37
|
+
--location
|
|
38
|
+
--request POST "${BASE_URL}/${API_PATH}"
|
|
39
|
+
--header "X-Tesla-ClientId: ${CLIENT_ID}"
|
|
40
|
+
--header "X-Tesla-SignAccessToken: ${API_KEY}"
|
|
41
|
+
--header "X-Tesla-Signature: ${signature}"
|
|
42
|
+
--header "X-Tesla-Timestamp: ${timestamp}"
|
|
43
|
+
--header "Content-Type: application/json"
|
|
44
|
+
--header "x-trace-id: skill_${timestamp}"
|
|
45
|
+
--header "User-Agent: onchain-pay-open-api/0.1.0 (Skill)"
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
if [ -n "$JSON_BODY" ]; then
|
|
49
|
+
curl_args+=(--data-raw "$JSON_BODY")
|
|
50
|
+
fi
|
|
51
|
+
|
|
52
|
+
curl "${curl_args[@]}" | python3 -m json.tool 2>/dev/null || curl "${curl_args[@]}"
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## 1.1.0 - 2026-04-20
|
|
4
|
+
|
|
5
|
+
### Scene 1: Order Query & Appeal Handling
|
|
6
|
+
- Added: Order detail query by order number (`getUserOrderDetail`)
|
|
7
|
+
- Added: Order list with rich filters — status, trade type, asset, date range (`listOrders`)
|
|
8
|
+
- Added: Enhanced order history with counterpart nickname and advertisement role (`listUserOrderHistory`)
|
|
9
|
+
- Added: Complaint/appeal status query with pagination and filters (`query-complaints`)
|
|
10
|
+
- Added: Order status branch handling (completed → timeline, in-progress → countdown, appealing → auto-show appeal)
|
|
11
|
+
|
|
12
|
+
### Scene 2: Ad Publish & Management (Merchant Only)
|
|
13
|
+
- Added: Market reference price query for pricing decisions (`getReferencePrice`)
|
|
14
|
+
- Added: Market ad search with advertiser info (`search`)
|
|
15
|
+
- Added: Get available ad categories for current user (`getAvailableAdsCategory`)
|
|
16
|
+
- Added: Get user's configured payment methods (`getPayMethodByUserId`)
|
|
17
|
+
- Added: List all system trade methods (`listAllTradeMethods`)
|
|
18
|
+
- Added: Publish new advertisements with confirmation flow (`post`) **[write operation]**
|
|
19
|
+
- Added: Update existing ad parameters with diff display (`update`) **[write operation]**
|
|
20
|
+
- Added: Batch update ad status — online/offline/close (`updateStatus`) **[write operation]**
|
|
21
|
+
|
|
22
|
+
### Merchant & Support
|
|
23
|
+
- Added: Merchant profile and ad listings query (`getAdDetails`)
|
|
24
|
+
- Added: List supported digital currencies (`digitalCurrency/list`)
|
|
25
|
+
- Added: List supported fiat currencies (`fiatCurrency/list`)
|
|
26
|
+
|
|
27
|
+
## 1.0.1 - 2026-03-25
|
|
28
|
+
|
|
29
|
+
- Changed: Update order placement link format from filtered list page to ad-specific detail page using `adNo` parameter (`https://c2c.binance.com/en/adv?code={adNo}`)
|
|
30
|
+
|
|
31
|
+
## 1.0.0 - 2026-03-24
|
|
32
|
+
|
|
33
|
+
- Initial release
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Binance
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|