@silentswap/sdk 0.0.90 → 0.0.91

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.
Files changed (2) hide show
  1. package/dist/bridge.js +11 -11
  2. package/package.json +1 -1
package/dist/bridge.js CHANGED
@@ -716,23 +716,23 @@ async function solveDebridgeSingleChainUsdcAmount(chainId, srcToken, srcAmount,
716
716
  * @param maxImpactPercent - Maximum price impact percentage allowed (default from constants)
717
717
  * @returns Promise resolving to solve result with optimal amounts
718
718
  */
719
- export async function solveOptimalUsdcAmount(srcChainId, srcToken, srcAmount, userAddress, depositCalldata, maxImpactPercent, depositorAddress, evmSignerAddress // Optional EVM address for deposit calldata (required for Solana swaps)
719
+ export async function solveOptimalUsdcAmount(srcChainId, srcToken, srcAmount, userAddress, depositCalldata, maxImpactPercent, depositorAddress, evmSignerAddress // Optional EVM address for deposit calldata (required for non-EVM swaps: Solana, Bitcoin)
720
720
  ) {
721
- // Check if this is a Solana chain
722
- const isSolanaChain = isSolanaChainId(srcChainId);
723
- // For Solana chains, we need an EVM address for deposit calldata
724
- // userAddress is the Solana address (for relay quote user parameter)
721
+ // Check if this is a non-EVM chain (Solana, Bitcoin, etc.)
722
+ const isNonEvmChain = isNonEvmRelayChainId(srcChainId);
723
+ // For non-EVM chains (Solana, Bitcoin), we need an EVM address for deposit calldata
724
+ // userAddress is the source chain address (Solana/Bitcoin) for relay quote user parameter
725
725
  // evmSignerAddress is the EVM address (for deposit calldata and relay quote recipient)
726
- const evmAddressForCalldata = evmSignerAddress || (!isSolanaChain && userAddress.startsWith('0x') ? userAddress : undefined);
726
+ const evmAddressForCalldata = evmSignerAddress || (!isNonEvmChain && userAddress.startsWith('0x') ? userAddress : undefined);
727
727
  if (!depositCalldata && !evmAddressForCalldata) {
728
- throw new Error('EVM address required for deposit calldata. Provide evmSignerAddress parameter for Solana swaps.');
728
+ throw new Error('EVM address required for deposit calldata. Provide evmSignerAddress parameter for non-EVM swaps.');
729
729
  }
730
730
  // Create phony deposit calldata if not provided
731
731
  const calldata = depositCalldata || createPhonyDepositCalldata(evmAddressForCalldata);
732
- // For Solana chains, we need to pass the EVM address as recipient in relay quotes
733
- // userAddress is the Solana address (for user parameter)
734
- // evmSignerAddress is the EVM address (for recipient parameter)
735
- const recipientAddress = isSolanaChain && evmSignerAddress ? evmSignerAddress : userAddress;
732
+ // For non-EVM chains, we need to pass the EVM address as recipient in relay quotes
733
+ // userAddress is the source chain address (for user parameter)
734
+ // evmSignerAddress is the EVM address (for recipient parameter on the destination EVM chain)
735
+ const recipientAddress = isNonEvmChain && evmSignerAddress ? evmSignerAddress : userAddress;
736
736
  // Try both providers in parallel
737
737
  const [relayResult, debridgeResult] = await Promise.allSettled([
738
738
  solveRelayUsdcAmount(srcChainId, srcToken, srcAmount, userAddress, calldata, maxImpactPercent, depositorAddress, recipientAddress),
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@silentswap/sdk",
3
3
  "type": "module",
4
- "version": "0.0.90",
4
+ "version": "0.0.91",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
7
7
  "files": [