@layerzerolabs/lz-definitions
Advanced tools
Comparing version 1.5.7 to 1.5.8
@@ -19,2 +19,3 @@ import { Chain, ChainType, EndpointVersion, Environment, Stage } from '../enums'; | ||
export declare function getNetworksForStage(stage: Stage): string[]; | ||
export declare const getEndpointVersionForUlnVersion: (ulnVersion: string) => EndpointVersion; | ||
export declare function getChainIdForNetwork(chain: string, stage: string, ulnVersion: string): string; | ||
@@ -21,0 +22,0 @@ export declare function getNetworkForChainId(targetchainId: number): { |
@@ -6,3 +6,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.getNetworkForChainId = exports.getChainIdForNetwork = exports.getNetworksForStage = exports.endpointIdToChainType = exports.endpointIdToStage = exports.endpointIdToChain = exports.getChainType = exports.networkToChainType = exports.networkToChain = exports.chainAndStageToNetwork = exports.chainAndStageToEndpointId = exports.endpointIdToNetwork = exports.networkToStage = exports.networkToEnv = exports.networkToEndpointId = void 0; | ||
exports.getNetworkForChainId = exports.getChainIdForNetwork = exports.getEndpointVersionForUlnVersion = exports.getNetworksForStage = exports.endpointIdToChainType = exports.endpointIdToStage = exports.endpointIdToChain = exports.getChainType = exports.networkToChainType = exports.networkToChain = exports.chainAndStageToNetwork = exports.chainAndStageToEndpointId = exports.endpointIdToNetwork = exports.networkToStage = exports.networkToEnv = exports.networkToEndpointId = void 0; | ||
const tiny_invariant_1 = __importDefault(require("tiny-invariant")); | ||
@@ -121,4 +121,19 @@ const constants_1 = require("../constants"); | ||
const ULN_V1_BIAS = 100; | ||
const getEndpointVersionForUlnVersion = (ulnVersion) => { | ||
const [majorVerion, minorVersion, endpointVersion] = ulnVersion.split('.'); | ||
if (!endpointVersion) { | ||
return enums_1.EndpointVersion.V1; | ||
} | ||
const version = { | ||
'1': enums_1.EndpointVersion.V1, | ||
'2': enums_1.EndpointVersion.V2, | ||
}[endpointVersion]; | ||
if (!version) { | ||
throw new Error(`Invalid ulnVersion: ${ulnVersion}`); | ||
} | ||
return version; | ||
}; | ||
exports.getEndpointVersionForUlnVersion = getEndpointVersionForUlnVersion; | ||
function getChainIdForNetwork(chain, stage, ulnVersion) { | ||
const endpointId = chainAndStageToEndpointId(chain, stage, enums_1.EndpointVersion.V1); | ||
const endpointId = chainAndStageToEndpointId(chain, stage, (0, exports.getEndpointVersionForUlnVersion)(ulnVersion)); | ||
return (ulnVersion == '1' ? endpointId - ULN_V1_BIAS : endpointId).toString(); | ||
@@ -125,0 +140,0 @@ } |
{ | ||
"name": "@layerzerolabs/lz-definitions", | ||
"version": "1.5.7", | ||
"version": "1.5.8", | ||
"description": "LayerZero Utility", | ||
@@ -9,3 +9,3 @@ "license": "MIT", | ||
"files": [ | ||
"dist" | ||
"dist/**/*" | ||
], | ||
@@ -24,4 +24,4 @@ "scripts": { | ||
"@jest/globals": "^29.5.0", | ||
"@layerzerolabs/eslint-config": "^1.5.7", | ||
"@layerzerolabs/typescript-config": "^1.5.7", | ||
"@layerzerolabs/eslint-config": "^1.5.8", | ||
"@layerzerolabs/typescript-config": "^1.5.8", | ||
"@types/jest": "^29.4.0", | ||
@@ -28,0 +28,0 @@ "eslint": "^8.17.0", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
65790
867
249
171
23