@unifold/ui-react 0.1.44 → 0.1.46
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/dist/index.d.mts +3 -2
- package/dist/index.d.ts +3 -2
- package/dist/index.js +16 -58
- package/dist/index.mjs +16 -58
- package/package.json +2 -2
package/dist/index.d.mts
CHANGED
|
@@ -514,7 +514,7 @@ interface WithdrawModalProps {
|
|
|
514
514
|
sourceTokenSymbol?: string;
|
|
515
515
|
recipientAddress?: string;
|
|
516
516
|
senderAddress: string;
|
|
517
|
-
onWithdraw
|
|
517
|
+
onWithdraw: (txInfo: WithdrawTransactionInfo) => void | Promise<void>;
|
|
518
518
|
onWithdrawSuccess?: (data: {
|
|
519
519
|
message: string;
|
|
520
520
|
transaction?: unknown;
|
|
@@ -584,7 +584,8 @@ interface WithdrawFormProps {
|
|
|
584
584
|
senderAddress: string;
|
|
585
585
|
sourceChainId: string;
|
|
586
586
|
sourceTokenAddress: string;
|
|
587
|
-
|
|
587
|
+
/** Called when the user confirms the withdrawal. The host app signs and submits the transaction. */
|
|
588
|
+
onWithdraw: (txInfo: WithdrawTransactionInfo) => void | Promise<void>;
|
|
588
589
|
onWithdrawError?: (error: {
|
|
589
590
|
message: string;
|
|
590
591
|
error?: unknown;
|
package/dist/index.d.ts
CHANGED
|
@@ -514,7 +514,7 @@ interface WithdrawModalProps {
|
|
|
514
514
|
sourceTokenSymbol?: string;
|
|
515
515
|
recipientAddress?: string;
|
|
516
516
|
senderAddress: string;
|
|
517
|
-
onWithdraw
|
|
517
|
+
onWithdraw: (txInfo: WithdrawTransactionInfo) => void | Promise<void>;
|
|
518
518
|
onWithdrawSuccess?: (data: {
|
|
519
519
|
message: string;
|
|
520
520
|
transaction?: unknown;
|
|
@@ -584,7 +584,8 @@ interface WithdrawFormProps {
|
|
|
584
584
|
senderAddress: string;
|
|
585
585
|
sourceChainId: string;
|
|
586
586
|
sourceTokenAddress: string;
|
|
587
|
-
|
|
587
|
+
/** Called when the user confirms the withdrawal. The host app signs and submits the transaction. */
|
|
588
|
+
onWithdraw: (txInfo: WithdrawTransactionInfo) => void | Promise<void>;
|
|
588
589
|
onWithdrawError?: (error: {
|
|
589
590
|
message: string;
|
|
590
591
|
error?: unknown;
|
package/dist/index.js
CHANGED
|
@@ -10588,10 +10588,11 @@ function BrowserWalletModal({
|
|
|
10588
10588
|
const chainType = depositWallet.chain_type;
|
|
10589
10589
|
const recipientAddress = depositWallet.address;
|
|
10590
10590
|
const supportedChainType = chainType === "algorand" || chainType === "xrpl" ? "ethereum" : chainType;
|
|
10591
|
-
const { executions: depositExecutions, isPolling } = useDepositPolling({
|
|
10591
|
+
const { executions: depositExecutions, isPolling, handleIveDeposited } = useDepositPolling({
|
|
10592
10592
|
userId,
|
|
10593
10593
|
publishableKey,
|
|
10594
10594
|
clientSecret,
|
|
10595
|
+
depositWalletId: depositWallet.id,
|
|
10595
10596
|
enabled: open && hasSignedTransaction,
|
|
10596
10597
|
onDepositSuccess,
|
|
10597
10598
|
onDepositError
|
|
@@ -10842,6 +10843,7 @@ function BrowserWalletModal({
|
|
|
10842
10843
|
}
|
|
10843
10844
|
setReceivedUsdAtSubmission(checkoutReceivedUsd ?? "0");
|
|
10844
10845
|
setHasSignedTransaction(true);
|
|
10846
|
+
handleIveDeposited();
|
|
10845
10847
|
setIsConfirming(false);
|
|
10846
10848
|
setStep("confirming");
|
|
10847
10849
|
onSuccess?.(txHash);
|
|
@@ -14051,6 +14053,9 @@ function WithdrawForm({
|
|
|
14051
14053
|
setIsSubmitting(true);
|
|
14052
14054
|
setSubmitError(null);
|
|
14053
14055
|
try {
|
|
14056
|
+
if (!onWithdraw) {
|
|
14057
|
+
throw new Error("No withdrawal method available. Please provide an onWithdraw handler.");
|
|
14058
|
+
}
|
|
14054
14059
|
const depositWallet = await onDepositWalletCreation({
|
|
14055
14060
|
destinationChainType: selectedChain.chain_type,
|
|
14056
14061
|
destinationChainId: selectedChain.chain_id,
|
|
@@ -14108,63 +14113,16 @@ function WithdrawForm({
|
|
|
14108
14113
|
withdrawIntentAddress: depositWallet.address,
|
|
14109
14114
|
recipientAddress: trimmedAddress
|
|
14110
14115
|
};
|
|
14111
|
-
|
|
14112
|
-
|
|
14113
|
-
|
|
14114
|
-
|
|
14115
|
-
|
|
14116
|
-
|
|
14117
|
-
|
|
14118
|
-
|
|
14119
|
-
|
|
14120
|
-
|
|
14121
|
-
amount: humanAmount,
|
|
14122
|
-
tokenSymbol,
|
|
14123
|
-
publishableKey
|
|
14124
|
-
});
|
|
14125
|
-
} else if (wallet.chainFamily === "evm") {
|
|
14126
|
-
await sendEvmWithdraw({
|
|
14127
|
-
provider: wallet.provider,
|
|
14128
|
-
fromAddress: wallet.address,
|
|
14129
|
-
depositWalletAddress: depositWallet.address,
|
|
14130
|
-
sourceTokenAddress,
|
|
14131
|
-
sourceChainId,
|
|
14132
|
-
amountBaseUnit
|
|
14133
|
-
});
|
|
14134
|
-
} else if (wallet.chainFamily === "solana") {
|
|
14135
|
-
await sendSolanaWithdraw({
|
|
14136
|
-
provider: wallet.provider,
|
|
14137
|
-
fromAddress: wallet.address,
|
|
14138
|
-
depositWalletAddress: depositWallet.address,
|
|
14139
|
-
sourceTokenAddress,
|
|
14140
|
-
amountBaseUnit,
|
|
14141
|
-
publishableKey
|
|
14142
|
-
});
|
|
14143
|
-
}
|
|
14144
|
-
} catch (walletErr) {
|
|
14145
|
-
console.error("[Unifold] Browser wallet send failed:", walletErr, {
|
|
14146
|
-
wallet: `${wallet.name} (${wallet.chainFamily})`,
|
|
14147
|
-
sourceChainId,
|
|
14148
|
-
amount: humanAmount,
|
|
14149
|
-
amountBaseUnit,
|
|
14150
|
-
depositWallet: depositWallet.address
|
|
14151
|
-
});
|
|
14152
|
-
throw walletErr;
|
|
14153
|
-
}
|
|
14154
|
-
} else if (onWithdraw) {
|
|
14155
|
-
try {
|
|
14156
|
-
await onWithdraw(txInfo);
|
|
14157
|
-
} catch (callbackErr) {
|
|
14158
|
-
console.error("[Unifold] onWithdraw callback failed:", callbackErr, {
|
|
14159
|
-
sourceChainId,
|
|
14160
|
-
amount: humanAmount,
|
|
14161
|
-
amountBaseUnit,
|
|
14162
|
-
depositWallet: depositWallet.address
|
|
14163
|
-
});
|
|
14164
|
-
throw callbackErr;
|
|
14165
|
-
}
|
|
14166
|
-
} else {
|
|
14167
|
-
throw new Error("No withdrawal method available. Please connect a wallet.");
|
|
14116
|
+
try {
|
|
14117
|
+
await onWithdraw(txInfo);
|
|
14118
|
+
} catch (callbackErr) {
|
|
14119
|
+
console.error("[Unifold] onWithdraw callback failed:", callbackErr, {
|
|
14120
|
+
sourceChainId,
|
|
14121
|
+
amount: humanAmount,
|
|
14122
|
+
amountBaseUnit,
|
|
14123
|
+
depositWallet: depositWallet.address
|
|
14124
|
+
});
|
|
14125
|
+
throw callbackErr;
|
|
14168
14126
|
}
|
|
14169
14127
|
onWithdrawSubmitted?.(txInfo);
|
|
14170
14128
|
} catch (err) {
|
package/dist/index.mjs
CHANGED
|
@@ -10558,10 +10558,11 @@ function BrowserWalletModal({
|
|
|
10558
10558
|
const chainType = depositWallet.chain_type;
|
|
10559
10559
|
const recipientAddress = depositWallet.address;
|
|
10560
10560
|
const supportedChainType = chainType === "algorand" || chainType === "xrpl" ? "ethereum" : chainType;
|
|
10561
|
-
const { executions: depositExecutions, isPolling } = useDepositPolling({
|
|
10561
|
+
const { executions: depositExecutions, isPolling, handleIveDeposited } = useDepositPolling({
|
|
10562
10562
|
userId,
|
|
10563
10563
|
publishableKey,
|
|
10564
10564
|
clientSecret,
|
|
10565
|
+
depositWalletId: depositWallet.id,
|
|
10565
10566
|
enabled: open && hasSignedTransaction,
|
|
10566
10567
|
onDepositSuccess,
|
|
10567
10568
|
onDepositError
|
|
@@ -10812,6 +10813,7 @@ function BrowserWalletModal({
|
|
|
10812
10813
|
}
|
|
10813
10814
|
setReceivedUsdAtSubmission(checkoutReceivedUsd ?? "0");
|
|
10814
10815
|
setHasSignedTransaction(true);
|
|
10816
|
+
handleIveDeposited();
|
|
10815
10817
|
setIsConfirming(false);
|
|
10816
10818
|
setStep("confirming");
|
|
10817
10819
|
onSuccess?.(txHash);
|
|
@@ -14061,6 +14063,9 @@ function WithdrawForm({
|
|
|
14061
14063
|
setIsSubmitting(true);
|
|
14062
14064
|
setSubmitError(null);
|
|
14063
14065
|
try {
|
|
14066
|
+
if (!onWithdraw) {
|
|
14067
|
+
throw new Error("No withdrawal method available. Please provide an onWithdraw handler.");
|
|
14068
|
+
}
|
|
14064
14069
|
const depositWallet = await onDepositWalletCreation({
|
|
14065
14070
|
destinationChainType: selectedChain.chain_type,
|
|
14066
14071
|
destinationChainId: selectedChain.chain_id,
|
|
@@ -14118,63 +14123,16 @@ function WithdrawForm({
|
|
|
14118
14123
|
withdrawIntentAddress: depositWallet.address,
|
|
14119
14124
|
recipientAddress: trimmedAddress
|
|
14120
14125
|
};
|
|
14121
|
-
|
|
14122
|
-
|
|
14123
|
-
|
|
14124
|
-
|
|
14125
|
-
|
|
14126
|
-
|
|
14127
|
-
|
|
14128
|
-
|
|
14129
|
-
|
|
14130
|
-
|
|
14131
|
-
amount: humanAmount,
|
|
14132
|
-
tokenSymbol,
|
|
14133
|
-
publishableKey
|
|
14134
|
-
});
|
|
14135
|
-
} else if (wallet.chainFamily === "evm") {
|
|
14136
|
-
await sendEvmWithdraw({
|
|
14137
|
-
provider: wallet.provider,
|
|
14138
|
-
fromAddress: wallet.address,
|
|
14139
|
-
depositWalletAddress: depositWallet.address,
|
|
14140
|
-
sourceTokenAddress,
|
|
14141
|
-
sourceChainId,
|
|
14142
|
-
amountBaseUnit
|
|
14143
|
-
});
|
|
14144
|
-
} else if (wallet.chainFamily === "solana") {
|
|
14145
|
-
await sendSolanaWithdraw({
|
|
14146
|
-
provider: wallet.provider,
|
|
14147
|
-
fromAddress: wallet.address,
|
|
14148
|
-
depositWalletAddress: depositWallet.address,
|
|
14149
|
-
sourceTokenAddress,
|
|
14150
|
-
amountBaseUnit,
|
|
14151
|
-
publishableKey
|
|
14152
|
-
});
|
|
14153
|
-
}
|
|
14154
|
-
} catch (walletErr) {
|
|
14155
|
-
console.error("[Unifold] Browser wallet send failed:", walletErr, {
|
|
14156
|
-
wallet: `${wallet.name} (${wallet.chainFamily})`,
|
|
14157
|
-
sourceChainId,
|
|
14158
|
-
amount: humanAmount,
|
|
14159
|
-
amountBaseUnit,
|
|
14160
|
-
depositWallet: depositWallet.address
|
|
14161
|
-
});
|
|
14162
|
-
throw walletErr;
|
|
14163
|
-
}
|
|
14164
|
-
} else if (onWithdraw) {
|
|
14165
|
-
try {
|
|
14166
|
-
await onWithdraw(txInfo);
|
|
14167
|
-
} catch (callbackErr) {
|
|
14168
|
-
console.error("[Unifold] onWithdraw callback failed:", callbackErr, {
|
|
14169
|
-
sourceChainId,
|
|
14170
|
-
amount: humanAmount,
|
|
14171
|
-
amountBaseUnit,
|
|
14172
|
-
depositWallet: depositWallet.address
|
|
14173
|
-
});
|
|
14174
|
-
throw callbackErr;
|
|
14175
|
-
}
|
|
14176
|
-
} else {
|
|
14177
|
-
throw new Error("No withdrawal method available. Please connect a wallet.");
|
|
14126
|
+
try {
|
|
14127
|
+
await onWithdraw(txInfo);
|
|
14128
|
+
} catch (callbackErr) {
|
|
14129
|
+
console.error("[Unifold] onWithdraw callback failed:", callbackErr, {
|
|
14130
|
+
sourceChainId,
|
|
14131
|
+
amount: humanAmount,
|
|
14132
|
+
amountBaseUnit,
|
|
14133
|
+
depositWallet: depositWallet.address
|
|
14134
|
+
});
|
|
14135
|
+
throw callbackErr;
|
|
14178
14136
|
}
|
|
14179
14137
|
onWithdrawSubmitted?.(txInfo);
|
|
14180
14138
|
} catch (err) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@unifold/ui-react",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.46",
|
|
4
4
|
"description": "Unifold UI React - Deposit and onramp components for React applications",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
"lucide-react": "^0.454.0",
|
|
44
44
|
"qr-code-styling": "^1.6.0-rc.1",
|
|
45
45
|
"tailwind-merge": "^2.0.0",
|
|
46
|
-
"@unifold/core": "0.1.
|
|
46
|
+
"@unifold/core": "0.1.46"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@solana/spl-token": "^0.3.8",
|