@paulstinchcombe/kami721c-sdk
Version:
SDK for interacting with KAMI721C NFT contracts
219 lines (218 loc) • 7.96 kB
TypeScript
import { ContractRunner } from 'ethers';
/**
* Royalty data structure
*/
export interface RoyaltyData {
receiver: string;
feeNumerator: bigint;
}
/**
* KAMI721C contract wrapper class
*/
export declare class KAMI721C {
private contract;
/**
* Creates a new instance of the KAMI721C contract wrapper
* @param runner An ethers.js ContractRunner (Provider or Signer)
* @param contractAddress The address of the KAMI721C contract
*/
constructor(runner: ContractRunner, contractAddress: string);
/**
* Connect a signer to the contract
* @param signer The signer to connect
* @returns A new instance of the KAMI721C contract with the connected signer
*/
connect(signer: ContractRunner): KAMI721C;
/**
* Get the contract address
* @returns The contract address
*/
getAddress(): string;
/**
* Get the contract name
* @returns The name of the NFT collection
*/
name(): Promise<string>;
/**
* Get the contract symbol
* @returns The symbol of the NFT collection
*/
symbol(): Promise<string>;
/**
* Get the total supply of tokens
* @returns The total number of tokens minted
*/
totalSupply(): Promise<bigint>;
/**
* Get the token URI for a specific token ID
* @param tokenId The ID of the token to query
* @returns The token URI
*/
tokenURI(tokenId: number | bigint): Promise<string>;
/**
* Get the owner of a specific token
* @param tokenId The ID of the token to query
* @returns The address of the token owner
*/
ownerOf(tokenId: number | bigint): Promise<string>;
/**
* Get the balance of an address
* @param owner The address to query
* @returns The number of tokens owned by the address
*/
balanceOf(owner: string): Promise<bigint>;
/**
* Get the current mint price
* @returns The mint price in USDC (with 6 decimals)
*/
mintPrice(): Promise<bigint>;
/**
* Set the mint price (requires OWNER_ROLE)
* @param newMintPrice The new mint price in USDC (with 6 decimals)
* @returns The transaction
*/
setMintPrice(newMintPrice: bigint | string): Promise<any>;
/**
* Mint a new token (requires USDC approval)
* @returns The transaction
*/
mint(): Promise<any>;
/**
* Set royalties for all newly minted tokens (requires OWNER_ROLE)
* @param royalties Array of royalty receivers and fee numerators
* @returns The transaction
*/
setMintRoyalties(royalties: RoyaltyData[]): Promise<any>;
/**
* Set royalties for a specific token's mint event (requires OWNER_ROLE)
* @param tokenId The ID of the token to set royalties for
* @param royalties Array of royalty receivers and fee numerators
* @returns The transaction
*/
setTokenMintRoyalties(tokenId: number | bigint, royalties: RoyaltyData[]): Promise<any>;
/**
* Set global transfer royalties for all tokens (requires OWNER_ROLE)
* @param royalties Array of royalty receivers and fee numerators
* @returns The transaction
*/
setTransferRoyalties(royalties: RoyaltyData[]): Promise<any>;
/**
* Set transfer royalties for a specific token (requires OWNER_ROLE)
* @param tokenId The ID of the token to set royalties for
* @param royalties Array of royalty receivers and fee numerators
* @returns The transaction
*/
setTokenTransferRoyalties(tokenId: number | bigint, royalties: RoyaltyData[]): Promise<any>;
/**
* Get the current royalty percentage for transfers
* @returns The royalty percentage in basis points (e.g., 1000 = 10%)
*/
royaltyPercentage(): Promise<number>;
/**
* Set the royalty percentage for transfers (requires OWNER_ROLE)
* @param newRoyaltyPercentage New royalty percentage in basis points (e.g., 1000 = 10%)
* @returns The transaction
*/
setRoyaltyPercentage(newRoyaltyPercentage: number): Promise<any>;
/**
* Get the platform commission details
* @returns The platform commission percentage and address
*/
getPlatformCommission(): Promise<{
percentage: number;
address: string;
}>;
/**
* Set the platform commission details (requires OWNER_ROLE)
* @param newPercentage New commission percentage in basis points (e.g., 500 = 5%)
* @param newAddress New platform address to receive commission
* @returns The transaction
*/
setPlatformCommission(newPercentage: number, newAddress: string): Promise<any>;
/**
* Sell a token to another address with royalties handled automatically
* @param to The buyer address
* @param tokenId The token ID to sell
* @param salePrice The sale price in USDC
* @returns The transaction
*/
sellToken(to: string, tokenId: number | bigint, salePrice: bigint | string): Promise<any>;
/**
* Get royalty information for a token sale
* @param tokenId The ID of the token being sold
* @param salePrice The sale price
* @returns The royalty receiver address and amount
*/
royaltyInfo(tokenId: number | bigint, salePrice: bigint | string): Promise<{
receiver: string;
royaltyAmount: bigint;
}>;
/**
* Get mint royalty receivers for a token
* @param tokenId The ID of the token
* @returns Array of royalty data
*/
getMintRoyaltyReceivers(tokenId: number | bigint): Promise<RoyaltyData[]>;
/**
* Get transfer royalty receivers for a token
* @param tokenId The ID of the token
* @returns Array of royalty data
*/
getTransferRoyaltyReceivers(tokenId: number | bigint): Promise<RoyaltyData[]>;
/**
* Check if an address has a specific role
* @param role The role to check (OWNER_ROLE, PLATFORM_ROLE, or RENTER_ROLE)
* @param address The address to check
* @returns True if the address has the role
*/
hasRole(role: string, address: string): Promise<boolean>;
/**
* Grant a role to an address (requires DEFAULT_ADMIN_ROLE)
* @param role The role to grant (OWNER_ROLE, PLATFORM_ROLE, or RENTER_ROLE)
* @param address The address to grant the role to
* @returns The transaction
*/
grantRole(role: string, address: string): Promise<any>;
/**
* Revoke a role from an address (requires DEFAULT_ADMIN_ROLE)
* @param role The role to revoke (OWNER_ROLE, PLATFORM_ROLE, or RENTER_ROLE)
* @param address The address to revoke the role from
* @returns The transaction
*/
revokeRole(role: string, address: string): Promise<any>;
/**
* Get the OWNER_ROLE constant
* @returns The OWNER_ROLE bytes32 value
*/
OWNER_ROLE(): Promise<string>;
/**
* Get the PLATFORM_ROLE constant
* @returns The PLATFORM_ROLE bytes32 value
*/
PLATFORM_ROLE(): Promise<string>;
/**
* Get the RENTER_ROLE constant
* @returns The RENTER_ROLE bytes32 value
*/
RENTER_ROLE(): Promise<string>;
/**
* Set the base URI for tokens (requires OWNER_ROLE)
* @param baseURI The new base URI
* @returns The transaction
*/
setBaseURI(baseURI: string): Promise<any>;
/**
* Burn a token (requires token owner permission)
* @param tokenId The ID of the token to burn
* @returns The transaction
*/
burn(tokenId: number | bigint): Promise<any>;
/**
* Set the security policy for the contract (requires OWNER_ROLE)
* @param securityLevel The security level
* @param operatorWhitelistId The operator whitelist ID
* @param permittedContractReceiversAllowlistId The permitted contract receivers allowlist ID
* @returns The transaction
*/
setSecurityPolicy(securityLevel: number, operatorWhitelistId: number, permittedContractReceiversAllowlistId: number): Promise<any>;
}