import { ResultAsync } from "neverthrow"; import { ActiveStateChannel } from "../ActiveStateChannel"; import { Balances } from "../Balances"; import { BigNumberString } from "../BigNumberString"; import { ChainId } from "../ChainId"; import { AcceptPaymentError, BalancesUnavailableError, BlockchainUnavailableError, InsufficientBalanceError, PersistenceError, VectorError, GatewayValidationError, GatewayConnectorError, InvalidParametersError, ProxyError, GatewayAuthorizationDeniedError, RegistryFactoryContractError, NonFungibleRegistryContractError, InvalidPaymentError, GatewayActivationError, InvalidPaymentIdError, TransferResolutionError, TransferCreationError, PaymentStakeError, PaymentCreationError, InactiveGatewayError, CoreInitializationErrors } from "../errors"; import { EthereumAccountAddress } from "../EthereumAccountAddress"; import { EthereumContractAddress } from "../EthereumContractAddress"; import { GatewayRegistrationFilter } from "../GatewayRegistrationFilter"; import { GatewayRegistrationInfo } from "../GatewayRegistrationInfo"; import { GatewayTokenInfo } from "../GatewayTokenInfo"; import { GatewayUrl } from "../GatewayUrl"; import { HypernetLink } from "../HypernetLink"; import { Payment } from "../Payment"; import { PaymentId } from "../PaymentId"; import { PublicIdentifier } from "../PublicIdentifier"; import { Signature } from "../Signature"; import { TokenInformation } from "../TokenInformation"; import { InitializeStatus } from "../InitializeStatus"; export interface IHypernetPayments { paymentsInitialized(chainId?: ChainId): ResultAsync; waitPaymentsInitialized(chainId?: ChainId): ResultAsync; initializePayments(chainId?: ChainId): ResultAsync; /** * Gets the public id of the Hypernet Core user account. If the core is not initialized, * it will throw an error * @dev currently this matches the Vector pubId */ getPublicIdentifier(): ResultAsync; /** * Returns a list of active state channels. * Basically a list of routers with which you are connected. */ getActiveStateChannels(): ResultAsync; /** * Creates a state channel with any of a list of routers on a particular chain. * You can create a state channel with any router you like; however, if you * create it with a router none of your authorized gateways can use, it's of * very limited use. * @param routerPublicIdentifiers * @param chainId */ createStateChannel(routerPublicIdentifiers: PublicIdentifier[], chainId: ChainId): ResultAsync; /** * This function will load HypernetCore with funds. It should be called for each type of asset you want to use. * Can be called by either party (provider or consumer); internally, deposits into the router channel. * @param channelAddress The address of the state channel * @param assetAddress The Ethereum address of the token you want to deposit. These can be ETH, HyperToken, Dai, or any othe supported payment token. * @param amount The amount of funds (in wei) that you are depositing * @dev this creates a transaction on the blockchain! */ depositFunds(channelAddress: EthereumContractAddress, assetAddress: EthereumContractAddress, amount: BigNumberString): ResultAsync; /** * This function will withdraw funds from Hypernet core into a specified Ethereum address. * @param assetAddress * @param amount * @param destinationAddress */ withdrawFunds(channelAddress: EthereumContractAddress, assetAddress: EthereumContractAddress, amount: BigNumberString, destinationAddress: EthereumAccountAddress): ResultAsync; /** * Returns the balance account, including funds within * the general channel, and funds locked inside transfers within the channel. */ getBalances(): ResultAsync; /** * Returns all Hypernet Ledger for the user */ getLinks(): ResultAsync; /** * Returns all active Hypernet Ledgers for the user * An active link contains an incomplete/non-finalized transfer. */ getActiveLinks(): ResultAsync; /** * For a specified payment, puts up stake to accept the payment * @param paymentId the payment ID to accept funds */ acceptOffer(paymentId: PaymentId): ResultAsync; /** * Pulls an incremental amount from an authorized payment * @param paymentId: The authorized payment ID to pull from. * @param amount: The amount to pull. The token type has already been baked in. */ pullFunds(paymentId: PaymentId, amount: BigNumberString): ResultAsync; /** * Finalized an authorized payment with the final payment amount. * @param paymentId the payment ID to finalize * @param finalAmount the total payment amount to pull */ finalizePullPayment(paymentId: PaymentId, finalAmount: BigNumberString): Promise; /** * This method is used to force the system to take a very, very close * look at a particular payment. It will also notify the gateway * and send all the payment details to the gateway. The gateway may * be able to fix the payment- for instance, if the payment is stuck * in Approved waiting for the gateway to release the insurance, and * the gateway doesn't know about the payment * @param paymentId */ repairPayments(paymentIds: PaymentId[]): ResultAsync; /** * Only used for development purposes! * @param amount */ mintTestToken(amount: BigNumberString): ResultAsync; authorizeGateway(gatewayUrl: GatewayUrl): ResultAsync; deauthorizeGateway(gatewayUrl: GatewayUrl): ResultAsync; getAuthorizedGateways(): ResultAsync, PersistenceError | VectorError | BlockchainUnavailableError | ProxyError>; getAuthorizedGatewaysConnectorsStatus(): ResultAsync, PersistenceError | VectorError | BlockchainUnavailableError | ProxyError>; /** * Returns the token info for each requested gateway. * This is useful for figuring out if you want to create a state channel * @param gatewayUrls the list of gatways URLs that you are interested in */ getGatewayTokenInfo(gatewayUrls: GatewayUrl[]): ResultAsync, ProxyError | PersistenceError | GatewayAuthorizationDeniedError | BalancesUnavailableError | BlockchainUnavailableError | GatewayActivationError | VectorError | GatewayValidationError | NonFungibleRegistryContractError | InactiveGatewayError | RegistryFactoryContractError>; /** * Returns the requested gateway registration info. * This allows you to search for gateways. * @param filter optional; this will filter the gateway results */ getGatewayRegistrationInfo(filter?: GatewayRegistrationFilter): ResultAsync; /** * Returns a map of all gateways from the gateway registry */ getGatewayEntryList(): ResultAsync, NonFungibleRegistryContractError | RegistryFactoryContractError | ProxyError>; getTokenInformation(): ResultAsync; getTokenInformationForChain(chainId: ChainId): ResultAsync; getTokenInformationByAddress(tokenAddress: EthereumContractAddress): ResultAsync; closeGatewayIFrame(gatewayUrl: GatewayUrl): ResultAsync; displayGatewayIFrame(gatewayUrl: GatewayUrl): ResultAsync; } //# sourceMappingURL=IHypernetPayments.d.ts.map