Skip to content

Commit

Permalink
added poseidon create_token
Browse files Browse the repository at this point in the history
  • Loading branch information
adpthegreat committed Nov 28, 2024
1 parent f2b20c3 commit 4482c4d
Show file tree
Hide file tree
Showing 19 changed files with 1,816 additions and 67 deletions.
32 changes: 32 additions & 0 deletions tokens/create-token/poseidon/Anchor.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
[toolchain]

[features]
resolution = true
skip-lint = false

[programs.localnet]
create_tokens = "6xsCBfTAhmH8JQ6cXN69cvWaiDUG723k76MDMjt9fRah"

[registry]
url = "https://api.apr.dev"

[provider]
cluster = "Localnet"
wallet = "~/.config/solana/id.json"

[scripts]
test = "pnpm run ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts"

[test]
startup_wait = 5000
shutdown_wait = 2000
upgradeable = false

[test.validator]
bind_address = "0.0.0.0"
url = "https://api.mainnet-beta.solana.com"
ledger = ".anchor/test-ledger"
rpc_port = 8899

[[test.validator.clone]]
address = "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"
File renamed without changes.
7 changes: 0 additions & 7 deletions tokens/create-token/poseidon/create_tokens/.gitignore

This file was deleted.

7 changes: 0 additions & 7 deletions tokens/create-token/poseidon/create_tokens/.prettierignore

This file was deleted.

18 changes: 0 additions & 18 deletions tokens/create-token/poseidon/create_tokens/Anchor.toml

This file was deleted.

This file was deleted.

16 changes: 0 additions & 16 deletions tokens/create-token/poseidon/create_tokens/tests/create_tokens.ts

This file was deleted.

76 changes: 76 additions & 0 deletions tokens/create-token/poseidon/dump.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,76 @@
#!/bin/bash

# Exit immediately if a command exits with a non-zero status
set -e

# Mainnet URL
MAINNET_URL="https://api.mainnet-beta.solana.com"

# Function to check Solana installation
check_solana_installation() {
if ! command -v solana &> /dev/null; then
echo "Error: Solana CLI is not installed or not in PATH"
return 1
fi

if ! solana --version &> /dev/null; then
echo "Error: Solana CLI is available but returned an error"
return 1
fi

return 0
}

# Function to check and set Solana network to mainnet
check_and_set_mainnet() {
# Get current cluster
current_cluster=$(solana config get | grep "RPC URL" | awk '{print $3}')

# If not on mainnet, switch to mainnet
if [[ "$current_cluster" != "$MAINNET_URL" ]]; then
echo "Switching Solana network to mainnet..."
solana config set --url "$MAINNET_URL"
fi
}

# Function to check if Solana test validator is running
check_test_validator() {
# Check if solana-test-validator process is running
if ! pgrep -f "solana-test-validator" &> /dev/null; then
echo "Error: Solana test validator is not running."
echo "Please start Solana test validator in a new terminal in this directory:"
echo "cd $(pwd) && solana-test-validator"
return 1
fi

return 0
}

# Main script
main() {
# Check if Solana is installed
if ! check_solana_installation; then
echo "Solana check failed"
exit 1
fi

# Check and set to mainnet if needed
check_and_set_mainnet

# Check if test validator is running
if ! check_test_validator; then
exit 1
fi

# Dump Solana program
if ! solana program dump metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s mpl_token_metadata.so; then
echo "Failed to dump Solana program"
exit 1
fi

echo "Solana program dumped successfully"
}

# Run the main function
main

Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,14 @@
"license": "ISC",
"scripts": {
"lint:fix": "prettier */*.js \"*/**/*{.js,.ts}\" -w",
"lint": "prettier */*.js \"*/**/*{.js,.ts}\" --check"
"lint": "prettier */*.js \"*/**/*{.js,.ts}\" --check",
"ts-mocha": "ts-mocha --project tsconfig.json"
},
"dependencies": {
"@coral-xyz/anchor": "^0.30.1"
"@coral-xyz/anchor": "^0.30.1",
"@solana/web3.js": "^1.95.4",
"anchor-bankrun": "^0.5.0",
"solana-bankrun": "^0.4.0"
},
"devDependencies": {
"chai": "^4.3.4",
Expand Down
Loading

0 comments on commit 4482c4d

Please sign in to comment.