@reyaxyz/sdk 0.34.4 → 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.
- package/dist/abis/socket/VaultWithPayload.json +31 -1
- package/dist/index.js +0 -1
- package/dist/index.js.map +1 -1
- package/dist/services/lp/bridgeAndDepositPassivePool.js +14 -15
- package/dist/services/lp/bridgeAndDepositPassivePool.js.map +1 -1
- package/dist/services/lp/encode.js +4 -6
- package/dist/services/lp/encode.js.map +1 -1
- package/dist/services/lp/simulateWithdrawPassivePoolAndBridge.js +1 -1
- package/dist/services/lp/simulateWithdrawPassivePoolAndBridge.js.map +1 -1
- package/dist/services/lp/transferFromMAToPool.js +11 -7
- package/dist/services/lp/transferFromMAToPool.js.map +1 -1
- package/dist/services/lp/types.js.map +1 -1
- package/dist/services/lp/withdrawPassivePoolAndBridge.js +6 -9
- package/dist/services/lp/withdrawPassivePoolAndBridge.js.map +1 -1
- package/dist/services/margin-accounts/bridgeAndDepositExistingMA.js +27 -20
- package/dist/services/margin-accounts/bridgeAndDepositExistingMA.js.map +1 -1
- package/dist/services/margin-accounts/bridgeAndDepositNewMA.js +14 -15
- package/dist/services/margin-accounts/bridgeAndDepositNewMA.js.map +1 -1
- package/dist/services/margin-accounts/deposit.js +3 -3
- package/dist/services/margin-accounts/deposit.js.map +1 -1
- package/dist/services/margin-accounts/encode.js +20 -12
- package/dist/services/margin-accounts/encode.js.map +1 -1
- package/dist/services/margin-accounts/transferMarginBetweenAccounts.js +3 -3
- package/dist/services/margin-accounts/transferMarginBetweenAccounts.js.map +1 -1
- package/dist/services/margin-accounts/types.js.map +1 -1
- package/dist/services/margin-accounts/withdraw.js +3 -3
- package/dist/services/margin-accounts/withdraw.js.map +1 -1
- package/dist/services/margin-accounts/withdrawMAAndBridge.js +20 -17
- package/dist/services/margin-accounts/withdrawMAAndBridge.js.map +1 -1
- package/dist/services/sign.js +26 -9
- package/dist/services/sign.js.map +1 -1
- package/dist/services/token/approve.js +18 -4
- package/dist/services/token/approve.js.map +1 -1
- package/dist/services/token/getAllowance.js +18 -4
- package/dist/services/token/getAllowance.js.map +1 -1
- package/dist/services/token/{getBalanceByChainId.js → getUsdcBalance.js} +18 -21
- package/dist/services/token/getUsdcBalance.js.map +1 -0
- package/dist/services/token/index.js +1 -1
- package/dist/services/token/index.js.map +1 -1
- package/dist/services/token/types.js +1 -0
- package/dist/services/token/types.js.map +1 -1
- package/dist/types/index.d.ts +0 -1
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/services/lp/bridgeAndDepositPassivePool.d.ts.map +1 -1
- package/dist/types/services/lp/encode.d.ts +2 -2
- package/dist/types/services/lp/encode.d.ts.map +1 -1
- package/dist/types/services/lp/transferFromMAToPool.d.ts.map +1 -1
- package/dist/types/services/lp/types.d.ts +1 -1
- package/dist/types/services/lp/types.d.ts.map +1 -1
- package/dist/types/services/lp/withdrawPassivePoolAndBridge.d.ts.map +1 -1
- package/dist/types/services/margin-accounts/bridgeAndDepositExistingMA.d.ts +2 -2
- package/dist/types/services/margin-accounts/bridgeAndDepositExistingMA.d.ts.map +1 -1
- package/dist/types/services/margin-accounts/bridgeAndDepositNewMA.d.ts.map +1 -1
- package/dist/types/services/margin-accounts/encode.d.ts +3 -3
- package/dist/types/services/margin-accounts/encode.d.ts.map +1 -1
- package/dist/types/services/margin-accounts/types.d.ts +2 -2
- package/dist/types/services/margin-accounts/types.d.ts.map +1 -1
- package/dist/types/services/margin-accounts/withdrawMAAndBridge.d.ts +1 -1
- package/dist/types/services/margin-accounts/withdrawMAAndBridge.d.ts.map +1 -1
- package/dist/types/services/sign.d.ts +4 -2
- package/dist/types/services/sign.d.ts.map +1 -1
- package/dist/types/services/token/approve.d.ts.map +1 -1
- package/dist/types/services/token/getAllowance.d.ts.map +1 -1
- package/dist/types/services/token/getUsdcBalance.d.ts +3 -0
- package/dist/types/services/token/getUsdcBalance.d.ts.map +1 -0
- package/dist/types/services/token/index.d.ts +1 -1
- package/dist/types/services/token/index.d.ts.map +1 -1
- package/dist/types/services/token/types.d.ts +3 -4
- package/dist/types/services/token/types.d.ts.map +1 -1
- package/dist/types/utils/contractAddresses.d.ts +1 -1
- package/dist/types/utils/contractAddresses.d.ts.map +1 -1
- package/dist/utils/contractAddresses.js +3 -3
- package/dist/utils/contractAddresses.js.map +1 -1
- package/package.json +3 -3
- package/src/abis/socket/VaultWithPayload.json +31 -1
- package/src/index.ts +0 -1
- package/src/services/lp/bridgeAndDepositPassivePool.ts +6 -8
- package/src/services/lp/encode.ts +2 -7
- package/src/services/lp/simulateWithdrawPassivePoolAndBridge.ts +2 -2
- package/src/services/lp/transferFromMAToPool.ts +17 -10
- package/src/services/lp/types.ts +1 -1
- package/src/services/lp/withdrawPassivePoolAndBridge.ts +6 -11
- package/src/services/margin-accounts/bridgeAndDepositExistingMA.ts +45 -16
- package/src/services/margin-accounts/bridgeAndDepositNewMA.ts +16 -8
- package/src/services/margin-accounts/deposit.ts +3 -3
- package/src/services/margin-accounts/encode.ts +25 -16
- package/src/services/margin-accounts/transferMarginBetweenAccounts.ts +3 -3
- package/src/services/margin-accounts/types.ts +2 -2
- package/src/services/margin-accounts/withdraw.ts +3 -3
- package/src/services/margin-accounts/withdrawMAAndBridge.ts +25 -15
- package/src/services/sign.ts +33 -20
- package/src/services/token/approve.ts +29 -6
- package/src/services/token/getAllowance.ts +29 -5
- package/src/services/token/getUsdcBalance.ts +15 -0
- package/src/services/token/index.ts +1 -1
- package/src/services/token/types.ts +2 -3
- package/src/utils/contractAddresses.ts +5 -4
- package/dist/services/token/getBalanceByChainId.js.map +0 -1
- package/dist/types/services/token/getBalanceByChainId.d.ts +0 -3
- package/dist/types/services/token/getBalanceByChainId.d.ts.map +0 -1
- package/dist/types/utils/network.d.ts +0 -4
- package/dist/types/utils/network.d.ts.map +0 -1
- package/dist/utils/network.js +0 -25
- package/dist/utils/network.js.map +0 -1
- package/src/services/token/getBalanceByChainId.ts +0 -30
- package/src/utils/network.ts +0 -23
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { ApprovalType, GetAllowanceParams } from './types';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
GetSocketVaultParams,
|
|
4
|
+
getERC20Allowance,
|
|
5
|
+
getSocketVault,
|
|
6
|
+
getTokenInfoByAddress,
|
|
7
|
+
} from '@reyaxyz/common';
|
|
3
8
|
import { ContractType, getAddress } from '../../utils/contractAddresses';
|
|
4
9
|
|
|
5
10
|
export const getAllowance = async (
|
|
@@ -10,10 +15,29 @@ export const getAllowance = async (
|
|
|
10
15
|
const network = await params.signer.provider?.getNetwork();
|
|
11
16
|
const chainId = Number(network?.chainId);
|
|
12
17
|
|
|
13
|
-
const
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
18
|
+
const tokenInfo = getTokenInfoByAddress(underLyingTokenAddress);
|
|
19
|
+
|
|
20
|
+
let contractProxyAddress;
|
|
21
|
+
switch (params.type) {
|
|
22
|
+
case ApprovalType.DEPOSIT:
|
|
23
|
+
contractProxyAddress = getAddress(chainId, ContractType.CORE_PROXY);
|
|
24
|
+
break;
|
|
25
|
+
case ApprovalType.LP:
|
|
26
|
+
contractProxyAddress = getAddress(
|
|
27
|
+
chainId,
|
|
28
|
+
ContractType.PASSIVE_POOL_PROXY,
|
|
29
|
+
);
|
|
30
|
+
break;
|
|
31
|
+
case ApprovalType.BRIDGE:
|
|
32
|
+
contractProxyAddress = getSocketVault({
|
|
33
|
+
moneyInOutChainId: chainId,
|
|
34
|
+
tokenName: tokenInfo.name,
|
|
35
|
+
} as GetSocketVaultParams);
|
|
36
|
+
break;
|
|
37
|
+
default:
|
|
38
|
+
throw new Error('Unexpected approval type in getAllowance');
|
|
39
|
+
}
|
|
40
|
+
|
|
17
41
|
const walletAddress: string = await params.signer.getAddress();
|
|
18
42
|
|
|
19
43
|
const allowance = await getERC20Allowance({
|
|
@@ -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
|
+
};
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { JsonRpcSigner, Signer } from 'ethers';
|
|
2
2
|
import { TokenEntity } from '@reyaxyz/common';
|
|
3
|
-
import { MoneyInOutChainId, ReyaChainId } from '@reyaxyz/common';
|
|
4
3
|
|
|
5
4
|
export enum ApprovalType {
|
|
6
5
|
LP,
|
|
7
6
|
DEPOSIT,
|
|
7
|
+
BRIDGE,
|
|
8
8
|
}
|
|
9
9
|
|
|
10
10
|
export type ApproveTokenParams = {
|
|
@@ -24,7 +24,6 @@ export type GetBalanceByTokenAddressParams = {
|
|
|
24
24
|
tokenAddress: TokenEntity['address'];
|
|
25
25
|
};
|
|
26
26
|
|
|
27
|
-
export type
|
|
27
|
+
export type GetUsdcBalanceParams = {
|
|
28
28
|
signer: Signer | JsonRpcSigner;
|
|
29
|
-
chainId: ReyaChainId | MoneyInOutChainId;
|
|
30
29
|
};
|
|
@@ -13,7 +13,8 @@ const addresses: Record<ReyaChainId, Record<ContractType, Address>> = {
|
|
|
13
13
|
[ContractType.CORE_PROXY]: '0xaf68ce211989a9b05a8d6212c8f432785296a847',
|
|
14
14
|
[ContractType.PASSIVE_POOL_PROXY]:
|
|
15
15
|
'0x79d6f095ba4b74a3d2b4522e7080ed76d8aeb940',
|
|
16
|
-
[ContractType.PERIPHERY_PROXY]:
|
|
16
|
+
[ContractType.PERIPHERY_PROXY]:
|
|
17
|
+
'0x8a0500b4290aba646a3d46027b621e5167a56b8d',
|
|
17
18
|
},
|
|
18
19
|
// TODO: add proper config
|
|
19
20
|
[ReyaChainId.reyaNetwork]: {
|
|
@@ -26,16 +27,16 @@ const addresses: Record<ReyaChainId, Record<ContractType, Address>> = {
|
|
|
26
27
|
export const getAddress = (
|
|
27
28
|
chainId: number,
|
|
28
29
|
contractName: ContractType,
|
|
29
|
-
):
|
|
30
|
+
): Address => {
|
|
30
31
|
const keyChainId = chainId.toString();
|
|
31
32
|
|
|
32
33
|
if (!Object.keys(addresses).includes(keyChainId)) {
|
|
33
|
-
|
|
34
|
+
throw new Error(`Unspecified addresses for chain id ${keyChainId}`);
|
|
34
35
|
}
|
|
35
36
|
|
|
36
37
|
const networkAddresses = addresses[chainId as ReyaChainId];
|
|
37
38
|
if (!Object.keys(networkAddresses).includes(contractName)) {
|
|
38
|
-
|
|
39
|
+
throw new Error(`Unspecified address for ${contractName} contract`);
|
|
39
40
|
}
|
|
40
41
|
|
|
41
42
|
return networkAddresses[contractName];
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getBalanceByChainId.js","sourceRoot":"/","sources":["services/token/getBalanceByChainId.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,uEAAsE;AACtE,0CAAiE;AAEjE,yCAAyC;AACzC,IAAM,eAAe;IAInB,GAAC,oBAAW,CAAC,UAAU,IAAG,4CAA4C;IACtE,GAAC,oBAAW,CAAC,WAAW,IAAG,4CAA4C;IACvE,GAAC,0BAAiB,CAAC,aAAa,IAC9B,4CAA4C;IAC9C,GAAC,0BAAiB,CAAC,eAAe,IAChC,4CAA4C;IAC9C,GAAC,0BAAiB,CAAC,SAAS,IAAG,4CAA4C;IAC3E,GAAC,0BAAiB,CAAC,eAAe,IAChC,4CAA4C;OAC/C,CAAC;AAEF,yCAAyC;AAClC,IAAM,mBAAmB,GAAG,UAAO,EAGd;QAF1B,MAAM,YAAA,EACN,OAAO,aAAA;;;YAEP,sBAAO,IAAA,mDAAwB,EAAC;oBAC9B,MAAM,QAAA;oBACN,YAAY,EAAE,eAAe,CAAC,OAAO,CAAC;iBACvC,CAAC,EAAC;;;CACJ,CAAC;AARW,QAAA,mBAAmB,uBAQ9B","sourcesContent":["import { GetBalanceByChainIdParams } from './types';\nimport { getBalanceByTokenAddress } from './getBalanceByTokenAddress';\nimport { MoneyInOutChainId, ReyaChainId } from '@reyaxyz/common';\n\n// TODO: Milan hardcoded address atm fix!\nconst chainToTokenMap: Record<\n ReyaChainId | MoneyInOutChainId,\n Lowercase<string>\n> = {\n [ReyaChainId.reyaCronos]: '0x1b700a40a0707dd5f0bc31cbc57d730558e5714d',\n [ReyaChainId.reyaNetwork]: '0x51b0b7f083e563d5cf9d0b5f3916b59fc49c7e5f',\n [MoneyInOutChainId.polygonMumbai]:\n '0xd9edcc943ed9729b08e52bb1e110fe43d1930773',\n [MoneyInOutChainId.arbitrumSepolia]:\n '0x8537307810fc40f4073a12a38554d4ff78efff41',\n [MoneyInOutChainId.opSepolia]: '0x6d290609b3f5f02d52f28d97c75a443ed8564cbf',\n [MoneyInOutChainId.ethereumSepolia]:\n '0x565810cbfa3cf1390963e5afa2fb953795686339',\n};\n\n// TODO: Milan hardcoded address atm fix!\nexport const getBalanceByChainId = async ({\n signer,\n chainId,\n}: GetBalanceByChainIdParams): Promise<number> => {\n return getBalanceByTokenAddress({\n signer,\n tokenAddress: chainToTokenMap[chainId],\n });\n};\n"]}
|
|
@@ -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;AAqBpD,eAAO,MAAM,mBAAmB,yBAG7B,yBAAyB,KAAG,QAAQ,MAAM,CAK5C,CAAC"}
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
import { MoneyInOutChainId, ReyaChainId } from '@reyaxyz/common';
|
|
2
|
-
export declare function getReyaNetwork(env: 'production' | 'test'): ReyaChainId;
|
|
3
|
-
export declare function getReyaNetworkFromMoneyInOutChainId(moneyInOutChainId: MoneyInOutChainId): ReyaChainId;
|
|
4
|
-
//# sourceMappingURL=network.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"network.d.ts","sourceRoot":"/","sources":["utils/network.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAEjE,wBAAgB,cAAc,CAAC,GAAG,EAAE,YAAY,GAAG,MAAM,GAAG,WAAW,CAKtE;AAED,wBAAgB,mCAAmC,CACjD,iBAAiB,EAAE,iBAAiB,GACnC,WAAW,CAWb"}
|
package/dist/utils/network.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getReyaNetworkFromMoneyInOutChainId = exports.getReyaNetwork = void 0;
|
|
4
|
-
var common_1 = require("@reyaxyz/common");
|
|
5
|
-
function getReyaNetwork(env) {
|
|
6
|
-
if (env === 'production')
|
|
7
|
-
return common_1.ReyaChainId.reyaNetwork;
|
|
8
|
-
if (env === 'test')
|
|
9
|
-
return common_1.ReyaChainId.reyaCronos;
|
|
10
|
-
throw new Error('Unknown error passed');
|
|
11
|
-
}
|
|
12
|
-
exports.getReyaNetwork = getReyaNetwork;
|
|
13
|
-
function getReyaNetworkFromMoneyInOutChainId(moneyInOutChainId) {
|
|
14
|
-
switch (moneyInOutChainId) {
|
|
15
|
-
case common_1.MoneyInOutChainId.polygonMumbai:
|
|
16
|
-
case common_1.MoneyInOutChainId.arbitrumSepolia:
|
|
17
|
-
case common_1.MoneyInOutChainId.opSepolia:
|
|
18
|
-
case common_1.MoneyInOutChainId.ethereumSepolia:
|
|
19
|
-
return getReyaNetwork('test');
|
|
20
|
-
default:
|
|
21
|
-
throw new Error('getReyaNetwork: unexpected moneyInOutChainId');
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
exports.getReyaNetworkFromMoneyInOutChainId = getReyaNetworkFromMoneyInOutChainId;
|
|
25
|
-
//# sourceMappingURL=network.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"network.js","sourceRoot":"/","sources":["utils/network.ts"],"names":[],"mappings":";;;AAAA,0CAAiE;AAEjE,SAAgB,cAAc,CAAC,GAA0B;IACvD,IAAI,GAAG,KAAK,YAAY;QAAE,OAAO,oBAAW,CAAC,WAAW,CAAC;IACzD,IAAI,GAAG,KAAK,MAAM;QAAE,OAAO,oBAAW,CAAC,UAAU,CAAC;IAElD,MAAM,IAAI,KAAK,CAAC,sBAAsB,CAAC,CAAC;AAC1C,CAAC;AALD,wCAKC;AAED,SAAgB,mCAAmC,CACjD,iBAAoC;IAEpC,QAAQ,iBAAiB,EAAE,CAAC;QAC1B,KAAK,0BAAiB,CAAC,aAAa,CAAC;QACrC,KAAK,0BAAiB,CAAC,eAAe,CAAC;QACvC,KAAK,0BAAiB,CAAC,SAAS,CAAC;QACjC,KAAK,0BAAiB,CAAC,eAAe;YACpC,OAAO,cAAc,CAAC,MAAM,CAAC,CAAC;QAEhC;YACE,MAAM,IAAI,KAAK,CAAC,8CAA8C,CAAC,CAAC;IACpE,CAAC;AACH,CAAC;AAbD,kFAaC","sourcesContent":["import { MoneyInOutChainId, ReyaChainId } from '@reyaxyz/common';\n\nexport function getReyaNetwork(env: 'production' | 'test'): ReyaChainId {\n if (env === 'production') return ReyaChainId.reyaNetwork;\n if (env === 'test') return ReyaChainId.reyaCronos;\n\n throw new Error('Unknown error passed');\n}\n\nexport function getReyaNetworkFromMoneyInOutChainId(\n moneyInOutChainId: MoneyInOutChainId,\n): ReyaChainId {\n switch (moneyInOutChainId) {\n case MoneyInOutChainId.polygonMumbai:\n case MoneyInOutChainId.arbitrumSepolia:\n case MoneyInOutChainId.opSepolia:\n case MoneyInOutChainId.ethereumSepolia:\n return getReyaNetwork('test');\n\n default:\n throw new Error('getReyaNetwork: unexpected moneyInOutChainId');\n }\n}\n"]}
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import { GetBalanceByChainIdParams } from './types';
|
|
2
|
-
import { getBalanceByTokenAddress } from './getBalanceByTokenAddress';
|
|
3
|
-
import { MoneyInOutChainId, ReyaChainId } from '@reyaxyz/common';
|
|
4
|
-
|
|
5
|
-
// TODO: Milan hardcoded address atm fix!
|
|
6
|
-
const chainToTokenMap: Record<
|
|
7
|
-
ReyaChainId | MoneyInOutChainId,
|
|
8
|
-
Lowercase<string>
|
|
9
|
-
> = {
|
|
10
|
-
[ReyaChainId.reyaCronos]: '0x1b700a40a0707dd5f0bc31cbc57d730558e5714d',
|
|
11
|
-
[ReyaChainId.reyaNetwork]: '0x51b0b7f083e563d5cf9d0b5f3916b59fc49c7e5f',
|
|
12
|
-
[MoneyInOutChainId.polygonMumbai]:
|
|
13
|
-
'0xd9edcc943ed9729b08e52bb1e110fe43d1930773',
|
|
14
|
-
[MoneyInOutChainId.arbitrumSepolia]:
|
|
15
|
-
'0x8537307810fc40f4073a12a38554d4ff78efff41',
|
|
16
|
-
[MoneyInOutChainId.opSepolia]: '0x6d290609b3f5f02d52f28d97c75a443ed8564cbf',
|
|
17
|
-
[MoneyInOutChainId.ethereumSepolia]:
|
|
18
|
-
'0x565810cbfa3cf1390963e5afa2fb953795686339',
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
// TODO: Milan hardcoded address atm fix!
|
|
22
|
-
export const getBalanceByChainId = async ({
|
|
23
|
-
signer,
|
|
24
|
-
chainId,
|
|
25
|
-
}: GetBalanceByChainIdParams): Promise<number> => {
|
|
26
|
-
return getBalanceByTokenAddress({
|
|
27
|
-
signer,
|
|
28
|
-
tokenAddress: chainToTokenMap[chainId],
|
|
29
|
-
});
|
|
30
|
-
};
|
package/src/utils/network.ts
DELETED
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { MoneyInOutChainId, ReyaChainId } from '@reyaxyz/common';
|
|
2
|
-
|
|
3
|
-
export function getReyaNetwork(env: 'production' | 'test'): ReyaChainId {
|
|
4
|
-
if (env === 'production') return ReyaChainId.reyaNetwork;
|
|
5
|
-
if (env === 'test') return ReyaChainId.reyaCronos;
|
|
6
|
-
|
|
7
|
-
throw new Error('Unknown error passed');
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
export function getReyaNetworkFromMoneyInOutChainId(
|
|
11
|
-
moneyInOutChainId: MoneyInOutChainId,
|
|
12
|
-
): ReyaChainId {
|
|
13
|
-
switch (moneyInOutChainId) {
|
|
14
|
-
case MoneyInOutChainId.polygonMumbai:
|
|
15
|
-
case MoneyInOutChainId.arbitrumSepolia:
|
|
16
|
-
case MoneyInOutChainId.opSepolia:
|
|
17
|
-
case MoneyInOutChainId.ethereumSepolia:
|
|
18
|
-
return getReyaNetwork('test');
|
|
19
|
-
|
|
20
|
-
default:
|
|
21
|
-
throw new Error('getReyaNetwork: unexpected moneyInOutChainId');
|
|
22
|
-
}
|
|
23
|
-
}
|