@silentswap/react 0.1.47 → 0.1.49
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.
|
@@ -702,9 +702,6 @@ export function useBridgeExecution(walletClient, connector, solanaConnector, sol
|
|
|
702
702
|
});
|
|
703
703
|
// Handle bridge execution based on selected provider
|
|
704
704
|
if (selectedProvider === 'debridge') {
|
|
705
|
-
// Note: allowanceTarget is not needed here because approval is already handled
|
|
706
|
-
// in executeSwap before bridge execution (matching Svelte silentswap.ts line 985-986).
|
|
707
|
-
// DeBridge will provide its own allowanceTarget from the response if needed.
|
|
708
705
|
try {
|
|
709
706
|
return await executeDebridgeBridge(sourceChainId, sourceTokenAddress, isSourceNative, bridgeUsdcAmount, depositCalldata, evmSignerAddress, // Use EVM signer address for deposit calldata
|
|
710
707
|
allowanceTarget ?? '', // From solve phase; create-tx with enableEstimate:false is used for approval when needed
|
|
@@ -712,12 +709,19 @@ export function useBridgeExecution(walletClient, connector, solanaConnector, sol
|
|
|
712
709
|
walletClient, connector, setCurrentStep, onStatus);
|
|
713
710
|
}
|
|
714
711
|
catch (error) {
|
|
715
|
-
|
|
716
|
-
//
|
|
717
|
-
//
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
712
|
+
// Only fall back to relay if deBridge failed BEFORE sending a transaction.
|
|
713
|
+
// If a deBridge tx was already confirmed on-chain, falling back would cause
|
|
714
|
+
// a double bridge execution (both deBridge and relay processing funds).
|
|
715
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
716
|
+
const txAlreadySent = msg.includes('DeBridge transaction failed:') ||
|
|
717
|
+
msg.includes('DeBridge transaction timed out') ||
|
|
718
|
+
msg.includes('Missing deBridge order ID');
|
|
719
|
+
if (txAlreadySent) {
|
|
720
|
+
// Transaction was sent — do NOT fall back, propagate the error
|
|
721
|
+
throw error;
|
|
722
|
+
}
|
|
723
|
+
console.warn('DeBridge quote/setup failed, falling back to relay.link bridge:', msg);
|
|
724
|
+
return await executeRelayBridge(walletClient, connector, sourceChainId, sourceTokenAddress, isSourceNative, bridgeUsdcAmount, approveUsdcCalldata, depositCalldata, evmUserForBridge, depositorAddress, setCurrentStep, onStatus);
|
|
721
725
|
}
|
|
722
726
|
}
|
|
723
727
|
else if (selectedProvider === 'relay') {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@silentswap/react",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.49",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "dist/index.js",
|
|
7
7
|
"types": "dist/index.d.ts",
|
|
@@ -24,8 +24,8 @@
|
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@bigmi/core": "^0.6.5",
|
|
26
26
|
"@ensdomains/ensjs": "^4.2.0",
|
|
27
|
-
"@silentswap/sdk": "0.1.
|
|
28
|
-
"@silentswap/ui-kit": "0.1.
|
|
27
|
+
"@silentswap/sdk": "0.1.49",
|
|
28
|
+
"@silentswap/ui-kit": "0.1.49",
|
|
29
29
|
"@solana/codecs-strings": "^5.1.0",
|
|
30
30
|
"@solana/kit": "^5.1.0",
|
|
31
31
|
"@solana/rpc": "^5.1.0",
|