मुख्य सामग्री पर जाएं
Scripts, CI/CD jobs, या किसी भी backend से Virtual Environments बनाने के लिए REST API का उपयोग करें। वही endpoints dashboard को back करते हैं। पूर्ण request और response schemas के लिए, देखें REST API reference

शुरू करने से पहले

  • एक Tenderly access key। इसे अपने shell में TENDERLY_ACCESS_KEY के रूप में export करें।
  • आपके account और project slugs, जो आपके Tenderly Dashboard के URL में उपलब्ध हैं।
export TENDERLY_ACCESS_KEY=# the key you copied

एक single-network Virtual Environment बनाएं

1
API कॉल करें
2
अपनी fork और chain configuration के साथ vnets endpoint पर POST करें:
3
RESPONSE=$(curl --request POST \
  --url https://api.tenderly.co/api/v1/account/me/project/project/vnets \
  --header 'Accept: application/json' \
  --header 'Content-Type: application/json' \
  --header "X-Access-Key: ${TENDERLY_ACCESS_KEY}" \
  --data '{
    "slug": "my-staging-testnet-25",
    "display_name": "My Staging TestNet",
    "fork_config":            { "network_id": 1, "block_number": "latest" },
    "virtual_network_config": { "chain_config": { "chain_id": 73571 } },
    "sync_state_config":      { "enabled": false, "commitment_level": "latest" },
    "explorer_page_config":   { "enabled": false, "verification_visibility": "bytecode" }
  }')
4
Admin RPC URL निकालें
5
response पर rpcs array में Admin और Public RPC URLs होते हैं। अपनी बाकी script के लिए Admin RPC को बाहर निकालें:
6
ADMIN_RPC=$(echo $RESPONSE | jq -r '.rpcs[] | select(.name == "Admin RPC") | .url')

एक Multichain Virtual Environment बनाएं

एक Multichain Virtual Environment multivnets endpoint के माध्यम से एक ही call में बनाया जाता है। कॉल में सभी networks एक stack_id के तहत समूहीकृत होते हैं, जो उनके बीच cross-chain bridging संभव बनाता है।
multivnet-create.sh
curl --location 'https://api.tenderly.co/api/v1/account/me/project/project/multivnets' \
  --header 'accept: application/json, text/plain, */*' \
  --header "X-Access-Key: ${TENDERLY_ACCESS_KEY}" \
  --header 'content-type: application/json' \
  --data '{
    "vnets": [
      {
        "slug": "mainnet-staging",
        "fork_config":            { "network_id": 1,     "block_number": "latest" },
        "virtual_network_config": { "chain_config": { "chain_id": 1 } }
      },
      {
        "slug": "arbitrum-staging",
        "fork_config":            { "network_id": 42161, "block_number": "latest" },
        "virtual_network_config": { "chain_config": { "chain_id": 42161 } }
      },
      {
        "slug": "base-staging",
        "fork_config":            { "network_id": 8453,  "block_number": "latest" },
        "virtual_network_config": { "chain_config": { "chain_id": 8453 } }
      }
    ]
  }'
vnets array में प्रत्येक entry Multichain Virtual Environment के अंदर एक network बनाता है। response एक stack_id और Virtual Environment objects का एक array लौटाता है, जिनमें से प्रत्येक के अपने RPC endpoints होते हैं। Field-by-field schema के लिए REST API reference देखें।

अगले कदम