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

@dydxprotocol/starkex-lib

Package Overview
Dependencies
Maintainers
10
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.10.1 to 0.10.2

4

__tests__/signable/conditional-transfer.test.ts

@@ -35,4 +35,4 @@ /**

const mockSignature = (
'062b0cfbb1540d1eca1c465a29d7a12b080366055ea56ccdebfb06b450c1d38a' +
'0712a5d857cc9c5a7c7ba2d3a798a670e616b9a48b68f20908c47948e676576d'
'04814c5d3501863134108802cab5d12df4b959654332103b837252549d24e9a6' +
'06bc01225e9f1690b08b63de2a3b179fb2927d4564b3440bbb0da4c37caf597e'
);

@@ -39,0 +39,0 @@

@@ -30,4 +30,4 @@ "use strict";

};
const mockSignature = ('062b0cfbb1540d1eca1c465a29d7a12b080366055ea56ccdebfb06b450c1d38a' +
'0712a5d857cc9c5a7c7ba2d3a798a670e616b9a48b68f20908c47948e676576d');
const mockSignature = ('04814c5d3501863134108802cab5d12df4b959654332103b837252549d24e9a6' +
'06bc01225e9f1690b08b63de2a3b179fb2927d4564b3440bbb0da4c37caf597e');
describe('SignableConditionalTransfer', () => {

@@ -34,0 +34,0 @@ describe('verifySignature()', () => {

@@ -15,5 +15,5 @@ "use strict";

// Note: Fees are not supported for conditional transfers.
const FEE_POSITION_ID_BN = new bn_js_1.default(0);
const MAX_AMOUNT_FEE_BN = new bn_js_1.default(0);
const COLLATERAL_ASSET_ID_BN = util_1.hexToBn(constants_1.COLLATERAL_ASSET_ID);
const FEE_ASSET_ID_BN = new bn_js_1.default(0);
const CONDITIONAL_TRANSFER_PREFIX = 5;

@@ -71,9 +71,10 @@ const CONDITIONAL_TRANSFER_PADDING_BITS = 81;

}
// The transfer asset and fee asset are always the collateral asset.
// The transfer asset is always the collateral asset.
// Fees are not supported for conditional transfers.
const assetIds = await hashes_1.getCacheablePedersenHash(COLLATERAL_ASSET_ID_BN, COLLATERAL_ASSET_ID_BN);
const assetIds = await hashes_1.getCacheablePedersenHash(COLLATERAL_ASSET_ID_BN, FEE_ASSET_ID_BN);
const transferPart1 = await hashes_1.getPedersenHash(await hashes_1.getPedersenHash(assetIds, receiverPublicKeyBn), conditionBn);
const transferPart2 = new bn_js_1.default(senderPositionIdBn)
// Note: Use toString() to avoid mutating senderPositionIdBn.
const transferPart2 = new bn_js_1.default(senderPositionIdBn.toString())
.iushln(constants_2.CONDITIONAL_TRANSFER_FIELD_BIT_LENGTHS.positionId).iadd(receiverPositionIdBn)
.iushln(constants_2.CONDITIONAL_TRANSFER_FIELD_BIT_LENGTHS.positionId).iadd(FEE_POSITION_ID_BN)
.iushln(constants_2.CONDITIONAL_TRANSFER_FIELD_BIT_LENGTHS.positionId).iadd(senderPositionIdBn)
.iushln(constants_2.CONDITIONAL_TRANSFER_FIELD_BIT_LENGTHS.nonce).iadd(nonceBn);

@@ -92,2 +93,2 @@ const transferPart3 = new bn_js_1.default(CONDITIONAL_TRANSFER_PREFIX)

exports.SignableConditionalTransfer = SignableConditionalTransfer;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZGl0aW9uYWwtdHJhbnNmZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvc2lnbmFibGUvY29uZGl0aW9uYWwtdHJhbnNmZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7O0FBQUEsa0RBQXVCO0FBRXZCLDRDQUdzQjtBQUN0Qix3Q0FJb0I7QUFDcEIsc0NBS3FCO0FBS3JCLDJDQUFxRTtBQUNyRSxxQ0FHa0I7QUFDbEIscURBQWlEO0FBRWpELDBEQUEwRDtBQUMxRCxNQUFNLGtCQUFrQixHQUFHLElBQUksZUFBRSxDQUFDLENBQUMsQ0FBQyxDQUFDO0FBQ3JDLE1BQU0sa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CLENBQUM7YUFDbEYsTUFBTSxDQUFDLGtEQUFzQyxDQUFDLEtBQUssQ0FBQyxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUMsQ0FBQztRQUN0RSxNQUFNLGFBQWEsR0FBRyxJQUFJLGVBQUUsQ0FBQywyQkFBMkIsQ0FBQzthQUN0RCxNQUFNLENBQUMsa0RBQXNDLENBQUMsY0FBYyxDQUFDLENBQUMsSUFBSSxDQUFDLGdCQUFnQixDQUFDO2FBQ3BGLE1BQU0sQ0FBQyxrREFBc0MsQ0FBQyxjQUFjLENBQUMsQ0FBQyxJQUFJLENBQUMsaUJBQWlCLENBQUM7YUFDckYsTUFBTSxDQUFDLGtEQUFzQyxDQUFDLG9CQUFvQixDQUFDLENBQUMsSUFBSSxDQUN2RSxzQkFBc0IsQ0FDdkI7YUFDQSxNQUFNLENBQUMsaUNBQWlDLENBQUMsQ0FBQztRQUU3QyxPQUFPLHdCQUFlLENBQ3BCLE1BQU0sd0JBQWUsQ0FDbkIsYUFBYSxFQUNiLGFBQWEsQ0FDZCxFQUNELGFBQWEsQ0FDZCxDQUFDO0lBQ0osQ0FBQztJQUVELFdBQVc7UUFDVCxPQUFPLElBQUksQ0FBQyxPQUFPLENBQUM7SUFDdEIsQ0FBQztDQUNGO0FBbEdELGtFQWtHQyJ9
{
"name": "@dydxprotocol/starkex-lib",
"version": "0.10.1",
"version": "0.10.2",
"description": "Cryptographic functions for use with StarkEx",

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

@@ -30,6 +30,6 @@ import BN from 'bn.js';

// Note: Fees are not supported for conditional transfers.
const FEE_POSITION_ID_BN = new BN(0);
const MAX_AMOUNT_FEE_BN = new BN(0);
const COLLATERAL_ASSET_ID_BN = hexToBn(COLLATERAL_ASSET_ID);
const FEE_ASSET_ID_BN = new BN(0);
const CONDITIONAL_TRANSFER_PREFIX = 5;

@@ -103,5 +103,5 @@ const CONDITIONAL_TRANSFER_PADDING_BITS = 81;

// The transfer asset and fee asset are always the collateral asset.
// The transfer asset is always the collateral asset.
// Fees are not supported for conditional transfers.
const assetIds = await getCacheablePedersenHash(COLLATERAL_ASSET_ID_BN, COLLATERAL_ASSET_ID_BN);
const assetIds = await getCacheablePedersenHash(COLLATERAL_ASSET_ID_BN, FEE_ASSET_ID_BN);

@@ -115,5 +115,6 @@ const transferPart1 = await getPedersenHash(

);
const transferPart2 = new BN(senderPositionIdBn)
// Note: Use toString() to avoid mutating senderPositionIdBn.
const transferPart2 = new BN(senderPositionIdBn.toString())
.iushln(CONDITIONAL_TRANSFER_FIELD_BIT_LENGTHS.positionId).iadd(receiverPositionIdBn)
.iushln(CONDITIONAL_TRANSFER_FIELD_BIT_LENGTHS.positionId).iadd(FEE_POSITION_ID_BN)
.iushln(CONDITIONAL_TRANSFER_FIELD_BIT_LENGTHS.positionId).iadd(senderPositionIdBn)
.iushln(CONDITIONAL_TRANSFER_FIELD_BIT_LENGTHS.nonce).iadd(nonceBn);

@@ -120,0 +121,0 @@ const transferPart3 = new BN(CONDITIONAL_TRANSFER_PREFIX)

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