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

@dydxprotocol/starkex-lib

Package Overview
Dependencies
Maintainers
8
Versions
62
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@dydxprotocol/starkex-lib - npm Package Compare versions

Comparing version 0.2.6 to 0.3.0

31

__tests__/orders.test.ts

@@ -9,2 +9,3 @@ /**

import Big from 'big.js';
import _ from 'lodash';

@@ -14,2 +15,3 @@

InternalOrder,
InternalOrderWithPriceAndClientId,
KeyPair,

@@ -21,2 +23,3 @@ OrderSide,

import { generateKeyPair } from '../src/keys';
import { nonceFromClientId } from '../src/helpers';
import { normalizeHex } from '../src/util';

@@ -90,5 +93,31 @@

it('signs an order with quoteAmount instead of price', () => {
const originalOrder = signatureExample.order as InternalOrder;
const order: InternalOrder = {
...originalOrder,
quoteAmount: new Big(originalOrder.size).times(originalOrder.price!).toFixed(),
price: undefined,
};
const privateKey: string = signatureExample.keyPair.privateKey;
const expectedSignature: string = signatureExample.signature;
const signature: string = Order.fromInternal(order).sign(privateKey);
expect(signature).toEqual(expectedSignature);
});
it('signs an order with nonce instead of clientId', () => {
const originalOrder = signatureExample.order as InternalOrder;
const order: InternalOrder = {
...originalOrder,
nonce: nonceFromClientId(originalOrder.clientId!),
clientId: undefined,
};
const privateKey: string = signatureExample.keyPair.privateKey;
const expectedSignature: string = signatureExample.signature;
const signature: string = Order.fromInternal(order).sign(privateKey);
expect(signature).toEqual(expectedSignature);
});
it('generates a different signature when the client ID is different', () => {
const privateKey: string = signatureExample.keyPair.privateKey;
const order: InternalOrder = signatureExample.order as InternalOrder;
const order = signatureExample.order as InternalOrderWithPriceAndClientId;
const newOrder = {

@@ -95,0 +124,0 @@ ...order,

@@ -13,5 +13,7 @@ "use strict";

Object.defineProperty(exports, "__esModule", { value: true });
const big_js_1 = __importDefault(require("big.js"));
const lodash_1 = __importDefault(require("lodash"));
const types_1 = require("../src/types");
const keys_1 = require("../src/keys");
const helpers_1 = require("../src/helpers");
const util_1 = require("../src/util");

@@ -71,2 +73,26 @@ // Module under test.

});
it('signs an order with quoteAmount instead of price', () => {
const originalOrder = signature_example_json_1.default.order;
const order = {
...originalOrder,
quoteAmount: new big_js_1.default(originalOrder.size).times(originalOrder.price).toFixed(),
price: undefined,
};
const privateKey = signature_example_json_1.default.keyPair.privateKey;
const expectedSignature = signature_example_json_1.default.signature;
const signature = order_1.default.fromInternal(order).sign(privateKey);
expect(signature).toEqual(expectedSignature);
});
it('signs an order with nonce instead of clientId', () => {
const originalOrder = signature_example_json_1.default.order;
const order = {
...originalOrder,
nonce: helpers_1.nonceFromClientId(originalOrder.clientId),
clientId: undefined,
};
const privateKey = signature_example_json_1.default.keyPair.privateKey;
const expectedSignature = signature_example_json_1.default.signature;
const signature = order_1.default.fromInternal(order).sign(privateKey);
expect(signature).toEqual(expectedSignature);
});
it('generates a different signature when the client ID is different', () => {

@@ -158,2 +184,2 @@ const privateKey = signature_example_json_1.default.keyPair.privateKey;

}
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3JkZXJzLnRlc3QuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9fX3Rlc3RzX18vb3JkZXJzLnRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBOzs7Ozs7R0FNRzs7Ozs7QUFFSCxvREFBdUI7QUFFdkIsd0NBTXNCO0FBQ3RCLHNDQUE4QztBQUM5QyxzQ0FBMkM7QUFFM0MscUJBQXFCO0FBQ3JCLHlEQUFpQztBQUVqQyxlQUFlO0FBQ2YsMkZBQTZEO0FBRTdELE1BQU0sYUFBYSxHQUFZLGdCQUFDLENBQUMsU0FBUyxDQUFDLGdDQUFnQixDQUFDLE9BQU8sRUFBRSxtQkFBWSxDQUFDLENBQUM7QUFFbkYsUUFBUSxDQUFDLFFBQVEsRUFBRSxHQUFHLEVBQUU7SUFFd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0FBQyxVQUFVLENBQUMsQ0FBQztZQUNqRSxJQUFJLENBQUMsUUFBUSxDQUFDLGVBQWUsQ0FBQyxjQUFjLENBQUMsRUFBRTtnQkFDN0MseUNBQXlDO2dCQUN6QyxPQUFPLENBQUMsR0FBRyxDQUNULDZCQUE2QixJQUFJLENBQUMsU0FBUyxDQUFDLE9BQU8sQ0FBQyxHQUFHO29CQUN2RCxpQkFBaUIsSUFBSSxDQUFDLFNBQVMsQ0FBQyxjQUFjLENBQUMsRUFBRSxDQUNsRCxDQUFDO2dCQUNGLE1BQU0sR0FBRyxJQUFJLENBQUM7YUFDZjtTQUNGO1FBQ0QsTUFBTSxDQUFDLE1BQU0sQ0FBQyxDQUFDLElBQUksQ0FBQyxLQUFLLENBQUMsQ0FBQztJQUM3QixDQUFDLENBQUMsQ0FBQztBQUNMLENBQUMsQ0FBQyxDQUFDO0FBRUg7O0dBRUc7QUFDSCxTQUFTLGlCQUFpQixDQUFDLENBQVMsRUFBRSxDQUFTO0lBQzdDLE1BQU0sT0FBTyxHQUFHLENBQUMsQ0FBQyxNQUFNLENBQUMsUUFBUSxDQUFDLENBQUMsQ0FBQyxDQUFDLENBQUMsRUFBRSxFQUFFLENBQUMsR0FBRyxDQUFDLENBQUMsR0FBRyxFQUFFLENBQUMsQ0FBQyxRQUFRLENBQUMsRUFBRSxDQUFDLENBQUM7SUFDcEUsTUFBTSxTQUFTLEdBQUcsR0FBRyxDQUFDLENBQUMsS0FBSyxDQUFDLENBQUMsRUFBRSxDQUFDLENBQUMsR0FBRyxPQUFPLEdBQUcsQ0FBQyxDQUFDLEtBQUssQ0FBQyxDQUFDLEdBQUcsQ0FBQyxDQUFDLEVBQUUsQ0FBQztJQUNoRSxPQUFPLFNBQVMsQ0FBQztBQUNuQixDQUFDIn0=

12

build/src/helpers.d.ts
/**
* Helper functions exported by starkex-lib.
*/
import { EcKeyPair, EcPublicKey, KeyPair, OrderSide, PerpetualMarket, SignatureStruct, Asset } from './types';
import { Asset, EcKeyPair, EcPublicKey, InternalOrder, KeyPair, SignatureStruct, StarkwareAmounts } from './types';
/**

@@ -51,10 +51,6 @@ * Helper for if you want to access additional cryptographic functionality with a private key.

* Get Starkware order fields, given paramters from an order and/or fill.
*
* Must provide either quoteAmount or price.
*/
export declare function getStarkwareAmounts(market: PerpetualMarket, side: OrderSide, size: string, price: string): {
amountSynthetic: string;
amountCollateral: string;
assetIdSynthetic: Asset;
assetIdCollateral: Asset;
isBuyingSynthetic: boolean;
};
export declare function getStarkwareAmounts(params: Pick<InternalOrder, 'market' | 'side' | 'size' | 'quoteAmount' | 'price'>): StarkwareAmounts;
/**

@@ -61,0 +57,0 @@ * Generate a nonce deterministically from an ID set on the order by the client.

@@ -130,4 +130,8 @@ "use strict";

* Get Starkware order fields, given paramters from an order and/or fill.
*
* Must provide either quoteAmount or price.
*/
function getStarkwareAmounts(market, side, size, price) {
function getStarkwareAmounts(params) {
const { market, side, size, quoteAmount, price, } = params;
// Determine side and assets.
const isBuyingSynthetic = side === types_1.OrderSide.BUY;

@@ -139,3 +143,6 @@ const assetIdSynthetic = constants_1.BASE_TOKEN[market];

const assetIdCollateral = constants_1.MARGIN_TOKEN;
const cost = new big_js_1.default(size).times(price).toFixed();
// Determine amounts.
const cost = typeof quoteAmount === 'string'
? quoteAmount
: new big_js_1.default(size).times(price).toFixed(); // Safe non-null assertion based on InternalOrder type.
const amountSynthetic = toQuantum(size, assetIdSynthetic);

@@ -165,2 +172,2 @@ const amountCollateral = toQuantum(cost, assetIdCollateral);

exports.nonceFromClientId = nonceFromClientId;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaGVscGVycy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uL3NyYy9oZWxwZXJzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTs7R0FFRzs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OztBQUVILG9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hash.
const nonce = helpers_1.nonceFromClientId(order.clientId);
// Nonce may be created by hashing the client-provided ID. Does not need to be a secure hash.
const nonce = typeof order.nonce === 'string'
? order.nonce
: helpers_1.nonceFromClientId(order.clientId); // Safe non-null assertion based on InternalOrder type.
// This is the public key x-coordinate as a hex string, without 0x prefix.

@@ -47,3 +49,3 @@ const publicKey = order.starkKey;

// well-defined and applied consistently.
const { amountSynthetic, amountCollateral, assetIdSynthetic, assetIdCollateral, isBuyingSynthetic, } = helpers_1.getStarkwareAmounts(order.market, order.side, order.size, order.price);
const { amountSynthetic, amountCollateral, assetIdSynthetic, assetIdCollateral, isBuyingSynthetic, } = helpers_1.getStarkwareAmounts(order);
// The fee is an amount, not a percentage, and is always denominated in the margin token.

@@ -104,2 +106,2 @@ const amountFee = helpers_1.toQuantum(order.limitFee, constants_1.MARGIN_TOKEN);

exports.default = Order;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3JkZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvb3JkZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7O0FBQUEsb0RBQTRCO0FBRTVCLGtEQUF1QjtBQUN2Qix5REFBMkM7QUFFM0MsMkNBS3FCO0FBQ3JCLHVDQUltQjtBQUNuQiwwREFBa0M7QUFDbEMsbUNBSWlCO0FBQ2pCLGlDQUVnQjtBQUVoQjs7R0FFRztBQUNILE1BQXFCLEtBQU0sU0FBUSxrQkFBd0I7SUFFekQsTUFBTSxDQUFDLFlBQVksQ0FDakIsS0FBb0I7UUFFcEIsNkRBQTZEO1FBQzdELE1BQU0sU0FBUyxHQUFHLGlCQUFTLENBQUMsS0FBSyxDQUFDO1FBRWxDLHVGQUF1RjtRQUN2RixNQUFNLEtBQUssR0FBRywyQkFBaUIsQ0FBQyxLQUFLLENBQUMsUUFBUSxDQUFD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YsTUFBTSxhQUFhLEdBQUcsbUJBQVksQ0FBQyxVQUFVLENBQUMsUUFBUSxDQUFDLEVBQUUsQ0FBQyxDQUFDLENBQUM7UUFFNUQsT0FBTyxNQUFNLENBQUMsV0FBVyxDQUN2QixNQUFNLENBQUMsV0FBVyxDQUFDLHlCQUFhLENBQUMsS0FBSyxDQUFDLGdCQUFnQixDQUFDLENBQUMsRUFDekQsTUFBTSxDQUFDLFdBQVcsQ0FBQyx5QkFBYSxDQUFDLEtBQUssQ0FBQyxpQkFBaUIsQ0FBQyxDQUFDLEVBQzFELGFBQWEsQ0FDZCxDQUFDO0lBQ0osQ0FBQztDQUNGO0FBM0ZELHdCQTJGQyJ9

@@ -40,8 +40,6 @@ import * as elliptic from 'elliptic';

}
export interface InternalOrder {
clientId: string;
interface InternalOrderBase {
starkKey: string;
positionId: string;
size: string;
price: string;
limitFee: string;

@@ -52,2 +50,23 @@ market: PerpetualMarket;

}
interface WithPrice {
price: string;
quoteAmount?: undefined;
}
interface WithQuoteAmount {
price?: undefined;
quoteAmount: string;
}
interface WithClientId {
clientId: string;
nonce?: undefined;
}
interface WithNonce {
clientId?: undefined;
nonce: string;
}
export declare type InternalOrderWithPriceAndClientId = InternalOrderBase & WithPrice & WithClientId;
export declare type InternalOrderWithQuoteAmountAndClientId = (InternalOrderBase & WithQuoteAmount & WithClientId);
export declare type InternalOrderWithPriceAndNonce = InternalOrderBase & WithPrice & WithNonce;
export declare type InternalOrderWithQuoteAmountAndNonce = InternalOrderBase & WithQuoteAmount & WithNonce;
export declare type InternalOrder = (InternalOrderWithPriceAndClientId | InternalOrderWithQuoteAmountAndClientId | InternalOrderWithPriceAndNonce | InternalOrderWithQuoteAmountAndNonce);
export declare enum ApiMethod {

@@ -79,11 +98,13 @@ POST = "POST",

}
export interface StarkwareOrder extends StarkwareSignable {
orderType: OrderType;
export interface StarkwareAmounts {
amountSynthetic: string;
amountCollateral: string;
amountFee: string;
assetIdSynthetic: Asset;
assetIdCollateral: Asset;
isBuyingSynthetic: boolean;
}
export interface StarkwareOrder extends StarkwareAmounts, StarkwareSignable {
orderType: OrderType;
amountFee: string;
positionId: string;
isBuyingSynthetic: boolean;
nonce: string;

@@ -101,1 +122,2 @@ expirationTimestamp: string;

export declare type TokenStruct = EthToken | Erc20Token;
export {};

@@ -35,2 +35,2 @@ "use strict";

})(ApiMethod = exports.ApiMethod || (exports.ApiMethod = {}));
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidHlwZXMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi9zcmMvdHlwZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7O0FBR0EsSUFBWSxTQUVYO0FBRkQsV0FBWSxTQUFTO0lBQ25CLDRDQUErQixDQUFBO0FBQ2pDLENBQUMsRUFGVyxTQUFTLEdBQVQsaUJBQVMsS0FBVCxpQkFBUyxRQUVwQjtBQUVELDhDQUE4QztBQUM5QyxJQUFZLGVBSVg7QUFKRCxXQUFZLGVBQWU7SUFDekIsc0NBQW1CLENBQUE7SUFDbkIsc0NBQW1CLENBQUE7SUFDbkIsd0NBQXFCLENBQUE7QUFDdkIsQ0FBQyxFQUpXLGVBQWUsR0FBZix1QkFBZSxLQUFmLHVCQUFlLFFBSTFCO0FBRUQsSUFBWSxLQU1YO0FBTkQsV0FBWSxLQUFLO0lBQ2Ysb0JBQVcsQ0FBQTtJQUNYLG9CQUFXLENBQUE7SUFDWCxzQkFBYSxDQUFBO0lBQ2Isc0JBQWEsQ0FBQTtJQUNiLHNCQUFhLENBQUE7QUFDZixDQUFDLEVBTlcsS0FBSyxHQUFMLGFBQUssS0FBTCxhQUFLLFFBTWhCO0FBRUQsSUFBWSxTQUdYO0FBSEQsV0FBWSxTQUFTO0lBQ25CLHdCQUFXLENBQUE7SUFDWCwwQkFBYSxDQUFBO0FBQ2YsQ0FBQyxFQUhXLFNBQVMsR0FBVCxpQkFBUyxLQUFULGl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LFFBR3BCO0FBaUVELElBQVksU0FLWDtBQUxELFdBQVksU0FBUztJQUNuQiwwQkFBYSxDQUFBO0lBQ2Isd0JBQVcsQ0FBQTtJQUNYLHdCQUFXLENBQUE7SUFDWCw4QkFBaUIsQ0FBQTtBQUNuQixDQUFDLEVBTFcsU0FBUyxHQUFULGlCQUFTLEtBQVQsaUJBQVMsUUFLcEIifQ==
{
"name": "@dydxprotocol/starkex-lib",
"version": "0.2.6",
"version": "0.3.0",
"description": "Cryptographic functions for use with StarkEx",

@@ -5,0 +5,0 @@ "main": "build/src/index.js",

@@ -18,9 +18,10 @@ /**

import {
Asset,
EcKeyPair,
EcPublicKey,
InternalOrder,
KeyPair,
OrderSide,
PerpetualMarket,
SignatureStruct,
Asset,
StarkwareAmounts,
} from './types';

@@ -144,15 +145,13 @@ import {

* Get Starkware order fields, given paramters from an order and/or fill.
*
* Must provide either quoteAmount or price.
*/
export function getStarkwareAmounts(
market: PerpetualMarket,
side: OrderSide,
size: string,
price: string,
): {
amountSynthetic: string;
amountCollateral: string;
assetIdSynthetic: Asset;
assetIdCollateral: Asset;
isBuyingSynthetic: boolean;
} {
params: Pick<InternalOrder, 'market' | 'side' | 'size' | 'quoteAmount' | 'price'>,
): StarkwareAmounts {
const {
market, side, size, quoteAmount, price,
} = params;
// Determine side and assets.
const isBuyingSynthetic = side === OrderSide.BUY;

@@ -164,5 +163,10 @@ const assetIdSynthetic = BASE_TOKEN[market];

const assetIdCollateral = MARGIN_TOKEN;
const cost = new Big(size).times(price).toFixed();
// Determine amounts.
const cost = typeof quoteAmount === 'string'
? quoteAmount
: new Big(size).times(price!).toFixed(); // Safe non-null assertion based on InternalOrder type.
const amountSynthetic = toQuantum(size, assetIdSynthetic);
const amountCollateral = toQuantum(cost, assetIdCollateral);
return {

@@ -169,0 +173,0 @@ amountSynthetic,

@@ -38,4 +38,6 @@ import assert from 'assert';

// Make the nonce by hashing the client-provided ID. Does not need to be a secure hash.
const nonce = nonceFromClientId(order.clientId);
// Nonce may be created by hashing the client-provided ID. Does not need to be a secure hash.
const nonce = typeof order.nonce === 'string'
? order.nonce
: nonceFromClientId(order.clientId!); // Safe non-null assertion based on InternalOrder type.

@@ -53,3 +55,3 @@ // This is the public key x-coordinate as a hex string, without 0x prefix.

isBuyingSynthetic,
} = getStarkwareAmounts(order.market, order.side, order.size, order.price);
} = getStarkwareAmounts(order);

@@ -56,0 +58,0 @@ // The fee is an amount, not a percentage, and is always denominated in the margin token.

@@ -52,8 +52,7 @@ import * as elliptic from 'elliptic';

export interface InternalOrder {
clientId: string,
// The order must specify either quoteAmount or price.
interface InternalOrderBase {
starkKey: string,
positionId: string,
size: string,
price: string,
limitFee: string,

@@ -64,2 +63,30 @@ market: PerpetualMarket,

}
interface WithPrice {
price: string,
quoteAmount?: undefined,
}
interface WithQuoteAmount {
price?: undefined,
quoteAmount: string,
}
interface WithClientId {
clientId: string,
nonce?: undefined,
}
interface WithNonce {
clientId?: undefined,
nonce: string,
}
export type InternalOrderWithPriceAndClientId = InternalOrderBase & WithPrice & WithClientId;
export type InternalOrderWithQuoteAmountAndClientId = (
InternalOrderBase & WithQuoteAmount & WithClientId
);
export type InternalOrderWithPriceAndNonce = InternalOrderBase & WithPrice & WithNonce;
export type InternalOrderWithQuoteAmountAndNonce = InternalOrderBase & WithQuoteAmount & WithNonce;
export type InternalOrder = (
InternalOrderWithPriceAndClientId |
InternalOrderWithQuoteAmountAndClientId |
InternalOrderWithPriceAndNonce |
InternalOrderWithQuoteAmountAndNonce
);

@@ -97,11 +124,14 @@ export enum ApiMethod {

export interface StarkwareOrder extends StarkwareSignable {
orderType: OrderType;
export interface StarkwareAmounts {
amountSynthetic: string;
amountCollateral: string;
amountFee: string;
assetIdSynthetic: Asset;
assetIdCollateral: Asset;
isBuyingSynthetic: boolean;
}
export interface StarkwareOrder extends StarkwareAmounts, StarkwareSignable {
orderType: OrderType;
amountFee: string;
positionId: string;
isBuyingSynthetic: boolean;
nonce: string; // For signature.

@@ -108,0 +138,0 @@ expirationTimestamp: string; // For signature.

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