UNPKG

@gotake/gotake-sdk

Version:

SDK for interacting with GoTake blockchain contracts

207 lines 9.05 kB
import { ethers } from 'ethers'; import { Provider } from '@ethersproject/providers'; import type { VideoPaymentStorage } from 'gotake-contracts/dist/typechain/contracts/VideoPayment'; import { BaseTransactionWrapper } from './base-transaction-wrapper'; import { TransactionOptions } from '../types'; /** * Wrapper for VideoPayment contract, providing purchase and content management functionality * Uses TypeChain generated types for full type safety */ export declare class VideoPaymentWrapper extends BaseTransactionWrapper { private _videoPayment; /** * Create VideoPayment wrapper instance * @param provider Provider instance * @param signer Signer instance */ constructor(provider: Provider, signer: ethers.Signer); /** * Get VideoPayment contract instance * @returns VideoPayment contract instance */ private getVideoPayment; /** * Purchase content with native currency (ETH) * @param contentId Content ID to purchase * @param options Transaction options * @returns Transaction result */ purchaseWithNative(contentId: number, options?: TransactionOptions): Promise<ethers.ContractTransaction>; /** * Purchase content with ERC20 token * @param contentId Content ID to purchase * @param paymentToken ERC20 token address * @param amount Token amount to pay * @param options Transaction options * @returns Transaction result */ purchaseContent(contentId: number, paymentToken: string, amount: ethers.BigNumber, options?: TransactionOptions): Promise<ethers.ContractTransaction>; /** * Batch purchase multiple content with native currency (ETH) * @param contentIds Array of content IDs to purchase * @param options Transaction options * @returns Transaction result */ batchPurchaseWithNative(contentIds: number[], options?: TransactionOptions): Promise<ethers.ContractTransaction>; /** * Batch update native prices for multiple content (Admin only) * @param contentIds Array of content IDs * @param prices Array of new prices in wei * @param options Transaction options * @returns Transaction result */ batchUpdateNativePrice(contentIds: number[], prices: ethers.BigNumber[], options?: TransactionOptions): Promise<ethers.ContractTransaction>; /** * Batch update token prices for multiple content (Admin only) * @param contentIds Array of content IDs * @param token Token address * @param prices Array of new prices * @param options Transaction options * @returns Transaction result */ batchUpdateTokenPrice(contentIds: number[], token: string, prices: ethers.BigNumber[], options?: TransactionOptions): Promise<ethers.ContractTransaction>; /** * Batch consume views for multiple users and content (Admin only) * @param users Array of user addresses * @param contentIds Array of content IDs * @param options Transaction options * @returns Transaction result */ batchConsumeView(users: string[], contentIds: number[], options?: TransactionOptions): Promise<ethers.ContractTransaction>; /** * Batch purchase multiple content with ERC20 token * @param contentIds Array of content IDs to purchase * @param paymentToken ERC20 token address * @param totalAmount Total token amount to pay * @param options Transaction options * @returns Transaction result */ batchPurchase(contentIds: number[], paymentToken: string, totalAmount: ethers.BigNumber, options?: TransactionOptions): Promise<ethers.ContractTransaction>; /** * Check if user has view permission for content * @param user User address * @param contentId Content ID * @returns True if user has valid view permission */ hasViewPermission(user: string, contentId: number): Promise<boolean>; /** * Get detailed permission information for user and content * @param user User address * @param contentId Content ID * @returns View permission details */ getPermissionDetails(user: string, contentId: number): Promise<VideoPaymentStorage.ViewPermissionStructOutput>; /** * Get user permissions for multiple content items * @param user User address * @param contentIds Array of content IDs * @returns Array of view permission details */ getUserPermissions(user: string, contentIds: number[]): Promise<VideoPaymentStorage.ViewPermissionStructOutput[]>; /** * Check if content is active * @param contentId Content ID * @returns True if content is active */ isContentActive(contentId: number): Promise<boolean>; /** * Check if token is supported * @param tokenAddress Token address * @returns True if token is supported */ isSupportedToken(tokenAddress: string): Promise<boolean>; /** * Consume a view for user (Admin only) * @param user User address * @param contentId Content ID * @param options Transaction options * @returns Transaction result */ consumeView(user: string, contentId: number, options?: TransactionOptions): Promise<ethers.ContractTransaction>; /** * Set content configuration (Admin only) * @param contentId Content ID * @param nativePrice Native price in wei * @param defaultViewCount Default view count * @param viewDuration View duration in seconds * @param isActive Whether content is active * @param options Transaction options * @returns Transaction result */ setContentConfig(contentId: number, nativePrice: ethers.BigNumber, defaultViewCount: number, viewDuration: number, isActive: boolean, options?: TransactionOptions): Promise<ethers.ContractTransaction>; /** * Batch set content configurations (Admin only) * @param contentIds Array of content IDs * @param nativePrices Array of native prices in wei * @param defaultViewCounts Array of default view counts * @param viewDurations Array of view durations in seconds * @param isActiveArray Array of active statuses * @param options Transaction options * @returns Transaction result */ batchSetContentConfig(contentIds: number[], nativePrices: ethers.BigNumber[], defaultViewCounts: number[], viewDurations: number[], isActiveArray: boolean[], options?: TransactionOptions): Promise<ethers.ContractTransaction>; /** * Update native price for content (Admin only) * @param contentId Content ID * @param price New price in wei * @param options Transaction options * @returns Transaction result */ updateNativePrice(contentId: number, price: ethers.BigNumber, options?: TransactionOptions): Promise<ethers.ContractTransaction>; /** * Update token price for content (Admin only) * @param contentId Content ID * @param token Token address * @param price New price * @param options Transaction options * @returns Transaction result */ updateTokenPrice(contentId: number, token: string, price: ethers.BigNumber, options?: TransactionOptions): Promise<ethers.ContractTransaction>; /** * Add supported token (Owner only) * @param tokenAddress Token address to add * @param options Transaction options * @returns Transaction result */ addSupportedToken(tokenAddress: string, options?: TransactionOptions): Promise<ethers.ContractTransaction>; /** * Remove supported token (Owner only) * @param tokenAddress Token address to remove * @param options Transaction options * @returns Transaction result */ removeSupportedToken(tokenAddress: string, options?: TransactionOptions): Promise<ethers.ContractTransaction>; /** * Add admin (Owner only) * @param adminAddress Admin address to add * @param options Transaction options * @returns Transaction result */ addAdmin(adminAddress: string, options?: TransactionOptions): Promise<ethers.ContractTransaction>; /** * Remove admin (Owner only) * @param adminAddress Admin address to remove * @param options Transaction options * @returns Transaction result */ removeAdmin(adminAddress: string, options?: TransactionOptions): Promise<ethers.ContractTransaction>; /** * Pause contract (Owner only) * @param options Transaction options * @returns Transaction result */ pause(options?: TransactionOptions): Promise<ethers.ContractTransaction>; /** * Unpause contract (Owner only) * @param options Transaction options * @returns Transaction result */ unpause(options?: TransactionOptions): Promise<ethers.ContractTransaction>; /** * Update connection when provider or signer changes * @param provider New provider instance * @param signer New signer instance */ updateConnection(provider: Provider, signer: ethers.Signer): void; } //# sourceMappingURL=video-payment-wrapper.d.ts.map