suiport-sdk 0.1.2 → 0.1.5
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/README.md +67 -32
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# suiport-sdk
|
|
2
2
|
|
|
3
|
-
Cross-chain payment SDK for Sui. Accept payments from any blockchain.
|
|
3
|
+
Cross-chain payment SDK for Sui. Accept payments from any blockchain with one line of code.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -14,47 +14,82 @@ npm install suiport-sdk
|
|
|
14
14
|
import { initSuiport, SuiportButton } from 'suiport-sdk'
|
|
15
15
|
|
|
16
16
|
// Initialize once at app startup
|
|
17
|
+
// Get your API key from https://partners.near-intents.org/
|
|
17
18
|
initSuiport({
|
|
18
|
-
apiKey: 'your-near-api-key',
|
|
19
|
+
apiKey: 'your-near-intents-api-key',
|
|
19
20
|
})
|
|
20
21
|
|
|
21
|
-
// Add the button
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
destinationToken="suiUSDC"
|
|
27
|
-
onSuccess={(result) => {
|
|
28
|
-
console.log('Payment complete!', result.txHash)
|
|
29
|
-
}}
|
|
30
|
-
/>
|
|
31
|
-
)
|
|
32
|
-
}
|
|
22
|
+
// Add the payment button
|
|
23
|
+
<SuiportButton
|
|
24
|
+
recipient="0x..." // Your Sui wallet address
|
|
25
|
+
onSuccess={(result) => console.log('Paid!', result.txHash)}
|
|
26
|
+
/>
|
|
33
27
|
```
|
|
34
28
|
|
|
29
|
+
That's it! Users can now pay you from 21+ blockchains. The token received is USDC on Sui by default.
|
|
30
|
+
|
|
31
|
+
## SuiportButton Props
|
|
32
|
+
|
|
33
|
+
| Prop | Type | Required | Default | Description |
|
|
34
|
+
|------|------|----------|---------|-------------|
|
|
35
|
+
| `recipient` | `string` | ✅ | - | Sui wallet address to receive payment |
|
|
36
|
+
| `destinationToken` | `'suiUSDC' \| 'suiSUI'` | ❌ | `'suiUSDC'` | Token to receive on Sui |
|
|
37
|
+
| `amount` | `string` | ❌ | - | Fixed amount (user selects if omitted) |
|
|
38
|
+
| `refundAddress` | `string` | ❌ | - | Refund address if payment fails* |
|
|
39
|
+
| `label` | `string` | ❌ | `'Pay with Crypto'` | Button text |
|
|
40
|
+
| `variant` | `'default' \| 'compact' \| 'outline'` | ❌ | `'default'` | Button style |
|
|
41
|
+
| `disabled` | `boolean` | ❌ | `false` | Disable the button |
|
|
42
|
+
| `className` | `string` | ❌ | - | Custom CSS class |
|
|
43
|
+
| `onSuccess` | `(result) => void` | ❌ | - | Called when payment completes |
|
|
44
|
+
| `onError` | `(error) => void` | ❌ | - | Called when payment fails |
|
|
45
|
+
| `onOpenChange` | `(open) => void` | ❌ | - | Called when modal opens/closes |
|
|
46
|
+
|
|
47
|
+
> *Note: In a future version, refund address input will be added directly in the modal UI, removing the need to pass it as a prop.
|
|
48
|
+
|
|
49
|
+
### Button Variants
|
|
50
|
+
|
|
51
|
+
- **`default`** - Gradient purple button with shadow (recommended)
|
|
52
|
+
- **`compact`** - Smaller version for tight spaces
|
|
53
|
+
- **`outline`** - Transparent with purple border
|
|
54
|
+
|
|
55
|
+
## Supported Chains & Tokens
|
|
56
|
+
|
|
57
|
+
| Chain | Tokens |
|
|
58
|
+
|-------|--------|
|
|
59
|
+
| **Sui** (destination) | SUI, USDC |
|
|
60
|
+
| **Ethereum** | ETH, USDC, USDT, WBTC, DAI, AAVE, UNI, LINK, SHIB, PEPE, TURBO, SAFE |
|
|
61
|
+
| **Solana** | SOL, USDC, USDT, TRUMP, WIF, MELANIA |
|
|
62
|
+
| **Bitcoin** | BTC |
|
|
63
|
+
| **Optimism** | ETH, USDC, USDT, OP |
|
|
64
|
+
| **Base** | ETH, USDC, cbBTC, BRETT |
|
|
65
|
+
| **Polygon** | POL, USDC, USDT |
|
|
66
|
+
| **Arbitrum** | ETH, USDC, USDT, ARB, GMX |
|
|
67
|
+
| **Avalanche** | AVAX, USDC, USDT |
|
|
68
|
+
| **BSC** | BNB, USDC, USDT |
|
|
69
|
+
| **TON** | TON, USDT |
|
|
70
|
+
| **Tron** | TRX, USDT |
|
|
71
|
+
| **NEAR** | wNEAR, USDC, USDT |
|
|
72
|
+
| **Cardano** | ADA |
|
|
73
|
+
| **XRP Ledger** | XRP |
|
|
74
|
+
| **Dogecoin** | DOGE |
|
|
75
|
+
| **Litecoin** | LTC |
|
|
76
|
+
| **Bitcoin Cash** | BCH |
|
|
77
|
+
| **Aptos** | APT |
|
|
78
|
+
| **Starknet** | STRK |
|
|
79
|
+
| **Berachain** | BERA |
|
|
80
|
+
| **Zcash** | ZEC |
|
|
81
|
+
|
|
35
82
|
## Features
|
|
36
83
|
|
|
37
|
-
- 🌐 Accept payments from
|
|
38
|
-
- ⚡
|
|
84
|
+
- 🌐 Accept payments from 21+ blockchains
|
|
85
|
+
- ⚡ Sub-minute settlement via NEAR Intents
|
|
39
86
|
- 💎 Premium glassmorphism UI
|
|
40
|
-
-
|
|
41
|
-
|
|
42
|
-
## API
|
|
43
|
-
|
|
44
|
-
### Components
|
|
45
|
-
|
|
46
|
-
- `SuiportButton` - Drop-in payment button
|
|
47
|
-
- `SuiportModal` - Payment modal component
|
|
48
|
-
|
|
49
|
-
### Hooks
|
|
50
|
-
|
|
51
|
-
- `useSuiportPayment` - Full control over payment flow
|
|
87
|
+
- 📱 Mobile-responsive modal
|
|
88
|
+
- 🔧 Zero wallet connection required from payers
|
|
52
89
|
|
|
53
|
-
|
|
90
|
+
## Advanced Usage
|
|
54
91
|
|
|
55
|
-
|
|
56
|
-
- `getQuote(options)` - Get swap quote
|
|
57
|
-
- `getExecutionStatus(depositAddress)` - Check status
|
|
92
|
+
For custom implementations, the SDK also exports `SuiportModal`, `useSuiportPayment` hook, and core functions like `getQuote` and `getExecutionStatus`. See the source code for details.
|
|
58
93
|
|
|
59
94
|
## License
|
|
60
95
|
|