feat: update api urls (backport #17186) (#17248)

* feat: update api urls

(cherry picked from commit 0f3045fb68)

* fix: cluster test

(cherry picked from commit ae5a10dffd)

* docs: update old devnet and testnet url references

(cherry picked from commit ec621e71dc)

* fix: update devnet and testnet urls

(cherry picked from commit 7be3171f4a)

Co-authored-by: Josh Hundley <josh.hundley@gmail.com>
This commit is contained in:
mergify[bot]
2021-05-15 00:08:24 +00:00
committed by GitHub
parent 9aacd0f3c3
commit e41460d500
21 changed files with 63 additions and 59 deletions

View File

@ -215,8 +215,8 @@ where
pub fn normalize_to_url_if_moniker<T: AsRef<str>>(url_or_moniker: T) -> String {
match url_or_moniker.as_ref() {
"m" | "mainnet-beta" => "https://api.mainnet-beta.solana.com",
"t" | "testnet" => "https://testnet.solana.com",
"d" | "devnet" => "https://devnet.solana.com",
"t" | "testnet" => "https://api.testnet.solana.com",
"d" | "devnet" => "https://api.devnet.solana.com",
"l" | "localhost" => "http://localhost:8899",
url => url,
}

View File

@ -107,13 +107,13 @@ mod test {
#[test]
fn compute_websocket_url() {
assert_eq!(
Config::compute_websocket_url(&"http://devnet.solana.com"),
"ws://devnet.solana.com/".to_string()
Config::compute_websocket_url(&"http://api.devnet.solana.com"),
"ws://api.devnet.solana.com/".to_string()
);
assert_eq!(
Config::compute_websocket_url(&"https://devnet.solana.com"),
"wss://devnet.solana.com/".to_string()
Config::compute_websocket_url(&"https://api.devnet.solana.com"),
"wss://api.devnet.solana.com/".to_string()
);
assert_eq!(

View File

@ -17,7 +17,7 @@ solana config get
例如,要指定 Devnet 集群,请运行:
```bash
solana config set --url https://devnet.solana.com
solana config set --url https://api.devnet.solana.com
```
## 确保版本相匹配

View File

@ -17,7 +17,7 @@ title: 发送和接收代币
首先在测试网给您的钱包_空投_ 一些虚拟代币。
```bash
solana airdrop 10 <RECIPIENT_ACCOUNT_ADDRESS> --url https://devnet.solana.com
solana airdrop 10 <RECIPIENT_ACCOUNT_ADDRESS> --url https://api.devnet.solana.com
```
其中,用您的 base58-encoded 公钥/钱包地址替换此处的 `<RECIPIENT_ACCOUNT_ADDRESS>`文本。
@ -27,7 +27,7 @@ solana airdrop 10 <RECIPIENT_ACCOUNT_ADDRESS> --url https://devnet.solana.com
通过检查帐户余额确认空投已经成功。 输出值应当为 `10 SOL`:
```bash
solana balance <ACCOUNT_ADDRESS> --url https://devnet.solana.com
solana balance <ACCOUNT_ADDRESS> --url https://api.devnet.solana.com
```
#### 创建第二个钱包地址
@ -51,7 +51,7 @@ pubkey: GKvqsuNcnwWqPzzuhLmGi4rzzh55FhJtGizkhHaEJqiV
接下来,通过发送来证明你拥有空投代币。 Solana 集群只有在您用交易发送方公钥对应的私钥签名时,才会接受交易。
```bash
solana transfer --from <KEYPAIR> <RECIPIENT_ACCOUNT_ADDRESS> 5 --url https://devnet.solana.com --fee-payer <KEYPAIR>
solana transfer --from <KEYPAIR> <RECIPIENT_ACCOUNT_ADDRESS> 5 --url https://api.devnet.solana.com --fee-payer <KEYPAIR>
```
其中,用第一个钱包的秘钥对的路径替换 `<KEYPAIR>`,用第二个钱包地址替换 `<RECIPIENT_ACCOUNT_ADDRESS>`
@ -59,7 +59,7 @@ solana transfer --from <KEYPAIR> <RECIPIENT_ACCOUNT_ADDRESS> 5 --url https://dev
使用 `solana balance` 确认余额已经更新:
```bash
solana balance <ACCOUNT_ADDRESS> --url http://devnet.solana.com
solana balance <ACCOUNT_ADDRESS> --url http://api.devnet.solana.com
```
其中 `<ACCOUNT_ADDRESS>` 是您密钥对的公钥或收件人的公钥。
@ -78,11 +78,11 @@ pubkey: DYw8jCTfwHNRJhhmFcbXvVDTqWMEVFBX6ZKUmG5CNSKK #
width enhance concert vacant ketchup eternal spy craft spy guard tag punch # 如果这是一个真实的钱包,不要将这次单词分享到网络上!
==========================================================================
$ solana airdrop 10 DYw8jCTfwHNRJhhmFcbXvVDTqWMEVFBX6ZKUmG5CNSKK --url https://devnet.solana.com # 空投 10 个 SOL 到我的钱包地址/公钥
$ solana airdrop 10 DYw8jCTfwHNRJhhmFcbXvVDTqWMEVFBX6ZKUmG5CNSKK --url https://api.devnet.solana.com # 空投 10 个 SOL 到我的钱包地址/公钥
正在从 35.233.193.70:9900 请求 10 SOL
10 SOL
$ solana balance DYw8jCTfwHNRJhhmFcbXvVDTqWMEVFBX6ZKUmG5CNSKK --url https://devnet.solana.com # 检查钱包余额
$ solana balance DYw8jCTfwHNRJhhmFcbXvVDTqWMEVFBX6ZKUmG5CNSKK --url https://api.devnet.solana.com # 检查钱包余额
10 SOL
$ solana-keygen new --no-outfile # 创建第二个钱包即纸钱包
@ -95,13 +95,13 @@ pubkey: 7S3P4HxJpyyigGzodYwHtCxZyUQe9JiBMHyRWXArAaKv # 这是
clump panic cousin hurt coast charge engage fall eager urge win love # 如果这是一个真实的钱包,切记不要将这次单词分享到网络上!
====================================================================
$ solana transfer --from my_solana_wallet.json 7S3P4HxJpyyigGzodYwHtCxZyUQe9JiBMHyRWXArAaKv 5 --url https://devnet.solana.com --fee-payer my_solana_wallet.json # 发送代币到纸钱包的公钥地址
$ solana transfer --from my_solana_wallet.json 7S3P4HxJpyyigGzodYwHtCxZyUQe9JiBMHyRWXArAaKv 5 --url https://api.devnet.solana.com --fee-payer my_solana_wallet.json # 发送代币到纸钱包的公钥地址
3gmXvykAd1nCQQ7MjosaHLf69Xyaqyq1qw2eu1mgPyYXd5G4v1rihhg1CiRw35b9fHzcftGKKEu4mbUeXY2pEX2z # 该笔交易的签名
$ solana balance DYw8jCTfwHNRJhhmFcbXvVDTqWMEVFBX6ZKUmG5CNSKK --url https://devnet.solana.com
$ solana balance DYw8jCTfwHNRJhhmFcbXvVDTqWMEVFBX6ZKUmG5CNSKK --url https://api.devnet.solana.com
4.999995 SOL # 由于需要 0.000005 SOL 的交易费用,发送金额要稍微小于 5 SOL
$ solana balance 7S3P4HxJpyyigGzodYwHtCxZyUQe9JiBMHyRWXArAaKv --url https://devnet.solana.com
$ solana balance 7S3P4HxJpyyigGzodYwHtCxZyUQe9JiBMHyRWXArAaKv --url https://api.devnet.solana.com
5 SOL # 第二个钱包现在已经接收到第一个钱包发送的 5 SOL
```

View File

@ -6,11 +6,11 @@ Solana 维护专用的 API 节点来完成 [JSON RPC](developing/clients/jsonrpc
## Devnet开发者网络
- `https://devnet.solana.com` - 单个 Solana 托管的 api 节点;限定频率
- `https://api.devnet.solana.com` - 单个 Solana 托管的 api 节点;限定频率
## Testnet测试网
- `https://testnet.solana.com` - 单个 Solana 托管的 api 节点;限定频率
- `https://api.testnet.solana.com` - 单个 Solana 托管的 api 节点;限定频率
## Mainnet Beta主网 Beta

View File

@ -26,12 +26,12 @@ Solana维护着几个不同用途的集群。
```bash
export SOLANA_METRICS_CONFIG="host=https://metrics.solana.com:8086,db=devnet,u=scratch_writer,p=topsecret"
```
- Devnet RPC URL`https://devnet.solana.com`
- Devnet RPC URL`https://api.devnet.solana.com`
##### 示例 `solana` 命令行配置
```bash
solana config set --url https://devnet.solana.com
solana config set --url https://api.devnet.solana.com
```
##### 示例 `solana-validator` 命令行
@ -66,12 +66,12 @@ $ solana-validator \
```bash
export SOLANA_METRICS_CONFIG="host=https://metrics.solana.com:8086,db=tds,u=testnet_write,p=c4fa841aa918bf8274e3e2a44d77568d9861b3ea"
```
- Testnet 的 RPC URL: `https://testnet.solana.com`
- Testnet 的 RPC URL: `https://api.testnet.solana.com`
##### 示例 `solana` 命令行配置
```bash
solana config set --url https://testnet.solana.com
solana config set --url https://api.testnet.solana.com
```
##### 示例 `solana-validator` 命令行

View File

@ -156,7 +156,7 @@ FLAGS:
OPTIONS:
-d, --data_dir <PATH> Directory to store install data [default: .../Library/Application Support/solana]
-u, --url <URL> JSON RPC URL for the solana cluster [default: http://devnet.solana.com]
-u, --url <URL> JSON RPC URL for the solana cluster [default: http://api.devnet.solana.com]
-p, --pubkey <PUBKEY> Public key of the update manifest [default: 9XX329sPuskWhH4DQh6k16c87dHKhXLBZTL3Gxmve8Gp]
```

View File

@ -32,11 +32,11 @@ solana vote-account ~/vote-account-keypair.json
```bash
与solana-gossip相似您应该在集群节点列表中看到您的验证节点
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","id":1, "method":"getClusterNodes"}' http://devnet.solana.com
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","id":1, "method":"getClusterNodes"}' http://api.devnet.solana.com
# 如果您的验证节点进行了正确的投票,那么它应该出现在“当前”投票帐户列表中。 如果已经质押,那么`stake` 应当为 > 0
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","id":1, "method":"getVoteAccounts"}' http://devnet.solana.com
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","id":1, "method":"getVoteAccounts"}' http://api.devnet.solana.com
# 返回当前的领导者安排表
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","id":1, "method":"getLeaderSchedule"}' http://devnet.solana.com
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","id":1, "method":"getLeaderSchedule"}' http://api.devnet.solana.com
# 返回当前 epoch 的信息 slotIndex 应该在随后的调用中获得进展。
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","id":1, "method":"getEpochInfo"}' http://devnet.solana.com
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","id":1, "method":"getEpochInfo"}' http://api.devnet.solana.com
```

View File

@ -7,7 +7,7 @@ title: 启动验证程序
Solana cli包含`get``set`配置命令可自动为cli命令设置`--url`参数。 例如:
```bash
solana config set --url http://devnet.solana.com
solana config set --url http://api.devnet.solana.com
```
尽管本节演示了如何连接到Devnet群集但其他的[Solana群集](../clusters.md)步骤与此类似。
@ -166,7 +166,7 @@ solana config set --keypair ~/validator-keypair.json
```text
Wallet Config Updated: /home/solana/.config/solana/wallet/config.yml
* url: http://devnet.solana.com
* url: http://api.devnet.solana.com
* keypair: /home/solana/validator-keypair.json
```

View File

@ -21,7 +21,7 @@ cluster.
For example to target the Devnet cluster, run:
```bash
solana config set --url https://devnet.solana.com
solana config set --url https://api.devnet.solana.com
```
## Ensure Versions Match

View File

@ -27,7 +27,7 @@ on devnet have **no** value, so don't worry if you lose them.
First, _airdrop_ yourself some play tokens on the devnet.
```bash
solana airdrop 1 <RECIPIENT_ACCOUNT_ADDRESS> --url https://devnet.solana.com
solana airdrop 1 <RECIPIENT_ACCOUNT_ADDRESS> --url https://api.devnet.solana.com
```
where you replace the text `<RECIPIENT_ACCOUNT_ADDRESS>` with your base58-encoded
@ -39,7 +39,7 @@ Confirm the airdrop was successful by checking the account's balance.
It should output `1 SOL`:
```bash
solana balance <ACCOUNT_ADDRESS> --url https://devnet.solana.com
solana balance <ACCOUNT_ADDRESS> --url https://api.devnet.solana.com
```
#### Create a second wallet address
@ -71,7 +71,7 @@ with the private keypair corresponding to the sender's public key in the
transaction.
```bash
solana transfer --from <KEYPAIR> <RECIPIENT_ACCOUNT_ADDRESS> 0.5 --allow-unfunded-recipient --url https://devnet.solana.com --fee-payer <KEYPAIR>
solana transfer --from <KEYPAIR> <RECIPIENT_ACCOUNT_ADDRESS> 0.5 --allow-unfunded-recipient --url https://api.devnet.solana.com --fee-payer <KEYPAIR>
```
where you replace `<KEYPAIR>` with the path to a keypair in your first wallet,
@ -81,7 +81,7 @@ wallet.
Confirm the updated balances with `solana balance`:
```bash
solana balance <ACCOUNT_ADDRESS> --url http://devnet.solana.com
solana balance <ACCOUNT_ADDRESS> --url http://api.devnet.solana.com
```
where `<ACCOUNT_ADDRESS>` is either the public key from your keypair or the
@ -101,11 +101,11 @@ Save this seed phrase to recover your new keypair:
width enhance concert vacant ketchup eternal spy craft spy guard tag punch # If this was a real wallet, never share these words on the internet like this!
==========================================================================
$ solana airdrop 1 DYw8jCTfwHNRJhhmFcbXvVDTqWMEVFBX6ZKUmG5CNSKK --url https://devnet.solana.com # Airdropping 1 SOL to my wallet's address/pubkey
$ solana airdrop 1 DYw8jCTfwHNRJhhmFcbXvVDTqWMEVFBX6ZKUmG5CNSKK --url https://api.devnet.solana.com # Airdropping 1 SOL to my wallet's address/pubkey
Requesting airdrop of 1 SOL from 35.233.193.70:9900
1 SOL
$ solana balance DYw8jCTfwHNRJhhmFcbXvVDTqWMEVFBX6ZKUmG5CNSKK --url https://devnet.solana.com # Check the address's balance
$ solana balance DYw8jCTfwHNRJhhmFcbXvVDTqWMEVFBX6ZKUmG5CNSKK --url https://api.devnet.solana.com # Check the address's balance
1 SOL
$ solana-keygen new --no-outfile # Creating a second wallet, a paper wallet
@ -118,13 +118,13 @@ Save this seed phrase to recover your new keypair:
clump panic cousin hurt coast charge engage fall eager urge win love # If this was a real wallet, never share these words on the internet like this!
====================================================================
$ solana transfer --from my_solana_wallet.json 7S3P4HxJpyyigGzodYwHtCxZyUQe9JiBMHyRWXArAaKv 0.5 --allow-unfunded-recipient --url https://devnet.solana.com --fee-payer my_solana_wallet.json # Transferring tokens to the public address of the paper wallet
$ solana transfer --from my_solana_wallet.json 7S3P4HxJpyyigGzodYwHtCxZyUQe9JiBMHyRWXArAaKv 0.5 --allow-unfunded-recipient --url https://api.devnet.solana.com --fee-payer my_solana_wallet.json # Transferring tokens to the public address of the paper wallet
3gmXvykAd1nCQQ7MjosaHLf69Xyaqyq1qw2eu1mgPyYXd5G4v1rihhg1CiRw35b9fHzcftGKKEu4mbUeXY2pEX2z # This is the transaction signature
$ solana balance DYw8jCTfwHNRJhhmFcbXvVDTqWMEVFBX6ZKUmG5CNSKK --url https://devnet.solana.com
$ solana balance DYw8jCTfwHNRJhhmFcbXvVDTqWMEVFBX6ZKUmG5CNSKK --url https://api.devnet.solana.com
0.499995 SOL # The sending account has slightly less than 0.5 SOL remaining due to the 0.000005 SOL transaction fee payment
$ solana balance 7S3P4HxJpyyigGzodYwHtCxZyUQe9JiBMHyRWXArAaKv --url https://devnet.solana.com
$ solana balance 7S3P4HxJpyyigGzodYwHtCxZyUQe9JiBMHyRWXArAaKv --url https://api.devnet.solana.com
0.5 SOL # The second wallet has now received the 0.5 SOL transfer from the first wallet
```

View File

@ -156,7 +156,7 @@ FLAGS:
OPTIONS:
-d, --data_dir <PATH> Directory to store install data [default: .../Library/Application Support/solana]
-u, --url <URL> JSON RPC URL for the solana cluster [default: http://devnet.solana.com]
-u, --url <URL> JSON RPC URL for the solana cluster [default: http://api.devnet.solana.com]
-p, --pubkey <PUBKEY> Public key of the update manifest [default: 9XX329sPuskWhH4DQh6k16c87dHKhXLBZTL3Gxmve8Gp]
```

View File

@ -37,11 +37,11 @@ cluster, as well as the health of the cluster:
```bash
# Similar to solana-gossip, you should see your validator in the list of cluster nodes
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","id":1, "method":"getClusterNodes"}' http://devnet.solana.com
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","id":1, "method":"getClusterNodes"}' http://api.devnet.solana.com
# If your validator is properly voting, it should appear in the list of `current` vote accounts. If staked, `stake` should be > 0
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","id":1, "method":"getVoteAccounts"}' http://devnet.solana.com
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","id":1, "method":"getVoteAccounts"}' http://api.devnet.solana.com
# Returns the current leader schedule
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","id":1, "method":"getLeaderSchedule"}' http://devnet.solana.com
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","id":1, "method":"getLeaderSchedule"}' http://api.devnet.solana.com
# Returns info about the current epoch. slotIndex should progress on subsequent calls.
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","id":1, "method":"getEpochInfo"}' http://devnet.solana.com
curl -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","id":1, "method":"getEpochInfo"}' http://api.devnet.solana.com
```

View File

@ -8,7 +8,7 @@ The solana cli includes `get` and `set` configuration commands to automatically
set the `--url` argument for cli commands. For example:
```bash
solana config set --url http://devnet.solana.com
solana config set --url http://api.devnet.solana.com
```
While this section demonstrates how to connect to the Devnet cluster, the steps
@ -208,7 +208,7 @@ You should see the following output:
```text
Wallet Config Updated: /home/solana/.config/solana/wallet/config.yml
* url: http://devnet.solana.com
* url: http://api.devnet.solana.com
* keypair: /home/solana/validator-keypair.json
```

View File

@ -1,4 +1,4 @@
pub const JSON_RPC_URL: &str = "http://devnet.solana.com";
pub const JSON_RPC_URL: &str = "http://api.devnet.solana.com";
lazy_static! {
pub static ref CONFIG_FILE: Option<String> = {

View File

@ -46,7 +46,7 @@ esac
case $URL in
stable)
URL=http://devnet.solana.com
URL=http://api.devnet.solana.com
;;
localhost)
URL=http://localhost:8899

View File

@ -149,7 +149,7 @@ where
.global(true)
.takes_value(true)
.value_name("URL")
.help("RPC entrypoint address. i.e. http://devnet.solana.com"),
.help("RPC entrypoint address. i.e. http://api.devnet.solana.com"),
)
.subcommand(
SubCommand::with_name("new")

View File

@ -29,7 +29,7 @@ if [[ -n "$1" ]]; then
fi
if [[ -z "$url" ]]; then
echo Provide complete URL, ex: "$0" http://devnet.solana.com:8899
echo Provide complete URL, ex: "$0" http://api.devnet.solana.com:8899
exit 1
fi
solana config set --url $url

View File

@ -37,7 +37,7 @@ where
.global(true)
.takes_value(true)
.value_name("URL")
.help("RPC entrypoint address. i.e. http://devnet.solana.com"),
.help("RPC entrypoint address. i.e. http://api.devnet.solana.com"),
)
.subcommand(
SubCommand::with_name("distribute-tokens")

View File

@ -5,13 +5,13 @@
*/
const endpoint = {
http: {
devnet: 'http://devnet.solana.com',
testnet: 'http://testnet.solana.com',
devnet: 'http://api.devnet.solana.com',
testnet: 'http://api.testnet.solana.com',
'mainnet-beta': 'http://api.mainnet-beta.solana.com',
},
https: {
devnet: 'https://devnet.solana.com',
testnet: 'https://testnet.solana.com',
devnet: 'https://api.devnet.solana.com',
testnet: 'https://api.testnet.solana.com',
'mainnet-beta': 'https://api.mainnet-beta.solana.com',
},
};

View File

@ -13,9 +13,13 @@ describe('Cluster Util', () => {
});
it('devnet', () => {
expect(clusterApiUrl()).to.eq('https://devnet.solana.com');
expect(clusterApiUrl('devnet')).to.eq('https://devnet.solana.com');
expect(clusterApiUrl('devnet', true)).to.eq('https://devnet.solana.com');
expect(clusterApiUrl('devnet', false)).to.eq('http://devnet.solana.com');
expect(clusterApiUrl()).to.eq('https://api.devnet.solana.com');
expect(clusterApiUrl('devnet')).to.eq('https://api.devnet.solana.com');
expect(clusterApiUrl('devnet', true)).to.eq(
'https://api.devnet.solana.com',
);
expect(clusterApiUrl('devnet', false)).to.eq(
'http://api.devnet.solana.com',
);
});
});