New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@mutants/cardano

Package Overview
Dependencies
Maintainers
1
Versions
84
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@mutants/cardano

This library is an alternative to the cardano-serialization-lib and does not require your app to load WebAssembly code.

  • 1.20.3
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

Mutants Cardano BETA

This library is an alternative to the cardano-serialization-lib and does not require your app to load WebAssembly code.

Sample transaction

In this transaction, the seller is sending a Mutant Croc NFT to our Marketplace validator, including a datum.

import {
  UTXOS,
  AssetUtils,
  RequiredInputs,
  RequiredOutputs,
  TransactionBuilder,
} from "@mutants/cardano";

// This is the asset the seller is going to send to our validator.
const mutantCrocAsset = {
    unit: "d517f38dd2c5acc3347c8e933e2c0185fafe3ba838f8830000a3c95f44724361726f6e6f566163696e75733030303030",
    quantity: "1" 
};

const estimateFee = 500000;
const sellerAddress = "addr1..." // Here you define the NFT seller payment address

// Here we calculate the min ADA required to be attached to the NFT
const minAdaUtxo = UTXOS.calculateMinMultiassetCost(
    AssetUtils.fromAssetsToPolicyMap([mutantCrocAsset])
);

// Here we define the seller required inputs. In order to send the NFT to the validator, we need to consume the NFT utxo,
// so we add the token, the min ADA that needs to be attached to it and an estimate fee (fee will be recalculated later)
const requiredInputs: RequiredInputs = {
    [sellerAddress]: {
        totalCoin: requiredUtxoADA + estimateFee,
        tokens: inputToken,
    },
};

// Here we define the required outputs. Since we want to send our NFT to our validator, we use the validator address here
// and determine that an output should be created with the Mutant NFT asset plus the minimum ADA required to be attached to that NFT.
// We also add the datum here, that will be used in our Plutus validator.
// In this case the datum has only 2 fields but ofc this would change depending in your validator script.
const datum = {
    constructor: 0,
    fields: [
      {
        bytes: seller,
      },
      {
        int: price,
      }
    ]
};

const requiredOutputs: RequiredOutputs = {
    [validator.address]: {
        totalCoin: minAdaUtxo,
        tokens: [mutantCrocAsset],
        datum,
    },
};

FAQs

Package last updated on 29 May 2022

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc