Skip to content

Commit

Permalink
update provider optional, fix type bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
KidSysco committed Dec 23, 2024
1 parent 4f0b501 commit 3194ae9
Showing 1 changed file with 4 additions and 37 deletions.
41 changes: 4 additions & 37 deletions src/types/useEvmNft.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Ref } from 'vue';
import { ethers } from 'ethers';
import { NftMetaData } from './useNftStore';
import { Nft, NftMetaData } from './useNftStore';

/**
* Composable for interacting with EVM-based NFT contracts.
Expand All @@ -16,7 +16,7 @@ import { NftMetaData } from './useNftStore';
*/
export declare function useEvmNft(
pageSize: number,
provider: ethers.JsonRpcProvider,
provider: ethers.JsonRpcProvider | null,
holderPublicKey: string | null,
contractOwnerPublicKey: string,
contractAddress: string,
Expand All @@ -34,51 +34,18 @@ export declare function useEvmNft(
page: number,
isAscending: boolean
) => Promise<{
tokens: Array<{
tokenId: number;
metaData: NftMetaData | null;
metaDataUrl: string;
owner: string | null;
privateData: object | null;
}>;
tokens: Nft[];
pageSize: number;
count: number;
}>;

/**
* Fetches metadata for a batch of token IDs.
*
* @param batchedTokenIds - Array of objects with `tokenId` and `owner` properties.
* @param isAscending - Whether to sort metadata in ascending order.
* @returns Promise resolving to an array of tokens with metadata and owner information.
*/
getMetaDataBatch: (
batchedTokenIds: Array<{ tokenId: number; owner: string | null }>,
isAscending: boolean
) => Promise<
Array<{
tokenId: number;
metaDataUrl: string;
metaData: NftMetaData | null;
privateData: object | null;
owner: string | null;
}>
>;

/**
* Fetches metadata for a list of token IDs.
*
* @param tokenIds - Array of token IDs.
* @returns Promise resolving to an array of token objects with metadata.
*/
getTokenMetaData: (tokenIds: number[]) => Promise<
Array<{
tokenId: number;
metaDataUrl: string;
metaData: NftMetaData | null;
privateData: object | null;
}>
>;
getTokenMetaData: (tokenIds: number[]) => Promise<Nft[]>;

/**
* Fetches the owner of a specific token.
Expand Down

0 comments on commit 3194ae9

Please sign in to comment.