@connext/types
Advanced tools
Comparing version 7.3.8 to 7.3.9
@@ -384,23 +384,23 @@ this.window = this.window || {}; | ||
const ChallengeProgressedEvent = "ChallengeProgressedEvent"; | ||
const ChallengeProgressionFailedEvent = "ChallengeProgressionFailedEvent"; | ||
const ChallengeCompletedEvent = "ChallengeCompletedEvent"; | ||
const ChallengeCompletionFailedEvent = "ChallengeCompletionFailedEvent"; | ||
const ChallengeOutcomeSetEvent = "ChallengeOutcomeSetEvent"; | ||
const ChallengeOutcomeFailedEvent = "ChallengeOutcomeFailedEvent"; | ||
const ChallengeCancelledEvent = "ChallengeCancelledEvent"; | ||
const ChallengeCancellationFailedEvent = "ChallengeCancellationFailedEvent"; | ||
const ChallengeUpdatedEvent = "ChallengeUpdatedEvent"; | ||
const StateProgressedEvent = "StateProgressedEvent"; | ||
const CHALLENGE_PROGRESSED_EVENT = "CHALLENGE_PROGRESSED_EVENT"; | ||
const CHALLENGE_PROGRESSION_FAILED_EVENT = "CHALLENGE_PROGRESSION_FAILED_EVENT"; | ||
const CHALLENGE_COMPLETED_EVENT = "CHALLENGE_COMPLETED_EVENT"; | ||
const CHALLENGE_COMPLETION_FAILED_EVENT = "CHALLENGE_COMPLETION_FAILED_EVENT"; | ||
const CHALLENGE_OUTCOME_SET_EVENT = "CHALLENGE_OUTCOME_SET_EVENT"; | ||
const CHALLENGE_OUTCOME_FAILED_EVENT = "CHALLENGE_OUTCOME_FAILED_EVENT"; | ||
const CHALLENGE_CANCELLED_EVENT = "CHALLENGE_CANCELLED_EVENT"; | ||
const CHALLENGE_CANCELLATION_FAILED_EVENT = "CHALLENGE_CANCELLATION_FAILED_EVENT"; | ||
const CHALLENGE_UPDATED_EVENT = "CHALLENGE_UPDATED_EVENT"; | ||
const STATE_PROGRESSED_EVENT = "STATE_PROGRESSED_EVENT"; | ||
const WatcherEvents = { | ||
[ChallengeUpdatedEvent]: ChallengeUpdatedEvent, | ||
[StateProgressedEvent]: StateProgressedEvent, | ||
[ChallengeProgressedEvent]: ChallengeProgressedEvent, | ||
[ChallengeProgressionFailedEvent]: ChallengeProgressionFailedEvent, | ||
[ChallengeOutcomeSetEvent]: ChallengeOutcomeSetEvent, | ||
[ChallengeOutcomeFailedEvent]: ChallengeOutcomeFailedEvent, | ||
[ChallengeCompletedEvent]: ChallengeCompletedEvent, | ||
[ChallengeCompletionFailedEvent]: ChallengeCompletionFailedEvent, | ||
[ChallengeCancelledEvent]: ChallengeCancelledEvent, | ||
[ChallengeCancellationFailedEvent]: ChallengeCancellationFailedEvent, | ||
[CHALLENGE_UPDATED_EVENT]: CHALLENGE_UPDATED_EVENT, | ||
[STATE_PROGRESSED_EVENT]: STATE_PROGRESSED_EVENT, | ||
[CHALLENGE_PROGRESSED_EVENT]: CHALLENGE_PROGRESSED_EVENT, | ||
[CHALLENGE_PROGRESSION_FAILED_EVENT]: CHALLENGE_PROGRESSION_FAILED_EVENT, | ||
[CHALLENGE_OUTCOME_SET_EVENT]: CHALLENGE_OUTCOME_SET_EVENT, | ||
[CHALLENGE_OUTCOME_FAILED_EVENT]: CHALLENGE_OUTCOME_FAILED_EVENT, | ||
[CHALLENGE_COMPLETED_EVENT]: CHALLENGE_COMPLETED_EVENT, | ||
[CHALLENGE_COMPLETION_FAILED_EVENT]: CHALLENGE_COMPLETION_FAILED_EVENT, | ||
[CHALLENGE_CANCELLED_EVENT]: CHALLENGE_CANCELLED_EVENT, | ||
[CHALLENGE_CANCELLATION_FAILED_EVENT]: CHALLENGE_CANCELLATION_FAILED_EVENT, | ||
}; | ||
@@ -426,14 +426,14 @@ (function (StoredAppChallengeStatus) { | ||
exports.CF_METHOD_TIMEOUT = CF_METHOD_TIMEOUT; | ||
exports.CHALLENGE_CANCELLATION_FAILED_EVENT = CHALLENGE_CANCELLATION_FAILED_EVENT; | ||
exports.CHALLENGE_CANCELLED_EVENT = CHALLENGE_CANCELLED_EVENT; | ||
exports.CHALLENGE_COMPLETED_EVENT = CHALLENGE_COMPLETED_EVENT; | ||
exports.CHALLENGE_COMPLETION_FAILED_EVENT = CHALLENGE_COMPLETION_FAILED_EVENT; | ||
exports.CHALLENGE_OUTCOME_FAILED_EVENT = CHALLENGE_OUTCOME_FAILED_EVENT; | ||
exports.CHALLENGE_OUTCOME_SET_EVENT = CHALLENGE_OUTCOME_SET_EVENT; | ||
exports.CHALLENGE_PROGRESSED_EVENT = CHALLENGE_PROGRESSED_EVENT; | ||
exports.CHALLENGE_PROGRESSION_FAILED_EVENT = CHALLENGE_PROGRESSION_FAILED_EVENT; | ||
exports.CHALLENGE_UPDATED_EVENT = CHALLENGE_UPDATED_EVENT; | ||
exports.CHANNEL_PROTOCOL_VERSION = CHANNEL_PROTOCOL_VERSION; | ||
exports.CONVENTION_FOR_ETH_ASSET_ID = CONVENTION_FOR_ETH_ASSET_ID; | ||
exports.ChallengeCancellationFailedEvent = ChallengeCancellationFailedEvent; | ||
exports.ChallengeCancelledEvent = ChallengeCancelledEvent; | ||
exports.ChallengeCompletedEvent = ChallengeCompletedEvent; | ||
exports.ChallengeCompletionFailedEvent = ChallengeCompletionFailedEvent; | ||
exports.ChallengeEvents = ChallengeEvents; | ||
exports.ChallengeOutcomeFailedEvent = ChallengeOutcomeFailedEvent; | ||
exports.ChallengeOutcomeSetEvent = ChallengeOutcomeSetEvent; | ||
exports.ChallengeProgressedEvent = ChallengeProgressedEvent; | ||
exports.ChallengeProgressionFailedEvent = ChallengeProgressionFailedEvent; | ||
exports.ChallengeUpdatedEvent = ChallengeUpdatedEvent; | ||
exports.ChannelMethods = ChannelMethods; | ||
@@ -481,2 +481,3 @@ exports.CommitmentTarget = CommitmentTarget; | ||
exports.RequireOnlineApps = RequireOnlineApps; | ||
exports.STATE_PROGRESSED_EVENT = STATE_PROGRESSED_EVENT; | ||
exports.STORE_SCHEMA_VERSION = STORE_SCHEMA_VERSION; | ||
@@ -492,3 +493,2 @@ exports.SignedTransferStatus = SignedTransferStatus; | ||
exports.SimpleTwoPartySwapAppName = SimpleTwoPartySwapAppName; | ||
exports.StateProgressedEvent = StateProgressedEvent; | ||
exports.StateSchemaVersion = StateSchemaVersion; | ||
@@ -495,0 +495,0 @@ exports.SupportedApplicationNames = SupportedApplicationNames; |
@@ -386,23 +386,23 @@ import { providers, BigNumber as BigNumber$1, constants } from 'ethers'; | ||
const ChallengeProgressedEvent = "ChallengeProgressedEvent"; | ||
const ChallengeProgressionFailedEvent = "ChallengeProgressionFailedEvent"; | ||
const ChallengeCompletedEvent = "ChallengeCompletedEvent"; | ||
const ChallengeCompletionFailedEvent = "ChallengeCompletionFailedEvent"; | ||
const ChallengeOutcomeSetEvent = "ChallengeOutcomeSetEvent"; | ||
const ChallengeOutcomeFailedEvent = "ChallengeOutcomeFailedEvent"; | ||
const ChallengeCancelledEvent = "ChallengeCancelledEvent"; | ||
const ChallengeCancellationFailedEvent = "ChallengeCancellationFailedEvent"; | ||
const ChallengeUpdatedEvent = "ChallengeUpdatedEvent"; | ||
const StateProgressedEvent = "StateProgressedEvent"; | ||
const CHALLENGE_PROGRESSED_EVENT = "CHALLENGE_PROGRESSED_EVENT"; | ||
const CHALLENGE_PROGRESSION_FAILED_EVENT = "CHALLENGE_PROGRESSION_FAILED_EVENT"; | ||
const CHALLENGE_COMPLETED_EVENT = "CHALLENGE_COMPLETED_EVENT"; | ||
const CHALLENGE_COMPLETION_FAILED_EVENT = "CHALLENGE_COMPLETION_FAILED_EVENT"; | ||
const CHALLENGE_OUTCOME_SET_EVENT = "CHALLENGE_OUTCOME_SET_EVENT"; | ||
const CHALLENGE_OUTCOME_FAILED_EVENT = "CHALLENGE_OUTCOME_FAILED_EVENT"; | ||
const CHALLENGE_CANCELLED_EVENT = "CHALLENGE_CANCELLED_EVENT"; | ||
const CHALLENGE_CANCELLATION_FAILED_EVENT = "CHALLENGE_CANCELLATION_FAILED_EVENT"; | ||
const CHALLENGE_UPDATED_EVENT = "CHALLENGE_UPDATED_EVENT"; | ||
const STATE_PROGRESSED_EVENT = "STATE_PROGRESSED_EVENT"; | ||
const WatcherEvents = { | ||
[ChallengeUpdatedEvent]: ChallengeUpdatedEvent, | ||
[StateProgressedEvent]: StateProgressedEvent, | ||
[ChallengeProgressedEvent]: ChallengeProgressedEvent, | ||
[ChallengeProgressionFailedEvent]: ChallengeProgressionFailedEvent, | ||
[ChallengeOutcomeSetEvent]: ChallengeOutcomeSetEvent, | ||
[ChallengeOutcomeFailedEvent]: ChallengeOutcomeFailedEvent, | ||
[ChallengeCompletedEvent]: ChallengeCompletedEvent, | ||
[ChallengeCompletionFailedEvent]: ChallengeCompletionFailedEvent, | ||
[ChallengeCancelledEvent]: ChallengeCancelledEvent, | ||
[ChallengeCancellationFailedEvent]: ChallengeCancellationFailedEvent, | ||
[CHALLENGE_UPDATED_EVENT]: CHALLENGE_UPDATED_EVENT, | ||
[STATE_PROGRESSED_EVENT]: STATE_PROGRESSED_EVENT, | ||
[CHALLENGE_PROGRESSED_EVENT]: CHALLENGE_PROGRESSED_EVENT, | ||
[CHALLENGE_PROGRESSION_FAILED_EVENT]: CHALLENGE_PROGRESSION_FAILED_EVENT, | ||
[CHALLENGE_OUTCOME_SET_EVENT]: CHALLENGE_OUTCOME_SET_EVENT, | ||
[CHALLENGE_OUTCOME_FAILED_EVENT]: CHALLENGE_OUTCOME_FAILED_EVENT, | ||
[CHALLENGE_COMPLETED_EVENT]: CHALLENGE_COMPLETED_EVENT, | ||
[CHALLENGE_COMPLETION_FAILED_EVENT]: CHALLENGE_COMPLETION_FAILED_EVENT, | ||
[CHALLENGE_CANCELLED_EVENT]: CHALLENGE_CANCELLED_EVENT, | ||
[CHALLENGE_CANCELLATION_FAILED_EVENT]: CHALLENGE_CANCELLATION_FAILED_EVENT, | ||
}; | ||
@@ -420,2 +420,2 @@ var StoredAppChallengeStatus; | ||
export { AppNames, BigNumber, CF_METHOD_TIMEOUT, CHANNEL_PROTOCOL_VERSION, CONVENTION_FOR_ETH_ASSET_ID, ChallengeCancellationFailedEvent, ChallengeCancelledEvent, ChallengeCompletedEvent, ChallengeCompletionFailedEvent, ChallengeEvents, ChallengeOutcomeFailedEvent, ChallengeOutcomeSetEvent, ChallengeProgressedEvent, ChallengeProgressionFailedEvent, ChallengeStatus, ChallengeUpdatedEvent, ChannelMethods, CommitmentTarget, CommitmentTypes, ConditionalTransferAppNames, ConditionalTransferTypes, ConnextClientStorePrefix, ConnextEventEmitter, ConnextNodeStorePrefix, DOMAIN_NAME, DOMAIN_SALT, DOMAIN_VERSION, DepositAppName, DepositAppStateEncoding, ETHEREUM_NAMESPACE, EXPECTED_CONTRACT_NAMES_IN_NETWORK_CONTEXT, EventNames, GANACHE_CHAIN_ID, GRAPH_BATCHED_SWAP_CONVERSION, GenericConditionalTransferAppName, GraphBatchedTransferAppActionEncoding, GraphBatchedTransferAppName, GraphBatchedTransferAppStateEncoding, GraphSignedTransferAppActionEncoding, GraphSignedTransferAppName, GraphSignedTransferAppStateEncoding, GraphSignedTransferStatus, HashLockTransferAppActionEncoding, HashLockTransferAppName, HashLockTransferAppStateEncoding, HashLockTransferStatus, JsonRpcProvider, LinkedTransferStatus, MethodNames, MultisigOperation, NATS_ATTEMPTS, NATS_TIMEOUT, OnlineLinkedTransferAppName, Opcode, OutcomeType, PriceOracleTypes, ProtocolNames, ProtocolRoles, PureActionApps, RequireOnlineApps, STORE_SCHEMA_VERSION, SignedTransferStatus, SimpleLinkedTransferAppActionEncoding, SimpleLinkedTransferAppName, SimpleLinkedTransferAppStateEncoding, SimpleSignedTransferAppActionEncoding, SimpleSignedTransferAppName, SimpleSignedTransferAppStateEncoding, SimpleSwapAppStateEncoding, SimpleTwoPartySwapAppName, StateProgressedEvent, StateSchemaVersion, StoredAppChallengeStatus, SupportedApplicationNames, TransferStatuses, TransferWithExpiryStatuses, TwoPartyFixedOutcome, WatcherEvents, WithdrawAppActionEncoding, WithdrawAppName, WithdrawAppStateEncoding, enumify, multiAssetMultiPartyCoinTransferEncoding, multiAssetMultiPartyCoinTransferInterpreterParamsEncoding, singleAssetSinglePartyCoinTransferEncoding, singleAssetTwoPartyCoinTransferEncoding, singleAssetTwoPartyCoinTransferInterpreterParamsEncoding, tidy, twoPartyFixedOutcomeInterpreterParamsEncoding }; | ||
export { AppNames, BigNumber, CF_METHOD_TIMEOUT, CHALLENGE_CANCELLATION_FAILED_EVENT, CHALLENGE_CANCELLED_EVENT, CHALLENGE_COMPLETED_EVENT, CHALLENGE_COMPLETION_FAILED_EVENT, CHALLENGE_OUTCOME_FAILED_EVENT, CHALLENGE_OUTCOME_SET_EVENT, CHALLENGE_PROGRESSED_EVENT, CHALLENGE_PROGRESSION_FAILED_EVENT, CHALLENGE_UPDATED_EVENT, CHANNEL_PROTOCOL_VERSION, CONVENTION_FOR_ETH_ASSET_ID, ChallengeEvents, ChallengeStatus, ChannelMethods, CommitmentTarget, CommitmentTypes, ConditionalTransferAppNames, ConditionalTransferTypes, ConnextClientStorePrefix, ConnextEventEmitter, ConnextNodeStorePrefix, DOMAIN_NAME, DOMAIN_SALT, DOMAIN_VERSION, DepositAppName, DepositAppStateEncoding, ETHEREUM_NAMESPACE, EXPECTED_CONTRACT_NAMES_IN_NETWORK_CONTEXT, EventNames, GANACHE_CHAIN_ID, GRAPH_BATCHED_SWAP_CONVERSION, GenericConditionalTransferAppName, GraphBatchedTransferAppActionEncoding, GraphBatchedTransferAppName, GraphBatchedTransferAppStateEncoding, GraphSignedTransferAppActionEncoding, GraphSignedTransferAppName, GraphSignedTransferAppStateEncoding, GraphSignedTransferStatus, HashLockTransferAppActionEncoding, HashLockTransferAppName, HashLockTransferAppStateEncoding, HashLockTransferStatus, JsonRpcProvider, LinkedTransferStatus, MethodNames, MultisigOperation, NATS_ATTEMPTS, NATS_TIMEOUT, OnlineLinkedTransferAppName, Opcode, OutcomeType, PriceOracleTypes, ProtocolNames, ProtocolRoles, PureActionApps, RequireOnlineApps, STATE_PROGRESSED_EVENT, STORE_SCHEMA_VERSION, SignedTransferStatus, SimpleLinkedTransferAppActionEncoding, SimpleLinkedTransferAppName, SimpleLinkedTransferAppStateEncoding, SimpleSignedTransferAppActionEncoding, SimpleSignedTransferAppName, SimpleSignedTransferAppStateEncoding, SimpleSwapAppStateEncoding, SimpleTwoPartySwapAppName, StateSchemaVersion, StoredAppChallengeStatus, SupportedApplicationNames, TransferStatuses, TransferWithExpiryStatuses, TwoPartyFixedOutcome, WatcherEvents, WithdrawAppActionEncoding, WithdrawAppName, WithdrawAppStateEncoding, enumify, multiAssetMultiPartyCoinTransferEncoding, multiAssetMultiPartyCoinTransferInterpreterParamsEncoding, singleAssetSinglePartyCoinTransferEncoding, singleAssetTwoPartyCoinTransferEncoding, singleAssetTwoPartyCoinTransferInterpreterParamsEncoding, tidy, twoPartyFixedOutcomeInterpreterParamsEncoding }; |
@@ -387,23 +387,23 @@ 'use strict'; | ||
const ChallengeProgressedEvent = "ChallengeProgressedEvent"; | ||
const ChallengeProgressionFailedEvent = "ChallengeProgressionFailedEvent"; | ||
const ChallengeCompletedEvent = "ChallengeCompletedEvent"; | ||
const ChallengeCompletionFailedEvent = "ChallengeCompletionFailedEvent"; | ||
const ChallengeOutcomeSetEvent = "ChallengeOutcomeSetEvent"; | ||
const ChallengeOutcomeFailedEvent = "ChallengeOutcomeFailedEvent"; | ||
const ChallengeCancelledEvent = "ChallengeCancelledEvent"; | ||
const ChallengeCancellationFailedEvent = "ChallengeCancellationFailedEvent"; | ||
const ChallengeUpdatedEvent = "ChallengeUpdatedEvent"; | ||
const StateProgressedEvent = "StateProgressedEvent"; | ||
const CHALLENGE_PROGRESSED_EVENT = "CHALLENGE_PROGRESSED_EVENT"; | ||
const CHALLENGE_PROGRESSION_FAILED_EVENT = "CHALLENGE_PROGRESSION_FAILED_EVENT"; | ||
const CHALLENGE_COMPLETED_EVENT = "CHALLENGE_COMPLETED_EVENT"; | ||
const CHALLENGE_COMPLETION_FAILED_EVENT = "CHALLENGE_COMPLETION_FAILED_EVENT"; | ||
const CHALLENGE_OUTCOME_SET_EVENT = "CHALLENGE_OUTCOME_SET_EVENT"; | ||
const CHALLENGE_OUTCOME_FAILED_EVENT = "CHALLENGE_OUTCOME_FAILED_EVENT"; | ||
const CHALLENGE_CANCELLED_EVENT = "CHALLENGE_CANCELLED_EVENT"; | ||
const CHALLENGE_CANCELLATION_FAILED_EVENT = "CHALLENGE_CANCELLATION_FAILED_EVENT"; | ||
const CHALLENGE_UPDATED_EVENT = "CHALLENGE_UPDATED_EVENT"; | ||
const STATE_PROGRESSED_EVENT = "STATE_PROGRESSED_EVENT"; | ||
const WatcherEvents = { | ||
[ChallengeUpdatedEvent]: ChallengeUpdatedEvent, | ||
[StateProgressedEvent]: StateProgressedEvent, | ||
[ChallengeProgressedEvent]: ChallengeProgressedEvent, | ||
[ChallengeProgressionFailedEvent]: ChallengeProgressionFailedEvent, | ||
[ChallengeOutcomeSetEvent]: ChallengeOutcomeSetEvent, | ||
[ChallengeOutcomeFailedEvent]: ChallengeOutcomeFailedEvent, | ||
[ChallengeCompletedEvent]: ChallengeCompletedEvent, | ||
[ChallengeCompletionFailedEvent]: ChallengeCompletionFailedEvent, | ||
[ChallengeCancelledEvent]: ChallengeCancelledEvent, | ||
[ChallengeCancellationFailedEvent]: ChallengeCancellationFailedEvent, | ||
[CHALLENGE_UPDATED_EVENT]: CHALLENGE_UPDATED_EVENT, | ||
[STATE_PROGRESSED_EVENT]: STATE_PROGRESSED_EVENT, | ||
[CHALLENGE_PROGRESSED_EVENT]: CHALLENGE_PROGRESSED_EVENT, | ||
[CHALLENGE_PROGRESSION_FAILED_EVENT]: CHALLENGE_PROGRESSION_FAILED_EVENT, | ||
[CHALLENGE_OUTCOME_SET_EVENT]: CHALLENGE_OUTCOME_SET_EVENT, | ||
[CHALLENGE_OUTCOME_FAILED_EVENT]: CHALLENGE_OUTCOME_FAILED_EVENT, | ||
[CHALLENGE_COMPLETED_EVENT]: CHALLENGE_COMPLETED_EVENT, | ||
[CHALLENGE_COMPLETION_FAILED_EVENT]: CHALLENGE_COMPLETION_FAILED_EVENT, | ||
[CHALLENGE_CANCELLED_EVENT]: CHALLENGE_CANCELLED_EVENT, | ||
[CHALLENGE_CANCELLATION_FAILED_EVENT]: CHALLENGE_CANCELLATION_FAILED_EVENT, | ||
}; | ||
@@ -429,14 +429,14 @@ (function (StoredAppChallengeStatus) { | ||
exports.CF_METHOD_TIMEOUT = CF_METHOD_TIMEOUT; | ||
exports.CHALLENGE_CANCELLATION_FAILED_EVENT = CHALLENGE_CANCELLATION_FAILED_EVENT; | ||
exports.CHALLENGE_CANCELLED_EVENT = CHALLENGE_CANCELLED_EVENT; | ||
exports.CHALLENGE_COMPLETED_EVENT = CHALLENGE_COMPLETED_EVENT; | ||
exports.CHALLENGE_COMPLETION_FAILED_EVENT = CHALLENGE_COMPLETION_FAILED_EVENT; | ||
exports.CHALLENGE_OUTCOME_FAILED_EVENT = CHALLENGE_OUTCOME_FAILED_EVENT; | ||
exports.CHALLENGE_OUTCOME_SET_EVENT = CHALLENGE_OUTCOME_SET_EVENT; | ||
exports.CHALLENGE_PROGRESSED_EVENT = CHALLENGE_PROGRESSED_EVENT; | ||
exports.CHALLENGE_PROGRESSION_FAILED_EVENT = CHALLENGE_PROGRESSION_FAILED_EVENT; | ||
exports.CHALLENGE_UPDATED_EVENT = CHALLENGE_UPDATED_EVENT; | ||
exports.CHANNEL_PROTOCOL_VERSION = CHANNEL_PROTOCOL_VERSION; | ||
exports.CONVENTION_FOR_ETH_ASSET_ID = CONVENTION_FOR_ETH_ASSET_ID; | ||
exports.ChallengeCancellationFailedEvent = ChallengeCancellationFailedEvent; | ||
exports.ChallengeCancelledEvent = ChallengeCancelledEvent; | ||
exports.ChallengeCompletedEvent = ChallengeCompletedEvent; | ||
exports.ChallengeCompletionFailedEvent = ChallengeCompletionFailedEvent; | ||
exports.ChallengeEvents = ChallengeEvents; | ||
exports.ChallengeOutcomeFailedEvent = ChallengeOutcomeFailedEvent; | ||
exports.ChallengeOutcomeSetEvent = ChallengeOutcomeSetEvent; | ||
exports.ChallengeProgressedEvent = ChallengeProgressedEvent; | ||
exports.ChallengeProgressionFailedEvent = ChallengeProgressionFailedEvent; | ||
exports.ChallengeUpdatedEvent = ChallengeUpdatedEvent; | ||
exports.ChannelMethods = ChannelMethods; | ||
@@ -484,2 +484,3 @@ exports.CommitmentTarget = CommitmentTarget; | ||
exports.RequireOnlineApps = RequireOnlineApps; | ||
exports.STATE_PROGRESSED_EVENT = STATE_PROGRESSED_EVENT; | ||
exports.STORE_SCHEMA_VERSION = STORE_SCHEMA_VERSION; | ||
@@ -495,3 +496,2 @@ exports.SignedTransferStatus = SignedTransferStatus; | ||
exports.SimpleTwoPartySwapAppName = SimpleTwoPartySwapAppName; | ||
exports.StateProgressedEvent = StateProgressedEvent; | ||
exports.StateSchemaVersion = StateSchemaVersion; | ||
@@ -498,0 +498,0 @@ exports.SupportedApplicationNames = SupportedApplicationNames; |
import { AppRegistry } from "./app"; | ||
import { providers } from "ethers"; | ||
import { providers, BigNumberish } from "ethers"; | ||
import { Address, Bytes32, DecString, PublicIdentifier, StringMapping, Transaction, UrlString } from "./basic"; | ||
@@ -61,3 +61,3 @@ import { IChannelProvider } from "./channelProvider"; | ||
installConditionalTransferReceiverApp(paymentId: string, conditionType: ConditionalTransferTypes): Promise<NodeResponses.InstallConditionalTransferReceiverApp>; | ||
requestCollateral(assetId: Address): Promise<NodeResponses.RequestCollateral>; | ||
requestCollateral(assetId: Address, amount?: BigNumberish): Promise<NodeResponses.RequestCollateral>; | ||
fetchLinkedTransfer(paymentId: Bytes32): Promise<NodeResponses.GetLinkedTransfer>; | ||
@@ -71,3 +71,4 @@ fetchSignedTransfer(paymentId: Bytes32): Promise<NodeResponses.GetSignedTransfer>; | ||
unsubscribeFromSwapRates(from: Address, to: Address): Promise<void>; | ||
cancelChallenge(appIdentityHash: string, signature: string): Promise<NodeResponses.CancelChallenge>; | ||
} | ||
//# sourceMappingURL=api.d.ts.map |
@@ -1,2 +0,2 @@ | ||
import { providers } from "ethers"; | ||
import { providers, BigNumberish } from "ethers"; | ||
import { AppRegistry, DefaultApp, AppInstanceJson } from "./app"; | ||
@@ -31,2 +31,3 @@ import { Address, Bytes32, DecString, PublicIdentifier } from "./basic"; | ||
skipInitStore?: boolean; | ||
watcherEnabled?: boolean; | ||
} | ||
@@ -59,6 +60,8 @@ export interface IConnextClient { | ||
checkDepositRights(params: P.CheckDepositRights): Promise<R.CheckDepositRights>; | ||
requestDepositRights(params: P.RequestDepositRights): Promise<mR.RequestDepositRights>; | ||
requestDepositRights(params: P.RequestDepositRights): Promise<R.RequestDepositRights>; | ||
rescindDepositRights(params: P.RescindDepositRights): Promise<R.RescindDepositRights>; | ||
restart(): Promise<void>; | ||
restoreState(): Promise<void>; | ||
initiateChallenge(params: P.InitiateChallenge): Promise<R.InitiateChallenge>; | ||
cancelChallenge(params: P.CancelChallenge): Promise<R.CancelChallenge>; | ||
isAvailable(): Promise<void>; | ||
@@ -80,3 +83,3 @@ getChannel(): Promise<NodeResponses.GetChannel>; | ||
unsubscribeToSwapRates(from: Address, to: Address): Promise<void>; | ||
requestCollateral(tokenAddress: Address): Promise<R.RequestCollateral>; | ||
requestCollateral(tokenAddress: Address, amount?: BigNumberish): Promise<R.RequestCollateral>; | ||
getRebalanceProfile(assetId?: Address): Promise<NodeResponses.GetRebalanceProfile | undefined>; | ||
@@ -83,0 +86,0 @@ getTransferHistory(): Promise<NodeResponses.GetTransferHistory>; |
@@ -11,2 +11,3 @@ import { Ctx } from "evt"; | ||
import { StateChannelJSON } from "./state"; | ||
import { WatcherEvents, WatcherEventDataMap } from "./watcher"; | ||
declare type SignedTransfer = typeof ConditionalTransferTypes.SignedTransfer; | ||
@@ -152,3 +153,3 @@ declare type GraphTransfer = typeof ConditionalTransferTypes.GraphTransfer; | ||
}; | ||
interface EventPayloadMap { | ||
interface EventPayloadMap extends WatcherEventDataMap { | ||
[CONDITIONAL_TRANSFER_CREATED_EVENT]: ConditionalTransferCreatedEventData<HashLockTransfer | LinkedTransfer | SignedTransfer | GraphTransfer | GraphBatchedTransfer>; | ||
@@ -203,3 +204,3 @@ [CONDITIONAL_TRANSFER_UNLOCKED_EVENT]: ConditionalTransferUnlockedEventData<HashLockTransfer | LinkedTransfer | SignedTransfer | GraphTransfer | GraphBatchedTransfer>; | ||
}; | ||
export declare type EventName = keyof typeof EventNames; | ||
export declare type EventName = keyof typeof EventNames | keyof typeof WatcherEvents; | ||
export declare type EventPayload = { | ||
@@ -206,0 +207,0 @@ [P in keyof EventPayloadMap]: EventPayloadMap[P]; |
@@ -1,4 +0,3 @@ | ||
import { Address, BigNumber, PublicIdentifier, TransactionReceipt } from "./basic"; | ||
import { Address, BigNumber, PublicIdentifier, TransactionResponse } from "./basic"; | ||
import { MinimalTransaction } from "./commitments"; | ||
import { StateChannelJSON } from "./state"; | ||
export declare type RebalanceProfile = { | ||
@@ -35,4 +34,4 @@ assetId: Address; | ||
export interface IOnchainTransactionService { | ||
sendTransaction(transaction: MinimalTransaction, channel: StateChannelJSON): Promise<TransactionReceipt>; | ||
sendTransaction(transaction: MinimalTransaction, chainId: number, multisigAddress?: string): Promise<TransactionResponse>; | ||
} | ||
//# sourceMappingURL=misc.d.ts.map |
import { providers } from "ethers"; | ||
import { Address, BigNumber, Bytes32, DecString, Network, PublicIdentifier } from "./basic"; | ||
import { Address, BigNumber, Bytes32, DecString, Network, PublicIdentifier, TransactionResponse } from "./basic"; | ||
import { ConditionalTransactionCommitmentJSON, MinimalTransaction, SetStateCommitmentJSON } from "./commitments"; | ||
@@ -83,2 +83,3 @@ import { PublicResults } from "./public"; | ||
declare type GetPendingAsyncTransfersResponse = FetchedLinkedTransfer[]; | ||
declare type CancelChallengeResponse = TransactionResponse; | ||
export declare namespace NodeResponses { | ||
@@ -100,4 +101,5 @@ type GetConfig = GetConfigResponse; | ||
type ChannelRestore = ChannelRestoreResponse; | ||
type CancelChallenge = CancelChallengeResponse; | ||
} | ||
export {}; | ||
//# sourceMappingURL=node.d.ts.map |
@@ -6,2 +6,9 @@ import { providers, BigNumberish } from "ethers"; | ||
import { NodeResponses } from "./node"; | ||
import { ChallengeInitiatedResponse } from "./watcher"; | ||
declare type InitiateChallengeParameters = { | ||
appIdentityHash: string; | ||
}; | ||
declare type CancelChallengeParameters = { | ||
appIdentityHash: string; | ||
}; | ||
declare type DepositParameters = { | ||
@@ -247,4 +254,6 @@ amount: BigNumberish; | ||
type Withdraw = WithdrawParameters; | ||
type InitiateChallenge = InitiateChallengeParameters; | ||
type CancelChallenge = CancelChallengeParameters; | ||
} | ||
export declare type PublicParam = CheckDepositRightsParameters | ConditionalTransferParameters | DepositParameters | HashLockTransferParameters | LinkedTransferParameters | RequestDepositRightsParameters | RescindDepositRightsParameters | ResolveConditionParameters | ResolveHashLockTransferParameters | ResolveGraphSignedTransferParameters | ResolveGraphBatchedTransferParameters | ResolveLinkedTransferParameters | ResolveSignedTransferParameters | SignedTransferParameters | GraphSignedTransferParameters | GraphBatchedTransferParameters | SwapParameters | TransferParameters | WithdrawParameters; | ||
export declare type PublicParam = CancelChallengeParameters | CheckDepositRightsParameters | ConditionalTransferParameters | DepositParameters | HashLockTransferParameters | InitiateChallengeParameters | LinkedTransferParameters | RequestDepositRightsParameters | RescindDepositRightsParameters | ResolveConditionParameters | ResolveHashLockTransferParameters | ResolveGraphSignedTransferParameters | ResolveGraphBatchedTransferParameters | ResolveLinkedTransferParameters | ResolveSignedTransferParameters | SignedTransferParameters | GraphSignedTransferParameters | GraphBatchedTransferParameters | SwapParameters | TransferParameters | WithdrawParameters; | ||
export declare namespace PublicResults { | ||
@@ -270,5 +279,7 @@ type CheckDepositRights = CheckDepositRightsResponse; | ||
type Withdraw = WithdrawResponse; | ||
type InitiateChallenge = ChallengeInitiatedResponse; | ||
type CancelChallenge = providers.TransactionResponse; | ||
} | ||
export declare type PublicResult = CheckDepositRightsResponse | ConditionalTransferResponse | DepositResponse | HashLockTransferResponse | LinkedTransferResponse | RequestCollateralResponse | RequestDepositRightsResponse | RescindDepositRightsResponse | ResolveConditionResponse | ResolveHashLockTransferResponse | ResolveLinkedTransferResponse | ResolveSignedTransferResponse | ResolveGraphSignedTransferResponse | ResolveGraphBatchedTransferResponse | SignedTransferResponse | GraphBatchedTransferResponse | GraphSignedTransferResponse | SwapResponse | TransferResponse | WithdrawResponse; | ||
export declare type PublicResult = CheckDepositRightsResponse | ConditionalTransferResponse | DepositResponse | HashLockTransferResponse | LinkedTransferResponse | PublicResults.CancelChallenge | PublicResults.InitiateChallenge | RequestCollateralResponse | RequestDepositRightsResponse | RescindDepositRightsResponse | ResolveConditionResponse | ResolveHashLockTransferResponse | ResolveLinkedTransferResponse | ResolveSignedTransferResponse | ResolveGraphSignedTransferResponse | ResolveGraphBatchedTransferResponse | SignedTransferResponse | GraphBatchedTransferResponse | GraphSignedTransferResponse | SwapResponse | TransferResponse | WithdrawResponse; | ||
export {}; | ||
//# sourceMappingURL=public.d.ts.map |
@@ -0,6 +1,8 @@ | ||
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 { IWatcherStoreService } from "./watcher"; | ||
import { StoredAppChallenge } from "./watcher"; | ||
export declare const ConnextNodeStorePrefix = "INDRA_NODE_CF_CORE"; | ||
@@ -22,19 +24,40 @@ export declare const ConnextClientStorePrefix = "INDRA_CLIENT_CF_CORE"; | ||
export declare const STORE_SCHEMA_VERSION = 1; | ||
export interface IStoreService extends IWatcherStoreService { | ||
updateSchemaVersion(version?: number): Promise<void>; | ||
getUserWithdrawals(): Promise<WithdrawalMonitorObject[]>; | ||
saveUserWithdrawal(withdrawalObject: WithdrawalMonitorObject): Promise<void>; | ||
removeUserWithdrawal(toRemove: WithdrawalMonitorObject): Promise<void>; | ||
createStateChannel(stateChannel: StateChannelJSON, signedSetupCommitment: MinimalTransaction, signedFreeBalanceUpdate: SetStateCommitmentJSON): Promise<void>; | ||
export interface IStoreService { | ||
init(): Promise<void>; | ||
clear(): Promise<void>; | ||
close(): Promise<void>; | ||
restore(): Promise<void>; | ||
getFreeBalance(multisigAddress: Address): Promise<AppInstanceJson | undefined>; | ||
getLatestProcessedBlock(): Promise<number>; | ||
addOnchainAction(appIdentityHash: Bytes32, provider: providers.JsonRpcProvider): Promise<void>; | ||
updateLatestProcessedBlock(blockNumber: number): Promise<void>; | ||
updateNumProposedApps(multisigAddress: string, numProposedApps: number, stateChannel?: StateChannelJSON): Promise<void>; | ||
createAppProposal(multisigAddress: Address, appProposal: AppInstanceJson, numProposedApps: number, signedSetStateCommitment: SetStateCommitmentJSON, signedConditionalTxCommitment: ConditionalTransactionCommitmentJSON, stateChannel?: StateChannelJSON): Promise<void>; | ||
removeAppProposal(multisigAddress: Address, appIdentityHash: Bytes32, stateChannel?: StateChannelJSON): Promise<void>; | ||
getActiveChallenges(): Promise<StoredAppChallenge[]>; | ||
getAppChallenge(appIdentityHash: Bytes32): Promise<StoredAppChallenge | undefined>; | ||
saveAppChallenge(data: ChallengeUpdatedEventPayload | StoredAppChallenge): Promise<void>; | ||
createChallengeUpdatedEvent(event: ChallengeUpdatedEventPayload): Promise<void>; | ||
createStateProgressedEvent(event: StateProgressedEventPayload): Promise<void>; | ||
getChallengeUpdatedEvents(appIdentityHash: Bytes32): Promise<ChallengeUpdatedEventPayload[]>; | ||
getStateProgressedEvents(appIdentityHash: Bytes32): Promise<StateProgressedEventPayload[]>; | ||
createAppInstance(multisigAddress: Address, appInstance: AppInstanceJson, freeBalanceAppInstance: AppInstanceJson, signedFreeBalanceUpdate: SetStateCommitmentJSON, stateChannel?: StateChannelJSON): Promise<void>; | ||
getAppInstance(appIdentityHash: Bytes32): Promise<AppInstanceJson | undefined>; | ||
updateAppInstance(multisigAddress: Address, appInstance: AppInstanceJson, signedSetStateCommitment: SetStateCommitmentJSON, stateChannel?: StateChannelJSON): Promise<void>; | ||
removeAppInstance(multisigAddress: Address, appInstance: AppInstanceJson, freeBalanceAppInstance: AppInstanceJson, signedFreeBalanceUpdate: SetStateCommitmentJSON, stateChannel?: StateChannelJSON): Promise<void>; | ||
clear(): Promise<void>; | ||
restore(): Promise<void>; | ||
init(): Promise<void>; | ||
close(): Promise<void>; | ||
createAppProposal(multisigAddress: Address, appProposal: AppInstanceJson, numProposedApps: number, signedSetStateCommitment: SetStateCommitmentJSON, signedConditionalTxCommitment: ConditionalTransactionCommitmentJSON, stateChannel?: StateChannelJSON): Promise<void>; | ||
getAppProposal(appIdentityHash: Bytes32): Promise<AppInstanceJson | undefined>; | ||
removeAppProposal(multisigAddress: Address, appIdentityHash: Bytes32, stateChannel?: StateChannelJSON): Promise<void>; | ||
getConditionalTransactionCommitment(appIdentityHash: Bytes32): Promise<ConditionalTransactionCommitmentJSON | undefined>; | ||
getSetStateCommitments(appIdentityHash: Bytes32): Promise<SetStateCommitmentJSON[]>; | ||
getSetupCommitment(multisigAddress: Address): Promise<MinimalTransaction | undefined>; | ||
getSchemaVersion(): Promise<number>; | ||
updateSchemaVersion(version?: number): Promise<void>; | ||
getStateChannel(multisigAddress: Address): Promise<StateChannelJSON | undefined>; | ||
getStateChannelByAppIdentityHash(appIdentityHash: Bytes32): Promise<StateChannelJSON | undefined>; | ||
getStateChannelByOwnersAndChainId(owners: Address[], chainId: number): Promise<StateChannelJSON | undefined>; | ||
getAllChannels(): Promise<StateChannelJSON[]>; | ||
createStateChannel(stateChannel: StateChannelJSON, signedSetupCommitment: MinimalTransaction, signedFreeBalanceUpdate: SetStateCommitmentJSON): Promise<void>; | ||
saveUserWithdrawal(withdrawalObject: WithdrawalMonitorObject): Promise<void>; | ||
getUserWithdrawals(): Promise<WithdrawalMonitorObject[]>; | ||
removeUserWithdrawal(toRemove: WithdrawalMonitorObject): Promise<void>; | ||
} | ||
//# sourceMappingURL=store.d.ts.map |
import { providers } from "ethers"; | ||
import { AppChallenge, ChallengeEvent, ChallengeEventData, ChallengeUpdatedEventPayload, SignedCancelChallengeRequest, StateProgressedEventPayload, ChallengeEvents } from "./contracts"; | ||
import { StateChannelJSON } from "./state"; | ||
import { Address, Bytes32 } from "./basic"; | ||
import { AppInstanceJson } from "./app"; | ||
import { ConditionalTransactionCommitmentJSON, MinimalTransaction, SetStateCommitmentJSON } from "./commitments"; | ||
import { AppChallenge, ChallengeEventData, SignedCancelChallengeRequest, ChallengeEvents } from "./contracts"; | ||
import { IChannelSigner } from "./crypto"; | ||
import { ILoggerService, ILogger } from "./logger"; | ||
import { Ctx } from "evt"; | ||
import { IOnchainTransactionService } from "./misc"; | ||
import { ContractAddressBook } from "./node"; | ||
import { IStoreService } from "./store"; | ||
export declare type WatcherInitOptions = { | ||
@@ -17,5 +15,5 @@ signer: IChannelSigner | string; | ||
context: ContractAddressBook; | ||
store: IWatcherStoreService; | ||
store: IStoreService; | ||
logger?: ILoggerService | ILogger; | ||
logLevel?: number; | ||
transactionService?: IOnchainTransactionService; | ||
}; | ||
@@ -34,46 +32,46 @@ declare type BaseChallengeTransactionCompletedEvent = { | ||
}; | ||
export declare const ChallengeProgressedEvent = "ChallengeProgressedEvent"; | ||
export declare const CHALLENGE_PROGRESSED_EVENT = "CHALLENGE_PROGRESSED_EVENT"; | ||
export declare type ChallengeProgressedEventData = BaseChallengeTransactionCompletedEvent; | ||
export declare const ChallengeProgressionFailedEvent = "ChallengeProgressionFailedEvent"; | ||
export declare const CHALLENGE_PROGRESSION_FAILED_EVENT = "CHALLENGE_PROGRESSION_FAILED_EVENT"; | ||
export declare type ChallengeProgressionFailedEventData = BaseChallengeTransactionFailedEvent; | ||
export declare const ChallengeCompletedEvent = "ChallengeCompletedEvent"; | ||
export declare const CHALLENGE_COMPLETED_EVENT = "CHALLENGE_COMPLETED_EVENT"; | ||
export declare type ChallengeCompletedEventData = BaseChallengeTransactionCompletedEvent; | ||
export declare const ChallengeCompletionFailedEvent = "ChallengeCompletionFailedEvent"; | ||
export declare const CHALLENGE_COMPLETION_FAILED_EVENT = "CHALLENGE_COMPLETION_FAILED_EVENT"; | ||
export declare type ChallengeCompletionFailedEventData = BaseChallengeTransactionFailedEvent; | ||
export declare const ChallengeOutcomeSetEvent = "ChallengeOutcomeSetEvent"; | ||
export declare const CHALLENGE_OUTCOME_SET_EVENT = "CHALLENGE_OUTCOME_SET_EVENT"; | ||
export declare type ChallengeOutcomeSetEventData = BaseChallengeTransactionCompletedEvent; | ||
export declare const ChallengeOutcomeFailedEvent = "ChallengeOutcomeFailedEvent"; | ||
export declare const CHALLENGE_OUTCOME_FAILED_EVENT = "CHALLENGE_OUTCOME_FAILED_EVENT"; | ||
export declare type ChallengeOutcomeFailedEventData = BaseChallengeTransactionFailedEvent; | ||
export declare const ChallengeCancelledEvent = "ChallengeCancelledEvent"; | ||
export declare const CHALLENGE_CANCELLED_EVENT = "CHALLENGE_CANCELLED_EVENT"; | ||
export declare type ChallengeCancelledEventData = BaseChallengeTransactionCompletedEvent; | ||
export declare const ChallengeCancellationFailedEvent = "ChallengeCancellationFailedEvent"; | ||
export declare const CHALLENGE_CANCELLATION_FAILED_EVENT = "CHALLENGE_CANCELLATION_FAILED_EVENT"; | ||
export declare type ChallengeCancellationFailedEventData = BaseChallengeTransactionFailedEvent; | ||
export declare const ChallengeUpdatedEvent = "ChallengeUpdatedEvent"; | ||
export declare const CHALLENGE_UPDATED_EVENT = "CHALLENGE_UPDATED_EVENT"; | ||
export declare type ChallengeUpdatedEventData = ChallengeEventData[typeof ChallengeEvents.ChallengeUpdated]; | ||
export declare const StateProgressedEvent = "StateProgressedEvent"; | ||
export declare const STATE_PROGRESSED_EVENT = "STATE_PROGRESSED_EVENT"; | ||
export declare type StateProgressedEventData = ChallengeEventData[typeof ChallengeEvents.StateProgressed]; | ||
export declare const WatcherEvents: { | ||
readonly ChallengeUpdatedEvent: "ChallengeUpdatedEvent"; | ||
readonly StateProgressedEvent: "StateProgressedEvent"; | ||
readonly ChallengeProgressedEvent: "ChallengeProgressedEvent"; | ||
readonly ChallengeProgressionFailedEvent: "ChallengeProgressionFailedEvent"; | ||
readonly ChallengeOutcomeSetEvent: "ChallengeOutcomeSetEvent"; | ||
readonly ChallengeOutcomeFailedEvent: "ChallengeOutcomeFailedEvent"; | ||
readonly ChallengeCompletedEvent: "ChallengeCompletedEvent"; | ||
readonly ChallengeCompletionFailedEvent: "ChallengeCompletionFailedEvent"; | ||
readonly ChallengeCancelledEvent: "ChallengeCancelledEvent"; | ||
readonly ChallengeCancellationFailedEvent: "ChallengeCancellationFailedEvent"; | ||
readonly CHALLENGE_UPDATED_EVENT: "CHALLENGE_UPDATED_EVENT"; | ||
readonly STATE_PROGRESSED_EVENT: "STATE_PROGRESSED_EVENT"; | ||
readonly CHALLENGE_PROGRESSED_EVENT: "CHALLENGE_PROGRESSED_EVENT"; | ||
readonly CHALLENGE_PROGRESSION_FAILED_EVENT: "CHALLENGE_PROGRESSION_FAILED_EVENT"; | ||
readonly CHALLENGE_OUTCOME_SET_EVENT: "CHALLENGE_OUTCOME_SET_EVENT"; | ||
readonly CHALLENGE_OUTCOME_FAILED_EVENT: "CHALLENGE_OUTCOME_FAILED_EVENT"; | ||
readonly CHALLENGE_COMPLETED_EVENT: "CHALLENGE_COMPLETED_EVENT"; | ||
readonly CHALLENGE_COMPLETION_FAILED_EVENT: "CHALLENGE_COMPLETION_FAILED_EVENT"; | ||
readonly CHALLENGE_CANCELLED_EVENT: "CHALLENGE_CANCELLED_EVENT"; | ||
readonly CHALLENGE_CANCELLATION_FAILED_EVENT: "CHALLENGE_CANCELLATION_FAILED_EVENT"; | ||
}; | ||
export declare type WatcherEvent = keyof typeof WatcherEvents; | ||
interface WatcherEventDataMap { | ||
[ChallengeUpdatedEvent]: ChallengeUpdatedEventData; | ||
[StateProgressedEvent]: StateProgressedEventData; | ||
[ChallengeProgressedEvent]: ChallengeProgressedEventData; | ||
[ChallengeProgressionFailedEvent]: ChallengeProgressionFailedEventData; | ||
[ChallengeOutcomeFailedEvent]: ChallengeOutcomeFailedEventData; | ||
[ChallengeOutcomeSetEvent]: ChallengeOutcomeSetEventData; | ||
[ChallengeCompletedEvent]: ChallengeCompletedEventData; | ||
[ChallengeCompletionFailedEvent]: ChallengeCompletionFailedEventData; | ||
[ChallengeCancelledEvent]: ChallengeCancelledEventData; | ||
[ChallengeCancellationFailedEvent]: ChallengeCancellationFailedEventData; | ||
export interface WatcherEventDataMap { | ||
[CHALLENGE_UPDATED_EVENT]: ChallengeUpdatedEventData; | ||
[STATE_PROGRESSED_EVENT]: StateProgressedEventData; | ||
[CHALLENGE_PROGRESSED_EVENT]: ChallengeProgressedEventData; | ||
[CHALLENGE_PROGRESSION_FAILED_EVENT]: ChallengeProgressionFailedEventData; | ||
[CHALLENGE_OUTCOME_FAILED_EVENT]: ChallengeOutcomeFailedEventData; | ||
[CHALLENGE_OUTCOME_SET_EVENT]: ChallengeOutcomeSetEventData; | ||
[CHALLENGE_COMPLETED_EVENT]: ChallengeCompletedEventData; | ||
[CHALLENGE_COMPLETION_FAILED_EVENT]: ChallengeCompletionFailedEventData; | ||
[CHALLENGE_CANCELLED_EVENT]: ChallengeCancelledEventData; | ||
[CHALLENGE_CANCELLATION_FAILED_EVENT]: ChallengeCancellationFailedEventData; | ||
} | ||
@@ -84,4 +82,4 @@ export declare type WatcherEventData = { | ||
export declare type ChallengeInitiatedResponse = { | ||
freeBalanceChallenge: providers.TransactionReceipt; | ||
appChallenge: providers.TransactionReceipt; | ||
freeBalanceChallenge: providers.TransactionResponse; | ||
appChallenge: providers.TransactionResponse; | ||
}; | ||
@@ -97,14 +95,4 @@ export interface IWatcher { | ||
initiate(appIdentityHash: string): Promise<ChallengeInitiatedResponse>; | ||
cancel(appIdentityHash: string, req: SignedCancelChallengeRequest): Promise<providers.TransactionReceipt>; | ||
cancel(appIdentityHash: string, req: SignedCancelChallengeRequest): Promise<providers.TransactionResponse>; | ||
} | ||
export interface IChainListener { | ||
attach<T extends ChallengeEvent>(event: T, callback: (data: ChallengeEventData[T]) => Promise<void>, providedFilter?: (data: ChallengeEventData[T]) => boolean, ctx?: Ctx<ChallengeEventData[T]>): void; | ||
attachOnce<T extends ChallengeEvent>(event: T, callback: (data: ChallengeEventData[T]) => Promise<void>, providedFilter?: (data: ChallengeEventData[T]) => boolean, ctx?: Ctx<ChallengeEventData[T]>): void; | ||
waitFor<T extends ChallengeEvent>(event: T, timeout: number, providedFilter?: (data: ChallengeEventData[T]) => boolean, ctx?: Ctx<ChallengeEventData[T]>): Promise<ChallengeEventData[T]>; | ||
createContext<T extends ChallengeEvent>(): Ctx<ChallengeEventData[T]>; | ||
detach<T extends ChallengeEvent>(ctx?: Ctx<ChallengeEventData[T]>): void; | ||
enable(): Promise<void>; | ||
disable(): Promise<void>; | ||
parseLogsFrom(startingBlock: number): Promise<void>; | ||
} | ||
export declare enum StoredAppChallengeStatus { | ||
@@ -124,26 +112,3 @@ NO_CHALLENGE = 0, | ||
}; | ||
export interface IWatcherStoreService { | ||
getAppChallenge(appIdentityHash: Bytes32): Promise<StoredAppChallenge | undefined>; | ||
saveAppChallenge(data: ChallengeUpdatedEventPayload | StoredAppChallenge): Promise<void>; | ||
getActiveChallenges(): Promise<StoredAppChallenge[]>; | ||
getLatestProcessedBlock(): Promise<number>; | ||
updateLatestProcessedBlock(blockNumber: number): Promise<void>; | ||
getStateProgressedEvents(appIdentityHash: Bytes32): Promise<StateProgressedEventPayload[]>; | ||
createStateProgressedEvent(event: StateProgressedEventPayload): Promise<void>; | ||
getChallengeUpdatedEvents(appIdentityHash: Bytes32): Promise<ChallengeUpdatedEventPayload[]>; | ||
createChallengeUpdatedEvent(event: ChallengeUpdatedEventPayload): Promise<void>; | ||
addOnchainAction(appIdentityHash: Bytes32, provider: providers.JsonRpcProvider): Promise<void>; | ||
getSchemaVersion(): Promise<number>; | ||
getAllChannels(): Promise<StateChannelJSON[]>; | ||
getStateChannel(multisigAddress: Address): Promise<StateChannelJSON | undefined>; | ||
getStateChannelByOwnersAndChainId(owners: Address[], chainId: number): Promise<StateChannelJSON | undefined>; | ||
getStateChannelByAppIdentityHash(appIdentityHash: Bytes32): Promise<StateChannelJSON | undefined>; | ||
getAppInstance(appIdentityHash: Bytes32): Promise<AppInstanceJson | undefined>; | ||
getAppProposal(appIdentityHash: Bytes32): Promise<AppInstanceJson | undefined>; | ||
getFreeBalance(multisigAddress: Address): Promise<AppInstanceJson | undefined>; | ||
getSetupCommitment(multisigAddress: Address): Promise<MinimalTransaction | undefined>; | ||
getSetStateCommitments(appIdentityHash: Bytes32): Promise<SetStateCommitmentJSON[]>; | ||
getConditionalTransactionCommitment(appIdentityHash: Bytes32): Promise<ConditionalTransactionCommitmentJSON | undefined>; | ||
} | ||
export {}; | ||
//# sourceMappingURL=watcher.d.ts.map |
@@ -1,22 +0,22 @@ | ||
export const ChallengeProgressedEvent = "ChallengeProgressedEvent"; | ||
export const ChallengeProgressionFailedEvent = "ChallengeProgressionFailedEvent"; | ||
export const ChallengeCompletedEvent = "ChallengeCompletedEvent"; | ||
export const ChallengeCompletionFailedEvent = "ChallengeCompletionFailedEvent"; | ||
export const ChallengeOutcomeSetEvent = "ChallengeOutcomeSetEvent"; | ||
export const ChallengeOutcomeFailedEvent = "ChallengeOutcomeFailedEvent"; | ||
export const ChallengeCancelledEvent = "ChallengeCancelledEvent"; | ||
export const ChallengeCancellationFailedEvent = "ChallengeCancellationFailedEvent"; | ||
export const ChallengeUpdatedEvent = "ChallengeUpdatedEvent"; | ||
export const StateProgressedEvent = "StateProgressedEvent"; | ||
export const CHALLENGE_PROGRESSED_EVENT = "CHALLENGE_PROGRESSED_EVENT"; | ||
export const CHALLENGE_PROGRESSION_FAILED_EVENT = "CHALLENGE_PROGRESSION_FAILED_EVENT"; | ||
export const CHALLENGE_COMPLETED_EVENT = "CHALLENGE_COMPLETED_EVENT"; | ||
export const CHALLENGE_COMPLETION_FAILED_EVENT = "CHALLENGE_COMPLETION_FAILED_EVENT"; | ||
export const CHALLENGE_OUTCOME_SET_EVENT = "CHALLENGE_OUTCOME_SET_EVENT"; | ||
export const CHALLENGE_OUTCOME_FAILED_EVENT = "CHALLENGE_OUTCOME_FAILED_EVENT"; | ||
export const CHALLENGE_CANCELLED_EVENT = "CHALLENGE_CANCELLED_EVENT"; | ||
export const CHALLENGE_CANCELLATION_FAILED_EVENT = "CHALLENGE_CANCELLATION_FAILED_EVENT"; | ||
export const CHALLENGE_UPDATED_EVENT = "CHALLENGE_UPDATED_EVENT"; | ||
export const STATE_PROGRESSED_EVENT = "STATE_PROGRESSED_EVENT"; | ||
export const WatcherEvents = { | ||
[ChallengeUpdatedEvent]: ChallengeUpdatedEvent, | ||
[StateProgressedEvent]: StateProgressedEvent, | ||
[ChallengeProgressedEvent]: ChallengeProgressedEvent, | ||
[ChallengeProgressionFailedEvent]: ChallengeProgressionFailedEvent, | ||
[ChallengeOutcomeSetEvent]: ChallengeOutcomeSetEvent, | ||
[ChallengeOutcomeFailedEvent]: ChallengeOutcomeFailedEvent, | ||
[ChallengeCompletedEvent]: ChallengeCompletedEvent, | ||
[ChallengeCompletionFailedEvent]: ChallengeCompletionFailedEvent, | ||
[ChallengeCancelledEvent]: ChallengeCancelledEvent, | ||
[ChallengeCancellationFailedEvent]: ChallengeCancellationFailedEvent, | ||
[CHALLENGE_UPDATED_EVENT]: CHALLENGE_UPDATED_EVENT, | ||
[STATE_PROGRESSED_EVENT]: STATE_PROGRESSED_EVENT, | ||
[CHALLENGE_PROGRESSED_EVENT]: CHALLENGE_PROGRESSED_EVENT, | ||
[CHALLENGE_PROGRESSION_FAILED_EVENT]: CHALLENGE_PROGRESSION_FAILED_EVENT, | ||
[CHALLENGE_OUTCOME_SET_EVENT]: CHALLENGE_OUTCOME_SET_EVENT, | ||
[CHALLENGE_OUTCOME_FAILED_EVENT]: CHALLENGE_OUTCOME_FAILED_EVENT, | ||
[CHALLENGE_COMPLETED_EVENT]: CHALLENGE_COMPLETED_EVENT, | ||
[CHALLENGE_COMPLETION_FAILED_EVENT]: CHALLENGE_COMPLETION_FAILED_EVENT, | ||
[CHALLENGE_CANCELLED_EVENT]: CHALLENGE_CANCELLED_EVENT, | ||
[CHALLENGE_CANCELLATION_FAILED_EVENT]: CHALLENGE_CANCELLATION_FAILED_EVENT, | ||
}; | ||
@@ -23,0 +23,0 @@ export var StoredAppChallengeStatus; |
{ | ||
"name": "@connext/types", | ||
"version": "7.3.8", | ||
"version": "7.3.9", | ||
"description": "TypeScript typings for common Connext types", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
import { AppRegistry } from "./app"; | ||
import { providers } from "ethers"; | ||
import { providers, BigNumberish } from "ethers"; | ||
@@ -81,3 +81,6 @@ import { | ||
): Promise<NodeResponses.InstallConditionalTransferReceiverApp>; | ||
requestCollateral(assetId: Address): Promise<NodeResponses.RequestCollateral>; | ||
requestCollateral( | ||
assetId: Address, | ||
amount?: BigNumberish, | ||
): Promise<NodeResponses.RequestCollateral>; | ||
fetchLinkedTransfer(paymentId: Bytes32): Promise<NodeResponses.GetLinkedTransfer>; | ||
@@ -91,2 +94,6 @@ fetchSignedTransfer(paymentId: Bytes32): Promise<NodeResponses.GetSignedTransfer>; | ||
unsubscribeFromSwapRates(from: Address, to: Address): Promise<void>; | ||
cancelChallenge( | ||
appIdentityHash: string, | ||
signature: string, | ||
): Promise<NodeResponses.CancelChallenge>; | ||
} |
@@ -1,2 +0,2 @@ | ||
import { providers } from "ethers"; | ||
import { providers, BigNumberish } from "ethers"; | ||
@@ -35,2 +35,3 @@ import { AppRegistry, DefaultApp, AppInstanceJson } from "./app"; | ||
skipInitStore?: boolean; | ||
watcherEnabled?: boolean; | ||
} | ||
@@ -87,3 +88,3 @@ | ||
checkDepositRights(params: P.CheckDepositRights): Promise<R.CheckDepositRights>; | ||
requestDepositRights(params: P.RequestDepositRights): Promise<mR.RequestDepositRights>; | ||
requestDepositRights(params: P.RequestDepositRights): Promise<R.RequestDepositRights>; | ||
rescindDepositRights(params: P.RescindDepositRights): Promise<R.RescindDepositRights>; | ||
@@ -94,2 +95,7 @@ restart(): Promise<void>; | ||
/////////////////////////////////// | ||
// Dispute methods | ||
initiateChallenge(params: P.InitiateChallenge): Promise<R.InitiateChallenge>; | ||
cancelChallenge(params: P.CancelChallenge): Promise<R.CancelChallenge>; | ||
/////////////////////////////////// | ||
// Node easy access methods | ||
@@ -117,3 +123,3 @@ isAvailable(): Promise<void>; | ||
unsubscribeToSwapRates(from: Address, to: Address): Promise<void>; | ||
requestCollateral(tokenAddress: Address): Promise<R.RequestCollateral>; | ||
requestCollateral(tokenAddress: Address, amount?: BigNumberish): Promise<R.RequestCollateral>; | ||
getRebalanceProfile(assetId?: Address): Promise<NodeResponses.GetRebalanceProfile | undefined>; | ||
@@ -120,0 +126,0 @@ getTransferHistory(): Promise<NodeResponses.GetTransferHistory>; |
@@ -16,2 +16,3 @@ import { Ctx } from "evt"; | ||
import { StateChannelJSON } from "./state"; | ||
import { WatcherEventData, WatcherEvents, WatcherEventDataMap } from "./watcher"; | ||
@@ -219,14 +220,11 @@ type SignedTransfer = typeof ConditionalTransferTypes.SignedTransfer; | ||
interface EventPayloadMap { | ||
interface EventPayloadMap extends WatcherEventDataMap { | ||
[CONDITIONAL_TRANSFER_CREATED_EVENT]: ConditionalTransferCreatedEventData< | ||
HashLockTransfer | LinkedTransfer | | ||
SignedTransfer | GraphTransfer | GraphBatchedTransfer | ||
HashLockTransfer | LinkedTransfer | SignedTransfer | GraphTransfer | GraphBatchedTransfer | ||
>; | ||
[CONDITIONAL_TRANSFER_UNLOCKED_EVENT]: ConditionalTransferUnlockedEventData< | ||
HashLockTransfer | LinkedTransfer | | ||
SignedTransfer | GraphTransfer | GraphBatchedTransfer | ||
HashLockTransfer | LinkedTransfer | SignedTransfer | GraphTransfer | GraphBatchedTransfer | ||
>; | ||
[CONDITIONAL_TRANSFER_FAILED_EVENT]: ConditionalTransferFailedEventData< | ||
HashLockTransfer | LinkedTransfer | | ||
SignedTransfer | GraphTransfer | GraphBatchedTransfer | ||
HashLockTransfer | LinkedTransfer | SignedTransfer | GraphTransfer | GraphBatchedTransfer | ||
>; | ||
@@ -282,3 +280,3 @@ [CREATE_CHANNEL_EVENT]: CreateMultisigEventData; | ||
} as const; | ||
export type EventName = keyof typeof EventNames; | ||
export type EventName = keyof typeof EventNames | keyof typeof WatcherEvents; | ||
export type EventPayload = { | ||
@@ -350,12 +348,9 @@ [P in keyof EventPayloadMap]: EventPayloadMap[P]; | ||
export type ConditionalTransferCreated<T> = ConditionalTransferCreatedEventData< | ||
HashLockTransfer | LinkedTransfer | | ||
SignedTransfer | GraphTransfer | GraphBatchedTransfer | ||
HashLockTransfer | LinkedTransfer | SignedTransfer | GraphTransfer | GraphBatchedTransfer | ||
>; | ||
export type ConditionalTransferUnlocked<T> = ConditionalTransferUnlockedEventData< | ||
HashLockTransfer | LinkedTransfer | | ||
SignedTransfer | GraphTransfer | GraphBatchedTransfer | ||
HashLockTransfer | LinkedTransfer | SignedTransfer | GraphTransfer | GraphBatchedTransfer | ||
>; | ||
export type ConditionalTransferFailed<T> = ConditionalTransferFailedEventData< | ||
HashLockTransfer | LinkedTransfer | | ||
SignedTransfer | GraphTransfer | GraphBatchedTransfer | ||
HashLockTransfer | LinkedTransfer | SignedTransfer | GraphTransfer | GraphBatchedTransfer | ||
>; | ||
@@ -362,0 +357,0 @@ export type DepositStarted = DepositStartedEventData; |
@@ -1,5 +0,4 @@ | ||
import { Address, BigNumber, Bytes32, PublicIdentifier, TransactionReceipt } from "./basic"; | ||
import { Address, BigNumber, Bytes32, PublicIdentifier, TransactionResponse } from "./basic"; | ||
import { enumify } from "./utils"; | ||
import { MinimalTransaction } from "./commitments"; | ||
import { StateChannelJSON } from "./state"; | ||
@@ -58,4 +57,5 @@ export type RebalanceProfile = { | ||
transaction: MinimalTransaction, | ||
channel: StateChannelJSON, | ||
): Promise<TransactionReceipt>; | ||
chainId: number, | ||
multisigAddress?: string, | ||
): Promise<TransactionResponse>; | ||
} |
import { providers } from "ethers"; | ||
import { Address, BigNumber, Bytes32, DecString, Network, PublicIdentifier } from "./basic"; | ||
import { | ||
Address, | ||
BigNumber, | ||
Bytes32, | ||
DecString, | ||
Network, | ||
PublicIdentifier, | ||
TransactionResponse, | ||
} from "./basic"; | ||
import { | ||
ConditionalTransactionCommitmentJSON, | ||
@@ -9,3 +17,2 @@ MinimalTransaction, | ||
} from "./commitments"; | ||
import { MethodResults } from "./methods"; | ||
import { PublicResults } from "./public"; | ||
@@ -105,2 +112,4 @@ import { StateChannelJSON } from "./state"; | ||
type CancelChallengeResponse = TransactionResponse; | ||
//////////////////////////////////// | ||
@@ -125,2 +134,3 @@ // exports | ||
export type ChannelRestore = ChannelRestoreResponse; | ||
export type CancelChallenge = CancelChallengeResponse; | ||
} |
@@ -7,4 +7,15 @@ import { providers, BigNumberish } from "ethers"; | ||
import { NodeResponses } from "./node"; | ||
import { ChallengeInitiatedResponse } from "./watcher"; | ||
//////////////////////////////////////// | ||
// disputes | ||
type InitiateChallengeParameters = { | ||
appIdentityHash: string; | ||
}; | ||
type CancelChallengeParameters = { | ||
appIdentityHash: string; | ||
}; | ||
//////////////////////////////////////// | ||
// deposit | ||
@@ -85,4 +96,4 @@ | ||
conditionType: | ||
typeof ConditionalTransferTypes.LinkedTransfer | | ||
typeof ConditionalTransferTypes.OnlineTransfer | ||
| typeof ConditionalTransferTypes.LinkedTransfer | ||
| typeof ConditionalTransferTypes.OnlineTransfer; | ||
amount: BigNumberish; | ||
@@ -103,3 +114,3 @@ assetId?: Address; | ||
type ResolveLinkedTransferParameters = { | ||
conditionType: typeof ConditionalTransferTypes.LinkedTransfer | ||
conditionType: typeof ConditionalTransferTypes.LinkedTransfer; | ||
paymentId: Bytes32; | ||
@@ -343,5 +354,8 @@ preImage: Bytes32; | ||
export type Withdraw = WithdrawParameters; | ||
export type InitiateChallenge = InitiateChallengeParameters; | ||
export type CancelChallenge = CancelChallengeParameters; | ||
} | ||
export type PublicParam = | ||
| CancelChallengeParameters | ||
| CheckDepositRightsParameters | ||
@@ -351,2 +365,3 @@ | ConditionalTransferParameters | ||
| HashLockTransferParameters | ||
| InitiateChallengeParameters | ||
| LinkedTransferParameters | ||
@@ -388,2 +403,4 @@ | RequestDepositRightsParameters | ||
export type Withdraw = WithdrawResponse; | ||
export type InitiateChallenge = ChallengeInitiatedResponse; | ||
export type CancelChallenge = providers.TransactionResponse; | ||
} | ||
@@ -397,2 +414,4 @@ | ||
| LinkedTransferResponse | ||
| PublicResults.CancelChallenge | ||
| PublicResults.InitiateChallenge | ||
| RequestCollateralResponse | ||
@@ -399,0 +418,0 @@ | RequestDepositRightsResponse |
117
src/store.ts
@@ -0,1 +1,3 @@ | ||
import { providers } from "ethers"; | ||
import { AppInstanceJson } from "./app"; | ||
@@ -8,4 +10,8 @@ import { Address, Bytes32 } from "./basic"; | ||
} from "./commitments"; | ||
import { | ||
ChallengeUpdatedEventPayload, | ||
StateProgressedEventPayload, | ||
} from "./contracts"; | ||
import { StateChannelJSON } from "./state"; | ||
import { IWatcherStoreService } from "./watcher"; | ||
import { StoredAppChallenge } from "./watcher"; | ||
@@ -34,21 +40,20 @@ export const ConnextNodeStorePrefix = "INDRA_NODE_CF_CORE"; | ||
// TODO: merge IWatcherStoreService & IStoreService? | ||
// IWatcherStoreService contains all event/challenge storage methods | ||
// in addition to all the getters for the setters defined below | ||
export interface IStoreService extends IWatcherStoreService { | ||
///// Schema version | ||
updateSchemaVersion(version?: number): Promise<void>; | ||
//////////////////////////////////////// | ||
// Main Store Interface | ||
///// Client Store Methods | ||
getUserWithdrawals(): Promise<WithdrawalMonitorObject[]>; | ||
saveUserWithdrawal(withdrawalObject: WithdrawalMonitorObject): Promise<void>; | ||
removeUserWithdrawal(toRemove: WithdrawalMonitorObject): Promise<void>; | ||
export interface IStoreService { | ||
///// State channels | ||
createStateChannel( | ||
stateChannel: StateChannelJSON, | ||
signedSetupCommitment: MinimalTransaction, | ||
signedFreeBalanceUpdate: SetStateCommitmentJSON, | ||
): Promise<void>; | ||
//// Admin methods | ||
init(): Promise<void>; | ||
clear(): Promise<void>; | ||
close(): Promise<void>; | ||
restore(): Promise<void>; | ||
//// Misc Getters | ||
getFreeBalance(multisigAddress: Address): Promise<AppInstanceJson | undefined>; | ||
getLatestProcessedBlock(): Promise<number>; | ||
//// Misc Setters | ||
addOnchainAction(appIdentityHash: Bytes32, provider: providers.JsonRpcProvider): Promise<void>; | ||
updateLatestProcessedBlock(blockNumber: number): Promise<void>; | ||
updateNumProposedApps( | ||
@@ -60,19 +65,14 @@ multisigAddress: string, | ||
///// App proposals | ||
createAppProposal( | ||
multisigAddress: Address, | ||
appProposal: AppInstanceJson, | ||
numProposedApps: number, | ||
signedSetStateCommitment: SetStateCommitmentJSON, | ||
signedConditionalTxCommitment: ConditionalTransactionCommitmentJSON, | ||
stateChannel?: StateChannelJSON, | ||
): Promise<void>; | ||
removeAppProposal( | ||
multisigAddress: Address, | ||
appIdentityHash: Bytes32, | ||
stateChannel?: StateChannelJSON, | ||
): Promise<void>; | ||
// proposals dont need to be updated | ||
//// AppChallenges | ||
getActiveChallenges(): Promise<StoredAppChallenge[]>; | ||
getAppChallenge(appIdentityHash: Bytes32): Promise<StoredAppChallenge | undefined>; | ||
saveAppChallenge(data: ChallengeUpdatedEventPayload | StoredAppChallenge): Promise<void>; | ||
///// App instances | ||
//// AppChallenge Events | ||
createChallengeUpdatedEvent(event: ChallengeUpdatedEventPayload): Promise<void>; | ||
createStateProgressedEvent(event: StateProgressedEventPayload): Promise<void>; | ||
getChallengeUpdatedEvents(appIdentityHash: Bytes32): Promise<ChallengeUpdatedEventPayload[]>; | ||
getStateProgressedEvents(appIdentityHash: Bytes32): Promise<StateProgressedEventPayload[]>; | ||
//// AppInstance | ||
createAppInstance( | ||
@@ -85,2 +85,3 @@ multisigAddress: Address, | ||
): Promise<void>; | ||
getAppInstance(appIdentityHash: Bytes32): Promise<AppInstanceJson | undefined>; | ||
updateAppInstance( | ||
@@ -100,8 +101,48 @@ multisigAddress: Address, | ||
///// Resetting methods | ||
clear(): Promise<void>; | ||
restore(): Promise<void>; | ||
//// AppProposal | ||
createAppProposal( | ||
multisigAddress: Address, | ||
appProposal: AppInstanceJson, | ||
numProposedApps: number, | ||
signedSetStateCommitment: SetStateCommitmentJSON, | ||
signedConditionalTxCommitment: ConditionalTransactionCommitmentJSON, | ||
stateChannel?: StateChannelJSON, | ||
): Promise<void>; | ||
getAppProposal(appIdentityHash: Bytes32): Promise<AppInstanceJson | undefined>; | ||
removeAppProposal( | ||
multisigAddress: Address, | ||
appIdentityHash: Bytes32, | ||
stateChannel?: StateChannelJSON, | ||
): Promise<void>; | ||
init(): Promise<void>; | ||
close(): Promise<void>; | ||
//// Commitments | ||
getConditionalTransactionCommitment( | ||
appIdentityHash: Bytes32, | ||
): Promise<ConditionalTransactionCommitmentJSON | undefined>; | ||
getSetStateCommitments(appIdentityHash: Bytes32): Promise<SetStateCommitmentJSON[]>; | ||
getSetupCommitment(multisigAddress: Address): Promise<MinimalTransaction | undefined>; | ||
//// SchemaVersion | ||
getSchemaVersion(): Promise<number>; | ||
updateSchemaVersion(version?: number): Promise<void>; | ||
//// State Channels | ||
getStateChannel(multisigAddress: Address): Promise<StateChannelJSON | undefined>; | ||
getStateChannelByAppIdentityHash(appIdentityHash: Bytes32): Promise<StateChannelJSON | undefined>; | ||
getStateChannelByOwnersAndChainId( | ||
owners: Address[], | ||
chainId: number, | ||
): Promise<StateChannelJSON | undefined>; | ||
getAllChannels(): Promise<StateChannelJSON[]>; | ||
createStateChannel( | ||
stateChannel: StateChannelJSON, | ||
signedSetupCommitment: MinimalTransaction, | ||
signedFreeBalanceUpdate: SetStateCommitmentJSON, | ||
): Promise<void>; | ||
//// User Withdrawals | ||
saveUserWithdrawal(withdrawalObject: WithdrawalMonitorObject): Promise<void>; | ||
getUserWithdrawals(): Promise<WithdrawalMonitorObject[]>; | ||
removeUserWithdrawal(toRemove: WithdrawalMonitorObject): Promise<void>; | ||
} |
import { providers } from "ethers"; | ||
import { Address, Bytes32 } from "./basic"; | ||
import { | ||
AppChallenge, | ||
ChallengeEvent, | ||
ChallengeEventData, | ||
ChallengeUpdatedEventPayload, | ||
SignedCancelChallengeRequest, | ||
StateProgressedEventPayload, | ||
ChallengeEvents, | ||
} from "./contracts"; | ||
import { StateChannelJSON } from "./state"; | ||
import { Address, Bytes32 } from "./basic"; | ||
import { AppInstanceJson } from "./app"; | ||
import { | ||
ConditionalTransactionCommitmentJSON, | ||
MinimalTransaction, | ||
SetStateCommitmentJSON, | ||
} from "./commitments"; | ||
import { IChannelSigner } from "./crypto"; | ||
import { ILoggerService, ILogger } from "./logger"; | ||
import { Ctx } from "evt"; | ||
import { IOnchainTransactionService } from "./misc"; | ||
import { ContractAddressBook } from "./node"; | ||
import { IStoreService } from "./store"; | ||
@@ -32,5 +23,5 @@ //////////////////////////////////////// | ||
context: ContractAddressBook; | ||
store: IWatcherStoreService; | ||
store: IStoreService; | ||
logger?: ILoggerService | ILogger; | ||
logLevel?: number; | ||
transactionService?: IOnchainTransactionService; | ||
}; | ||
@@ -46,2 +37,3 @@ | ||
}; | ||
type BaseChallengeTransactionFailedEvent = { | ||
@@ -56,31 +48,31 @@ appInstanceId: Bytes32; | ||
//////////////////////////////////////// | ||
export const ChallengeProgressedEvent = "ChallengeProgressedEvent"; | ||
export const CHALLENGE_PROGRESSED_EVENT = "CHALLENGE_PROGRESSED_EVENT"; | ||
export type ChallengeProgressedEventData = BaseChallengeTransactionCompletedEvent; | ||
//////////////////////////////////////// | ||
export const ChallengeProgressionFailedEvent = "ChallengeProgressionFailedEvent"; | ||
export const CHALLENGE_PROGRESSION_FAILED_EVENT = "CHALLENGE_PROGRESSION_FAILED_EVENT"; | ||
export type ChallengeProgressionFailedEventData = BaseChallengeTransactionFailedEvent; | ||
//////////////////////////////////////// | ||
export const ChallengeCompletedEvent = "ChallengeCompletedEvent"; | ||
export const CHALLENGE_COMPLETED_EVENT = "CHALLENGE_COMPLETED_EVENT"; | ||
export type ChallengeCompletedEventData = BaseChallengeTransactionCompletedEvent; | ||
//////////////////////////////////////// | ||
export const ChallengeCompletionFailedEvent = "ChallengeCompletionFailedEvent"; | ||
export const CHALLENGE_COMPLETION_FAILED_EVENT = "CHALLENGE_COMPLETION_FAILED_EVENT"; | ||
export type ChallengeCompletionFailedEventData = BaseChallengeTransactionFailedEvent; | ||
//////////////////////////////////////// | ||
export const ChallengeOutcomeSetEvent = "ChallengeOutcomeSetEvent"; | ||
export const CHALLENGE_OUTCOME_SET_EVENT = "CHALLENGE_OUTCOME_SET_EVENT"; | ||
export type ChallengeOutcomeSetEventData = BaseChallengeTransactionCompletedEvent; | ||
//////////////////////////////////////// | ||
export const ChallengeOutcomeFailedEvent = "ChallengeOutcomeFailedEvent"; | ||
export const CHALLENGE_OUTCOME_FAILED_EVENT = "CHALLENGE_OUTCOME_FAILED_EVENT"; | ||
export type ChallengeOutcomeFailedEventData = BaseChallengeTransactionFailedEvent; | ||
//////////////////////////////////////// | ||
export const ChallengeCancelledEvent = "ChallengeCancelledEvent"; | ||
export const CHALLENGE_CANCELLED_EVENT = "CHALLENGE_CANCELLED_EVENT"; | ||
export type ChallengeCancelledEventData = BaseChallengeTransactionCompletedEvent; | ||
//////////////////////////////////////// | ||
export const ChallengeCancellationFailedEvent = "ChallengeCancellationFailedEvent"; | ||
export const CHALLENGE_CANCELLATION_FAILED_EVENT = "CHALLENGE_CANCELLATION_FAILED_EVENT"; | ||
export type ChallengeCancellationFailedEventData = BaseChallengeTransactionFailedEvent; | ||
@@ -90,6 +82,6 @@ | ||
/// From contracts | ||
export const ChallengeUpdatedEvent = "ChallengeUpdatedEvent"; | ||
export const CHALLENGE_UPDATED_EVENT = "CHALLENGE_UPDATED_EVENT"; | ||
export type ChallengeUpdatedEventData = ChallengeEventData[typeof ChallengeEvents.ChallengeUpdated]; | ||
export const StateProgressedEvent = "StateProgressedEvent"; | ||
export const STATE_PROGRESSED_EVENT = "STATE_PROGRESSED_EVENT"; | ||
export type StateProgressedEventData = ChallengeEventData[typeof ChallengeEvents.StateProgressed]; | ||
@@ -99,26 +91,26 @@ | ||
export const WatcherEvents = { | ||
[ChallengeUpdatedEvent]: ChallengeUpdatedEvent, | ||
[StateProgressedEvent]: StateProgressedEvent, | ||
[ChallengeProgressedEvent]: ChallengeProgressedEvent, | ||
[ChallengeProgressionFailedEvent]: ChallengeProgressionFailedEvent, | ||
[ChallengeOutcomeSetEvent]: ChallengeOutcomeSetEvent, | ||
[ChallengeOutcomeFailedEvent]: ChallengeOutcomeFailedEvent, | ||
[ChallengeCompletedEvent]: ChallengeCompletedEvent, | ||
[ChallengeCompletionFailedEvent]: ChallengeCompletionFailedEvent, | ||
[ChallengeCancelledEvent]: ChallengeCancelledEvent, | ||
[ChallengeCancellationFailedEvent]: ChallengeCancellationFailedEvent, | ||
[CHALLENGE_UPDATED_EVENT]: CHALLENGE_UPDATED_EVENT, | ||
[STATE_PROGRESSED_EVENT]: STATE_PROGRESSED_EVENT, | ||
[CHALLENGE_PROGRESSED_EVENT]: CHALLENGE_PROGRESSED_EVENT, | ||
[CHALLENGE_PROGRESSION_FAILED_EVENT]: CHALLENGE_PROGRESSION_FAILED_EVENT, | ||
[CHALLENGE_OUTCOME_SET_EVENT]: CHALLENGE_OUTCOME_SET_EVENT, | ||
[CHALLENGE_OUTCOME_FAILED_EVENT]: CHALLENGE_OUTCOME_FAILED_EVENT, | ||
[CHALLENGE_COMPLETED_EVENT]: CHALLENGE_COMPLETED_EVENT, | ||
[CHALLENGE_COMPLETION_FAILED_EVENT]: CHALLENGE_COMPLETION_FAILED_EVENT, | ||
[CHALLENGE_CANCELLED_EVENT]: CHALLENGE_CANCELLED_EVENT, | ||
[CHALLENGE_CANCELLATION_FAILED_EVENT]: CHALLENGE_CANCELLATION_FAILED_EVENT, | ||
} as const; | ||
export type WatcherEvent = keyof typeof WatcherEvents; | ||
interface WatcherEventDataMap { | ||
[ChallengeUpdatedEvent]: ChallengeUpdatedEventData; | ||
[StateProgressedEvent]: StateProgressedEventData; | ||
[ChallengeProgressedEvent]: ChallengeProgressedEventData; | ||
[ChallengeProgressionFailedEvent]: ChallengeProgressionFailedEventData; | ||
[ChallengeOutcomeFailedEvent]: ChallengeOutcomeFailedEventData; | ||
[ChallengeOutcomeSetEvent]: ChallengeOutcomeSetEventData; | ||
[ChallengeCompletedEvent]: ChallengeCompletedEventData; | ||
[ChallengeCompletionFailedEvent]: ChallengeCompletionFailedEventData; | ||
[ChallengeCancelledEvent]: ChallengeCancelledEventData; | ||
[ChallengeCancellationFailedEvent]: ChallengeCancellationFailedEventData; | ||
export interface WatcherEventDataMap { | ||
[CHALLENGE_UPDATED_EVENT]: ChallengeUpdatedEventData; | ||
[STATE_PROGRESSED_EVENT]: StateProgressedEventData; | ||
[CHALLENGE_PROGRESSED_EVENT]: ChallengeProgressedEventData; | ||
[CHALLENGE_PROGRESSION_FAILED_EVENT]: ChallengeProgressionFailedEventData; | ||
[CHALLENGE_OUTCOME_FAILED_EVENT]: ChallengeOutcomeFailedEventData; | ||
[CHALLENGE_OUTCOME_SET_EVENT]: ChallengeOutcomeSetEventData; | ||
[CHALLENGE_COMPLETED_EVENT]: ChallengeCompletedEventData; | ||
[CHALLENGE_COMPLETION_FAILED_EVENT]: ChallengeCompletionFailedEventData; | ||
[CHALLENGE_CANCELLED_EVENT]: ChallengeCancelledEventData; | ||
[CHALLENGE_CANCELLATION_FAILED_EVENT]: ChallengeCancellationFailedEventData; | ||
} | ||
@@ -130,10 +122,7 @@ export type WatcherEventData = { | ||
//////////////////////////////////////// | ||
// Listener Events | ||
//////////////////////////////////////// | ||
// Watcher interface | ||
export type ChallengeInitiatedResponse = { | ||
freeBalanceChallenge: providers.TransactionReceipt; | ||
appChallenge: providers.TransactionReceipt; | ||
freeBalanceChallenge: providers.TransactionResponse; | ||
appChallenge: providers.TransactionResponse; | ||
}; | ||
@@ -168,42 +157,8 @@ | ||
req: SignedCancelChallengeRequest, | ||
): Promise<providers.TransactionReceipt>; | ||
): Promise<providers.TransactionResponse>; | ||
} | ||
//////////////////////////////////////// | ||
// Listener interface | ||
// Storage | ||
export interface IChainListener { | ||
//////// Evt methods | ||
attach<T extends ChallengeEvent>( | ||
event: T, | ||
callback: (data: ChallengeEventData[T]) => Promise<void>, | ||
providedFilter?: (data: ChallengeEventData[T]) => boolean, | ||
ctx?: Ctx<ChallengeEventData[T]>, | ||
): void; | ||
attachOnce<T extends ChallengeEvent>( | ||
event: T, | ||
callback: (data: ChallengeEventData[T]) => Promise<void>, | ||
providedFilter?: (data: ChallengeEventData[T]) => boolean, | ||
ctx?: Ctx<ChallengeEventData[T]>, | ||
): void; | ||
waitFor<T extends ChallengeEvent>( | ||
event: T, | ||
timeout: number, | ||
providedFilter?: (data: ChallengeEventData[T]) => boolean, | ||
ctx?: Ctx<ChallengeEventData[T]>, | ||
): Promise<ChallengeEventData[T]>; | ||
createContext<T extends ChallengeEvent>(): Ctx<ChallengeEventData[T]>; | ||
detach<T extends ChallengeEvent>(ctx?: Ctx<ChallengeEventData[T]>): void; | ||
//////// Public methods | ||
enable(): Promise<void>; | ||
disable(): Promise<void>; | ||
parseLogsFrom(startingBlock: number): Promise<void>; | ||
} | ||
//////////////////////////////////////// | ||
// Storage | ||
// The status of a challenge in the ChallengeRegistry | ||
@@ -219,2 +174,3 @@ export enum StoredAppChallengeStatus { | ||
} | ||
export type StoredAppChallenge = Omit<AppChallenge, "status"> & { | ||
@@ -225,55 +181,1 @@ identityHash: Bytes32; | ||
}; | ||
export interface IWatcherStoreService { | ||
// Disputes | ||
getAppChallenge(appIdentityHash: Bytes32): Promise<StoredAppChallenge | undefined>; | ||
saveAppChallenge(data: ChallengeUpdatedEventPayload | StoredAppChallenge): Promise<void>; | ||
getActiveChallenges(): Promise<StoredAppChallenge[]>; | ||
// Events | ||
getLatestProcessedBlock(): Promise<number>; | ||
updateLatestProcessedBlock(blockNumber: number): Promise<void>; | ||
getStateProgressedEvents(appIdentityHash: Bytes32): Promise<StateProgressedEventPayload[]>; | ||
createStateProgressedEvent(event: StateProgressedEventPayload): Promise<void>; | ||
getChallengeUpdatedEvents(appIdentityHash: Bytes32): Promise<ChallengeUpdatedEventPayload[]>; | ||
createChallengeUpdatedEvent(event: ChallengeUpdatedEventPayload): Promise<void>; | ||
addOnchainAction(appIdentityHash: Bytes32, provider: providers.JsonRpcProvider): Promise<void>; | ||
//////////////////////////////////////// | ||
//// Channel data | ||
// Schema version | ||
getSchemaVersion(): Promise<number>; | ||
// State channels | ||
getAllChannels(): Promise<StateChannelJSON[]>; | ||
getStateChannel(multisigAddress: Address): Promise<StateChannelJSON | undefined>; | ||
getStateChannelByOwnersAndChainId( | ||
owners: Address[], | ||
chainId: number, | ||
): Promise<StateChannelJSON | undefined>; | ||
getStateChannelByAppIdentityHash(appIdentityHash: Bytes32): Promise<StateChannelJSON | undefined>; | ||
// App instances | ||
getAppInstance(appIdentityHash: Bytes32): Promise<AppInstanceJson | undefined>; | ||
// App proposals | ||
getAppProposal(appIdentityHash: Bytes32): Promise<AppInstanceJson | undefined>; | ||
// Free balance | ||
getFreeBalance(multisigAddress: Address): Promise<AppInstanceJson | undefined>; | ||
// Setup commitment | ||
getSetupCommitment(multisigAddress: Address): Promise<MinimalTransaction | undefined>; | ||
// SetState commitment | ||
getSetStateCommitments(appIdentityHash: Bytes32): Promise<SetStateCommitmentJSON[]>; | ||
// Conditional tx commitment | ||
getConditionalTransactionCommitment( | ||
appIdentityHash: Bytes32, | ||
): Promise<ConditionalTransactionCommitmentJSON | undefined>; | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
859546
7341