Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@connext/apps

Package Overview
Dependencies
Maintainers
4
Versions
121
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@connext/apps - npm Package Compare versions

Comparing version 5.1.1 to 5.2.0

dist/src/HashLockTransferApp/convert.d.ts

41

dist/index-iife.js

@@ -10,6 +10,3 @@ this.window = this.window || {};

function convertFastSignedTransferAppState(to, obj) {
return Object.assign({ coinTransfers: [
types.convertAmountField(to, obj.coinTransfers[0]),
types.convertAmountField(to, obj.coinTransfers[1]),
] }, types.convertAmountField(to, obj));
return Object.assign(Object.assign({}, types.convertAmountField(to, obj)), { coinTransfers: types.convertCoinTransfers(to, obj.coinTransfers) });
}

@@ -74,3 +71,2 @@

const initialState = convertFastSignedTransferAppState("bignumber", initialStateBadType);
initialState.coinTransfers = initialState.coinTransfers.map((transfer) => types.bigNumberifyObj(transfer));
if (initialState.paymentId !== constants.HashZero) {

@@ -181,2 +177,31 @@ throw new Error(`Cannot install with pre-populated paymentId`);

function convertHashLockTransferParameters(to, obj) {
return types.convertAssetAmountWithId(to, obj);
}
function convertHashLockTransferAppState(to, obj) {
return Object.assign(Object.assign({}, types.convertFields(types.getType(obj.turnNum), to, ["turnNum"], Object.assign({}, obj))), { coinTransfers: types.convertCoinTransfers(to, obj.coinTransfers) });
}
const HashLockTransferAppRegistryInfo = {
name: types.HashLockTransferApp,
allowNodeInstall: true,
actionEncoding: types.HashLockTransferAppActionEncoding,
stateEncoding: types.HashLockTransferAppStateEncoding,
outcomeType: types.OutcomeType.SINGLE_ASSET_TWO_PARTY_COIN_TRANSFER,
};
const validateHashLockTransferApp = (params, initiatorPublicIdentifier, responderPublicIdentifier) => {
const { responderDeposit, initiatorDeposit, initialState: initialStateBadType } = types.bigNumberifyObj(params);
const initiatorFreeBalanceAddress = cfCore.xkeyKthAddress(initiatorPublicIdentifier);
const responderFreeBalanceAddress = cfCore.xkeyKthAddress(responderPublicIdentifier);
const initialState = convertHashLockTransferAppState("bignumber", initialStateBadType);
const initiatorTransfer = initialState.coinTransfers.filter((transfer) => {
return transfer.to === initiatorFreeBalanceAddress;
})[0];
const responderTransfer = initialState.coinTransfers.filter((transfer) => {
return transfer.to === responderFreeBalanceAddress;
})[0];
unidirectionalCoinTransferValidation(initiatorDeposit, responderDeposit, initiatorTransfer, responderTransfer);
};
const SupportedApplications = {

@@ -187,2 +212,3 @@ [types.CoinBalanceRefundApp]: types.CoinBalanceRefundApp,

[types.FastSignedTransferApp]: types.FastSignedTransferApp,
[types.HashLockTransferApp]: types.HashLockTransferApp,
};

@@ -194,2 +220,3 @@ const AppRegistry = [

CoinBalanceRefundAppRegistryInfo,
HashLockTransferAppRegistryInfo,
];

@@ -200,2 +227,3 @@

exports.FastSignedTransferAppRegistryInfo = FastSignedTransferAppRegistryInfo;
exports.HashLockTransferAppRegistryInfo = HashLockTransferAppRegistryInfo;
exports.SimpleLinkedTransferAppRegistryInfo = SimpleLinkedTransferAppRegistryInfo;

@@ -209,2 +237,4 @@ exports.SimpleTwoPartySwapAppRegistryInfo = SimpleTwoPartySwapAppRegistryInfo;

exports.convertFastSignedTransferParameters = convertFastSignedTransferParameters;
exports.convertHashLockTransferAppState = convertHashLockTransferAppState;
exports.convertHashLockTransferParameters = convertHashLockTransferParameters;
exports.convertLinkedTransferAppState = convertLinkedTransferAppState;

@@ -219,2 +249,3 @@ exports.convertLinkedTransferParameters = convertLinkedTransferParameters;

exports.validateFastSignedTransferApp = validateFastSignedTransferApp;
exports.validateHashLockTransferApp = validateHashLockTransferApp;
exports.validateSimpleLinkedTransferApp = validateSimpleLinkedTransferApp;

@@ -221,0 +252,0 @@ exports.validateSimpleSwapApp = validateSimpleSwapApp;

@@ -1,2 +0,2 @@

import { getType, convertFields, convertAmountField, FastSignedTransferApp, OutcomeType, FastSignedTransferAppStateEncoding, FastSignedTransferAppActionEncoding, bigNumberifyObj, CoinBalanceRefundApp, stringify, convertAssetAmountWithId, SimpleLinkedTransferAppActionEncoding, SimpleLinkedTransferApp, SimpleLinkedTransferAppStateEncoding, makeChecksumOrEthAddress, SimpleTwoPartySwapApp, SimpleSwapAppStateEncoding, calculateExchange, CoinBalanceRefundAppStateEncoding } from '@connext/types';
import { getType, convertFields, convertAmountField, convertCoinTransfers, FastSignedTransferApp, OutcomeType, FastSignedTransferAppStateEncoding, FastSignedTransferAppActionEncoding, bigNumberifyObj, CoinBalanceRefundApp, stringify, convertAssetAmountWithId, SimpleLinkedTransferAppActionEncoding, SimpleLinkedTransferApp, SimpleLinkedTransferAppStateEncoding, makeChecksumOrEthAddress, SimpleTwoPartySwapApp, SimpleSwapAppStateEncoding, calculateExchange, CoinBalanceRefundAppStateEncoding, HashLockTransferApp, HashLockTransferAppActionEncoding, HashLockTransferAppStateEncoding } from '@connext/types';
import { xkeyKthAddress } from '@connext/cf-core';

@@ -11,6 +11,3 @@ import { Zero, HashZero } from 'ethers/constants';

function convertFastSignedTransferAppState(to, obj) {
return Object.assign({ coinTransfers: [
convertAmountField(to, obj.coinTransfers[0]),
convertAmountField(to, obj.coinTransfers[1]),
] }, convertAmountField(to, obj));
return Object.assign(Object.assign({}, convertAmountField(to, obj)), { coinTransfers: convertCoinTransfers(to, obj.coinTransfers) });
}

@@ -75,3 +72,2 @@

const initialState = convertFastSignedTransferAppState("bignumber", initialStateBadType);
initialState.coinTransfers = initialState.coinTransfers.map((transfer) => bigNumberifyObj(transfer));
if (initialState.paymentId !== HashZero) {

@@ -182,2 +178,31 @@ throw new Error(`Cannot install with pre-populated paymentId`);

function convertHashLockTransferParameters(to, obj) {
return convertAssetAmountWithId(to, obj);
}
function convertHashLockTransferAppState(to, obj) {
return Object.assign(Object.assign({}, convertFields(getType(obj.turnNum), to, ["turnNum"], Object.assign({}, obj))), { coinTransfers: convertCoinTransfers(to, obj.coinTransfers) });
}
const HashLockTransferAppRegistryInfo = {
name: HashLockTransferApp,
allowNodeInstall: true,
actionEncoding: HashLockTransferAppActionEncoding,
stateEncoding: HashLockTransferAppStateEncoding,
outcomeType: OutcomeType.SINGLE_ASSET_TWO_PARTY_COIN_TRANSFER,
};
const validateHashLockTransferApp = (params, initiatorPublicIdentifier, responderPublicIdentifier) => {
const { responderDeposit, initiatorDeposit, initialState: initialStateBadType } = bigNumberifyObj(params);
const initiatorFreeBalanceAddress = xkeyKthAddress(initiatorPublicIdentifier);
const responderFreeBalanceAddress = xkeyKthAddress(responderPublicIdentifier);
const initialState = convertHashLockTransferAppState("bignumber", initialStateBadType);
const initiatorTransfer = initialState.coinTransfers.filter((transfer) => {
return transfer.to === initiatorFreeBalanceAddress;
})[0];
const responderTransfer = initialState.coinTransfers.filter((transfer) => {
return transfer.to === responderFreeBalanceAddress;
})[0];
unidirectionalCoinTransferValidation(initiatorDeposit, responderDeposit, initiatorTransfer, responderTransfer);
};
const SupportedApplications = {

@@ -188,2 +213,3 @@ [CoinBalanceRefundApp]: CoinBalanceRefundApp,

[FastSignedTransferApp]: FastSignedTransferApp,
[HashLockTransferApp]: HashLockTransferApp,
};

@@ -195,4 +221,5 @@ const AppRegistry = [

CoinBalanceRefundAppRegistryInfo,
HashLockTransferAppRegistryInfo,
];
export { AppRegistry, CoinBalanceRefundAppRegistryInfo, FastSignedTransferAppRegistryInfo, SimpleLinkedTransferAppRegistryInfo, SimpleTwoPartySwapAppRegistryInfo, SupportedApplications, baseCoinTransferValidation, commonAppProposalValidation, convertCoinBalanceRefund, convertFastSignedTransferAppState, convertFastSignedTransferParameters, convertLinkedTransferAppState, convertLinkedTransferParameters, convertLinkedTransferToRecipientParameters, convertResolveLinkedTransferParameters, convertResolveLinkedTransferToRecipientParameters, convertSimpleSwapAppState, convertSwapParameters, unidirectionalCoinTransferValidation, validateFastSignedTransferApp, validateSimpleLinkedTransferApp, validateSimpleSwapApp };
export { AppRegistry, CoinBalanceRefundAppRegistryInfo, FastSignedTransferAppRegistryInfo, HashLockTransferAppRegistryInfo, SimpleLinkedTransferAppRegistryInfo, SimpleTwoPartySwapAppRegistryInfo, SupportedApplications, baseCoinTransferValidation, commonAppProposalValidation, convertCoinBalanceRefund, convertFastSignedTransferAppState, convertFastSignedTransferParameters, convertHashLockTransferAppState, convertHashLockTransferParameters, convertLinkedTransferAppState, convertLinkedTransferParameters, convertLinkedTransferToRecipientParameters, convertResolveLinkedTransferParameters, convertResolveLinkedTransferToRecipientParameters, convertSimpleSwapAppState, convertSwapParameters, unidirectionalCoinTransferValidation, validateFastSignedTransferApp, validateHashLockTransferApp, validateSimpleLinkedTransferApp, validateSimpleSwapApp };

@@ -15,6 +15,3 @@ 'use strict';

function convertFastSignedTransferAppState(to, obj) {
return Object.assign({ coinTransfers: [
types.convertAmountField(to, obj.coinTransfers[0]),
types.convertAmountField(to, obj.coinTransfers[1]),
] }, types.convertAmountField(to, obj));
return Object.assign(Object.assign({}, types.convertAmountField(to, obj)), { coinTransfers: types.convertCoinTransfers(to, obj.coinTransfers) });
}

@@ -79,3 +76,2 @@

const initialState = convertFastSignedTransferAppState("bignumber", initialStateBadType);
initialState.coinTransfers = initialState.coinTransfers.map((transfer) => types.bigNumberifyObj(transfer));
if (initialState.paymentId !== constants.HashZero) {

@@ -186,2 +182,31 @@ throw new Error(`Cannot install with pre-populated paymentId`);

function convertHashLockTransferParameters(to, obj) {
return types.convertAssetAmountWithId(to, obj);
}
function convertHashLockTransferAppState(to, obj) {
return Object.assign(Object.assign({}, types.convertFields(types.getType(obj.turnNum), to, ["turnNum"], Object.assign({}, obj))), { coinTransfers: types.convertCoinTransfers(to, obj.coinTransfers) });
}
const HashLockTransferAppRegistryInfo = {
name: types.HashLockTransferApp,
allowNodeInstall: true,
actionEncoding: types.HashLockTransferAppActionEncoding,
stateEncoding: types.HashLockTransferAppStateEncoding,
outcomeType: types.OutcomeType.SINGLE_ASSET_TWO_PARTY_COIN_TRANSFER,
};
const validateHashLockTransferApp = (params, initiatorPublicIdentifier, responderPublicIdentifier) => {
const { responderDeposit, initiatorDeposit, initialState: initialStateBadType } = types.bigNumberifyObj(params);
const initiatorFreeBalanceAddress = cfCore.xkeyKthAddress(initiatorPublicIdentifier);
const responderFreeBalanceAddress = cfCore.xkeyKthAddress(responderPublicIdentifier);
const initialState = convertHashLockTransferAppState("bignumber", initialStateBadType);
const initiatorTransfer = initialState.coinTransfers.filter((transfer) => {
return transfer.to === initiatorFreeBalanceAddress;
})[0];
const responderTransfer = initialState.coinTransfers.filter((transfer) => {
return transfer.to === responderFreeBalanceAddress;
})[0];
unidirectionalCoinTransferValidation(initiatorDeposit, responderDeposit, initiatorTransfer, responderTransfer);
};
const SupportedApplications = {

@@ -192,2 +217,3 @@ [types.CoinBalanceRefundApp]: types.CoinBalanceRefundApp,

[types.FastSignedTransferApp]: types.FastSignedTransferApp,
[types.HashLockTransferApp]: types.HashLockTransferApp,
};

@@ -199,2 +225,3 @@ const AppRegistry = [

CoinBalanceRefundAppRegistryInfo,
HashLockTransferAppRegistryInfo,
];

@@ -205,2 +232,3 @@

exports.FastSignedTransferAppRegistryInfo = FastSignedTransferAppRegistryInfo;
exports.HashLockTransferAppRegistryInfo = HashLockTransferAppRegistryInfo;
exports.SimpleLinkedTransferAppRegistryInfo = SimpleLinkedTransferAppRegistryInfo;

@@ -214,2 +242,4 @@ exports.SimpleTwoPartySwapAppRegistryInfo = SimpleTwoPartySwapAppRegistryInfo;

exports.convertFastSignedTransferParameters = convertFastSignedTransferParameters;
exports.convertHashLockTransferAppState = convertHashLockTransferAppState;
exports.convertHashLockTransferParameters = convertHashLockTransferParameters;
exports.convertLinkedTransferAppState = convertLinkedTransferAppState;

@@ -224,3 +254,4 @@ exports.convertLinkedTransferParameters = convertLinkedTransferParameters;

exports.validateFastSignedTransferApp = validateFastSignedTransferApp;
exports.validateHashLockTransferApp = validateHashLockTransferApp;
exports.validateSimpleLinkedTransferApp = validateSimpleLinkedTransferApp;
exports.validateSimpleSwapApp = validateSimpleSwapApp;

7

dist/src/FastSignedTransferApp/convert.js

@@ -1,2 +0,2 @@

import { getType, convertFields, convertAmountField, } from "@connext/types";
import { getType, convertFields, convertAmountField, convertCoinTransfers, } from "@connext/types";
export function convertFastSignedTransferParameters(to, obj) {

@@ -7,7 +7,4 @@ const fromType = getType(obj.amount);

export function convertFastSignedTransferAppState(to, obj) {
return Object.assign({ coinTransfers: [
convertAmountField(to, obj.coinTransfers[0]),
convertAmountField(to, obj.coinTransfers[1]),
] }, convertAmountField(to, obj));
return Object.assign(Object.assign({}, convertAmountField(to, obj)), { coinTransfers: convertCoinTransfers(to, obj.coinTransfers) });
}
//# sourceMappingURL=convert.js.map

@@ -9,3 +9,2 @@ import { bigNumberifyObj } from "@connext/types";

const initialState = convertFastSignedTransferAppState("bignumber", initialStateBadType);
initialState.coinTransfers = initialState.coinTransfers.map((transfer) => bigNumberifyObj(transfer));
if (initialState.paymentId !== HashZero) {

@@ -12,0 +11,0 @@ throw new Error(`Cannot install with pre-populated paymentId`);

@@ -0,4 +1,4 @@

import { SimpleLinkedTransferAppAction, SimpleSwapAppState, SimpleLinkedTransferAppState, FastSignedTransferAppAction, FastSignedTransferAppState, CoinBalanceRefundApp, SimpleLinkedTransferApp, SimpleTwoPartySwapApp, FastSignedTransferApp, HashLockTransferApp, HashLockTransferAppAction, HashLockTransferAppState } from "@connext/types";
import { BigNumber } from "ethers/utils";
import { AppRegistry as AppRegistryType } from "./shared";
import { SimpleLinkedTransferAppAction, SimpleSwapAppState, SimpleLinkedTransferAppState, FastSignedTransferAppAction, FastSignedTransferAppState, CoinBalanceRefundApp, SimpleLinkedTransferApp, SimpleTwoPartySwapApp, FastSignedTransferApp } from "@connext/types";
export * from "./shared";

@@ -9,2 +9,3 @@ export * from "./FastSignedTransferApp";

export * from "./CoinBalanceRefundApp";
export * from "./HashLockTransferApp";
export declare const SupportedApplications: {

@@ -15,9 +16,10 @@ [CoinBalanceRefundApp]: string;

[FastSignedTransferApp]: string;
[HashLockTransferApp]: string;
};
export declare type SupportedApplication = keyof typeof SupportedApplications;
export declare const AppRegistry: AppRegistryType;
export declare type AppAction<T> = FastSignedTransferAppAction<T> | SimpleLinkedTransferAppAction | SimpleSwapAppState;
export declare type AppAction<T = string> = FastSignedTransferAppAction<T> | SimpleLinkedTransferAppAction | HashLockTransferAppAction;
export declare type AppActionBigNumber = AppAction<BigNumber>;
export declare type AppState<T> = FastSignedTransferAppState<T> | SimpleLinkedTransferAppState<T>;
export declare type AppState<T = string> = FastSignedTransferAppState<T> | SimpleLinkedTransferAppState<T> | SimpleSwapAppState<T> | HashLockTransferAppState<T>;
export declare type AppStateBigNumber = AppState<BigNumber>;
//# sourceMappingURL=index.d.ts.map

@@ -0,1 +1,2 @@

import { CoinBalanceRefundApp, SimpleLinkedTransferApp, SimpleTwoPartySwapApp, FastSignedTransferApp, HashLockTransferApp, } from "@connext/types";
import { FastSignedTransferAppRegistryInfo } from "./FastSignedTransferApp";

@@ -5,3 +6,3 @@ import { SimpleLinkedTransferAppRegistryInfo } from "./SimpleLinkedTransferApp";

import { CoinBalanceRefundAppRegistryInfo } from "./CoinBalanceRefundApp";
import { CoinBalanceRefundApp, SimpleLinkedTransferApp, SimpleTwoPartySwapApp, FastSignedTransferApp, } from "@connext/types";
import { HashLockTransferAppRegistryInfo } from "./HashLockTransferApp";
export * from "./shared";

@@ -12,2 +13,3 @@ export * from "./FastSignedTransferApp";

export * from "./CoinBalanceRefundApp";
export * from "./HashLockTransferApp";
export const SupportedApplications = {

@@ -18,2 +20,3 @@ [CoinBalanceRefundApp]: CoinBalanceRefundApp,

[FastSignedTransferApp]: FastSignedTransferApp,
[HashLockTransferApp]: HashLockTransferApp,
};

@@ -25,3 +28,4 @@ export const AppRegistry = [

CoinBalanceRefundAppRegistryInfo,
HashLockTransferAppRegistryInfo,
];
//# sourceMappingURL=index.js.map
{
"name": "@connext/apps",
"version": "5.1.1",
"version": "5.2.0",
"description": "Connext Counterfactual Apps",

@@ -18,4 +18,4 @@ "main": "dist/index.js",

"devDependencies": {
"@connext/cf-core": "5.1.0",
"@connext/types": "5.1.1",
"@connext/cf-core": "5.1.1",
"@connext/types": "5.2.0",
"ethers": "4.0.45",

@@ -22,0 +22,0 @@ "rollup": "1.31.1",

@@ -9,2 +9,3 @@ import {

FastSignedTransferAppState,
convertCoinTransfers,
} from "@connext/types";

@@ -25,8 +26,5 @@

return {
coinTransfers: [
convertAmountField(to, obj.coinTransfers[0]),
convertAmountField(to, obj.coinTransfers[1]),
],
...convertAmountField(to, obj),
coinTransfers: convertCoinTransfers(to, obj.coinTransfers),
};
}

@@ -19,6 +19,2 @@ import { CFCoreTypes, bigNumberifyObj, CoinTransfer, CoinTransferBigNumber } from "@connext/types";

initialState.coinTransfers = initialState.coinTransfers.map((transfer: CoinTransfer<BigNumber>) =>
bigNumberifyObj(transfer),
) as any;
if (initialState.paymentId !== HashZero) {

@@ -25,0 +21,0 @@ throw new Error(`Cannot install with pre-populated paymentId`);

@@ -1,8 +0,1 @@

import { BigNumber } from "ethers/utils";
import { FastSignedTransferAppRegistryInfo } from "./FastSignedTransferApp";
import { AppRegistry as AppRegistryType } from "./shared";
import { SimpleLinkedTransferAppRegistryInfo } from "./SimpleLinkedTransferApp";
import { SimpleTwoPartySwapAppRegistryInfo } from "./SimpleTwoPartySwapApp";
import { CoinBalanceRefundAppRegistryInfo } from "./CoinBalanceRefundApp";
import {

@@ -18,4 +11,15 @@ SimpleLinkedTransferAppAction,

FastSignedTransferApp,
HashLockTransferApp,
HashLockTransferAppAction,
HashLockTransferAppState,
} from "@connext/types";
import { BigNumber } from "ethers/utils";
import { FastSignedTransferAppRegistryInfo } from "./FastSignedTransferApp";
import { AppRegistry as AppRegistryType } from "./shared";
import { SimpleLinkedTransferAppRegistryInfo } from "./SimpleLinkedTransferApp";
import { SimpleTwoPartySwapAppRegistryInfo } from "./SimpleTwoPartySwapApp";
import { CoinBalanceRefundAppRegistryInfo } from "./CoinBalanceRefundApp";
import { HashLockTransferAppRegistryInfo } from "./HashLockTransferApp";
export * from "./shared";

@@ -26,2 +30,3 @@ export * from "./FastSignedTransferApp";

export * from "./CoinBalanceRefundApp";
export * from "./HashLockTransferApp";

@@ -33,2 +38,3 @@ export const SupportedApplications = {

[FastSignedTransferApp]: FastSignedTransferApp,
[HashLockTransferApp]: HashLockTransferApp,
};

@@ -43,11 +49,16 @@

CoinBalanceRefundAppRegistryInfo,
HashLockTransferAppRegistryInfo,
];
export type AppAction<T> =
export type AppAction<T = string> =
| FastSignedTransferAppAction<T>
| SimpleLinkedTransferAppAction
| SimpleSwapAppState;
| HashLockTransferAppAction;
export type AppActionBigNumber = AppAction<BigNumber>;
export type AppState<T> = FastSignedTransferAppState<T> | SimpleLinkedTransferAppState<T>;
export type AppState<T = string> =
| FastSignedTransferAppState<T>
| SimpleLinkedTransferAppState<T>
| SimpleSwapAppState<T>
| HashLockTransferAppState<T>;
export type AppStateBigNumber = AppState<BigNumber>;

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc