uniport-sdk 0.0.1 → 0.0.2
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 +21 -0
- package/README.md +128 -73
- package/dist/components/index.cjs +1140 -975
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.d.cts +2 -1
- package/dist/components/index.d.ts +2 -1
- package/dist/components/index.js +1118 -953
- package/dist/components/index.js.map +1 -1
- package/dist/core/index.cjs +216 -130
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +55 -45
- package/dist/core/index.d.ts +55 -45
- package/dist/core/index.js +212 -116
- package/dist/core/index.js.map +1 -1
- package/dist/{index-uzI1Zngp.d.cts → index-Dg_m2bK3.d.cts} +19 -10
- package/dist/{index-uzI1Zngp.d.ts → index-Dg_m2bK3.d.ts} +19 -10
- package/dist/index.cjs +1178 -1018
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +8 -6
- package/dist/index.d.ts +8 -6
- package/dist/index.js +1145 -975
- package/dist/index.js.map +1 -1
- package/package.json +18 -12
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
|
[](https://www.npmjs.com/package/uniport-sdk)
|
|
4
4
|
[](https://opensource.org/licenses/MIT)
|
|
5
5
|
|
|
6
|
-
Cross-chain payment SDK
|
|
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,140 @@ npm install uniport-sdk
|
|
|
16
16
|
## Quick Start
|
|
17
17
|
|
|
18
18
|
```tsx
|
|
19
|
-
import {
|
|
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..."
|
|
30
|
-
|
|
22
|
+
recipient="0x..."
|
|
23
|
+
destinationToken="arbitrumUSDC"
|
|
24
|
+
onSuccess={(result) => console.log('Paid', result.txHash)}
|
|
31
25
|
/>
|
|
32
26
|
```
|
|
33
27
|
|
|
34
|
-
|
|
28
|
+
The SDK uses Uniport's hosted backend by default. No API key or backend URL is required for standard integration.
|
|
29
|
+
|
|
30
|
+
## Backend Configuration
|
|
31
|
+
|
|
32
|
+
If you want to self-host or point the SDK at staging, configure it explicitly:
|
|
33
|
+
|
|
34
|
+
```tsx
|
|
35
|
+
import { configureUniport } from 'uniport-sdk'
|
|
36
|
+
|
|
37
|
+
configureUniport({
|
|
38
|
+
backendUrl: 'https://your-backend.example.com',
|
|
39
|
+
requestTimeoutMs: 20000,
|
|
40
|
+
})
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
`NEXT_PUBLIC_UNIPORT_BACKEND_URL` is still supported as a legacy override, but `configureUniport()` is the preferred integration path.
|
|
35
44
|
|
|
36
45
|
## UniportButton Props
|
|
37
46
|
|
|
38
|
-
| Prop | Type | Required |
|
|
39
|
-
|
|
40
|
-
| `recipient` | `string` |
|
|
41
|
-
| `destinationToken` |
|
|
42
|
-
| `amount` | `string` |
|
|
43
|
-
| `refundAddress` | `string` |
|
|
44
|
-
| `label` | `string` |
|
|
45
|
-
| `variant` | `'default' \| 'compact' \| 'outline'` |
|
|
46
|
-
| `disabled` | `boolean` |
|
|
47
|
-
| `className` | `string` |
|
|
48
|
-
| `
|
|
49
|
-
| `
|
|
50
|
-
| `
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
|
67
|
-
|
|
68
|
-
|
|
|
69
|
-
|
|
|
70
|
-
|
|
|
71
|
-
|
|
|
72
|
-
|
|
|
73
|
-
|
|
|
74
|
-
|
|
|
75
|
-
|
|
|
76
|
-
|
|
|
77
|
-
|
|
|
78
|
-
|
|
|
79
|
-
|
|
|
80
|
-
|
|
|
81
|
-
|
|
|
82
|
-
|
|
|
83
|
-
|
|
|
84
|
-
|
|
|
85
|
-
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
47
|
+
| Prop | Type | Required | Description |
|
|
48
|
+
|------|------|----------|-------------|
|
|
49
|
+
| `recipient` | `string` | Yes | Recipient wallet address on the destination chain |
|
|
50
|
+
| `destinationToken` | `string` | Yes | Destination token name from the supported token table |
|
|
51
|
+
| `amount` | `string` | No | Fixed amount in destination token units |
|
|
52
|
+
| `refundAddress` | `string` | No | Source-chain refund address to prefill in the modal |
|
|
53
|
+
| `label` | `string` | No | Button label |
|
|
54
|
+
| `variant` | `'default' \| 'compact' \| 'outline'` | No | Button style |
|
|
55
|
+
| `disabled` | `boolean` | No | Disable the button |
|
|
56
|
+
| `className` | `string` | No | Custom CSS class |
|
|
57
|
+
| `theme` | `'light' \| 'dark'` | No | Modal theme |
|
|
58
|
+
| `onSuccess` | `(result) => void` | No | Called when payment completes |
|
|
59
|
+
| `onError` | `(error) => void` | No | Called when payment fails |
|
|
60
|
+
| `onOpenChange` | `(open) => void` | No | Called when modal opens or closes |
|
|
61
|
+
|
|
62
|
+
If `refundAddress` is omitted, the payer can enter it inside the modal. The refund address is on the source chain the payer sends from.
|
|
63
|
+
|
|
64
|
+
## Supported Token Naming
|
|
65
|
+
|
|
66
|
+
Use the canonical token names below as `destinationToken`. Examples:
|
|
67
|
+
|
|
68
|
+
- `arbitrumUSDC`
|
|
69
|
+
- `ethereumUSDC`
|
|
70
|
+
- `solanaSOL`
|
|
71
|
+
- `bitcoinBTC`
|
|
72
|
+
|
|
73
|
+
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.
|
|
74
|
+
|
|
75
|
+
| Chain | Token Name | Symbol |
|
|
76
|
+
|-------|------------|--------|
|
|
77
|
+
| Sui | `suiSUI` | SUI |
|
|
78
|
+
| Sui | `suiUSDC` | USDC |
|
|
79
|
+
| Ethereum | `ethereumETH` | ETH |
|
|
80
|
+
| Ethereum | `ethereumUSDC` | USDC |
|
|
81
|
+
| Ethereum | `ethereumUSDT` | USDT |
|
|
82
|
+
| Ethereum | `ethereumWBTC` | WBTC |
|
|
83
|
+
| Ethereum | `ethereumDAI` | DAI |
|
|
84
|
+
| Ethereum | `ethereumAAVE` | AAVE |
|
|
85
|
+
| Ethereum | `ethereumUNI` | UNI |
|
|
86
|
+
| Ethereum | `ethereumLINK` | LINK |
|
|
87
|
+
| Ethereum | `ethereumSHIB` | SHIB |
|
|
88
|
+
| Ethereum | `ethereumPEPE` | PEPE |
|
|
89
|
+
| Ethereum | `ethereumTURBO` | TURBO |
|
|
90
|
+
| Ethereum | `ethereumSAFE` | SAFE |
|
|
91
|
+
| Solana | `solanaSOL` | SOL |
|
|
92
|
+
| Solana | `solanaUSDC` | USDC |
|
|
93
|
+
| Solana | `solanaUSDT` | USDT |
|
|
94
|
+
| Solana | `solanaTRUMP` | TRUMP |
|
|
95
|
+
| Solana | `solanaWIF` | $WIF |
|
|
96
|
+
| Solana | `solanaMELANIA` | MELANIA |
|
|
97
|
+
| Bitcoin | `bitcoinBTC` | BTC |
|
|
98
|
+
| Arbitrum | `arbitrumETH` | ETH |
|
|
99
|
+
| Arbitrum | `arbitrumUSDC` | USDC |
|
|
100
|
+
| Arbitrum | `arbitrumUSDT` | USDT |
|
|
101
|
+
| Arbitrum | `arbitrumARB` | ARB |
|
|
102
|
+
| Arbitrum | `arbitrumGMX` | GMX |
|
|
103
|
+
| Base | `baseETH` | ETH |
|
|
104
|
+
| Base | `baseUSDC` | USDC |
|
|
105
|
+
| Base | `baseCbBTC` | cbBTC |
|
|
106
|
+
| Base | `baseBRETT` | BRETT |
|
|
107
|
+
| Optimism | `optimismETH` | ETH |
|
|
108
|
+
| Optimism | `optimismUSDC` | USDC |
|
|
109
|
+
| Optimism | `optimismUSDT` | USDT |
|
|
110
|
+
| Optimism | `optimismOP` | OP |
|
|
111
|
+
| Polygon | `polygonPOL` | POL |
|
|
112
|
+
| Polygon | `polygonUSDC` | USDC |
|
|
113
|
+
| Polygon | `polygonUSDT` | USDT |
|
|
114
|
+
| Avalanche | `avalancheAVAX` | AVAX |
|
|
115
|
+
| Avalanche | `avalancheUSDC` | USDC |
|
|
116
|
+
| Avalanche | `avalancheUSDT` | USDT |
|
|
117
|
+
| BNB Chain | `bscBNB` | BNB |
|
|
118
|
+
| BNB Chain | `bscUSDC` | USDC |
|
|
119
|
+
| BNB Chain | `bscUSDT` | USDT |
|
|
120
|
+
| TON | `tonTON` | TON |
|
|
121
|
+
| TON | `tonUSDT` | USDT |
|
|
122
|
+
| Tron | `tronTRX` | TRX |
|
|
123
|
+
| Tron | `tronUSDT` | USDT |
|
|
124
|
+
| NEAR | `nearNEAR` | wNEAR |
|
|
125
|
+
| NEAR | `nearUSDC` | USDC |
|
|
126
|
+
| NEAR | `nearUSDT` | USDT |
|
|
127
|
+
| Cardano | `cardanoADA` | ADA |
|
|
128
|
+
| XRP Ledger | `xrpXRP` | XRP |
|
|
129
|
+
| Dogecoin | `dogecoinDOGE` | DOGE |
|
|
130
|
+
| Litecoin | `litecoinLTC` | LTC |
|
|
131
|
+
| Bitcoin Cash | `bitcoinCashBCH` | BCH |
|
|
132
|
+
| Aptos | `aptosAPT` | APT |
|
|
133
|
+
| Starknet | `starknetSTRK` | STRK |
|
|
134
|
+
| Berachain | `berachainBERA` | BERA |
|
|
135
|
+
| Zcash | `zcashZEC` | ZEC |
|
|
136
|
+
|
|
137
|
+
## Core Exports
|
|
138
|
+
|
|
139
|
+
The package exports:
|
|
140
|
+
|
|
141
|
+
- `UniportButton`
|
|
142
|
+
- `UniportModal`
|
|
143
|
+
- `useUniportPayment`
|
|
144
|
+
- `configureUniport`
|
|
145
|
+
- `getQuote`
|
|
146
|
+
- `submitDepositTx`
|
|
147
|
+
- `getExecutionStatus`
|
|
148
|
+
- token constants such as `arbitrumUSDC`, `ethereumUSDC`, and `solanaSOL`
|
|
149
|
+
|
|
150
|
+
## Errors
|
|
151
|
+
|
|
152
|
+
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
153
|
|
|
99
154
|
## License
|
|
100
155
|
|