Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix JS Demo #267

Draft
wants to merge 7 commits into
base: master
Choose a base branch
from
4 changes: 2 additions & 2 deletions cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ repository cardano-haskell-packages
-- you need to run if you change them

repository ghcjs-overlay
url: https://raw.githubusercontent.com/input-output-hk/hackage-overlay-ghcjs/b91c23d847a5ecedc3eca2e054afd1e8c4155256
url: https://raw.githubusercontent.com/input-output-hk/hackage-overlay-ghcjs/acbe0444181da7582127ca8b60eb122cdad1c458
secure: True
root-keys:
key-threshold: 0
--sha256: sha256-d+GumypPpDWxt4PtareJBHkIiWb09l/GskWnWcgDOQE=
--sha256: sha256-f8LXqyiSlCfi1gbHN3BEB489NCfcC1nut43lyQ0RG1s=

-- Avoid conflict in `hjsonschema`
-- src/Import.hs:2:16: error: [GHC-69158]
Expand Down
8 changes: 4 additions & 4 deletions jsapi/test/api.test.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright © 2021 IOHK
// License: Apache-2.0

import { version, inspectAddress } from '../src';
import * as library from '../src/cardano-addresses';
import { version, inspectAddress, init, cleanup } from '../src';
// import * as library from '../src/cardano-addresses';

import { LIB_VERSION } from './version';

Expand All @@ -13,15 +13,15 @@ beforeAll(() => {
process.stdin.destroy();
// This is not strictly necessary because the wrapper functions
// already call init().
library.init();
init();
console.debug("... Done.");
});

afterAll(() => {
console.debug("Stopping ghcjs RTS...");
// This is also not strictly necessary, if the program or web page
// is going to exit anyway.
library.cleanup();
cleanup();
console.debug("... Done.");
});

Expand Down
18 changes: 14 additions & 4 deletions jsbits/emscripten/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ set -euo pipefail
# ln -s ../cryptonite/cbits cryptonite
# ln -s ../cardano-crypto/cbits cardano-crypto


emcc -o crypto-cbits.js -s WASM=0 \
-s "EXTRA_EXPORTED_RUNTIME_METHODS=['printErr']" \
-s "EXPORTED_FUNCTIONS=['_malloc', '_free'\
Expand All @@ -25,7 +24,7 @@ emcc -o crypto-cbits.js -s WASM=0 \
,'_cryptonite_ed25519_point_base_scalarmul'\
,'_cryptonite_ed25519_point_encode'\
,'_cryptonite_ed25519_scalar_decode_long'\
,'_wallet_encrypted_derive_public', '_wallet_encrypted_derive_private', '_wallet_encrypted_derive_public'\
,'_wallet_encrypted_derive_public', '_wallet_encrypted_derive_private'\
,'_wallet_encrypted_sign', '_wallet_encrypted_from_secret', '_wallet_encrypted_change_pass'\
,'_wallet_encrypted_new_from_mkg']" \
-I. -Icryptonite -Icryptonite/decaf/include -Icryptonite/decaf/include/arch_32 -Icryptonite/blake2/ref -Idecaf/p448 -Idecaf/p448/arch_32 -Icardano-crypto -Icardano-crypto/ed25519 \
Expand All @@ -42,6 +41,17 @@ emcc -o crypto-cbits.js -s WASM=0 \
./cryptonite/cryptonite_chacha.c \
./cryptonite/cryptonite_poly1305.c

closure-compiler --js=crypto-cbits.js --js_output_file=crypto-cbits.min.js
# The outputs of closure-compiler are not being used, seems like it's overly
# aggressive, might as well remove it and save some time on the build process

# closure-compiler --js=crypto-cbits.js --js_output_file=crypto-cbits.min.js


# Originally we were including some polyfills for crc32 and crypto-wrappers.js
# These do not seem to be necessary as the current build process seems to be
# including them as expected and these were some of the ones causing duplication
# errors.

cat crypto-cbits.pre.js crypto-cbits.js crypto-cbits.post.js > cardano-crypto.js

cat crc32.js crypto-cbits.pre.js crypto-cbits.js crypto-cbits.post.js crypto-wrappers.js > cardano-crypto.js
#cat crc32.js crypto-cbits.pre.js crypto-cbits.js crypto-cbits.post.js crypto-wrappers.js > cardano-crypto.js
20 changes: 0 additions & 20 deletions jsbits/emscripten/crc32.js

This file was deleted.

Loading
Loading