@silentswap/sdk 0.1.45 → 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/constants.d.ts +1 -0
- package/dist/constants.js +3 -0
- package/dist/quote-utils.js +6 -6
- package/package.json +1 -1
package/dist/constants.d.ts
CHANGED
|
@@ -31,6 +31,7 @@ export declare const SB58_ADDR_SOL_PROGRAM_SYSTEM = "111111111111111111111111111
|
|
|
31
31
|
export declare const SB58_ADDR_SOL_RELAY_LINK_RECIPIENT = "CbKGgVKLJFb8bBrf58DnAkdryX6ubewVytn7X957YwNr";
|
|
32
32
|
export declare const SB58_ADDR_SOL_DEAD = "1nc1nerator11111111111111111111111111111111";
|
|
33
33
|
export declare const SBTC_ADDR_BITCOIN_NATIVE = "bc1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqmql8k8";
|
|
34
|
+
export declare const SBTC_ADDR_BTC_RELAY_LINK_RECIPIENT = "bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4";
|
|
34
35
|
export declare const N_RELAY_CHAIN_ID_SOLANA = 792703809;
|
|
35
36
|
export declare const N_RELAY_CHAIN_ID_BITCOIN = 8253038;
|
|
36
37
|
export declare const N_RELAY_CHAIN_ID_TRON = 728126428;
|
package/dist/constants.js
CHANGED
|
@@ -56,6 +56,9 @@ export const SB58_ADDR_SOL_DEAD = '1nc1nerator11111111111111111111111111111111';
|
|
|
56
56
|
// Bitcoin constants
|
|
57
57
|
// Bitcoin native token address (BTC) used by relay.link
|
|
58
58
|
export const SBTC_ADDR_BITCOIN_NATIVE = 'bc1qqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqmql8k8';
|
|
59
|
+
// Valid Bitcoin recipient address for relay.link quote estimation (BIP-173 test vector P2WPKH)
|
|
60
|
+
// relay.link rejects the phony zero address (SBTC_ADDR_BITCOIN_NATIVE) as recipient — use this fallback
|
|
61
|
+
export const SBTC_ADDR_BTC_RELAY_LINK_RECIPIENT = 'bc1qw508d6qejxtdg4y5r3zarvary0c5xw7kv8f3t4';
|
|
59
62
|
// Relay.link chain IDs for non-EVM chains
|
|
60
63
|
export const N_RELAY_CHAIN_ID_SOLANA = 792703809;
|
|
61
64
|
export const N_RELAY_CHAIN_ID_BITCOIN = 8253038;
|
package/dist/quote-utils.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import BigNumber from 'bignumber.js';
|
|
2
2
|
import { fetchRelayQuote, fetchDebridgeOrder, } from './bridge.js';
|
|
3
|
-
import { N_DEBRIDGE_CHAIN_ID_SOLANA, N_RELAY_CHAIN_ID_SOLANA, N_RELAY_CHAIN_ID_BITCOIN, SB58_ADDR_SOL_PROGRAM_SYSTEM, SB58_ADDR_SOL_DEAD, SB58_ADDR_SOL_RELAY_LINK_RECIPIENT, SBTC_ADDR_BITCOIN_NATIVE, DEAD_ADDRESS, } from './constants.js';
|
|
3
|
+
import { N_DEBRIDGE_CHAIN_ID_SOLANA, N_RELAY_CHAIN_ID_SOLANA, N_RELAY_CHAIN_ID_BITCOIN, SB58_ADDR_SOL_PROGRAM_SYSTEM, SB58_ADDR_SOL_DEAD, SB58_ADDR_SOL_RELAY_LINK_RECIPIENT, SBTC_ADDR_BITCOIN_NATIVE, SBTC_ADDR_BTC_RELAY_LINK_RECIPIENT, DEAD_ADDRESS, } from './constants.js';
|
|
4
4
|
const ZERO_ADDRESS = '0x0000000000000000000000000000000000000000';
|
|
5
5
|
/**
|
|
6
6
|
* Map relay.link chain IDs to deBridge chain IDs
|
|
@@ -434,16 +434,16 @@ forceProvider, tradeType = 'EXACT_INPUT', dstAmount) {
|
|
|
434
434
|
if (isDestBitcoin) {
|
|
435
435
|
// For Bitcoin destinations, relay.link requires:
|
|
436
436
|
// - user to be the source chain address (EVM address if source is EVM)
|
|
437
|
-
// - recipient to be
|
|
438
|
-
//
|
|
437
|
+
// - recipient to be a VALID Bitcoin address (NOT the phony zero address)
|
|
438
|
+
// relay.link returns NO_SWAP_ROUTES_FOUND when recipient is the phony address
|
|
439
439
|
// Set recipient to Bitcoin address
|
|
440
|
-
if (recipientAddress && !recipientAddress.startsWith('0x') && !recipientAddress.startsWith('1111')) {
|
|
440
|
+
if (recipientAddress && !recipientAddress.startsWith('0x') && !recipientAddress.startsWith('1111') && recipientAddress !== SBTC_ADDR_BITCOIN_NATIVE) {
|
|
441
441
|
// Use provided Bitcoin recipient address
|
|
442
442
|
relayParams.recipient = recipientAddress;
|
|
443
443
|
}
|
|
444
444
|
else {
|
|
445
|
-
//
|
|
446
|
-
|
|
445
|
+
// Fallback to a valid Bitcoin address for quote estimation
|
|
446
|
+
relayParams.recipient = SBTC_ADDR_BTC_RELAY_LINK_RECIPIENT;
|
|
447
447
|
}
|
|
448
448
|
}
|
|
449
449
|
else if (isSrcBitcoin) {
|