uniport-sdk 0.0.4 → 0.0.6
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 +39 -0
- package/dist/components/index.cjs +447 -248
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.js +447 -248
- package/dist/components/index.js.map +1 -1
- package/dist/core/index.cjs +133 -2
- package/dist/core/index.cjs.map +1 -1
- package/dist/core/index.d.cts +67 -1
- package/dist/core/index.d.ts +67 -1
- package/dist/core/index.js +120 -3
- package/dist/core/index.js.map +1 -1
- package/dist/index.cjs +273 -57
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +5 -1
- package/dist/index.d.ts +5 -1
- package/dist/index.js +261 -59
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -46,6 +46,8 @@ The SDK uses Uniport's hosted backend. No API key or backend URL is required for
|
|
|
46
46
|
|
|
47
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
48
|
|
|
49
|
+
**EVM source chains only:** if the payer leaves the refund address blank, it defaults to Uniport's own address (resolved from `uniport.eth`, with a hardcoded fallback if resolution fails) rather than blocking the payment. This exists because the underlying 1Click API currently requires an explicit refund address — it cannot yet auto-refund to the depositing wallet. On non-EVM chains (Sui, Solana, Bitcoin, etc.) a refund address is still required from the payer, since there is no Uniport-controlled address on those chains to fall back to.
|
|
50
|
+
|
|
49
51
|
## Supported Token Naming
|
|
50
52
|
|
|
51
53
|
Use the canonical token names below as `destinationToken`. Examples:
|
|
@@ -89,6 +91,8 @@ Legacy short aliases such as `arbUSDC` and `ethUSDC` are still accepted for back
|
|
|
89
91
|
| Base | `baseUSDC` | USDC |
|
|
90
92
|
| Base | `baseCbBTC` | cbBTC |
|
|
91
93
|
| Base | `baseBRETT` | BRETT |
|
|
94
|
+
| Scroll | `scrollETH` | ETH |
|
|
95
|
+
| Scroll | `scrollUSDT` | USDT |
|
|
92
96
|
| Optimism | `optimismETH` | ETH |
|
|
93
97
|
| Optimism | `optimismUSDC` | USDC |
|
|
94
98
|
| Optimism | `optimismUSDT` | USDT |
|
|
@@ -118,6 +122,36 @@ Legacy short aliases such as `arbUSDC` and `ethUSDC` are still accepted for back
|
|
|
118
122
|
| Starknet | `starknetSTRK` | STRK |
|
|
119
123
|
| Berachain | `berachainBERA` | BERA |
|
|
120
124
|
| Zcash | `zcashZEC` | ZEC |
|
|
125
|
+
| Stellar | `stellarXLM` | XLM |
|
|
126
|
+
| Stellar | `stellarUSDC` | USDC |
|
|
127
|
+
|
|
128
|
+
## Display amounts
|
|
129
|
+
|
|
130
|
+
Cross-chain quotes routinely land on odd decimals — e.g. paying exactly 5 USDC
|
|
131
|
+
may quote as `0.002703957684923543 ETH` on the destination side. The built-in
|
|
132
|
+
`UniportModal` rounds all displayed estimates to 6 significant digits via
|
|
133
|
+
`formatDisplayAmount` so payers see something readable (e.g. `0.0027040`).
|
|
134
|
+
This is display-only: the actual quote, deposit amount, and settlement values
|
|
135
|
+
are never altered — only the text shown in the UI is rounded.
|
|
136
|
+
|
|
137
|
+
## Memo-required chains
|
|
138
|
+
|
|
139
|
+
Some chains (currently: Stellar) require a memo alongside the deposit address
|
|
140
|
+
— sending funds without it can make the deposit unrecoverable. `UniportModal`
|
|
141
|
+
automatically requests the correct deposit mode for these chains and displays
|
|
142
|
+
the memo prominently, with its own copy button, right next to the deposit
|
|
143
|
+
address. `needsMemoDeposit(chain)` is exported if you need this in custom UI.
|
|
144
|
+
|
|
145
|
+
Note: the underlying 1Click API's own documentation suggests TON and XRP may
|
|
146
|
+
also need this, but that isn't the case for the chains actively supported
|
|
147
|
+
today (verified directly against the live API) — only Stellar currently
|
|
148
|
+
requires it. If this changes, `CHAINS_REQUIRING_MEMO` in `core/tokens.ts` is
|
|
149
|
+
the single place to update.
|
|
150
|
+
|
|
151
|
+
Stellar also has a chain-specific quirk worth knowing: non-native assets
|
|
152
|
+
(e.g. Stellar USDC) require the receiving address to have an established
|
|
153
|
+
trustline for that asset, or funds cannot be delivered. `UniportModal` warns
|
|
154
|
+
about this when a refund address is entered for a non-XLM Stellar token.
|
|
121
155
|
|
|
122
156
|
## Core Exports
|
|
123
157
|
|
|
@@ -129,6 +163,11 @@ The package exports:
|
|
|
129
163
|
- `getQuote`
|
|
130
164
|
- `submitDepositTx`
|
|
131
165
|
- `getExecutionStatus`
|
|
166
|
+
- `getExplorerTxUrl` — block-explorer transaction URL for a given chain
|
|
167
|
+
- `isEvmChain` — whether a `ChainId` is EVM-compatible
|
|
168
|
+
- `resolveEnsName` — resolve any `.eth` name via the ENSIdeas API
|
|
169
|
+
- `formatDisplayAmount` — rounds a human-readable amount to 6 significant digits for UI display only (never use the result for on-chain amounts)
|
|
170
|
+
- `needsMemoDeposit` — whether a `ChainId` requires a memo alongside its deposit address
|
|
132
171
|
- token constants such as `arbitrumUSDC`, `ethereumUSDC`, and `solanaSOL`
|
|
133
172
|
|
|
134
173
|
## Errors
|