@reyaxyz/sdk 0.35.0 → 0.36.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.
@@ -36,21 +36,27 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
36
36
  }
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.getBalanceByChainId = void 0;
39
+ exports.getUsdcBalance = void 0;
40
40
  var getBalanceByTokenAddress_1 = require("./getBalanceByTokenAddress");
41
41
  var common_1 = require("@reyaxyz/common");
42
- // TODO: Milan hardcoded address atm fix!
43
- // todo: this mus be removed!! here to not break UI
44
- var getBalanceByChainId = function (_a) {
45
- var signer = _a.signer, chainId = _a.chainId;
42
+ var getUsdcBalance = function (_a) {
43
+ var signer = _a.signer;
46
44
  return __awaiter(void 0, void 0, void 0, function () {
47
- return __generator(this, function (_b) {
48
- return [2 /*return*/, (0, getBalanceByTokenAddress_1.getBalanceByTokenAddress)({
49
- signer: signer,
50
- tokenAddress: (0, common_1.getTokenInfoByName)('USDC', chainId).address,
51
- })];
45
+ var network, moneyInOutChainId;
46
+ var _b;
47
+ return __generator(this, function (_c) {
48
+ switch (_c.label) {
49
+ case 0: return [4 /*yield*/, ((_b = signer.provider) === null || _b === void 0 ? void 0 : _b.getNetwork())];
50
+ case 1:
51
+ network = _c.sent();
52
+ moneyInOutChainId = Number(network === null || network === void 0 ? void 0 : network.chainId);
53
+ return [2 /*return*/, (0, getBalanceByTokenAddress_1.getBalanceByTokenAddress)({
54
+ signer: signer,
55
+ tokenAddress: (0, common_1.getTokenInfoByName)('USDC', moneyInOutChainId).address,
56
+ })];
57
+ }
52
58
  });
53
59
  });
54
60
  };
55
- exports.getBalanceByChainId = getBalanceByChainId;
56
- //# sourceMappingURL=getBalanceByChainId.js.map
61
+ exports.getUsdcBalance = getUsdcBalance;
62
+ //# sourceMappingURL=getUsdcBalance.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getUsdcBalance.js","sourceRoot":"/","sources":["services/token/getUsdcBalance.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,uEAAsE;AACtE,0CAAwE;AAEjE,IAAM,cAAc,GAAG,UAAO,EAEd;QADrB,MAAM,YAAA;;;;;;wBAEU,qBAAM,CAAA,MAAA,MAAM,CAAC,QAAQ,0CAAE,UAAU,EAAE,CAAA,EAAA;;oBAA7C,OAAO,GAAG,SAAmC;oBAC7C,iBAAiB,GAAsB,MAAM,CAAC,OAAO,aAAP,OAAO,uBAAP,OAAO,CAAE,OAAO,CAAC,CAAC;oBAEtE,sBAAO,IAAA,mDAAwB,EAAC;4BAC9B,MAAM,QAAA;4BACN,YAAY,EAAE,IAAA,2BAAkB,EAAC,MAAM,EAAE,iBAAiB,CAAC,CAAC,OAAO;yBACpE,CAAC,EAAC;;;;CACJ,CAAC;AAVW,QAAA,cAAc,kBAUzB","sourcesContent":["import { GetUsdcBalanceParams } from './types';\nimport { getBalanceByTokenAddress } from './getBalanceByTokenAddress';\nimport { MoneyInOutChainId, getTokenInfoByName } from '@reyaxyz/common';\n\nexport const getUsdcBalance = async ({\n signer,\n}: GetUsdcBalanceParams): Promise<number> => {\n const network = await signer.provider?.getNetwork();\n const moneyInOutChainId: MoneyInOutChainId = Number(network?.chainId);\n\n return getBalanceByTokenAddress({\n signer,\n tokenAddress: getTokenInfoByName('USDC', moneyInOutChainId).address,\n });\n};\n"]}
@@ -18,5 +18,5 @@ __exportStar(require("./types"), exports);
18
18
  __exportStar(require("./approve"), exports);
19
19
  __exportStar(require("./getAllowance"), exports);
20
20
  __exportStar(require("./getBalanceByTokenAddress"), exports);
21
- __exportStar(require("./getBalanceByChainId"), exports);
21
+ __exportStar(require("./getUsdcBalance"), exports);
22
22
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"/","sources":["services/token/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,4CAA0B;AAC1B,iDAA+B;AAC/B,6DAA2C;AAC3C,wDAAsC","sourcesContent":["export * from './types';\nexport * from './approve';\nexport * from './getAllowance';\nexport * from './getBalanceByTokenAddress';\nexport * from './getBalanceByChainId';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"/","sources":["services/token/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,0CAAwB;AACxB,4CAA0B;AAC1B,iDAA+B;AAC/B,6DAA2C;AAC3C,mDAAiC","sourcesContent":["export * from './types';\nexport * from './approve';\nexport * from './getAllowance';\nexport * from './getBalanceByTokenAddress';\nexport * from './getUsdcBalance';\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"types.js","sourceRoot":"/","sources":["services/token/types.ts"],"names":[],"mappings":";;;AAGA,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,2CAAE,CAAA;IACF,qDAAO,CAAA;IACP,mDAAM,CAAA;AACR,CAAC,EAJW,YAAY,4BAAZ,YAAY,QAIvB","sourcesContent":["import { JsonRpcSigner, Signer } from 'ethers';\nimport { MoneyInOutChainId, ReyaChainId, TokenEntity } from '@reyaxyz/common';\n\nexport enum ApprovalType {\n LP,\n DEPOSIT,\n BRIDGE,\n}\n\nexport type ApproveTokenParams = {\n signer: Signer | JsonRpcSigner;\n tokenAddress: TokenEntity['address'];\n type: ApprovalType;\n};\n\nexport type GetAllowanceParams = {\n signer: Signer | JsonRpcSigner;\n tokenAddress: TokenEntity['address'];\n type: ApprovalType;\n};\n\nexport type GetBalanceByTokenAddressParams = {\n signer: Signer | JsonRpcSigner;\n tokenAddress: TokenEntity['address'];\n};\n\nexport type GetBalanceByChainIdParams = {\n signer: Signer | JsonRpcSigner;\n chainId: ReyaChainId | MoneyInOutChainId;\n};\n"]}
1
+ {"version":3,"file":"types.js","sourceRoot":"/","sources":["services/token/types.ts"],"names":[],"mappings":";;;AAGA,IAAY,YAIX;AAJD,WAAY,YAAY;IACtB,2CAAE,CAAA;IACF,qDAAO,CAAA;IACP,mDAAM,CAAA;AACR,CAAC,EAJW,YAAY,4BAAZ,YAAY,QAIvB","sourcesContent":["import { JsonRpcSigner, Signer } from 'ethers';\nimport { TokenEntity } from '@reyaxyz/common';\n\nexport enum ApprovalType {\n LP,\n DEPOSIT,\n BRIDGE,\n}\n\nexport type ApproveTokenParams = {\n signer: Signer | JsonRpcSigner;\n tokenAddress: TokenEntity['address'];\n type: ApprovalType;\n};\n\nexport type GetAllowanceParams = {\n signer: Signer | JsonRpcSigner;\n tokenAddress: TokenEntity['address'];\n type: ApprovalType;\n};\n\nexport type GetBalanceByTokenAddressParams = {\n signer: Signer | JsonRpcSigner;\n tokenAddress: TokenEntity['address'];\n};\n\nexport type GetUsdcBalanceParams = {\n signer: Signer | JsonRpcSigner;\n};\n"]}
@@ -0,0 +1,3 @@
1
+ import { GetUsdcBalanceParams } from './types';
2
+ export declare const getUsdcBalance: ({ signer, }: GetUsdcBalanceParams) => Promise<number>;
3
+ //# sourceMappingURL=getUsdcBalance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getUsdcBalance.d.ts","sourceRoot":"/","sources":["services/token/getUsdcBalance.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AAI/C,eAAO,MAAM,cAAc,gBAExB,oBAAoB,KAAG,QAAQ,MAAM,CAQvC,CAAC"}
@@ -2,5 +2,5 @@ export * from './types';
2
2
  export * from './approve';
3
3
  export * from './getAllowance';
4
4
  export * from './getBalanceByTokenAddress';
5
- export * from './getBalanceByChainId';
5
+ export * from './getUsdcBalance';
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["services/token/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"/","sources":["services/token/index.ts"],"names":[],"mappings":"AAAA,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,4BAA4B,CAAC;AAC3C,cAAc,kBAAkB,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import { JsonRpcSigner, Signer } from 'ethers';
2
- import { MoneyInOutChainId, ReyaChainId, TokenEntity } from '@reyaxyz/common';
2
+ import { TokenEntity } from '@reyaxyz/common';
3
3
  export declare enum ApprovalType {
4
4
  LP = 0,
5
5
  DEPOSIT = 1,
@@ -19,8 +19,7 @@ export type GetBalanceByTokenAddressParams = {
19
19
  signer: Signer | JsonRpcSigner;
20
20
  tokenAddress: TokenEntity['address'];
21
21
  };
22
- export type GetBalanceByChainIdParams = {
22
+ export type GetUsdcBalanceParams = {
23
23
  signer: Signer | JsonRpcSigner;
24
- chainId: ReyaChainId | MoneyInOutChainId;
25
24
  };
26
25
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["services/token/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC/C,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9E,oBAAY,YAAY;IACtB,EAAE,IAAA;IACF,OAAO,IAAA;IACP,MAAM,IAAA;CACP;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,MAAM,GAAG,aAAa,CAAC;IAC/B,YAAY,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;IACrC,IAAI,EAAE,YAAY,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,MAAM,GAAG,aAAa,CAAC;IAC/B,YAAY,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;IACrC,IAAI,EAAE,YAAY,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG;IAC3C,MAAM,EAAE,MAAM,GAAG,aAAa,CAAC;IAC/B,YAAY,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,MAAM,EAAE,MAAM,GAAG,aAAa,CAAC;IAC/B,OAAO,EAAE,WAAW,GAAG,iBAAiB,CAAC;CAC1C,CAAC"}
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"/","sources":["services/token/types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAE9C,oBAAY,YAAY;IACtB,EAAE,IAAA;IACF,OAAO,IAAA;IACP,MAAM,IAAA;CACP;AAED,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,MAAM,GAAG,aAAa,CAAC;IAC/B,YAAY,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;IACrC,IAAI,EAAE,YAAY,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,MAAM,EAAE,MAAM,GAAG,aAAa,CAAC;IAC/B,YAAY,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;IACrC,IAAI,EAAE,YAAY,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,8BAA8B,GAAG;IAC3C,MAAM,EAAE,MAAM,GAAG,aAAa,CAAC;IAC/B,YAAY,EAAE,WAAW,CAAC,SAAS,CAAC,CAAC;CACtC,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,MAAM,EAAE,MAAM,GAAG,aAAa,CAAC;CAChC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@reyaxyz/sdk",
3
- "version": "0.35.0",
3
+ "version": "0.36.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": "3710b22ddcc4be855f8f9523c970bcd2bdfa1892"
37
+ "gitHead": "022a33f5002b6c0f187b0610e351686149f3c255"
38
38
  }
@@ -0,0 +1,15 @@
1
+ import { GetUsdcBalanceParams } from './types';
2
+ import { getBalanceByTokenAddress } from './getBalanceByTokenAddress';
3
+ import { MoneyInOutChainId, getTokenInfoByName } from '@reyaxyz/common';
4
+
5
+ export const getUsdcBalance = async ({
6
+ signer,
7
+ }: GetUsdcBalanceParams): Promise<number> => {
8
+ const network = await signer.provider?.getNetwork();
9
+ const moneyInOutChainId: MoneyInOutChainId = Number(network?.chainId);
10
+
11
+ return getBalanceByTokenAddress({
12
+ signer,
13
+ tokenAddress: getTokenInfoByName('USDC', moneyInOutChainId).address,
14
+ });
15
+ };
@@ -2,4 +2,4 @@ export * from './types';
2
2
  export * from './approve';
3
3
  export * from './getAllowance';
4
4
  export * from './getBalanceByTokenAddress';
5
- export * from './getBalanceByChainId';
5
+ export * from './getUsdcBalance';
@@ -1,5 +1,5 @@
1
1
  import { JsonRpcSigner, Signer } from 'ethers';
2
- import { MoneyInOutChainId, ReyaChainId, TokenEntity } from '@reyaxyz/common';
2
+ import { TokenEntity } from '@reyaxyz/common';
3
3
 
4
4
  export enum ApprovalType {
5
5
  LP,
@@ -24,7 +24,6 @@ export type GetBalanceByTokenAddressParams = {
24
24
  tokenAddress: TokenEntity['address'];
25
25
  };
26
26
 
27
- export type GetBalanceByChainIdParams = {
27
+ export type GetUsdcBalanceParams = {
28
28
  signer: Signer | JsonRpcSigner;
29
- chainId: ReyaChainId | MoneyInOutChainId;
30
29
  };
@@ -1 +0,0 @@
1
- {"version":3,"file":"getBalanceByChainId.js","sourceRoot":"/","sources":["services/token/getBalanceByChainId.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,uEAAsE;AACtE,0CAAqD;AAErD,yCAAyC;AACzC,mDAAmD;AAC5C,IAAM,mBAAmB,GAAG,UAAO,EAGd;QAF1B,MAAM,YAAA,EACN,OAAO,aAAA;;;YAEP,sBAAO,IAAA,mDAAwB,EAAC;oBAC9B,MAAM,QAAA;oBACN,YAAY,EAAE,IAAA,2BAAkB,EAAC,MAAM,EAAE,OAAO,CAAC,CAAC,OAAO;iBAC1D,CAAC,EAAC;;;CACJ,CAAC;AARW,QAAA,mBAAmB,uBAQ9B","sourcesContent":["import { GetBalanceByChainIdParams } from './types';\nimport { getBalanceByTokenAddress } from './getBalanceByTokenAddress';\nimport { getTokenInfoByName } from '@reyaxyz/common';\n\n// TODO: Milan hardcoded address atm fix!\n// todo: this mus be removed!! here to not break UI\nexport const getBalanceByChainId = async ({\n signer,\n chainId,\n}: GetBalanceByChainIdParams): Promise<number> => {\n return getBalanceByTokenAddress({\n signer,\n tokenAddress: getTokenInfoByName('USDC', chainId).address,\n });\n};\n"]}
@@ -1,3 +0,0 @@
1
- import { GetBalanceByChainIdParams } from './types';
2
- export declare const getBalanceByChainId: ({ signer, chainId, }: GetBalanceByChainIdParams) => Promise<number>;
3
- //# sourceMappingURL=getBalanceByChainId.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"getBalanceByChainId.d.ts","sourceRoot":"/","sources":["services/token/getBalanceByChainId.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,yBAAyB,EAAE,MAAM,SAAS,CAAC;AAMpD,eAAO,MAAM,mBAAmB,yBAG7B,yBAAyB,KAAG,QAAQ,MAAM,CAK5C,CAAC"}
@@ -1,15 +0,0 @@
1
- import { GetBalanceByChainIdParams } from './types';
2
- import { getBalanceByTokenAddress } from './getBalanceByTokenAddress';
3
- import { getTokenInfoByName } from '@reyaxyz/common';
4
-
5
- // TODO: Milan hardcoded address atm fix!
6
- // todo: this mus be removed!! here to not break UI
7
- export const getBalanceByChainId = async ({
8
- signer,
9
- chainId,
10
- }: GetBalanceByChainIdParams): Promise<number> => {
11
- return getBalanceByTokenAddress({
12
- signer,
13
- tokenAddress: getTokenInfoByName('USDC', chainId).address,
14
- });
15
- };