Skip to content

Commit 63b009c

Browse files
committed
Merge remote-tracking branch 'origin/ruslan/add-mint-and-metadata' into feature/change-transactionbuilder-creation
# Conflicts: # rust/src/tx_builder.rs
2 parents 03a4663 + 07c72a3 commit 63b009c

File tree

9 files changed

+181
-64
lines changed

9 files changed

+181
-64
lines changed

.github/workflows/pr-checks.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,30 @@ jobs:
4141
- name: rust:build-browser
4242
run: |
4343
npm run rust:build-browser
44+
check-warns:
45+
if: github.event.review && (github.event.review.state == 'approved' || contains(github.event.review.body, '/check'))
46+
runs-on: ubuntu-latest
47+
steps:
48+
- uses: actions/checkout@v2
49+
with:
50+
submodules: 'recursive'
51+
- uses: actions/setup-node@v1
52+
with:
53+
node-version: '12.18.1'
54+
- name: Cache node modules
55+
uses: actions/cache@v1
56+
with:
57+
path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS
58+
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
59+
restore-keys: |
60+
${{ runner.os }}-build-${{ env.cache-name }}-
61+
${{ runner.os }}-build-
62+
${{ runner.os }}-
63+
- name: prepare-rust
64+
run: |
65+
rustup install stable
66+
rustup target add wasm32-unknown-unknown --toolchain stable
67+
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
68+
- name: rust:check-warnings
69+
run: |
70+
npm run rust:check-warnings

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"rust:build-asm": "(rimraf ./rust/pkg && cd rust; wasm-pack build --target=browser; wasm-pack pack) && npm run asm:build && npm run js:flowgen",
1010
"rust:publish": "cd rust && cargo publish && cd ../",
1111
"asm:build": "./binaryen/bin/wasm2js ./rust/pkg/cardano_serialization_lib_bg.wasm --output ./rust/pkg/cardano_serialization_lib.asm.js && node ./scripts/wasm-to-asm",
12+
"rust:check-warnings": "(cd rust; RUSTFLAGS=\"-D warnings\" cargo +stable build)",
1213
"rust:test": "(cd rust; cargo test)",
1314
"js:flowgen": "flowgen ./rust/pkg/cardano_serialization_lib.d.ts -o ./rust/pkg/cardano_serialization_lib.js.flow --add-flow-header",
1415
"js:prepublish": "npm run rust:test && rimraf ./publish && cp -r ./rust/pkg ./publish && cp README.md publish/ && cp LICENSE publish/",

rust/pkg/cardano_serialization_lib.js.flow

Lines changed: 27 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2465,14 +2465,16 @@ declare export class Mint {
24652465
keys(): ScriptHashes;
24662466

24672467
/**
2468+
* Returns the multiasset where only positive (minting) entries are present
24682469
* @returns {MultiAsset}
24692470
*/
2470-
to_multiasset(): MultiAsset;
2471+
as_positive_multiasset(): MultiAsset;
24712472

24722473
/**
2473-
* @returns {Value}
2474+
* Returns the multiasset where only negative (burning) entries are present
2475+
* @returns {MultiAsset}
24742476
*/
2475-
to_value(): Value;
2477+
as_negative_multiasset(): MultiAsset;
24762478
}
24772479
/**
24782480
*/
@@ -5126,6 +5128,11 @@ declare export class TransactionBuilder {
51265128
*/
51275129
set_withdrawals(withdrawals: Withdrawals): void;
51285130

5131+
/**
5132+
* @returns {AuxiliaryData | void}
5133+
*/
5134+
get_auxiliary_data(): AuxiliaryData | void;
5135+
51295136
/**
51305137
* Set explicit auxiliary data via an AuxiliaryData object
51315138
* It might contain some metadata plus native or Plutus scripts
@@ -5273,12 +5280,6 @@ declare export class TransactionBuilder {
52735280
*/
52745281
get_implicit_input(): Value;
52755282

5276-
/**
5277-
* mint as value
5278-
* @returns {Value}
5279-
*/
5280-
get_mint_value(): Value;
5281-
52825283
/**
52835284
* does not include fee
52845285
* @returns {Value}
@@ -5316,10 +5317,21 @@ declare export class TransactionBuilder {
53165317
output_sizes(): Uint32Array;
53175318

53185319
/**
5320+
* Returns object the body of the new transaction
5321+
* Auxiliary data itself is not included
5322+
* You can use `get_auxiliary_date` or `build_tx`
53195323
* @returns {TransactionBody}
53205324
*/
53215325
build(): TransactionBody;
53225326

5327+
/**
5328+
* Returns full Transaction object with the body and the auxiliary data
5329+
* NOTE: witness_set is set to just empty set
5330+
* NOTE: is_valid set to true
5331+
* @returns {Transaction}
5332+
*/
5333+
build_tx(): Transaction;
5334+
53235335
/**
53245336
* warning: sum of all parts of a transaction must equal 0. You cannot just set the fee to the min value and forget about it
53255337
* warning: min_fee may be slightly larger than the actual minimum fee (ex: a few lovelaces)
@@ -6006,6 +6018,12 @@ declare export class Value {
60066018
*/
60076019
static new(coin: BigNum): Value;
60086020

6021+
/**
6022+
* @param {MultiAsset} multiasset
6023+
* @returns {Value}
6024+
*/
6025+
static new_from_assets(multiasset: MultiAsset): Value;
6026+
60096027
/**
60106028
* @returns {Value}
60116029
*/

rust/src/address.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ impl Address {
440440
None => {
441441
// see CIP5 for bech32 prefix rules
442442
let prefix_header = match &self.0 {
443-
AddrType::Reward(a) => "stake",
443+
AddrType::Reward(_) => "stake",
444444
_ => "addr",
445445
};
446446
let prefix_tail = match self.network_id()? {

rust/src/crypto.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -588,7 +588,7 @@ impl Deserialize for BootstrapWitness {
588588
}
589589

590590
impl DeserializeEmbeddedGroup for BootstrapWitness {
591-
fn deserialize_as_embedded_group<R: BufRead + Seek>(raw: &mut Deserializer<R>, len: cbor_event::Len) -> Result<Self, DeserializeError> {
591+
fn deserialize_as_embedded_group<R: BufRead + Seek>(raw: &mut Deserializer<R>, _: cbor_event::Len) -> Result<Self, DeserializeError> {
592592
let vkey = (|| -> Result<_, DeserializeError> {
593593
Ok(Vkey::deserialize(raw)?)
594594
})().map_err(|e| e.annotate("vkey"))?;
@@ -953,7 +953,6 @@ impl cbor_event::se::Serialize for Nonce {
953953

954954
impl Deserialize for Nonce {
955955
fn deserialize<R: std::io::BufRead>(raw: &mut Deserializer<R>) -> Result<Self, DeserializeError> {
956-
use std::convert::TryInto;
957956
(|| -> Result<Self, DeserializeError> {
958957
let len = raw.array()?;
959958
let hash = match raw.unsigned_integer()? {

rust/src/error.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
use cbor_event::{self, de::Deserializer, se::{Serialize, Serializer}};
2-
use std::io::{BufRead, Seek, Write};
1+
use cbor_event::{self};
32
use crate::chain_crypto;
43
use super::*;
54

0 commit comments

Comments
 (0)