Skip to content

Commit

Permalink
Add getNftEditions Method (#77)
Browse files Browse the repository at this point in the history
  • Loading branch information
0xIchigo authored Apr 4, 2024
1 parent b36bb6a commit 78d1cbc
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 1 deletion.
27 changes: 26 additions & 1 deletion src/RpcClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,32 @@ export class RpcClient {
}
}

/**
/**
* Get information about all the edition NFTs for a specific master NFT
* @returns {Promise<DAS.GetNftEditionsResponse>}
* @throws {Error}
*/
async getNftEditions(
params: DAS.GetNftEditionsRequest
): Promise<DAS.GetNftEditionsResponse> {
try {
const url = `${this.connection.rpcEndpoint}`;
const response = await axios.post(url, {
jsonrpc:"2.0",
id: this.id,
method: "getNftEditions",
params: params,
}, {
headers: { "Content-Type": "application/json" },
});

return response.data.result as DAS.GetNftEditionsResponse;
} catch (error) {
throw new Error(`Error in getNftEditions: ${error}`);
}
}

/**
* Get information about all token accounts for a specific mint or a specific owner
* @returns {Promise<DAS.GetTokenAccountsResponse>}
* @throws {Error}
Expand Down
23 changes: 23 additions & 0 deletions src/types/das-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,29 @@ export interface SearchAssetsRequest {
seq: number;
leaf_id: number;
}

// Get NFT Editions
export interface Editions {
mint?: string;
edition_address?: string;
edition?: number;
}

export interface GetNftEditionsRequest {
mint?: string;
page?: number;
limit?: number;
}

export interface GetNftEditionsResponse {
total?: number;
limit?: number;
page?: number;
master_edition_address?: string;
supply?: number;
max_supply?: number;
editions?: Editions[];
}

// Get Token Accounts
export interface TokenAccounts {
Expand Down

0 comments on commit 78d1cbc

Please sign in to comment.