UNPKG

kamiweb3-sdk

Version:

TypeScript SDK for KAMI721-C, KAMI721-AC, and KAMI1155-C smart contracts

315 lines 13.4 kB
import { Contract, BigNumberish, BytesLike } from 'ethers'; import { RoyaltyData, SignerOrProvider, RoyaltyInfo, RentalDetails } from '../types'; /** * Wraps an instance of the KAMI721AC contract (standard or upgradeable proxy) to provide typed methods. */ export declare class KAMI721ACWrapper { readonly contract: Contract; readonly address: string; readonly abi: any; /** * Creates an instance of KAMI721ACWrapper. * @param address The address of the standard contract or the proxy contract. * @param signerOrProvider A Signer (for transactions) or Provider (for read-only). * @param contractAbi (Optional) The ABI to use. Defaults to the standard KAMI721AC ABI. Provide the KAMI721ACUpgradeable ABI when attaching to a proxy. */ constructor(address: string, signerOrProvider: SignerOrProvider, contractAbi?: any); /** * Returns the number of tokens in `owner`'s account. * @throws {Error} If owner is the zero address. */ balanceOf(owner: string): Promise<bigint>; /** * Returns the owner of the `tokenId` token. * @throws {Error} If the token does not exist. */ ownerOf(tokenId: BigNumberish): Promise<string>; /** * Safely transfers `tokenId` token from `from` to `to`. * @throws {Error} If caller is not owner nor approved, or if `to` is zero address. */ safeTransferFrom(from: string, to: string, tokenId: BigNumberish, data?: BytesLike, overrides?: any): Promise<any>; /** * Transfers `tokenId` token from `from` to `to`. * Note: Usage of this method is discouraged, use `safeTransferFrom` whenever possible. * @throws {Error} If caller is not owner nor approved, or if `to` is zero address. */ transferFrom(from: string, to: string, tokenId: BigNumberish, overrides?: any): Promise<any>; /** * Gives permission to `to` to transfer `tokenId` token to another account. * The approval is cleared when the token is transferred. * @throws {Error} If `to` is the zero address. */ approve(to: string, tokenId: BigNumberish, overrides?: any): Promise<any>; /** * Returns the account approved for `tokenId` token. * @throws {Error} If the token does not exist. */ getApproved(tokenId: BigNumberish): Promise<string>; /** * Approve or remove `operator` as an operator for the caller. Operators can call transferFrom or safeTransferFrom for any token owned by the caller. */ setApprovalForAll(operator: string, approved: boolean, overrides?: any): Promise<any>; /** * Returns if the `operator` is allowed to manage all of the assets of `owner`. */ isApprovedForAll(owner: string, operator: string): Promise<boolean>; /** * Returns the token collection name. */ name(): Promise<string>; /** * Returns the token collection symbol. */ symbol(): Promise<string>; /** * Returns the Uniform Resource Identifier (URI) for `tokenId` token. * @throws {Error} If the token does not exist. */ tokenURI(tokenId: BigNumberish): Promise<string>; /** * Returns the total amount of tokens minted in the contract. * (ERC721A provides this) */ totalSupply(): Promise<bigint>; /** * Returns the next token ID to be minted. * Note: This function is not available in KAMI721AC contracts. * @returns The next token ID. * @throws {Error} This function is not available in KAMI721AC contracts. */ nextTokenId(): Promise<bigint>; /** * Checks if an address has already claimed tokens. * @param user The address to check. * @returns A promise that resolves to true if the user has claimed, false otherwise. */ hasClaimed(user: string): Promise<boolean>; /** * Rents a token for a specified duration and price. * @param tokenId The ID of the token to rent. * @param duration The duration of the rental in seconds. * @param rentalPrice The price for the rental. * @param overrides Optional transaction overrides. * @returns A promise that resolves to the transaction response. */ rentToken(tokenId: BigNumberish, duration: BigNumberish, rentalPrice: BigNumberish, overrides?: any): Promise<any>; /** * Ends a rental for a token. * @param tokenId The ID of the token to end the rental for. * @param overrides Optional transaction overrides. * @returns A promise that resolves to the transaction response. */ endRental(tokenId: BigNumberish, overrides?: any): Promise<any>; /** * Extends a rental for a token with additional duration and payment. * @param tokenId The ID of the token to extend the rental for. * @param additionalDuration The additional duration in seconds. * @param additionalPayment The additional payment in USDC. * @param overrides Optional transaction overrides. * @returns A promise that resolves to the transaction response. */ extendRental(tokenId: BigNumberish, additionalDuration: BigNumberish, additionalPayment: BigNumberish, overrides?: any): Promise<any>; /** * Gets rental details for a specific token. * @param tokenId The ID of the token to get rental details for. * @returns A promise that resolves to the rental details. */ getRentalDetails(tokenId: BigNumberish): Promise<RentalDetails>; /** * Checks if a user has active rentals. * @param user The address to check for active rentals. * @returns True if the user has active rentals, false otherwise. */ hasActiveRentals(user: string): Promise<boolean>; /** * Returns royalty information for a given token and sale price. * @param tokenId The token ID to get royalty information for. * @param salePrice The sale price to calculate royalties for. * @returns RoyaltyInfo object containing receiver address and royalty amount. */ royaltyInfo(tokenId: BigNumberish, salePrice: BigNumberish): Promise<RoyaltyInfo>; /** * Claims tokens for the caller. * @param overrides Optional transaction overrides. * @returns A promise that resolves to the transaction response. */ claim(overrides?: any): Promise<any>; /** * Claims tokens for multiple recipients in a batch. * @param recipients Array of recipient addresses. * @param overrides Optional transaction overrides. * @returns A promise that resolves to the transaction response. */ batchClaim(recipients: string[], overrides?: any): Promise<any>; /** * Claims tokens for multiple recipients in a batch (alternative method). * @param recipients Array of recipient addresses. * @param overrides Optional transaction overrides. * @returns A promise that resolves to the transaction response. */ batchClaimFor(recipients: string[], overrides?: any): Promise<any>; /** * Sells a token to a buyer for a specified price. * @param to The address to sell the token to. * @param tokenId The ID of the token to sell. * @param salePrice The price to sell the token for. * @throws {Error} If caller is not owner nor approved, or if buyer doesn't have sufficient USDC. */ sellToken(to: string, tokenId: BigNumberish, salePrice: BigNumberish, overrides?: any): Promise<any>; /** * Sets mint royalties for the contract. * @param royalties Array of RoyaltyData objects. * @throws {Error} If caller doesn't have OWNER_ROLE. */ setMintRoyalties(royalties: RoyaltyData[], overrides?: any): Promise<any>; /** * Sets transfer royalties for the contract. * @param royalties Array of RoyaltyData objects. * @throws {Error} If caller doesn't have OWNER_ROLE. */ setTransferRoyalties(royalties: RoyaltyData[], overrides?: any): Promise<any>; /** * Sets mint royalties for a specific token. * @param tokenId The ID of the token to set royalties for. * @param royalties Array of RoyaltyData objects. * @throws {Error} If caller doesn't have OWNER_ROLE. */ setTokenMintRoyalties(tokenId: BigNumberish, royalties: RoyaltyData[], overrides?: any): Promise<any>; /** * Sets transfer royalties for a specific token. * @param tokenId The ID of the token to set royalties for. * @param royalties Array of RoyaltyData objects. * @throws {Error} If caller doesn't have OWNER_ROLE. */ setTokenTransferRoyalties(tokenId: BigNumberish, royalties: RoyaltyData[], overrides?: any): Promise<any>; /** * Gets mint royalty receivers for a token. * @param tokenId The ID of the token to get royalty receivers for. * @returns Array of RoyaltyData objects. */ getMintRoyaltyReceivers(tokenId: BigNumberish): Promise<RoyaltyData[]>; /** * Gets transfer royalty receivers for a token. * @param tokenId The ID of the token to get royalty receivers for. * @returns Array of RoyaltyData objects. */ getTransferRoyaltyReceivers(tokenId: BigNumberish): Promise<RoyaltyData[]>; /** * Sets the mint price for the contract. * @param newMintPrice The new mint price in USDC. * @throws {Error} If caller doesn't have OWNER_ROLE. */ setMintPrice(newMintPrice: BigNumberish, overrides?: any): Promise<any>; /** * Gets the current mint price. * @returns The current mint price in USDC. */ getMintPrice(): Promise<bigint>; /** * Sets the platform commission percentage and address. * @param newPercentage The new commission percentage in basis points. * @param newPlatformAddress The new platform address. * @throws {Error} If caller doesn't have OWNER_ROLE. */ setPlatformCommission(newPercentage: BigNumberish, newPlatformAddress: string, overrides?: any): Promise<any>; /** * Gets the platform address. * @returns The platform address. */ getPlatformAddress(): Promise<string>; /** * Gets the platform commission percentage. * @returns The platform commission percentage in basis points. */ getPlatformCommissionPercentage(): Promise<bigint>; /** * Sets the base URI for token metadata. * @param baseURI The new base URI. * @throws {Error} If caller doesn't have OWNER_ROLE. */ setBaseURI(baseURI: string, overrides?: any): Promise<any>; /** * Gets the base URI for token metadata. * @returns The base URI. */ getBaseURI(): Promise<string>; /** * Gets the USDC token address. * @returns The USDC token address. */ usdc(): Promise<string>; /** * Pauses the contract. * @throws {Error} If caller doesn't have PAUSER_ROLE. */ pause(overrides?: any): Promise<any>; /** * Checks if the contract is paused. * @returns True if the contract is paused, false otherwise. */ paused(): Promise<boolean>; /** * Unpauses the contract. * @throws {Error} If caller doesn't have PAUSER_ROLE. */ unpause(overrides?: any): Promise<any>; /** * Burns a token. * @param tokenId The ID of the token to burn. * @throws {Error} If caller is not owner nor approved. */ burn(tokenId: BigNumberish, overrides?: any): Promise<any>; /** * Checks if an account has a specific role. * @param role The role to check. * @param account The account to check. * @returns True if the account has the role, false otherwise. */ hasRole(role: BytesLike, account: string): Promise<boolean>; /** * Gets the admin role for a specific role. * @param role The role to get the admin for. * @returns The admin role. */ getRoleAdmin(role: BytesLike): Promise<string>; /** * Grants a role to an account. * @param role The role to grant. * @param account The account to grant the role to. * @throws {Error} If caller doesn't have the admin role. */ grantRole(role: BytesLike, account: string, overrides?: any): Promise<any>; /** * Revokes a role from an account. * @param role The role to revoke. * @param account The account to revoke the role from. * @throws {Error} If caller doesn't have the admin role. */ revokeRole(role: BytesLike, account: string, overrides?: any): Promise<any>; /** * Renounces a role from the caller. * @param role The role to renounce. * @throws {Error} If caller doesn't have the role. */ renounceRole(role: BytesLike, overrides?: any): Promise<any>; /** * Requires that the current signerOrProvider is a Signer. * @throws {Error} If the current signerOrProvider is not a Signer. */ private requireSigner; /** * Requires that the caller has a specific role. * @param role The role to check. * @param errorMessage The error message to throw if the caller doesn't have the role. * @throws {Error} If the caller doesn't have the role. */ private requireRole; /** * Creates a new wrapper instance connected to a different signer or provider. * @param signerOrProvider The new signer or provider to connect to. * @returns A new KAMI721ACWrapper instance. */ connect(signerOrProvider: SignerOrProvider): KAMI721ACWrapper; } //# sourceMappingURL=KAMI721ACWrapper.d.ts.map