UNPKG

kamiweb3-sdk

Version:

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

299 lines 14 kB
import { Contract, BigNumberish, BytesLike } from 'ethers'; import { RoyaltyData, SignerOrProvider, RentalDetails } from '../types'; /** * Wraps an instance of the KAMI1155C contract (standard or upgradeable proxy) to provide typed methods. */ export declare class KAMI1155CWrapper { readonly contract: Contract; readonly address: string; readonly abi: any; /** * Creates an instance of KAMI1155CWrapper. * @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 KAMI1155C ABI. Provide the KAMI1155CUpgradeable ABI when attaching to a proxy. */ constructor(address: string, signerOrProvider: SignerOrProvider, contractAbi?: any); /** * Gets the balance of a specific token ID for an account. * @param account The address of the account. * @param id The ID of the token. * @returns A promise that resolves to the balance. */ balanceOf(account: string, id: BigNumberish): Promise<bigint>; /** * Gets the balances of multiple token IDs for multiple accounts. * @param accounts An array of account addresses. * @param ids An array of token IDs. * @returns A promise that resolves to an array of balances. */ balanceOfBatch(accounts: string[], ids: BigNumberish[]): Promise<bigint[]>; /** * Safely transfers tokens from one address to another. * Requires the caller to be the owner, approved, or the approved operator. * @param from The address to transfer from. * @param to The address to transfer to. * @param id The ID of the token to transfer. * @param amount The amount of tokens to transfer. * @param data Additional data with no specified format. * @param overrides Optional transaction overrides. * @returns A promise that resolves to the transaction response. */ safeTransferFrom(from: string, to: string, id: BigNumberish, amount: BigNumberish, data: BytesLike, overrides?: any): Promise<any>; /** * Safely transfers multiple token types from one address to another. * Requires the caller to be the owner, approved, or the approved operator. * @param from The address to transfer from. * @param to The address to transfer to. * @param ids An array of token IDs to transfer. * @param amounts An array of amounts corresponding to each token ID. * @param data Additional data with no specified format. * @param overrides Optional transaction overrides. * @returns A promise that resolves to the transaction response. */ safeBatchTransferFrom(from: string, to: string, ids: BigNumberish[], amounts: BigNumberish[], data: BytesLike, overrides?: any): Promise<any>; /** * Enables or disables approval for a third party ("operator") to manage all of the caller's tokens. * @param operator Address to add to the set of authorized operators. * @param approved True if the operator is approved, false to revoke approval. * @param overrides Optional transaction overrides. * @returns A promise that resolves to the transaction response. */ setApprovalForAll(operator: string, approved: boolean, overrides?: any): Promise<any>; /** * Queries the approval status of an operator for a given owner. * @param owner The owner of the tokens. * @param operator The address of the operator. * @returns True if the operator is approved, false otherwise. */ isApprovedForAll(owner: string, operator: string): Promise<boolean>; /** * Returns the URI for a given token ID. * @param id The ID of the token. * @returns A promise that resolves to the URI string. */ uri(id: BigNumberish): Promise<string>; /** * Returns the next token ID to be minted. * @returns A promise that resolves to the next token ID. */ nextTokenId(): Promise<bigint>; supportsInterface(interfaceId: BytesLike): Promise<boolean>; /** * Mint tokens to the caller. (Matches contract: mint(uint256 amount)) */ mint(amount: BigNumberish, overrides?: any): Promise<any>; /** * Mint batches of tokens to the caller. (Matches contract: mintBatch(uint256[] amounts)) */ mintBatch(amounts: BigNumberish[], overrides?: any): Promise<any>; /** * Sells tokens from the owner to a buyer. * Requires the seller (signer) to own or be approved for the tokens. * Requires the buyer to have approved the contract to spend the salePrice in USDC. * @param to The address of the buyer. * @param id The ID of the token being sold. * @param amount The amount of tokens being sold. * @param salePrice The price in USDC for the tokens. * @param overrides Optional transaction overrides. * @returns A promise that resolves to the transaction response. */ sellToken(to: string, id: BigNumberish, amount: BigNumberish, salePrice: BigNumberish, overrides?: any): Promise<any>; /** * Rents tokens for a specified duration and price. * Requires the renter to have approved the contract to spend the rentalPrice in USDC. * @param id The ID of the token to rent. * @param duration The duration of the rental in seconds. * @param rentalPrice The price in USDC for the rental. * @param overrides Optional transaction overrides. * @returns A promise that resolves to the transaction response. */ rentToken(id: BigNumberish, duration: BigNumberish, rentalPrice: BigNumberish, overrides?: any): Promise<any>; /** * Ends a rental for a token. * Can only be called by the renter or after the rental period has expired. * @param id 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(id: BigNumberish, overrides?: any): Promise<any>; /** * Extends a rental for a token with additional duration and payment. * Can only be called by the current renter. * @param id 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(id: BigNumberish, additionalDuration: BigNumberish, additionalPayment: BigNumberish, overrides?: any): Promise<any>; /** * Gets rental details for a specific token. * @param id The ID of the token to get rental details for. * @returns A promise that resolves to the rental details. */ getRentalDetails(id: BigNumberish): Promise<RentalDetails>; /** * Checks if a user has active rentals. * @param user The address to check for active rentals. * @returns A promise that resolves to true if the user has active rentals, false otherwise. */ hasActiveRentals(user: string): Promise<boolean>; /** * Sets mint royalties for the contract. * @param royalties Array of RoyaltyData objects. * @param overrides Optional transaction overrides. * @returns A promise that resolves to the transaction response. */ setMintRoyalties(royalties: RoyaltyData[], overrides?: any): Promise<any>; /** * Sets transfer royalties for the contract. * @param royalties Array of RoyaltyData objects. * @param overrides Optional transaction overrides. * @returns A promise that resolves to the transaction response. */ setTransferRoyalties(royalties: RoyaltyData[], overrides?: any): Promise<any>; /** * Sets mint royalties for a specific token. * @param id The ID of the token to set royalties for. * @param royalties Array of RoyaltyData objects. * @param overrides Optional transaction overrides. * @returns A promise that resolves to the transaction response. */ setTokenMintRoyalties(id: BigNumberish, royalties: RoyaltyData[], overrides?: any): Promise<any>; /** * Sets transfer royalties for a specific token. * @param id The ID of the token to set royalties for. * @param royalties Array of RoyaltyData objects. * @param overrides Optional transaction overrides. * @returns A promise that resolves to the transaction response. */ setTokenTransferRoyalties(id: BigNumberish, royalties: RoyaltyData[], overrides?: any): Promise<any>; /** * Gets mint royalty receivers for a token. * @param id The ID of the token to get royalty receivers for. * @returns A promise that resolves to an array of RoyaltyData objects. */ getMintRoyaltyReceivers(id: BigNumberish): Promise<RoyaltyData[]>; /** * Gets transfer royalty receivers for a token. * @param id The ID of the token to get royalty receivers for. * @returns A promise that resolves to an array of RoyaltyData objects. */ getTransferRoyaltyReceivers(id: BigNumberish): Promise<RoyaltyData[]>; /** * Sets the mint price for the contract. * @param newMintPrice The new mint price in USDC. * @param overrides Optional transaction overrides. * @returns A promise that resolves to the transaction response. */ setMintPrice(newMintPrice: BigNumberish, overrides?: any): Promise<any>; /** * Gets the current mint price. * @returns A promise that resolves to 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. * @param overrides Optional transaction overrides. * @returns A promise that resolves to the transaction response. */ setPlatformCommission(newPercentage: BigNumberish, newPlatformAddress: string, overrides?: any): Promise<any>; /** * Gets the platform address. * @returns A promise that resolves to the platform address. */ getPlatformAddress(): Promise<string>; /** * Gets the platform commission percentage. * @returns A promise that resolves to the platform commission percentage in basis points. */ getPlatformCommissionPercentage(): Promise<bigint>; /** * Sets the base URI for token metadata. * @param baseURI The new base URI. * @param overrides Optional transaction overrides. * @returns A promise that resolves to the transaction response. */ setBaseURI(baseURI: string, overrides?: any): Promise<any>; /** * Gets the base URI for token metadata. * @returns A promise that resolves to the base URI. */ getBaseURI(): Promise<string>; /** * Pauses the contract. * @param overrides Optional transaction overrides. * @returns A promise that resolves to the transaction response. */ pause(overrides?: any): Promise<any>; /** * Checks if the contract is paused. * @returns A promise that resolves to true if the contract is paused, false otherwise. */ paused(): Promise<boolean>; /** * Unpauses the contract. * @param overrides Optional transaction overrides. * @returns A promise that resolves to the transaction response. */ unpause(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 A promise that resolves to 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 A promise that resolves to 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. * @param overrides Optional transaction overrides. * @returns A promise that resolves to the transaction response. */ 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. * @param overrides Optional transaction overrides. * @returns A promise that resolves to the transaction response. */ revokeRole(role: BytesLike, account: string, overrides?: any): Promise<any>; /** * Renounces a role from the caller. * @param role The role to renounce. * @param account The account to renounce the role from. * @param overrides Optional transaction overrides. * @returns A promise that resolves to the transaction response. */ renounceRole(role: BytesLike, account: string, 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 KAMI1155CWrapper instance. */ connect(signerOrProvider: SignerOrProvider): KAMI1155CWrapper; } //# sourceMappingURL=KAMI1155CWrapper.d.ts.map