@reyaxyz/common 0.314.0 → 0.315.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/README.md
CHANGED
|
@@ -6,5 +6,5 @@
|
|
|
6
6
|
|
|
7
7
|
| Statements | Branches | Functions | Lines |
|
|
8
8
|
| --------------------------- | ----------------------- | ------------------------- | ----------------- |
|
|
9
|
-
|  |  |  |  |
|
|
10
10
|
|
|
@@ -5,6 +5,7 @@ export declare const chainIdToExplorerURL: {
|
|
|
5
5
|
[key in MoneyInOutChainId | ReyaChainId]: string;
|
|
6
6
|
};
|
|
7
7
|
export declare const getAlchemyRpcUrl: (apiKey: string, chainId: MoneyInOutChainId) => string | null;
|
|
8
|
+
export declare const getInfuraRpcUrl: (apiKey: string, chainId: MoneyInOutChainId) => string | null;
|
|
8
9
|
export declare const getPublicRpcUrls: (chainId: MoneyInOutChainId | ReyaChainId) => string[];
|
|
9
10
|
export declare const getPublicRpcUrlsOrThrow: (chainId: MoneyInOutChainId | ReyaChainId) => string[];
|
|
10
11
|
//# sourceMappingURL=network.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"network.d.ts","sourceRoot":"/","sources":["utils/network.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE1D,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,WAAW,GACnB,iBAAiB,EAAE,CAkBrB;AAED,wBAAgB,mCAAmC,CACjD,iBAAiB,EAAE,iBAAiB,GACnC,WAAW,CAcb;AAED,eAAO,MAAM,oBAAoB,EAAE;KAChC,GAAG,IAAI,iBAAiB,GAAG,WAAW,GAAG,MAAM;CAYjD,CAAC;
|
|
1
|
+
{"version":3,"file":"network.d.ts","sourceRoot":"/","sources":["utils/network.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,iBAAiB,EAAE,WAAW,EAAE,MAAM,UAAU,CAAC;AAE1D,wBAAgB,qBAAqB,CACnC,OAAO,EAAE,WAAW,GACnB,iBAAiB,EAAE,CAkBrB;AAED,wBAAgB,mCAAmC,CACjD,iBAAiB,EAAE,iBAAiB,GACnC,WAAW,CAcb;AAED,eAAO,MAAM,oBAAoB,EAAE;KAChC,GAAG,IAAI,iBAAiB,GAAG,WAAW,GAAG,MAAM;CAYjD,CAAC;AA8FF,eAAO,MAAM,gBAAgB,WACnB,MAAM,WACL,iBAAiB,KACzB,MAAM,GAAG,IAQX,CAAC;AAEF,eAAO,MAAM,eAAe,WAClB,MAAM,WACL,iBAAiB,KACzB,MAAM,GAAG,IAQX,CAAC;AAEF,eAAO,MAAM,gBAAgB,YAClB,iBAAiB,GAAG,WAAW,KACvC,MAAM,EAQR,CAAC;AAEF,eAAO,MAAM,uBAAuB,YACzB,iBAAiB,GAAG,WAAW,KACvC,MAAM,EAQR,CAAC"}
|
package/dist/utils/network.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var _a, _b, _c;
|
|
2
|
+
var _a, _b, _c, _d;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.getPublicRpcUrlsOrThrow = exports.getPublicRpcUrls = exports.getAlchemyRpcUrl = exports.chainIdToExplorerURL = exports.getReyaNetworkFromMoneyInOutChainId = exports.getMoneyInOutNetworks = void 0;
|
|
4
|
+
exports.getPublicRpcUrlsOrThrow = exports.getPublicRpcUrls = exports.getInfuraRpcUrl = exports.getAlchemyRpcUrl = exports.chainIdToExplorerURL = exports.getReyaNetworkFromMoneyInOutChainId = exports.getMoneyInOutNetworks = void 0;
|
|
5
5
|
var types_1 = require("../types");
|
|
6
6
|
function getMoneyInOutNetworks(chainId) {
|
|
7
7
|
if (chainId === types_1.ReyaChainId.reyaNetwork)
|
|
@@ -119,6 +119,18 @@ var ALCHEMY_BASE_RPC_URL = (_c = {},
|
|
|
119
119
|
_c[types_1.MoneyInOutChainId.opSepolia] = 'https://opt-sepolia.g.alchemy.com/v2',
|
|
120
120
|
_c[types_1.MoneyInOutChainId.ethereumSepolia] = 'https://eth-sepolia.g.alchemy.com/v2',
|
|
121
121
|
_c);
|
|
122
|
+
var INFURA_BASE_RPC_URL = (_d = {},
|
|
123
|
+
// mainnet
|
|
124
|
+
_d[types_1.MoneyInOutChainId.ethereumMainnet] = 'https://mainnet.infura.io/v3',
|
|
125
|
+
_d[types_1.MoneyInOutChainId.opMainnet] = 'https://optimism-mainnet.infura.io/v3',
|
|
126
|
+
_d[types_1.MoneyInOutChainId.polygonMainnet] = 'https://polygon-mainnet.infura.io/v3',
|
|
127
|
+
_d[types_1.MoneyInOutChainId.arbitrumOne] = 'https://arbitrum-mainnet.infura.io/v3',
|
|
128
|
+
_d[types_1.MoneyInOutChainId.baseMainnet] = 'https://base-mainnet.infura.io/v3',
|
|
129
|
+
// testnet
|
|
130
|
+
_d[types_1.MoneyInOutChainId.arbitrumSepolia] = 'https://arbitrum-sepolia.infura.io/v3',
|
|
131
|
+
_d[types_1.MoneyInOutChainId.opSepolia] = 'https://optimism-sepolia.infura.io/v3',
|
|
132
|
+
_d[types_1.MoneyInOutChainId.ethereumSepolia] = 'https://sepolia.infura.io/v3',
|
|
133
|
+
_d);
|
|
122
134
|
var getAlchemyRpcUrl = function (apiKey, chainId) {
|
|
123
135
|
var rpcUrl = ALCHEMY_BASE_RPC_URL[chainId];
|
|
124
136
|
if (!rpcUrl) {
|
|
@@ -127,6 +139,14 @@ var getAlchemyRpcUrl = function (apiKey, chainId) {
|
|
|
127
139
|
return "".concat(rpcUrl, "/").concat(apiKey);
|
|
128
140
|
};
|
|
129
141
|
exports.getAlchemyRpcUrl = getAlchemyRpcUrl;
|
|
142
|
+
var getInfuraRpcUrl = function (apiKey, chainId) {
|
|
143
|
+
var rpcUrl = INFURA_BASE_RPC_URL[chainId];
|
|
144
|
+
if (!rpcUrl) {
|
|
145
|
+
return null;
|
|
146
|
+
}
|
|
147
|
+
return "".concat(rpcUrl, "/").concat(apiKey);
|
|
148
|
+
};
|
|
149
|
+
exports.getInfuraRpcUrl = getInfuraRpcUrl;
|
|
130
150
|
var getPublicRpcUrls = function (chainId) {
|
|
131
151
|
var rpcUrls = ChainRpcUrls[chainId];
|
|
132
152
|
if (!rpcUrls) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"network.js","sourceRoot":"/","sources":["utils/network.ts"],"names":[],"mappings":";;;;AAAA,kCAA0D;AAE1D,SAAgB,qBAAqB,CACnC,OAAoB;IAEpB,IAAI,OAAO,KAAK,mBAAW,CAAC,WAAW;QACrC,OAAO;YACL,yBAAiB,CAAC,eAAe;YACjC,yBAAiB,CAAC,SAAS;YAC3B,yBAAiB,CAAC,cAAc;YAChC,yBAAiB,CAAC,WAAW;YAC7B,yBAAiB,CAAC,WAAW;SAC9B,CAAC;IAEJ,IAAI,OAAO,KAAK,mBAAW,CAAC,UAAU;QACpC,OAAO;YACL,yBAAiB,CAAC,eAAe;YACjC,yBAAiB,CAAC,SAAS;YAC3B,yBAAiB,CAAC,eAAe;SAClC,CAAC;IAEJ,MAAM,IAAI,KAAK,CAAC,gCAAyB,OAAO,CAAE,CAAC,CAAC;AACtD,CAAC;AApBD,sDAoBC;AAED,SAAgB,mCAAmC,CACjD,iBAAoC;IAEpC,IACE,qBAAqB,CAAC,mBAAW,CAAC,WAAW,CAAC,CAAC,QAAQ,CAAC,iBAAiB,CAAC,EAC1E,CAAC;QACD,OAAO,mBAAW,CAAC,WAAW,CAAC;IACjC,CAAC;IAED,IACE,qBAAqB,CAAC,mBAAW,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,iBAAiB,CAAC,EACzE,CAAC;QACD,OAAO,mBAAW,CAAC,UAAU,CAAC;IAChC,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,oCAA6B,iBAAiB,CAAE,CAAC,CAAC;AACpE,CAAC;AAhBD,kFAgBC;AAEY,QAAA,oBAAoB;IAG/B,GAAC,yBAAiB,CAA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,CAAC;AAVW,QAAA,gBAAgB,oBAU3B;AAEK,IAAM,uBAAuB,GAAG,UACrC,OAAwC;IAExC,IAAM,OAAO,GAAG,IAAA,wBAAgB,EAAC,OAAO,CAAC,CAAC;IAE1C,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,+CAA+C,GAAG,OAAO,CAAC,CAAC;IAC7E,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAVW,QAAA,uBAAuB,2BAUlC","sourcesContent":["import { MoneyInOutChainId, ReyaChainId } from '../types';\n\nexport function getMoneyInOutNetworks(\n chainId: ReyaChainId,\n): MoneyInOutChainId[] {\n if (chainId === ReyaChainId.reyaNetwork)\n return [\n MoneyInOutChainId.ethereumMainnet,\n MoneyInOutChainId.opMainnet,\n MoneyInOutChainId.polygonMainnet,\n MoneyInOutChainId.arbitrumOne,\n MoneyInOutChainId.baseMainnet,\n ];\n\n if (chainId === ReyaChainId.reyaCronos)\n return [\n MoneyInOutChainId.ethereumSepolia,\n MoneyInOutChainId.opSepolia,\n MoneyInOutChainId.arbitrumSepolia,\n ];\n\n throw new Error(`Unknown Reya chain id ${chainId}`);\n}\n\nexport function getReyaNetworkFromMoneyInOutChainId(\n moneyInOutChainId: MoneyInOutChainId,\n): ReyaChainId {\n if (\n getMoneyInOutNetworks(ReyaChainId.reyaNetwork).includes(moneyInOutChainId)\n ) {\n return ReyaChainId.reyaNetwork;\n }\n\n if (\n getMoneyInOutNetworks(ReyaChainId.reyaCronos).includes(moneyInOutChainId)\n ) {\n return ReyaChainId.reyaCronos;\n }\n\n throw new Error(`Unknown external chain id ${moneyInOutChainId}`);\n}\n\nexport const chainIdToExplorerURL: {\n [key in MoneyInOutChainId | ReyaChainId]: string;\n} = {\n [MoneyInOutChainId.ethereumMainnet]: 'https://etherscan.io',\n [MoneyInOutChainId.opMainnet]: 'https://optimistic.etherscan.io',\n [MoneyInOutChainId.polygonMainnet]: 'https://polygonscan.com',\n [MoneyInOutChainId.arbitrumOne]: 'https://arbiscan.io',\n [MoneyInOutChainId.baseMainnet]: 'https://basescan.org',\n [MoneyInOutChainId.arbitrumSepolia]: 'https://sepolia.arbiscan.io',\n [MoneyInOutChainId.opSepolia]: 'https://sepolia-optimism.etherscan.io',\n [MoneyInOutChainId.ethereumSepolia]: 'https://sepolia.etherscan.io',\n [ReyaChainId.reyaNetwork]: 'https://explorer.reya.network',\n [ReyaChainId.reyaCronos]: 'https://reya-cronos.blockscout.com',\n};\n\nconst ChainRpcUrls: Record<MoneyInOutChainId | ReyaChainId, string[]> = {\n [ReyaChainId.reyaNetwork]: [\n 'https://rpc.reya.network/263e76b89da84d478fd2b6e8783a1cfe',\n ],\n [MoneyInOutChainId.ethereumMainnet]: [\n 'https://mainnet.gateway.tenderly.co',\n 'https://eth.llamarpc.com',\n 'https://eth-mainnet.g.alchemy.com/v2/Tkk3-2tTcsCLnFa4dSSUkpZsDyOH55Ar',\n 'https://eth-mainnet.g.alchemy.com/v2/Bin_D_qtJLCqvFyzt-0SxZRWTL423_tg',\n 'https://eth-mainnet.g.alchemy.com/v2/A21_W1GwGu775PCAoQbj_pJgBPzIgAzv',\n 'https://mainnet.gateway.tenderly.co/69U6LoF0URUv5CfuIU7FdL',\n ],\n [MoneyInOutChainId.opMainnet]: [\n 'https://mainnet.optimism.io',\n 'https://optimism.llamarpc.com',\n 'https://opt-mainnet.g.alchemy.com/v2/Tkk3-2tTcsCLnFa4dSSUkpZsDyOH55Ar',\n 'https://opt-mainnet.g.alchemy.com/v2/Bin_D_qtJLCqvFyzt-0SxZRWTL423_tg',\n 'https://opt-mainnet.g.alchemy.com/v2/A21_W1GwGu775PCAoQbj_pJgBPzIgAzv',\n 'https://optimism.gateway.tenderly.co/69LkAPTI3LODcBAdtz9wQC',\n ],\n [MoneyInOutChainId.polygonMainnet]: [\n 'https://polygon-rpc.com',\n 'https://gateway.tenderly.co/public/polygon',\n 'https://polygon-mainnet.g.alchemy.com/v2/Tkk3-2tTcsCLnFa4dSSUkpZsDyOH55Ar',\n 'https://polygon-mainnet.g.alchemy.com/v2/Bin_D_qtJLCqvFyzt-0SxZRWTL423_tg',\n 'https://polygon-mainnet.g.alchemy.com/v2/A21_W1GwGu775PCAoQbj_pJgBPzIgAzv',\n 'https://polygon.gateway.tenderly.co/7Qw4fTY4kf3v02LjJjWyvZ',\n ],\n [MoneyInOutChainId.arbitrumOne]: [\n 'https://arb1.arbitrum.io/rpc',\n 'https://arbitrum.llamarpc.com',\n 'https://arb-mainnet.g.alchemy.com/v2/Tkk3-2tTcsCLnFa4dSSUkpZsDyOH55Ar',\n 'https://arb-mainnet.g.alchemy.com/v2/Bin_D_qtJLCqvFyzt-0SxZRWTL423_tg',\n 'https://arb-mainnet.g.alchemy.com/v2/A21_W1GwGu775PCAoQbj_pJgBPzIgAzv',\n 'https://arbitrum.gateway.tenderly.co/1wQGK6nNPTbSc7asucAbzA',\n ],\n [MoneyInOutChainId.baseMainnet]: [\n 'https://mainnet.base.org',\n 'https://base.llamarpc.com',\n 'https://base-mainnet.g.alchemy.com/v2/Tkk3-2tTcsCLnFa4dSSUkpZsDyOH55Ar',\n 'https://base-mainnet.g.alchemy.com/v2/Bin_D_qtJLCqvFyzt-0SxZRWTL423_tg',\n 'https://base-mainnet.g.alchemy.com/v2/A21_W1GwGu775PCAoQbj_pJgBPzIgAzv',\n 'https://base.gateway.tenderly.co/2LHAD54IBvgXiVQdhE9mIF',\n ],\n // Add the rest of the mainnet URLs above\n [ReyaChainId.reyaCronos]: [\n 'https://rpc.reya-cronos.gelato.digital/263e76b89da84d478fd2b6e8783a1cfe',\n ],\n [MoneyInOutChainId.arbitrumSepolia]: [\n 'https://sepolia-rollup.arbitrum.io/rpc',\n 'https://endpoints.omniatech.io/v1/arbitrum/sepolia/public',\n 'https://arbitrum-sepolia.gateway.tenderly.co/4YMRN8fKu2SV1JSNsGlbMZ',\n ],\n [MoneyInOutChainId.opSepolia]: [\n 'https://sepolia.optimism.io',\n 'https://optimism-sepolia.blockpi.network/v1/rpc/public',\n 'https://optimism-sepolia.gateway.tenderly.co/2nXBEGPk57CotvTJMjIMK7',\n ],\n [MoneyInOutChainId.ethereumSepolia]: [\n 'https://sepolia.gateway.tenderly.co',\n 'https://ethereum-sepolia.blockpi.network/v1/rpc/public',\n 'https://sepolia.gateway.tenderly.co/1u2yZV1rdVLpgOeHwD1Z8M',\n ],\n};\n\nconst ALCHEMY_BASE_RPC_URL: Record<MoneyInOutChainId, string> = {\n // mainnet\n [MoneyInOutChainId.ethereumMainnet]: 'https://eth-mainnet.g.alchemy.com/v2',\n [MoneyInOutChainId.opMainnet]: 'https://opt-mainnet.g.alchemy.com/v2',\n [MoneyInOutChainId.polygonMainnet]:\n 'https://polygon-mainnet.g.alchemy.com/v2',\n [MoneyInOutChainId.arbitrumOne]: 'https://arb-mainnet.g.alchemy.com/v2',\n [MoneyInOutChainId.baseMainnet]: 'https://base-mainnet.g.alchemy.com/v2',\n // testnet\n [MoneyInOutChainId.arbitrumSepolia]: 'https://arb-sepolia.g.alchemy.com/v2',\n [MoneyInOutChainId.opSepolia]: 'https://opt-sepolia.g.alchemy.com/v2',\n [MoneyInOutChainId.ethereumSepolia]: 'https://eth-sepolia.g.alchemy.com/v2',\n};\n\nexport const getAlchemyRpcUrl = (\n apiKey: string,\n chainId: MoneyInOutChainId,\n): string | null => {\n const rpcUrl = ALCHEMY_BASE_RPC_URL[chainId];\n\n if (!rpcUrl) {\n return null;\n }\n\n return `${rpcUrl}/${apiKey}`;\n};\n\nexport const getPublicRpcUrls = (\n chainId: MoneyInOutChainId | ReyaChainId,\n): string[] => {\n const rpcUrls = ChainRpcUrls[chainId];\n\n if (!rpcUrls) {\n return [];\n }\n\n return rpcUrls;\n};\n\nexport const getPublicRpcUrlsOrThrow = (\n chainId: MoneyInOutChainId | ReyaChainId,\n): string[] => {\n const rpcUrls = getPublicRpcUrls(chainId);\n\n if (rpcUrls.length === 0) {\n throw new Error('No public RPC URLs configured for the chain: ' + chainId);\n }\n\n return rpcUrls;\n};\n"]}
|
|
1
|
+
{"version":3,"file":"network.js","sourceRoot":"/","sources":["utils/network.ts"],"names":[],"mappings":";;;;AAAA,kCAA0D;AAE1D,SAAgB,qBAAqB,CACnC,OAAoB;IAEpB,IAAI,OAAO,KAAK,mBAAW,CAAC,WAAW;QACrC,OAAO;YACL,yBAAiB,CAAC,eAAe;YACjC,yBAAiB,CAAC,SAAS;YAC3B,yBAAiB,CAAC,cAAc;YAChC,yBAAiB,CAAC,WAAW;YAC7B,yBAAiB,CAAC,WAAW;SAC9B,CAAC;IAEJ,IAAI,OAAO,KAAK,mBAAW,CAAC,UAAU;QACpC,OAAO;YACL,yBAAiB,CAAC,eAAe;YACjC,yBAAiB,CAAC,SAAS;YAC3B,yBAAiB,CAAC,eAAe;SAClC,CAAC;IAEJ,MAAM,IAAI,KAAK,CAAC,gCAAyB,OAAO,CAAE,CAAC,CAAC;AACtD,CAAC;AApBD,sDAoBC;AAED,SAAgB,mCAAmC,CACjD,iBAAoC;IAEpC,IACE,qBAAqB,CAAC,mBAAW,CAAC,WAAW,CAAC,CAAC,QAAQ,CAAC,iBAAiB,CAAC,EAC1E,CAAC;QACD,OAAO,mBAAW,CAAC,WAAW,CAAC;IACjC,CAAC;IAED,IACE,qBAAqB,CAAC,mBAAW,CAAC,UAAU,CAAC,CAAC,QAAQ,CAAC,iBAAiB,CAAC,EACzE,CAAC;QACD,OAAO,mBAAW,CAAC,UAAU,CAAC;IAChC,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,oCAA6B,iBAAiB,CAAE,CAAC,CAAC;AACpE,CAAC;AAhBD,kFAgBC;AAEY,QAAA,oBAAoB;IAG/B,GAAC,yBAAiB,CAAC,eAAe,IAAG,sBAAsB;IAC3D,GAAC,yBAAiB,CAAC,SAAS,IAAG,iCAAiC;IAChE,GAAC,yBAAiB,CAAC,cAAc,IAAG,yBAAyB;IAC7D,GAAC,yBAAiB,CAAC,WAAW,I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MAAM,cAAI,MAAM,CAAE,CAAC;AAC/B,CAAC,CAAC;AAXW,QAAA,gBAAgB,oBAW3B;AAEK,IAAM,eAAe,GAAG,UAC7B,MAAc,EACd,OAA0B;IAE1B,IAAM,MAAM,GAAG,mBAAmB,CAAC,OAAO,CAAC,CAAC;IAE5C,IAAI,CAAC,MAAM,EAAE,CAAC;QACZ,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,UAAG,MAAM,cAAI,MAAM,CAAE,CAAC;AAC/B,CAAC,CAAC;AAXW,QAAA,eAAe,mBAW1B;AAEK,IAAM,gBAAgB,GAAG,UAC9B,OAAwC;IAExC,IAAM,OAAO,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC;IAEtC,IAAI,CAAC,OAAO,EAAE,CAAC;QACb,OAAO,EAAE,CAAC;IACZ,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAVW,QAAA,gBAAgB,oBAU3B;AAEK,IAAM,uBAAuB,GAAG,UACrC,OAAwC;IAExC,IAAM,OAAO,GAAG,IAAA,wBAAgB,EAAC,OAAO,CAAC,CAAC;IAE1C,IAAI,OAAO,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACzB,MAAM,IAAI,KAAK,CAAC,+CAA+C,GAAG,OAAO,CAAC,CAAC;IAC7E,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,CAAC,CAAC;AAVW,QAAA,uBAAuB,2BAUlC","sourcesContent":["import { MoneyInOutChainId, ReyaChainId } from '../types';\n\nexport function getMoneyInOutNetworks(\n chainId: ReyaChainId,\n): MoneyInOutChainId[] {\n if (chainId === ReyaChainId.reyaNetwork)\n return [\n MoneyInOutChainId.ethereumMainnet,\n MoneyInOutChainId.opMainnet,\n MoneyInOutChainId.polygonMainnet,\n MoneyInOutChainId.arbitrumOne,\n MoneyInOutChainId.baseMainnet,\n ];\n\n if (chainId === ReyaChainId.reyaCronos)\n return [\n MoneyInOutChainId.ethereumSepolia,\n MoneyInOutChainId.opSepolia,\n MoneyInOutChainId.arbitrumSepolia,\n ];\n\n throw new Error(`Unknown Reya chain id ${chainId}`);\n}\n\nexport function getReyaNetworkFromMoneyInOutChainId(\n moneyInOutChainId: MoneyInOutChainId,\n): ReyaChainId {\n if (\n getMoneyInOutNetworks(ReyaChainId.reyaNetwork).includes(moneyInOutChainId)\n ) {\n return ReyaChainId.reyaNetwork;\n }\n\n if (\n getMoneyInOutNetworks(ReyaChainId.reyaCronos).includes(moneyInOutChainId)\n ) {\n return ReyaChainId.reyaCronos;\n }\n\n throw new Error(`Unknown external chain id ${moneyInOutChainId}`);\n}\n\nexport const chainIdToExplorerURL: {\n [key in MoneyInOutChainId | ReyaChainId]: string;\n} = {\n [MoneyInOutChainId.ethereumMainnet]: 'https://etherscan.io',\n [MoneyInOutChainId.opMainnet]: 'https://optimistic.etherscan.io',\n [MoneyInOutChainId.polygonMainnet]: 'https://polygonscan.com',\n [MoneyInOutChainId.arbitrumOne]: 'https://arbiscan.io',\n [MoneyInOutChainId.baseMainnet]: 'https://basescan.org',\n [MoneyInOutChainId.arbitrumSepolia]: 'https://sepolia.arbiscan.io',\n [MoneyInOutChainId.opSepolia]: 'https://sepolia-optimism.etherscan.io',\n [MoneyInOutChainId.ethereumSepolia]: 'https://sepolia.etherscan.io',\n [ReyaChainId.reyaNetwork]: 'https://explorer.reya.network',\n [ReyaChainId.reyaCronos]: 'https://reya-cronos.blockscout.com',\n};\n\nconst ChainRpcUrls: Record<MoneyInOutChainId | ReyaChainId, string[]> = {\n [ReyaChainId.reyaNetwork]: [\n 'https://rpc.reya.network/263e76b89da84d478fd2b6e8783a1cfe',\n ],\n [MoneyInOutChainId.ethereumMainnet]: [\n 'https://mainnet.gateway.tenderly.co',\n 'https://eth.llamarpc.com',\n 'https://eth-mainnet.g.alchemy.com/v2/Tkk3-2tTcsCLnFa4dSSUkpZsDyOH55Ar',\n 'https://eth-mainnet.g.alchemy.com/v2/Bin_D_qtJLCqvFyzt-0SxZRWTL423_tg',\n 'https://eth-mainnet.g.alchemy.com/v2/A21_W1GwGu775PCAoQbj_pJgBPzIgAzv',\n 'https://mainnet.gateway.tenderly.co/69U6LoF0URUv5CfuIU7FdL',\n ],\n [MoneyInOutChainId.opMainnet]: [\n 'https://mainnet.optimism.io',\n 'https://optimism.llamarpc.com',\n 'https://opt-mainnet.g.alchemy.com/v2/Tkk3-2tTcsCLnFa4dSSUkpZsDyOH55Ar',\n 'https://opt-mainnet.g.alchemy.com/v2/Bin_D_qtJLCqvFyzt-0SxZRWTL423_tg',\n 'https://opt-mainnet.g.alchemy.com/v2/A21_W1GwGu775PCAoQbj_pJgBPzIgAzv',\n 'https://optimism.gateway.tenderly.co/69LkAPTI3LODcBAdtz9wQC',\n ],\n [MoneyInOutChainId.polygonMainnet]: [\n 'https://polygon-rpc.com',\n 'https://gateway.tenderly.co/public/polygon',\n 'https://polygon-mainnet.g.alchemy.com/v2/Tkk3-2tTcsCLnFa4dSSUkpZsDyOH55Ar',\n 'https://polygon-mainnet.g.alchemy.com/v2/Bin_D_qtJLCqvFyzt-0SxZRWTL423_tg',\n 'https://polygon-mainnet.g.alchemy.com/v2/A21_W1GwGu775PCAoQbj_pJgBPzIgAzv',\n 'https://polygon.gateway.tenderly.co/7Qw4fTY4kf3v02LjJjWyvZ',\n ],\n [MoneyInOutChainId.arbitrumOne]: [\n 'https://arb1.arbitrum.io/rpc',\n 'https://arbitrum.llamarpc.com',\n 'https://arb-mainnet.g.alchemy.com/v2/Tkk3-2tTcsCLnFa4dSSUkpZsDyOH55Ar',\n 'https://arb-mainnet.g.alchemy.com/v2/Bin_D_qtJLCqvFyzt-0SxZRWTL423_tg',\n 'https://arb-mainnet.g.alchemy.com/v2/A21_W1GwGu775PCAoQbj_pJgBPzIgAzv',\n 'https://arbitrum.gateway.tenderly.co/1wQGK6nNPTbSc7asucAbzA',\n ],\n [MoneyInOutChainId.baseMainnet]: [\n 'https://mainnet.base.org',\n 'https://base.llamarpc.com',\n 'https://base-mainnet.g.alchemy.com/v2/Tkk3-2tTcsCLnFa4dSSUkpZsDyOH55Ar',\n 'https://base-mainnet.g.alchemy.com/v2/Bin_D_qtJLCqvFyzt-0SxZRWTL423_tg',\n 'https://base-mainnet.g.alchemy.com/v2/A21_W1GwGu775PCAoQbj_pJgBPzIgAzv',\n 'https://base.gateway.tenderly.co/2LHAD54IBvgXiVQdhE9mIF',\n ],\n // Add the rest of the mainnet URLs above\n [ReyaChainId.reyaCronos]: [\n 'https://rpc.reya-cronos.gelato.digital/263e76b89da84d478fd2b6e8783a1cfe',\n ],\n [MoneyInOutChainId.arbitrumSepolia]: [\n 'https://sepolia-rollup.arbitrum.io/rpc',\n 'https://endpoints.omniatech.io/v1/arbitrum/sepolia/public',\n 'https://arbitrum-sepolia.gateway.tenderly.co/4YMRN8fKu2SV1JSNsGlbMZ',\n ],\n [MoneyInOutChainId.opSepolia]: [\n 'https://sepolia.optimism.io',\n 'https://optimism-sepolia.blockpi.network/v1/rpc/public',\n 'https://optimism-sepolia.gateway.tenderly.co/2nXBEGPk57CotvTJMjIMK7',\n ],\n [MoneyInOutChainId.ethereumSepolia]: [\n 'https://sepolia.gateway.tenderly.co',\n 'https://ethereum-sepolia.blockpi.network/v1/rpc/public',\n 'https://sepolia.gateway.tenderly.co/1u2yZV1rdVLpgOeHwD1Z8M',\n ],\n};\n\nconst ALCHEMY_BASE_RPC_URL: Record<MoneyInOutChainId, string> = {\n // mainnet\n [MoneyInOutChainId.ethereumMainnet]: 'https://eth-mainnet.g.alchemy.com/v2',\n [MoneyInOutChainId.opMainnet]: 'https://opt-mainnet.g.alchemy.com/v2',\n [MoneyInOutChainId.polygonMainnet]:\n 'https://polygon-mainnet.g.alchemy.com/v2',\n [MoneyInOutChainId.arbitrumOne]: 'https://arb-mainnet.g.alchemy.com/v2',\n [MoneyInOutChainId.baseMainnet]: 'https://base-mainnet.g.alchemy.com/v2',\n // testnet\n [MoneyInOutChainId.arbitrumSepolia]: 'https://arb-sepolia.g.alchemy.com/v2',\n [MoneyInOutChainId.opSepolia]: 'https://opt-sepolia.g.alchemy.com/v2',\n [MoneyInOutChainId.ethereumSepolia]: 'https://eth-sepolia.g.alchemy.com/v2',\n};\n\nconst INFURA_BASE_RPC_URL: Record<MoneyInOutChainId, string> = {\n // mainnet\n [MoneyInOutChainId.ethereumMainnet]: 'https://mainnet.infura.io/v3',\n [MoneyInOutChainId.opMainnet]: 'https://optimism-mainnet.infura.io/v3',\n [MoneyInOutChainId.polygonMainnet]: 'https://polygon-mainnet.infura.io/v3',\n [MoneyInOutChainId.arbitrumOne]: 'https://arbitrum-mainnet.infura.io/v3',\n [MoneyInOutChainId.baseMainnet]: 'https://base-mainnet.infura.io/v3',\n // testnet\n [MoneyInOutChainId.arbitrumSepolia]: 'https://arbitrum-sepolia.infura.io/v3',\n [MoneyInOutChainId.opSepolia]: 'https://optimism-sepolia.infura.io/v3',\n [MoneyInOutChainId.ethereumSepolia]: 'https://sepolia.infura.io/v3',\n};\n\nexport const getAlchemyRpcUrl = (\n apiKey: string,\n chainId: MoneyInOutChainId,\n): string | null => {\n const rpcUrl = ALCHEMY_BASE_RPC_URL[chainId];\n\n if (!rpcUrl) {\n return null;\n }\n\n return `${rpcUrl}/${apiKey}`;\n};\n\nexport const getInfuraRpcUrl = (\n apiKey: string,\n chainId: MoneyInOutChainId,\n): string | null => {\n const rpcUrl = INFURA_BASE_RPC_URL[chainId];\n\n if (!rpcUrl) {\n return null;\n }\n\n return `${rpcUrl}/${apiKey}`;\n};\n\nexport const getPublicRpcUrls = (\n chainId: MoneyInOutChainId | ReyaChainId,\n): string[] => {\n const rpcUrls = ChainRpcUrls[chainId];\n\n if (!rpcUrls) {\n return [];\n }\n\n return rpcUrls;\n};\n\nexport const getPublicRpcUrlsOrThrow = (\n chainId: MoneyInOutChainId | ReyaChainId,\n): string[] => {\n const rpcUrls = getPublicRpcUrls(chainId);\n\n if (rpcUrls.length === 0) {\n throw new Error('No public RPC URLs configured for the chain: ' + chainId);\n }\n\n return rpcUrls;\n};\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@reyaxyz/common",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.315.0",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public",
|
|
6
6
|
"registry": "https://registry.npmjs.org"
|
|
@@ -44,5 +44,5 @@
|
|
|
44
44
|
"generate:coverage-badges": "npx istanbul-badges-readme --silent"
|
|
45
45
|
},
|
|
46
46
|
"packageManager": "pnpm@8.3.1",
|
|
47
|
-
"gitHead": "
|
|
47
|
+
"gitHead": "ae5e0edc0b875184d1d8bfccca5abdb43ce163b3"
|
|
48
48
|
}
|
package/src/utils/network.ts
CHANGED
|
@@ -134,6 +134,19 @@ const ALCHEMY_BASE_RPC_URL: Record<MoneyInOutChainId, string> = {
|
|
|
134
134
|
[MoneyInOutChainId.ethereumSepolia]: 'https://eth-sepolia.g.alchemy.com/v2',
|
|
135
135
|
};
|
|
136
136
|
|
|
137
|
+
const INFURA_BASE_RPC_URL: Record<MoneyInOutChainId, string> = {
|
|
138
|
+
// mainnet
|
|
139
|
+
[MoneyInOutChainId.ethereumMainnet]: 'https://mainnet.infura.io/v3',
|
|
140
|
+
[MoneyInOutChainId.opMainnet]: 'https://optimism-mainnet.infura.io/v3',
|
|
141
|
+
[MoneyInOutChainId.polygonMainnet]: 'https://polygon-mainnet.infura.io/v3',
|
|
142
|
+
[MoneyInOutChainId.arbitrumOne]: 'https://arbitrum-mainnet.infura.io/v3',
|
|
143
|
+
[MoneyInOutChainId.baseMainnet]: 'https://base-mainnet.infura.io/v3',
|
|
144
|
+
// testnet
|
|
145
|
+
[MoneyInOutChainId.arbitrumSepolia]: 'https://arbitrum-sepolia.infura.io/v3',
|
|
146
|
+
[MoneyInOutChainId.opSepolia]: 'https://optimism-sepolia.infura.io/v3',
|
|
147
|
+
[MoneyInOutChainId.ethereumSepolia]: 'https://sepolia.infura.io/v3',
|
|
148
|
+
};
|
|
149
|
+
|
|
137
150
|
export const getAlchemyRpcUrl = (
|
|
138
151
|
apiKey: string,
|
|
139
152
|
chainId: MoneyInOutChainId,
|
|
@@ -147,6 +160,19 @@ export const getAlchemyRpcUrl = (
|
|
|
147
160
|
return `${rpcUrl}/${apiKey}`;
|
|
148
161
|
};
|
|
149
162
|
|
|
163
|
+
export const getInfuraRpcUrl = (
|
|
164
|
+
apiKey: string,
|
|
165
|
+
chainId: MoneyInOutChainId,
|
|
166
|
+
): string | null => {
|
|
167
|
+
const rpcUrl = INFURA_BASE_RPC_URL[chainId];
|
|
168
|
+
|
|
169
|
+
if (!rpcUrl) {
|
|
170
|
+
return null;
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
return `${rpcUrl}/${apiKey}`;
|
|
174
|
+
};
|
|
175
|
+
|
|
150
176
|
export const getPublicRpcUrls = (
|
|
151
177
|
chainId: MoneyInOutChainId | ReyaChainId,
|
|
152
178
|
): string[] => {
|