From aff02192995f5ce842e16443ade39548b0a21ba9 Mon Sep 17 00:00:00 2001 From: Abdelkrim Dib Date: Tue, 28 May 2024 14:50:36 +0100 Subject: [PATCH] resolve native script address --- packages/module/src/common/utils/resolver.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/packages/module/src/common/utils/resolver.ts b/packages/module/src/common/utils/resolver.ts index 679a68fef..76cbd6cba 100644 --- a/packages/module/src/common/utils/resolver.ts +++ b/packages/module/src/common/utils/resolver.ts @@ -52,6 +52,17 @@ export const resolveLanguageView = (era: Era, version: LanguageVersion) => { return SUPPORTED_LANGUAGE_VIEWS[era][version]; }; +export const resolveNativeScriptAddress = (script: NativeScript, networkId = 0) => { + const nativeScript = toNativeScript(script); + + const enterpriseAddress = csl.EnterpriseAddress.new(networkId, + csl.StakeCredential.from_scripthash(nativeScript.hash()), + ); + + return enterpriseAddress.to_address().to_bech32(); + +} + export const resolveNativeScriptHash = (script: NativeScript) => { return toNativeScript(script).hash().to_hex(); };