@silentswap/react 0.0.58 → 0.0.60

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.
@@ -1,5 +1,5 @@
1
1
  import { useCallback, useState } from 'react';
2
- import { isSolanaAsset, isBitcoinAsset, parseEvmCaip19, S_CAIP19_USDC_AVALANCHE, getAssetByCaip19, solveOptimalUsdcAmount, fetchRelayQuote, N_RELAY_CHAIN_ID_SOLANA, N_RELAY_CHAIN_ID_BITCOIN, SB58_ADDR_SOL_PROGRAM_SYSTEM, isSolanaNativeToken, parseSolanaCaip19, EVM_PHONY_ADDRESS, isValidSolanaAddress, isValidBitcoinAddress, isValidEvmAddress, getAddressFromCaip10, S0X_ADDR_USDC_AVALANCHE, isEvmNativeToken, caip19FungibleEvmToken, FacilitatorKeyType, createHdFacilitatorGroupFromEntropy, PublicKeyArgGroups, SB58_CHAIN_ID_SOLANA_MAINNET, caip19SplToken, DeliveryMethod, X_MAX_IMPACT_PERCENT, NI_CHAIN_ID_AVALANCHE, SBTC_ADDR_BITCOIN_NATIVE, } from '@silentswap/sdk';
2
+ import { isSolanaAsset, isBitcoinAsset, parseEvmCaip19, S_CAIP19_USDC_AVALANCHE, getAssetByCaip19, solveOptimalUsdcAmount, fetchRelayQuote, N_RELAY_CHAIN_ID_SOLANA, N_RELAY_CHAIN_ID_BITCOIN, SB58_ADDR_SOL_PROGRAM_SYSTEM, isSolanaNativeToken, parseSolanaCaip19, EVM_PHONY_ADDRESS, isValidSolanaAddress, isValidBitcoinAddress, isValidEvmAddress, getAddressFromCaip10, S0X_ADDR_USDC_AVALANCHE, isEvmNativeToken, caip19FungibleEvmToken, FacilitatorKeyType, createHdFacilitatorGroupFromEntropy, PublicKeyArgGroups, SB58_CHAIN_ID_SOLANA_MAINNET, caip19SplToken, DeliveryMethod, X_MAX_IMPACT_PERCENT, NI_CHAIN_ID_AVALANCHE, SBTC_ADDR_BITCOIN_NATIVE, isEvmAsset, } from '@silentswap/sdk';
3
3
  import { getAddress } from 'viem';
4
4
  import { BigNumber } from 'bignumber.js';
5
5
  /**
@@ -280,17 +280,22 @@ export function useQuoteCalculation({ address, evmAddress, wallet, depositorAddr
280
280
  }
281
281
  else {
282
282
  // Check if contact is a valid EVM address format
283
- if (isValidEvmAddress(dest.contact)) {
284
- // Normalize to checksummed format
285
- try {
286
- recipientAddress = getAddress(dest.contact);
283
+ if (isEvmAsset(dest.asset)) {
284
+ if (isValidEvmAddress(dest.contact)) {
285
+ // Normalize to checksummed format
286
+ try {
287
+ recipientAddress = getAddress(dest.contact);
288
+ }
289
+ catch (error) {
290
+ throw new Error(`Invalid EVM address checksum for destination ${idx}: ${dest.contact}. ${error instanceof Error ? error.message : String(error)}`);
291
+ }
287
292
  }
288
- catch (error) {
289
- throw new Error(`Invalid EVM address checksum for destination ${idx}: ${dest.contact}. ${error instanceof Error ? error.message : String(error)}`);
293
+ else {
294
+ throw new Error(`Hex: ${dest.asset} Invalid EVM recipient address for destination ${idx}: ${dest.contact}. Expected 0x-prefixed EVM address or caip10:eip155:*: format.`);
290
295
  }
291
296
  }
292
297
  else {
293
- throw new Error(`Invalid EVM recipient address for destination ${idx}: ${dest.contact}. Expected 0x-prefixed EVM address or caip10:eip155:*: format.`);
298
+ recipientAddress = dest.contact;
294
299
  }
295
300
  }
296
301
  }
@@ -314,7 +319,7 @@ export function useQuoteCalculation({ address, evmAddress, wallet, depositorAddr
314
319
  }
315
320
  else if (!isDestSolana && !isDestBitcoin) {
316
321
  // Validate EVM address format
317
- if (!isValidEvmAddress(recipientAddress)) {
322
+ if (isEvmAsset(dest.asset) && !isValidEvmAddress(recipientAddress)) {
318
323
  throw new Error(`Invalid recipient address type for EVM destination ${idx}: ${recipientAddress}. Expected 0x-prefixed EVM address.`);
319
324
  }
320
325
  }
@@ -200,7 +200,6 @@ export function useTransaction({ walletClient, connector, solanaConnector, solan
200
200
  }
201
201
  // Create Solana transaction executor
202
202
  const solanaExecutor = createSolanaTransactionExecutor(solanaConnector, solanaConnection);
203
- debugger;
204
203
  // For Solana, we still need EVM wallet client for chain switching (if needed)
205
204
  // But the actual transaction execution will use Solana executor
206
205
  const executeTx = createTransactionExecutor(walletClient, connector, solanaExecutor);
@@ -247,7 +246,6 @@ export function useTransaction({ walletClient, connector, solanaConnector, solan
247
246
  setIsLoading(true);
248
247
  setError(null);
249
248
  try {
250
- debugger;
251
249
  // Create wrapper functions using shared utilities
252
250
  const executeTx = createTransactionExecutor(walletClient, connector);
253
251
  const switchChain = createChainSwitcher(walletClient, connector);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@silentswap/react",
3
3
  "type": "module",
4
- "version": "0.0.58",
4
+ "version": "0.0.60",
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.0.58",
28
- "@silentswap/ui-kit": "0.0.58",
27
+ "@silentswap/sdk": "0.0.60",
28
+ "@silentswap/ui-kit": "0.0.60",
29
29
  "@solana/codecs-strings": "^5.1.0",
30
30
  "@solana/kit": "^5.1.0",
31
31
  "@solana/rpc": "^5.1.0",