mirror of
https://github.com/0x1d/drift-keeper.git
synced 2025-12-16 11:04:31 +01:00
initial commit
This commit is contained in:
57
ctl.sh
Executable file
57
ctl.sh
Executable file
@@ -0,0 +1,57 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
LAMPORTS_PER_SOL=1000000000
|
||||
API_ENDPOINT=https://api.mainnet-beta.solana.com/
|
||||
|
||||
source .env
|
||||
|
||||
function balance {
|
||||
function sol {
|
||||
local addr=${1:-$WALLET_ADDRESS}
|
||||
local balance=$(curl $API_ENDPOINT -s -X POST -H "Content-Type: application/json" -d '
|
||||
{
|
||||
"jsonrpc": "2.0", "id": 1,
|
||||
"method": "getBalance",
|
||||
"params": [
|
||||
"'${addr}'"
|
||||
]
|
||||
}
|
||||
' | jq .result.value)
|
||||
echo "$(jq -n $balance/$LAMPORTS_PER_SOL)"
|
||||
}
|
||||
|
||||
function usdc {
|
||||
local addr=${1:-$WALLET_ADDRESS}
|
||||
local balance=$(
|
||||
curl $API_ENDPOINT -s -X POST -H "Content-Type: application/json" -d '
|
||||
{
|
||||
"jsonrpc": "2.0", "id": 1,
|
||||
"method": "getTokenAccountsByOwner",
|
||||
"params": [
|
||||
"'${addr}'",
|
||||
{
|
||||
"mint": "EPjFWdd5AufqSSqeM2qN1xzybapC8G4wEGGkZwyTDt1v"
|
||||
},{
|
||||
"encoding": "jsonParsed"
|
||||
}]
|
||||
}' | jq .result.value[0].account.data.parsed.info.tokenAmount.uiAmount)
|
||||
echo ${balance}
|
||||
|
||||
}
|
||||
${@:-}
|
||||
}
|
||||
|
||||
function image {
|
||||
function build {
|
||||
mkdir -p .build
|
||||
git clone https://github.com/drift-labs/keeper-bots-v2 -b mainnet-beta .build/keeper-bots-v2
|
||||
docker build -f Dockerfile -t ${DOCKER_IMAGE} .build/keeper-bots-v2
|
||||
rm -rf .build
|
||||
}
|
||||
function push {
|
||||
docker push ${DOCKER_IMAGE}
|
||||
}
|
||||
${@:-}
|
||||
}
|
||||
|
||||
${@:-}
|
||||
Reference in New Issue
Block a user