@reyaxyz/sdk 0.21.2 → 0.22.0

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.
@@ -20,4 +20,7 @@ __exportStar(require("./bridgeAndDepositPassivePool"), exports);
20
20
  __exportStar(require("./transferFromMAToPool"), exports);
21
21
  __exportStar(require("./withdrawPassivePoolAndBridge"), exports);
22
22
  __exportStar(require("./simulateTransferFromMAToPool"), exports);
23
+ __exportStar(require("./simulateBridgeAndDepositPassivePool"), exports);
24
+ __exportStar(require("./simulateWithdrawPassivePoolAndBridge"), exports);
25
+ __exportStar(require("./simulateBridgeAndDepositPassivePool"), exports);
23
26
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["services/lp/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,uCAAqB;AACrB,gEAA8C;AAC9C,yDAAuC;AACvC,iEAA+C;AAC/C,iEAA+C","sourcesContent":["export * from './types';\nexport * from './lp';\nexport * from './bridgeAndDepositPassivePool';\nexport * from './transferFromMAToPool';\nexport * from './withdrawPassivePoolAndBridge';\nexport * from './simulateTransferFromMAToPool';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["services/lp/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,uCAAqB;AACrB,gEAA8C;AAC9C,yDAAuC;AACvC,iEAA+C;AAC/C,iEAA+C;AAC/C,wEAAsD;AACtD,yEAAuD;AACvD,wEAAsD","sourcesContent":["export * from './types';\nexport * from './lp';\nexport * from './bridgeAndDepositPassivePool';\nexport * from './transferFromMAToPool';\nexport * from './withdrawPassivePoolAndBridge';\nexport * from './simulateTransferFromMAToPool';\nexport * from './simulateBridgeAndDepositPassivePool';\nexport * from './simulateWithdrawPassivePoolAndBridge';\nexport * from './simulateBridgeAndDepositPassivePool';\n"]}
@@ -0,0 +1,67 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.simulateBridgeAndDepositPassivePool = void 0;
40
+ // The maximum is inclusive and the minimum is inclusive
41
+ function getRandomIntInclusive(min, max) {
42
+ min = Math.ceil(min);
43
+ max = Math.floor(max);
44
+ return Math.floor(Math.random() * (max - min + 1) + min);
45
+ }
46
+ var randomSimulation = function () {
47
+ return {
48
+ bridgeGasFees: getRandomIntInclusive(1000, 100000),
49
+ estimatedDepositedAmount: getRandomIntInclusive(1000, 100000),
50
+ };
51
+ };
52
+ var simulateBridgeAndDepositPassivePool = function (
53
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
54
+ params) { return __awaiter(void 0, void 0, void 0, function () {
55
+ return __generator(this, function (_a) {
56
+ switch (_a.label) {
57
+ case 0: return [4 /*yield*/, new Promise(function (resolve) {
58
+ setTimeout(function () {
59
+ resolve(randomSimulation());
60
+ }, Math.random() * 100 + 1000);
61
+ })];
62
+ case 1: return [2 /*return*/, _a.sent()];
63
+ }
64
+ });
65
+ }); };
66
+ exports.simulateBridgeAndDepositPassivePool = simulateBridgeAndDepositPassivePool;
67
+ //# sourceMappingURL=simulateBridgeAndDepositPassivePool.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simulateBridgeAndDepositPassivePool.js","sourceRoot":"/","sources":["services/lp/simulateBridgeAndDepositPassivePool.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,wDAAwD;AACxD,SAAS,qBAAqB,CAAC,GAAW,EAAE,GAAW;IACrD,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACrB,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACtB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC;AAC3D,CAAC;AAED,IAAM,gBAAgB,GAAG;IACvB,OAAO;QACL,aAAa,EAAE,qBAAqB,CAAC,IAAI,EAAE,MAAM,CAAC;QAClD,wBAAwB,EAAE,qBAAqB,CAAC,IAAI,EAAE,MAAM,CAAC;KAC9D,CAAC;AACJ,CAAC,CAAC;AAEK,IAAM,mCAAmC,GAAG;AACjD,6DAA6D;AAC7D,MAAiD;;;oBAE1C,qBAAM,IAAI,OAAO,CAAC,UAAC,OAAO;oBAC/B,UAAU,CACR;wBACE,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAC;oBAC9B,CAAC,EACD,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,IAAI,CAC3B,CAAC;gBACJ,CAAC,CAAC,EAAA;oBAPF,sBAAO,SAOL,EAAC;;;KACJ,CAAC;AAZW,QAAA,mCAAmC,uCAY9C","sourcesContent":["import {\n SimulateBridgeAndDepositPassivePoolParams,\n SimulateBridgeAndDepositPassivePoolResult,\n} from './types';\n\n// The maximum is inclusive and the minimum is inclusive\nfunction getRandomIntInclusive(min: number, max: number) {\n min = Math.ceil(min);\n max = Math.floor(max);\n return Math.floor(Math.random() * (max - min + 1) + min);\n}\n\nconst randomSimulation = (): SimulateBridgeAndDepositPassivePoolResult => {\n return {\n bridgeGasFees: getRandomIntInclusive(1000, 100000),\n estimatedDepositedAmount: getRandomIntInclusive(1000, 100000),\n };\n};\n\nexport const simulateBridgeAndDepositPassivePool = async (\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n params: SimulateBridgeAndDepositPassivePoolParams,\n): Promise<SimulateBridgeAndDepositPassivePoolResult> => {\n return await new Promise((resolve) => {\n setTimeout(\n () => {\n resolve(randomSimulation());\n },\n Math.random() * 100 + 1000,\n );\n });\n};\n"]}
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
+ function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
+ return new (P || (P = Promise))(function (resolve, reject) {
5
+ function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
+ function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
+ function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
+ step((generator = generator.apply(thisArg, _arguments || [])).next());
9
+ });
10
+ };
11
+ var __generator = (this && this.__generator) || function (thisArg, body) {
12
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
13
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
+ function verb(n) { return function (v) { return step([n, v]); }; }
15
+ function step(op) {
16
+ if (f) throw new TypeError("Generator is already executing.");
17
+ while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
+ if (y = 0, t) op = [op[0] & 2, t.value];
20
+ switch (op[0]) {
21
+ case 0: case 1: t = op; break;
22
+ case 4: _.label++; return { value: op[1], done: false };
23
+ case 5: _.label++; y = op[1]; op = [0]; continue;
24
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
+ default:
26
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
+ if (t[2]) _.ops.pop();
31
+ _.trys.pop(); continue;
32
+ }
33
+ op = body.call(thisArg, _);
34
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
+ }
37
+ };
38
+ Object.defineProperty(exports, "__esModule", { value: true });
39
+ exports.simulateWithdrawPassivePoolAndBridge = void 0;
40
+ // The maximum is inclusive and the minimum is inclusive
41
+ function getRandomIntInclusive(min, max) {
42
+ min = Math.ceil(min);
43
+ max = Math.floor(max);
44
+ return Math.floor(Math.random() * (max - min + 1) + min);
45
+ }
46
+ var randomSimulation = function () {
47
+ return {
48
+ bridgeGasFees: getRandomIntInclusive(1000, 100000),
49
+ };
50
+ };
51
+ var simulateWithdrawPassivePoolAndBridge = function (
52
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
53
+ params) { return __awaiter(void 0, void 0, void 0, function () {
54
+ return __generator(this, function (_a) {
55
+ switch (_a.label) {
56
+ case 0: return [4 /*yield*/, new Promise(function (resolve) {
57
+ setTimeout(function () {
58
+ resolve(randomSimulation());
59
+ }, Math.random() * 100 + 1000);
60
+ })];
61
+ case 1: return [2 /*return*/, _a.sent()];
62
+ }
63
+ });
64
+ }); };
65
+ exports.simulateWithdrawPassivePoolAndBridge = simulateWithdrawPassivePoolAndBridge;
66
+ //# sourceMappingURL=simulateWithdrawPassivePoolAndBridge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simulateWithdrawPassivePoolAndBridge.js","sourceRoot":"/","sources":["services/lp/simulateWithdrawPassivePoolAndBridge.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAKA,wDAAwD;AACxD,SAAS,qBAAqB,CAAC,GAAW,EAAE,GAAW;IACrD,GAAG,GAAG,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;IACrB,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC;IACtB,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,GAAG,GAAG,GAAG,CAAC,CAAC,GAAG,GAAG,CAAC,CAAC;AAC3D,CAAC;AAED,IAAM,gBAAgB,GAAG;IACvB,OAAO;QACL,aAAa,EAAE,qBAAqB,CAAC,IAAI,EAAE,MAAM,CAAC;KACnD,CAAC;AACJ,CAAC,CAAC;AAEK,IAAM,oCAAoC,GAAG;AAClD,6DAA6D;AAC7D,MAAkD;;;oBAE3C,qBAAM,IAAI,OAAO,CAAC,UAAC,OAAO;oBAC/B,UAAU,CACR;wBACE,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAAC;oBAC9B,CAAC,EACD,IAAI,CAAC,MAAM,EAAE,GAAG,GAAG,GAAG,IAAI,CAC3B,CAAC;gBACJ,CAAC,CAAC,EAAA;oBAPF,sBAAO,SAOL,EAAC;;;KACJ,CAAC;AAZW,QAAA,oCAAoC,wCAY/C","sourcesContent":["import {\n SimulateWithdrawPassivePoolAndBridgeParams,\n SimulateWithdrawPassivePoolAndBridgeResult,\n} from './types';\n\n// The maximum is inclusive and the minimum is inclusive\nfunction getRandomIntInclusive(min: number, max: number) {\n min = Math.ceil(min);\n max = Math.floor(max);\n return Math.floor(Math.random() * (max - min + 1) + min);\n}\n\nconst randomSimulation = (): SimulateWithdrawPassivePoolAndBridgeResult => {\n return {\n bridgeGasFees: getRandomIntInclusive(1000, 100000),\n };\n};\n\nexport const simulateWithdrawPassivePoolAndBridge = async (\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n params: SimulateWithdrawPassivePoolAndBridgeParams,\n): Promise<SimulateWithdrawPassivePoolAndBridgeResult> => {\n return await new Promise((resolve) => {\n setTimeout(\n () => {\n resolve(randomSimulation());\n },\n Math.random() * 100 + 1000,\n );\n });\n};\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"/","sources":["services/lp/types.ts"],"names":[],"mappings":"","sourcesContent":["import { JsonRpcSigner, Signer } from 'ethers';\nimport {\n LpPoolEntity,\n LpWithdrawBalanceEntity,\n MarginAccountEntity,\n OwnerMetadataEntity,\n} from '@reyaxyz/common';\n\nexport type ProvideLiquidityParams = {\n signer: Signer | JsonRpcSigner;\n amount: number;\n lpPoolId: LpPoolEntity['id'];\n};\n\nexport type RemoveLiquidityParams = {\n signer: Signer | JsonRpcSigner;\n lpPoolId: LpPoolEntity['id'];\n amount: number;\n};\n\nexport type ProvideLiquidityResult = {\n transactionHash: string | null;\n};\n\nexport type RemoveLiquidityResult = {\n transactionHash: string | null;\n};\n\nexport type TransferFromMAToPoolParams = {\n signer: Signer | JsonRpcSigner;\n owner: Pick<OwnerMetadataEntity, 'address' | 'coreSigNonce'>;\n marginAccountId: MarginAccountEntity['id'];\n pool: Pick<LpPoolEntity, 'id' | 'tokenAddress'>;\n amount: number;\n};\n\nexport type TransferFromMAToPoolResult = {\n transactionHash: string | null;\n};\n\nexport type WithdrawPassivePoolAndBridgeParams = {\n signer: Signer | JsonRpcSigner;\n owner: Pick<OwnerMetadataEntity, 'address' | 'poolSigNonce'>;\n pool: Pick<LpPoolEntity, 'id' | 'tokenAddress'>;\n amount: number;\n sharePrice: LpWithdrawBalanceEntity['poolSharePrice'];\n};\n\nexport type WithdrawPassivePoolAndBridgeResult = {\n transactionHash: string | null;\n};\n\nexport type BridgeAndDepositPassivePoolParams = {\n signer: Signer | JsonRpcSigner;\n ownerAddress: OwnerMetadataEntity['address'];\n pool: Pick<LpPoolEntity, 'id' | 'tokenAddress'>;\n amount: number;\n};\n\nexport type BridgeAndDepositPassivePoolResult = {\n transactionHash: string | null;\n};\n\nexport type SimulateTransferFromMAToPoolResult = {\n bridgeGasFees: number;\n estimatedDepositedAmount: number;\n};\n\n// TODO: Milan reevaluate these params\nexport type SimulateTransferFromMAToPoolParams = {\n signer: Signer | JsonRpcSigner;\n lpPoolId: LpPoolEntity['id'];\n tokenAddress: LpPoolEntity['tokenAddress'];\n amount: number;\n};\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"/","sources":["services/lp/types.ts"],"names":[],"mappings":"","sourcesContent":["import { JsonRpcSigner, Signer } from 'ethers';\nimport {\n LpPoolEntity,\n LpWithdrawBalanceEntity,\n MarginAccountEntity,\n OwnerMetadataEntity,\n} from '@reyaxyz/common';\n\nexport type ProvideLiquidityParams = {\n signer: Signer | JsonRpcSigner;\n amount: number;\n lpPoolId: LpPoolEntity['id'];\n};\n\nexport type RemoveLiquidityParams = {\n signer: Signer | JsonRpcSigner;\n lpPoolId: LpPoolEntity['id'];\n amount: number;\n};\n\nexport type ProvideLiquidityResult = {\n transactionHash: string | null;\n};\n\nexport type RemoveLiquidityResult = {\n transactionHash: string | null;\n};\n\nexport type TransferFromMAToPoolParams = {\n signer: Signer | JsonRpcSigner;\n owner: Pick<OwnerMetadataEntity, 'address' | 'coreSigNonce'>;\n marginAccountId: MarginAccountEntity['id'];\n pool: Pick<LpPoolEntity, 'id' | 'tokenAddress'>;\n amount: number;\n};\n\nexport type TransferFromMAToPoolResult = {\n transactionHash: string | null;\n};\n\nexport type WithdrawPassivePoolAndBridgeParams = {\n signer: Signer | JsonRpcSigner;\n owner: Pick<OwnerMetadataEntity, 'address' | 'poolSigNonce'>;\n pool: Pick<LpPoolEntity, 'id' | 'tokenAddress'>;\n amount: number;\n sharePrice: LpWithdrawBalanceEntity['poolSharePrice'];\n};\n\nexport type WithdrawPassivePoolAndBridgeResult = {\n transactionHash: string | null;\n};\n\nexport type BridgeAndDepositPassivePoolParams = {\n signer: Signer | JsonRpcSigner;\n ownerAddress: OwnerMetadataEntity['address'];\n pool: Pick<LpPoolEntity, 'id' | 'tokenAddress'>;\n amount: number;\n};\n\nexport type BridgeAndDepositPassivePoolResult = {\n transactionHash: string | null;\n};\n\n// TODO: Milan, Alex reevaluate these params\nexport type SimulateTransferFromMAToPoolResult = {\n bridgeGasFees: number;\n estimatedDepositedAmount: number;\n};\n\n// TODO: Milan, Alex reevaluate these params\nexport type SimulateTransferFromMAToPoolParams = {\n signer: Signer | JsonRpcSigner;\n lpPoolId: LpPoolEntity['id'];\n tokenAddress: LpPoolEntity['tokenAddress'];\n amount: number;\n};\n\n// TODO: Milan, Alex reevaluate these params\nexport type SimulateBridgeAndDepositPassivePoolResult = {\n bridgeGasFees: number;\n estimatedDepositedAmount: number;\n};\n\n// TODO: Milan, Alex reevaluate these params\nexport type SimulateBridgeAndDepositPassivePoolParams = {\n signer: Signer | JsonRpcSigner;\n lpPoolId: LpPoolEntity['id'];\n tokenAddress: LpPoolEntity['tokenAddress'];\n amount: number;\n};\n\n// TODO: Milan, Alex reevaluate these params\nexport type SimulateWithdrawPassivePoolAndBridgeResult = {\n bridgeGasFees: number;\n};\n\n// TODO: Milan, Alex reevaluate these params\nexport type SimulateWithdrawPassivePoolAndBridgeParams = {\n signer: Signer | JsonRpcSigner;\n lpPoolId: LpPoolEntity['id'];\n tokenAddress: LpPoolEntity['tokenAddress'];\n amount: number;\n};\n"]}
@@ -4,4 +4,7 @@ export * from './bridgeAndDepositPassivePool';
4
4
  export * from './transferFromMAToPool';
5
5
  export * from './withdrawPassivePoolAndBridge';
6
6
  export * from './simulateTransferFromMAToPool';
7
+ export * from './simulateBridgeAndDepositPassivePool';
8
+ export * from './simulateWithdrawPassivePoolAndBridge';
9
+ export * from './simulateBridgeAndDepositPassivePool';
7
10
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["services/lp/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,MAAM,CAAC;AACrB,cAAc,+BAA+B,CAAC;AAC9C,cAAc,wBAAwB,CAAC;AACvC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["services/lp/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,MAAM,CAAC;AACrB,cAAc,+BAA+B,CAAC;AAC9C,cAAc,wBAAwB,CAAC;AACvC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,gCAAgC,CAAC;AAC/C,cAAc,uCAAuC,CAAC;AACtD,cAAc,wCAAwC,CAAC;AACvD,cAAc,uCAAuC,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { SimulateBridgeAndDepositPassivePoolParams, SimulateBridgeAndDepositPassivePoolResult } from './types';
2
+ export declare const simulateBridgeAndDepositPassivePool: (params: SimulateBridgeAndDepositPassivePoolParams) => Promise<SimulateBridgeAndDepositPassivePoolResult>;
3
+ //# sourceMappingURL=simulateBridgeAndDepositPassivePool.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simulateBridgeAndDepositPassivePool.d.ts","sourceRoot":"/","sources":["services/lp/simulateBridgeAndDepositPassivePool.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,yCAAyC,EACzC,yCAAyC,EAC1C,MAAM,SAAS,CAAC;AAgBjB,eAAO,MAAM,mCAAmC,WAEtC,yCAAyC,KAChD,QAAQ,yCAAyC,CASnD,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { SimulateWithdrawPassivePoolAndBridgeParams, SimulateWithdrawPassivePoolAndBridgeResult } from './types';
2
+ export declare const simulateWithdrawPassivePoolAndBridge: (params: SimulateWithdrawPassivePoolAndBridgeParams) => Promise<SimulateWithdrawPassivePoolAndBridgeResult>;
3
+ //# sourceMappingURL=simulateWithdrawPassivePoolAndBridge.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"simulateWithdrawPassivePoolAndBridge.d.ts","sourceRoot":"/","sources":["services/lp/simulateWithdrawPassivePoolAndBridge.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,0CAA0C,EAC1C,0CAA0C,EAC3C,MAAM,SAAS,CAAC;AAejB,eAAO,MAAM,oCAAoC,WAEvC,0CAA0C,KACjD,QAAQ,0CAA0C,CASpD,CAAC"}
@@ -55,4 +55,23 @@ export type SimulateTransferFromMAToPoolParams = {
55
55
  tokenAddress: LpPoolEntity['tokenAddress'];
56
56
  amount: number;
57
57
  };
58
+ export type SimulateBridgeAndDepositPassivePoolResult = {
59
+ bridgeGasFees: number;
60
+ estimatedDepositedAmount: number;
61
+ };
62
+ export type SimulateBridgeAndDepositPassivePoolParams = {
63
+ signer: Signer | JsonRpcSigner;
64
+ lpPoolId: LpPoolEntity['id'];
65
+ tokenAddress: LpPoolEntity['tokenAddress'];
66
+ amount: number;
67
+ };
68
+ export type SimulateWithdrawPassivePoolAndBridgeResult = {
69
+ bridgeGasFees: number;
70
+ };
71
+ export type SimulateWithdrawPassivePoolAndBridgeParams = {
72
+ signer: Signer | JsonRpcSigner;
73
+ lpPoolId: LpPoolEntity['id'];
74
+ tokenAddress: LpPoolEntity['tokenAddress'];
75
+ amount: number;
76
+ };
58
77
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["services/lp/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC/C,OAAO,EACL,YAAY,EACZ,uBAAuB,EACvB,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,iBAAiB,CAAC;AAEzB,MAAM,MAAM,sBAAsB,GAAG;IACnC,MAAM,EAAE,MAAM,GAAG,aAAa,CAAC;IAC/B,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,MAAM,EAAE,MAAM,GAAG,aAAa,CAAC;IAC/B,QAAQ,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;IAC7B,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAEF,MAAM,MAAM,sBAAsB,GAAG;IACnC,eAAe,EAAE,MAAM,GAAG,IAAI,CAAC;CAChC,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AY,CAAC,cAAc,CAAC,CAAC;IAC3C,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAGF,MAAM,MAAM,yCAAyC,GAAG;IACtD,aAAa,EAAE,MAAM,CAAC;IACtB,wBAAwB,EAAE,MAAM,CAAC;CAClC,CAAC;AAGF,MAAM,MAAM,yCAAyC,GAAG;IACtD,MAAM,EAAE,MAAM,GAAG,aAAa,CAAC;IAC/B,QAAQ,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;IAC7B,YAAY,EAAE,YAAY,CAAC,cAAc,CAAC,CAAC;IAC3C,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC;AAGF,MAAM,MAAM,0CAA0C,GAAG;IACvD,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAGF,MAAM,MAAM,0CAA0C,GAAG;IACvD,MAAM,EAAE,MAAM,GAAG,aAAa,CAAC;IAC/B,QAAQ,EAAE,YAAY,CAAC,IAAI,CAAC,CAAC;IAC7B,YAAY,EAAE,YAAY,CAAC,cAAc,CAAC,CAAC;IAC3C,MAAM,EAAE,MAAM,CAAC;CAChB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reyaxyz/sdk",
3
- "version": "0.21.2",
3
+ "version": "0.22.0",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -34,5 +34,5 @@
34
34
  "ethers": "6.9.0"
35
35
  },
36
36
  "packageManager": "pnpm@8.10.4",
37
- "gitHead": "c5bb40cc3334b6335e2891fb9c0aa4a0f538569c"
37
+ "gitHead": "8bdc302b94dc89af420df470f18cde8563b4d54b"
38
38
  }
@@ -4,3 +4,6 @@ export * from './bridgeAndDepositPassivePool';
4
4
  export * from './transferFromMAToPool';
5
5
  export * from './withdrawPassivePoolAndBridge';
6
6
  export * from './simulateTransferFromMAToPool';
7
+ export * from './simulateBridgeAndDepositPassivePool';
8
+ export * from './simulateWithdrawPassivePoolAndBridge';
9
+ export * from './simulateBridgeAndDepositPassivePool';
@@ -0,0 +1,32 @@
1
+ import {
2
+ SimulateBridgeAndDepositPassivePoolParams,
3
+ SimulateBridgeAndDepositPassivePoolResult,
4
+ } from './types';
5
+
6
+ // The maximum is inclusive and the minimum is inclusive
7
+ function getRandomIntInclusive(min: number, max: number) {
8
+ min = Math.ceil(min);
9
+ max = Math.floor(max);
10
+ return Math.floor(Math.random() * (max - min + 1) + min);
11
+ }
12
+
13
+ const randomSimulation = (): SimulateBridgeAndDepositPassivePoolResult => {
14
+ return {
15
+ bridgeGasFees: getRandomIntInclusive(1000, 100000),
16
+ estimatedDepositedAmount: getRandomIntInclusive(1000, 100000),
17
+ };
18
+ };
19
+
20
+ export const simulateBridgeAndDepositPassivePool = async (
21
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
22
+ params: SimulateBridgeAndDepositPassivePoolParams,
23
+ ): Promise<SimulateBridgeAndDepositPassivePoolResult> => {
24
+ return await new Promise((resolve) => {
25
+ setTimeout(
26
+ () => {
27
+ resolve(randomSimulation());
28
+ },
29
+ Math.random() * 100 + 1000,
30
+ );
31
+ });
32
+ };
@@ -0,0 +1,31 @@
1
+ import {
2
+ SimulateWithdrawPassivePoolAndBridgeParams,
3
+ SimulateWithdrawPassivePoolAndBridgeResult,
4
+ } from './types';
5
+
6
+ // The maximum is inclusive and the minimum is inclusive
7
+ function getRandomIntInclusive(min: number, max: number) {
8
+ min = Math.ceil(min);
9
+ max = Math.floor(max);
10
+ return Math.floor(Math.random() * (max - min + 1) + min);
11
+ }
12
+
13
+ const randomSimulation = (): SimulateWithdrawPassivePoolAndBridgeResult => {
14
+ return {
15
+ bridgeGasFees: getRandomIntInclusive(1000, 100000),
16
+ };
17
+ };
18
+
19
+ export const simulateWithdrawPassivePoolAndBridge = async (
20
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
21
+ params: SimulateWithdrawPassivePoolAndBridgeParams,
22
+ ): Promise<SimulateWithdrawPassivePoolAndBridgeResult> => {
23
+ return await new Promise((resolve) => {
24
+ setTimeout(
25
+ () => {
26
+ resolve(randomSimulation());
27
+ },
28
+ Math.random() * 100 + 1000,
29
+ );
30
+ });
31
+ };
@@ -61,15 +61,43 @@ export type BridgeAndDepositPassivePoolResult = {
61
61
  transactionHash: string | null;
62
62
  };
63
63
 
64
+ // TODO: Milan, Alex reevaluate these params
64
65
  export type SimulateTransferFromMAToPoolResult = {
65
66
  bridgeGasFees: number;
66
67
  estimatedDepositedAmount: number;
67
68
  };
68
69
 
69
- // TODO: Milan reevaluate these params
70
+ // TODO: Milan, Alex reevaluate these params
70
71
  export type SimulateTransferFromMAToPoolParams = {
71
72
  signer: Signer | JsonRpcSigner;
72
73
  lpPoolId: LpPoolEntity['id'];
73
74
  tokenAddress: LpPoolEntity['tokenAddress'];
74
75
  amount: number;
75
76
  };
77
+
78
+ // TODO: Milan, Alex reevaluate these params
79
+ export type SimulateBridgeAndDepositPassivePoolResult = {
80
+ bridgeGasFees: number;
81
+ estimatedDepositedAmount: number;
82
+ };
83
+
84
+ // TODO: Milan, Alex reevaluate these params
85
+ export type SimulateBridgeAndDepositPassivePoolParams = {
86
+ signer: Signer | JsonRpcSigner;
87
+ lpPoolId: LpPoolEntity['id'];
88
+ tokenAddress: LpPoolEntity['tokenAddress'];
89
+ amount: number;
90
+ };
91
+
92
+ // TODO: Milan, Alex reevaluate these params
93
+ export type SimulateWithdrawPassivePoolAndBridgeResult = {
94
+ bridgeGasFees: number;
95
+ };
96
+
97
+ // TODO: Milan, Alex reevaluate these params
98
+ export type SimulateWithdrawPassivePoolAndBridgeParams = {
99
+ signer: Signer | JsonRpcSigner;
100
+ lpPoolId: LpPoolEntity['id'];
101
+ tokenAddress: LpPoolEntity['tokenAddress'];
102
+ amount: number;
103
+ };