@connext/apps
Advanced tools
Comparing version 6.0.0-alpha.2 to 6.0.0-alpha3
@@ -1,3 +0,2 @@ | ||
export * from "./convert"; | ||
export * from "./registry"; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,3 +0,2 @@ | ||
export * from "./convert"; | ||
export * from "./registry"; | ||
//# sourceMappingURL=index.js.map |
@@ -1,8 +0,8 @@ | ||
import { coinBalanceRefundAppStateEncoding, OutcomeType, CoinBalanceRefundApp, } from "@connext/types"; | ||
import { CoinBalanceRefundAppName, CoinBalanceRefundAppStateEncoding, OutcomeType, } from "@connext/types"; | ||
export const CoinBalanceRefundAppRegistryInfo = { | ||
allowNodeInstall: true, | ||
name: CoinBalanceRefundApp, | ||
name: CoinBalanceRefundAppName, | ||
outcomeType: OutcomeType.SINGLE_ASSET_TWO_PARTY_COIN_TRANSFER, | ||
stateEncoding: coinBalanceRefundAppStateEncoding, | ||
stateEncoding: CoinBalanceRefundAppStateEncoding, | ||
}; | ||
//# sourceMappingURL=registry.js.map |
@@ -1,4 +0,3 @@ | ||
export * from "./convert"; | ||
export * from "./registry"; | ||
export * from "./validation"; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,4 +0,3 @@ | ||
export * from "./convert"; | ||
export * from "./registry"; | ||
export * from "./validation"; | ||
//# sourceMappingURL=index.js.map |
@@ -1,5 +0,5 @@ | ||
import { OutcomeType, FastSignedTransferAppStateEncoding, FastSignedTransferAppActionEncoding, FastSignedTransferApp, } from "@connext/types"; | ||
import { FastSignedTransferAppActionEncoding, FastSignedTransferAppName, FastSignedTransferAppStateEncoding, OutcomeType, } from "@connext/types"; | ||
export const FastSignedTransferAppRegistryInfo = { | ||
allowNodeInstall: true, | ||
name: FastSignedTransferApp, | ||
name: FastSignedTransferAppName, | ||
outcomeType: OutcomeType.SINGLE_ASSET_TWO_PARTY_COIN_TRANSFER, | ||
@@ -6,0 +6,0 @@ stateEncoding: FastSignedTransferAppStateEncoding, |
@@ -1,2 +0,14 @@ | ||
export declare const validateFastSignedTransferApp: (params: import("@connext/types").ProtocolTypes.ProposeInstallParams, initiatorPublicIdentifier: string, responderPublicIdentifier: string) => void; | ||
export declare const validateFastSignedTransferApp: (params: { | ||
appDefinition: string; | ||
abiEncodings: import("@connext/types").AppABIEncodings; | ||
initiatorDeposit: import("ethers/utils").BigNumber; | ||
initiatorDepositTokenAddress: string; | ||
responderDeposit: import("ethers/utils").BigNumber; | ||
responderDepositTokenAddress: string; | ||
timeout: import("ethers/utils").BigNumber; | ||
initialState: import("@connext/types").AppState; | ||
proposedToIdentifier: string; | ||
outcomeType: "TWO_PARTY_FIXED_OUTCOME" | "MULTI_ASSET_MULTI_PARTY_COIN_TRANSFER" | "SINGLE_ASSET_TWO_PARTY_COIN_TRANSFER"; | ||
meta?: Object | undefined; | ||
}, initiatorPublicIdentifier: string, responderPublicIdentifier: string) => void; | ||
//# sourceMappingURL=validation.d.ts.map |
@@ -1,9 +0,7 @@ | ||
import { bigNumberifyObj } from "@connext/types"; | ||
import { xkeyKthAddress } from "@connext/cf-core"; | ||
import { HashZero } from "ethers/constants"; | ||
import { unidirectionalCoinTransferValidation } from "../shared"; | ||
import { convertFastSignedTransferAppState } from "./convert"; | ||
import { HashZero } from "ethers/constants"; | ||
export const validateFastSignedTransferApp = (params, initiatorPublicIdentifier, responderPublicIdentifier) => { | ||
const { responderDeposit, initiatorDeposit, initialState: initialStateBadType } = bigNumberifyObj(params); | ||
const initialState = convertFastSignedTransferAppState("bignumber", initialStateBadType); | ||
const { responderDeposit, initiatorDeposit } = params; | ||
const initialState = params.initialState; | ||
if (initialState.paymentId !== HashZero) { | ||
@@ -10,0 +8,0 @@ throw new Error(`Cannot install with pre-populated paymentId`); |
@@ -1,4 +0,3 @@ | ||
export * from "./convert"; | ||
export * from "./registry"; | ||
export * from "./validation"; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,4 +0,3 @@ | ||
export * from "./convert"; | ||
export * from "./registry"; | ||
export * from "./validation"; | ||
//# sourceMappingURL=index.js.map |
@@ -1,4 +0,4 @@ | ||
import { OutcomeType, HashLockTransferAppActionEncoding, HashLockTransferAppStateEncoding, HashLockTransferApp, } from "@connext/types"; | ||
import { OutcomeType, HashLockTransferAppActionEncoding, HashLockTransferAppStateEncoding, HashLockTransferAppName, } from "@connext/types"; | ||
export const HashLockTransferAppRegistryInfo = { | ||
name: HashLockTransferApp, | ||
name: HashLockTransferAppName, | ||
allowNodeInstall: true, | ||
@@ -5,0 +5,0 @@ actionEncoding: HashLockTransferAppActionEncoding, |
@@ -1,2 +0,14 @@ | ||
export declare const validateHashLockTransferApp: (params: import("@connext/types").ProtocolTypes.ProposeInstallParams, blockNumber: number, initiatorPublicIdentifier: string, responderPublicIdentifier: string) => void; | ||
export declare const validateHashLockTransferApp: (params: { | ||
appDefinition: string; | ||
abiEncodings: import("@connext/types").AppABIEncodings; | ||
initiatorDeposit: import("ethers/utils").BigNumber; | ||
initiatorDepositTokenAddress: string; | ||
responderDeposit: import("ethers/utils").BigNumber; | ||
responderDepositTokenAddress: string; | ||
timeout: import("ethers/utils").BigNumber; | ||
initialState: import("@connext/types").AppState; | ||
proposedToIdentifier: string; | ||
outcomeType: "TWO_PARTY_FIXED_OUTCOME" | "MULTI_ASSET_MULTI_PARTY_COIN_TRANSFER" | "SINGLE_ASSET_TWO_PARTY_COIN_TRANSFER"; | ||
meta?: Object | undefined; | ||
}, blockNumber: number, initiatorPublicIdentifier: string, responderPublicIdentifier: string) => void; | ||
//# sourceMappingURL=validation.d.ts.map |
import { xkeyKthAddress } from "@connext/cf-core"; | ||
import { bigNumberifyObj } from "@connext/types"; | ||
import { unidirectionalCoinTransferValidation } from "../shared"; | ||
import { convertHashLockTransferAppState } from "./convert"; | ||
export const validateHashLockTransferApp = (params, blockNumber, initiatorPublicIdentifier, responderPublicIdentifier) => { | ||
const { responderDeposit, initiatorDeposit, initialState: initialStateBadType } = bigNumberifyObj(params); | ||
const { responderDeposit, initiatorDeposit } = params; | ||
const initialState = params.initialState; | ||
const initiatorFreeBalanceAddress = xkeyKthAddress(initiatorPublicIdentifier); | ||
const responderFreeBalanceAddress = xkeyKthAddress(responderPublicIdentifier); | ||
const initialState = convertHashLockTransferAppState("bignumber", initialStateBadType); | ||
const initiatorTransfer = initialState.coinTransfers.filter((transfer) => { | ||
@@ -11,0 +9,0 @@ return transfer.to === initiatorFreeBalanceAddress; |
@@ -1,25 +0,17 @@ | ||
import { SimpleLinkedTransferAppAction, SimpleSwapAppState, SimpleLinkedTransferAppState, FastSignedTransferAppAction, FastSignedTransferAppState, WithdrawAppAction, WithdrawAppState, CoinBalanceRefundApp, SimpleLinkedTransferApp, SimpleTwoPartySwapApp, FastSignedTransferApp, HashLockTransferApp, HashLockTransferAppAction, HashLockTransferAppState, WithdrawApp } from "@connext/types"; | ||
import { BigNumber } from "ethers/utils"; | ||
import { AppRegistry as AppRegistryType } from "./shared"; | ||
import { AppRegistryType } from "./shared"; | ||
import { CoinBalanceRefundAppRegistryInfo } from "./CoinBalanceRefundApp"; | ||
import { FastSignedTransferAppRegistryInfo } from "./FastSignedTransferApp"; | ||
import { SimpleLinkedTransferAppRegistryInfo } from "./SimpleLinkedTransferApp"; | ||
import { SimpleSignedTransferAppRegistryInfo } from "./SimpleSignedTransferApp"; | ||
import { SimpleTwoPartySwapAppRegistryInfo } from "./SimpleTwoPartySwapApp"; | ||
export declare const AppRegistry: AppRegistryType; | ||
export * from "./shared"; | ||
export * from "./CoinBalanceRefundApp"; | ||
export * from "./FastSignedTransferApp"; | ||
export * from "./HashLockTransferApp"; | ||
export * from "./SimpleLinkedTransferApp"; | ||
export * from "./SimpleSignedTransferApp"; | ||
export * from "./SimpleTwoPartySwapApp"; | ||
export * from "./CoinBalanceRefundApp"; | ||
export * from "./WithdrawApp"; | ||
export * from "./HashLockTransferApp"; | ||
export declare const SupportedApplications: { | ||
[CoinBalanceRefundApp]: string; | ||
[SimpleLinkedTransferApp]: string; | ||
[SimpleTwoPartySwapApp]: string; | ||
[FastSignedTransferApp]: string; | ||
[WithdrawApp]: string; | ||
[HashLockTransferApp]: string; | ||
}; | ||
export declare type SupportedApplication = keyof typeof SupportedApplications; | ||
export declare const AppRegistry: AppRegistryType; | ||
export declare type AppAction<T = string> = FastSignedTransferAppAction<T> | HashLockTransferAppAction | SimpleLinkedTransferAppAction | WithdrawAppAction; | ||
export declare type AppActionBigNumber = AppAction<BigNumber>; | ||
export declare type AppState<T = string> = FastSignedTransferAppState<T> | HashLockTransferAppState<T> | SimpleLinkedTransferAppState<T> | SimpleSwapAppState<T> | WithdrawAppState<T>; | ||
export declare type AppStateBigNumber = AppState<BigNumber>; | ||
export { FastSignedTransferAppRegistryInfo, AppRegistryType, SimpleLinkedTransferAppRegistryInfo, SimpleSignedTransferAppRegistryInfo, SimpleTwoPartySwapAppRegistryInfo, CoinBalanceRefundAppRegistryInfo, }; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,26 +0,12 @@ | ||
import { CoinBalanceRefundApp, SimpleLinkedTransferApp, SimpleTwoPartySwapApp, FastSignedTransferApp, HashLockTransferApp, WithdrawApp, } from "@connext/types"; | ||
import { WithdrawAppRegistryInfo } from "./WithdrawApp"; | ||
import { CoinBalanceRefundAppRegistryInfo } from "./CoinBalanceRefundApp"; | ||
import { FastSignedTransferAppRegistryInfo } from "./FastSignedTransferApp"; | ||
import { HashLockTransferAppRegistryInfo } from "./HashLockTransferApp"; | ||
import { SimpleLinkedTransferAppRegistryInfo } from "./SimpleLinkedTransferApp"; | ||
import { SimpleSignedTransferAppRegistryInfo } from "./SimpleSignedTransferApp"; | ||
import { SimpleTwoPartySwapAppRegistryInfo } from "./SimpleTwoPartySwapApp"; | ||
import { CoinBalanceRefundAppRegistryInfo } from "./CoinBalanceRefundApp"; | ||
import { HashLockTransferAppRegistryInfo } from "./HashLockTransferApp"; | ||
export * from "./shared"; | ||
export * from "./FastSignedTransferApp"; | ||
export * from "./SimpleLinkedTransferApp"; | ||
export * from "./SimpleTwoPartySwapApp"; | ||
export * from "./CoinBalanceRefundApp"; | ||
export * from "./WithdrawApp"; | ||
export * from "./HashLockTransferApp"; | ||
export const SupportedApplications = { | ||
[CoinBalanceRefundApp]: CoinBalanceRefundApp, | ||
[SimpleLinkedTransferApp]: SimpleLinkedTransferApp, | ||
[SimpleTwoPartySwapApp]: SimpleTwoPartySwapApp, | ||
[FastSignedTransferApp]: FastSignedTransferApp, | ||
[WithdrawApp]: WithdrawApp, | ||
[HashLockTransferApp]: HashLockTransferApp, | ||
}; | ||
import { WithdrawAppRegistryInfo } from "./WithdrawApp"; | ||
export const AppRegistry = [ | ||
FastSignedTransferAppRegistryInfo, | ||
SimpleLinkedTransferAppRegistryInfo, | ||
SimpleSignedTransferAppRegistryInfo, | ||
SimpleTwoPartySwapAppRegistryInfo, | ||
@@ -31,2 +17,11 @@ CoinBalanceRefundAppRegistryInfo, | ||
]; | ||
export * from "./shared"; | ||
export * from "./CoinBalanceRefundApp"; | ||
export * from "./FastSignedTransferApp"; | ||
export * from "./HashLockTransferApp"; | ||
export * from "./SimpleLinkedTransferApp"; | ||
export * from "./SimpleSignedTransferApp"; | ||
export * from "./SimpleTwoPartySwapApp"; | ||
export * from "./WithdrawApp"; | ||
export { FastSignedTransferAppRegistryInfo, SimpleLinkedTransferAppRegistryInfo, SimpleSignedTransferAppRegistryInfo, SimpleTwoPartySwapAppRegistryInfo, CoinBalanceRefundAppRegistryInfo, }; | ||
//# sourceMappingURL=index.js.map |
@@ -0,2 +1,3 @@ | ||
export * from "./registry"; | ||
export * from "./validation"; | ||
//# sourceMappingURL=index.js.map |
@@ -1,11 +0,20 @@ | ||
import { OutcomeType } from "@connext/types"; | ||
import { SupportedApplication } from ".."; | ||
import { CoinBalanceRefundAppName, FastSignedTransferAppName, HashLockTransferAppName, OutcomeType, SimpleLinkedTransferAppName, SimpleSignedTransferAppName, SimpleTwoPartySwapAppName, WithdrawAppName } from "@connext/types"; | ||
export declare const SupportedApplications: { | ||
[CoinBalanceRefundAppName]: "CoinBalanceRefundApp"; | ||
[SimpleLinkedTransferAppName]: "SimpleLinkedTransferApp"; | ||
[SimpleSignedTransferAppName]: "SimpleSignedTransferApp"; | ||
[SimpleTwoPartySwapAppName]: "SimpleTwoPartySwapApp"; | ||
[FastSignedTransferAppName]: "FastSignedTransferApp"; | ||
[WithdrawAppName]: "WithdrawApp"; | ||
[HashLockTransferAppName]: "HashLockTransferApp"; | ||
}; | ||
export declare type SupportedApplications = (typeof SupportedApplications)[keyof typeof SupportedApplications]; | ||
export declare type AppRegistryInfo = { | ||
actionEncoding?: string; | ||
allowNodeInstall: boolean; | ||
name: SupportedApplication; | ||
name: SupportedApplications; | ||
outcomeType: OutcomeType; | ||
stateEncoding: string; | ||
}; | ||
export declare type AppRegistry = AppRegistryInfo[]; | ||
export declare type AppRegistryType = AppRegistryInfo[]; | ||
//# sourceMappingURL=registry.d.ts.map |
@@ -0,1 +1,11 @@ | ||
import { CoinBalanceRefundAppName, enumify, FastSignedTransferAppName, HashLockTransferAppName, SimpleLinkedTransferAppName, SimpleSignedTransferAppName, SimpleTwoPartySwapAppName, WithdrawAppName, } from "@connext/types"; | ||
export const SupportedApplications = enumify({ | ||
[CoinBalanceRefundAppName]: CoinBalanceRefundAppName, | ||
[SimpleLinkedTransferAppName]: SimpleLinkedTransferAppName, | ||
[SimpleSignedTransferAppName]: SimpleSignedTransferAppName, | ||
[SimpleTwoPartySwapAppName]: SimpleTwoPartySwapAppName, | ||
[FastSignedTransferAppName]: FastSignedTransferAppName, | ||
[WithdrawAppName]: WithdrawAppName, | ||
[HashLockTransferAppName]: HashLockTransferAppName, | ||
}); | ||
//# sourceMappingURL=registry.js.map |
@@ -0,6 +1,19 @@ | ||
import { CoinTransfer } from "@connext/types"; | ||
import { BigNumber } from "ethers/utils"; | ||
import { AppRegistryInfo } from "./registry"; | ||
import { BigNumber } from "ethers/utils"; | ||
export declare const baseCoinTransferValidation: (initiatorDeposit: BigNumber, responderDeposit: BigNumber, initiatorTransfer: import("@connext/types").CoinTransfer<BigNumber>, responderTransfer: import("@connext/types").CoinTransfer<BigNumber>) => void; | ||
export declare const unidirectionalCoinTransferValidation: (initiatorDeposit: BigNumber, responderDeposit: BigNumber, initiatorTransfer: import("@connext/types").CoinTransfer<BigNumber>, responderTransfer: import("@connext/types").CoinTransfer<BigNumber>) => void; | ||
export declare const commonAppProposalValidation: (params: import("@connext/types").ProtocolTypes.ProposeInstallParams, appRegistryInfo: AppRegistryInfo, supportedTokenAddresses: string[]) => void; | ||
export declare const baseCoinTransferValidation: (initiatorDeposit: BigNumber, responderDeposit: BigNumber, initiatorTransfer: CoinTransfer, responderTransfer: CoinTransfer) => void; | ||
export declare const unidirectionalCoinTransferValidation: (initiatorDeposit: BigNumber, responderDeposit: BigNumber, initiatorTransfer: CoinTransfer, responderTransfer: CoinTransfer) => void; | ||
export declare const commonAppProposalValidation: (params: { | ||
appDefinition: string; | ||
abiEncodings: import("@connext/types").AppABIEncodings; | ||
initiatorDeposit: BigNumber; | ||
initiatorDepositTokenAddress: string; | ||
responderDeposit: BigNumber; | ||
responderDepositTokenAddress: string; | ||
timeout: BigNumber; | ||
initialState: import("@connext/types").AppState; | ||
proposedToIdentifier: string; | ||
outcomeType: "TWO_PARTY_FIXED_OUTCOME" | "MULTI_ASSET_MULTI_PARTY_COIN_TRANSFER" | "SINGLE_ASSET_TWO_PARTY_COIN_TRANSFER"; | ||
meta?: Object | undefined; | ||
}, appRegistryInfo: AppRegistryInfo, supportedTokenAddresses: string[]) => void; | ||
//# sourceMappingURL=validation.d.ts.map |
@@ -1,2 +0,2 @@ | ||
import { stringify, bigNumberifyObj, CoinBalanceRefundApp, } from "@connext/types"; | ||
import { CoinBalanceRefundAppName, stringify, } from "@connext/types"; | ||
import { Zero } from "ethers/constants"; | ||
@@ -34,3 +34,3 @@ const appProposalMatchesRegistry = (proposal, appRegistryInfo) => { | ||
export const commonAppProposalValidation = (params, appRegistryInfo, supportedTokenAddresses) => { | ||
const { initiatorDeposit, initiatorDepositTokenAddress, responderDeposit, responderDepositTokenAddress, } = bigNumberifyObj(params); | ||
const { initiatorDeposit, initiatorDepositTokenAddress, responderDeposit, responderDepositTokenAddress, } = params; | ||
appProposalMatchesRegistry(params, appRegistryInfo); | ||
@@ -45,3 +45,3 @@ if (!supportedTokenAddresses.includes(initiatorDepositTokenAddress)) { | ||
initiatorDeposit.isZero() && | ||
appRegistryInfo.name !== CoinBalanceRefundApp) { | ||
appRegistryInfo.name !== CoinBalanceRefundAppName) { | ||
throw new Error(`Cannot install an app with zero valued deposits for both initiator and responder.`); | ||
@@ -48,0 +48,0 @@ } |
@@ -1,4 +0,3 @@ | ||
export * from "./convert"; | ||
export * from "./registry"; | ||
export * from "./validation"; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,4 +0,3 @@ | ||
export * from "./convert"; | ||
export * from "./registry"; | ||
export * from "./validation"; | ||
//# sourceMappingURL=index.js.map |
@@ -1,6 +0,6 @@ | ||
import { OutcomeType, SimpleLinkedTransferAppStateEncoding, SimpleLinkedTransferAppActionEncoding, SimpleLinkedTransferApp, } from "@connext/types"; | ||
import { OutcomeType, SimpleLinkedTransferAppName, SimpleLinkedTransferAppActionEncoding, SimpleLinkedTransferAppStateEncoding, } from "@connext/types"; | ||
export const SimpleLinkedTransferAppRegistryInfo = { | ||
actionEncoding: SimpleLinkedTransferAppActionEncoding, | ||
allowNodeInstall: true, | ||
name: SimpleLinkedTransferApp, | ||
name: SimpleLinkedTransferAppName, | ||
outcomeType: OutcomeType.SINGLE_ASSET_TWO_PARTY_COIN_TRANSFER, | ||
@@ -7,0 +7,0 @@ stateEncoding: SimpleLinkedTransferAppStateEncoding, |
@@ -1,2 +0,14 @@ | ||
export declare const validateSimpleLinkedTransferApp: (params: import("@connext/types").ProtocolTypes.ProposeInstallParams, initiatorPublicIdentifier: string, responderPublicIdentifier: string) => void; | ||
export declare const validateSimpleLinkedTransferApp: (params: { | ||
appDefinition: string; | ||
abiEncodings: import("@connext/types").AppABIEncodings; | ||
initiatorDeposit: import("ethers/utils").BigNumber; | ||
initiatorDepositTokenAddress: string; | ||
responderDeposit: import("ethers/utils").BigNumber; | ||
responderDepositTokenAddress: string; | ||
timeout: import("ethers/utils").BigNumber; | ||
initialState: import("@connext/types").AppState; | ||
proposedToIdentifier: string; | ||
outcomeType: "TWO_PARTY_FIXED_OUTCOME" | "MULTI_ASSET_MULTI_PARTY_COIN_TRANSFER" | "SINGLE_ASSET_TWO_PARTY_COIN_TRANSFER"; | ||
meta?: Object | undefined; | ||
}, initiatorPublicIdentifier: string, responderPublicIdentifier: string) => void; | ||
//# sourceMappingURL=validation.d.ts.map |
import { xkeyKthAddress } from "@connext/cf-core"; | ||
import { bigNumberifyObj, stringify } from "@connext/types"; | ||
import { stringify, } from "@connext/types"; | ||
import { unidirectionalCoinTransferValidation } from "../shared"; | ||
import { convertLinkedTransferAppState } from "./convert"; | ||
export const validateSimpleLinkedTransferApp = (params, initiatorPublicIdentifier, responderPublicIdentifier) => { | ||
const { responderDeposit, initiatorDeposit, initialState: initialStateBadType } = bigNumberifyObj(params); | ||
const { responderDeposit, initiatorDeposit } = params; | ||
const initialState = params.initialState; | ||
const initiatorFreeBalanceAddress = xkeyKthAddress(initiatorPublicIdentifier); | ||
const responderFreeBalanceAddress = xkeyKthAddress(responderPublicIdentifier); | ||
const initialState = convertLinkedTransferAppState("bignumber", initialStateBadType); | ||
initialState.coinTransfers = initialState.coinTransfers.map((transfer) => bigNumberifyObj(transfer)); | ||
const initiatorTransfer = initialState.coinTransfers.filter((transfer) => { | ||
@@ -12,0 +10,0 @@ return transfer.to === initiatorFreeBalanceAddress; |
@@ -1,4 +0,3 @@ | ||
export * from "./convert"; | ||
export * from "./registry"; | ||
export * from "./validation"; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,4 +0,3 @@ | ||
export * from "./convert"; | ||
export * from "./registry"; | ||
export * from "./validation"; | ||
//# sourceMappingURL=index.js.map |
@@ -1,5 +0,5 @@ | ||
import { OutcomeType, SimpleSwapAppStateEncoding, SimpleTwoPartySwapApp } from "@connext/types"; | ||
import { OutcomeType, SimpleSwapAppStateEncoding, SimpleTwoPartySwapAppName, } from "@connext/types"; | ||
export const SimpleTwoPartySwapAppRegistryInfo = { | ||
allowNodeInstall: true, | ||
name: SimpleTwoPartySwapApp, | ||
name: SimpleTwoPartySwapAppName, | ||
outcomeType: OutcomeType.MULTI_ASSET_MULTI_PARTY_COIN_TRANSFER, | ||
@@ -6,0 +6,0 @@ stateEncoding: SimpleSwapAppStateEncoding, |
import { SwapRate } from "@connext/types"; | ||
export declare const validateSimpleSwapApp: (params: import("@connext/types").ProtocolTypes.ProposeInstallParams, allowedSwaps: SwapRate[], ourRate: string) => void; | ||
export declare const validateSimpleSwapApp: (params: { | ||
appDefinition: string; | ||
abiEncodings: import("@connext/types").AppABIEncodings; | ||
initiatorDeposit: import("ethers/utils").BigNumber; | ||
initiatorDepositTokenAddress: string; | ||
responderDeposit: import("ethers/utils").BigNumber; | ||
responderDepositTokenAddress: string; | ||
timeout: import("ethers/utils").BigNumber; | ||
initialState: import("@connext/types").AppState; | ||
proposedToIdentifier: string; | ||
outcomeType: "TWO_PARTY_FIXED_OUTCOME" | "MULTI_ASSET_MULTI_PARTY_COIN_TRANSFER" | "SINGLE_ASSET_TWO_PARTY_COIN_TRANSFER"; | ||
meta?: Object | undefined; | ||
}, allowedSwaps: SwapRate[], ourRate: string) => void; | ||
//# sourceMappingURL=validation.d.ts.map |
@@ -1,6 +0,6 @@ | ||
import { bigNumberifyObj, stringify, calculateExchange, } from "@connext/types"; | ||
import { calculateExchange, stringify, } from "@connext/types"; | ||
import { bigNumberify } from "ethers/utils"; | ||
const ALLOWED_DISCREPANCY_PCT = 5; | ||
export const validateSimpleSwapApp = (params, allowedSwaps, ourRate) => { | ||
const { responderDeposit, initiatorDeposit, initiatorDepositTokenAddress, responderDepositTokenAddress, } = bigNumberifyObj(params); | ||
const { responderDeposit, initiatorDeposit, initiatorDepositTokenAddress, responderDepositTokenAddress, } = params; | ||
if (!allowedSwaps.find((swap) => swap.from === initiatorDepositTokenAddress && swap.to === responderDepositTokenAddress)) { | ||
@@ -7,0 +7,0 @@ throw new Error(`Swap from ${initiatorDepositTokenAddress} to ${responderDepositTokenAddress} is not valid. Valid swaps: ${stringify(allowedSwaps)}`); |
@@ -1,2 +0,1 @@ | ||
export * from "./convert"; | ||
export * from "./registry"; | ||
@@ -3,0 +2,0 @@ export * from "./validation"; |
@@ -1,2 +0,1 @@ | ||
export * from "./convert"; | ||
export * from "./registry"; | ||
@@ -3,0 +2,0 @@ export * from "./validation"; |
@@ -1,5 +0,5 @@ | ||
import { OutcomeType, WithdrawAppStateEncoding, WithdrawAppActionEncoding, WithdrawApp, } from "@connext/types"; | ||
import { OutcomeType, WithdrawAppStateEncoding, WithdrawAppActionEncoding, WithdrawAppName, } from "@connext/types"; | ||
export const WithdrawAppRegistryInfo = { | ||
allowNodeInstall: true, | ||
name: WithdrawApp, | ||
name: WithdrawAppName, | ||
outcomeType: OutcomeType.SINGLE_ASSET_TWO_PARTY_COIN_TRANSFER, | ||
@@ -6,0 +6,0 @@ stateEncoding: WithdrawAppStateEncoding, |
@@ -1,2 +0,14 @@ | ||
export declare const validateWithdrawApp: (params: import("@connext/types").ProtocolTypes.ProposeInstallParams, initiatorPublicIdentifier: string, responderPublicIdentifier: string) => Promise<void>; | ||
export declare const validateWithdrawApp: (params: { | ||
appDefinition: string; | ||
abiEncodings: import("@connext/types").AppABIEncodings; | ||
initiatorDeposit: import("ethers/utils").BigNumber; | ||
initiatorDepositTokenAddress: string; | ||
responderDeposit: import("ethers/utils").BigNumber; | ||
responderDepositTokenAddress: string; | ||
timeout: import("ethers/utils").BigNumber; | ||
initialState: import("@connext/types").AppState; | ||
proposedToIdentifier: string; | ||
outcomeType: "TWO_PARTY_FIXED_OUTCOME" | "MULTI_ASSET_MULTI_PARTY_COIN_TRANSFER" | "SINGLE_ASSET_TWO_PARTY_COIN_TRANSFER"; | ||
meta?: Object | undefined; | ||
}, initiatorPublicIdentifier: string, responderPublicIdentifier: string) => Promise<void>; | ||
//# sourceMappingURL=validation.d.ts.map |
import { xkeyKthAddress } from "@connext/cf-core"; | ||
import { bigNumberifyObj, recoverAddressWithEthers, } from "@connext/types"; | ||
import { bigNumberifyJson, recoverAddressWithEthers, } from "@connext/types"; | ||
import { HashZero, Zero } from "ethers/constants"; | ||
import { unidirectionalCoinTransferValidation } from "../shared"; | ||
import { convertWithrawAppState } from "./convert"; | ||
import { HashZero, Zero } from "ethers/constants"; | ||
export const validateWithdrawApp = async (params, initiatorPublicIdentifier, responderPublicIdentifier) => { | ||
const { responderDeposit, initiatorDeposit, initialState: initialStateBadType } = bigNumberifyObj(params); | ||
const { responderDeposit, initiatorDeposit } = params; | ||
const initialState = bigNumberifyJson(params.initialState); | ||
const initiatorFreeBalanceAddress = xkeyKthAddress(initiatorPublicIdentifier); | ||
const responderFreeBalanceAddress = xkeyKthAddress(responderPublicIdentifier); | ||
const initialState = convertWithrawAppState("bignumber", initialStateBadType); | ||
initialState.transfers = initialState.transfers.map((transfer) => bigNumberifyObj(transfer)); | ||
const initiatorTransfer = initialState.transfers[0]; | ||
@@ -13,0 +11,0 @@ const responderTransfer = initialState.transfers[1]; |
import { MultisigTransaction } from "@connext/types"; | ||
import { MultisigCommitment } from "@connext/cf-core"; | ||
import { BigNumberish } from "ethers/utils"; | ||
import { MultisigCommitment } from "@connext/cf-core"; | ||
export declare class WithdrawETHCommitment extends MultisigCommitment { | ||
@@ -5,0 +5,0 @@ readonly multisigAddress: string; |
import { MultisigOperation } from "@connext/types"; | ||
import { MultisigCommitment } from "@connext/cf-core"; | ||
import { ERC20 } from "@connext/contracts"; | ||
import { bigNumberify, Interface } from "ethers/utils"; | ||
import { MultisigCommitment } from "@connext/cf-core"; | ||
import ERC20 from "@connext/contracts/build/ERC20.json"; | ||
export class WithdrawETHCommitment extends MultisigCommitment { | ||
@@ -6,0 +6,0 @@ constructor(multisigAddress, multisigOwners, to, value) { |
{ | ||
"name": "@connext/apps", | ||
"version": "6.0.0-alpha.2", | ||
"version": "6.0.0-alpha3", | ||
"description": "Connext Counterfactual Apps", | ||
@@ -21,6 +21,6 @@ "main": "dist/index.js", | ||
"devDependencies": { | ||
"@connext/cf-core": "6.0.0-alpha.1", | ||
"@connext/cf-core": "6.0.0-alpha.2", | ||
"@connext/contracts": "1.0.5", | ||
"@connext/crypto": "6.0.0-alpha.1", | ||
"@connext/types": "6.0.0-alpha.2", | ||
"@connext/crypto": "6.0.0-alpha.2", | ||
"@connext/types": "6.0.0-alpha3", | ||
"ethers": "4.0.46", | ||
@@ -27,0 +27,0 @@ "rollup": "1.31.1", |
@@ -1,2 +0,1 @@ | ||
export * from "./convert"; | ||
export * from "./registry"; |
import { | ||
coinBalanceRefundAppStateEncoding, | ||
CoinBalanceRefundAppName, | ||
CoinBalanceRefundAppStateEncoding, | ||
OutcomeType, | ||
CoinBalanceRefundApp, | ||
} from "@connext/types"; | ||
@@ -11,5 +11,7 @@ | ||
allowNodeInstall: true, | ||
name: CoinBalanceRefundApp, | ||
name: CoinBalanceRefundAppName, | ||
outcomeType: OutcomeType.SINGLE_ASSET_TWO_PARTY_COIN_TRANSFER, | ||
stateEncoding: coinBalanceRefundAppStateEncoding, | ||
stateEncoding: CoinBalanceRefundAppStateEncoding, | ||
}; | ||
@@ -1,3 +0,3 @@ | ||
export * from "./convert"; | ||
export * from "./registry"; | ||
export * from "./validation"; | ||
import { | ||
FastSignedTransferAppActionEncoding, | ||
FastSignedTransferAppName, | ||
FastSignedTransferAppStateEncoding, | ||
OutcomeType, | ||
FastSignedTransferAppStateEncoding, | ||
FastSignedTransferAppActionEncoding, | ||
FastSignedTransferApp, | ||
} from "@connext/types"; | ||
import { AppRegistryInfo } from "../shared"; | ||
import {} from "../shared"; | ||
export const FastSignedTransferAppRegistryInfo: AppRegistryInfo = { | ||
allowNodeInstall: true, | ||
name: FastSignedTransferApp, | ||
name: FastSignedTransferAppName, | ||
outcomeType: OutcomeType.SINGLE_ASSET_TWO_PARTY_COIN_TRANSFER, | ||
@@ -15,0 +14,0 @@ stateEncoding: FastSignedTransferAppStateEncoding, |
@@ -1,18 +0,18 @@ | ||
import { CFCoreTypes, bigNumberifyObj, CoinTransfer, CoinTransferBigNumber } from "@connext/types"; | ||
import { xkeyKthAddress } from "@connext/cf-core"; | ||
import { BigNumber } from "ethers/utils"; | ||
import { | ||
MethodParams, | ||
FastSignedTransferAppState, | ||
CoinTransfer, | ||
} from "@connext/types"; | ||
import { HashZero } from "ethers/constants"; | ||
import { unidirectionalCoinTransferValidation } from "../shared"; | ||
import { convertFastSignedTransferAppState } from "./convert"; | ||
import { HashZero } from "ethers/constants"; | ||
export const validateFastSignedTransferApp = ( | ||
params: CFCoreTypes.ProposeInstallParams, | ||
params: MethodParams.ProposeInstall, | ||
initiatorPublicIdentifier: string, | ||
responderPublicIdentifier: string, | ||
) => { | ||
const { responderDeposit, initiatorDeposit, initialState: initialStateBadType } = bigNumberifyObj( | ||
params, | ||
); | ||
const initialState = convertFastSignedTransferAppState("bignumber", initialStateBadType); | ||
const { responderDeposit, initiatorDeposit } = params; | ||
const initialState = params.initialState as FastSignedTransferAppState; | ||
@@ -27,3 +27,3 @@ if (initialState.paymentId !== HashZero) { | ||
// initiator is sender | ||
const initiatorTransfer = initialState.coinTransfers.filter((transfer: CoinTransferBigNumber) => { | ||
const initiatorTransfer = initialState.coinTransfers.filter((transfer: CoinTransfer) => { | ||
return transfer.to === initiatorFreeBalanceAddress; | ||
@@ -33,3 +33,3 @@ })[0]; | ||
// responder is receiver | ||
const responderTransfer = initialState.coinTransfers.filter((transfer: CoinTransferBigNumber) => { | ||
const responderTransfer = initialState.coinTransfers.filter((transfer: CoinTransfer) => { | ||
return transfer.to === responderFreeBalanceAddress; | ||
@@ -36,0 +36,0 @@ })[0]; |
@@ -1,3 +0,2 @@ | ||
export * from "./convert"; | ||
export * from "./registry"; | ||
export * from "./validation"; |
@@ -5,3 +5,3 @@ import { | ||
HashLockTransferAppStateEncoding, | ||
HashLockTransferApp, | ||
HashLockTransferAppName, | ||
} from "@connext/types"; | ||
@@ -12,3 +12,3 @@ | ||
export const HashLockTransferAppRegistryInfo: AppRegistryInfo = { | ||
name: HashLockTransferApp, | ||
name: HashLockTransferAppName, | ||
allowNodeInstall: true, | ||
@@ -15,0 +15,0 @@ actionEncoding: HashLockTransferAppActionEncoding, |
import { xkeyKthAddress } from "@connext/cf-core"; | ||
import { CFCoreTypes, CoinTransferBigNumber, bigNumberifyObj } from "@connext/types"; | ||
import { MethodParams, CoinTransfer, HashLockTransferAppState } from "@connext/types"; | ||
import { unidirectionalCoinTransferValidation } from "../shared"; | ||
import { convertHashLockTransferAppState } from "./convert"; | ||
export const validateHashLockTransferApp = ( | ||
params: CFCoreTypes.ProposeInstallParams, | ||
params: MethodParams.ProposeInstall, | ||
blockNumber: number, | ||
@@ -13,5 +12,4 @@ initiatorPublicIdentifier: string, | ||
) => { | ||
const { responderDeposit, initiatorDeposit, initialState: initialStateBadType } = bigNumberifyObj( | ||
params, | ||
); | ||
const { responderDeposit, initiatorDeposit } = params; | ||
const initialState = params.initialState as HashLockTransferAppState; | ||
@@ -21,8 +19,6 @@ const initiatorFreeBalanceAddress = xkeyKthAddress(initiatorPublicIdentifier); | ||
const initialState = convertHashLockTransferAppState("bignumber", initialStateBadType); | ||
const initiatorTransfer = initialState.coinTransfers.filter((transfer: CoinTransferBigNumber) => { | ||
const initiatorTransfer = initialState.coinTransfers.filter((transfer: CoinTransfer) => { | ||
return transfer.to === initiatorFreeBalanceAddress; | ||
})[0]; | ||
const responderTransfer = initialState.coinTransfers.filter((transfer: CoinTransferBigNumber) => { | ||
const responderTransfer = initialState.coinTransfers.filter((transfer: CoinTransfer) => { | ||
return transfer.to === responderFreeBalanceAddress; | ||
@@ -29,0 +25,0 @@ })[0]; |
@@ -1,69 +0,36 @@ | ||
import { | ||
SimpleLinkedTransferAppAction, | ||
SimpleSwapAppState, | ||
SimpleLinkedTransferAppState, | ||
FastSignedTransferAppAction, | ||
FastSignedTransferAppState, | ||
WithdrawAppAction, | ||
WithdrawAppState, | ||
CoinBalanceRefundApp, | ||
SimpleLinkedTransferApp, | ||
SimpleTwoPartySwapApp, | ||
FastSignedTransferApp, | ||
HashLockTransferApp, | ||
HashLockTransferAppAction, | ||
HashLockTransferAppState, | ||
WithdrawApp, | ||
} from "@connext/types"; | ||
import { BigNumber } from "ethers/utils"; | ||
import { WithdrawAppRegistryInfo } from "./WithdrawApp"; | ||
import { AppRegistryType } from "./shared"; | ||
import { CoinBalanceRefundAppRegistryInfo } from "./CoinBalanceRefundApp"; | ||
import { FastSignedTransferAppRegistryInfo } from "./FastSignedTransferApp"; | ||
import { AppRegistry as AppRegistryType } from "./shared"; | ||
import { HashLockTransferAppRegistryInfo } from "./HashLockTransferApp"; | ||
import { SimpleLinkedTransferAppRegistryInfo } from "./SimpleLinkedTransferApp"; | ||
import { SimpleSignedTransferAppRegistryInfo } from "./SimpleSignedTransferApp"; | ||
import { SimpleTwoPartySwapAppRegistryInfo } from "./SimpleTwoPartySwapApp"; | ||
import { CoinBalanceRefundAppRegistryInfo } from "./CoinBalanceRefundApp"; | ||
import { HashLockTransferAppRegistryInfo } from "./HashLockTransferApp"; | ||
import { WithdrawAppRegistryInfo } from "./WithdrawApp"; | ||
export const AppRegistry: AppRegistryType = [ | ||
FastSignedTransferAppRegistryInfo, | ||
SimpleLinkedTransferAppRegistryInfo, | ||
SimpleSignedTransferAppRegistryInfo, | ||
SimpleTwoPartySwapAppRegistryInfo, | ||
CoinBalanceRefundAppRegistryInfo, | ||
WithdrawAppRegistryInfo, | ||
HashLockTransferAppRegistryInfo, | ||
]; | ||
export * from "./shared"; | ||
export * from "./CoinBalanceRefundApp"; | ||
export * from "./FastSignedTransferApp"; | ||
export * from "./HashLockTransferApp"; | ||
export * from "./SimpleLinkedTransferApp"; | ||
export * from "./SimpleSignedTransferApp"; | ||
export * from "./SimpleTwoPartySwapApp"; | ||
export * from "./CoinBalanceRefundApp"; | ||
export * from "./WithdrawApp"; | ||
export * from "./HashLockTransferApp"; | ||
export const SupportedApplications = { | ||
[CoinBalanceRefundApp]: CoinBalanceRefundApp, | ||
[SimpleLinkedTransferApp]: SimpleLinkedTransferApp, | ||
[SimpleTwoPartySwapApp]: SimpleTwoPartySwapApp, | ||
[FastSignedTransferApp]: FastSignedTransferApp, | ||
[WithdrawApp]: WithdrawApp, | ||
[HashLockTransferApp]: HashLockTransferApp, | ||
}; | ||
export type SupportedApplication = keyof typeof SupportedApplications; | ||
export const AppRegistry: AppRegistryType = [ | ||
export { | ||
FastSignedTransferAppRegistryInfo, | ||
AppRegistryType, | ||
SimpleLinkedTransferAppRegistryInfo, | ||
SimpleSignedTransferAppRegistryInfo, | ||
SimpleTwoPartySwapAppRegistryInfo, | ||
CoinBalanceRefundAppRegistryInfo, | ||
WithdrawAppRegistryInfo, | ||
HashLockTransferAppRegistryInfo, | ||
]; | ||
export type AppAction<T = string> = | ||
| FastSignedTransferAppAction<T> | ||
| HashLockTransferAppAction | ||
| SimpleLinkedTransferAppAction | ||
| WithdrawAppAction; | ||
export type AppActionBigNumber = AppAction<BigNumber>; | ||
export type AppState<T = string> = | ||
| FastSignedTransferAppState<T> | ||
| HashLockTransferAppState<T> | ||
| SimpleLinkedTransferAppState<T> | ||
| SimpleSwapAppState<T> | ||
| WithdrawAppState<T>; | ||
export type AppStateBigNumber = AppState<BigNumber>; | ||
}; |
@@ -1,9 +0,30 @@ | ||
import { OutcomeType } from "@connext/types"; | ||
import { | ||
CoinBalanceRefundAppName, | ||
enumify, | ||
FastSignedTransferAppName, | ||
HashLockTransferAppName, | ||
OutcomeType, | ||
SimpleLinkedTransferAppName, | ||
SimpleSignedTransferAppName, | ||
SimpleTwoPartySwapAppName, | ||
WithdrawAppName, | ||
} from "@connext/types"; | ||
import { SupportedApplication } from ".."; | ||
export const SupportedApplications = enumify({ | ||
[CoinBalanceRefundAppName]: CoinBalanceRefundAppName, | ||
[SimpleLinkedTransferAppName]: SimpleLinkedTransferAppName, | ||
[SimpleSignedTransferAppName]: SimpleSignedTransferAppName, | ||
[SimpleTwoPartySwapAppName]: SimpleTwoPartySwapAppName, | ||
[FastSignedTransferAppName]: FastSignedTransferAppName, | ||
[WithdrawAppName]: WithdrawAppName, | ||
[HashLockTransferAppName]: HashLockTransferAppName, | ||
}); | ||
export type SupportedApplications = | ||
(typeof SupportedApplications)[keyof typeof SupportedApplications]; | ||
export type AppRegistryInfo = { | ||
actionEncoding?: string; | ||
allowNodeInstall: boolean; | ||
name: SupportedApplication; | ||
name: SupportedApplications; | ||
outcomeType: OutcomeType; | ||
@@ -13,2 +34,2 @@ stateEncoding: string; | ||
export type AppRegistry = AppRegistryInfo[]; | ||
export type AppRegistryType = AppRegistryInfo[]; |
import { | ||
CFCoreTypes, | ||
CoinBalanceRefundAppName, | ||
CoinTransfer, | ||
MethodParams, | ||
stringify, | ||
bigNumberifyObj, | ||
CoinTransferBigNumber, | ||
CoinBalanceRefundApp, | ||
} from "@connext/types"; | ||
import { Zero } from "ethers/constants"; | ||
import { BigNumber } from "ethers/utils"; | ||
import { AppRegistryInfo } from "./registry"; | ||
import { BigNumber } from "ethers/utils"; | ||
import { Zero } from "ethers/constants"; | ||
const appProposalMatchesRegistry = ( | ||
proposal: CFCoreTypes.ProposeInstallParams, | ||
proposal: MethodParams.ProposeInstall, | ||
appRegistryInfo: AppRegistryInfo, | ||
@@ -46,4 +45,4 @@ ): void => { | ||
responderDeposit: BigNumber, | ||
initiatorTransfer: CoinTransferBigNumber, | ||
responderTransfer: CoinTransferBigNumber, | ||
initiatorTransfer: CoinTransfer, | ||
responderTransfer: CoinTransfer, | ||
) => { | ||
@@ -77,4 +76,4 @@ if (!initiatorTransfer || !responderTransfer) { | ||
responderDeposit: BigNumber, | ||
initiatorTransfer: CoinTransferBigNumber, | ||
responderTransfer: CoinTransferBigNumber, | ||
initiatorTransfer: CoinTransfer, | ||
responderTransfer: CoinTransfer, | ||
) => { | ||
@@ -113,3 +112,3 @@ baseCoinTransferValidation( | ||
export const commonAppProposalValidation = ( | ||
params: CFCoreTypes.ProposeInstallParams, | ||
params: MethodParams.ProposeInstall, | ||
appRegistryInfo: AppRegistryInfo, | ||
@@ -123,3 +122,3 @@ supportedTokenAddresses: string[], | ||
responderDepositTokenAddress, | ||
} = bigNumberifyObj(params); | ||
} = params; | ||
@@ -141,3 +140,3 @@ appProposalMatchesRegistry(params, appRegistryInfo); | ||
initiatorDeposit.isZero() && | ||
appRegistryInfo.name !== CoinBalanceRefundApp | ||
appRegistryInfo.name !== CoinBalanceRefundAppName | ||
) { | ||
@@ -144,0 +143,0 @@ throw new Error( |
@@ -1,3 +0,2 @@ | ||
export * from "./convert"; | ||
export * from "./registry"; | ||
export * from "./validation"; |
import { | ||
OutcomeType, | ||
SimpleLinkedTransferAppName, | ||
SimpleLinkedTransferAppActionEncoding, | ||
SimpleLinkedTransferAppStateEncoding, | ||
SimpleLinkedTransferAppActionEncoding, | ||
SimpleLinkedTransferApp, | ||
} from "@connext/types"; | ||
@@ -13,5 +13,6 @@ | ||
allowNodeInstall: true, | ||
name: SimpleLinkedTransferApp, | ||
name: SimpleLinkedTransferAppName, | ||
outcomeType: OutcomeType.SINGLE_ASSET_TWO_PARTY_COIN_TRANSFER, | ||
stateEncoding: SimpleLinkedTransferAppStateEncoding, | ||
}; | ||
import { xkeyKthAddress } from "@connext/cf-core"; | ||
import { CFCoreTypes, CoinTransferBigNumber, bigNumberifyObj, stringify } from "@connext/types"; | ||
import { | ||
MethodParams, | ||
CoinTransfer, | ||
SimpleLinkedTransferAppState, | ||
stringify, | ||
} from "@connext/types"; | ||
import { unidirectionalCoinTransferValidation } from "../shared"; | ||
import { convertLinkedTransferAppState } from "./convert"; | ||
export const validateSimpleLinkedTransferApp = ( | ||
params: CFCoreTypes.ProposeInstallParams, | ||
params: MethodParams.ProposeInstall, | ||
initiatorPublicIdentifier: string, | ||
responderPublicIdentifier: string, | ||
) => { | ||
const { responderDeposit, initiatorDeposit, initialState: initialStateBadType } = bigNumberifyObj( | ||
params, | ||
); | ||
const { responderDeposit, initiatorDeposit } = params; | ||
const initialState = params.initialState as SimpleLinkedTransferAppState; | ||
@@ -19,12 +22,6 @@ const initiatorFreeBalanceAddress = xkeyKthAddress(initiatorPublicIdentifier); | ||
const initialState = convertLinkedTransferAppState("bignumber", initialStateBadType); | ||
initialState.coinTransfers = initialState.coinTransfers.map((transfer: CoinTransferBigNumber) => | ||
bigNumberifyObj(transfer), | ||
) as any; | ||
const initiatorTransfer = initialState.coinTransfers.filter((transfer: CoinTransferBigNumber) => { | ||
const initiatorTransfer = initialState.coinTransfers.filter((transfer: CoinTransfer) => { | ||
return transfer.to === initiatorFreeBalanceAddress; | ||
})[0]; | ||
const responderTransfer = initialState.coinTransfers.filter((transfer: CoinTransferBigNumber) => { | ||
const responderTransfer = initialState.coinTransfers.filter((transfer: CoinTransfer) => { | ||
return transfer.to === responderFreeBalanceAddress; | ||
@@ -31,0 +28,0 @@ })[0]; |
@@ -1,3 +0,2 @@ | ||
export * from "./convert"; | ||
export * from "./registry"; | ||
export * from "./validation"; |
@@ -1,2 +0,6 @@ | ||
import { OutcomeType, SimpleSwapAppStateEncoding, SimpleTwoPartySwapApp } from "@connext/types"; | ||
import { | ||
OutcomeType, | ||
SimpleSwapAppStateEncoding, | ||
SimpleTwoPartySwapAppName, | ||
} from "@connext/types"; | ||
@@ -7,5 +11,5 @@ import { AppRegistryInfo } from "../shared"; | ||
allowNodeInstall: true, | ||
name: SimpleTwoPartySwapApp, | ||
name: SimpleTwoPartySwapAppName, | ||
outcomeType: OutcomeType.MULTI_ASSET_MULTI_PARTY_COIN_TRANSFER, | ||
stateEncoding: SimpleSwapAppStateEncoding, | ||
}; |
import { | ||
CFCoreTypes, | ||
bigNumberifyObj, | ||
MethodParams, | ||
AllowedSwap, | ||
calculateExchange, | ||
stringify, | ||
SwapRate, | ||
AllowedSwap, | ||
calculateExchange, | ||
} from "@connext/types"; | ||
@@ -14,3 +13,3 @@ import { bigNumberify } from "ethers/utils"; | ||
export const validateSimpleSwapApp = ( | ||
params: CFCoreTypes.ProposeInstallParams, | ||
params: MethodParams.ProposeInstall, | ||
allowedSwaps: SwapRate[], | ||
@@ -24,3 +23,3 @@ ourRate: string, | ||
responderDepositTokenAddress, | ||
} = bigNumberifyObj(params); | ||
} = params; | ||
@@ -27,0 +26,0 @@ if ( |
@@ -1,4 +0,3 @@ | ||
export * from "./convert"; | ||
export * from "./registry"; | ||
export * from "./validation"; | ||
export * from "./withdrawCommitment"; |
@@ -5,3 +5,3 @@ import { | ||
WithdrawAppActionEncoding, | ||
WithdrawApp, | ||
WithdrawAppName, | ||
} from "@connext/types"; | ||
@@ -13,3 +13,3 @@ | ||
allowNodeInstall: true, | ||
name: WithdrawApp, | ||
name: WithdrawAppName, | ||
outcomeType: OutcomeType.SINGLE_ASSET_TWO_PARTY_COIN_TRANSFER, | ||
@@ -16,0 +16,0 @@ stateEncoding: WithdrawAppStateEncoding, |
import { xkeyKthAddress } from "@connext/cf-core"; | ||
import { | ||
CFCoreTypes, | ||
CoinTransferBigNumber, | ||
bigNumberifyObj, | ||
bigNumberifyJson, | ||
MethodParams, | ||
recoverAddressWithEthers, | ||
WithdrawAppState, | ||
recoverAddressWithEthers, | ||
} from "@connext/types"; | ||
import { HashZero, Zero } from "ethers/constants"; | ||
import { unidirectionalCoinTransferValidation } from "../shared"; | ||
import { convertWithrawAppState } from "./convert"; | ||
import { BigNumber } from "ethers/utils"; | ||
import { HashZero, Zero } from "ethers/constants"; | ||
export const validateWithdrawApp = async ( | ||
params: CFCoreTypes.ProposeInstallParams, | ||
params: MethodParams.ProposeInstall, | ||
initiatorPublicIdentifier: string, | ||
responderPublicIdentifier: string, | ||
) => { | ||
const { responderDeposit, initiatorDeposit, initialState: initialStateBadType } = bigNumberifyObj( | ||
params, | ||
); | ||
const { responderDeposit, initiatorDeposit } = params; | ||
const initialState = bigNumberifyJson(params.initialState) as WithdrawAppState; | ||
@@ -27,11 +23,2 @@ const initiatorFreeBalanceAddress = xkeyKthAddress(initiatorPublicIdentifier); | ||
const initialState: WithdrawAppState<BigNumber> = convertWithrawAppState( | ||
"bignumber", | ||
initialStateBadType, | ||
); | ||
initialState.transfers = initialState.transfers.map((transfer: CoinTransferBigNumber) => | ||
bigNumberifyObj(transfer), | ||
) as any; | ||
const initiatorTransfer = initialState.transfers[0]; | ||
@@ -38,0 +25,0 @@ const responderTransfer = initialState.transfers[1]; |
import { MultisigTransaction, MultisigOperation } from "@connext/types"; | ||
import { MultisigCommitment } from "@connext/cf-core"; | ||
import { ERC20 } from "@connext/contracts"; | ||
import { BigNumberish, bigNumberify, Interface } from "ethers/utils"; | ||
import { MultisigCommitment } from "@connext/cf-core"; | ||
import ERC20 from "@connext/contracts/build/ERC20.json"; | ||
@@ -6,0 +6,0 @@ export class WithdrawETHCommitment extends MultisigCommitment { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
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
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
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
1
448921
130
1871
1