@evedex/exchange-crypto 1.0.12 → 1.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js CHANGED
@@ -41,6 +41,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
41
41
  step((generator = generator.apply(thisArg, _arguments || [])).next());
42
42
  });
43
43
  };
44
+ var __importDefault = (this && this.__importDefault) || function (mod) {
45
+ return (mod && mod.__esModule) ? mod : { "default": mod };
46
+ };
44
47
  Object.defineProperty(exports, "__esModule", { value: true });
45
48
  exports.utils = void 0;
46
49
  exports.signAuth = signAuth;
@@ -52,9 +55,11 @@ exports.signReplaceLimitOrder = signReplaceLimitOrder;
52
55
  exports.signReplaceStopLimitOrder = signReplaceStopLimitOrder;
53
56
  exports.signTradingBalanceWithdraw = signTradingBalanceWithdraw;
54
57
  exports.signTpSl = signTpSl;
58
+ const big_js_1 = __importDefault(require("big.js"));
55
59
  const crypto_1 = require("./utils/crypto");
56
60
  const numeric_1 = require("./utils/numeric");
57
61
  const validate_1 = require("./utils/validate");
62
+ const utils_1 = require("./utils");
58
63
  exports.utils = __importStar(require("./utils"));
59
64
  function signAuth(signer, payload) {
60
65
  return __awaiter(this, void 0, void 0, function* () {
@@ -167,7 +172,7 @@ function signTradingBalanceWithdraw(signer, withdraw) {
167
172
  (0, validate_1.validatePayload)(withdraw, crypto_1.EIP721Schemas.withdraw);
168
173
  const normalize = {
169
174
  recipient: withdraw.recipient,
170
- amount: (0, numeric_1.toMatcherNumber)(withdraw.amount),
175
+ amount: (0, big_js_1.default)(withdraw.amount).round(utils_1.MATCHER_PRECISION, big_js_1.default.roundDown).toString(),
171
176
  };
172
177
  const signature = yield signer.signTypedData((0, crypto_1.getDomainData)(yield signer.getChainId()), crypto_1.EIP721Schemas.withdraw, {
173
178
  recipient: withdraw.recipient,
package/dist/mjs/index.js CHANGED
@@ -1,6 +1,8 @@
1
+ import Big from "big.js";
1
2
  import { EIP721Schemas, getDomainData, toEthNumber, } from "./utils/crypto";
2
3
  import { toMatcherNumber } from "./utils/numeric";
3
4
  import { validatePayload } from "./utils/validate";
5
+ import { MATCHER_PRECISION } from "./utils";
4
6
  export * as utils from "./utils";
5
7
  export async function signAuth(signer, payload) {
6
8
  const address = await signer.getAddress();
@@ -140,7 +142,7 @@ export async function signTradingBalanceWithdraw(signer, withdraw) {
140
142
  validatePayload(withdraw, EIP721Schemas.withdraw);
141
143
  const normalize = {
142
144
  recipient: withdraw.recipient,
143
- amount: toMatcherNumber(withdraw.amount),
145
+ amount: Big(withdraw.amount).round(MATCHER_PRECISION, Big.roundDown).toString(),
144
146
  };
145
147
  const signature = await signer.signTypedData(getDomainData(await signer.getChainId()), EIP721Schemas.withdraw, {
146
148
  recipient: withdraw.recipient,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@evedex/exchange-crypto",
3
- "version": "1.0.12",
3
+ "version": "1.0.13",
4
4
  "description": "",
5
5
  "main": "dist/cjs/index.js",
6
6
  "module": "dist/mjs/index.js",