Skip to content

Instantly share code, notes, and snippets.

@zhourunlai
Last active May 9, 2024 14:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zhourunlai/87cb3238f276c92c3c05949cdbbed84e to your computer and use it in GitHub Desktop.
Save zhourunlai/87cb3238f276c92c3c05949cdbbed84e to your computer and use it in GitHub Desktop.
arbitrageur
import requests
import time
KEYS = []
def answer(public_key):
url = "https://wonderland-api2.ngrok.dev/s1/quests/answer/2"
headers = {
"origin": "https://app.sanctum.so",
"user-agent": "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36",
}
data = {
"pk": public_key,
"value": {"answer": "evenstar cathedral"}
}
try:
req = requests.post(url, headers=headers, json=data, timeout=5)
except Exception:
print(f'FAIL: {public_key}')
return
try:
result = req.json()
print(f'SUCC: {public_key} => {result}')
except Exception:
print(f'FAIL: {public_key}')
return
return result
for key in KEYS:
answer(key)
time.sleep(1)
#!/usr/bin/env node
const solMint = 'So11111111111111111111111111111111111111112';
const infMint = '5oVNBeEEQvYi1cX3ir8Dx5n1P7pdxydbGF2X4TxVusJm';
const jitosolMint = 'J1toso1uCk3RLmjorhTtrVwY9HJ7X8V9yYac6Y7kGCPn';
const solInitAmount = 100000000000;
const jitosolRate = 1.10209433278
// 1. https://jup.ag/swap/SOL-INF
function step1_On_Jup(solAmount) {
fetch('https://quote-api.jup.ag/v6/quote?' + new URLSearchParams({
inputMint: solMint,
outputMint: infMint,
amount: solAmount
})
).then(response => response.json())
.then(
data => {
var infAmount = data.outAmount;
console.log("infAmount: ", infAmount);
step2_On_Sanctum(infAmount)
}
)
}
// 2. https://app.sanctum.so/trade
function step2_On_Sanctum(infAmount) {
fetch('https://sanctum-s-api.fly.dev/v1/swap/quote?' + new URLSearchParams({
input: infMint,
outputLstMint: jitosolMint,
amount: infAmount,
mode: 'ExactIn'
})
).then(response => response.json())
.then(
data => {
var jitoAmout = data.outAmount;
console.log("jitoAmout: ", jitoAmout);
step3_On_Jito_Immediately(jitoAmout);
step3_On_Jito_Delayed(jitoAmout);
}
)
}
// 3. https://www.jito.network/staking/
function step3_On_Jito_Immediately(jitoAmout) {
fetch('https://quote-api.jup.ag/v6/quote?' + new URLSearchParams({
inputMint: jitosolMint,
outputMint: solMint,
amount: jitoAmout
})
).then(response => response.json())
.then(
data => {
var solImmAmount = data.outAmount;
console.log("solImmAmount: ", solImmAmount);
}
)
}
function step3_On_Jito_Delayed(jitoAmout) {
var solDelayAmount = Math.floor(jitoAmout * jitosolRate);
console.log("solDelayAmount: ", solDelayAmount);
}
step1_On_Jup(solInitAmount);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment