nansen-cli 1.40.0 → 1.40.1
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/CHANGELOG.md +6 -0
- package/package.json +1 -1
- package/src/trade-validation.js +16 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,11 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 1.40.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#516](https://github.com/nansen-ai/nansen-cli/pull/516) [`48722ef`](https://github.com/nansen-ai/nansen-cli/commit/48722ef0c7e6c0a7ce8c4c026245afb6e6f47e79) Thanks [@kome12](https://github.com/kome12)! - Fix cross-chain bridges into native SOL being refused at execute time. The quote/intent binding compared the wrapped-SOL mint (how `--to SOL` resolves) against the System Program address that aggregators use as the native-SOL sentinel and rejected them as different tokens. Both spellings are now treated as the same asset.
|
|
8
|
+
|
|
3
9
|
## 1.40.0
|
|
4
10
|
|
|
5
11
|
### Minor Changes
|
package/package.json
CHANGED
package/src/trade-validation.js
CHANGED
|
@@ -122,6 +122,17 @@ const NATIVE_TOKEN_ADDRESSES = {
|
|
|
122
122
|
base: '0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee',
|
|
123
123
|
};
|
|
124
124
|
|
|
125
|
+
// Native SOL has two on-chain spellings that denote the same asset: the
|
|
126
|
+
// canonical wrapped-SOL mint (what the CLI resolves `SOL` to and persists as
|
|
127
|
+
// the request intent) and the System Program address that aggregators and
|
|
128
|
+
// bridges (e.g. Relay) use as the native-lamport sentinel in their quotes.
|
|
129
|
+
// tokensEqual treats them as equivalent so the intent-binding check doesn't
|
|
130
|
+
// false-reject a legitimate quote that names native SOL the other way.
|
|
131
|
+
const SOLANA_NATIVE_SOL_ALIASES = new Set([
|
|
132
|
+
'So11111111111111111111111111111111111111112', // wrapped SOL mint
|
|
133
|
+
'11111111111111111111111111111111', // System Program — native SOL sentinel
|
|
134
|
+
]);
|
|
135
|
+
|
|
125
136
|
// USDC contract addresses per chain.
|
|
126
137
|
const USDC_ADDRESSES = {
|
|
127
138
|
solana: 'EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v',
|
|
@@ -571,7 +582,11 @@ export function needsAllowanceRevoke(existingAllowance, approveAmt) {
|
|
|
571
582
|
*/
|
|
572
583
|
function tokensEqual(a, b, chain) {
|
|
573
584
|
if (!a || !b) return false;
|
|
574
|
-
if (chain === 'solana')
|
|
585
|
+
if (chain === 'solana') {
|
|
586
|
+
// Both sides naming native SOL (in either spelling) is a match.
|
|
587
|
+
if (SOLANA_NATIVE_SOL_ALIASES.has(a) && SOLANA_NATIVE_SOL_ALIASES.has(b)) return true;
|
|
588
|
+
return a === b;
|
|
589
|
+
}
|
|
575
590
|
return a.toLowerCase() === b.toLowerCase();
|
|
576
591
|
}
|
|
577
592
|
|