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

Switched to using emurgo/cardano-serialization-lib #493

Merged
merged 16 commits into from
Jun 9, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49,876 changes: 49,876 additions & 0 deletions fixtures/test/ogmios-datum-cache/plutus-data-samples.json

Large diffs are not rendered by default.

14 changes: 0 additions & 14 deletions fixtures/test/parsing/json_stringify_numbers/expected/t1.json

This file was deleted.

This file was deleted.

This file was deleted.

4 changes: 0 additions & 4 deletions fixtures/test/parsing/json_stringify_numbers/expected/t4.json

This file was deleted.

16 changes: 0 additions & 16 deletions fixtures/test/parsing/json_stringify_numbers/input/t1.json

This file was deleted.

10 changes: 0 additions & 10 deletions fixtures/test/parsing/json_stringify_numbers/input/t2.json

This file was deleted.

1 change: 0 additions & 1 deletion fixtures/test/parsing/json_stringify_numbers/input/t3.json

This file was deleted.

35 changes: 0 additions & 35 deletions fixtures/test/parsing/json_stringify_numbers/input/t4.json

This file was deleted.

18 changes: 9 additions & 9 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
"author": "",
"license": "MIT",
"dependencies": {
"@ngua/cardano-serialization-lib-browser": "^9.1.2",
"@ngua/cardano-serialization-lib-nodejs": "^9.1.2",
"@emurgo/cardano-serialization-lib-browser": "10.1.0",
"@emurgo/cardano-serialization-lib-nodejs": "10.1.0",
"big-integer": "1.6.51",
"blakejs": "1.2.1",
"bufferutil": "4.0.5",
Expand Down
1 change: 1 addition & 0 deletions spago.dhall
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ You can edit this file as you like.
, "node-buffer"
, "node-fs"
, "node-fs-aff"
, "node-path"
, "nonempty"
, "ordered-collections"
, "partial"
Expand Down
4 changes: 2 additions & 2 deletions src/Deserialization/FromBytes.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

var lib;
if (typeof BROWSER_RUNTIME != 'undefined' && BROWSER_RUNTIME) {
lib = require('@ngua/cardano-serialization-lib-browser');
lib = require('@emurgo/cardano-serialization-lib-browser');
} else {
lib = require('@ngua/cardano-serialization-lib-nodejs');
lib = require('@emurgo/cardano-serialization-lib-nodejs');
}

const fromBytes = name => helper => bytes => {
Expand Down
4 changes: 2 additions & 2 deletions src/Deserialization/NativeScript.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

var lib;
if (typeof BROWSER_RUNTIME != 'undefined' && BROWSER_RUNTIME) {
lib = require('@ngua/cardano-serialization-lib-browser');
lib = require('@emurgo/cardano-serialization-lib-browser');
} else {
lib = require('@ngua/cardano-serialization-lib-nodejs');
lib = require('@emurgo/cardano-serialization-lib-nodejs');
}

const getNativeScriptAs = prop => maybe => ns => {
Expand Down
4 changes: 2 additions & 2 deletions src/Deserialization/PlutusData.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* global require exports BROWSER_RUNTIME */
var lib;
if (typeof BROWSER_RUNTIME != 'undefined' && BROWSER_RUNTIME) {
lib = require('@ngua/cardano-serialization-lib-browser');
lib = require('@emurgo/cardano-serialization-lib-browser');
} else {
lib = require('@ngua/cardano-serialization-lib-nodejs');
lib = require('@emurgo/cardano-serialization-lib-nodejs');
}

const plutusDataAs = what => helper => data => {
Expand Down
4 changes: 2 additions & 2 deletions src/Deserialization/UnspentOutput.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

var lib;
if (typeof BROWSER_RUNTIME != 'undefined' && BROWSER_RUNTIME) {
lib = require('@ngua/cardano-serialization-lib-browser');
lib = require('@emurgo/cardano-serialization-lib-browser');
} else {
lib = require('@ngua/cardano-serialization-lib-nodejs');
lib = require('@emurgo/cardano-serialization-lib-nodejs');
}

const call = property => object => object[property]();
Expand Down
4 changes: 2 additions & 2 deletions src/Deserialization/WitnessSet.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

var lib;
if (typeof BROWSER_RUNTIME != 'undefined' && BROWSER_RUNTIME) {
lib = require('@ngua/cardano-serialization-lib-browser');
lib = require('@emurgo/cardano-serialization-lib-browser');
} else {
lib = require('@ngua/cardano-serialization-lib-nodejs');
lib = require('@emurgo/cardano-serialization-lib-nodejs');
}

const call = property => object => object[property]();
Expand Down
4 changes: 2 additions & 2 deletions src/Hashing.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ const SHA3 = require('jssha/dist/sha3');

let lib;
if (typeof BROWSER_RUNTIME != 'undefined' && BROWSER_RUNTIME) {
lib = require('@ngua/cardano-serialization-lib-browser');
lib = require('@emurgo/cardano-serialization-lib-browser');
} else {
lib = require('@ngua/cardano-serialization-lib-nodejs');
lib = require('@emurgo/cardano-serialization-lib-nodejs');
}

const DIGEST_LENGTH_256 = 32;
Expand Down
4 changes: 2 additions & 2 deletions src/Serialization.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

var lib;
if (typeof BROWSER_RUNTIME != 'undefined' && BROWSER_RUNTIME) {
lib = require('@ngua/cardano-serialization-lib-browser');
lib = require('@emurgo/cardano-serialization-lib-browser');
} else {
lib = require('@ngua/cardano-serialization-lib-nodejs');
lib = require('@emurgo/cardano-serialization-lib-nodejs');
}

const setter = prop => obj => value => () =>
Expand Down
4 changes: 2 additions & 2 deletions src/Serialization/Address.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

var CardanoWasm;
if (typeof BROWSER_RUNTIME != 'undefined' && BROWSER_RUNTIME) {
CardanoWasm = require('@ngua/cardano-serialization-lib-browser');
CardanoWasm = require('@emurgo/cardano-serialization-lib-browser');
} else {
CardanoWasm = require('@ngua/cardano-serialization-lib-nodejs');
CardanoWasm = require('@emurgo/cardano-serialization-lib-nodejs');
}


Expand Down
6 changes: 2 additions & 4 deletions src/Serialization/AuxiliaryData.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,14 @@

var lib;
if (typeof BROWSER_RUNTIME != 'undefined' && BROWSER_RUNTIME) {
lib = require('@ngua/cardano-serialization-lib-browser');
lib = require('@emurgo/cardano-serialization-lib-browser');
} else {
lib = require('@ngua/cardano-serialization-lib-nodejs');
lib = require('@emurgo/cardano-serialization-lib-nodejs');
}

const setter = prop => obj => value => () =>
obj['set_' + prop](value);

exports.setTxAuxiliaryData = setter('auxiliary_data');

exports.newAuxiliaryData = () =>
lib.AuxiliaryData.new();

Expand Down
1 change: 0 additions & 1 deletion src/Serialization/AuxiliaryData.purs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ import Serialization.Types
, GeneralTransactionMetadata
, NativeScripts
, PlutusScripts
, Transaction
, TransactionMetadatum
)
import Serialization.WitnessSet
Expand Down
4 changes: 2 additions & 2 deletions src/Serialization/BigInt.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/* global require exports BROWSER_RUNTIME */
var lib;
if (typeof BROWSER_RUNTIME != 'undefined' && BROWSER_RUNTIME) {
lib = require('@ngua/cardano-serialization-lib-browser');
lib = require('@emurgo/cardano-serialization-lib-browser');
} else {
lib = require('@ngua/cardano-serialization-lib-nodejs');
lib = require('@emurgo/cardano-serialization-lib-nodejs');
}

exports._BigInt_from_str = helper => str => {
Expand Down
4 changes: 2 additions & 2 deletions src/Serialization/BigNum.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

var lib;
if (typeof BROWSER_RUNTIME != 'undefined' && BROWSER_RUNTIME) {
lib = require('@ngua/cardano-serialization-lib-browser');
lib = require('@emurgo/cardano-serialization-lib-browser');
} else {
lib = require('@ngua/cardano-serialization-lib-nodejs');
lib = require('@emurgo/cardano-serialization-lib-nodejs');
}

exports.bigNumFromString = helper => str => {
Expand Down
4 changes: 2 additions & 2 deletions src/Serialization/Hash.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

var CardanoWasm;
if (typeof BROWSER_RUNTIME != 'undefined' && BROWSER_RUNTIME) {
CardanoWasm = require('@ngua/cardano-serialization-lib-browser');
CardanoWasm = require('@emurgo/cardano-serialization-lib-browser');
} else {
CardanoWasm = require('@ngua/cardano-serialization-lib-nodejs');
CardanoWasm = require('@emurgo/cardano-serialization-lib-nodejs');
}

const hashFromImpl = hashClassFrom => maybe => input => {
Expand Down
4 changes: 2 additions & 2 deletions src/Serialization/NativeScript.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

var lib;
if (typeof BROWSER_RUNTIME != 'undefined' && BROWSER_RUNTIME) {
lib = require('@ngua/cardano-serialization-lib-browser');
lib = require('@emurgo/cardano-serialization-lib-browser');
} else {
lib = require('@ngua/cardano-serialization-lib-nodejs');
lib = require('@emurgo/cardano-serialization-lib-nodejs');
}

const mkScript = prop => arg => lib.NativeScript[prop](arg);
Expand Down
4 changes: 2 additions & 2 deletions src/Serialization/PlutusData.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

var lib;
if (typeof BROWSER_RUNTIME != 'undefined' && BROWSER_RUNTIME) {
lib = require('@ngua/cardano-serialization-lib-browser');
lib = require('@emurgo/cardano-serialization-lib-browser');
} else {
lib = require('@ngua/cardano-serialization-lib-nodejs');
lib = require('@emurgo/cardano-serialization-lib-nodejs');
}

exports._mkPlutusData_bytes = bytes => lib.PlutusData.new_bytes(bytes);
Expand Down
4 changes: 2 additions & 2 deletions src/Serialization/WitnessSet.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

var lib;
if (typeof BROWSER_RUNTIME != 'undefined' && BROWSER_RUNTIME) {
lib = require('@ngua/cardano-serialization-lib-browser');
lib = require('@emurgo/cardano-serialization-lib-browser');
} else {
lib = require('@ngua/cardano-serialization-lib-nodejs');
lib = require('@emurgo/cardano-serialization-lib-nodejs');
}

exports.newTransactionWitnessSet = () =>
Expand Down
4 changes: 2 additions & 2 deletions src/Types/Int.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

var lib;
if (typeof BROWSER_RUNTIME != 'undefined' && BROWSER_RUNTIME) {
lib = require('@ngua/cardano-serialization-lib-browser');
lib = require('@emurgo/cardano-serialization-lib-browser');
} else {
lib = require('@ngua/cardano-serialization-lib-nodejs');
lib = require('@emurgo/cardano-serialization-lib-nodejs');
}

exports.newPositive = lib.Int.new;
Expand Down
23 changes: 22 additions & 1 deletion src/Types/PlutusData.purs
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,12 @@ module Types.PlutusData
import Prelude

import Aeson
( class DecodeAeson
( class EncodeAeson
, class DecodeAeson
, JsonDecodeError(UnexpectedValue)
, decodeAeson
, encodeAeson
, encodeAeson'
, toStringifiedNumbersJson
, (.:)
)
Expand Down Expand Up @@ -38,6 +40,7 @@ derive instance Generic PlutusData _
instance Show PlutusData where
show x = genericShow x

-- Ogmios Datum Cache Json format
instance DecodeAeson PlutusData where
decodeAeson aeson = decodeConstr
<|> decodeMap
Expand Down Expand Up @@ -77,3 +80,21 @@ instance DecodeAeson PlutusData where
Nothing -> Left $ UnexpectedValue $ toStringifiedNumbersJson $
encodeAeson bytesHex
Just res -> pure $ Bytes res

instance EncodeAeson PlutusData where
encodeAeson' (Constr constr fields) = encodeAeson'
{ "constr": encodeAeson constr
, "fields": encodeAeson fields
}
encodeAeson' (Map elems) = encodeAeson'
{ "map": encodeAeson $ map
( \(k /\ v) ->
{ "key": encodeAeson k
, "value": encodeAeson v
}
)
elems
}
encodeAeson' (List elems) = encodeAeson' elems
encodeAeson' (Integer bi) = encodeAeson' bi
encodeAeson' (Bytes ba) = encodeAeson' ba
4 changes: 2 additions & 2 deletions src/Wallet.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@

var lib;
if (typeof BROWSER_RUNTIME != 'undefined' && BROWSER_RUNTIME) {
lib = require('@ngua/cardano-serialization-lib-browser');
lib = require('@emurgo/cardano-serialization-lib-browser');
} else {
lib = require('@ngua/cardano-serialization-lib-nodejs');
lib = require('@emurgo/cardano-serialization-lib-nodejs');
}

// _enableNami :: Effect (Promise Cip30Connection)
Expand Down
Loading