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

@connext/types

Package Overview
Dependencies
Maintainers
4
Versions
242
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@connext/types - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

33

dist/index-iife.js

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

const BigNumber = ethers.utils.BigNumber;
(function (EventName) {
EventName["CREATE_CHANNEL"] = "createChannelEvent";
EventName["INSTALL_VIRTUAL"] = "installVirtualEvent";
EventName["PROPOSE_INSTALL_VIRTUAL"] = "proposeInstallVirtualEvent";
EventName["UNINSTALL_VIRTUAL"] = "uninstallVirtualEvent";
EventName["UPDATE_STATE"] = "updateStateEvent";
EventName["WITHDRAWAL"] = "withdrawEvent";
})(exports.EventName || (exports.EventName = {}));
const SupportedApplications = {

@@ -88,3 +80,3 @@ EthUnidirectionalTransferApp: "EthUnidirectionalTransferApp",

}
function convertDepositToAsset(to, obj) {
function convertDepositParametersToAsset(to, obj) {
const asset = Object.assign({}, obj);

@@ -96,3 +88,3 @@ if (!asset.assetId) {

}
function convertTransferToAsset(to, obj) {
function convertTransferParametersToAsset(to, obj) {
const asset = Object.assign({}, obj);

@@ -104,5 +96,20 @@ if (!asset.assetId) {

}
function convertWithdrawParametersToAsset(to, obj) {
const asset = Object.assign({}, obj);
if (!asset.assetId) {
asset.assetId = ethers.constants.AddressZero;
}
return convertAssetAmount(to, asset);
}
function convertAppState(to, obj) {
return Object.assign({}, obj, { transfers: [convertAssetAmount(to, obj.transfers[0]), convertAssetAmount(to, obj.transfers[1])] });
}
const convert = {
AppState: convertAppState,
Asset: convertAssetAmount,
Deposit: convertDepositParametersToAsset,
Multisig: convertMultisig,
Transfer: convertAssetAmount,
TransferParameters: convertTransferParametersToAsset,
Withdraw: convertWithdrawParametersToAsset,
};

@@ -115,7 +122,9 @@

exports.convert = convert;
exports.convertAppState = convertAppState;
exports.convertAssetAmount = convertAssetAmount;
exports.convertDepositToAsset = convertDepositToAsset;
exports.convertDepositParametersToAsset = convertDepositParametersToAsset;
exports.convertFields = convertFields;
exports.convertMultisig = convertMultisig;
exports.convertTransferToAsset = convertTransferToAsset;
exports.convertTransferParametersToAsset = convertTransferParametersToAsset;
exports.convertWithdrawParametersToAsset = convertWithdrawParametersToAsset;

@@ -122,0 +131,0 @@ return exports;

@@ -5,11 +5,2 @@ import { OutcomeType } from '@counterfactual/types';

const BigNumber = utils.BigNumber;
var EventName;
(function (EventName) {
EventName["CREATE_CHANNEL"] = "createChannelEvent";
EventName["INSTALL_VIRTUAL"] = "installVirtualEvent";
EventName["PROPOSE_INSTALL_VIRTUAL"] = "proposeInstallVirtualEvent";
EventName["UNINSTALL_VIRTUAL"] = "uninstallVirtualEvent";
EventName["UPDATE_STATE"] = "updateStateEvent";
EventName["WITHDRAWAL"] = "withdrawEvent";
})(EventName || (EventName = {}));
const SupportedApplications = {

@@ -88,3 +79,3 @@ EthUnidirectionalTransferApp: "EthUnidirectionalTransferApp",

}
function convertDepositToAsset(to, obj) {
function convertDepositParametersToAsset(to, obj) {
const asset = Object.assign({}, obj);

@@ -96,3 +87,3 @@ if (!asset.assetId) {

}
function convertTransferToAsset(to, obj) {
function convertTransferParametersToAsset(to, obj) {
const asset = Object.assign({}, obj);

@@ -104,7 +95,22 @@ if (!asset.assetId) {

}
function convertWithdrawParametersToAsset(to, obj) {
const asset = Object.assign({}, obj);
if (!asset.assetId) {
asset.assetId = constants.AddressZero;
}
return convertAssetAmount(to, asset);
}
function convertAppState(to, obj) {
return Object.assign({}, obj, { transfers: [convertAssetAmount(to, obj.transfers[0]), convertAssetAmount(to, obj.transfers[1])] });
}
const convert = {
AppState: convertAppState,
Asset: convertAssetAmount,
Deposit: convertDepositParametersToAsset,
Multisig: convertMultisig,
Transfer: convertAssetAmount,
TransferParameters: convertTransferParametersToAsset,
Withdraw: convertWithdrawParametersToAsset,
};
export { AppRegistry, BigNumber, EventName, SupportedApplications, SupportedNetworks, convert, convertAssetAmount, convertDepositToAsset, convertFields, convertMultisig, convertTransferToAsset };
export { AppRegistry, BigNumber, SupportedApplications, SupportedNetworks, convert, convertAppState, convertAssetAmount, convertDepositParametersToAsset, convertFields, convertMultisig, convertTransferParametersToAsset, convertWithdrawParametersToAsset };

@@ -9,10 +9,2 @@ 'use strict';

const BigNumber = ethers.utils.BigNumber;
(function (EventName) {
EventName["CREATE_CHANNEL"] = "createChannelEvent";
EventName["INSTALL_VIRTUAL"] = "installVirtualEvent";
EventName["PROPOSE_INSTALL_VIRTUAL"] = "proposeInstallVirtualEvent";
EventName["UNINSTALL_VIRTUAL"] = "uninstallVirtualEvent";
EventName["UPDATE_STATE"] = "updateStateEvent";
EventName["WITHDRAWAL"] = "withdrawEvent";
})(exports.EventName || (exports.EventName = {}));
const SupportedApplications = {

@@ -91,3 +83,3 @@ EthUnidirectionalTransferApp: "EthUnidirectionalTransferApp",

}
function convertDepositToAsset(to, obj) {
function convertDepositParametersToAsset(to, obj) {
const asset = Object.assign({}, obj);

@@ -99,3 +91,3 @@ if (!asset.assetId) {

}
function convertTransferToAsset(to, obj) {
function convertTransferParametersToAsset(to, obj) {
const asset = Object.assign({}, obj);

@@ -107,5 +99,20 @@ if (!asset.assetId) {

}
function convertWithdrawParametersToAsset(to, obj) {
const asset = Object.assign({}, obj);
if (!asset.assetId) {
asset.assetId = ethers.constants.AddressZero;
}
return convertAssetAmount(to, asset);
}
function convertAppState(to, obj) {
return Object.assign({}, obj, { transfers: [convertAssetAmount(to, obj.transfers[0]), convertAssetAmount(to, obj.transfers[1])] });
}
const convert = {
AppState: convertAppState,
Asset: convertAssetAmount,
Deposit: convertDepositParametersToAsset,
Multisig: convertMultisig,
Transfer: convertAssetAmount,
TransferParameters: convertTransferParametersToAsset,
Withdraw: convertWithdrawParametersToAsset,
};

@@ -118,6 +125,8 @@

exports.convert = convert;
exports.convertAppState = convertAppState;
exports.convertAssetAmount = convertAssetAmount;
exports.convertDepositToAsset = convertDepositToAsset;
exports.convertDepositParametersToAsset = convertDepositParametersToAsset;
exports.convertFields = convertFields;
exports.convertMultisig = convertMultisig;
exports.convertTransferToAsset = convertTransferToAsset;
exports.convertTransferParametersToAsset = convertTransferParametersToAsset;
exports.convertWithdrawParametersToAsset = convertWithdrawParametersToAsset;

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

import { MessagingConfig } from "@connext/messaging";
import { Address, NetworkContext, Node as NodeTypes } from "@counterfactual/types";

@@ -7,10 +8,2 @@ import { utils } from "ethers";

export declare type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>>;
export declare enum EventName {
CREATE_CHANNEL = "createChannelEvent",
INSTALL_VIRTUAL = "installVirtualEvent",
PROPOSE_INSTALL_VIRTUAL = "proposeInstallVirtualEvent",
UNINSTALL_VIRTUAL = "uninstallVirtualEvent",
UPDATE_STATE = "updateStateEvent",
WITHDRAWAL = "withdrawEvent"
}
export declare type EthUnidirectionalTransferAppInitialState<T = string> = {

@@ -52,3 +45,3 @@ finalized: false;

id: number;
channel: NodeChannel<T>;
channel: NodeChannel;
appRegistry: AppRegistry;

@@ -96,6 +89,7 @@ appId: number;

xpub: string;
channels: NodeChannel<T>[];
channels: NodeChannel[];
};
export declare type UserBigNumber = User<BigNumber>;
export declare type NodeChannel<T = string> = {
export declare type NodeChannel = {
id: number;
nodePublicIdentifier: string;

@@ -105,7 +99,3 @@ userPublicIdentifier: string;

available: boolean;
freeBalancePartyA: T;
freeBalancePartyB: T;
nonce: number;
};
export declare type NodeChannelBigNumber = NodeChannel<BigNumber>;
export declare type Channel<T = string> = {

@@ -170,8 +160,7 @@ id: number;

nodePublicIdentifier: string;
clusterId?: string;
servers: string[];
token?: string;
messaging: MessagingConfig;
};
export declare type GetChannelResponse = NodeChannel;
export declare type CreateChannelResponse = NodeChannel;
export declare type RequestCollateralResponse = NodeTypes.DepositResult | undefined;
export declare type DepositParameters<T = string> = Omit<AssetAmount<T>, "assetId"> & {

@@ -192,3 +181,3 @@ assetId?: Address;

export declare type ExchangeParametersBigNumber = ExchangeParameters<BigNumber>;
export declare type WithdrawParameters<T = string> = AssetAmount<T> & {
export declare type WithdrawParameters<T = string> = DepositParameters<T> & {
recipient?: Address;

@@ -207,5 +196,7 @@ };

export declare function convertMultisig<To extends NumericTypeName>(to: To, obj: MultisigState<any>): MultisigState<NumericTypes[To]>;
export declare function convertDepositToAsset<To extends NumericTypeName>(to: To, obj: DepositParameters<any>): AssetAmount<NumericTypes[To]>;
export declare function convertTransferToAsset<To extends NumericTypeName>(to: To, obj: TransferParameters<any>): TransferParameters<NumericTypes[To]>;
export declare function convertDepositParametersToAsset<To extends NumericTypeName>(to: To, obj: DepositParameters<any>): AssetAmount<NumericTypes[To]>;
export declare function convertTransferParametersToAsset<To extends NumericTypeName>(to: To, obj: TransferParameters<any>): TransferParameters<NumericTypes[To]>;
export declare function convertWithdrawParametersToAsset<To extends NumericTypeName>(to: To, obj: WithdrawParameters<any>): AssetAmount<NumericTypes[To]>;
export declare function convertAppState<To extends NumericTypeName>(to: To, obj: AppState<any>): AppState<NumericTypes[To]>;
export declare const convert: any;
export {};
import { OutcomeType } from "@counterfactual/types";
import { constants, utils } from "ethers";
export const BigNumber = utils.BigNumber;
export var EventName;
(function (EventName) {
EventName["CREATE_CHANNEL"] = "createChannelEvent";
EventName["INSTALL_VIRTUAL"] = "installVirtualEvent";
EventName["PROPOSE_INSTALL_VIRTUAL"] = "proposeInstallVirtualEvent";
EventName["UNINSTALL_VIRTUAL"] = "uninstallVirtualEvent";
EventName["UPDATE_STATE"] = "updateStateEvent";
EventName["WITHDRAWAL"] = "withdrawEvent";
})(EventName || (EventName = {}));
export const SupportedApplications = {

@@ -86,3 +77,3 @@ EthUnidirectionalTransferApp: "EthUnidirectionalTransferApp",

}
export function convertDepositToAsset(to, obj) {
export function convertDepositParametersToAsset(to, obj) {
const asset = Object.assign({}, obj);

@@ -94,3 +85,3 @@ if (!asset.assetId) {

}
export function convertTransferToAsset(to, obj) {
export function convertTransferParametersToAsset(to, obj) {
const asset = Object.assign({}, obj);

@@ -102,6 +93,21 @@ if (!asset.assetId) {

}
export function convertWithdrawParametersToAsset(to, obj) {
const asset = Object.assign({}, obj);
if (!asset.assetId) {
asset.assetId = constants.AddressZero;
}
return convertAssetAmount(to, asset);
}
export function convertAppState(to, obj) {
return Object.assign({}, obj, { transfers: [convertAssetAmount(to, obj.transfers[0]), convertAssetAmount(to, obj.transfers[1])] });
}
export const convert = {
AppState: convertAppState,
Asset: convertAssetAmount,
Deposit: convertDepositParametersToAsset,
Multisig: convertMultisig,
Transfer: convertAssetAmount,
TransferParameters: convertTransferParametersToAsset,
Withdraw: convertWithdrawParametersToAsset,
};
//# sourceMappingURL=index.js.map
{
"name": "@connext/types",
"version": "0.0.2",
"version": "0.0.3",
"description": "TypeScript typings for common Connext types",

@@ -19,13 +19,15 @@ "main": "dist/index.js",

},
"dependencies": {
"ethers": "4.0.32"
},
"devDependencies": {
"@counterfactual/types": "0.0.16",
"@connext/messaging": "0.0.5",
"@counterfactual/types": "0.0.19",
"@types/jest": "24.0.15",
"jest": "24.8.0",
"rollup": "1.16.6",
"rollup-plugin-typescript2": "0.21.2",
"ts-jest": "24.0.2",
"rollup": "1.16.3",
"rollup-plugin-typescript2": "0.21.2",
"typescript": "3.5.2"
},
"dependencies": {
"ethers": "4.0.29"
}
}

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

import { MessagingConfig } from "@connext/messaging";
import { Address, NetworkContext, Node as NodeTypes, OutcomeType } from "@counterfactual/types";

@@ -14,10 +15,6 @@ import { constants, utils } from "ethers";

////// EMITTED EVENTS
export enum EventName {
CREATE_CHANNEL = "createChannelEvent",
INSTALL_VIRTUAL = "installVirtualEvent",
PROPOSE_INSTALL_VIRTUAL = "proposeInstallVirtualEvent",
UNINSTALL_VIRTUAL = "uninstallVirtualEvent",
UPDATE_STATE = "updateStateEvent",
WITHDRAWAL = "withdrawEvent",
}
// TODO: extend CF types, export their import, rename?
// NOTE: you cannot extend enum types in typescript.
// to "extend" the cf types with our own events, make it a
// const, or use a union type if needed

@@ -101,3 +98,3 @@ ////////////////////////////////////

id: number;
channel: NodeChannel<T>;
channel: NodeChannel;
appRegistry: AppRegistry;

@@ -160,7 +157,8 @@ appId: number;

xpub: string;
channels: NodeChannel<T>[];
channels: NodeChannel[];
};
export type UserBigNumber = User<BigNumber>;
export type NodeChannel<T = string> = {
export type NodeChannel = {
id: number;
nodePublicIdentifier: string;

@@ -170,8 +168,3 @@ userPublicIdentifier: string;

available: boolean;
freeBalancePartyA: T;
freeBalancePartyB: T;
nonce: number;
// TODO: add apps
};
export type NodeChannelBigNumber = NodeChannel<BigNumber>;
export type Channel<T = string> = {

@@ -252,5 +245,3 @@ id: number;

nodePublicIdentifier: string;
clusterId?: string;
servers: string[];
token?: string;
messaging: MessagingConfig;
};

@@ -262,2 +253,4 @@

export type RequestCollateralResponse = NodeTypes.DepositResult | undefined;
/////////////////////////////////

@@ -292,3 +285,3 @@ ///////// CLIENT INPUT TYPES

////// Withdraw types
export type WithdrawParameters<T = string> = AssetAmount<T> & {
export type WithdrawParameters<T = string> = DepositParameters<T> & {
recipient?: Address; // if not provided, will default to signer addr

@@ -392,3 +385,3 @@ };

*/
export function convertDepositToAsset<To extends NumericTypeName>(
export function convertDepositParametersToAsset<To extends NumericTypeName>(
to: To,

@@ -406,3 +399,3 @@ obj: DepositParameters<any>,

export function convertTransferToAsset<To extends NumericTypeName>(
export function convertTransferParametersToAsset<To extends NumericTypeName>(
to: To,

@@ -423,6 +416,34 @@ obj: TransferParameters<any>,

export function convertWithdrawParametersToAsset<To extends NumericTypeName>(
to: To,
obj: WithdrawParameters<any>,
): AssetAmount<NumericTypes[To]> {
const asset: any = {
...obj,
};
if (!asset.assetId) {
asset.assetId = constants.AddressZero;
}
return convertAssetAmount(to, asset);
}
export function convertAppState<To extends NumericTypeName>(
to: To,
obj: AppState<any>,
): AppState<NumericTypes[To]> {
return {
...obj,
transfers: [convertAssetAmount(to, obj.transfers[0]), convertAssetAmount(to, obj.transfers[1])],
};
}
// DEFINE CONVERSION OBJECT TO BE EXPORTED
export const convert: any = {
AppState: convertAppState,
Asset: convertAssetAmount,
Deposit: convertDepositParametersToAsset,
Multisig: convertMultisig,
Transfer: convertAssetAmount,
TransferParameters: convertTransferParametersToAsset,
Withdraw: convertWithdrawParametersToAsset,
};

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