slot-rpc

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Slot RPC

Slot RPC

Cartridge provides dedicated RPC endpoints for Starknet with authentication and CORS support.
Cartridge 为Starknet提供带有认证和CORS支持的专用RPC端点。

Endpoints

端点

  • Mainnet:
    https://api.cartridge.gg/x/starknet/mainnet
  • Sepolia:
    https://api.cartridge.gg/x/starknet/sepolia
  • 主网
    https://api.cartridge.gg/x/starknet/mainnet
  • Sepolia测试网
    https://api.cartridge.gg/x/starknet/sepolia

Pricing

定价

Free for up to 1M requests/month. Additional requests: $5/1M, charged to the team.
每月最多100万次请求免费。 超出部分:每100万次请求5美元,向团队收取费用。

Authentication Methods

认证方式

API Token

API令牌

bash
curl https://api.cartridge.gg/x/starknet/mainnet \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "starknet_chainId",
    "params": [],
    "id": 1
  }'
bash
curl https://api.cartridge.gg/x/starknet/mainnet \
  -H "Authorization: Bearer YOUR_API_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "jsonrpc": "2.0",
    "method": "starknet_chainId",
    "params": [],
    "id": 1
  }'

Domain Whitelisting

域名白名单

For browser apps, whitelist domains to make direct RPC calls without exposing tokens. Whitelisted domains are rate-limited per IP.
javascript
const response = await fetch('https://api.cartridge.gg/x/starknet/mainnet', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    jsonrpc: '2.0',
    method: 'starknet_chainId',
    params: [],
    id: 1,
  }),
});
对于浏览器应用,可将域名加入白名单,无需暴露令牌即可直接发起RPC调用。 白名单域名按IP进行速率限制。
javascript
const response = await fetch('https://api.cartridge.gg/x/starknet/mainnet', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    jsonrpc: '2.0',
    method: 'starknet_chainId',
    params: [],
    id: 1,
  }),
});

Managing API Tokens

管理API令牌

bash
undefined
bash
undefined

Create a token

创建令牌

slot rpc tokens create <KEY_NAME> --team <TEAM_NAME>
slot rpc tokens create <KEY_NAME> --team <TEAM_NAME>

List tokens

列出令牌

slot rpc tokens list --team <TEAM_NAME>
slot rpc tokens list --team <TEAM_NAME>

Delete a token

删除令牌

slot rpc tokens delete <KEY_ID> --team <TEAM_NAME>
undefined
slot rpc tokens delete <KEY_ID> --team <TEAM_NAME>
undefined

Managing CORS Whitelist

管理CORS白名单

Whitelists are specified as root domains; all subdomains are automatically included.
bash
undefined
白名单以根域名指定;所有子域名会自动包含在内。
bash
undefined

Add a domain

添加域名

slot rpc whitelist add <DOMAIN> --team <TEAM_NAME>
slot rpc whitelist add <DOMAIN> --team <TEAM_NAME>

List whitelisted domains

列出白名单域名

slot rpc whitelist list --team <TEAM_NAME>
slot rpc whitelist list --team <TEAM_NAME>

Remove a domain

移除域名

slot rpc whitelist remove <ENTRY_ID> --team <TEAM_NAME>
undefined
slot rpc whitelist remove <ENTRY_ID> --team <TEAM_NAME>
undefined

Viewing Logs

查看日志

bash
slot rpc logs --team <TEAM_NAME>
Options:
  • --after <CURSOR>
    : Pagination cursor
  • --limit <NUMBER>
    : Entries to return (default: 100)
  • --since <DURATION>
    : Time period (
    30m
    ,
    1h
    ,
    24h
    )
Examples:
bash
undefined
bash
slot rpc logs --team <TEAM_NAME>
选项:
  • --after <CURSOR>
    :分页游标
  • --limit <NUMBER>
    :返回条目数(默认:100)
  • --since <DURATION>
    :时间范围(
    30m
    ,
    1h
    ,
    24h
示例:
bash
undefined

Last 5 entries from past 30 minutes

过去30分钟内的最后5条条目

slot rpc logs --team my-team --limit 5 --since 30m
slot rpc logs --team my-team --limit 5 --since 30m

Paginate with cursor

使用游标分页

slot rpc logs --team my-team --after <cursor> --limit 5
undefined
slot rpc logs --team my-team --after <cursor> --limit 5
undefined