Skip to content

Commit 4482c4d

Browse files
author
adpthegreat
committed
added poseidon create_token
1 parent f2b20c3 commit 4482c4d

File tree

19 files changed

+1816
-67
lines changed

19 files changed

+1816
-67
lines changed

Diff for: tokens/create-token/poseidon/Anchor.toml

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
[toolchain]
2+
3+
[features]
4+
resolution = true
5+
skip-lint = false
6+
7+
[programs.localnet]
8+
create_tokens = "6xsCBfTAhmH8JQ6cXN69cvWaiDUG723k76MDMjt9fRah"
9+
10+
[registry]
11+
url = "https://api.apr.dev"
12+
13+
[provider]
14+
cluster = "Localnet"
15+
wallet = "~/.config/solana/id.json"
16+
17+
[scripts]
18+
test = "pnpm run ts-mocha -p ./tsconfig.json -t 1000000 tests/**/*.ts"
19+
20+
[test]
21+
startup_wait = 5000
22+
shutdown_wait = 2000
23+
upgradeable = false
24+
25+
[test.validator]
26+
bind_address = "0.0.0.0"
27+
url = "https://api.mainnet-beta.solana.com"
28+
ledger = ".anchor/test-ledger"
29+
rpc_port = 8899
30+
31+
[[test.validator.clone]]
32+
address = "metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s"

Diff for: tokens/create-token/poseidon/create_tokens/.gitignore

-7
This file was deleted.

Diff for: tokens/create-token/poseidon/create_tokens/.prettierignore

-7
This file was deleted.

Diff for: tokens/create-token/poseidon/create_tokens/Anchor.toml

-18
This file was deleted.

Diff for: tokens/create-token/poseidon/create_tokens/programs/create_tokens/src/lib.rs

-16
This file was deleted.

Diff for: tokens/create-token/poseidon/create_tokens/tests/create_tokens.ts

-16
This file was deleted.

Diff for: tokens/create-token/poseidon/dump.sh

+76
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
#!/bin/bash
2+
3+
# Exit immediately if a command exits with a non-zero status
4+
set -e
5+
6+
# Mainnet URL
7+
MAINNET_URL="https://api.mainnet-beta.solana.com"
8+
9+
# Function to check Solana installation
10+
check_solana_installation() {
11+
if ! command -v solana &> /dev/null; then
12+
echo "Error: Solana CLI is not installed or not in PATH"
13+
return 1
14+
fi
15+
16+
if ! solana --version &> /dev/null; then
17+
echo "Error: Solana CLI is available but returned an error"
18+
return 1
19+
fi
20+
21+
return 0
22+
}
23+
24+
# Function to check and set Solana network to mainnet
25+
check_and_set_mainnet() {
26+
# Get current cluster
27+
current_cluster=$(solana config get | grep "RPC URL" | awk '{print $3}')
28+
29+
# If not on mainnet, switch to mainnet
30+
if [[ "$current_cluster" != "$MAINNET_URL" ]]; then
31+
echo "Switching Solana network to mainnet..."
32+
solana config set --url "$MAINNET_URL"
33+
fi
34+
}
35+
36+
# Function to check if Solana test validator is running
37+
check_test_validator() {
38+
# Check if solana-test-validator process is running
39+
if ! pgrep -f "solana-test-validator" &> /dev/null; then
40+
echo "Error: Solana test validator is not running."
41+
echo "Please start Solana test validator in a new terminal in this directory:"
42+
echo "cd $(pwd) && solana-test-validator"
43+
return 1
44+
fi
45+
46+
return 0
47+
}
48+
49+
# Main script
50+
main() {
51+
# Check if Solana is installed
52+
if ! check_solana_installation; then
53+
echo "Solana check failed"
54+
exit 1
55+
fi
56+
57+
# Check and set to mainnet if needed
58+
check_and_set_mainnet
59+
60+
# Check if test validator is running
61+
if ! check_test_validator; then
62+
exit 1
63+
fi
64+
65+
# Dump Solana program
66+
if ! solana program dump metaqbxxUerdq28cj1RbAWkYQm3ybzjb6a8bt518x1s mpl_token_metadata.so; then
67+
echo "Failed to dump Solana program"
68+
exit 1
69+
fi
70+
71+
echo "Solana program dumped successfully"
72+
}
73+
74+
# Run the main function
75+
main
76+

Diff for: tokens/create-token/poseidon/mpl_token_metadata.so

775 KB
Binary file not shown.

Diff for: tokens/create-token/poseidon/create_tokens/package.json renamed to tokens/create-token/poseidon/package.json

+6-2
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,14 @@
22
"license": "ISC",
33
"scripts": {
44
"lint:fix": "prettier */*.js \"*/**/*{.js,.ts}\" -w",
5-
"lint": "prettier */*.js \"*/**/*{.js,.ts}\" --check"
5+
"lint": "prettier */*.js \"*/**/*{.js,.ts}\" --check",
6+
"ts-mocha": "ts-mocha --project tsconfig.json"
67
},
78
"dependencies": {
8-
"@coral-xyz/anchor": "^0.30.1"
9+
"@coral-xyz/anchor": "^0.30.1",
10+
"@solana/web3.js": "^1.95.4",
11+
"anchor-bankrun": "^0.5.0",
12+
"solana-bankrun": "^0.4.0"
913
},
1014
"devDependencies": {
1115
"chai": "^4.3.4",

0 commit comments

Comments
 (0)