@reyaxyz/sdk 0.113.6 → 0.113.7

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.
@@ -42,7 +42,7 @@ var common_1 = require("@reyaxyz/common");
42
42
  var signAndBroadcastTransaction_1 = require("../signAndBroadcastTransaction");
43
43
  var ethers_1 = require("ethers");
44
44
  var withdrawPassivePoolAndBridge = function (params) { return __awaiter(void 0, void 0, void 0, function () {
45
- var reyaChainId, sharesAmount, eip712Signature, socketMsgGasLimit, data, result;
45
+ var reyaChainId, sharesAmount, socketMsgGasLimit, eip712Signature, data, result;
46
46
  return __generator(this, function (_a) {
47
47
  switch (_a.label) {
48
48
  case 0:
@@ -53,12 +53,12 @@ var withdrawPassivePoolAndBridge = function (params) { return __awaiter(void 0,
53
53
  else {
54
54
  sharesAmount = (0, common_1.scale)(30)(params.amount / params.sharePrice);
55
55
  }
56
- return [4 /*yield*/, (0, common_1.signPoolRemoveLiquidity)(params.signer, reyaChainId, (0, common_1.getAddress)(reyaChainId, common_1.ContractType.PERIPHERY_PROXY), params.owner.address, params.pool.id, sharesAmount, BigInt(0), params.owner.poolSigNonce + 1, (0, common_1.getCurrentTimestampInSeconds)() + common_1.BRIDGE_DEADLINE_IN_SECONDS, ethers_1.ethers.AbiCoder.defaultAbiCoder().encode(['address', 'uint256', 'uint256'], [params.owner.address, params.moneyInOutChainId, BigInt('10000000')]))];
57
- case 1:
58
- eip712Signature = _a.sent();
59
56
  socketMsgGasLimit = (0, common_1.getSocketWithdrawMsgGasLimit)({
60
57
  moneyInOutChainId: params.moneyInOutChainId,
61
58
  }).msgGasLimit;
59
+ return [4 /*yield*/, (0, common_1.signPoolRemoveLiquidity)(params.signer, reyaChainId, (0, common_1.getAddress)(reyaChainId, common_1.ContractType.PERIPHERY_PROXY), params.owner.address, params.pool.id, sharesAmount, BigInt(0), params.owner.poolSigNonce + 1, (0, common_1.getCurrentTimestampInSeconds)() + common_1.BRIDGE_DEADLINE_IN_SECONDS, ethers_1.ethers.AbiCoder.defaultAbiCoder().encode(['address', 'uint256', 'uint256'], [params.owner.address, params.moneyInOutChainId, socketMsgGasLimit]))];
60
+ case 1:
61
+ eip712Signature = _a.sent();
62
62
  data = (0, encode_1.encodeWithdrawPassivePoolAndBridge)(params.owner.address, params.pool.id, sharesAmount, BigInt(0), eip712Signature, socketMsgGasLimit, params.moneyInOutChainId, params.owner.address).calldata;
63
63
  return [4 /*yield*/, (0, signAndBroadcastTransaction_1.signAndBroadcastTransaction)(data, reyaChainId, common_1.ContractType.PERIPHERY_PROXY, {
64
64
  destinationType: 'pool',
@@ -1 +1 @@
1
- {"version":3,"file":"withdrawPassivePoolAndBridge.js","sourceRoot":"/","sources":["services/lp/withdrawPassivePoolAndBridge.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAIA,mCAA8D;AAC9D,0CASyB;AACzB,8EAA6E;AAC7E,iCAAgC;AAEzB,IAAM,4BAA4B,GAAG,UAC1C,MAA0C;;;;;gBAEpC,WAAW,GAAG,IAAA,4CAAmC,EACrD,MAAM,CAAC,iBAAiB,CACzB,CAAC;gBAGF,IAAI,MAAM,CAAC,WAAW,EAAE,CAAC;oBACvB,YAAY,GAAG,IAAA,cAAK,EAAC,EAAE,CAAC,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;gBAChD,CAAC;qBAAM,CAAC;oBACN,YAAY,GAAG,IAAA,cAAK,EAAC,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,GAAG,MAAM,CAAC,UAAU,CAAC,CAAC;gBAC9D,CAAC;gBAEuB,qBAAM,IAAA,gCAAuB,EACnD,MAAM,CAAC,MAAM,EACb,WAAW,EACX,IAAA,mBAAU,EAAC,WAAW,EAAE,qBAAY,CAAC,eAAe,CAAC,EACrD,MAAM,CAAC,KAAK,CAAC,OAAO,EACpB,MAAM,CAAC,IAAI,CAAC,EAAE,EACd,YAAY,EACZ,MAAM,CAAC,CAAC,CAAC,EACT,MAAM,CAAC,KAAK,CAAC,YAAY,GAAG,CAAC,EAC7B,IAAA,qCAA4B,GAAE,GAAG,mCAA0B,EAC3D,eAAM,CAAC,QAAQ,CAAC,eAAe,EAAE,CAAC,MAAM,CACtC,CAAC,SAAS,EAAE,SAAS,EAAE,SAAS,CAAC,EACjC,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,EAAE,MAAM,CAAC,iBAAiB,EAAE,MAAM,CAAC,UAAU,CAAC,CAAC,CACrE,CACF,EAAA;;gBAdK,eAAe,GAAG,SAcvB;gBAEK,iBAAiB,GAAG,IAAA,qCAA4B,EAAC;oBACrD,iBAAiB,EAAE,MAAM,CAAC,iBAAiB;iBAC5C,CAAC,CAAC,WAAW,CAAC;gBAEG,IAAI,GAAK,IAAA,2CAAkC,EAC3D,MAAM,CAAC,KAAK,CAAC,OAAO,EACpB,MAAM,CAAC,IAAI,CAAC,EAAE,EACd,YAAY,EACZ,MAAM,CAAC,CAAC,CAAC,EACT,eAAe,EACf,iBAAiB,EACjB,MAAM,CAAC,iBAAiB,EACxB,MAAM,CAAC,KAAK,CAAC,OAAO,CACrB,SATqB,CASpB;gBAEa,qBAAM,IAAA,yDAA2B,EAC9C,IAAI,EACJ,WAAW,EACX,qBAAY,CAAC,eAAe,EAC5B;wBACE,eAAe,EAAE,MAAM;qBACxB,CACF,EAAA;;gBAPK,MAAM,GAAG,SAOd;gBAED,sBAAO;wBACL,eAAe,EAAE,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,MAAM,KAAI,IAAI;wBACvC,YAAY,EAAE,MAAM,CAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,YAAY,CAAC,IAAI,IAAI;qBACnD,EAAC;;;KACH,CAAC;AA1DW,QAAA,4BAA4B,gCA0DvC","sourcesContent":["import {\n WithdrawPassivePoolAndBridgeParams,\n WithdrawPassivePoolAndBridgeResult,\n} from './types';\nimport { encodeWithdrawPassivePoolAndBridge } from './encode';\nimport {\n getCurrentTimestampInSeconds,\n scale,\n signPoolRemoveLiquidity,\n ContractType,\n getAddress,\n BRIDGE_DEADLINE_IN_SECONDS,\n getReyaNetworkFromMoneyInOutChainId,\n getSocketWithdrawMsgGasLimit,\n} from '@reyaxyz/common';\nimport { signAndBroadcastTransaction } from '../signAndBroadcastTransaction';\nimport { ethers } from 'ethers';\n\nexport const withdrawPassivePoolAndBridge = async (\n params: WithdrawPassivePoolAndBridgeParams,\n): Promise<WithdrawPassivePoolAndBridgeResult> => {\n const reyaChainId = getReyaNetworkFromMoneyInOutChainId(\n params.moneyInOutChainId,\n );\n\n let sharesAmount;\n if (params.withdrawMax) {\n sharesAmount = scale(30)(params.sharesAmount);\n } else {\n sharesAmount = scale(30)(params.amount / params.sharePrice);\n }\n\n const eip712Signature = await signPoolRemoveLiquidity(\n params.signer,\n reyaChainId,\n getAddress(reyaChainId, ContractType.PERIPHERY_PROXY),\n params.owner.address,\n params.pool.id,\n sharesAmount,\n BigInt(0),\n params.owner.poolSigNonce + 1,\n getCurrentTimestampInSeconds() + BRIDGE_DEADLINE_IN_SECONDS,\n ethers.AbiCoder.defaultAbiCoder().encode(\n ['address', 'uint256', 'uint256'],\n [params.owner.address, params.moneyInOutChainId, BigInt('10000000')],\n ),\n );\n\n const socketMsgGasLimit = getSocketWithdrawMsgGasLimit({\n moneyInOutChainId: params.moneyInOutChainId,\n }).msgGasLimit;\n\n const { calldata: data } = encodeWithdrawPassivePoolAndBridge(\n params.owner.address,\n params.pool.id,\n sharesAmount,\n BigInt(0),\n eip712Signature,\n socketMsgGasLimit,\n params.moneyInOutChainId,\n params.owner.address,\n );\n\n const result = await signAndBroadcastTransaction(\n data,\n reyaChainId,\n ContractType.PERIPHERY_PROXY,\n {\n destinationType: 'pool',\n },\n );\n\n return {\n transactionHash: result?.txHash || null,\n poolSigNonce: Number(result?.poolSigNonce) || null,\n };\n};\n"]}
1
+ {"version":3,"file":"withdrawPassivePoolAndBridge.js","sourceRoot":"/","sources":["services/lp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AAI,GAAK,IAAA,2CAAkC,EAC3D,MAAM,CAAC,KAAK,CAAC,OAAO,EACpB,MAAM,CAAC,IAAI,CAAC,EAAE,EACd,YAAY,EACZ,MAAM,CAAC,CAAC,CAAC,EACT,eAAe,EACf,iBAAiB,EACjB,MAAM,CAAC,iBAAiB,EACxB,MAAM,CAAC,KAAK,CAAC,OAAO,CACrB,SATqB,CASpB;gBAEa,qBAAM,IAAA,yDAA2B,EAC9C,IAAI,EACJ,WAAW,EACX,qBAAY,CAAC,eAAe,EAC5B;wBACE,eAAe,EAAE,MAAM;qBACxB,CACF,EAAA;;gBAPK,MAAM,GAAG,SAOd;gBAED,sBAAO;wBACL,eAAe,EAAE,CAAA,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,MAAM,KAAI,IAAI;wBACvC,YAAY,EAAE,MAAM,CAAC,MAAM,aAAN,MAAM,uBAAN,MAAM,CAAE,YAAY,CAAC,IAAI,IAAI;qBACnD,EAAC;;;KACH,CAAC;AA1DW,QAAA,4BAA4B,gCA0DvC","sourcesContent":["import {\n WithdrawPassivePoolAndBridgeParams,\n WithdrawPassivePoolAndBridgeResult,\n} from './types';\nimport { encodeWithdrawPassivePoolAndBridge } from './encode';\nimport {\n getCurrentTimestampInSeconds,\n scale,\n signPoolRemoveLiquidity,\n ContractType,\n getAddress,\n BRIDGE_DEADLINE_IN_SECONDS,\n getReyaNetworkFromMoneyInOutChainId,\n getSocketWithdrawMsgGasLimit,\n} from '@reyaxyz/common';\nimport { signAndBroadcastTransaction } from '../signAndBroadcastTransaction';\nimport { ethers } from 'ethers';\n\nexport const withdrawPassivePoolAndBridge = async (\n params: WithdrawPassivePoolAndBridgeParams,\n): Promise<WithdrawPassivePoolAndBridgeResult> => {\n const reyaChainId = getReyaNetworkFromMoneyInOutChainId(\n params.moneyInOutChainId,\n );\n\n let sharesAmount;\n if (params.withdrawMax) {\n sharesAmount = scale(30)(params.sharesAmount);\n } else {\n sharesAmount = scale(30)(params.amount / params.sharePrice);\n }\n\n const socketMsgGasLimit = getSocketWithdrawMsgGasLimit({\n moneyInOutChainId: params.moneyInOutChainId,\n }).msgGasLimit;\n\n const eip712Signature = await signPoolRemoveLiquidity(\n params.signer,\n reyaChainId,\n getAddress(reyaChainId, ContractType.PERIPHERY_PROXY),\n params.owner.address,\n params.pool.id,\n sharesAmount,\n BigInt(0),\n params.owner.poolSigNonce + 1,\n getCurrentTimestampInSeconds() + BRIDGE_DEADLINE_IN_SECONDS,\n ethers.AbiCoder.defaultAbiCoder().encode(\n ['address', 'uint256', 'uint256'],\n [params.owner.address, params.moneyInOutChainId, socketMsgGasLimit],\n ),\n );\n\n const { calldata: data } = encodeWithdrawPassivePoolAndBridge(\n params.owner.address,\n params.pool.id,\n sharesAmount,\n BigInt(0),\n eip712Signature,\n socketMsgGasLimit,\n params.moneyInOutChainId,\n params.owner.address,\n );\n\n const result = await signAndBroadcastTransaction(\n data,\n reyaChainId,\n ContractType.PERIPHERY_PROXY,\n {\n destinationType: 'pool',\n },\n );\n\n return {\n transactionHash: result?.txHash || null,\n poolSigNonce: Number(result?.poolSigNonce) || null,\n };\n};\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reyaxyz/sdk",
3
- "version": "0.113.6",
3
+ "version": "0.113.7",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -35,5 +35,5 @@
35
35
  "ethers": "6.9.0"
36
36
  },
37
37
  "packageManager": "pnpm@8.3.1",
38
- "gitHead": "1c9a103892678fd3f8971a550980bb8cac55ed6e"
38
+ "gitHead": "20240e70a9fbba67528d8b824cd2c83c98b82fc4"
39
39
  }
@@ -30,6 +30,10 @@ export const withdrawPassivePoolAndBridge = async (
30
30
  sharesAmount = scale(30)(params.amount / params.sharePrice);
31
31
  }
32
32
 
33
+ const socketMsgGasLimit = getSocketWithdrawMsgGasLimit({
34
+ moneyInOutChainId: params.moneyInOutChainId,
35
+ }).msgGasLimit;
36
+
33
37
  const eip712Signature = await signPoolRemoveLiquidity(
34
38
  params.signer,
35
39
  reyaChainId,
@@ -42,14 +46,10 @@ export const withdrawPassivePoolAndBridge = async (
42
46
  getCurrentTimestampInSeconds() + BRIDGE_DEADLINE_IN_SECONDS,
43
47
  ethers.AbiCoder.defaultAbiCoder().encode(
44
48
  ['address', 'uint256', 'uint256'],
45
- [params.owner.address, params.moneyInOutChainId, BigInt('10000000')],
49
+ [params.owner.address, params.moneyInOutChainId, socketMsgGasLimit],
46
50
  ),
47
51
  );
48
52
 
49
- const socketMsgGasLimit = getSocketWithdrawMsgGasLimit({
50
- moneyInOutChainId: params.moneyInOutChainId,
51
- }).msgGasLimit;
52
-
53
53
  const { calldata: data } = encodeWithdrawPassivePoolAndBridge(
54
54
  params.owner.address,
55
55
  params.pool.id,