@dydxprotocol/starkex-lib
Advanced tools
Comparing version 0.7.0 to 0.8.0
@@ -33,4 +33,4 @@ /** | ||
const mockSignature = ( | ||
'014dedad7bd42da36e81ce627e55be508a4afe019700dd478ea8134b3549d327' + | ||
'0571d1dcbab6f25f4d2f3af054f359773289266c69df91c9608882f0a9b201d8' | ||
'067e90143a21d8a6aca85207de5e124e9644f7adc18deb42c5cf1240766e57bb' + | ||
'04a39c4fdadf214d7282a59d37b21e0d3ea7fe1fc0d0ee25c22a3dd9d5cb8307' | ||
); | ||
@@ -94,3 +94,3 @@ | ||
it('converts human amounts to quantum amounts', () => { | ||
it('converts human amounts to quantum amounts and converts expiration to hours', () => { | ||
const starkwareConditionalTransfer: StarkwareConditionalTransfer = ( | ||
@@ -100,2 +100,3 @@ new SignableConditionalTransfer(mockParams).toStarkware() | ||
expect(starkwareConditionalTransfer.quantumsAmount).toEqual('49478023'); | ||
expect(starkwareConditionalTransfer.expirationEpochHours).toBe(444533); | ||
}); | ||
@@ -102,0 +103,0 @@ }); |
@@ -44,8 +44,8 @@ /** | ||
const mockSignature = ( | ||
'059487ea7c537f34516f4dc7c54ad30ab0096823269ba18aea0e64e13fb03462' + | ||
'03be73ed4dafbf99baeeaee6dce315cd834b5e3257d4e74371d14cf8f2189a59' | ||
'0398287472161cba0e6386ff0b2f25f39ba37c646b7bbadace80eee6b8e7157d' + | ||
'01ba924272e1e42b3211b96bbbe012e7e8101e1b3e5b83ea90d161ad11fcced4' | ||
); | ||
const mockSignatureEvenY = ( | ||
'030644ef5b2de9e93f13df5a4cf8284e7256223366b5da29bf2002ed40825171' + | ||
'03961ec47c34c49e97095c546895cc22afa6e563474615729720fd8b768c5b87' | ||
'05cf391a69386f53693344bada2e0d245879f3c6a98971498b2862ff2f359c49' + | ||
'0737deea7e201eaa86c8d6eeb2c1ca3ce89ac248b3fe1a6182301aa72d6e8e4f' | ||
); | ||
@@ -172,9 +172,12 @@ | ||
it('converts human amounts to quantum amounts', () => { | ||
it('converts human amounts to quantum amounts and converts expiration to hours', () => { | ||
const starkwareOrder: StarkwareOrder = SignableOrder | ||
.fromOrder(mockOrder) | ||
.toStarkware(); | ||
expect(starkwareOrder.quantumsAmountSynthetic).toEqual('14500050000'); | ||
expect(starkwareOrder.quantumsAmountCollateral).toEqual('50750272151'); | ||
expect(starkwareOrder.quantumsAmountFee).toEqual('6343784019'); | ||
expect(starkwareOrder.quantumsAmountSynthetic).toBe('14500050000'); | ||
expect(starkwareOrder.quantumsAmountCollateral).toBe('50750272151'); | ||
expect(starkwareOrder.quantumsAmountFee).toBe('6343784019'); | ||
// Order expiration should be rounded up, and should have a buffer added. | ||
expect(starkwareOrder.expirationEpochHours).toBe(444581); | ||
}); | ||
@@ -181,0 +184,0 @@ |
@@ -32,4 +32,4 @@ /** | ||
const mockSignature = ( | ||
'0214a0ab2f3c065c5848ad9dbac6cc98509b66e76a8f563d5c8ffda01b0fa2e0' + | ||
'07242b1c65d039fe645d122ecea7c3e58c8fda5814e0c152dbdeef4af706ad06' | ||
'05e48c33f8205a5359c95f1bd7385c1c1f587e338a514298c07634c0b6c952ba' + | ||
'0687d6980502a5d7fa84ef6fdc00104db22c43c7fb83e88ca84f19faa9ee3de1' | ||
); | ||
@@ -115,7 +115,8 @@ | ||
it('converts human amounts to quantum amounts', () => { | ||
it('converts human amounts to quantum amounts and converts expiration to hours', () => { | ||
const starkwareWithdrawal: StarkwareWithdrawal = SignableWithdrawal | ||
.fromWithdrawal(mockWithdrawal) | ||
.toStarkware(); | ||
expect(starkwareWithdrawal.quantumsAmount).toEqual('49478023'); | ||
expect(starkwareWithdrawal.quantumsAmount).toBe('49478023'); | ||
expect(starkwareWithdrawal.expirationEpochHours).toBe(444533); | ||
}); | ||
@@ -122,0 +123,0 @@ }); |
@@ -28,4 +28,4 @@ "use strict"; | ||
}; | ||
const mockSignature = ('014dedad7bd42da36e81ce627e55be508a4afe019700dd478ea8134b3549d327' + | ||
'0571d1dcbab6f25f4d2f3af054f359773289266c69df91c9608882f0a9b201d8'); | ||
const mockSignature = ('067e90143a21d8a6aca85207de5e124e9644f7adc18deb42c5cf1240766e57bb' + | ||
'04a39c4fdadf214d7282a59d37b21e0d3ea7fe1fc0d0ee25c22a3dd9d5cb8307'); | ||
describe('SignableConditionalTransfer', () => { | ||
@@ -77,5 +77,6 @@ describe('verifySignature()', () => { | ||
describe('toStarkware()', () => { | ||
it('converts human amounts to quantum amounts', () => { | ||
it('converts human amounts to quantum amounts and converts expiration to hours', () => { | ||
const starkwareConditionalTransfer = (new conditional_transfer_1.SignableConditionalTransfer(mockParams).toStarkware()); | ||
expect_1.default(starkwareConditionalTransfer.quantumsAmount).toEqual('49478023'); | ||
expect_1.default(starkwareConditionalTransfer.expirationEpochHours).toBe(444533); | ||
}); | ||
@@ -93,2 +94,2 @@ }); | ||
}); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZGl0aW9uYWwtdHJhbnNmZXIudGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL19fdGVzdHNfXy9zaWduYWJsZS9jb25kaXRpb25hbC10cmFuc2Zlci50ZXN0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTs7R0FFRzs7Ozs7QUFFSCxvREFBNEI7QUFPNUIseUNBQXVEO0FBQ3ZELGlDQUEyQztBQUUzQyxxQkFBcUI7QUFDckIsa0ZBQXNGO0FBRXRGLGVBQWU7QUFDZixNQUFNLFdBQVcsR0FBWTtJQUMzQixTQUFTLEVBQUUsaUVBQWlFO0lBQzVFLFVBQVUsRUFBRSxpRUFBaUU7Q0FDOUUsQ0FBQztBQUNGLE1BQU0sVUFBVSxHQUE4QjtJQUM1QyxnQkFBZ0IsRUFBRSxPQUFPO0lBQ3pCLGtCQUFrQixFQUFFLE9BQU87SUFDM0IsaUJBQWlCLEVBQUUsa0VBQWtFO0lBQ3JGLFdBQVcsRUFBRSxXQUFXO0lB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Q0FBQztRQUNqRCxNQUFNLFFBQVEsR0FBRyxJQUFJLGtEQUEyQixDQUFDLFVBQVUsQ0FBQyxDQUFDO1FBQzdELE1BQU0sU0FBUyxHQUFHLFFBQVEsQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDLFVBQVUsQ0FBQyxDQUFDO1FBRXBELCtEQUErRDtRQUMvRCxnQkFBTSxDQUNKLFFBQVEsQ0FBQyxlQUFlLENBQUMsU0FBUyxFQUFFLE9BQU8sQ0FBQyxTQUFTLENBQUMsQ0FDdkQsQ0FBQyxJQUFJLENBQUMsSUFBSSxDQUFDLENBQUM7UUFFYixtRUFBbUU7UUFDbkUsZ0JBQU0sQ0FDSixRQUFRLENBQUMsZUFBZSxDQUFDLFNBQVMsRUFBRSxXQUFXLENBQUMsU0FBUyxDQUFDLENBQzNELENBQUMsSUFBSSxDQUFDLEtBQUssQ0FBQyxDQUFDO0lBQ2hCLENBQUMsQ0FBQyxDQUFDO0FBQ0wsQ0FBQyxDQUFDLENBQUMifQ== |
@@ -36,6 +36,6 @@ "use strict"; | ||
}; | ||
const mockSignature = ('059487ea7c537f34516f4dc7c54ad30ab0096823269ba18aea0e64e13fb03462' + | ||
'03be73ed4dafbf99baeeaee6dce315cd834b5e3257d4e74371d14cf8f2189a59'); | ||
const mockSignatureEvenY = ('030644ef5b2de9e93f13df5a4cf8284e7256223366b5da29bf2002ed40825171' + | ||
'03961ec47c34c49e97095c546895cc22afa6e563474615729720fd8b768c5b87'); | ||
const mockSignature = ('0398287472161cba0e6386ff0b2f25f39ba37c646b7bbadace80eee6b8e7157d' + | ||
'01ba924272e1e42b3211b96bbbe012e7e8101e1b3e5b83ea90d161ad11fcced4'); | ||
const mockSignatureEvenY = ('05cf391a69386f53693344bada2e0d245879f3c6a98971498b2862ff2f359c49' + | ||
'0737deea7e201eaa86c8d6eeb2c1ca3ce89ac248b3fe1a6182301aa72d6e8e4f'); | ||
describe('SignableOrder', () => { | ||
@@ -145,9 +145,11 @@ describe('verifySignature()', () => { | ||
describe('toStarkware()', () => { | ||
it('converts human amounts to quantum amounts', () => { | ||
it('converts human amounts to quantum amounts and converts expiration to hours', () => { | ||
const starkwareOrder = order_1.SignableOrder | ||
.fromOrder(mockOrder) | ||
.toStarkware(); | ||
expect_1.default(starkwareOrder.quantumsAmountSynthetic).toEqual('14500050000'); | ||
expect_1.default(starkwareOrder.quantumsAmountCollateral).toEqual('50750272151'); | ||
expect_1.default(starkwareOrder.quantumsAmountFee).toEqual('6343784019'); | ||
expect_1.default(starkwareOrder.quantumsAmountSynthetic).toBe('14500050000'); | ||
expect_1.default(starkwareOrder.quantumsAmountCollateral).toBe('50750272151'); | ||
expect_1.default(starkwareOrder.quantumsAmountFee).toBe('6343784019'); | ||
// Order expiration should be rounded up, and should have a buffer added. | ||
expect_1.default(starkwareOrder.expirationEpochHours).toBe(444581); | ||
}); | ||
@@ -175,2 +177,2 @@ it('throws if the market is unknown', () => { | ||
}); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3JkZXIudGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL19fdGVzdHNfXy9zaWduYWJsZS9vcmRlci50ZXN0LnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7QUFBQTs7R0FFRzs7Ozs7QUFFSCxvREFBMkM7QUFDM0Msb0RBQTRCO0FBRTVCLDJDQVF5QjtBQUN6Qix5Q0FBdUQ7QUFDdkQsK0NBQXNEO0FBQ3RELGlDQUEyQztBQUUzQyxxQkFBcUI7QUFDckIsb0RBQXlEO0FBRXpELGVBQWU7QUFDZixNQUFNLFdBQVcsR0FBWTtJQUMzQixTQUFTLEVBQUUsaUVBQWlFO0lBQzVFLFVBQVUsRUFBRSxpRUFBaUU7Q0FDOUUsQ0FBQztBQUNGLE1BQU0sZ0JBQWdCLEdBQVk7SUFDaEMsU0FBUyxFQUFFLGlFQUFpRTtJQUM1RSx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LEVBQUU7UUFDcEIsK0JBQStCO1FBQy9CLEtBQUssSUFBSSxDQUFDLEdBQUcsQ0FBQyxFQUFFLENBQUMsR0FBRyxDQUFDLEVBQUUsQ0FBQyxFQUFFLEVBQUU7WUFDMUIsTUFBTSxPQUFPLEdBQVksNEJBQXFCLEVBQUUsQ0FBQztZQUNqRCxNQUFNLGFBQWEsR0FBRyxxQkFBYSxDQUFDLFNBQVMsQ0FBQyxTQUFTLENBQUMsQ0FBQztZQUN6RCxNQUFNLFNBQVMsR0FBRyxhQUFhLENBQUMsSUFBSSxDQUFDLE9BQU8sQ0FBQyxVQUFVLENBQUMsQ0FBQztZQUV6RCwrREFBK0Q7WUFDL0QsZ0JBQU0sQ0FDSixhQUFhLENBQUMsZUFBZSxDQUFDLFNBQVMsRUFBRSxPQUFPLENBQUMsU0FBUyxDQUFDLENBQzVELENBQUMsSUFBSSxDQUFDLElBQUksQ0FBQyxDQUFDO1lBRWIsbUVBQW1FO1lBQ25FLGdCQUFNLENBQ0osYUFBYSxDQUFDLGVBQWUsQ0FBQyxTQUFTLEVBQUUsV0FBVyxDQUFDLFNBQVMsQ0FBQyxDQUNoRSxDQUFDLElBQUksQ0FBQyxLQUFLLENBQUMsQ0FBQztTQUNmO0lBQ0gsQ0FBQyxDQUFDLENBQUM7QUFDTCxDQUFDLENBQUMsQ0FBQyJ9 |
@@ -26,4 +26,4 @@ "use strict"; | ||
}; | ||
const mockSignature = ('0214a0ab2f3c065c5848ad9dbac6cc98509b66e76a8f563d5c8ffda01b0fa2e0' + | ||
'07242b1c65d039fe645d122ecea7c3e58c8fda5814e0c152dbdeef4af706ad06'); | ||
const mockSignature = ('05e48c33f8205a5359c95f1bd7385c1c1f587e338a514298c07634c0b6c952ba' + | ||
'0687d6980502a5d7fa84ef6fdc00104db22c43c7fb83e88ca84f19faa9ee3de1'); | ||
describe('SignableWithdrawal', () => { | ||
@@ -96,7 +96,8 @@ describe('verifySignature()', () => { | ||
describe('toStarkware()', () => { | ||
it('converts human amounts to quantum amounts', () => { | ||
it('converts human amounts to quantum amounts and converts expiration to hours', () => { | ||
const starkwareWithdrawal = withdrawal_1.SignableWithdrawal | ||
.fromWithdrawal(mockWithdrawal) | ||
.toStarkware(); | ||
expect_1.default(starkwareWithdrawal.quantumsAmount).toEqual('49478023'); | ||
expect_1.default(starkwareWithdrawal.quantumsAmount).toBe('49478023'); | ||
expect_1.default(starkwareWithdrawal.expirationEpochHours).toBe(444533); | ||
}); | ||
@@ -117,2 +118,2 @@ }); | ||
}); | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid2l0aGRyYXdhbC50ZXN0LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vX190ZXN0c19fL3NpZ25hYmxlL3dpdGhkcmF3YWwudGVzdC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiO0FBQUE7O0dBRUc7Ozs7O0FBRUgsb0RBQTRCO0FBUTVCLHlDQUF1RDtBQUN2RCwrQ0FBc0Q7QUFDdEQsaUNBQTJDO0FBRTNDLHFCQUFxQjtBQUNyQiw4REFBbUU7QUFFbkUsZUFBZTtBQUNmLE1BQU0sV0FBVyxHQUFZO0lBQzNCLFNBQVMsRUFBRSxpRUFBaUU7SUFDNUUsVUFBVSxFQUFFLGlFQUFpRTtDQUM5RSxDQUFDO0FBQ0YsTUFBTSxjQUFjLEdBQTJCO0lBQzdDLFVBQVUsRUFBRSxPQUFPO0lBQ25CLFdBQVcsRUFBRSxXQUFXO0lBQ3hCLHNCQUFzQixFQUFFLDBCQUEwQjtJQUNsRCxRQUFRLEVBQUUsd0VBQXdFO0NBQ25GLENBQUM7QUFDRixNQUFNLGFBQWEsR0FBRyxDQUNwQixrRUFBa0U7SUFDbEUsa0VBQWtFLENBQ25FLENBQUM7QUFFRixRQUFRLENBQUMsb0JBQW9CLEVBQUUsR0FBRyxFQUFFO0lBRWxDLFFBQVEsQ0FBQyxtQkFB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UMsQ0FBQztJQUNMLENBQUMsQ0FBQyxDQUFDO0lBRUgsRUFBRSxDQUFDLFlBQVksRUFBRSxHQUFHLEVBQUU7UUFDcEIsK0JBQStCO1FBQy9CLEtBQUssSUFBSSxDQUFDLEdBQUcsQ0FBQyxFQUFFLENBQUMsR0FBRyxDQUFDLEVBQUUsQ0FBQyxFQUFFLEVBQUU7WUFDMUIsTUFBTSxPQUFPLEdBQVksNEJBQXFCLEVBQUUsQ0FBQztZQUNqRCxNQUFNLGtCQUFrQixHQUFHLCtCQUFrQixDQUFDLGNBQWMsQ0FBQyxjQUFjLENBQUMsQ0FBQztZQUM3RSxNQUFNLFNBQVMsR0FBRyxrQkFBa0IsQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDLFVBQVUsQ0FBQyxDQUFDO1lBRTlELCtEQUErRDtZQUMvRCxnQkFBTSxDQUNKLGtCQUFrQixDQUFDLGVBQWUsQ0FBQyxTQUFTLEVBQUUsT0FBTyxDQUFDLFNBQVMsQ0FBQyxDQUNqRSxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsQ0FBQztZQUViLG1FQUFtRTtZQUNuRSxnQkFBTSxDQUNKLGtCQUFrQixDQUFDLGVBQWUsQ0FBQyxTQUFTLEVBQUUsV0FBVyxDQUFDLFNBQVMsQ0FBQyxDQUNyRSxDQUFDLElBQUksQ0FBQyxLQUFLLENBQUMsQ0FBQztTQUNmO0lBQ0gsQ0FBQyxDQUFDLENBQUM7QUFDTCxDQUFDLENBQUMsQ0FBQyJ9 |
@@ -8,2 +8,13 @@ /** | ||
export declare function nonceFromClientId(clientId: string): string; | ||
export declare function isoTimestampToEpochSeconds(isoTimestamp: string): string; | ||
/** | ||
* Convert an ISO timestamp to an epoch timestamp in seconds, rounding down. | ||
*/ | ||
export declare function isoTimestampToEpochSeconds(isoTimestamp: string): number; | ||
/** | ||
* Convert an ISO timestamp to an epoch timestamp in hours, rounding up. | ||
*/ | ||
export declare function isoTimestampToEpochHours(isoTimestamp: string): number; | ||
/** | ||
* Add expiration buffer to ensure an order signature is valid when it arrives on-chain. | ||
*/ | ||
export declare function addOrderExpirationBufferHours(expirationEpochHours: number): number; |
@@ -9,3 +9,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.isoTimestampToEpochSeconds = exports.nonceFromClientId = void 0; | ||
exports.addOrderExpirationBufferHours = exports.isoTimestampToEpochHours = exports.isoTimestampToEpochSeconds = exports.nonceFromClientId = void 0; | ||
const crypto_1 = __importDefault(require("crypto")); | ||
@@ -16,2 +16,4 @@ const bn_js_1 = __importDefault(require("bn.js")); | ||
const MAX_NONCE = new bn_js_1.default(2).pow(new bn_js_1.default(constants_1.ORDER_FIELD_BIT_LENGTHS.nonce)); | ||
const ONE_SECOND_MS = 1000; | ||
const ONE_HOUR_MS = 60 * 60 * ONE_SECOND_MS; | ||
/** | ||
@@ -25,6 +27,23 @@ * Generate a nonce deterministically from an arbitrary string provided by a client. | ||
exports.nonceFromClientId = nonceFromClientId; | ||
/** | ||
* Convert an ISO timestamp to an epoch timestamp in seconds, rounding down. | ||
*/ | ||
function isoTimestampToEpochSeconds(isoTimestamp) { | ||
return `${Math.floor(new Date(isoTimestamp).getTime() / 1000)}`; | ||
return Math.floor(new Date(isoTimestamp).getTime() / ONE_SECOND_MS); | ||
} | ||
exports.isoTimestampToEpochSeconds = isoTimestampToEpochSeconds; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWlzYy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9oZWxwZXJzL21pc2MudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBOztHQUVHOzs7Ozs7QUFFSCxvREFBZ0M7QUFFaEMsa0RBQXVCO0FBRXZCLHNDQUFzQztBQUN0QyxxREFBZ0U7QUFFaEUsTUFBTSxTQUFTLEdBQUcsSUFBSSxlQUFFLENBQUMsQ0FBQyxDQUFDLENBQUMsR0FBRyxDQUFDLElBQUksZUFBRSxDQUFDLG1DQUF1QixDQUFDLEtBQUssQ0FBQyxDQUFDLENBQUM7QUFFdkU7O0dBRUc7QUFDSCxTQUFnQixpQkFBaUIsQ0FBQyxRQUFnQjtJQUNoRCxNQUFNLFFBQVEsR0FBRyxnQkFBVSxDQUFDLFVBQVUsQ0FBQyxRQUFRLENBQUMsQ0FBQyxNQUFNLENBQUMsUUFBUSxDQUFDLENBQUMsTUFBTSxDQUFDLEtBQUssQ0FBQyxDQUFDO0lBQ2hGLE9BQU8sY0FBTyxDQUFDLFFBQVEsQ0FBQyxDQUFDLEdBQUcsQ0FBQyxTQUFTLENBQUMsQ0FBQyxRQUFRLEVBQUUsQ0FBQztBQUNyRCxDQUFDO0FBSEQsOENBR0M7QUFFRCxTQUFnQiwwQkFBMEIsQ0FBQyxZQUFvQjtJQUM3RCxPQUFPLEdBQUcsSUFBSSxDQUFDLEtBQUssQ0FBQyxJQUFJLElBQUksQ0FBQyxZQUFZLENBQUMsQ0FBQyxPQUFPLEVBQUUsR0FBRyxJQUFJLENBQUMsRUFBRSxDQUFDO0FBQ2xFLENBQUM7QUFGRCxnRUFFQyJ9 | ||
/** | ||
* Convert an ISO timestamp to an epoch timestamp in hours, rounding up. | ||
*/ | ||
function isoTimestampToEpochHours(isoTimestamp) { | ||
return Math.ceil(new Date(isoTimestamp).getTime() / ONE_HOUR_MS); | ||
} | ||
exports.isoTimestampToEpochHours = isoTimestampToEpochHours; | ||
/** | ||
* Add expiration buffer to ensure an order signature is valid when it arrives on-chain. | ||
*/ | ||
function addOrderExpirationBufferHours(expirationEpochHours) { | ||
return expirationEpochHours + constants_1.STARK_SIGNATURE_EXPIRATION_BUFFER_HOURS; | ||
} | ||
exports.addOrderExpirationBufferHours = addOrderExpirationBufferHours; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibWlzYy5qcyIsInNvdXJjZVJvb3QiOiI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0FBQyxJQUFJLENBQUMsSUFBSSxJQUFJLENBQUMsWUFBWSxDQUFDLENBQUMsT0FBTyxFQUFFLEdBQUcsV0FBVyxDQUFDLENBQUM7QUFDbkUsQ0FBQztBQUZELDREQUVDO0FBRUQ7O0dBRUc7QUFDSCxTQUFnQiw2QkFBNkIsQ0FBQyxvQkFBNEI7SUFDeEUsT0FBTyxvQkFBb0IsR0FBRyxtREFBdUMsQ0FBQztBQUN4RSxDQUFDO0FBRkQsc0VBRUMifQ== |
@@ -28,2 +28,6 @@ /// <reference types="node" /> | ||
/** | ||
* Convert an integer number to a BN. | ||
*/ | ||
export declare function intToBn(int: number): BN; | ||
/** | ||
* Convert a string to a BN equal to the left-aligned UTF-8 representation with a fixed bit length. | ||
@@ -30,0 +34,0 @@ * |
@@ -6,3 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.utf8ToBn = exports.decToBn = exports.hexToBn = exports.bufferToBn = exports.randomBuffer = exports.normalizeHex32 = exports.bnToHex32 = void 0; | ||
exports.utf8ToBn = exports.intToBn = exports.decToBn = exports.hexToBn = exports.bufferToBn = exports.randomBuffer = exports.normalizeHex32 = exports.bnToHex32 = void 0; | ||
const bn_js_1 = __importDefault(require("bn.js")); | ||
@@ -76,2 +76,12 @@ /** | ||
/** | ||
* Convert an integer number to a BN. | ||
*/ | ||
function intToBn(int) { | ||
if (!Number.isInteger(int)) { | ||
throw new Error('intToBn: Input is not an integer'); | ||
} | ||
return new bn_js_1.default(int); | ||
} | ||
exports.intToBn = intToBn; | ||
/** | ||
* Convert a string to a BN equal to the left-aligned UTF-8 representation with a fixed bit length. | ||
@@ -94,2 +104,2 @@ * | ||
exports.utf8ToBn = utf8ToBn; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9saWIvdXRpbC50cyJdL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DO0tBQzNFO0lBQ0QsTUFBTSxNQUFNLEdBQUcsTUFBTSxDQUFDLElBQUksQ0FBQyxDQUFDLENBQUMsQ0FBQztJQUM5QixNQUFNLEdBQUcsR0FBRyxNQUFNLENBQUMsUUFBUSxDQUFDLEtBQUssQ0FBQyxDQUFDO0lBQ25DLE1BQU0sU0FBUyxHQUFHLEdBQUcsQ0FBQyxNQUFNLENBQUMsT0FBTyxHQUFHLENBQUMsRUFBRSxHQUFHLENBQUMsQ0FBQztJQUMvQyxJQUFJLFNBQVMsQ0FBQyxNQUFNLEtBQUssT0FBTyxHQUFHLENBQUMsRUFBRTtRQUNwQyxNQUFNLElBQUksS0FBSyxDQUFDLDJDQUEyQyxPQUFPLE9BQU8sQ0FBQyxDQUFDO0tBQzVFO0lBQ0QsT0FBTyxJQUFJLGVBQUUsQ0FBQyxTQUFTLEVBQUUsRUFBRSxDQUFDLENBQUM7QUFDL0IsQ0FBQztBQWRELDRCQWNDIn0= |
@@ -28,4 +28,4 @@ "use strict"; | ||
const quantumsAmount = helpers_1.toQuantumsExact(transfer.humanAmount, constants_1.COLLATERAL_ASSET); | ||
// Convert to a Unix timestamp (in seconds). | ||
const expirationEpochSeconds = helpers_1.isoTimestampToEpochSeconds(transfer.expirationIsoTimestamp); | ||
// Convert to a Unix timestamp (in hours). | ||
const expirationEpochHours = helpers_1.isoTimestampToEpochHours(transfer.expirationIsoTimestamp); | ||
super({ | ||
@@ -38,3 +38,3 @@ senderPositionId: transfer.senderPositionId, | ||
nonce, | ||
expirationEpochSeconds, | ||
expirationEpochHours, | ||
}); | ||
@@ -49,3 +49,3 @@ } | ||
const nonceBn = util_1.decToBn(this.message.nonce); | ||
const expirationEpochSecondsBn = util_1.decToBn(this.message.expirationEpochSeconds); | ||
const expirationEpochSecondsBn = util_1.intToBn(this.message.expirationEpochHours); | ||
if (senderPositionIdBn.bitLength() > constants_2.CONDITIONAL_TRANSFER_FIELD_BIT_LENGTHS.positionId) { | ||
@@ -70,4 +70,4 @@ throw new Error('SignableOraclePrice: senderPositionId exceeds max value'); | ||
if (expirationEpochSecondsBn.bitLength() > | ||
constants_2.CONDITIONAL_TRANSFER_FIELD_BIT_LENGTHS.expirationEpochSeconds) { | ||
throw new Error('SignableOraclePrice: expirationEpochSeconds exceeds max value'); | ||
constants_2.CONDITIONAL_TRANSFER_FIELD_BIT_LENGTHS.expirationEpochHours) { | ||
throw new Error('SignableOraclePrice: expirationEpochHours exceeds max value'); | ||
} | ||
@@ -85,3 +85,3 @@ // The transfer asset and fee asset are always the collateral asset. | ||
.iushln(constants_2.CONDITIONAL_TRANSFER_FIELD_BIT_LENGTHS.quantumsAmount).iadd(MAX_AMOUNT_FEE_BN) | ||
.iushln(constants_2.CONDITIONAL_TRANSFER_FIELD_BIT_LENGTHS.expirationEpochSeconds).iadd(expirationEpochSecondsBn) | ||
.iushln(constants_2.CONDITIONAL_TRANSFER_FIELD_BIT_LENGTHS.expirationEpochHours).iadd(expirationEpochSecondsBn) | ||
.iushln(CONDITIONAL_TRANSFER_PADDING_BITS); | ||
@@ -95,2 +95,2 @@ return starkex_resources_1.pedersen(starkex_resources_1.pedersen(transferPart1, transferPart2), transferPart3); | ||
exports.SignableConditionalTransfer = SignableConditionalTransfer; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uZGl0aW9uYWwtdHJhbnNmZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvc2lnbmFibGUvY29uZGl0aW9uYWwtdHJhbnNmZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7O0FBQUEsa0RBQXVCO0FBRXZCLDRDQUdzQjtBQUN0Qix3Q0FJb0I7QUFDcEIsZ0VBQW9EO0FBQ3BELHNDQUlxQjtBQUtyQiwyQ0FBcUU7QUFDckUscURBQWlEO0FBRWpELDBEQUEwRDtBQUMxRCxNQUFNLGtCQUFrQixHQUFHLElBQUksZ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0FBQyxrREFBc0MsQ0FBQyxjQUFjLENBQUMsQ0FBQyxJQUFJLENBQUMsZ0JBQWdCLENBQUM7YUFDcEYsTUFBTSxDQUFDLGtEQUFzQyxDQUFDLGNBQWMsQ0FBQyxDQUFDLElBQUksQ0FBQyxpQkFBaUIsQ0FBQzthQUNyRixNQUFNLENBQUMsa0RBQXNDLENBQUMsb0JBQW9CLENBQUMsQ0FBQyxJQUFJLENBQ3ZFLHdCQUF3QixDQUN6QjthQUNBLE1BQU0sQ0FBQyxpQ0FBaUMsQ0FBQyxDQUFDO1FBRTdDLE9BQU8sNEJBQVEsQ0FDYiw0QkFBUSxDQUNOLGFBQWEsRUFDYixhQUFhLENBQ2QsRUFDRCxhQUFhLENBQ2QsQ0FBQztJQUNKLENBQUM7SUFFRCxXQUFXO1FBQ1QsT0FBTyxJQUFJLENBQUMsT0FBTyxDQUFDO0lBQ3RCLENBQUM7Q0FDRjtBQWpHRCxrRUFpR0MifQ== |
@@ -0,1 +1,2 @@ | ||
export declare const STARK_SIGNATURE_EXPIRATION_BUFFER_HOURS: number; | ||
export declare const ORDER_FIELD_BIT_LENGTHS: { | ||
@@ -8,3 +9,3 @@ assetIdSynthetic: number; | ||
positionId: number; | ||
expirationEpochSeconds: number; | ||
expirationEpochHours: number; | ||
}; | ||
@@ -16,3 +17,3 @@ export declare const WITHDRAWAL_FIELD_BIT_LENGTHS: { | ||
quantumsAmount: number; | ||
expirationEpochSeconds: number; | ||
expirationEpochHours: number; | ||
}; | ||
@@ -25,3 +26,3 @@ export declare const CONDITIONAL_TRANSFER_FIELD_BIT_LENGTHS: { | ||
quantumsAmount: number; | ||
expirationEpochSeconds: number; | ||
expirationEpochHours: number; | ||
condition: number; | ||
@@ -28,0 +29,0 @@ }; |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.ORACLE_PRICE_FIELD_BIT_LENGTHS = exports.CONDITIONAL_TRANSFER_FIELD_BIT_LENGTHS = exports.WITHDRAWAL_FIELD_BIT_LENGTHS = exports.ORDER_FIELD_BIT_LENGTHS = void 0; | ||
exports.ORACLE_PRICE_FIELD_BIT_LENGTHS = exports.CONDITIONAL_TRANSFER_FIELD_BIT_LENGTHS = exports.WITHDRAWAL_FIELD_BIT_LENGTHS = exports.ORDER_FIELD_BIT_LENGTHS = exports.STARK_SIGNATURE_EXPIRATION_BUFFER_HOURS = void 0; | ||
exports.STARK_SIGNATURE_EXPIRATION_BUFFER_HOURS = 24 * 2; // Two days. | ||
exports.ORDER_FIELD_BIT_LENGTHS = { | ||
@@ -11,3 +12,3 @@ assetIdSynthetic: 128, | ||
positionId: 64, | ||
expirationEpochSeconds: 32, | ||
expirationEpochHours: 32, | ||
}; | ||
@@ -19,3 +20,3 @@ exports.WITHDRAWAL_FIELD_BIT_LENGTHS = { | ||
quantumsAmount: 64, | ||
expirationEpochSeconds: 32, | ||
expirationEpochHours: 32, | ||
}; | ||
@@ -28,3 +29,3 @@ exports.CONDITIONAL_TRANSFER_FIELD_BIT_LENGTHS = { | ||
quantumsAmount: 64, | ||
expirationEpochSeconds: 32, | ||
expirationEpochHours: 32, | ||
condition: 251, | ||
@@ -38,2 +39,2 @@ }; | ||
}; | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29uc3RhbnRzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vc3JjL3NpZ25hYmxlL2NvbnN0YW50cy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7QUFBYSxRQUFBLHVCQUF1QixHQUFHO0lBQ3JDLGdCQUFnQixFQUFFLEdBQUc7SUFDckIsaUJBQWlCLEVBQUUsR0FBRztJQUN0QixVQUFVLEVBQUUsR0FBRztJQUNmLGNBQWMsRUFBRSxFQUFFO0lBQ2xCLEtBQUssRUFBRSxFQUFFO0lBQ1QsVUFBVSxFQUFFLEVBQUU7SUFDZCxzQkFBc0IsRUFBRSxFQUFFO0N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VQUFVLEVBQUUsRUFBRTtJQUNkLG9CQUFvQixFQUFFLEVBQUU7Q0FDekIsQ0FBQztBQUVXLFFBQUEsNEJBQTRCLEdBQUc7SUFDMUMsT0FBTyxFQUFFLEdBQUc7SUFDWixVQUFVLEVBQUUsRUFBRTtJQUNkLEtBQUssRUFBRSxFQUFFO0lBQ1QsY0FBYyxFQUFFLEVBQUU7SUFDbEIsb0JBQW9CLEVBQUUsRUFBRTtDQUN6QixDQUFDO0FBRVcsUUFBQSxzQ0FBc0MsR0FBRztJQUNwRCxPQUFPLEVBQUUsR0FBRztJQUNaLGlCQUFpQixFQUFFLEdBQUc7SUFDdEIsVUFBVSxFQUFFLEVBQUU7SUFDZCxLQUFLLEVBQUUsRUFBRTtJQUNULGNBQWMsRUFBRSxFQUFFO0lBQ2xCLG9CQUFvQixFQUFFLEVBQUU7SUFDeEIsU0FBUyxFQUFFLEdBQUc7Q0FDZixDQUFDO0FBRVcsUUFBQSw4QkFBOEIsR0FBRztJQUM1QyxTQUFTLEVBQUUsR0FBRztJQUNkLFVBQVUsRUFBRSxFQUFFO0lBQ2QsS0FBSyxFQUFFLEdBQUc7SUFDVixxQkFBcUIsRUFBRSxFQUFFO0NBQzFCLENBQUMifQ== |
@@ -30,3 +30,3 @@ "use strict"; | ||
const priceBn = util_1.decToBn(this.message.price); | ||
const timestampEpochSecondsBn = util_1.decToBn(helpers_1.isoTimestampToEpochSeconds(this.message.isoTimestamp)); | ||
const timestampEpochSecondsBn = util_1.intToBn(helpers_1.isoTimestampToEpochSeconds(this.message.isoTimestamp)); | ||
const signedAssetId = util_1.hexToBn(this.message.signedAssetId); | ||
@@ -47,2 +47,2 @@ if (priceBn.bitLength() > constants_1.ORACLE_PRICE_FIELD_BIT_LENGTHS.price) { | ||
SignableOraclePrice.fromPrice = SignableOraclePrice.fromPriceWithAssetName; // Alias. | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3JhY2xlLXByaWNlLmp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HQUFHLGNBQU8sQ0FBQyxJQUFJLENBQUMsT0FBTyxDQUFDLGFBQWEsQ0FBQyxDQUFDO1FBRTFELElBQUksT0FBTyxDQUFDLFNBQVMsRUFBRSxHQUFHLDBDQUE4QixDQUFDLEtBQUssRUFBRTtZQUM5RCxNQUFNLElBQUksS0FBSyxDQUFDLDhDQUE4QyxDQUFDLENBQUM7U0FDakU7UUFDRCxJQUNFLHVCQUF1QixDQUFDLFNBQVMsRUFBRSxHQUFHLDBDQUE4QixDQUFDLHFCQUFxQixFQUMxRjtZQUNBLE1BQU0sSUFBSSxLQUFLLENBQUMsOERBQThELENBQUMsQ0FBQztTQUNqRjtRQUVELE1BQU0saUJBQWlCLEdBQUcsT0FBTzthQUM5QixNQUFNLENBQUMsMENBQThCLENBQUMscUJBQXFCLENBQUM7YUFDNUQsSUFBSSxDQUFDLHVCQUF1QixDQUFDLENBQUM7UUFFakMsT0FBTyxpQkFBUSxDQUFDLGFBQWEsRUFBRSxpQkFBaUIsQ0FBQyxDQUFDO0lBQ3BELENBQUM7O0FBOUNILGtEQStDQztBQTdDUSw2QkFBUyxHQUFHLG1CQUFtQixDQUFDLHNCQUFzQixDQUFDLENBQUMsU0FBUyJ9 |
@@ -41,4 +41,4 @@ "use strict"; | ||
const assetIdFee = constants_1.ASSET_ID_MAP[constants_1.COLLATERAL_ASSET]; | ||
// Convert to a Unix timestamp (in seconds). | ||
const expirationEpochSeconds = helpers_1.isoTimestampToEpochSeconds(order.expirationIsoTimestamp); | ||
// Convert to a Unix timestamp (in hours) and add buffer to ensure signature is valid on-chain. | ||
const expirationEpochHours = helpers_1.addOrderExpirationBufferHours(helpers_1.isoTimestampToEpochHours(order.expirationIsoTimestamp)); | ||
return new SignableOrder({ | ||
@@ -55,3 +55,3 @@ orderType, | ||
isBuyingSynthetic, | ||
expirationEpochSeconds, | ||
expirationEpochHours, | ||
}); | ||
@@ -68,3 +68,3 @@ } | ||
const positionIdBn = util_1.decToBn(this.message.positionId); | ||
const expirationEpochSecondsBn = util_1.decToBn(this.message.expirationEpochSeconds); | ||
const expirationEpochSecondsBn = util_1.intToBn(this.message.expirationEpochHours); | ||
const [assetIdSellBn, assetIdBuyBn] = this.message.isBuyingSynthetic | ||
@@ -100,4 +100,4 @@ ? [assetIdCollateralBn, assetIdSyntheticBn] | ||
} | ||
if (expirationEpochSecondsBn.bitLength() > constants_2.ORDER_FIELD_BIT_LENGTHS.expirationEpochSeconds) { | ||
throw new Error('SignableOrder: expirationEpochSeconds exceeds max value'); | ||
if (expirationEpochSecondsBn.bitLength() > constants_2.ORDER_FIELD_BIT_LENGTHS.expirationEpochHours) { | ||
throw new Error('SignableOrder: expirationEpochHours exceeds max value'); | ||
} | ||
@@ -112,3 +112,3 @@ const orderPart1 = new bn_js_1.default(quantumsAmountSellBn) | ||
.iushln(constants_2.ORDER_FIELD_BIT_LENGTHS.positionId).iadd(positionIdBn) // Repeat (3/3). | ||
.iushln(constants_2.ORDER_FIELD_BIT_LENGTHS.expirationEpochSeconds).iadd(expirationEpochSecondsBn) | ||
.iushln(constants_2.ORDER_FIELD_BIT_LENGTHS.expirationEpochHours).iadd(expirationEpochSecondsBn) | ||
.iushln(ORDER_PADDING_BITS); | ||
@@ -124,2 +124,2 @@ const assetsBn = starkex_resources_1.pedersen(starkex_resources_1.pedersen(assetIdSellBn, assetIdBuyBn), assetIdFeeBn); | ||
SignableOrder.fromOrder = SignableOrder.fromOrderWithClientId; // Alias. | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoib3JkZXIuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi9zcmMvc2lnbmFibGUvb3JkZXIudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7O0FBQUEsa0RBQXVCO0FBRXZCLDRDQUdzQjtBQUN0Qix3Q0FLb0I7QUFDcEIsZ0VBQW9EO0FBQ3BELHNDQUErQztBQUMvQyxvQ0FPa0I7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BQyxDQUFDO1FBQy9FLE9BQU8sNEJBQVEsQ0FBQyw0QkFBUSxDQUFDLFFBQVEsRUFBRSxVQUFVLENBQUMsRUFBRSxVQUFVLENBQUMsQ0FBQztJQUM5RCxDQUFDO0lBRUQsV0FBVztRQUNULE9BQU8sSUFBSSxDQUFDLE9BQU8sQ0FBQztJQUN0QixDQUFDOztBQTNISCxzQ0E0SEM7QUExSFEsdUJBQVMsR0FBRyxhQUFhLENBQUMscUJBQXFCLENBQUMsQ0FBQyxTQUFTIn0= |
@@ -35,4 +35,4 @@ "use strict"; | ||
const quantumsAmount = helpers_1.toQuantumsExact(withdrawal.humanAmount, constants_1.COLLATERAL_ASSET); | ||
// Convert to a Unix timestamp (in seconds). | ||
const expirationEpochSeconds = helpers_1.isoTimestampToEpochSeconds(withdrawal.expirationIsoTimestamp); | ||
// Convert to a Unix timestamp (in hours). | ||
const expirationEpochHours = helpers_1.isoTimestampToEpochHours(withdrawal.expirationIsoTimestamp); | ||
return new SignableWithdrawal({ | ||
@@ -42,3 +42,3 @@ positionId, | ||
quantumsAmount, | ||
expirationEpochSeconds, | ||
expirationEpochHours, | ||
}); | ||
@@ -50,3 +50,3 @@ } | ||
const quantumsAmountBn = util_1.decToBn(this.message.quantumsAmount); | ||
const expirationEpochSecondsBn = util_1.decToBn(this.message.expirationEpochSeconds); | ||
const expirationEpochSecondsBn = util_1.intToBn(this.message.expirationEpochHours); | ||
if (positionIdBn.bitLength() > constants_2.WITHDRAWAL_FIELD_BIT_LENGTHS.positionId) { | ||
@@ -61,4 +61,4 @@ throw new Error('SignableOraclePrice: positionId exceeds max value'); | ||
} | ||
if (expirationEpochSecondsBn.bitLength() > constants_2.WITHDRAWAL_FIELD_BIT_LENGTHS.expirationEpochSeconds) { | ||
throw new Error('SignableOraclePrice: expirationEpochSeconds exceeds max value'); | ||
if (expirationEpochSecondsBn.bitLength() > constants_2.WITHDRAWAL_FIELD_BIT_LENGTHS.expirationEpochHours) { | ||
throw new Error('SignableOraclePrice: expirationEpochHours exceeds max value'); | ||
} | ||
@@ -69,3 +69,3 @@ const packedWithdrawalBn = new bn_js_1.default(WITHDRAWAL_PREFIX) | ||
.iushln(constants_2.WITHDRAWAL_FIELD_BIT_LENGTHS.quantumsAmount).iadd(quantumsAmountBn) | ||
.iushln(constants_2.WITHDRAWAL_FIELD_BIT_LENGTHS.expirationEpochSeconds).iadd(expirationEpochSecondsBn) | ||
.iushln(constants_2.WITHDRAWAL_FIELD_BIT_LENGTHS.expirationEpochHours).iadd(expirationEpochSecondsBn) | ||
.iushln(WITHDRAWAL_PADDING_BITS); | ||
@@ -80,2 +80,2 @@ return starkex_resources_1.pedersen(COLLATERAL_ASSET_ID_BN, packedWithdrawalBn); | ||
SignableWithdrawal.fromWithdrawal = SignableWithdrawal.fromWithdrawalWithClientId; // Alias. | ||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoid2l0aGRyYXdhbC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uL3NyYy9zaWduYWJsZS93aXRoZHJhd2FsLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiI7Ozs7OztBQUFBLGtEQUF1QjtBQUV2Qiw0Q0FHc0I7QUFDdEIsd0NBSW9CO0FBQ3BCLGdFQUFvRDtBQUNwRCxzQ0FBK0M7QUFNL0MsMkNBQTJEO0FBQzNELHFEQUFpRDtBQUVqRCxNQUFNLHNCQUFzQixHQUFHLGNBQU8sQ0FBQywrQkFBbUIsQ0FBQyxDQUFDO0FBQzVELE1BQU0saUJBQWlCLEdBQUcsQ0FBQyxDQUFDO0FBQzVCLE1BQU0sdUJBQXVCLEdBQUcsRUFBRSxDQUFDO0FBRW5DOztHQUVHO0FBQ0gsTUFBYSxrQkFBbUIsU0FBUSw4QkFBa0M7SUFJeEUsTUFBTSxDQUFDLDBCQUEwQixDQUMvQixVQUFrQztRQUVsQyxvREFBb0Q7UUFDcEQsTUFBTS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Ba0IsQ0FBQywwQkFBMEIsQ0FBQyxDQUFDLFNBQVMifQ== |
@@ -47,3 +47,3 @@ /// <reference types="node" /> | ||
nonce: string; | ||
expirationEpochSeconds: string; | ||
expirationEpochHours: number; | ||
} | ||
@@ -66,3 +66,3 @@ export interface ConditionalTransferParams { | ||
nonce: string; | ||
expirationEpochSeconds: string; | ||
expirationEpochHours: number; | ||
} | ||
@@ -102,3 +102,3 @@ interface OrderParamsBase { | ||
nonce: string; | ||
expirationEpochSeconds: string; | ||
expirationEpochHours: number; | ||
} | ||
@@ -105,0 +105,0 @@ export declare enum ApiMethod { |
{ | ||
"name": "@dydxprotocol/starkex-lib", | ||
"version": "0.7.0", | ||
"version": "0.8.0", | ||
"description": "Cryptographic functions for use with StarkEx", | ||
@@ -5,0 +5,0 @@ "main": "build/src/index.js", |
@@ -10,5 +10,10 @@ /** | ||
import { hexToBn } from '../lib/util'; | ||
import { ORDER_FIELD_BIT_LENGTHS } from '../signable/constants'; | ||
import { | ||
ORDER_FIELD_BIT_LENGTHS, | ||
STARK_SIGNATURE_EXPIRATION_BUFFER_HOURS, | ||
} from '../signable/constants'; | ||
const MAX_NONCE = new BN(2).pow(new BN(ORDER_FIELD_BIT_LENGTHS.nonce)); | ||
const ONE_SECOND_MS = 1000; | ||
const ONE_HOUR_MS = 60 * 60 * ONE_SECOND_MS; | ||
@@ -23,4 +28,21 @@ /** | ||
export function isoTimestampToEpochSeconds(isoTimestamp: string): string { | ||
return `${Math.floor(new Date(isoTimestamp).getTime() / 1000)}`; | ||
/** | ||
* Convert an ISO timestamp to an epoch timestamp in seconds, rounding down. | ||
*/ | ||
export function isoTimestampToEpochSeconds(isoTimestamp: string): number { | ||
return Math.floor(new Date(isoTimestamp).getTime() / ONE_SECOND_MS); | ||
} | ||
/** | ||
* Convert an ISO timestamp to an epoch timestamp in hours, rounding up. | ||
*/ | ||
export function isoTimestampToEpochHours(isoTimestamp: string): number { | ||
return Math.ceil(new Date(isoTimestamp).getTime() / ONE_HOUR_MS); | ||
} | ||
/** | ||
* Add expiration buffer to ensure an order signature is valid when it arrives on-chain. | ||
*/ | ||
export function addOrderExpirationBufferHours(expirationEpochHours: number): number { | ||
return expirationEpochHours + STARK_SIGNATURE_EXPIRATION_BUFFER_HOURS; | ||
} |
@@ -73,2 +73,12 @@ import BN from 'bn.js'; | ||
/** | ||
* Convert an integer number to a BN. | ||
*/ | ||
export function intToBn(int: number): BN { | ||
if (!Number.isInteger(int)) { | ||
throw new Error('intToBn: Input is not an integer'); | ||
} | ||
return new BN(int); | ||
} | ||
/** | ||
* Convert a string to a BN equal to the left-aligned UTF-8 representation with a fixed bit length. | ||
@@ -75,0 +85,0 @@ * |
@@ -8,3 +8,3 @@ import BN from 'bn.js'; | ||
import { | ||
isoTimestampToEpochSeconds, | ||
isoTimestampToEpochHours, | ||
nonceFromClientId, | ||
@@ -18,2 +18,3 @@ toQuantumsExact, | ||
hexToBn, | ||
intToBn, | ||
} from '../lib/util'; | ||
@@ -48,4 +49,4 @@ import { | ||
// Convert to a Unix timestamp (in seconds). | ||
const expirationEpochSeconds = isoTimestampToEpochSeconds(transfer.expirationIsoTimestamp); | ||
// Convert to a Unix timestamp (in hours). | ||
const expirationEpochHours = isoTimestampToEpochHours(transfer.expirationIsoTimestamp); | ||
@@ -59,3 +60,3 @@ super({ | ||
nonce, | ||
expirationEpochSeconds, | ||
expirationEpochHours, | ||
}); | ||
@@ -71,3 +72,3 @@ } | ||
const nonceBn = decToBn(this.message.nonce); | ||
const expirationEpochSecondsBn = decToBn(this.message.expirationEpochSeconds); | ||
const expirationEpochSecondsBn = intToBn(this.message.expirationEpochHours); | ||
@@ -98,5 +99,5 @@ if (senderPositionIdBn.bitLength() > CONDITIONAL_TRANSFER_FIELD_BIT_LENGTHS.positionId) { | ||
expirationEpochSecondsBn.bitLength() > | ||
CONDITIONAL_TRANSFER_FIELD_BIT_LENGTHS.expirationEpochSeconds | ||
CONDITIONAL_TRANSFER_FIELD_BIT_LENGTHS.expirationEpochHours | ||
) { | ||
throw new Error('SignableOraclePrice: expirationEpochSeconds exceeds max value'); | ||
throw new Error('SignableOraclePrice: expirationEpochHours exceeds max value'); | ||
} | ||
@@ -122,3 +123,3 @@ | ||
.iushln(CONDITIONAL_TRANSFER_FIELD_BIT_LENGTHS.quantumsAmount).iadd(MAX_AMOUNT_FEE_BN) | ||
.iushln(CONDITIONAL_TRANSFER_FIELD_BIT_LENGTHS.expirationEpochSeconds).iadd( | ||
.iushln(CONDITIONAL_TRANSFER_FIELD_BIT_LENGTHS.expirationEpochHours).iadd( | ||
expirationEpochSecondsBn, | ||
@@ -125,0 +126,0 @@ ) |
@@ -0,1 +1,3 @@ | ||
export const STARK_SIGNATURE_EXPIRATION_BUFFER_HOURS = 24 * 2; // Two days. | ||
export const ORDER_FIELD_BIT_LENGTHS = { | ||
@@ -8,3 +10,3 @@ assetIdSynthetic: 128, | ||
positionId: 64, | ||
expirationEpochSeconds: 32, | ||
expirationEpochHours: 32, | ||
}; | ||
@@ -17,3 +19,3 @@ | ||
quantumsAmount: 64, | ||
expirationEpochSeconds: 32, | ||
expirationEpochHours: 32, | ||
}; | ||
@@ -27,3 +29,3 @@ | ||
quantumsAmount: 64, | ||
expirationEpochSeconds: 32, | ||
expirationEpochHours: 32, | ||
condition: 251, | ||
@@ -30,0 +32,0 @@ }; |
@@ -5,4 +5,9 @@ import BN from 'bn.js'; | ||
import { pedersen } from '../lib/starkex-resources/crypto'; | ||
import { decToBn, hexToBn, utf8ToBn } from '../lib/util'; | ||
import { | ||
decToBn, | ||
hexToBn, | ||
intToBn, | ||
utf8ToBn, | ||
} from '../lib/util'; | ||
import { | ||
OraclePriceWithAssetName, | ||
@@ -46,3 +51,3 @@ OraclePriceWithAssetId, | ||
const priceBn = decToBn(this.message.price); | ||
const timestampEpochSecondsBn = decToBn(isoTimestampToEpochSeconds(this.message.isoTimestamp)); | ||
const timestampEpochSecondsBn = intToBn(isoTimestampToEpochSeconds(this.message.isoTimestamp)); | ||
const signedAssetId = hexToBn(this.message.signedAssetId); | ||
@@ -49,0 +54,0 @@ |
@@ -8,4 +8,5 @@ import BN from 'bn.js'; | ||
import { | ||
addOrderExpirationBufferHours, | ||
getStarkwareAmounts, | ||
isoTimestampToEpochSeconds, | ||
isoTimestampToEpochHours, | ||
nonceFromClientId, | ||
@@ -15,4 +16,8 @@ getStarkwareLimitFeeAmount, | ||
import { pedersen } from '../lib/starkex-resources'; | ||
import { decToBn, hexToBn } from '../lib/util'; | ||
import { | ||
decToBn, | ||
hexToBn, | ||
intToBn, | ||
} from '../lib/util'; | ||
import { | ||
OrderWithNonce, | ||
@@ -75,4 +80,6 @@ OrderWithNonceAndQuoteAmount, | ||
// Convert to a Unix timestamp (in seconds). | ||
const expirationEpochSeconds = isoTimestampToEpochSeconds(order.expirationIsoTimestamp); | ||
// Convert to a Unix timestamp (in hours) and add buffer to ensure signature is valid on-chain. | ||
const expirationEpochHours = addOrderExpirationBufferHours( | ||
isoTimestampToEpochHours(order.expirationIsoTimestamp), | ||
); | ||
@@ -90,3 +97,3 @@ return new SignableOrder({ | ||
isBuyingSynthetic, | ||
expirationEpochSeconds, | ||
expirationEpochHours, | ||
}); | ||
@@ -104,3 +111,3 @@ } | ||
const positionIdBn = decToBn(this.message.positionId); | ||
const expirationEpochSecondsBn = decToBn(this.message.expirationEpochSeconds); | ||
const expirationEpochSecondsBn = intToBn(this.message.expirationEpochHours); | ||
@@ -138,4 +145,4 @@ const [assetIdSellBn, assetIdBuyBn] = this.message.isBuyingSynthetic | ||
} | ||
if (expirationEpochSecondsBn.bitLength() > ORDER_FIELD_BIT_LENGTHS.expirationEpochSeconds) { | ||
throw new Error('SignableOrder: expirationEpochSeconds exceeds max value'); | ||
if (expirationEpochSecondsBn.bitLength() > ORDER_FIELD_BIT_LENGTHS.expirationEpochHours) { | ||
throw new Error('SignableOrder: expirationEpochHours exceeds max value'); | ||
} | ||
@@ -152,3 +159,3 @@ | ||
.iushln(ORDER_FIELD_BIT_LENGTHS.positionId).iadd(positionIdBn) // Repeat (3/3). | ||
.iushln(ORDER_FIELD_BIT_LENGTHS.expirationEpochSeconds).iadd(expirationEpochSecondsBn) | ||
.iushln(ORDER_FIELD_BIT_LENGTHS.expirationEpochHours).iadd(expirationEpochSecondsBn) | ||
.iushln(ORDER_PADDING_BITS); | ||
@@ -155,0 +162,0 @@ |
@@ -8,3 +8,3 @@ import BN from 'bn.js'; | ||
import { | ||
isoTimestampToEpochSeconds, | ||
isoTimestampToEpochHours, | ||
nonceFromClientId, | ||
@@ -14,4 +14,8 @@ toQuantumsExact, | ||
import { pedersen } from '../lib/starkex-resources'; | ||
import { decToBn, hexToBn } from '../lib/util'; | ||
import { | ||
decToBn, | ||
hexToBn, | ||
intToBn, | ||
} from '../lib/util'; | ||
import { | ||
StarkwareWithdrawal, | ||
@@ -56,4 +60,4 @@ WithdrawalWithNonce, | ||
// Convert to a Unix timestamp (in seconds). | ||
const expirationEpochSeconds = isoTimestampToEpochSeconds(withdrawal.expirationIsoTimestamp); | ||
// Convert to a Unix timestamp (in hours). | ||
const expirationEpochHours = isoTimestampToEpochHours(withdrawal.expirationIsoTimestamp); | ||
@@ -64,3 +68,3 @@ return new SignableWithdrawal({ | ||
quantumsAmount, | ||
expirationEpochSeconds, | ||
expirationEpochHours, | ||
}); | ||
@@ -73,3 +77,3 @@ } | ||
const quantumsAmountBn = decToBn(this.message.quantumsAmount); | ||
const expirationEpochSecondsBn = decToBn(this.message.expirationEpochSeconds); | ||
const expirationEpochSecondsBn = intToBn(this.message.expirationEpochHours); | ||
@@ -86,5 +90,5 @@ if (positionIdBn.bitLength() > WITHDRAWAL_FIELD_BIT_LENGTHS.positionId) { | ||
if ( | ||
expirationEpochSecondsBn.bitLength() > WITHDRAWAL_FIELD_BIT_LENGTHS.expirationEpochSeconds | ||
expirationEpochSecondsBn.bitLength() > WITHDRAWAL_FIELD_BIT_LENGTHS.expirationEpochHours | ||
) { | ||
throw new Error('SignableOraclePrice: expirationEpochSeconds exceeds max value'); | ||
throw new Error('SignableOraclePrice: expirationEpochHours exceeds max value'); | ||
} | ||
@@ -96,3 +100,3 @@ | ||
.iushln(WITHDRAWAL_FIELD_BIT_LENGTHS.quantumsAmount).iadd(quantumsAmountBn) | ||
.iushln(WITHDRAWAL_FIELD_BIT_LENGTHS.expirationEpochSeconds).iadd(expirationEpochSecondsBn) | ||
.iushln(WITHDRAWAL_FIELD_BIT_LENGTHS.expirationEpochHours).iadd(expirationEpochSecondsBn) | ||
.iushln(WITHDRAWAL_PADDING_BITS); | ||
@@ -99,0 +103,0 @@ |
@@ -58,3 +58,3 @@ export enum StarkwareOrderType { | ||
nonce: string; // For signature. A base-10 integer. | ||
expirationEpochSeconds: string; | ||
expirationEpochHours: number; | ||
} | ||
@@ -81,3 +81,3 @@ | ||
nonce: string; // For signature. A base-10 integer. | ||
expirationEpochSeconds: string; | ||
expirationEpochHours: number; | ||
} | ||
@@ -125,3 +125,3 @@ | ||
nonce: string; // For signature. A base-10 integer. | ||
expirationEpochSeconds: string; | ||
expirationEpochHours: number; | ||
} | ||
@@ -128,0 +128,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
462531
8677