import { providers } from "ethers" ; import { AppInstanceJson } from "./app" ; import { Address , Bytes32 } from "./basic" ; import { ConditionalTransactionCommitmentJSON , MinimalTransaction , SetStateCommitmentJSON , } from "./commitments" ; import { ChallengeUpdatedEventPayload , StateProgressedEventPayload , } from "./contracts" ; import { StateChannelJSON } from "./state" ; import { StoredAppChallenge } from "./watcher" ; export const ConnextNodeStorePrefix = "INDRA_NODE_CF_CORE" ; export const ConnextClientStorePrefix = "INDRA_CLIENT_CF_CORE" ; export type StorePair = { path : string ; value : any ; } ; export interface IBackupService { restore ( ) : Promise < StorePair [ ] > ; backup ( pair ) : Promise < void > ; } export type WithdrawalMonitorObject = { retry : number ; tx : MinimalTransaction ; withdrawalTx : string ; } ; export const STORE_SCHEMA_VERSION = 1 ; export interface IStoreService { init ( ) : Promise < void > ; clear ( ) : Promise < void > ; close ( ) : Promise < void > ; restore ( ) : Promise < void > ; getFreeBalance ( multisigAddress ) : Promise < AppInstanceJson | undefined > ; getLatestProcessedBlock ( ) : Promise < number > ; addOnchainAction ( appIdentityHash , provider ) : Promise < void > ; updateLatestProcessedBlock ( blockNumber ) : Promise < void > ; updateNumProposedApps ( multisigAddress , numProposedApps , stateChannel ? ) : Promise < void > ; getActiveChallenges ( ) : Promise < StoredAppChallenge [ ] > ; getAppChallenge ( appIdentityHash ) : Promise < StoredAppChallenge | undefined > ; saveAppChallenge ( data ) : Promise < void > ; createChallengeUpdatedEvent ( event ) : Promise < void > ; createStateProgressedEvent ( event ) : Promise < void > ; getChallengeUpdatedEvents ( appIdentityHash ) : Promise < ChallengeUpdatedEventPayload [ ] > ; getStateProgressedEvents ( appIdentityHash ) : Promise < StateProgressedEventPayload [ ] > ; createAppInstance ( multisigAddress , appInstance , freeBalanceAppInstance , signedFreeBalanceUpdate , stateChannel ? ) : Promise < void > ; getAppInstance ( appIdentityHash ) : Promise < AppInstanceJson | undefined > ; updateAppInstance ( multisigAddress , appInstance , signedSetStateCommitment , stateChannel ? ) : Promise < void > ; removeAppInstance ( multisigAddress , appInstance , freeBalanceAppInstance , signedFreeBalanceUpdate , stateChannel ? ) : Promise < void > ; createAppProposal ( multisigAddress , appProposal , numProposedApps , signedSetStateCommitment , signedConditionalTxCommitment , stateChannel ? ) : Promise < void > ; getAppProposal ( appIdentityHash ) : Promise < AppInstanceJson | undefined > ; removeAppProposal ( multisigAddress , appIdentityHash , stateChannel ? ) : Promise < void > ; getConditionalTransactionCommitment ( appIdentityHash ) : Promise < ConditionalTransactionCommitmentJSON | undefined > ; getSetStateCommitments ( appIdentityHash ) : Promise < SetStateCommitmentJSON [ ] > ; getSetupCommitment ( multisigAddress ) : Promise < MinimalTransaction | undefined > ; getSchemaVersion ( ) : Promise < number > ; updateSchemaVersion ( version ? ) : Promise < void > ; getStateChannel ( multisigAddress ) : Promise < StateChannelJSON | undefined > ; getStateChannelByAppIdentityHash ( appIdentityHash ) : Promise < StateChannelJSON | undefined > ; getStateChannelByOwnersAndChainId ( owners , chainId ) : Promise < StateChannelJSON | undefined > ; getAllChannels ( ) : Promise < StateChannelJSON [ ] > ; createStateChannel ( stateChannel , signedSetupCommitment , signedFreeBalanceUpdate ) : Promise < void > ; saveUserWithdrawal ( withdrawalObject ) : Promise < void > ; getUserWithdrawals ( ) : Promise < WithdrawalMonitorObject [ ] > ; removeUserWithdrawal ( toRemove ) : Promise < void > ; }