@reyaxyz/sdk 0.9.0 → 0.11.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.
package/dist/index.js CHANGED
@@ -16,6 +16,7 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
16
16
  Object.defineProperty(exports, "__esModule", { value: true });
17
17
  __exportStar(require("./services/lp"), exports);
18
18
  __exportStar(require("./services/margin-accounts"), exports);
19
+ __exportStar(require("./services/money-flows"), exports);
19
20
  __exportStar(require("./services/orders"), exports);
20
21
  __exportStar(require("./services/token"), exports);
21
22
  //# sourceMappingURL=index.js.map
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,6DAA2C;AAC3C,oDAAkC;AAClC,mDAAiC","sourcesContent":["export * from './services/lp';\nexport * from './services/margin-accounts';\nexport * from './services/orders';\nexport * from './services/token';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,gDAA8B;AAC9B,6DAA2C;AAC3C,yDAAuC;AACvC,oDAAkC;AAClC,mDAAiC","sourcesContent":["export * from './services/lp';\nexport * from './services/margin-accounts';\nexport * from './services/money-flows';\nexport * from './services/orders';\nexport * from './services/token';\n"]}
@@ -0,0 +1,23 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getAllowedChainsForMoneyInOut = void 0;
4
+ var getAllowedChainsForMoneyInOut = function (_a) {
5
+ var
6
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
7
+ destinationChainId = _a.destinationChainId;
8
+ // todo: implement
9
+ return {
10
+ sourceChains: [
11
+ {
12
+ chainId: 11155111,
13
+ tokens: {
14
+ '0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238': {
15
+ vaultAddress: '0x036CbD53842c5426634e7929541eC2318f3dCF7e',
16
+ },
17
+ },
18
+ },
19
+ ],
20
+ };
21
+ };
22
+ exports.getAllowedChainsForMoneyInOut = getAllowedChainsForMoneyInOut;
23
+ //# sourceMappingURL=getAllowedChainsForMoneyInOut.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getAllowedChainsForMoneyInOut.js","sourceRoot":"/","sources":["services/money-flows/getAllowedChainsForMoneyInOut.ts"],"names":[],"mappings":";;;AAKO,IAAM,6BAA6B,GAAG,UAAC,EAGR;;IAFpC,6DAA6D;IAC7D,kBAAkB,wBAAA;IAElB,kBAAkB;IAClB,OAAO;QACL,YAAY,EAAE;YACZ;gBACE,OAAO,EAAE,QAAQ;gBACjB,MAAM,EAAE;oBACN,4CAA4C,EAAE;wBAC5C,YAAY,EAAE,4CAA4C;qBAC3D;iBACF;aACF;SACF;KACF,CAAC;AACJ,CAAC,CAAC;AAjBW,QAAA,6BAA6B,iCAiBxC","sourcesContent":["import {\n GetAllowedChainsForMoneyInOutParams,\n GetAllowedChainsForMoneyInOutResult,\n} from './types';\n\nexport const getAllowedChainsForMoneyInOut = ({\n // eslint-disable-next-line @typescript-eslint/no-unused-vars\n destinationChainId,\n}: GetAllowedChainsForMoneyInOutParams): GetAllowedChainsForMoneyInOutResult => {\n // todo: implement\n return {\n sourceChains: [\n {\n chainId: 11155111,\n tokens: {\n '0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238': {\n vaultAddress: '0x036CbD53842c5426634e7929541eC2318f3dCF7e',\n },\n },\n },\n ],\n };\n};\n"]}
@@ -0,0 +1,18 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __exportStar = (this && this.__exportStar) || function(m, exports) {
14
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
15
+ };
16
+ Object.defineProperty(exports, "__esModule", { value: true });
17
+ __exportStar(require("./getAllowedChainsForMoneyInOut"), exports);
18
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["services/money-flows/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,kEAAgD","sourcesContent":["export * from './getAllowedChainsForMoneyInOut';\n"]}
@@ -0,0 +1,3 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"/","sources":["services/money-flows/types.ts"],"names":[],"mappings":"","sourcesContent":["export type GetAllowedChainsForMoneyInOutParams = {\n destinationChainId: number;\n};\n\nexport type GetAllowedChainsForMoneyInOutResult = {\n sourceChains: {\n chainId: number;\n tokens: {\n [tokenAddress: string]: {\n vaultAddress: string;\n };\n };\n }[];\n};\n"]}
@@ -1,5 +1,6 @@
1
1
  export * from './services/lp';
2
2
  export * from './services/margin-accounts';
3
+ export * from './services/money-flows';
3
4
  export * from './services/orders';
4
5
  export * from './services/token';
5
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["index.ts"],"names":[],"mappings":"AAAA,cAAc,eAAe,CAAC;AAC9B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,wBAAwB,CAAC;AACvC,cAAc,mBAAmB,CAAC;AAClC,cAAc,kBAAkB,CAAC"}
@@ -0,0 +1,3 @@
1
+ import { GetAllowedChainsForMoneyInOutParams, GetAllowedChainsForMoneyInOutResult } from './types';
2
+ export declare const getAllowedChainsForMoneyInOut: ({ destinationChainId, }: GetAllowedChainsForMoneyInOutParams) => GetAllowedChainsForMoneyInOutResult;
3
+ //# sourceMappingURL=getAllowedChainsForMoneyInOut.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getAllowedChainsForMoneyInOut.d.ts","sourceRoot":"/","sources":["services/money-flows/getAllowedChainsForMoneyInOut.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mCAAmC,EACnC,mCAAmC,EACpC,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,6BAA6B,4BAGvC,mCAAmC,KAAG,mCAcxC,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './getAllowedChainsForMoneyInOut';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["services/money-flows/index.ts"],"names":[],"mappings":"AAAA,cAAc,iCAAiC,CAAC"}
@@ -0,0 +1,14 @@
1
+ export type GetAllowedChainsForMoneyInOutParams = {
2
+ destinationChainId: number;
3
+ };
4
+ export type GetAllowedChainsForMoneyInOutResult = {
5
+ sourceChains: {
6
+ chainId: number;
7
+ tokens: {
8
+ [tokenAddress: string]: {
9
+ vaultAddress: string;
10
+ };
11
+ };
12
+ }[];
13
+ };
14
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["services/money-flows/types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,mCAAmC,GAAG;IAChD,kBAAkB,EAAE,MAAM,CAAC;CAC5B,CAAC;AAEF,MAAM,MAAM,mCAAmC,GAAG;IAChD,YAAY,EAAE;QACZ,OAAO,EAAE,MAAM,CAAC;QAChB,MAAM,EAAE;YACN,CAAC,YAAY,EAAE,MAAM,GAAG;gBACtB,YAAY,EAAE,MAAM,CAAC;aACtB,CAAC;SACH,CAAC;KACH,EAAE,CAAC;CACL,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"lp.d.ts","sourceRoot":"/","sources":["utils/lp.ts"],"names":[],"mappings":"AAEA,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAOhE;AAED,wBAAgB,oBAAoB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAOjE;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAOvE"}
1
+ {"version":3,"file":"lp.d.ts","sourceRoot":"/","sources":["utils/lp.ts"],"names":[],"mappings":"AAEA,wBAAgB,uBAAuB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CAOhE;AAED,wBAAgB,oBAAoB,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,CAOjE;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAIvE"}
package/dist/utils/lp.js CHANGED
@@ -20,10 +20,9 @@ function calculateMinOutForLp(sharesAmount) {
20
20
  }
21
21
  exports.calculateMinOutForLp = calculateMinOutForLp;
22
22
  function expandLpAmount(amount, decimals) {
23
- var decimalFactor = BigInt(Math.pow(10, decimals));
24
- var amountBigInt = BigInt(amount);
25
- var amountDenormalised = amountBigInt * decimalFactor;
26
- return amountDenormalised;
23
+ var decimalFactor = (0, bignumber_js_1.default)(10).pow(decimals);
24
+ var amountBigNumber = (0, bignumber_js_1.default)(amount);
25
+ return BigInt(amountBigNumber.times(decimalFactor).toFixed());
27
26
  }
28
27
  exports.expandLpAmount = expandLpAmount;
29
28
  //# sourceMappingURL=lp.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"lp.js","sourceRoot":"/","sources":["utils/lp.ts"],"names":[],"mappings":";;;;;;AAAA,8DAAqC;AAErC,SAAgB,uBAAuB,CAAC,QAAgB;IACtD,IAAM,MAAM,GAAG,IAAA,sBAAS,EAAC,QAAQ,CAAC,CAAC;IAEnC,2DAA2D;IAC3D,IAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAElC,OAAO,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,6CAA6C;AAClG,CAAC;AAPD,0DAOC;AAED,SAAgB,oBAAoB,CAAC,YAAoB;IACvD,IAAM,MAAM,GAAG,IAAA,sBAAS,EAAC,YAAY,CAAC,CAAC;IAEvC,6DAA6D;IAC7D,IAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAElC,OAAO,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,6CAA6C;AAClG,CAAC;AAPD,oDAOC;AAED,SAAgB,cAAc,CAAC,MAAc,EAAE,QAAgB;IAC7D,IAAM,aAAa,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,QAAQ,CAAC,CAAC,CAAC;IACrD,IAAM,YAAY,GAAG,MAAM,CAAC,MAAM,CAAC,CAAC;IAEpC,IAAM,kBAAkB,GAAG,YAAY,GAAG,aAAa,CAAC;IAExD,OAAO,kBAAkB,CAAC;AAC5B,CAAC;AAPD,wCAOC","sourcesContent":["import BigNumber from 'bignumber.js';\n\nexport function calculateMinSharesForLp(lpAmount: number): number {\n const amount = BigNumber(lpAmount);\n\n // Calculate 1% // @todo update this number once we have it\n const offset = amount.times(0.99);\n\n return amount.minus(offset).times(1e6).toNumber(); // rUSD/USDC has 6 decimals, change if needed\n}\n\nexport function calculateMinOutForLp(sharesAmount: number): number {\n const amount = BigNumber(sharesAmount);\n\n // Calculate 1% // @todo update once we have the exact number\n const offset = amount.times(0.99);\n\n return amount.minus(offset).times(1e6).toNumber(); // rUSD/USDC has 6 decimals, change if needed\n}\n\nexport function expandLpAmount(amount: number, decimals: number): bigint {\n const decimalFactor = BigInt(Math.pow(10, decimals));\n const amountBigInt = BigInt(amount);\n\n const amountDenormalised = amountBigInt * decimalFactor;\n\n return amountDenormalised;\n}\n"]}
1
+ {"version":3,"file":"lp.js","sourceRoot":"/","sources":["utils/lp.ts"],"names":[],"mappings":";;;;;;AAAA,8DAAqC;AAErC,SAAgB,uBAAuB,CAAC,QAAgB;IACtD,IAAM,MAAM,GAAG,IAAA,sBAAS,EAAC,QAAQ,CAAC,CAAC;IAEnC,2DAA2D;IAC3D,IAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAElC,OAAO,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,6CAA6C;AAClG,CAAC;AAPD,0DAOC;AAED,SAAgB,oBAAoB,CAAC,YAAoB;IACvD,IAAM,MAAM,GAAG,IAAA,sBAAS,EAAC,YAAY,CAAC,CAAC;IAEvC,6DAA6D;IAC7D,IAAM,MAAM,GAAG,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;IAElC,OAAO,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,6CAA6C;AAClG,CAAC;AAPD,oDAOC;AAED,SAAgB,cAAc,CAAC,MAAc,EAAE,QAAgB;IAC7D,IAAM,aAAa,GAAG,IAAA,sBAAS,EAAC,EAAE,CAAC,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;IAClD,IAAM,eAAe,GAAG,IAAA,sBAAS,EAAC,MAAM,CAAC,CAAC;IAC1C,OAAO,MAAM,CAAC,eAAe,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC,OAAO,EAAE,CAAC,CAAC;AAChE,CAAC;AAJD,wCAIC","sourcesContent":["import BigNumber from 'bignumber.js';\n\nexport function calculateMinSharesForLp(lpAmount: number): number {\n const amount = BigNumber(lpAmount);\n\n // Calculate 1% // @todo update this number once we have it\n const offset = amount.times(0.99);\n\n return amount.minus(offset).times(1e6).toNumber(); // rUSD/USDC has 6 decimals, change if needed\n}\n\nexport function calculateMinOutForLp(sharesAmount: number): number {\n const amount = BigNumber(sharesAmount);\n\n // Calculate 1% // @todo update once we have the exact number\n const offset = amount.times(0.99);\n\n return amount.minus(offset).times(1e6).toNumber(); // rUSD/USDC has 6 decimals, change if needed\n}\n\nexport function expandLpAmount(amount: number, decimals: number): bigint {\n const decimalFactor = BigNumber(10).pow(decimals);\n const amountBigNumber = BigNumber(amount);\n return BigInt(amountBigNumber.times(decimalFactor).toFixed());\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reyaxyz/sdk",
3
- "version": "0.9.0",
3
+ "version": "0.11.0",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org"
@@ -33,5 +33,5 @@
33
33
  "ethers": "6.9.0"
34
34
  },
35
35
  "packageManager": "pnpm@8.10.4",
36
- "gitHead": "9f2ff5ef64beccf41401f5805b3b1114865350c3"
36
+ "gitHead": "4f23d7ea33e5b0cfeead1661fbbd1dc20c702551"
37
37
  }
package/src/index.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './services/lp';
2
2
  export * from './services/margin-accounts';
3
+ export * from './services/money-flows';
3
4
  export * from './services/orders';
4
5
  export * from './services/token';
@@ -0,0 +1,23 @@
1
+ import {
2
+ GetAllowedChainsForMoneyInOutParams,
3
+ GetAllowedChainsForMoneyInOutResult,
4
+ } from './types';
5
+
6
+ export const getAllowedChainsForMoneyInOut = ({
7
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
8
+ destinationChainId,
9
+ }: GetAllowedChainsForMoneyInOutParams): GetAllowedChainsForMoneyInOutResult => {
10
+ // todo: implement
11
+ return {
12
+ sourceChains: [
13
+ {
14
+ chainId: 11155111,
15
+ tokens: {
16
+ '0x1c7D4B196Cb0C7B01d743Fbc6116a902379C7238': {
17
+ vaultAddress: '0x036CbD53842c5426634e7929541eC2318f3dCF7e',
18
+ },
19
+ },
20
+ },
21
+ ],
22
+ };
23
+ };
@@ -0,0 +1 @@
1
+ export * from './getAllowedChainsForMoneyInOut';
@@ -0,0 +1,14 @@
1
+ export type GetAllowedChainsForMoneyInOutParams = {
2
+ destinationChainId: number;
3
+ };
4
+
5
+ export type GetAllowedChainsForMoneyInOutResult = {
6
+ sourceChains: {
7
+ chainId: number;
8
+ tokens: {
9
+ [tokenAddress: string]: {
10
+ vaultAddress: string;
11
+ };
12
+ };
13
+ }[];
14
+ };
package/src/utils/lp.ts CHANGED
@@ -19,10 +19,7 @@ export function calculateMinOutForLp(sharesAmount: number): number {
19
19
  }
20
20
 
21
21
  export function expandLpAmount(amount: number, decimals: number): bigint {
22
- const decimalFactor = BigInt(Math.pow(10, decimals));
23
- const amountBigInt = BigInt(amount);
24
-
25
- const amountDenormalised = amountBigInt * decimalFactor;
26
-
27
- return amountDenormalised;
22
+ const decimalFactor = BigNumber(10).pow(decimals);
23
+ const amountBigNumber = BigNumber(amount);
24
+ return BigInt(amountBigNumber.times(decimalFactor).toFixed());
28
25
  }