Skip to content

Commit

Permalink
chore: Use pre-release build of cardano-serialization-lib
Browse files Browse the repository at this point in the history
  • Loading branch information
rhyslbw committed Feb 2, 2021
1 parent 53e5336 commit 914746b
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 7 deletions.
Binary file not shown.
Binary file not shown.
2 changes: 1 addition & 1 deletion packages/api-cardano-db-hasura/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
],
"dependencies": {
"@cardano-graphql/util": "3.2.0",
"@emurgo/cardano-serialization-lib-nodejs": "^5.0.0-rc.0",
"cardano-serialization-lib": "file:../../packages-cache/cardano-serialization-lib-5.0.0-98fdbfacef9e24dfb90b955dfadb1a3ff8e1425d-rc.0.tgz",
"@graphql-tools/delegate": "^6.0.10",
"@graphql-tools/schema": "^6.0.9",
"@graphql-tools/wrap": "^6.0.9",
Expand Down
2 changes: 1 addition & 1 deletion packages/api-cardano-db-hasura/src/util.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import CardanoWasm from '@emurgo/cardano-serialization-lib-nodejs'
import CardanoWasm from 'cardano-serialization-lib'
import { Config } from './Config'
import fs from 'fs-extra'
import path from 'path'
Expand Down
9 changes: 4 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -574,11 +574,6 @@
exec-sh "^0.3.2"
minimist "^1.2.0"

"@emurgo/cardano-serialization-lib-nodejs@^5.0.0-rc.0":
version "5.0.0-rc.0"
resolved "https://registry.yarnpkg.com/@emurgo/cardano-serialization-lib-nodejs/-/cardano-serialization-lib-nodejs-5.0.0-rc.0.tgz#da6e7679ee83e467adfc78c2789b2a5129f7f6b1"
integrity sha512-CVd5YHVIsxiokJTYnyZunzr8jaeuEMVb83Jjt4j0OTNJJfp3ReV0ZIvGsoGJUP2K+07nT8xWnHDEDrMH97ZIkQ==

"@graphql-codegen/cli@^1.15.2":
version "1.16.2"
resolved "https://registry.yarnpkg.com/@graphql-codegen/cli/-/cli-1.16.2.tgz#ff92e5e6813a404616d7504500be26ff88b7092d"
Expand Down Expand Up @@ -2888,6 +2883,10 @@ capture-exit@^2.0.0:
dependencies:
rsvp "^4.8.4"

"cardano-serialization-lib@file:packages-cache/cardano-serialization-lib-5.0.0-98fdbfacef9e24dfb90b955dfadb1a3ff8e1425d-rc.0.tgz":
version "5.0.0-rc.0"
resolved "file:packages-cache/cardano-serialization-lib-5.0.0-98fdbfacef9e24dfb90b955dfadb1a3ff8e1425d-rc.0.tgz#271675fcd46fd5abb527e59d7c507e66c93c2fc1"

caseless@~0.12.0:
version "0.12.0"
resolved "https://registry.yarnpkg.com/caseless/-/caseless-0.12.0.tgz#1b681c21ff84033c826543090689420d187151dc"
Expand Down

2 comments on commit 914746b

@ArturWieczorek
Copy link
Contributor

@ArturWieczorek ArturWieczorek commented on 914746b Feb 2, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested on mary-qa:

Sending ADA + MA tokens from: payment.addr

cat payment.addr 
addr_test1qpm8ja74c22wvc9qk0rqgd3l640jx7jvxjjlhjfsysylnxj293607xx9ckju2gwm5r46r5lucyhf9fgzfzu6k7nvkvusa0ty89
cardano-cli query utxo --mary-era --address $(cat payment.addr) --testnet-magic 3
                           TxHash                                 TxIx        Amount
--------------------------------------------------------------------------------------
24e8c16ae358d1a0d23332cb87c92bd562ee3eb57d771c94a6179cd4e33466ce     0        100000000000 lovelace + 5 26087d7e937f880a5c75fbc566b111f1fad7259c65c2d4635c0f3c8b.arturcoin

to extended-payment.addr:

cat extended-payment.addr
addr_test1qz3gkzmatgtvw7zdkttvchftja4fys79krn7rue6x7dc43t939ww4vt849h8wpjv38czxt4q97vc8438tte28amvwm3qm63e2w
cardano-cli query utxo --mary-era --address $(cat extended-payment.addr) --testnet-magic 3
                           TxHash                                 TxIx        Amount
--------------------------------------------------------------------------------------
7d6ff5b0e68d91cdaf89486e2020c62794dfc132e471bc5e56aedb94a276f7f3     1        899987000000 lovelace

Build:

cardano-cli transaction build-raw --mary-era \
--tx-in 24e8c16ae358d1a0d23332cb87c92bd562ee3eb57d771c94a6179cd4e33466ce#0 \
--tx-out "addr_test1qz3gkzmatgtvw7zdkttvchftja4fys79krn7rue6x7dc43t939ww4vt849h8wpjv38czxt4q97vc8438tte28amvwm3qm63e2w+2000000+2 26087d7e937f880a5c75fbc566b111f1fad7259c65c2d4635c0f3c8b.arturcoin" \
--tx-out "addr_test1qpm8ja74c22wvc9qk0rqgd3l640jx7jvxjjlhjfsysylnxj293607xx9ckju2gwm5r46r5lucyhf9fgzfzu6k7nvkvusa0ty89+99997000000+3 26087d7e937f880a5c75fbc566b111f1fad7259c65c2d4635c0f3c8b.arturcoin" \
--fee 1000000 \
--out-file tx001.raw

Sign:

cardano-cli transaction sign \
--tx-body-file tx001.raw \
--signing-key-file ../keys/payment.skey \
--testnet-magic 3 \
--out-file tx001.signed
cat tx001.signed
{
    "type": "Tx MaryEra",
    "description": "",
    "cborHex": "83a3008182582024e8c16ae358d1a0d23332cb87c92bd562ee3eb57d771c94a6179cd4e33466ce00018282583900a28b0b7d5a16c7784db2d6cc5d2b976a9243c5b0e7e1f33a379b8ac565895ceab167a96e77064c89f0232ea02f9983d6275af2a3f76c76e2821a001e8480a1581c26087d7e937f880a5c75fbc566b111f1fad7259c65c2d4635c0f3c8ba1496172747572636f696e0282583900767977d5c294e660a0b3c604363fd55f237a4c34a5fbc9302409f99a4a2c74ff18c5c5a5c521dba0eba1d3fcc12e92a50248b9ab7a6cb339821b0000001748492140a1581c26087d7e937f880a5c75fbc566b111f1fad7259c65c2d4635c0f3c8ba1496172747572636f696e03021a000f4240a100818258204cbf60e3261bb6f980672529186dd0dfb1b0549203164f43e2066e285def756f5840787079b85baa37c242ea9aa6a27a7ff94e99fc0d068d28111a7144c1d3398de9cba3da43a5206fba9fd199164216c4be294386d0476fbc257bbb4d6f8d4f9e07f6"
}

Mutation:

mutation submitTransaction {
    submitTransaction(transaction: "83a3008182582024e8c16ae358d1a0d23332cb87c92bd562ee3eb57d771c94a6179cd4e33466ce00018282583900a28b0b7d5a16c7784db2d6cc5d2b976a9243c5b0e7e1f33a379b8ac565895ceab167a96e77064c89f0232ea02f9983d6275af2a3f76c76e2821a001e8480a1581c26087d7e937f880a5c75fbc566b111f1fad7259c65c2d4635c0f3c8ba1496172747572636f696e0282583900767977d5c294e660a0b3c604363fd55f237a4c34a5fbc9302409f99a4a2c74ff18c5c5a5c521dba0eba1d3fcc12e92a50248b9ab7a6cb339821b0000001748492140a1581c26087d7e937f880a5c75fbc566b111f1fad7259c65c2d4635c0f3c8ba1496172747572636f696e03021a000f4240a100818258204cbf60e3261bb6f980672529186dd0dfb1b0549203164f43e2066e285def756f5840787079b85baa37c242ea9aa6a27a7ff94e99fc0d068d28111a7144c1d3398de9cba3da43a5206fba9fd199164216c4be294386d0476fbc257bbb4d6f8d4f9e07f6"){
    hash
  }
}

Response:

{
  "data": {
    "submitTransaction": {
      "hash": "b5f01ae1181ba457b3f5f58d5cf13e335572f11ec9ceda13ea803d90077247dc"
    }
  }
}

State of addresses after TX submission:

cardano-cli query utxo --mary-era --address $(cat payment.addr) --testnet-magic 3
                           TxHash                                 TxIx        Amount
--------------------------------------------------------------------------------------
b5f01ae1181ba457b3f5f58d5cf13e335572f11ec9ceda13ea803d90077247dc     1        99997000000 lovelace + 3 26087d7e937f880a5c75fbc566b111f1fad7259c65c2d4635c0f3c8b.arturcoin
cardano-cli query utxo --mary-era --address $(cat extended-payment.addr) --testnet-magic 3
                           TxHash                                 TxIx        Amount
--------------------------------------------------------------------------------------
7d6ff5b0e68d91cdaf89486e2020c62794dfc132e471bc5e56aedb94a276f7f3     1        899987000000 lovelace
b5f01ae1181ba457b3f5f58d5cf13e335572f11ec9ceda13ea803d90077247dc     0        2000000 lovelace + 2 26087d7e937f880a5c75fbc566b111f1fad7259c65c2d4635c0f3c8b.arturcoin

GQL Query for tokens:

query transactionsByHashesWithTokens {
    transactions(
        where: { hash: { _in: "b5f01ae1181ba457b3f5f58d5cf13e335572f11ec9ceda13ea803d90077247dc" }},
        order_by: { hash: desc }
    ) {
        block {
            number
        }
        blockIndex
        deposit
        fee
        hash
        inputs(order_by: { sourceTxHash: asc }) {
            address
            sourceTxIndex
            sourceTxHash
            value
            tokens {
                assetName
                policyId
                quantity
            }
        }
        inputs_aggregate {
            aggregate {
                sum {
                    value
                }
            }
        }
        mint {
            assetName
            policyId
            quantity
        }
        outputs(order_by: { index: asc }) {
            index
            address
            value
            tokens {
                assetName
                policyId
                quantity
            }
        }
        outputs_aggregate {
            aggregate {
                sum {
                    value
                }
            }
        }
        size
        totalOutput
        withdrawals_aggregate {
            aggregate {
                sum {
                    amount
                }
            }
        }
    }
}

Response:

{
  "data": {
    "transactions": [
      {
        "block": {
          "number": 32811
        },
        "blockIndex": 0,
        "deposit": 0,
        "fee": 1000000,
        "hash": "b5f01ae1181ba457b3f5f58d5cf13e335572f11ec9ceda13ea803d90077247dc",
        "inputs": [
          {
            "address": "addr_test1qpm8ja74c22wvc9qk0rqgd3l640jx7jvxjjlhjfsysylnxj293607xx9ckju2gwm5r46r5lucyhf9fgzfzu6k7nvkvusa0ty89",
            "sourceTxIndex": 0,
            "sourceTxHash": "24e8c16ae358d1a0d23332cb87c92bd562ee3eb57d771c94a6179cd4e33466ce",
            "value": "100000000000",
            "tokens": [
              {
                "assetName": "\\x6172747572636f696e",
                "policyId": "26087d7e937f880a5c75fbc566b111f1fad7259c65c2d4635c0f3c8b",
                "quantity": "5"
              }
            ]
          }
        ],
        "inputs_aggregate": {
          "aggregate": {
            "sum": {
              "value": "100000000000"
            }
          }
        },
        "mint": [],
        "outputs": [
          {
            "index": 0,
            "address": "addr_test1qz3gkzmatgtvw7zdkttvchftja4fys79krn7rue6x7dc43t939ww4vt849h8wpjv38czxt4q97vc8438tte28amvwm3qm63e2w",
            "value": "2000000",
            "tokens": [
              {
                "assetName": "\\x6172747572636f696e",
                "policyId": "26087d7e937f880a5c75fbc566b111f1fad7259c65c2d4635c0f3c8b",
                "quantity": "2"
              }
            ]
          },
          {
            "index": 1,
            "address": "addr_test1qpm8ja74c22wvc9qk0rqgd3l640jx7jvxjjlhjfsysylnxj293607xx9ckju2gwm5r46r5lucyhf9fgzfzu6k7nvkvusa0ty89",
            "value": "99997000000",
            "tokens": [
              {
                "assetName": "\\x6172747572636f696e",
                "policyId": "26087d7e937f880a5c75fbc566b111f1fad7259c65c2d4635c0f3c8b",
                "quantity": "3"
              }
            ]
          }
        ],
        "outputs_aggregate": {
          "aggregate": {
            "sum": {
              "value": "99999000000"
            }
          }
        },
        "size": 375,
        "totalOutput": "99999000000",
        "withdrawals_aggregate": {
          "aggregate": {
            "sum": {
              "amount": null
            }
          }
        }
      }
    ]
  }
}

Explorer:

https://explorer.mary-qa.dev.cardano.org/en/transaction?id=b5f01ae1181ba457b3f5f58d5cf13e335572f11ec9ceda13ea803d90077247dc

image

@ArturWieczorek
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Example of minting:

{
  "data": {
    "transactions": [
      {
        "block": {
          "number": 32920
        },
        "blockIndex": 0,
        "deposit": 0,
        "fee": 1000000,
        "hash": "91290a6e31668b6b3c05213a651ecec94295db626933e4bdec30d46f5b6f7a5d",
        "inputs": [
          {
            "address": "addr_test1qz3gkzmatgtvw7zdkttvchftja4fys79krn7rue6x7dc43t939ww4vt849h8wpjv38czxt4q97vc8438tte28amvwm3qm63e2w",
            "sourceTxIndex": 1,
            "sourceTxHash": "7d6ff5b0e68d91cdaf89486e2020c62794dfc132e471bc5e56aedb94a276f7f3",
            "value": "899987000000",
            "tokens": []
          }
        ],
        "inputs_aggregate": {
          "aggregate": {
            "sum": {
              "value": "899987000000"
            }
          }
        },
        "mint": [
          {
            "assetName": "\\x6172747572636f696e",
            "policyId": "594f149934d10dc4e72f922c8219f394c0baf05b1c7932ad2866ffe7",
            "quantity": "25"
          }
        ],
        "outputs": [
          {
            "index": 0,
            "address": "addr_test1qpm8ja74c22wvc9qk0rqgd3l640jx7jvxjjlhjfsysylnxj293607xx9ckju2gwm5r46r5lucyhf9fgzfzu6k7nvkvusa0ty89",
            "value": "899986000000",
            "tokens": [
              {
                "assetName": "\\x6172747572636f696e",
                "policyId": "594f149934d10dc4e72f922c8219f394c0baf05b1c7932ad2866ffe7",
                "quantity": "25"
              }
            ]
          }
        ],
        "outputs_aggregate": {
          "aggregate": {
            "sum": {
              "value": "899986000000"
            }
          }
        },
        "size": 447,
        "totalOutput": "899986000000",
        "withdrawals_aggregate": {
          "aggregate": {
            "sum": {
              "amount": null
            }
          }
        }
      }
    ]
  }
}

Example of burning:

{
  "data": {
    "transactions": [
      {
        "block": {
          "number": 32970
        },
        "blockIndex": 0,
        "deposit": 0,
        "fee": 1000000,
        "hash": "4f7c4a07bd31d35a55497186ceea421d424f64dd95b254edc91c1c4bfa3b43d8",
        "inputs": [
          {
            "address": "addr_test1qpm8ja74c22wvc9qk0rqgd3l640jx7jvxjjlhjfsysylnxj293607xx9ckju2gwm5r46r5lucyhf9fgzfzu6k7nvkvusa0ty89",
            "sourceTxIndex": 0,
            "sourceTxHash": "91290a6e31668b6b3c05213a651ecec94295db626933e4bdec30d46f5b6f7a5d",
            "value": "899986000000",
            "tokens": [
              {
                "assetName": "\\x6172747572636f696e",
                "policyId": "594f149934d10dc4e72f922c8219f394c0baf05b1c7932ad2866ffe7",
                "quantity": "25"
              }
            ]
          }
        ],
        "inputs_aggregate": {
          "aggregate": {
            "sum": {
              "value": "899986000000"
            }
          }
        },
        "mint": [
          {
            "assetName": "\\x6172747572636f696e",
            "policyId": "594f149934d10dc4e72f922c8219f394c0baf05b1c7932ad2866ffe7",
            "quantity": "-25"
          }
        ],
        "outputs": [
          {
            "index": 0,
            "address": "addr_test1qpm8ja74c22wvc9qk0rqgd3l640jx7jvxjjlhjfsysylnxj293607xx9ckju2gwm5r46r5lucyhf9fgzfzu6k7nvkvusa0ty89",
            "value": "899985000000",
            "tokens": []
          }
        ],
        "outputs_aggregate": {
          "aggregate": {
            "sum": {
              "value": "899985000000"
            }
          }
        },
        "size": 402,
        "totalOutput": "899985000000",
        "withdrawals_aggregate": {
          "aggregate": {
            "sum": {
              "amount": null
            }
          }
        }
      }
    ]
  }
}

Please sign in to comment.