@connext/apps
Advanced tools
Comparing version
@@ -1,2 +0,2 @@ | ||
import { CoinBalanceRefundAppStateEncoding, OutcomeType, CoinBalanceRefundApp, } from "@connext/types"; | ||
import { coinBalanceRefundAppStateEncoding, OutcomeType, CoinBalanceRefundApp, } from "@connext/types"; | ||
export const CoinBalanceRefundAppRegistryInfo = { | ||
@@ -6,4 +6,4 @@ allowNodeInstall: true, | ||
outcomeType: OutcomeType.SINGLE_ASSET_TWO_PARTY_COIN_TRANSFER, | ||
stateEncoding: CoinBalanceRefundAppStateEncoding, | ||
stateEncoding: coinBalanceRefundAppStateEncoding, | ||
}; | ||
//# sourceMappingURL=registry.js.map |
@@ -1,8 +0,8 @@ | ||
import { convertAssetAmountWithId, convertCoinTransfers, convertFields, getType, } from "@connext/types"; | ||
import { convertCoinTransfers, convertFields, getType, } from "@connext/types"; | ||
export function convertHashLockTransferParameters(to, obj) { | ||
return convertAssetAmountWithId(to, obj); | ||
return convertFields(getType(obj.amount), to, ["timelock", "amount"], Object.assign({}, obj)); | ||
} | ||
export function convertHashLockTransferAppState(to, obj) { | ||
return Object.assign(Object.assign({}, convertFields(getType(obj.turnNum), to, ["turnNum"], Object.assign({}, obj))), { coinTransfers: convertCoinTransfers(to, obj.coinTransfers) }); | ||
return Object.assign(Object.assign({}, convertFields(getType(obj.timelock), to, ["timelock"], Object.assign({}, obj))), { coinTransfers: convertCoinTransfers(to, obj.coinTransfers) }); | ||
} | ||
//# sourceMappingURL=convert.js.map |
@@ -1,2 +0,2 @@ | ||
export declare const validateHashLockTransferApp: (params: import("@connext/types").ProtocolTypes.ProposeInstallParams, initiatorPublicIdentifier: string, responderPublicIdentifier: string) => void; | ||
export declare const validateHashLockTransferApp: (params: import("@connext/types").ProtocolTypes.ProposeInstallParams, blockNumber: number, initiatorPublicIdentifier: string, responderPublicIdentifier: string) => void; | ||
//# sourceMappingURL=validation.d.ts.map |
@@ -5,3 +5,3 @@ import { xkeyKthAddress } from "@connext/cf-core"; | ||
import { convertHashLockTransferAppState } from "./convert"; | ||
export const validateHashLockTransferApp = (params, initiatorPublicIdentifier, responderPublicIdentifier) => { | ||
export const validateHashLockTransferApp = (params, blockNumber, initiatorPublicIdentifier, responderPublicIdentifier) => { | ||
const { responderDeposit, initiatorDeposit, initialState: initialStateBadType } = bigNumberifyObj(params); | ||
@@ -17,4 +17,7 @@ const initiatorFreeBalanceAddress = xkeyKthAddress(initiatorPublicIdentifier); | ||
})[0]; | ||
if (initialState.timelock.lt(blockNumber)) { | ||
throw new Error(`Cannot install an app with an expired timelock. Timelock in state: ${initialState.timelock}. Current block: ${blockNumber}`); | ||
} | ||
unidirectionalCoinTransferValidation(initiatorDeposit, responderDeposit, initiatorTransfer, responderTransfer); | ||
}; | ||
//# sourceMappingURL=validation.js.map |
@@ -1,2 +0,2 @@ | ||
import { SimpleLinkedTransferAppAction, SimpleSwapAppState, SimpleLinkedTransferAppState, FastSignedTransferAppAction, FastSignedTransferAppState, CoinBalanceRefundApp, SimpleLinkedTransferApp, SimpleTwoPartySwapApp, FastSignedTransferApp, HashLockTransferApp, HashLockTransferAppAction, HashLockTransferAppState } from "@connext/types"; | ||
import { SimpleLinkedTransferAppAction, SimpleSwapAppState, SimpleLinkedTransferAppState, FastSignedTransferAppAction, FastSignedTransferAppState, WithdrawAppAction, WithdrawAppState, CoinBalanceRefundApp, SimpleLinkedTransferApp, SimpleTwoPartySwapApp, FastSignedTransferApp, HashLockTransferApp, HashLockTransferAppAction, HashLockTransferAppState, WithdrawApp } from "@connext/types"; | ||
import { BigNumber } from "ethers/utils"; | ||
@@ -9,2 +9,3 @@ import { AppRegistry as AppRegistryType } from "./shared"; | ||
export * from "./CoinBalanceRefundApp"; | ||
export * from "./WithdrawApp"; | ||
export * from "./HashLockTransferApp"; | ||
@@ -16,2 +17,3 @@ export declare const SupportedApplications: { | ||
[FastSignedTransferApp]: string; | ||
[WithdrawApp]: string; | ||
[HashLockTransferApp]: string; | ||
@@ -21,6 +23,6 @@ }; | ||
export declare const AppRegistry: AppRegistryType; | ||
export declare type AppAction<T = string> = FastSignedTransferAppAction<T> | SimpleLinkedTransferAppAction | HashLockTransferAppAction; | ||
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> | SimpleLinkedTransferAppState<T> | SimpleSwapAppState<T> | HashLockTransferAppState<T>; | ||
export declare type AppState<T = string> = FastSignedTransferAppState<T> | HashLockTransferAppState<T> | SimpleLinkedTransferAppState<T> | SimpleSwapAppState<T> | WithdrawAppState<T>; | ||
export declare type AppStateBigNumber = AppState<BigNumber>; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -1,2 +0,3 @@ | ||
import { CoinBalanceRefundApp, SimpleLinkedTransferApp, SimpleTwoPartySwapApp, FastSignedTransferApp, HashLockTransferApp, } from "@connext/types"; | ||
import { CoinBalanceRefundApp, SimpleLinkedTransferApp, SimpleTwoPartySwapApp, FastSignedTransferApp, HashLockTransferApp, WithdrawApp, } from "@connext/types"; | ||
import { WithdrawAppRegistryInfo } from "./WithdrawApp"; | ||
import { FastSignedTransferAppRegistryInfo } from "./FastSignedTransferApp"; | ||
@@ -12,2 +13,3 @@ import { SimpleLinkedTransferAppRegistryInfo } from "./SimpleLinkedTransferApp"; | ||
export * from "./CoinBalanceRefundApp"; | ||
export * from "./WithdrawApp"; | ||
export * from "./HashLockTransferApp"; | ||
@@ -19,2 +21,3 @@ export const SupportedApplications = { | ||
[FastSignedTransferApp]: FastSignedTransferApp, | ||
[WithdrawApp]: WithdrawApp, | ||
[HashLockTransferApp]: HashLockTransferApp, | ||
@@ -27,4 +30,5 @@ }; | ||
CoinBalanceRefundAppRegistryInfo, | ||
WithdrawAppRegistryInfo, | ||
HashLockTransferAppRegistryInfo, | ||
]; | ||
//# sourceMappingURL=index.js.map |
@@ -1,2 +0,2 @@ | ||
import { convertAssetAmountWithId, convertAmountField, } from "@connext/types"; | ||
import { convertAssetAmountWithId, convertAmountField, convertCoinTransfersToObjIfNeeded, } from "@connext/types"; | ||
export function convertLinkedTransferParameters(to, obj) { | ||
@@ -15,2 +15,3 @@ return convertAssetAmountWithId(to, obj); | ||
export function convertLinkedTransferAppState(to, obj) { | ||
obj.coinTransfers = convertCoinTransfersToObjIfNeeded(obj.coinTransfers); | ||
return convertAssetAmountWithId(to, Object.assign(Object.assign({}, obj), { coinTransfers: [ | ||
@@ -17,0 +18,0 @@ convertAmountField(to, obj.coinTransfers[0]), |
@@ -1,3 +0,5 @@ | ||
import { convertAmountField, makeChecksumOrEthAddress, } from "@connext/types"; | ||
import { convertAmountField, makeChecksumOrEthAddress, convertCoinTransfersToObjIfNeeded } from "@connext/types"; | ||
export function convertSimpleSwapAppState(to, obj) { | ||
obj.coinTransfers[0] = convertCoinTransfersToObjIfNeeded(obj.coinTransfers[0]); | ||
obj.coinTransfers[1] = convertCoinTransfersToObjIfNeeded(obj.coinTransfers[1]); | ||
return Object.assign(Object.assign({}, obj), { coinTransfers: [ | ||
@@ -4,0 +6,0 @@ convertAmountField(to, obj.coinTransfers[0]), |
{ | ||
"name": "@connext/apps", | ||
"version": "5.2.1", | ||
"version": "6.0.0-alpha.0", | ||
"description": "Connext Counterfactual Apps", | ||
@@ -18,6 +18,8 @@ "main": "dist/index.js", | ||
"devDependencies": { | ||
"@connext/cf-core": "5.2.0", | ||
"@connext/types": "5.2.1", | ||
"@connext/cf-core": "5.2.1", | ||
"@connext/contracts": "1.0.5", | ||
"@connext/types": "6.0.0-alpha.0", | ||
"ethers": "4.0.45", | ||
"rollup": "1.31.1", | ||
"@rollup/plugin-json": "4.0.2", | ||
"rollup-plugin-typescript2": "0.26.0", | ||
@@ -24,0 +26,0 @@ "typescript": "3.7.5" |
import { | ||
CoinBalanceRefundAppStateEncoding, | ||
coinBalanceRefundAppStateEncoding, | ||
OutcomeType, | ||
@@ -13,3 +13,3 @@ CoinBalanceRefundApp, | ||
outcomeType: OutcomeType.SINGLE_ASSET_TWO_PARTY_COIN_TRANSFER, | ||
stateEncoding: CoinBalanceRefundAppStateEncoding, | ||
stateEncoding: coinBalanceRefundAppStateEncoding, | ||
}; |
@@ -16,3 +16,3 @@ import { | ||
): HashLockTransferParameters<NumericTypes[To]> { | ||
return convertAssetAmountWithId(to, obj); | ||
return convertFields(getType(obj.amount), to, ["timelock", "amount"], { ...obj }) | ||
} | ||
@@ -25,5 +25,5 @@ | ||
return { | ||
...convertFields(getType(obj.turnNum), to, ["turnNum"], { ...obj }), | ||
...convertFields(getType(obj.timelock), to, ["timelock"], { ...obj }), | ||
coinTransfers: convertCoinTransfers(to, obj.coinTransfers), | ||
}; | ||
} |
@@ -9,2 +9,3 @@ import { xkeyKthAddress } from "@connext/cf-core"; | ||
params: CFCoreTypes.ProposeInstallParams, | ||
blockNumber: number, | ||
initiatorPublicIdentifier: string, | ||
@@ -29,2 +30,8 @@ responderPublicIdentifier: string, | ||
if (initialState.timelock.lt(blockNumber)) { | ||
throw new Error( | ||
`Cannot install an app with an expired timelock. Timelock in state: ${initialState.timelock}. Current block: ${blockNumber}`, | ||
); | ||
} | ||
unidirectionalCoinTransferValidation( | ||
@@ -31,0 +38,0 @@ initiatorDeposit, |
@@ -7,2 +7,4 @@ import { | ||
FastSignedTransferAppState, | ||
WithdrawAppAction, | ||
WithdrawAppState, | ||
CoinBalanceRefundApp, | ||
@@ -15,5 +17,7 @@ SimpleLinkedTransferApp, | ||
HashLockTransferAppState, | ||
WithdrawApp, | ||
} from "@connext/types"; | ||
import { BigNumber } from "ethers/utils"; | ||
import { WithdrawAppRegistryInfo } from "./WithdrawApp"; | ||
import { FastSignedTransferAppRegistryInfo } from "./FastSignedTransferApp"; | ||
@@ -31,2 +35,3 @@ import { AppRegistry as AppRegistryType } from "./shared"; | ||
export * from "./CoinBalanceRefundApp"; | ||
export * from "./WithdrawApp"; | ||
export * from "./HashLockTransferApp"; | ||
@@ -39,2 +44,3 @@ | ||
[FastSignedTransferApp]: FastSignedTransferApp, | ||
[WithdrawApp]: WithdrawApp, | ||
[HashLockTransferApp]: HashLockTransferApp, | ||
@@ -50,2 +56,3 @@ }; | ||
CoinBalanceRefundAppRegistryInfo, | ||
WithdrawAppRegistryInfo, | ||
HashLockTransferAppRegistryInfo, | ||
@@ -56,4 +63,5 @@ ]; | ||
| FastSignedTransferAppAction<T> | ||
| HashLockTransferAppAction | ||
| SimpleLinkedTransferAppAction | ||
| HashLockTransferAppAction; | ||
| WithdrawAppAction; | ||
export type AppActionBigNumber = AppAction<BigNumber>; | ||
@@ -63,5 +71,6 @@ | ||
| FastSignedTransferAppState<T> | ||
| HashLockTransferAppState<T> | ||
| SimpleLinkedTransferAppState<T> | ||
| SimpleSwapAppState<T> | ||
| HashLockTransferAppState<T>; | ||
| WithdrawAppState<T>; | ||
export type AppStateBigNumber = AppState<BigNumber>; |
@@ -11,2 +11,3 @@ import { | ||
convertAmountField, | ||
convertCoinTransfersToObjIfNeeded, | ||
} from "@connext/types"; | ||
@@ -46,2 +47,3 @@ | ||
): SimpleLinkedTransferAppState<NumericTypes[To]> { | ||
obj.coinTransfers = convertCoinTransfersToObjIfNeeded(obj.coinTransfers); | ||
return convertAssetAmountWithId(to, { | ||
@@ -48,0 +50,0 @@ ...obj, |
@@ -8,2 +8,3 @@ import { | ||
makeChecksumOrEthAddress, | ||
convertCoinTransfersToObjIfNeeded | ||
} from "@connext/types"; | ||
@@ -15,2 +16,4 @@ | ||
): SimpleSwapAppState<NumericTypes[To]> { | ||
obj.coinTransfers[0] = convertCoinTransfersToObjIfNeeded(obj.coinTransfers[0]); | ||
obj.coinTransfers[1] = convertCoinTransfersToObjIfNeeded(obj.coinTransfers[1]); | ||
return { | ||
@@ -17,0 +20,0 @@ ...obj, |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
694131
67.83%145
20.83%4285
175.21%8
33.33%3
50%13
1200%1
Infinity%