Skip to content

Commit

Permalink
feat(nft-list): unify interface for amount as other nft-index chains
Browse files Browse the repository at this point in the history
  • Loading branch information
imsk17 committed Oct 4, 2024
1 parent 4aeda34 commit 5013c59
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 7 deletions.
6 changes: 4 additions & 2 deletions src/handlers/icp/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,12 @@ export async function icpHandler({
return {
tokenId: tid.toString(),
uri: metadata,
native: md,
native: {
amount: 1n,
md,
},
collectionIdent: contract,
type: "NFT",
amount: 1n,
} as const;
}),
);
Expand Down
2 changes: 1 addition & 1 deletion src/handlers/icp/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,4 +52,4 @@ export type TICPHandler = TSingularNftChain<
string
> &
ReadClaimed721Event &
TNFTList<[string, Value][], null>;
TNFTList<{ md: [string, Value][] }, null>;
4 changes: 2 additions & 2 deletions src/handlers/secret/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,10 +60,10 @@ export function secretHandler({
uri: tokenInfo.all_nft_info.info?.token_uri || "",
tokenId: token,
type: "NFT",
amount: 1n,
native: {
contract: contract,
contractHash: ea.codeHash || "",
amount: 1n,
tokenId: token,
viewingKey: ea.viewingKey,
metadata: tokenInfo.all_nft_info.info?.token_uri || "",
Expand Down Expand Up @@ -118,12 +118,12 @@ export function secretHandler({
tokenInfo.token_id_private_info.token_id_info.public_metadata
.token_uri || "",
tokenId: token.token_id,
amount: BigInt(token.amount),
type: "SFT",
native: {
contract: contract,
contractHash: ea.codeHash || "",
tokenId: token,
amount: BigInt(token.amount),
viewingKey: ea.viewingKey,
metadata:
tokenInfo.token_id_private_info.token_id_info.public_metadata
Expand Down
5 changes: 3 additions & 2 deletions src/handlers/types/chain.ts
Original file line number Diff line number Diff line change
Expand Up @@ -379,10 +379,11 @@ export type TNFTList<NFT, EA> = {
};

export type TokenInfo<RawTokenInfo> = {
readonly native: RawTokenInfo;
readonly native: {
amount: bigint;
} & RawTokenInfo;
readonly uri: string;
readonly collectionIdent: string;
readonly tokenId: string;
readonly type: "NFT" | "SFT";
readonly amount: bigint;
};

0 comments on commit 5013c59

Please sign in to comment.