uniport-sdk 0.0.1 → 0.0.3

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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Uniport
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,9 +1,9 @@
1
- # Uniport
1
+ # Uniport SDK
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/uniport-sdk.svg)](https://www.npmjs.com/package/uniport-sdk)
4
4
  [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
5
5
 
6
- Cross-chain payment SDK. Accept crypto payments from any blockchain with one line of code.
6
+ Cross-chain payment SDK for accepting crypto payments into a destination token you choose.
7
7
 
8
8
  [GitHub Repository](https://github.com/officialcmg/uniport)
9
9
 
@@ -16,85 +16,124 @@ npm install uniport-sdk
16
16
  ## Quick Start
17
17
 
18
18
  ```tsx
19
- import { initUniport, UniportButton } from 'uniport-sdk'
19
+ import { UniportButton } from 'uniport-sdk'
20
20
 
21
- // Initialize once at app startup
22
- // Get your API key from https://partners.near-intents.org/
23
- initUniport({
24
- apiKey: 'your-near-intents-api-key',
25
- })
26
-
27
- // Add the payment button
28
21
  <UniportButton
29
- recipient="0x..." // Your Sui wallet address
30
- onSuccess={(result) => console.log('Paid!', result.txHash)}
22
+ recipient="0x..."
23
+ destinationToken="arbitrumUSDC"
24
+ onSuccess={(result) => console.log('Paid', result.txHash)}
31
25
  />
32
26
  ```
33
27
 
34
- That's it! Users can now pay you from 21+ blockchains. The token received is USDC on Sui by default.
28
+ The SDK uses Uniport's hosted backend. No API key or backend URL is required for standard integration.
35
29
 
36
30
  ## UniportButton Props
37
31
 
38
- | Prop | Type | Required | Default | Description |
39
- |------|------|----------|---------|-------------|
40
- | `recipient` | `string` | ✅ | - | Recipient wallet address |
41
- | `destinationToken` | - | ❌ | `'suiUSDC'` | Token to receive on Sui |
42
- | `amount` | `string` | ❌ | - | Fixed amount (user selects if omitted) |
43
- | `refundAddress` | `string` | ❌ | - | Refund address if payment fails* |
44
- | `label` | `string` | ❌ | `'Pay with Crypto'` | Button text |
45
- | `variant` | `'default' \| 'compact' \| 'outline'` | ❌ | `'default'` | Button style |
46
- | `disabled` | `boolean` | ❌ | `false` | Disable the button |
47
- | `className` | `string` | ❌ | - | Custom CSS class |
48
- | `onSuccess` | `(result) => void` | ❌ | - | Called when payment completes |
49
- | `onError` | `(error) => void` | ❌ | - | Called when payment fails |
50
- | `onOpenChange` | `(open) => void` | ❌ | - | Called when modal opens/closes |
51
-
52
- > *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.
53
-
54
- ### Button Variants
55
-
56
- - **`default`** - Gradient purple button with shadow (recommended)
57
- - **`compact`** - Smaller version for tight spaces
58
- - **`outline`** - Transparent with purple border
59
-
60
- ## Supported Chains & Tokens
61
-
62
- | Chain | Tokens |
63
- |-------|--------|
64
- | **Sui** (destination) | SUI, USDC |
65
- | **Ethereum** | ETH, USDC, USDT, WBTC, DAI, AAVE, UNI, LINK, SHIB, PEPE, TURBO, SAFE |
66
- | **Solana** | SOL, USDC, USDT, TRUMP, WIF, MELANIA |
67
- | **Bitcoin** | BTC |
68
- | **Optimism** | ETH, USDC, USDT, OP |
69
- | **Base** | ETH, USDC, cbBTC, BRETT |
70
- | **Polygon** | POL, USDC, USDT |
71
- | **Arbitrum** | ETH, USDC, USDT, ARB, GMX |
72
- | **Avalanche** | AVAX, USDC, USDT |
73
- | **BSC** | BNB, USDC, USDT |
74
- | **TON** | TON, USDT |
75
- | **Tron** | TRX, USDT |
76
- | **NEAR** | wNEAR, USDC, USDT |
77
- | **Cardano** | ADA |
78
- | **XRP Ledger** | XRP |
79
- | **Dogecoin** | DOGE |
80
- | **Litecoin** | LTC |
81
- | **Bitcoin Cash** | BCH |
82
- | **Aptos** | APT |
83
- | **Starknet** | STRK |
84
- | **Berachain** | BERA |
85
- | **Zcash** | ZEC |
86
-
87
- ## Features
88
-
89
- - 🌐 Accept payments from 21+ blockchains
90
- - ⚡ Sub-minute settlement via NEAR Intents
91
- - 💎 Premium glassmorphism UI
92
- - 📱 Mobile-responsive modal
93
- - 🔧 Zero wallet connection required from payers
94
-
95
- ## Advanced Usage
96
-
97
- For custom implementations, the SDK also exports `UniportModal`, `useUniportPayment` hook, and core functions like `getQuote` and `getExecutionStatus`. See the source code for details.
32
+ | Prop | Type | Required | Description |
33
+ |------|------|----------|-------------|
34
+ | `recipient` | `string` | Yes | Recipient wallet address on the destination chain |
35
+ | `destinationToken` | `string` | Yes | Destination token name from the supported token table |
36
+ | `amount` | `string` | No | Fixed amount in destination token units |
37
+ | `refundAddress` | `string` | No | Source-chain refund address to prefill in the modal |
38
+ | `label` | `string` | No | Button label |
39
+ | `variant` | `'default' \| 'compact' \| 'outline'` | No | Button style |
40
+ | `disabled` | `boolean` | No | Disable the button |
41
+ | `className` | `string` | No | Custom CSS class |
42
+ | `theme` | `'light' \| 'dark'` | No | Modal theme |
43
+ | `onSuccess` | `(result) => void` | No | Called when payment completes |
44
+ | `onError` | `(error) => void` | No | Called when payment fails |
45
+ | `onOpenChange` | `(open) => void` | No | Called when modal opens or closes |
46
+
47
+ If `refundAddress` is omitted, the payer can enter it inside the modal. The refund address is on the source chain the payer sends from.
48
+
49
+ ## Supported Token Naming
50
+
51
+ Use the canonical token names below as `destinationToken`. Examples:
52
+
53
+ - `arbitrumUSDC`
54
+ - `ethereumUSDC`
55
+ - `solanaSOL`
56
+ - `bitcoinBTC`
57
+
58
+ Legacy short aliases such as `arbUSDC` and `ethUSDC` are still accepted for backward compatibility, but the canonical names below are the stable prop names to document and ship against.
59
+
60
+ | Chain | Token Name | Symbol |
61
+ |-------|------------|--------|
62
+ | Sui | `suiSUI` | SUI |
63
+ | Sui | `suiUSDC` | USDC |
64
+ | Ethereum | `ethereumETH` | ETH |
65
+ | Ethereum | `ethereumUSDC` | USDC |
66
+ | Ethereum | `ethereumUSDT` | USDT |
67
+ | Ethereum | `ethereumWBTC` | WBTC |
68
+ | Ethereum | `ethereumDAI` | DAI |
69
+ | Ethereum | `ethereumAAVE` | AAVE |
70
+ | Ethereum | `ethereumUNI` | UNI |
71
+ | Ethereum | `ethereumLINK` | LINK |
72
+ | Ethereum | `ethereumSHIB` | SHIB |
73
+ | Ethereum | `ethereumPEPE` | PEPE |
74
+ | Ethereum | `ethereumTURBO` | TURBO |
75
+ | Ethereum | `ethereumSAFE` | SAFE |
76
+ | Solana | `solanaSOL` | SOL |
77
+ | Solana | `solanaUSDC` | USDC |
78
+ | Solana | `solanaUSDT` | USDT |
79
+ | Solana | `solanaTRUMP` | TRUMP |
80
+ | Solana | `solanaWIF` | $WIF |
81
+ | Solana | `solanaMELANIA` | MELANIA |
82
+ | Bitcoin | `bitcoinBTC` | BTC |
83
+ | Arbitrum | `arbitrumETH` | ETH |
84
+ | Arbitrum | `arbitrumUSDC` | USDC |
85
+ | Arbitrum | `arbitrumUSDT` | USDT |
86
+ | Arbitrum | `arbitrumARB` | ARB |
87
+ | Arbitrum | `arbitrumGMX` | GMX |
88
+ | Base | `baseETH` | ETH |
89
+ | Base | `baseUSDC` | USDC |
90
+ | Base | `baseCbBTC` | cbBTC |
91
+ | Base | `baseBRETT` | BRETT |
92
+ | Optimism | `optimismETH` | ETH |
93
+ | Optimism | `optimismUSDC` | USDC |
94
+ | Optimism | `optimismUSDT` | USDT |
95
+ | Optimism | `optimismOP` | OP |
96
+ | Polygon | `polygonPOL` | POL |
97
+ | Polygon | `polygonUSDC` | USDC |
98
+ | Polygon | `polygonUSDT` | USDT |
99
+ | Avalanche | `avalancheAVAX` | AVAX |
100
+ | Avalanche | `avalancheUSDC` | USDC |
101
+ | Avalanche | `avalancheUSDT` | USDT |
102
+ | BNB Chain | `bscBNB` | BNB |
103
+ | BNB Chain | `bscUSDC` | USDC |
104
+ | BNB Chain | `bscUSDT` | USDT |
105
+ | TON | `tonTON` | TON |
106
+ | TON | `tonUSDT` | USDT |
107
+ | Tron | `tronTRX` | TRX |
108
+ | Tron | `tronUSDT` | USDT |
109
+ | NEAR | `nearNEAR` | wNEAR |
110
+ | NEAR | `nearUSDC` | USDC |
111
+ | NEAR | `nearUSDT` | USDT |
112
+ | Cardano | `cardanoADA` | ADA |
113
+ | XRP Ledger | `xrpXRP` | XRP |
114
+ | Dogecoin | `dogecoinDOGE` | DOGE |
115
+ | Litecoin | `litecoinLTC` | LTC |
116
+ | Bitcoin Cash | `bitcoinCashBCH` | BCH |
117
+ | Aptos | `aptosAPT` | APT |
118
+ | Starknet | `starknetSTRK` | STRK |
119
+ | Berachain | `berachainBERA` | BERA |
120
+ | Zcash | `zcashZEC` | ZEC |
121
+
122
+ ## Core Exports
123
+
124
+ The package exports:
125
+
126
+ - `UniportButton`
127
+ - `UniportModal`
128
+ - `useUniportPayment`
129
+ - `getQuote`
130
+ - `submitDepositTx`
131
+ - `getExecutionStatus`
132
+ - token constants such as `arbitrumUSDC`, `ethereumUSDC`, and `solanaSOL`
133
+
134
+ ## Errors
135
+
136
+ Backend request failures are surfaced as typed `UniportError` instances from the core module. Timeouts, quote failures, deposit submission failures, and status failures are normalized by the SDK before they reach your UI.
98
137
 
99
138
  ## License
100
139