Appearance
Submit
Submit a transfer plan with useWalletTransfer. The user confirms in the wallet. Does not require WalletsProvider — but you still need a connected walletId on the plan.
Same submit / retry as Submit (Core). If result.status === 'requires_retry', the wallet already signed and sent. Show Retry — do not submit again.
Ready to submit
Use this checklist to enable the confirm button. submit still validates the same things and will throw if something is missing — this is only for UI.
- Session view is
active - Connection
status === 'connected' - Token is
eligible plan.flow !== 'unavailable'- Amount is valid (
useDualAmountInput().isValid) - Quote is present when the flow needs one (swap / bridge; direct can omit)
- Not already in
requires_retry(then show Retry instead)
Direct can omit quote. Swap and bridge need a current quote — if the amount changed, refetch and do not submit a stale one. Pass the whole quote object into submit. Do not build or edit fields.
Example
tsx
import {
ConnectSdkError,
ConnectSdkErrorCode,
} from '@swapped/connect-sdk'
import { useWalletTransfer } from '@swapped/connect-sdk/react'
function Confirm({
plan,
amount,
quote,
}: {
plan: WalletTransferPlan
amount: string
quote?: WalletTransferQuote
}) {
const { submit, retry, result, isPending, error } = useWalletTransfer()
return (
<div>
<button
type="button"
disabled={
isPending ||
plan.flow === 'unavailable' ||
result?.status === 'requires_retry'
}
onClick={() =>
void submit({
plan,
amount,
quote,
onStatus: event => {
event.status
},
})
}
>
{isPending ? 'Confirming…' : 'Confirm in wallet'}
</button>
{result?.status === 'requires_retry' ? (
<button
type="button"
disabled={isPending}
onClick={() => void retry()}
>
Retry
</button>
) : null}
{error instanceof ConnectSdkError &&
error.code !== ConnectSdkErrorCode.WALLET_TRANSACTION_REJECTED ? (
<p>
{error.code === ConnectSdkErrorCode.WALLET_TRANSFER_INSUFFICIENT_FEE
? 'Not enough to cover fees'
: 'Transfer failed'}
</p>
) : null}
</div>
)
}Branch on ConnectSdkError.code — see Errors. User cancel (WALLET_TRANSACTION_REJECTED) is silent here.
submit options
| Option | Meaning |
|---|---|
plan | Transfer plan from useWalletTransferPlan |
amount | Source crypto string |
quote? | Quote from useWalletTransferQuote. Required for swap / bridge; optional for direct |
onStatus? | Status events for this submit |
Returns
| Field | Meaning |
|---|---|
submit(request) | Returns WalletTransferResult | null (null on throw; error is on error) |
retry() | Returns WalletTransferResult | null |
result | Last WalletTransferResult (status, hash, …) |
isPending | Submit or retry in flight |
error | Last thrown error |
reset | Clear result / error |
requires_retry
The wallet already signed / sent. Registration with Swapped failed. If result.status === 'requires_retry', call retry(). Do not submit again.
submit throws WALLET_TRANSFER_REQUIRES_RETRY (and the hook sets error) if a previous submit already returned requires_retry.
Status values: Submit (Core).