From aac3736387dec3d22c7a3222d46244911b283856 Mon Sep 17 00:00:00 2001 From: Vladimir Kalnitsky Date: Wed, 14 Feb 2024 19:04:34 +0400 Subject: [PATCH] Switch to cardano-serialization-lib-gc (instead of separate browser/nodejs versions of CSL). --- package-lock.json | 43 ++++++------------- package.json | 3 +- src/Internal/ApplyArgs.js | 5 +-- src/Internal/BalanceTx/UtxoMinAda.js | 9 +--- src/Internal/Deserialization/FromBytes.js | 9 +--- src/Internal/Deserialization/Keys.js | 9 +--- src/Internal/Deserialization/Language.js | 9 +--- src/Internal/Deserialization/NativeScript.js | 9 +--- src/Internal/Deserialization/PlutusData.js | 9 +--- src/Internal/Deserialization/Transaction.js | 9 +--- src/Internal/Deserialization/UnspentOutput.js | 9 +--- src/Internal/Hashing.js | 11 +---- src/Internal/Serialization.js | 9 +--- src/Internal/Serialization/Address.js | 9 +--- src/Internal/Serialization/AuxiliaryData.js | 9 +--- src/Internal/Serialization/BigInt.js | 9 +--- src/Internal/Serialization/Hash.js | 9 +--- src/Internal/Serialization/Keys.js | 2 - src/Internal/Serialization/MinFee.js | 9 +--- src/Internal/Serialization/NativeScript.js | 9 +--- src/Internal/Serialization/PlutusData.js | 9 +--- src/Internal/Serialization/PlutusScript.js | 9 +--- src/Internal/Serialization/WitnessSet.js | 9 +--- src/Internal/Types/BigNum.js | 10 +---- src/Internal/Types/Int.js | 9 +--- src/Internal/Wallet/Bip32.js | 10 +---- test/Wallet/Cip30/SignData.js | 9 ++-- 27 files changed, 41 insertions(+), 223 deletions(-) diff --git a/package-lock.json b/package-lock.json index d5ef3adaa5..1b1ee70052 100644 --- a/package-lock.json +++ b/package-lock.json @@ -11,8 +11,7 @@ "dependencies": { "@emurgo/cardano-message-signing-browser": "1.0.1", "@emurgo/cardano-message-signing-nodejs": "1.0.1", - "@mlabs-haskell/cardano-serialization-lib-gc-browser": "^1.0.6", - "@mlabs-haskell/cardano-serialization-lib-gc-nodejs": "^1.0.6", + "@mlabs-haskell/cardano-serialization-lib-gc": "^1.0.9", "@mlabs-haskell/csl-gc-wrapper": "^1.0.2", "@mlabs-haskell/json-bigint": "2.0.0", "@noble/secp256k1": "^1.7.0", @@ -494,22 +493,14 @@ "integrity": "sha512-Hcv+nVC0kZnQ3tD9GVu5xSMR4VVYOteQIr/hwFPVEvPdlXqgGEuRjiheChHgdM+JyqdgNcmzZOX/tnl0JOiI7A==", "dev": true }, - "node_modules/@mlabs-haskell/cardano-serialization-lib-gc-browser": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/@mlabs-haskell/cardano-serialization-lib-gc-browser/-/cardano-serialization-lib-gc-browser-1.0.6.tgz", - "integrity": "sha512-b7dLrrhjUJSdsmjzariCZO734NB+M/ONLGBiQ/TQzMRtsMydqSFQg6WbMdwYPustoNmQOg6a8bm9+RgllqdmFw==", + "node_modules/@mlabs-haskell/cardano-serialization-lib-gc": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@mlabs-haskell/cardano-serialization-lib-gc/-/cardano-serialization-lib-gc-1.0.9.tgz", + "integrity": "sha512-O3JZGS0GjbyQPlKP6KRb7Q78ANfqIHxpQ0xmX6BK9tUw6KOueNfJ6e80JD+MHogoPJwOei7prqpHgCu+hitNQw==", "dependencies": { "@emurgo/cardano-serialization-lib-browser": "^11.2.1", - "@mlabs-haskell/csl-gc-wrapper": "^1.0.1" - } - }, - "node_modules/@mlabs-haskell/cardano-serialization-lib-gc-nodejs": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/@mlabs-haskell/cardano-serialization-lib-gc-nodejs/-/cardano-serialization-lib-gc-nodejs-1.0.6.tgz", - "integrity": "sha512-I1FqhjEHgib+y0+6K1tSqvrtldRvqjrM5mL+TW9224ezEDScQeCroPWbgGBwwi6rjkN9YpS8Uz6gC0vo8lua1A==", - "dependencies": { - "@emurgo/cardano-serialization-lib-nodejs": "^11.4.0", - "@mlabs-haskell/csl-gc-wrapper": "^1.0.1" + "@emurgo/cardano-serialization-lib-nodejs": "^11.2.1", + "@mlabs-haskell/csl-gc-wrapper": "^1.0.2" } }, "node_modules/@mlabs-haskell/csl-gc-wrapper": { @@ -6618,22 +6609,14 @@ "integrity": "sha512-Hcv+nVC0kZnQ3tD9GVu5xSMR4VVYOteQIr/hwFPVEvPdlXqgGEuRjiheChHgdM+JyqdgNcmzZOX/tnl0JOiI7A==", "dev": true }, - "@mlabs-haskell/cardano-serialization-lib-gc-browser": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/@mlabs-haskell/cardano-serialization-lib-gc-browser/-/cardano-serialization-lib-gc-browser-1.0.6.tgz", - "integrity": "sha512-b7dLrrhjUJSdsmjzariCZO734NB+M/ONLGBiQ/TQzMRtsMydqSFQg6WbMdwYPustoNmQOg6a8bm9+RgllqdmFw==", + "@mlabs-haskell/cardano-serialization-lib-gc": { + "version": "1.0.9", + "resolved": "https://registry.npmjs.org/@mlabs-haskell/cardano-serialization-lib-gc/-/cardano-serialization-lib-gc-1.0.9.tgz", + "integrity": "sha512-O3JZGS0GjbyQPlKP6KRb7Q78ANfqIHxpQ0xmX6BK9tUw6KOueNfJ6e80JD+MHogoPJwOei7prqpHgCu+hitNQw==", "requires": { "@emurgo/cardano-serialization-lib-browser": "^11.2.1", - "@mlabs-haskell/csl-gc-wrapper": "^1.0.1" - } - }, - "@mlabs-haskell/cardano-serialization-lib-gc-nodejs": { - "version": "1.0.6", - "resolved": "https://registry.npmjs.org/@mlabs-haskell/cardano-serialization-lib-gc-nodejs/-/cardano-serialization-lib-gc-nodejs-1.0.6.tgz", - "integrity": "sha512-I1FqhjEHgib+y0+6K1tSqvrtldRvqjrM5mL+TW9224ezEDScQeCroPWbgGBwwi6rjkN9YpS8Uz6gC0vo8lua1A==", - "requires": { - "@emurgo/cardano-serialization-lib-nodejs": "^11.4.0", - "@mlabs-haskell/csl-gc-wrapper": "^1.0.1" + "@emurgo/cardano-serialization-lib-nodejs": "^11.2.1", + "@mlabs-haskell/csl-gc-wrapper": "^1.0.2" } }, "@mlabs-haskell/csl-gc-wrapper": { diff --git a/package.json b/package.json index 0a19852661..a4e3b13720 100755 --- a/package.json +++ b/package.json @@ -36,8 +36,7 @@ "dependencies": { "@emurgo/cardano-message-signing-browser": "1.0.1", "@emurgo/cardano-message-signing-nodejs": "1.0.1", - "@mlabs-haskell/cardano-serialization-lib-gc-browser": "^1.0.6", - "@mlabs-haskell/cardano-serialization-lib-gc-nodejs": "^1.0.6", + "@mlabs-haskell/cardano-serialization-lib-gc": "^1.0.9", "@mlabs-haskell/csl-gc-wrapper": "^1.0.2", "@mlabs-haskell/json-bigint": "2.0.0", "@noble/secp256k1": "^1.7.0", diff --git a/src/Internal/ApplyArgs.js b/src/Internal/ApplyArgs.js index 9ff6702981..bc93f773da 100644 --- a/src/Internal/ApplyArgs.js +++ b/src/Internal/ApplyArgs.js @@ -1,12 +1,11 @@ /* global BROWSER_RUNTIME */ -let lib; +import * as lib from "@mlabs-haskell/cardano-serialization-lib-gc"; + let apply_args; if (typeof BROWSER_RUNTIME != "undefined" && BROWSER_RUNTIME) { - lib = await import("@mlabs-haskell/cardano-serialization-lib-gc-browser"); apply_args = await import("apply-args-browser"); } else { - lib = await import("@mlabs-haskell/cardano-serialization-lib-gc-nodejs"); apply_args = await import("apply-args-nodejs"); } diff --git a/src/Internal/BalanceTx/UtxoMinAda.js b/src/Internal/BalanceTx/UtxoMinAda.js index 5b6910c849..c26911f919 100644 --- a/src/Internal/BalanceTx/UtxoMinAda.js +++ b/src/Internal/BalanceTx/UtxoMinAda.js @@ -1,11 +1,4 @@ -/* global BROWSER_RUNTIME */ - -let lib; -if (typeof BROWSER_RUNTIME != "undefined" && BROWSER_RUNTIME) { - lib = await import("@mlabs-haskell/cardano-serialization-lib-gc-browser"); -} else { - lib = await import("@mlabs-haskell/cardano-serialization-lib-gc-nodejs"); -} +import * as lib from "@mlabs-haskell/cardano-serialization-lib-gc"; export function minAdaForOutput(maybe) { return txOutput => dataCost => { diff --git a/src/Internal/Deserialization/FromBytes.js b/src/Internal/Deserialization/FromBytes.js index f7b57ae04c..985f7ca88c 100644 --- a/src/Internal/Deserialization/FromBytes.js +++ b/src/Internal/Deserialization/FromBytes.js @@ -1,11 +1,4 @@ -/* global BROWSER_RUNTIME */ - -let lib; -if (typeof BROWSER_RUNTIME != "undefined" && BROWSER_RUNTIME) { - lib = await import("@mlabs-haskell/cardano-serialization-lib-gc-browser"); -} else { - lib = await import("@mlabs-haskell/cardano-serialization-lib-gc-nodejs"); -} +import * as lib from "@mlabs-haskell/cardano-serialization-lib-gc"; export function _fromBytes(helper) { return name => bytes => { diff --git a/src/Internal/Deserialization/Keys.js b/src/Internal/Deserialization/Keys.js index 4beb728a43..60f8e7c65f 100644 --- a/src/Internal/Deserialization/Keys.js +++ b/src/Internal/Deserialization/Keys.js @@ -1,11 +1,4 @@ -/* global BROWSER_RUNTIME */ - -let lib; -if (typeof BROWSER_RUNTIME != "undefined" && BROWSER_RUNTIME) { - lib = await import("@mlabs-haskell/cardano-serialization-lib-gc-browser"); -} else { - lib = await import("@mlabs-haskell/cardano-serialization-lib-gc-nodejs"); -} +import * as lib from "@mlabs-haskell/cardano-serialization-lib-gc"; export function freshPrivateKey() { return lib.PrivateKey.generate_ed25519(); diff --git a/src/Internal/Deserialization/Language.js b/src/Internal/Deserialization/Language.js index e39c2a5aac..c299f8434b 100644 --- a/src/Internal/Deserialization/Language.js +++ b/src/Internal/Deserialization/Language.js @@ -1,11 +1,4 @@ -/* global BROWSER_RUNTIME */ - -let lib; -if (typeof BROWSER_RUNTIME != "undefined" && BROWSER_RUNTIME) { - lib = await import("@mlabs-haskell/cardano-serialization-lib-gc-browser"); -} else { - lib = await import("@mlabs-haskell/cardano-serialization-lib-gc-nodejs"); -} +import * as lib from "@mlabs-haskell/cardano-serialization-lib-gc"; export function _convertLanguage(langCtors) { return cslLang => { diff --git a/src/Internal/Deserialization/NativeScript.js b/src/Internal/Deserialization/NativeScript.js index 4ef2dc16ba..9cccf27f8f 100644 --- a/src/Internal/Deserialization/NativeScript.js +++ b/src/Internal/Deserialization/NativeScript.js @@ -1,11 +1,4 @@ -/* global BROWSER_RUNTIME */ - -let lib; -if (typeof BROWSER_RUNTIME != "undefined" && BROWSER_RUNTIME) { - lib = await import("@mlabs-haskell/cardano-serialization-lib-gc-browser"); -} else { - lib = await import("@mlabs-haskell/cardano-serialization-lib-gc-nodejs"); -} +import * as lib from "@mlabs-haskell/cardano-serialization-lib-gc"; export function _convertNativeScript(handler) { return ns => { diff --git a/src/Internal/Deserialization/PlutusData.js b/src/Internal/Deserialization/PlutusData.js index 3d0c288050..44425ea4e6 100644 --- a/src/Internal/Deserialization/PlutusData.js +++ b/src/Internal/Deserialization/PlutusData.js @@ -1,11 +1,4 @@ -/* global BROWSER_RUNTIME */ - -let lib; -if (typeof BROWSER_RUNTIME != "undefined" && BROWSER_RUNTIME) { - lib = await import("@mlabs-haskell/cardano-serialization-lib-gc-browser"); -} else { - lib = await import("@mlabs-haskell/cardano-serialization-lib-gc-nodejs"); -} +import * as lib from "@mlabs-haskell/cardano-serialization-lib-gc"; export function _convertPlutusData(handle) { return pd => { diff --git a/src/Internal/Deserialization/Transaction.js b/src/Internal/Deserialization/Transaction.js index 57faa3572c..2347ef92f9 100644 --- a/src/Internal/Deserialization/Transaction.js +++ b/src/Internal/Deserialization/Transaction.js @@ -1,11 +1,4 @@ -/* global BROWSER_RUNTIME */ - -let lib; -if (typeof BROWSER_RUNTIME != "undefined" && BROWSER_RUNTIME) { - lib = await import("@mlabs-haskell/cardano-serialization-lib-gc-browser"); -} else { - lib = await import("@mlabs-haskell/cardano-serialization-lib-gc-nodejs"); -} +import * as lib from "@mlabs-haskell/cardano-serialization-lib-gc"; const call = property => object => object[property](); const callMaybe = property => maybe => object => { diff --git a/src/Internal/Deserialization/UnspentOutput.js b/src/Internal/Deserialization/UnspentOutput.js index 61f5ecbee3..3af30f47e1 100644 --- a/src/Internal/Deserialization/UnspentOutput.js +++ b/src/Internal/Deserialization/UnspentOutput.js @@ -1,11 +1,4 @@ -/* global BROWSER_RUNTIME */ - -let lib; -if (typeof BROWSER_RUNTIME != "undefined" && BROWSER_RUNTIME) { - lib = await import("@mlabs-haskell/cardano-serialization-lib-gc-browser"); -} else { - lib = await import("@mlabs-haskell/cardano-serialization-lib-gc-nodejs"); -} +import * as lib from "@mlabs-haskell/cardano-serialization-lib-gc"; const call = property => object => object[property](); const callMaybe = property => maybe => object => { diff --git a/src/Internal/Hashing.js b/src/Internal/Hashing.js index 0b647d6da4..c251e3c01a 100644 --- a/src/Internal/Hashing.js +++ b/src/Internal/Hashing.js @@ -1,16 +1,7 @@ -/* global BROWSER_RUNTIME */ - import Blake2 from "blakejs"; - import SHA256 from "jssha/sha256"; import SHA3 from "jssha/sha3"; - -let lib; -if (typeof BROWSER_RUNTIME != "undefined" && BROWSER_RUNTIME) { - lib = await import("@mlabs-haskell/cardano-serialization-lib-gc-browser"); -} else { - lib = await import("@mlabs-haskell/cardano-serialization-lib-gc-nodejs"); -} +import * as lib from "@mlabs-haskell/cardano-serialization-lib-gc"; export function blake2b224Hash(bytesToHash) { return Blake2.blake2b(bytesToHash, null, 28); diff --git a/src/Internal/Serialization.js b/src/Internal/Serialization.js index ee93d49db9..d745526609 100644 --- a/src/Internal/Serialization.js +++ b/src/Internal/Serialization.js @@ -1,11 +1,4 @@ -/* global BROWSER_RUNTIME */ - -let lib; -if (typeof BROWSER_RUNTIME != "undefined" && BROWSER_RUNTIME) { - lib = await import("@mlabs-haskell/cardano-serialization-lib-gc-browser"); -} else { - lib = await import("@mlabs-haskell/cardano-serialization-lib-gc-nodejs"); -} +import * as lib from "@mlabs-haskell/cardano-serialization-lib-gc"; const setter = prop => obj => value => () => obj["set_" + prop](value); diff --git a/src/Internal/Serialization/Address.js b/src/Internal/Serialization/Address.js index 083ece7f85..78800fccd0 100644 --- a/src/Internal/Serialization/Address.js +++ b/src/Internal/Serialization/Address.js @@ -1,11 +1,4 @@ -/* global BROWSER_RUNTIME */ - -let lib; -if (typeof BROWSER_RUNTIME != "undefined" && BROWSER_RUNTIME) { - lib = await import("@mlabs-haskell/cardano-serialization-lib-gc-browser"); -} else { - lib = await import("@mlabs-haskell/cardano-serialization-lib-gc-nodejs"); -} +import * as lib from "@mlabs-haskell/cardano-serialization-lib-gc"; const callClassStaticMaybe = (classname, functionname) => maybe => input => { let ret = null; diff --git a/src/Internal/Serialization/AuxiliaryData.js b/src/Internal/Serialization/AuxiliaryData.js index 33fd344de2..367ec0b6c2 100644 --- a/src/Internal/Serialization/AuxiliaryData.js +++ b/src/Internal/Serialization/AuxiliaryData.js @@ -1,11 +1,4 @@ -/* global BROWSER_RUNTIME */ - -let lib; -if (typeof BROWSER_RUNTIME != "undefined" && BROWSER_RUNTIME) { - lib = await import("@mlabs-haskell/cardano-serialization-lib-gc-browser"); -} else { - lib = await import("@mlabs-haskell/cardano-serialization-lib-gc-nodejs"); -} +import * as lib from "@mlabs-haskell/cardano-serialization-lib-gc"; const setter = prop => obj => value => () => obj["set_" + prop](value); diff --git a/src/Internal/Serialization/BigInt.js b/src/Internal/Serialization/BigInt.js index dc61768cc1..ad30d665c1 100644 --- a/src/Internal/Serialization/BigInt.js +++ b/src/Internal/Serialization/BigInt.js @@ -1,11 +1,4 @@ -/* global BROWSER_RUNTIME */ - -let lib; -if (typeof BROWSER_RUNTIME != "undefined" && BROWSER_RUNTIME) { - lib = await import("@mlabs-haskell/cardano-serialization-lib-gc-browser"); -} else { - lib = await import("@mlabs-haskell/cardano-serialization-lib-gc-nodejs"); -} +import * as lib from "@mlabs-haskell/cardano-serialization-lib-gc"; export function _BigInt_from_str(helper) { return str => { diff --git a/src/Internal/Serialization/Hash.js b/src/Internal/Serialization/Hash.js index 1ac1b8c796..93d34250d3 100644 --- a/src/Internal/Serialization/Hash.js +++ b/src/Internal/Serialization/Hash.js @@ -1,11 +1,4 @@ -/* global BROWSER_RUNTIME */ - -let lib; -if (typeof BROWSER_RUNTIME != "undefined" && BROWSER_RUNTIME) { - lib = await import("@mlabs-haskell/cardano-serialization-lib-gc-browser"); -} else { - lib = await import("@mlabs-haskell/cardano-serialization-lib-gc-nodejs"); -} +import * as lib from "@mlabs-haskell/cardano-serialization-lib-gc"; export function hashToBytes(hash) { return hash.to_bytes(); diff --git a/src/Internal/Serialization/Keys.js b/src/Internal/Serialization/Keys.js index 3c80c09b4f..9d80aa7ec1 100644 --- a/src/Internal/Serialization/Keys.js +++ b/src/Internal/Serialization/Keys.js @@ -1,5 +1,3 @@ -/* global BROWSER_RUNTIME */ - const bytesFromKey = key => key.as_bytes(); export { bytesFromKey as bytesFromPublicKey }; diff --git a/src/Internal/Serialization/MinFee.js b/src/Internal/Serialization/MinFee.js index 52e0732ada..195564dc7e 100644 --- a/src/Internal/Serialization/MinFee.js +++ b/src/Internal/Serialization/MinFee.js @@ -1,11 +1,4 @@ -/* global BROWSER_RUNTIME */ - -let lib; -if (typeof BROWSER_RUNTIME != "undefined" && BROWSER_RUNTIME) { - lib = await import("@mlabs-haskell/cardano-serialization-lib-gc-browser"); -} else { - lib = await import("@mlabs-haskell/cardano-serialization-lib-gc-nodejs"); -} +import * as lib from "@mlabs-haskell/cardano-serialization-lib-gc"; export function _minFee(maybe) { return tx => txFeeFixed => txFeePerByte => { diff --git a/src/Internal/Serialization/NativeScript.js b/src/Internal/Serialization/NativeScript.js index 810331fa7c..030278d6c0 100644 --- a/src/Internal/Serialization/NativeScript.js +++ b/src/Internal/Serialization/NativeScript.js @@ -1,11 +1,4 @@ -/* global BROWSER_RUNTIME */ - -let lib; -if (typeof BROWSER_RUNTIME != "undefined" && BROWSER_RUNTIME) { - lib = await import("@mlabs-haskell/cardano-serialization-lib-gc-browser"); -} else { - lib = await import("@mlabs-haskell/cardano-serialization-lib-gc-nodejs"); -} +import * as lib from "@mlabs-haskell/cardano-serialization-lib-gc"; const mkScript = prop => arg => lib.NativeScript[prop](arg); diff --git a/src/Internal/Serialization/PlutusData.js b/src/Internal/Serialization/PlutusData.js index 9c642c773e..ff29181d86 100644 --- a/src/Internal/Serialization/PlutusData.js +++ b/src/Internal/Serialization/PlutusData.js @@ -1,11 +1,4 @@ -/* global BROWSER_RUNTIME */ - -let lib; -if (typeof BROWSER_RUNTIME != "undefined" && BROWSER_RUNTIME) { - lib = await import("@mlabs-haskell/cardano-serialization-lib-gc-browser"); -} else { - lib = await import("@mlabs-haskell/cardano-serialization-lib-gc-nodejs"); -} +import * as lib from "@mlabs-haskell/cardano-serialization-lib-gc"; export function _mkPlutusData_bytes(bytes) { return lib.PlutusData.new_bytes(bytes); diff --git a/src/Internal/Serialization/PlutusScript.js b/src/Internal/Serialization/PlutusScript.js index ab48270fec..01933a33e1 100644 --- a/src/Internal/Serialization/PlutusScript.js +++ b/src/Internal/Serialization/PlutusScript.js @@ -1,11 +1,4 @@ -/* global BROWSER_RUNTIME */ - -let lib; -if (typeof BROWSER_RUNTIME != "undefined" && BROWSER_RUNTIME) { - lib = await import("@mlabs-haskell/cardano-serialization-lib-gc-browser"); -} else { - lib = await import("@mlabs-haskell/cardano-serialization-lib-gc-nodejs"); -} +import * as lib from "@mlabs-haskell/cardano-serialization-lib-gc"; export function newPlutusV1Script(bytes) { return lib.PlutusScript.new(bytes); diff --git a/src/Internal/Serialization/WitnessSet.js b/src/Internal/Serialization/WitnessSet.js index 96b8fd2cda..d916f7a673 100644 --- a/src/Internal/Serialization/WitnessSet.js +++ b/src/Internal/Serialization/WitnessSet.js @@ -1,11 +1,4 @@ -/* global BROWSER_RUNTIME */ - -let lib; -if (typeof BROWSER_RUNTIME != "undefined" && BROWSER_RUNTIME) { - lib = await import("@mlabs-haskell/cardano-serialization-lib-gc-browser"); -} else { - lib = await import("@mlabs-haskell/cardano-serialization-lib-gc-nodejs"); -} +import * as lib from "@mlabs-haskell/cardano-serialization-lib-gc"; export function newTransactionWitnessSet() { return lib.TransactionWitnessSet.new(); diff --git a/src/Internal/Types/BigNum.js b/src/Internal/Types/BigNum.js index 5514c30545..df50fcd94b 100644 --- a/src/Internal/Types/BigNum.js +++ b/src/Internal/Types/BigNum.js @@ -1,12 +1,4 @@ -/* global BROWSER_RUNTIME */ - -let lib; -if (typeof BROWSER_RUNTIME != "undefined" && BROWSER_RUNTIME) { - lib = await import("@mlabs-haskell/cardano-serialization-lib-gc-browser"); -} else { - lib = await import("@mlabs-haskell/cardano-serialization-lib-gc-nodejs"); - // lib = (await import("../../../../cardano-serialization-lib-gc/nodejs/index.js")); -} +import * as lib from "@mlabs-haskell/cardano-serialization-lib-gc"; export function bnCompare(lhs) { return rhs => lhs.compare(rhs); diff --git a/src/Internal/Types/Int.js b/src/Internal/Types/Int.js index 8110b53cb3..0451643da2 100644 --- a/src/Internal/Types/Int.js +++ b/src/Internal/Types/Int.js @@ -1,11 +1,4 @@ -/* global BROWSER_RUNTIME */ - -let lib; -if (typeof BROWSER_RUNTIME != "undefined" && BROWSER_RUNTIME) { - lib = await import("@mlabs-haskell/cardano-serialization-lib-gc-browser"); -} else { - lib = await import("@mlabs-haskell/cardano-serialization-lib-gc-nodejs"); -} +import * as lib from "@mlabs-haskell/cardano-serialization-lib-gc"; export const newPositive = lib.Int.new; export const newNegative = lib.Int.new_negative; diff --git a/src/Internal/Wallet/Bip32.js b/src/Internal/Wallet/Bip32.js index 9518c96977..cb573568f5 100644 --- a/src/Internal/Wallet/Bip32.js +++ b/src/Internal/Wallet/Bip32.js @@ -1,12 +1,4 @@ -/* global BROWSER_RUNTIME */ - -let lib; -if (typeof BROWSER_RUNTIME != "undefined" && BROWSER_RUNTIME) { - lib = await import("@mlabs-haskell/cardano-serialization-lib-gc-browser"); -} else { - lib = await import("@mlabs-haskell/cardano-serialization-lib-gc-nodejs"); -} - +import * as lib from "@mlabs-haskell/cardano-serialization-lib-gc"; import bip39 from "bip39"; const HARDENED = 0x80000000; diff --git a/test/Wallet/Cip30/SignData.js b/test/Wallet/Cip30/SignData.js index 7d99800c52..20554c46c6 100644 --- a/test/Wallet/Cip30/SignData.js +++ b/test/Wallet/Cip30/SignData.js @@ -1,16 +1,13 @@ /* global BROWSER_RUNTIME */ -let lib, csl; +import * as csl from "@mlabs-haskell/cardano-serialization-lib-gc"; + +let lib; if (typeof BROWSER_RUNTIME != "undefined" && BROWSER_RUNTIME) { lib = await import("@emurgo/cardano-message-signing-browser"); - csl = await import("@mlabs-haskell/cardano-serialization-lib-gc-browser"); } else { lib = await import("@emurgo/cardano-message-signing-nodejs"); - csl = await import("@mlabs-haskell/cardano-serialization-lib-gc-nodejs"); } -// import gcWrapper from "@mlabs-haskell/csl-gc-wrapper"; -// lib = gcWrapper(lib); -// csl = gcWrapper(csl); function opt_chain(maybe, obj) { const isNothing = x => x === null || x === undefined;