Socket
Socket
Sign inDemoInstall

@uniswap/uniswapx-sdk

Package Overview
Dependencies
Maintainers
25
Versions
48
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@uniswap/uniswapx-sdk - npm Package Compare versions

Comparing version 1.4.1 to 1.5.0

dist/src/contracts/factories/V2DutchOrderReactor__factory.d.ts

9

dist/src/builder/DutchOrderBuilder.js

@@ -19,9 +19,10 @@ "use strict";

this.permit2Address = permit2Address;
const mappedReactorAddress = constants_1.REACTOR_ADDRESS_MAPPING[chainId]
? constants_1.REACTOR_ADDRESS_MAPPING[chainId][constants_1.OrderType.Dutch]
: undefined;
if (reactorAddress) {
this.reactor(reactorAddress);
}
else if (constants_1.REACTOR_ADDRESS_MAPPING[chainId] &&
constants_1.REACTOR_ADDRESS_MAPPING[chainId][constants_1.OrderType.Dutch]) {
const reactorAddress = constants_1.REACTOR_ADDRESS_MAPPING[chainId][constants_1.OrderType.Dutch];
this.reactor(reactorAddress);
else if (mappedReactorAddress) {
this.reactor(mappedReactorAddress);
}

@@ -28,0 +29,0 @@ else {

@@ -14,7 +14,8 @@ export declare const PERMIT2_MAPPING: {

export declare enum OrderType {
Dutch = "Dutch"
Dutch = "Dutch",
Limit = "Limit"
}
declare type Reactors = {
declare type Reactors = Partial<{
[key in OrderType]: string;
};
}>;
declare type ReactorMapping = {

@@ -25,3 +26,2 @@ readonly [key: number]: Reactors;

[key: string]: {
chainId: number;
orderType: OrderType;

@@ -28,0 +28,0 @@ };

@@ -28,2 +28,3 @@ "use strict";

OrderType["Dutch"] = "Dutch";
OrderType["Limit"] = "Limit";
})(OrderType = exports.OrderType || (exports.OrderType = {}));

@@ -46,7 +47,6 @@ exports.REACTOR_ADDRESS_MAPPING = {

exports.MULTICALL_ADDRESS = "0xcA11bde05977b3631167028862bE2a173976CA11";
exports.REVERSE_REACTOR_MAPPING = Object.entries(exports.REACTOR_ADDRESS_MAPPING).reduce((acc, [chainId, orderTypes]) => {
exports.REVERSE_REACTOR_MAPPING = Object.entries(exports.REACTOR_ADDRESS_MAPPING).reduce((acc, [_, orderTypes]) => {
for (const [orderType, reactorAddress] of Object.entries(orderTypes)) {
// lowercase for consistency when parsing orders
acc[reactorAddress.toLowerCase()] = {
chainId: parseInt(chainId),
orderType: OrderType[orderType],

@@ -53,0 +53,0 @@ };

@@ -7,3 +7,4 @@ export { ExclusiveDutchOrderReactor__factory } from "./ExclusiveDutchOrderReactor__factory";

export { SwapRouter02Executor__factory } from "./SwapRouter02Executor__factory";
export { V2DutchOrderReactor__factory } from "./V2DutchOrderReactor__factory";
export { DeploylessMulticall2__factory } from "./DeploylessMulticall2__factory";
export { Multicall2__factory } from "./Multicall2__factory";
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Multicall2__factory = exports.DeploylessMulticall2__factory = exports.SwapRouter02Executor__factory = exports.Permit2__factory = exports.OrderQuoter__factory = exports.MockERC20__factory = exports.ExclusiveFillerValidation__factory = exports.ExclusiveDutchOrderReactor__factory = void 0;
exports.Multicall2__factory = exports.DeploylessMulticall2__factory = exports.V2DutchOrderReactor__factory = exports.SwapRouter02Executor__factory = exports.Permit2__factory = exports.OrderQuoter__factory = exports.MockERC20__factory = exports.ExclusiveFillerValidation__factory = exports.ExclusiveDutchOrderReactor__factory = void 0;
/* Autogenerated file. Do not edit manually. */

@@ -19,2 +19,4 @@ /* tslint:disable */

Object.defineProperty(exports, "SwapRouter02Executor__factory", { enumerable: true, get: function () { return SwapRouter02Executor__factory_1.SwapRouter02Executor__factory; } });
var V2DutchOrderReactor__factory_1 = require("./V2DutchOrderReactor__factory");
Object.defineProperty(exports, "V2DutchOrderReactor__factory", { enumerable: true, get: function () { return V2DutchOrderReactor__factory_1.V2DutchOrderReactor__factory; } });
var DeploylessMulticall2__factory_1 = require("./DeploylessMulticall2__factory");

@@ -21,0 +23,0 @@ Object.defineProperty(exports, "DeploylessMulticall2__factory", { enumerable: true, get: function () { return DeploylessMulticall2__factory_1.DeploylessMulticall2__factory; } });

@@ -7,2 +7,3 @@ export type { ExclusiveDutchOrderReactor } from "./ExclusiveDutchOrderReactor";

export type { SwapRouter02Executor } from "./SwapRouter02Executor";
export type { V2DutchOrderReactor } from "./V2DutchOrderReactor";
export type { DeploylessMulticall2 } from "./DeploylessMulticall2";

@@ -19,1 +20,2 @@ export type { Multicall2 } from "./Multicall2";

export { SwapRouter02Executor__factory } from "./factories/SwapRouter02Executor__factory";
export { V2DutchOrderReactor__factory } from "./factories/V2DutchOrderReactor__factory";
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.SwapRouter02Executor__factory = exports.Permit2__factory = exports.OrderQuoter__factory = exports.Multicall2__factory = exports.MockERC20__factory = exports.ExclusiveFillerValidation__factory = exports.ExclusiveDutchOrderReactor__factory = exports.DeploylessMulticall2__factory = exports.factories = void 0;
exports.V2DutchOrderReactor__factory = exports.SwapRouter02Executor__factory = exports.Permit2__factory = exports.OrderQuoter__factory = exports.Multicall2__factory = exports.MockERC20__factory = exports.ExclusiveFillerValidation__factory = exports.ExclusiveDutchOrderReactor__factory = exports.DeploylessMulticall2__factory = exports.factories = void 0;
const tslib_1 = require("tslib");

@@ -22,2 +22,4 @@ exports.factories = tslib_1.__importStar(require("./factories"));

Object.defineProperty(exports, "SwapRouter02Executor__factory", { enumerable: true, get: function () { return SwapRouter02Executor__factory_1.SwapRouter02Executor__factory; } });
var V2DutchOrderReactor__factory_1 = require("./factories/V2DutchOrderReactor__factory");
Object.defineProperty(exports, "V2DutchOrderReactor__factory", { enumerable: true, get: function () { return V2DutchOrderReactor__factory_1.V2DutchOrderReactor__factory; } });
//# sourceMappingURL=index.js.map

@@ -5,23 +5,4 @@ import { SignatureLike } from "@ethersproject/bytes";

import { ResolvedOrder } from "../utils/OrderQuoter";
import { Order, OrderInfo, OrderResolutionOptions } from "./types";
import { DutchInput, DutchInputJSON, DutchOutput, DutchOutputJSON, Order, OrderInfo, OrderResolutionOptions } from "./types";
export declare function id(text: string): string;
export declare type DutchOutput = {
readonly token: string;
readonly startAmount: BigNumber;
readonly endAmount: BigNumber;
readonly recipient: string;
};
export declare type DutchOutputJSON = Omit<DutchOutput, "startAmount" | "endAmount"> & {
startAmount: string;
endAmount: string;
};
export declare type DutchInput = {
readonly token: string;
readonly startAmount: BigNumber;
readonly endAmount: BigNumber;
};
export declare type DutchInputJSON = Omit<DutchInput, "startAmount" | "endAmount"> & {
startAmount: string;
endAmount: string;
};
export declare type DutchOrderInfo = OrderInfo & {

@@ -28,0 +9,0 @@ decayStartTime: number;

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

import { Order } from "./types";
export * from "./DutchOrder";
export * from "./types";
export * from "./validation";
/**
* Parses a given serialized order
* @return Parsed order object
*/
export declare function parseOrder(order: string): Order;
export * from "./V2DutchOrder";
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.parseOrder = void 0;
const tslib_1 = require("tslib");
const constants_1 = require("../constants");
const errors_1 = require("../errors");
const utils_1 = require("../utils");
const DutchOrder_1 = require("./DutchOrder");
tslib_1.__exportStar(require("./DutchOrder"), exports);
tslib_1.__exportStar(require("./types"), exports);
tslib_1.__exportStar(require("./validation"), exports);
const FIRST_FIELD_OFFSET = 88;
const ADDRESS_LENGTH = 40;
/**
* Parses a given serialized order
* @return Parsed order object
*/
function parseOrder(order) {
// reactor address is always the first field in order
const reactor = "0x" +
(0, utils_1.stripHexPrefix)(order)
.slice(FIRST_FIELD_OFFSET, FIRST_FIELD_OFFSET + ADDRESS_LENGTH)
.toLowerCase();
if (!constants_1.REVERSE_REACTOR_MAPPING[reactor]) {
throw new errors_1.MissingConfiguration("reactor", reactor);
}
const { chainId, orderType } = constants_1.REVERSE_REACTOR_MAPPING[reactor];
switch (orderType) {
case constants_1.OrderType.Dutch:
return DutchOrder_1.DutchOrder.parse(order, chainId);
default:
throw new errors_1.MissingConfiguration("orderType", orderType);
}
}
exports.parseOrder = parseOrder;
tslib_1.__exportStar(require("./V2DutchOrder"), exports);
//# sourceMappingURL=index.js.map

@@ -41,2 +41,25 @@ import { SignatureLike } from "@ethersproject/bytes";

}
export declare abstract class V2Order extends Order {
/**
* Recovers the signer (user) that signed over the inner order
* * @param signature The signature to recover
* * @returns address The address which created the signature
*/
abstract getSigner(signature: SignatureLike): string;
/**
* Returns the abi encoded full order, including cosigned data, cosignature, etc
* @return The abi encoded serialized order which can be submitted on-chain
*/
abstract serialize(): string;
/**
* Recovers the cosigner address that signed over the full order
* @param fullOrderHash The full order hash over (orderHash || cosignerData)
* @returns address The cosigner address
*/
abstract recoverCosigner(fullOrderHash: string): string;
/**
* @return Returns the full order hash over (orderHash || cosignerData)
*/
abstract hashFullOrder(): string;
}
export declare type TokenAmount = {

@@ -58,1 +81,20 @@ readonly token: string;

};
export declare type DutchOutput = {
readonly token: string;
readonly startAmount: BigNumber;
readonly endAmount: BigNumber;
readonly recipient: string;
};
export declare type DutchOutputJSON = Omit<DutchOutput, "startAmount" | "endAmount"> & {
startAmount: string;
endAmount: string;
};
export declare type DutchInput = {
readonly token: string;
readonly startAmount: BigNumber;
readonly endAmount: BigNumber;
};
export declare type DutchInputJSON = Omit<DutchInput, "startAmount" | "endAmount"> & {
startAmount: string;
endAmount: string;
};
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Order = void 0;
exports.V2Order = exports.Order = void 0;
const validation_1 = require("./validation");

@@ -15,2 +15,5 @@ class Order {

exports.Order = Order;
class V2Order extends Order {
}
exports.V2Order = V2Order;
//# sourceMappingURL=types.js.map

@@ -7,2 +7,3 @@ export * from "./OrderValidator";

export * from "./dutchDecay";
export * from "./order";
export declare function stripHexPrefix(a: string): string;

@@ -11,2 +11,3 @@ "use strict";

tslib_1.__exportStar(require("./dutchDecay"), exports);
tslib_1.__exportStar(require("./order"), exports);
function stripHexPrefix(a) {

@@ -13,0 +14,0 @@ if (a.startsWith("0x")) {

{
"name": "@uniswap/uniswapx-sdk",
"author": "Uniswap",
"version": "1.4.1",
"version": "1.5.0",
"license": "MIT",

@@ -22,3 +22,3 @@ "main": "dist/src/index.js",

"test:prettier": "prettier \"src/**/*.ts\" --list-different",
"test:unit": "jest --testPathPattern src --detectOpenHandles --forceExit",
"test:unit": "jest --testPathPattern src --detectOpenHandles --forceExit --testPathIgnorePatterns dist/",
"test:integration": "yarn build && cd integration && yarn && yarn test",

@@ -25,0 +25,0 @@ "prepare": "npm run build",

@@ -49,7 +49,9 @@ # uniswapx-sdk

```ts
import { parseOrder, Order, OrderValidation } from '@uniswap/uniswapx-sdk';
import { DutchOrder, Order } from '@uniswap/uniswapx-sdk';
const serializedOrder = '0x1111222233334444555500000000234300234...';
const order: Order = parseOrder(serializedOrder);
const chainId = 1;
const order: Order = DutchOrder.parse(serializedOrder, chainId);
const orderData = order.info;

@@ -56,0 +58,0 @@ const orderHash = order.hash();

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

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