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

@helios-lang/ledger

Package Overview
Dependencies
Maintainers
1
Versions
95
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@helios-lang/ledger - npm Package Compare versions

Comparing version 0.1.22 to 0.1.23

2

package.json
{
"name": "@helios-lang/ledger",
"version": "0.1.22",
"version": "0.1.23",
"description": "Ledger types (eg. for building transactions)",

@@ -5,0 +5,0 @@ "main": "src/index.js",

@@ -1,3 +0,9 @@

import { ByteStream, bytesToHex, toBytes } from "@helios-lang/codec-utils"
import {
ByteStream,
bytesToHex,
decodeUtf8,
isValidUtf8,
toBytes
} from "@helios-lang/codec-utils"
import {
AssetClass,

@@ -26,12 +32,24 @@ handleAssetClassArgs,

/**
* @typedef {Assets | [
* MintingPolicyHashLike,
* [
* @typedef {[
* ByteArrayLike,
* bigint | number
* ][]
* ][]} AssetsLike
* ][] | Record<string, bigint | number>} TokensLike
*/
/**
* @typedef {Assets | [
* MintingPolicyHashLike,
* TokensLike
* ][] | Record<string, TokensLike>} AssetsLike
*/
/**
* 1. 100
* 2. 222
* 3. 333
* 4. 444
*/
const CIP68_PREFIXES = ["000643b0", "000de140", "0014df10", "001BC280"]
/**
* Represents a list of non-Ada tokens.

@@ -50,11 +68,16 @@ */

constructor(arg = []) {
this.assets = arg.map(([mph, tokens]) => {
return [
MintingPolicyHash.fromAlike(mph),
tokens.map(([tokenName, qty]) => [
toBytes(tokenName),
BigInt(qty)
])
]
})
this.assets = (Array.isArray(arg) ? arg : Object.entries(arg)).map(
([mph, tokens]) => {
return [
MintingPolicyHash.fromAlike(mph),
(Array.isArray(tokens)
? tokens
: Object.entries(tokens)
).map(([tokenName, qty]) => [
toBytes(tokenName),
BigInt(qty)
])
]
}
)

@@ -81,3 +104,6 @@ this.normalize()

return [ac.mph, [[ac.tokenName, qty]]]
return /** @type {[MintingPolicyHash, [number[], bigint][]]} */ ([
ac.mph,
[[ac.tokenName, qty]]
])
})

@@ -251,6 +277,19 @@ )

Object.fromEntries(
tokens.map(([tokenName, qty]) => [
bytesToHex(tokenName),
qty.toString()
])
tokens.map(([tokenName, qty]) => {
const hasCip68Prefix = CIP68_PREFIXES.includes(
bytesToHex(tokenName.slice(0, 4))
)
return [
bytesToHex(tokenName),
{
name: hasCip68Prefix
? decodeUtf8(tokenName.slice(4))
: isValidUtf8(tokenName)
? decodeUtf8(tokenName)
: undefined,
quantity: qty.toString()
}
]
})
)

@@ -480,6 +519,8 @@ ])

return new Assets(
this.assets.map(([mph, tokens]) => [
mph,
tokens.map(([token, qty]) => [token, qty * s])
])
this.assets.map(([mph, tokens]) => {
return /** @type {[MintingPolicyHash, [number[], bigint][]]} */ ([
mph,
tokens.map(([token, qty]) => [token, qty * s])
])
})
)

@@ -486,0 +527,0 @@ }

/**
* @typedef {import("@helios-lang/codec-utils").ByteArrayLike} ByteArrayLike
* @typedef {import("./AssetClass.js").AssetClassLike} AssetClassLike
* @typedef {import("../hashes/MintingPolicyHash.js").MintingPolicyHashLike} MintingPolicyHashLike
*/
/**
* @typedef {Assets | [
* MintingPolicyHashLike,
* [
* ByteArrayLike,
* bigint | number
* ][]
* ][]} AssetsLike
*/
/**
* Represents a list of non-Ada tokens.

@@ -189,11 +175,12 @@ */

export type MintingPolicyHashLike = import("../hashes/MintingPolicyHash.js").MintingPolicyHashLike;
export type TokensLike = [
ByteArrayLike,
bigint | number
][] | Record<string, bigint | number>;
export type AssetsLike = Assets | [
MintingPolicyHashLike,
[
ByteArrayLike,
bigint | number
][]
][];
TokensLike
][] | Record<string, TokensLike>;
import { MintingPolicyHash } from "../hashes/index.js";
import { MapData } from "@helios-lang/uplc";
//# sourceMappingURL=Assets.d.ts.map

Sorry, the diff of this file is not supported yet

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