@reyaxyz/sdk 0.86.1 → 0.87.1

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/README.md CHANGED
@@ -6,5 +6,5 @@
6
6
 
7
7
  | Statements | Branches | Functions | Lines |
8
8
  | --------------------------- | ----------------------- | ------------------------- | ----------------- |
9
- | ![Statements](https://img.shields.io/badge/statements-13.14%25-red.svg?style=flat) | ![Branches](https://img.shields.io/badge/branches-4.47%25-red.svg?style=flat) | ![Functions](https://img.shields.io/badge/functions-8.33%25-red.svg?style=flat) | ![Lines](https://img.shields.io/badge/lines-12.53%25-red.svg?style=flat) |
9
+ | ![Statements](https://img.shields.io/badge/statements-13.05%25-red.svg?style=flat) | ![Branches](https://img.shields.io/badge/branches-4.41%25-red.svg?style=flat) | ![Functions](https://img.shields.io/badge/functions-8.33%25-red.svg?style=flat) | ![Lines](https://img.shields.io/badge/lines-12.44%25-red.svg?style=flat) |
10
10
 
@@ -44,8 +44,9 @@ var common_3 = require("@reyaxyz/common");
44
44
  var common_4 = require("@reyaxyz/common");
45
45
  var ethers_1 = require("ethers");
46
46
  var ethers_2 = require("ethers");
47
+ var config_1 = require("../../config");
47
48
  var encodeMatchOrder = function (signer, chainId, coreSigNonce, accountId, orderBase, orderPriceLimit, counterpartyAccountIds, marketId, exchangeId) { return __awaiter(void 0, void 0, void 0, function () {
48
- var multiAction, eip712Signature, value, functionSignature, parameters, INTERFACE, calldata;
49
+ var multiAction, eip712Signature, value, environment, functionSignature, parameters, INTERFACE, calldata;
49
50
  return __generator(this, function (_a) {
50
51
  switch (_a.label) {
51
52
  case 0:
@@ -55,7 +56,11 @@ var encodeMatchOrder = function (signer, chainId, coreSigNonce, accountId, order
55
56
  case 1:
56
57
  eip712Signature = _a.sent();
57
58
  value = BigInt(0);
58
- functionSignature = 'executeMatchOrders';
59
+ environment = (0, config_1.getSdkEnvironment)();
60
+ functionSignature = 'execute';
61
+ if (environment === 'production') {
62
+ functionSignature = 'executeMatchOrders';
63
+ }
59
64
  parameters = [
60
65
  { accountId: accountId, commands: multiAction.commands, sig: eip712Signature },
61
66
  ];
@@ -1 +1 @@
1
- {"version":3,"file":"encode.js","sourceRoot":"/","sources":["services/orders/encode.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,0CAIyB;AACzB,oCAA8C;AAC9C,0CAAmD;AACnD,0CAIyB;AACzB,0CAA2D;AAC3D,iCAA2C;AAC3C,iCAAgC;AACzB,IAAM,gBAAgB,GAAG,UAC9B,MAAc,EACd,OAAe,EACf,YAAoB,EACpB,SAAiB,EACjB,SAAiB,EACjB,eAAuB,EACvB,sBAAgC,EAChC,QAAgB,EAChB,UAAkB;;;;;gBAEZ,WAAW,GAAG,IAAI,oBAAW,EAAE,CAAC;gBAEtC,IAAA,0BAAiB,EACf,sBAAsB,EACtB,SAAS,EACT,eAAe,EACf,QAAQ,EACR,UAAU,EACV,WAAW,CACZ,CAAC;gBACsB,qBAAM,IAAA,yBAAgB,EAC5C,MAAM,EACN,OAAO,EACP,IAAA,mBAAU,EAAC,OAAO,EAAE,qBAAY,CAAC,eAAe,CAAC,EACjD,SAAS,EACT,WAAW,CAAC,QAAQ,EACpB,YAAY,GAAG,CAAC,EAChB,IAAA,qCAA4B,GAAE,GAAG,iCAAwB,EACzD,eAAM,CAAC,QAAQ,CAAC,eAAe,EAAE,CAAC,MAAM,CAAC,EAAE,EAAE,EAAE,CAAC,CACjD,EAAA;;gBATK,eAAe,GAAG,SASvB;gBAEK,KAAK,GAAG,MAAM,CAAC,CAAC,CAAC,CAAC;gBAClB,iBAAiB,GAAG,oBAAoB,CAAC;gBACzC,UAAU,GAAG;oBACjB,EAAE,SAAS,WAAA,EAAE,QAAQ,EAAE,WAAW,CAAC,QAAQ,EAAE,GAAG,EAAE,eAAe,EAAE;iBACpE,CAAC;gBAEI,SAAS,GAAG,IAAI,kBAAS,CAAC,qBAAG,CAAC,CAAC;gBAC/B,QAAQ,GAAG,SAAS,CAAC,kBAAkB,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC;gBAC7E,sBAAO;wBACL,QAAQ,EAAE,QAAQ;wBAClB,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC;qBAClC,EAAC;;;KACH,CAAC;AA5CW,QAAA,gBAAgB,oBA4C3B","sourcesContent":["import {\n MethodParameters,\n MultiAction,\n PeripheryAbi as abi,\n} from '@reyaxyz/common';\nimport { encodeSingleTrade } from '../encode';\nimport { signCoreCommands } from '@reyaxyz/common';\nimport {\n getCurrentTimestampInSeconds,\n ContractType,\n getAddress,\n} from '@reyaxyz/common';\nimport { CORE_DEADLINE_IN_SECONDS } from '@reyaxyz/common';\nimport { Interface, Signer } from 'ethers';\nimport { ethers } from 'ethers';\nexport const encodeMatchOrder = async (\n signer: Signer,\n chainId: number,\n coreSigNonce: number,\n accountId: number,\n orderBase: bigint,\n orderPriceLimit: bigint,\n counterpartyAccountIds: number[],\n marketId: number,\n exchangeId: number,\n): Promise<MethodParameters> => {\n const multiAction = new MultiAction();\n\n encodeSingleTrade(\n counterpartyAccountIds,\n orderBase,\n orderPriceLimit,\n marketId,\n exchangeId,\n multiAction,\n );\n const eip712Signature = await signCoreCommands(\n signer,\n chainId,\n getAddress(chainId, ContractType.PERIPHERY_PROXY),\n accountId,\n multiAction.commands,\n coreSigNonce + 1,\n getCurrentTimestampInSeconds() + CORE_DEADLINE_IN_SECONDS,\n ethers.AbiCoder.defaultAbiCoder().encode([], []),\n );\n\n const value = BigInt(0);\n const functionSignature = 'executeMatchOrders';\n const parameters = [\n { accountId, commands: multiAction.commands, sig: eip712Signature },\n ];\n\n const INTERFACE = new Interface(abi);\n const calldata = INTERFACE.encodeFunctionData(functionSignature, parameters);\n return {\n calldata: calldata,\n value: BigInt(value).toString(10),\n };\n};\n"]}
1
+ {"version":3,"file":"encode.js","sourceRoot":"/","sources":["services/orders/encode.ts"],"names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Q,GAAG,SAAS,CAAC,kBAAkB,CAAC,iBAAiB,EAAE,UAAU,CAAC,CAAC;gBAC7E,sBAAO;wBACL,QAAQ,EAAE,QAAQ;wBAClB,KAAK,EAAE,MAAM,CAAC,KAAK,CAAC,CAAC,QAAQ,CAAC,EAAE,CAAC;qBAClC,EAAC;;;KACH,CAAC;AAjDW,QAAA,gBAAgB,oBAiD3B","sourcesContent":["import {\n MethodParameters,\n MultiAction,\n PeripheryAbi as abi,\n} from '@reyaxyz/common';\nimport { encodeSingleTrade } from '../encode';\nimport { signCoreCommands } from '@reyaxyz/common';\nimport {\n getCurrentTimestampInSeconds,\n ContractType,\n getAddress,\n} from '@reyaxyz/common';\nimport { CORE_DEADLINE_IN_SECONDS } from '@reyaxyz/common';\nimport { Interface, Signer } from 'ethers';\nimport { ethers } from 'ethers';\nimport { getSdkEnvironment } from '../../config';\nexport const encodeMatchOrder = async (\n signer: Signer,\n chainId: number,\n coreSigNonce: number,\n accountId: number,\n orderBase: bigint,\n orderPriceLimit: bigint,\n counterpartyAccountIds: number[],\n marketId: number,\n exchangeId: number,\n): Promise<MethodParameters> => {\n const multiAction = new MultiAction();\n\n encodeSingleTrade(\n counterpartyAccountIds,\n orderBase,\n orderPriceLimit,\n marketId,\n exchangeId,\n multiAction,\n );\n const eip712Signature = await signCoreCommands(\n signer,\n chainId,\n getAddress(chainId, ContractType.PERIPHERY_PROXY),\n accountId,\n multiAction.commands,\n coreSigNonce + 1,\n getCurrentTimestampInSeconds() + CORE_DEADLINE_IN_SECONDS,\n ethers.AbiCoder.defaultAbiCoder().encode([], []),\n );\n\n const value = BigInt(0);\n const environment = getSdkEnvironment();\n // @todo remove once mainnet is upgraded\n let functionSignature = 'execute';\n if (environment === 'production') {\n functionSignature = 'executeMatchOrders';\n }\n const parameters = [\n { accountId, commands: multiAction.commands, sig: eip712Signature },\n ];\n\n const INTERFACE = new Interface(abi);\n const calldata = INTERFACE.encodeFunctionData(functionSignature, parameters);\n return {\n calldata: calldata,\n value: BigInt(value).toString(10),\n };\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"encode.d.ts","sourceRoot":"/","sources":["services/orders/encode.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAGjB,MAAM,iBAAiB,CAAC;AASzB,OAAO,EAAa,MAAM,EAAE,MAAM,QAAQ,CAAC;AAE3C,eAAO,MAAM,gBAAgB,WACnB,MAAM,WACL,MAAM,gBACD,MAAM,aACT,MAAM,aACN,MAAM,mBACA,MAAM,0BACC,MAAM,EAAE,YACtB,MAAM,cACJ,MAAM,KACjB,QAAQ,gBAAgB,CAkC1B,CAAC"}
1
+ {"version":3,"file":"encode.d.ts","sourceRoot":"/","sources":["services/orders/encode.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAGjB,MAAM,iBAAiB,CAAC;AASzB,OAAO,EAAa,MAAM,EAAE,MAAM,QAAQ,CAAC;AAG3C,eAAO,MAAM,gBAAgB,WACnB,MAAM,WACL,MAAM,gBACD,MAAM,aACT,MAAM,aACN,MAAM,mBACA,MAAM,0BACC,MAAM,EAAE,YACtB,MAAM,cACJ,MAAM,KACjB,QAAQ,gBAAgB,CAuC1B,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reyaxyz/sdk",
3
- "version": "0.86.1",
3
+ "version": "0.87.1",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -29,10 +29,10 @@
29
29
  "generate:coverage-badges": "npx istanbul-badges-readme --silent"
30
30
  },
31
31
  "dependencies": {
32
- "@reyaxyz/common": "0.100.1",
32
+ "@reyaxyz/common": "0.101.1",
33
33
  "bignumber.js": "^9.1.2",
34
34
  "ethers": "6.9.0"
35
35
  },
36
36
  "packageManager": "pnpm@8.3.1",
37
- "gitHead": "5b5ee21f5e782ec994aef9cea72dd2f12ec72b22"
37
+ "gitHead": "919508f4e5967052a2960afdb0eca2608767f32b"
38
38
  }
@@ -13,6 +13,7 @@ import {
13
13
  import { CORE_DEADLINE_IN_SECONDS } from '@reyaxyz/common';
14
14
  import { Interface, Signer } from 'ethers';
15
15
  import { ethers } from 'ethers';
16
+ import { getSdkEnvironment } from '../../config';
16
17
  export const encodeMatchOrder = async (
17
18
  signer: Signer,
18
19
  chainId: number,
@@ -46,7 +47,12 @@ export const encodeMatchOrder = async (
46
47
  );
47
48
 
48
49
  const value = BigInt(0);
49
- const functionSignature = 'executeMatchOrders';
50
+ const environment = getSdkEnvironment();
51
+ // @todo remove once mainnet is upgraded
52
+ let functionSignature = 'execute';
53
+ if (environment === 'production') {
54
+ functionSignature = 'executeMatchOrders';
55
+ }
50
56
  const parameters = [
51
57
  { accountId, commands: multiAction.commands, sig: eip712Signature },
52
58
  ];