Skip to content

Commit c842d15

Browse files
v15.7.3: prevent passing down wrong orca pool data
1 parent 0ba3303 commit c842d15

File tree

8 files changed

+38
-3
lines changed

8 files changed

+38
-3
lines changed

dist/esm/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1561,6 +1561,13 @@ const getPrice = async ({
15611561
});
15621562
}
15631563

1564+
let poolMints = [freshWhirlpoolData.tokenMintA.toString(), freshWhirlpoolData.tokenMintB.toString()];
1565+
1566+
if(!poolMints.includes(tokenIn) || !poolMints.includes(tokenOut)) {
1567+
console.log('wrong freshWhirlpoolData!', poolMints, tokenIn, tokenOut);
1568+
throw('wrong freshWhirlpoolData!', poolMints, tokenIn, tokenOut)
1569+
}
1570+
15641571
const aToB = (freshWhirlpoolData.tokenMintA.toString() === tokenIn);
15651572

15661573
const tickArrays = await getTickArrays({ pool: account.pubkey, freshWhirlpoolData, aToB });

dist/esm/index.svm.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3764,6 +3764,13 @@ const getPrice = async ({
37643764
});
37653765
}
37663766

3767+
let poolMints = [freshWhirlpoolData.tokenMintA.toString(), freshWhirlpoolData.tokenMintB.toString()];
3768+
3769+
if(!poolMints.includes(tokenIn) || !poolMints.includes(tokenOut)) {
3770+
console.log('wrong freshWhirlpoolData!', poolMints, tokenIn, tokenOut);
3771+
throw('wrong freshWhirlpoolData!', poolMints, tokenIn, tokenOut)
3772+
}
3773+
37673774
const aToB = (freshWhirlpoolData.tokenMintA.toString() === tokenIn);
37683775

37693776
const tickArrays = await getTickArrays({ pool: account.pubkey, freshWhirlpoolData, aToB });

dist/umd/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1566,6 +1566,13 @@
15661566
});
15671567
}
15681568

1569+
let poolMints = [freshWhirlpoolData.tokenMintA.toString(), freshWhirlpoolData.tokenMintB.toString()];
1570+
1571+
if(!poolMints.includes(tokenIn) || !poolMints.includes(tokenOut)) {
1572+
console.log('wrong freshWhirlpoolData!', poolMints, tokenIn, tokenOut);
1573+
throw('wrong freshWhirlpoolData!', poolMints, tokenIn, tokenOut)
1574+
}
1575+
15691576
const aToB = (freshWhirlpoolData.tokenMintA.toString() === tokenIn);
15701577

15711578
const tickArrays = await getTickArrays({ pool: account.pubkey, freshWhirlpoolData, aToB });

dist/umd/index.svm.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3770,6 +3770,13 @@
37703770
});
37713771
}
37723772

3773+
let poolMints = [freshWhirlpoolData.tokenMintA.toString(), freshWhirlpoolData.tokenMintB.toString()];
3774+
3775+
if(!poolMints.includes(tokenIn) || !poolMints.includes(tokenOut)) {
3776+
console.log('wrong freshWhirlpoolData!', poolMints, tokenIn, tokenOut);
3777+
throw('wrong freshWhirlpoolData!', poolMints, tokenIn, tokenOut)
3778+
}
3779+
37733780
const aToB = (freshWhirlpoolData.tokenMintA.toString() === tokenIn);
37743781

37753782
const tickArrays = await getTickArrays({ pool: account.pubkey, freshWhirlpoolData, aToB });

package.evm.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@depay/web3-exchanges-evm",
33
"moduleName": "Web3Exchanges",
4-
"version": "15.7.2",
4+
"version": "15.7.3",
55
"description": "JavaScript library simplifying decentralized web3 exchange routing for multiple blockchains and exchanges.",
66
"main": "dist/umd/index.evm.js",
77
"module": "dist/esm/index.evm.js",

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@depay/web3-exchanges",
33
"moduleName": "Web3Exchanges",
4-
"version": "15.7.2",
4+
"version": "15.7.3",
55
"description": "JavaScript library simplifying decentralized web3 exchange routing for multiple blockchains and exchanges.",
66
"main": "dist/umd/index.js",
77
"module": "dist/esm/index.js",

package.svm.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@depay/web3-exchanges-svm",
33
"moduleName": "Web3Exchanges",
4-
"version": "15.7.2",
4+
"version": "15.7.3",
55
"description": "JavaScript library simplifying decentralized web3 exchange routing for multiple blockchains and exchanges.",
66
"main": "dist/umd/index.svm.js",
77
"module": "dist/esm/index.svm.js",

src/platforms/svm/orca/price/index.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,13 @@ const getPrice = async ({
4343
})
4444
}
4545

46+
let poolMints = [freshWhirlpoolData.tokenMintA.toString(), freshWhirlpoolData.tokenMintB.toString()]
47+
48+
if(!poolMints.includes(tokenIn) || !poolMints.includes(tokenOut)) {
49+
console.log('wrong freshWhirlpoolData!', poolMints, tokenIn, tokenOut)
50+
throw('wrong freshWhirlpoolData!', poolMints, tokenIn, tokenOut)
51+
}
52+
4653
const aToB = (freshWhirlpoolData.tokenMintA.toString() === tokenIn)
4754

4855
const tickArrays = await getTickArrays({ pool: account.pubkey, freshWhirlpoolData, aToB })

0 commit comments

Comments
 (0)