概述
主版本 NFT 可以打印带编号的副本,每个副本都有自己的 mint。getNftEditions 列出某个主版本 mint 的这些印刷版,同时返回主版本的当前供应量和最大供应量。
参数
页码,从 1 开始。请参阅分页。
响应
代码示例
请求
curl https://fra.rpc.orbitflare.com?api_key=YOUR-API-KEY -X POST -H "Content-Type: application/json" -d '{
"jsonrpc": "2.0",
"id": 1,
"method": "getNftEditions",
"params": {
"mint": "MASTER_EDITION_MINT",
"page": 1,
"limit": 100
}
}'
响应结构
{
"jsonrpc": "2.0",
"result": {
"total": 2,
"limit": 100,
"page": 1,
"master_edition_address": "MASTER_EDITION_ACCOUNT",
"supply": 2,
"max_supply": 10,
"editions": [
{ "mint": "PRINT_MINT_1", "edition_address": "PRINT_EDITION_ACCOUNT_1", "edition": 1 },
{ "mint": "PRINT_MINT_2", "edition_address": "PRINT_EDITION_ACCOUNT_2", "edition": 2 }
]
},
"id": 1
}
TypeScript
const RPC_URL = 'https://fra.rpc.orbitflare.com?api_key=YOUR-API-KEY';
async function getNftEditions(mint: string, page = 1) {
const response = await fetch(RPC_URL, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify({
jsonrpc: '2.0',
id: 1,
method: 'getNftEditions',
params: { mint, page, limit: 1000 },
}),
});
const { result, error } = await response.json();
if (error) throw new Error(error.message);
console.log(`${result.supply} of ${result.max_supply ?? 'unlimited'} printed`);
return result.editions;
}
Rust
使用 OrbitFlare Rust SDK:use orbitflare_sdk::das::GetNftEditions;
let editions = client
.get_nft_editions(&GetNftEditions::new("MASTER_EDITION_MINT").page(1).limit(1000))
.await?;
match editions.max_supply {
Some(max) => println!("{} of {max} printed", editions.supply),
None => println!("{} printed, no maximum", editions.supply),
}
for edition in &editions.editions {
println!("#{} {}", edition.edition, edition.mint);
}
常见错误
| 错误码 | 消息 | 解决方案 |
|---|---|---|
| -32602 | Pubkey Validation Err: … is invalid | 传入有效的 base-58 mint |
| -32602 | Pagination Error. Limit should not be greater than 1000. | 使用不超过 1,000 的 limit |
| -32000 | Edition data not found | 该 mint 不是主版本,或尚未被索引 |