Skip to content

Commit 1c56ad5

Browse files
author
adpthegreat
committed
updated transfer-tokens
1 parent ab8967c commit 1c56ad5

File tree

15 files changed

+2247
-0
lines changed

15 files changed

+2247
-0
lines changed
Lines changed: 32 additions & 0 deletions
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+
transfer_tokens = "4h2WWD9id7t75bNDwwWRoWYh759MDePhPZFiFJat9E9S"
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"
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[workspace]
2+
members = [
3+
"programs/*"
4+
]
5+
resolver = "2"
6+
7+
[profile.release]
8+
overflow-checks = true
9+
lto = "fat"
10+
codegen-units = 1
11+
[profile.release.build-override]
12+
opt-level = 3
13+
incremental = false
14+
codegen-units = 1
Lines changed: 76 additions & 0 deletions
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+
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
// Migrations are an early feature. Currently, they're nothing more than this
2+
// single deploy script that's invoked from the CLI, injecting a provider
3+
// configured from the workspace's Anchor.toml.
4+
5+
const anchor = require('@coral-xyz/anchor');
6+
7+
module.exports = async (provider) => {
8+
// Configure client to use the provider.
9+
anchor.setProvider(provider);
10+
11+
// Add your deploy script here.
12+
};
775 KB
Binary file not shown.
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"license": "ISC",
3+
"scripts": {
4+
"lint:fix": "prettier */*.js \"*/**/*{.js,.ts}\" -w",
5+
"lint": "prettier */*.js \"*/**/*{.js,.ts}\" --check",
6+
"ts-mocha": "ts-mocha --project tsconfig.json"
7+
},
8+
"dependencies": {
9+
"@coral-xyz/anchor": "^0.30.1",
10+
"@solana/spl-token": "0.4.9",
11+
"@solana/web3.js": "^1.95.5",
12+
"anchor-bankrun": "^0.5.0",
13+
"solana-bankrun": "^0.4.0"
14+
},
15+
"devDependencies": {
16+
"@types/bn.js": "^5.1.6",
17+
"@types/chai": "^4.3.20",
18+
"@types/mocha": "^9.1.1",
19+
"chai": "^4.5.0",
20+
"mocha": "^9.2.2",
21+
"prettier": "^2.8.8",
22+
"ts-mocha": "^10.0.0",
23+
"typescript": "^4.9.5"
24+
}
25+
}

0 commit comments

Comments
 (0)