@connext/apps
Advanced tools
Comparing version 7.0.3 to 7.0.4
@@ -347,2 +347,37 @@ this.window = this.window || {}; | ||
const GraphBatchSignedTransferAppRegistryInfo = { | ||
allowNodeInstall: true, | ||
name: types.GraphBatchedTransferAppName, | ||
outcomeType: types.OutcomeType.SINGLE_ASSET_TWO_PARTY_COIN_TRANSFER, | ||
stateEncoding: types.GraphBatchedTransferAppStateEncoding, | ||
actionEncoding: types.GraphBatchedTransferAppActionEncoding, | ||
}; | ||
const ALLOWED_DISCREPANCY_PCT$1 = 5; | ||
const validateGraphBatchedTransferApp = async (params, getSwapRate) => { | ||
validateSignedTransferApp(params); | ||
const { meta, initiatorDepositAssetId, initialState } = params; | ||
let ourRate; | ||
if (!(meta === null || meta === void 0 ? void 0 : meta.senderAssetId) || (meta === null || meta === void 0 ? void 0 : meta.senderAssetId) === initiatorDepositAssetId) { | ||
ourRate = "1"; | ||
} | ||
else { | ||
ourRate = await getSwapRate(meta === null || meta === void 0 ? void 0 : meta.senderAssetId, initiatorDepositAssetId); | ||
} | ||
const expectedRate = ethers.utils.parseUnits(ourRate, 18); | ||
const givenRate = initialState.swapRate; | ||
const calculatedToActualDiscrepancy = expectedRate.sub(givenRate).abs(); | ||
const allowedDiscrepancy = expectedRate | ||
.mul(ethers.BigNumber.from(100).sub(ALLOWED_DISCREPANCY_PCT$1)) | ||
.div(100); | ||
if (calculatedToActualDiscrepancy.gt(allowedDiscrepancy)) { | ||
throw new Error(`Given rate ${givenRate.toString()} is out of range of our expected rate (${expectedRate.toString()})} by more than ${ALLOWED_DISCREPANCY_PCT$1}% (discrepancy: ${calculatedToActualDiscrepancy.toString()})`); | ||
} | ||
}; | ||
const proposeGraphBatchedTransferMiddleware = (cxt, getSwapRate) => { | ||
const { params } = cxt; | ||
return validateGraphBatchedTransferApp(params, getSwapRate); | ||
}; | ||
const { Zero: Zero$8 } = ethers.constants; | ||
@@ -369,2 +404,3 @@ const GraphSignedTransferAppRegistryInfo = { | ||
GraphSignedTransferAppRegistryInfo, | ||
GraphBatchSignedTransferAppRegistryInfo, | ||
SimpleTwoPartySwapAppRegistryInfo, | ||
@@ -389,7 +425,7 @@ WithdrawAppRegistryInfo, | ||
}; | ||
const generateValidationMiddleware = async (networkContexts, supportedTokenAddresses) => { | ||
const generateValidationMiddleware = async (networkContexts, supportedTokenAddresses, getSwapRate) => { | ||
const validationMiddleware = async (protocol, middlewareContext) => { | ||
switch (protocol) { | ||
case types.ProtocolNames.propose: { | ||
await proposeMiddleware(networkContexts, middlewareContext, supportedTokenAddresses); | ||
await proposeMiddleware(networkContexts, middlewareContext, supportedTokenAddresses, getSwapRate); | ||
break; | ||
@@ -426,3 +462,3 @@ } | ||
}; | ||
const proposeMiddleware = async (networkContexts, middlewareContext, supportedTokenAddresses) => { | ||
const proposeMiddleware = async (networkContexts, middlewareContext, supportedTokenAddresses, getSwapRate) => { | ||
const { proposal, stateChannel } = middlewareContext; | ||
@@ -438,2 +474,6 @@ const { contractAddresses, provider } = networkContexts[stateChannel.chainId]; | ||
} | ||
case contractAddresses.GraphBatchedTransferApp: { | ||
await proposeGraphBatchedTransferMiddleware(middlewareContext, getSwapRate); | ||
break; | ||
} | ||
case contractAddresses.GraphSignedTransferApp: { | ||
@@ -476,2 +516,3 @@ proposeGraphSignedTransferMiddleware(middlewareContext); | ||
exports.GRAPH_SIGNED_TRANSFER_STATE_TIMEOUT = GRAPH_SIGNED_TRANSFER_STATE_TIMEOUT; | ||
exports.GraphBatchSignedTransferAppRegistryInfo = GraphBatchSignedTransferAppRegistryInfo; | ||
exports.GraphSignedTransferAppRegistryInfo = GraphSignedTransferAppRegistryInfo; | ||
@@ -495,2 +536,3 @@ exports.HASHLOCK_TRANSFER_STATE_TIMEOUT = HASHLOCK_TRANSFER_STATE_TIMEOUT; | ||
exports.proposeDepositMiddleware = proposeDepositMiddleware; | ||
exports.proposeGraphBatchedTransferMiddleware = proposeGraphBatchedTransferMiddleware; | ||
exports.proposeGraphSignedTransferMiddleware = proposeGraphSignedTransferMiddleware; | ||
@@ -506,2 +548,3 @@ exports.proposeHashLockTransferMiddleware = proposeHashLockTransferMiddleware; | ||
exports.validateDepositApp = validateDepositApp; | ||
exports.validateGraphBatchedTransferApp = validateGraphBatchedTransferApp; | ||
exports.validateGraphSignedTransferApp = validateGraphSignedTransferApp; | ||
@@ -508,0 +551,0 @@ exports.validateHashLockTransferApp = validateHashLockTransferApp; |
import { constants, Contract, utils, BigNumber } from 'ethers'; | ||
import { DepositAppName, OutcomeType, DepositAppStateEncoding, CONVENTION_FOR_ETH_ASSET_ID, Contract as Contract$1, ProtocolRoles, HashLockTransferAppName, HashLockTransferAppActionEncoding, HashLockTransferAppStateEncoding, SimpleLinkedTransferAppActionEncoding, SimpleLinkedTransferAppName, SimpleLinkedTransferAppStateEncoding, SimpleSignedTransferAppName, SimpleSignedTransferAppStateEncoding, SimpleSignedTransferAppActionEncoding, WithdrawAppName, WithdrawAppStateEncoding, WithdrawAppActionEncoding, singleAssetSinglePartyCoinTransferEncoding, singleAssetTwoPartyCoinTransferInterpreterParamsEncoding, MultisigOperation, SimpleTwoPartySwapAppName, SimpleSwapAppStateEncoding, GraphSignedTransferAppName, GraphSignedTransferAppStateEncoding, GraphSignedTransferAppActionEncoding, ProtocolNames } from '@connext/types'; | ||
import { DepositAppName, OutcomeType, DepositAppStateEncoding, CONVENTION_FOR_ETH_ASSET_ID, Contract as Contract$1, ProtocolRoles, HashLockTransferAppName, HashLockTransferAppActionEncoding, HashLockTransferAppStateEncoding, SimpleLinkedTransferAppActionEncoding, SimpleLinkedTransferAppName, SimpleLinkedTransferAppStateEncoding, SimpleSignedTransferAppName, SimpleSignedTransferAppStateEncoding, SimpleSignedTransferAppActionEncoding, WithdrawAppName, WithdrawAppStateEncoding, WithdrawAppActionEncoding, singleAssetSinglePartyCoinTransferEncoding, singleAssetTwoPartyCoinTransferInterpreterParamsEncoding, MultisigOperation, SimpleTwoPartySwapAppName, SimpleSwapAppStateEncoding, GraphBatchedTransferAppName, GraphBatchedTransferAppStateEncoding, GraphBatchedTransferAppActionEncoding, GraphSignedTransferAppName, GraphSignedTransferAppStateEncoding, GraphSignedTransferAppActionEncoding, ProtocolNames } from '@connext/types'; | ||
import { toBN, getAddressFromAssetId, stringify, getSignerAddressFromPublicIdentifier, bigNumberifyJson, recoverAddressFromChannelMessage, calculateExchangeWad } from '@connext/utils'; | ||
@@ -348,2 +348,37 @@ import { ERC20, MinimumViableMultisig, MultisigCommitment, ConditionalTransactionDelegateTarget } from '@connext/contracts'; | ||
const GraphBatchSignedTransferAppRegistryInfo = { | ||
allowNodeInstall: true, | ||
name: GraphBatchedTransferAppName, | ||
outcomeType: OutcomeType.SINGLE_ASSET_TWO_PARTY_COIN_TRANSFER, | ||
stateEncoding: GraphBatchedTransferAppStateEncoding, | ||
actionEncoding: GraphBatchedTransferAppActionEncoding, | ||
}; | ||
const ALLOWED_DISCREPANCY_PCT$1 = 5; | ||
const validateGraphBatchedTransferApp = async (params, getSwapRate) => { | ||
validateSignedTransferApp(params); | ||
const { meta, initiatorDepositAssetId, initialState } = params; | ||
let ourRate; | ||
if (!(meta === null || meta === void 0 ? void 0 : meta.senderAssetId) || (meta === null || meta === void 0 ? void 0 : meta.senderAssetId) === initiatorDepositAssetId) { | ||
ourRate = "1"; | ||
} | ||
else { | ||
ourRate = await getSwapRate(meta === null || meta === void 0 ? void 0 : meta.senderAssetId, initiatorDepositAssetId); | ||
} | ||
const expectedRate = utils.parseUnits(ourRate, 18); | ||
const givenRate = initialState.swapRate; | ||
const calculatedToActualDiscrepancy = expectedRate.sub(givenRate).abs(); | ||
const allowedDiscrepancy = expectedRate | ||
.mul(BigNumber.from(100).sub(ALLOWED_DISCREPANCY_PCT$1)) | ||
.div(100); | ||
if (calculatedToActualDiscrepancy.gt(allowedDiscrepancy)) { | ||
throw new Error(`Given rate ${givenRate.toString()} is out of range of our expected rate (${expectedRate.toString()})} by more than ${ALLOWED_DISCREPANCY_PCT$1}% (discrepancy: ${calculatedToActualDiscrepancy.toString()})`); | ||
} | ||
}; | ||
const proposeGraphBatchedTransferMiddleware = (cxt, getSwapRate) => { | ||
const { params } = cxt; | ||
return validateGraphBatchedTransferApp(params, getSwapRate); | ||
}; | ||
const { Zero: Zero$8 } = constants; | ||
@@ -370,2 +405,3 @@ const GraphSignedTransferAppRegistryInfo = { | ||
GraphSignedTransferAppRegistryInfo, | ||
GraphBatchSignedTransferAppRegistryInfo, | ||
SimpleTwoPartySwapAppRegistryInfo, | ||
@@ -390,7 +426,7 @@ WithdrawAppRegistryInfo, | ||
}; | ||
const generateValidationMiddleware = async (networkContexts, supportedTokenAddresses) => { | ||
const generateValidationMiddleware = async (networkContexts, supportedTokenAddresses, getSwapRate) => { | ||
const validationMiddleware = async (protocol, middlewareContext) => { | ||
switch (protocol) { | ||
case ProtocolNames.propose: { | ||
await proposeMiddleware(networkContexts, middlewareContext, supportedTokenAddresses); | ||
await proposeMiddleware(networkContexts, middlewareContext, supportedTokenAddresses, getSwapRate); | ||
break; | ||
@@ -427,3 +463,3 @@ } | ||
}; | ||
const proposeMiddleware = async (networkContexts, middlewareContext, supportedTokenAddresses) => { | ||
const proposeMiddleware = async (networkContexts, middlewareContext, supportedTokenAddresses, getSwapRate) => { | ||
const { proposal, stateChannel } = middlewareContext; | ||
@@ -439,2 +475,6 @@ const { contractAddresses, provider } = networkContexts[stateChannel.chainId]; | ||
} | ||
case contractAddresses.GraphBatchedTransferApp: { | ||
await proposeGraphBatchedTransferMiddleware(middlewareContext, getSwapRate); | ||
break; | ||
} | ||
case contractAddresses.GraphSignedTransferApp: { | ||
@@ -472,2 +512,2 @@ proposeGraphSignedTransferMiddleware(middlewareContext); | ||
export { AppRegistry, DEFAULT_APP_TIMEOUT, DEPOSIT_STATE_TIMEOUT, DepositAppRegistryInfo, GRAPH_SIGNED_TRANSFER_STATE_TIMEOUT, GraphSignedTransferAppRegistryInfo, HASHLOCK_TRANSFER_STATE_TIMEOUT, HashLockTransferAppRegistryInfo, LINKED_TRANSFER_STATE_TIMEOUT, MINIMUM_APP_TIMEOUT, SIGNED_TRANSFER_STATE_TIMEOUT, SWAP_STATE_TIMEOUT, SimpleLinkedTransferAppRegistryInfo, SimpleSignedTransferAppRegistryInfo, SimpleTwoPartySwapAppRegistryInfo, TRANSFER_TIMEOUT, WITHDRAW_STATE_TIMEOUT, WithdrawAppRegistryInfo, WithdrawCommitment, baseCoinTransferValidation, commonAppProposalValidation, generateValidationMiddleware, proposeDepositMiddleware, proposeGraphSignedTransferMiddleware, proposeHashLockTransferMiddleware, proposeLinkedTransferMiddleware, proposeSignedTransferMiddleware, proposeSwapMiddleware, proposeWithdrawMiddleware, sharedProposalMiddleware, unidirectionalCoinTransferValidation, uninstallDepositMiddleware, validateDepositApp, validateGraphSignedTransferApp, validateHashLockTransferApp, validateSignedTransferApp, validateSimpleLinkedTransferApp, validateSimpleSwapApp, validateWithdrawApp }; | ||
export { AppRegistry, DEFAULT_APP_TIMEOUT, DEPOSIT_STATE_TIMEOUT, DepositAppRegistryInfo, GRAPH_SIGNED_TRANSFER_STATE_TIMEOUT, GraphBatchSignedTransferAppRegistryInfo, GraphSignedTransferAppRegistryInfo, HASHLOCK_TRANSFER_STATE_TIMEOUT, HashLockTransferAppRegistryInfo, LINKED_TRANSFER_STATE_TIMEOUT, MINIMUM_APP_TIMEOUT, SIGNED_TRANSFER_STATE_TIMEOUT, SWAP_STATE_TIMEOUT, SimpleLinkedTransferAppRegistryInfo, SimpleSignedTransferAppRegistryInfo, SimpleTwoPartySwapAppRegistryInfo, TRANSFER_TIMEOUT, WITHDRAW_STATE_TIMEOUT, WithdrawAppRegistryInfo, WithdrawCommitment, baseCoinTransferValidation, commonAppProposalValidation, generateValidationMiddleware, proposeDepositMiddleware, proposeGraphBatchedTransferMiddleware, proposeGraphSignedTransferMiddleware, proposeHashLockTransferMiddleware, proposeLinkedTransferMiddleware, proposeSignedTransferMiddleware, proposeSwapMiddleware, proposeWithdrawMiddleware, sharedProposalMiddleware, unidirectionalCoinTransferValidation, uninstallDepositMiddleware, validateDepositApp, validateGraphBatchedTransferApp, validateGraphSignedTransferApp, validateHashLockTransferApp, validateSignedTransferApp, validateSimpleLinkedTransferApp, validateSimpleSwapApp, validateWithdrawApp }; |
@@ -352,2 +352,37 @@ 'use strict'; | ||
const GraphBatchSignedTransferAppRegistryInfo = { | ||
allowNodeInstall: true, | ||
name: types.GraphBatchedTransferAppName, | ||
outcomeType: types.OutcomeType.SINGLE_ASSET_TWO_PARTY_COIN_TRANSFER, | ||
stateEncoding: types.GraphBatchedTransferAppStateEncoding, | ||
actionEncoding: types.GraphBatchedTransferAppActionEncoding, | ||
}; | ||
const ALLOWED_DISCREPANCY_PCT$1 = 5; | ||
const validateGraphBatchedTransferApp = async (params, getSwapRate) => { | ||
validateSignedTransferApp(params); | ||
const { meta, initiatorDepositAssetId, initialState } = params; | ||
let ourRate; | ||
if (!(meta === null || meta === void 0 ? void 0 : meta.senderAssetId) || (meta === null || meta === void 0 ? void 0 : meta.senderAssetId) === initiatorDepositAssetId) { | ||
ourRate = "1"; | ||
} | ||
else { | ||
ourRate = await getSwapRate(meta === null || meta === void 0 ? void 0 : meta.senderAssetId, initiatorDepositAssetId); | ||
} | ||
const expectedRate = ethers.utils.parseUnits(ourRate, 18); | ||
const givenRate = initialState.swapRate; | ||
const calculatedToActualDiscrepancy = expectedRate.sub(givenRate).abs(); | ||
const allowedDiscrepancy = expectedRate | ||
.mul(ethers.BigNumber.from(100).sub(ALLOWED_DISCREPANCY_PCT$1)) | ||
.div(100); | ||
if (calculatedToActualDiscrepancy.gt(allowedDiscrepancy)) { | ||
throw new Error(`Given rate ${givenRate.toString()} is out of range of our expected rate (${expectedRate.toString()})} by more than ${ALLOWED_DISCREPANCY_PCT$1}% (discrepancy: ${calculatedToActualDiscrepancy.toString()})`); | ||
} | ||
}; | ||
const proposeGraphBatchedTransferMiddleware = (cxt, getSwapRate) => { | ||
const { params } = cxt; | ||
return validateGraphBatchedTransferApp(params, getSwapRate); | ||
}; | ||
const { Zero: Zero$8 } = ethers.constants; | ||
@@ -374,2 +409,3 @@ const GraphSignedTransferAppRegistryInfo = { | ||
GraphSignedTransferAppRegistryInfo, | ||
GraphBatchSignedTransferAppRegistryInfo, | ||
SimpleTwoPartySwapAppRegistryInfo, | ||
@@ -394,7 +430,7 @@ WithdrawAppRegistryInfo, | ||
}; | ||
const generateValidationMiddleware = async (networkContexts, supportedTokenAddresses) => { | ||
const generateValidationMiddleware = async (networkContexts, supportedTokenAddresses, getSwapRate) => { | ||
const validationMiddleware = async (protocol, middlewareContext) => { | ||
switch (protocol) { | ||
case types.ProtocolNames.propose: { | ||
await proposeMiddleware(networkContexts, middlewareContext, supportedTokenAddresses); | ||
await proposeMiddleware(networkContexts, middlewareContext, supportedTokenAddresses, getSwapRate); | ||
break; | ||
@@ -431,3 +467,3 @@ } | ||
}; | ||
const proposeMiddleware = async (networkContexts, middlewareContext, supportedTokenAddresses) => { | ||
const proposeMiddleware = async (networkContexts, middlewareContext, supportedTokenAddresses, getSwapRate) => { | ||
const { proposal, stateChannel } = middlewareContext; | ||
@@ -443,2 +479,6 @@ const { contractAddresses, provider } = networkContexts[stateChannel.chainId]; | ||
} | ||
case contractAddresses.GraphBatchedTransferApp: { | ||
await proposeGraphBatchedTransferMiddleware(middlewareContext, getSwapRate); | ||
break; | ||
} | ||
case contractAddresses.GraphSignedTransferApp: { | ||
@@ -481,2 +521,3 @@ proposeGraphSignedTransferMiddleware(middlewareContext); | ||
exports.GRAPH_SIGNED_TRANSFER_STATE_TIMEOUT = GRAPH_SIGNED_TRANSFER_STATE_TIMEOUT; | ||
exports.GraphBatchSignedTransferAppRegistryInfo = GraphBatchSignedTransferAppRegistryInfo; | ||
exports.GraphSignedTransferAppRegistryInfo = GraphSignedTransferAppRegistryInfo; | ||
@@ -500,2 +541,3 @@ exports.HASHLOCK_TRANSFER_STATE_TIMEOUT = HASHLOCK_TRANSFER_STATE_TIMEOUT; | ||
exports.proposeDepositMiddleware = proposeDepositMiddleware; | ||
exports.proposeGraphBatchedTransferMiddleware = proposeGraphBatchedTransferMiddleware; | ||
exports.proposeGraphSignedTransferMiddleware = proposeGraphSignedTransferMiddleware; | ||
@@ -511,2 +553,3 @@ exports.proposeHashLockTransferMiddleware = proposeHashLockTransferMiddleware; | ||
exports.validateDepositApp = validateDepositApp; | ||
exports.validateGraphBatchedTransferApp = validateGraphBatchedTransferApp; | ||
exports.validateGraphSignedTransferApp = validateGraphSignedTransferApp; | ||
@@ -513,0 +556,0 @@ exports.validateHashLockTransferApp = validateHashLockTransferApp; |
@@ -9,2 +9,3 @@ export declare const TRANSFER_TIMEOUT: import("ethers").BigNumber; | ||
export * from "./SimpleSignedTransferApp"; | ||
export * from "./GraphBatchedTransferApp"; | ||
export * from "./GraphSignedTransferApp"; | ||
@@ -11,0 +12,0 @@ export * from "./SimpleTwoPartySwapApp"; |
@@ -11,2 +11,3 @@ import { constants } from "ethers"; | ||
export * from "./SimpleSignedTransferApp"; | ||
export * from "./GraphBatchedTransferApp"; | ||
export * from "./GraphSignedTransferApp"; | ||
@@ -13,0 +14,0 @@ export * from "./SimpleTwoPartySwapApp"; |
@@ -5,3 +5,3 @@ import { Address, ContractAddresses, NetworkContexts, ProposeMiddlewareContext, ValidationMiddleware } from "@connext/types"; | ||
[chainId: number]: string[]; | ||
}) => Promise<ValidationMiddleware>; | ||
}, getSwapRate: (fromTokenAddress: Address, toTokenAddress: Address) => Promise<string>) => Promise<ValidationMiddleware>; | ||
//# sourceMappingURL=middleware.d.ts.map |
@@ -12,2 +12,3 @@ import { ProtocolNames, } from "@connext/types"; | ||
import { proposeGraphSignedTransferMiddleware } from "./GraphSignedTransferApp"; | ||
import { proposeGraphBatchedTransferMiddleware } from "./GraphBatchedTransferApp"; | ||
const getNameFromAddress = (contractAddress, appDefinition) => { | ||
@@ -26,7 +27,7 @@ const [name] = Object.entries(contractAddress).find(([name, addr]) => addr === appDefinition) || []; | ||
}; | ||
export const generateValidationMiddleware = async (networkContexts, supportedTokenAddresses) => { | ||
export const generateValidationMiddleware = async (networkContexts, supportedTokenAddresses, getSwapRate) => { | ||
const validationMiddleware = async (protocol, middlewareContext) => { | ||
switch (protocol) { | ||
case ProtocolNames.propose: { | ||
await proposeMiddleware(networkContexts, middlewareContext, supportedTokenAddresses); | ||
await proposeMiddleware(networkContexts, middlewareContext, supportedTokenAddresses, getSwapRate); | ||
break; | ||
@@ -63,3 +64,3 @@ } | ||
}; | ||
const proposeMiddleware = async (networkContexts, middlewareContext, supportedTokenAddresses) => { | ||
const proposeMiddleware = async (networkContexts, middlewareContext, supportedTokenAddresses, getSwapRate) => { | ||
const { proposal, stateChannel } = middlewareContext; | ||
@@ -75,2 +76,6 @@ const { contractAddresses, provider } = networkContexts[stateChannel.chainId]; | ||
} | ||
case contractAddresses.GraphBatchedTransferApp: { | ||
await proposeGraphBatchedTransferMiddleware(middlewareContext, getSwapRate); | ||
break; | ||
} | ||
case contractAddresses.GraphSignedTransferApp: { | ||
@@ -77,0 +82,0 @@ proposeGraphSignedTransferMiddleware(middlewareContext); |
@@ -5,5 +5,6 @@ import { DepositAppRegistryInfo } from "./DepositApp"; | ||
import { SimpleSignedTransferAppRegistryInfo } from "./SimpleSignedTransferApp"; | ||
import { GraphSignedTransferAppRegistryInfo } from "./GraphSignedTransferApp"; | ||
import { GraphBatchSignedTransferAppRegistryInfo } from "./GraphBatchedTransferApp"; | ||
import { SimpleTwoPartySwapAppRegistryInfo } from "./SimpleTwoPartySwapApp"; | ||
import { WithdrawAppRegistryInfo } from "./WithdrawApp"; | ||
import { GraphSignedTransferAppRegistryInfo } from "./GraphSignedTransferApp"; | ||
export const AppRegistry = [ | ||
@@ -13,2 +14,3 @@ SimpleLinkedTransferAppRegistryInfo, | ||
GraphSignedTransferAppRegistryInfo, | ||
GraphBatchSignedTransferAppRegistryInfo, | ||
SimpleTwoPartySwapAppRegistryInfo, | ||
@@ -15,0 +17,0 @@ WithdrawAppRegistryInfo, |
{ | ||
"name": "@connext/apps", | ||
"version": "7.0.3", | ||
"version": "7.0.4", | ||
"description": "Connext Counterfactual Apps", | ||
@@ -22,4 +22,4 @@ "main": "dist/index.js", | ||
"@connext/contracts": "3.4.1", | ||
"@connext/types": "7.0.3", | ||
"@connext/utils": "7.0.3", | ||
"@connext/types": "7.0.4", | ||
"@connext/utils": "7.0.4", | ||
"@rollup/plugin-json": "4.1.0", | ||
@@ -26,0 +26,0 @@ "ethers": "5.0.7", |
@@ -14,4 +14,5 @@ import { constants } from "ethers"; | ||
export * from "./SimpleSignedTransferApp"; | ||
export * from "./GraphBatchedTransferApp"; | ||
export * from "./GraphSignedTransferApp"; | ||
export * from "./SimpleTwoPartySwapApp"; | ||
export * from "./WithdrawApp"; |
@@ -23,2 +23,3 @@ import { | ||
import { proposeGraphSignedTransferMiddleware } from "./GraphSignedTransferApp"; | ||
import { proposeGraphBatchedTransferMiddleware } from "./GraphBatchedTransferApp"; | ||
@@ -54,2 +55,3 @@ const getNameFromAddress = (contractAddress: ContractAddresses, appDefinition: Address) => { | ||
supportedTokenAddresses: { [chainId: number]: Address[] }, | ||
getSwapRate: (fromTokenAddress: Address, toTokenAddress: Address) => Promise<string>, // for graph batched app | ||
): Promise<ValidationMiddleware> => { | ||
@@ -66,2 +68,3 @@ const validationMiddleware: ValidationMiddleware = async ( | ||
supportedTokenAddresses, | ||
getSwapRate, | ||
); | ||
@@ -110,2 +113,3 @@ break; | ||
supportedTokenAddresses: { [chainId: number]: Address[] }, | ||
getSwapRate: (fromTokenAddress: Address, toTokenAddress: Address) => Promise<string>, | ||
) => { | ||
@@ -122,2 +126,6 @@ const { proposal, stateChannel } = middlewareContext; | ||
} | ||
case contractAddresses.GraphBatchedTransferApp: { | ||
await proposeGraphBatchedTransferMiddleware(middlewareContext, getSwapRate); | ||
break; | ||
} | ||
case contractAddresses.GraphSignedTransferApp: { | ||
@@ -124,0 +132,0 @@ proposeGraphSignedTransferMiddleware(middlewareContext); |
@@ -6,5 +6,6 @@ import { AppRegistryType } from "./shared"; | ||
import { SimpleSignedTransferAppRegistryInfo } from "./SimpleSignedTransferApp"; | ||
import { GraphSignedTransferAppRegistryInfo } from "./GraphSignedTransferApp"; | ||
import { GraphBatchSignedTransferAppRegistryInfo } from "./GraphBatchedTransferApp"; | ||
import { SimpleTwoPartySwapAppRegistryInfo } from "./SimpleTwoPartySwapApp"; | ||
import { WithdrawAppRegistryInfo } from "./WithdrawApp"; | ||
import { GraphSignedTransferAppRegistryInfo } from "./GraphSignedTransferApp"; | ||
@@ -15,2 +16,3 @@ export const AppRegistry: AppRegistryType = [ | ||
GraphSignedTransferAppRegistryInfo, | ||
GraphBatchSignedTransferAppRegistryInfo, | ||
SimpleTwoPartySwapAppRegistryInfo, | ||
@@ -17,0 +19,0 @@ WithdrawAppRegistryInfo, |
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
784529
200
3204