uniport-sdk 0.0.10 → 0.0.11
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 +2 -0
- package/dist/components/index.cjs +4 -2
- package/dist/components/index.cjs.map +1 -1
- package/dist/components/index.js +4 -2
- package/dist/components/index.js.map +1 -1
- package/dist/index.cjs +4 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +4 -2
- 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
|
+
When `amount` is set, the payer can't change it in the modal. `onSuccess` runs in the payer's browser, so before granting goods or access, confirm on your server that the recipient received the amount.
|
|
50
|
+
|
|
49
51
|
When `amount` is supplied, the modal requests that exact destination amount and rounds the quoted input upward only when the increase is at most 0.25%. Rounded surplus and failed-swap refunds are credited to Uniport's configured Intents account. When `amount` is omitted, the payer enters an exact input amount and receives the quoted output.
|
|
50
52
|
|
|
51
53
|
**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.
|
|
@@ -926,10 +926,11 @@ function useUniportPayment(options) {
|
|
|
926
926
|
);
|
|
927
927
|
const setAmount = react.useCallback(
|
|
928
928
|
(newAmount) => {
|
|
929
|
+
if (swapType === "EXACT_OUTPUT") return;
|
|
929
930
|
setAmountState(newAmount);
|
|
930
931
|
schedulePreviewQuote(newAmount, effectiveRefundAddress, selectedToken);
|
|
931
932
|
},
|
|
932
|
-
[effectiveRefundAddress, schedulePreviewQuote, selectedToken]
|
|
933
|
+
[effectiveRefundAddress, schedulePreviewQuote, selectedToken, swapType]
|
|
933
934
|
);
|
|
934
935
|
const setRefundAddress = react.useCallback(
|
|
935
936
|
(newRefundAddress) => {
|
|
@@ -1588,6 +1589,7 @@ function UniportModal({
|
|
|
1588
1589
|
placeholder: "0.00",
|
|
1589
1590
|
value: payment.amount,
|
|
1590
1591
|
onChange: (e) => payment.setAmount(e.target.value),
|
|
1592
|
+
readOnly: isExactOutput,
|
|
1591
1593
|
style: {
|
|
1592
1594
|
width: "100%",
|
|
1593
1595
|
textAlign: "center",
|
|
@@ -1603,7 +1605,7 @@ function UniportModal({
|
|
|
1603
1605
|
lineHeight: 1,
|
|
1604
1606
|
padding: 0
|
|
1605
1607
|
},
|
|
1606
|
-
autoFocus:
|
|
1608
|
+
autoFocus: !isExactOutput
|
|
1607
1609
|
}
|
|
1608
1610
|
),
|
|
1609
1611
|
/* @__PURE__ */ jsxRuntime.jsx("div", { style: { fontSize: "14px", color: t.textMuted, marginTop: 8 }, children: isExactOutput ? payment.destinationToken.symbol : tok?.symbol })
|