Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@blockfrost/blockfrost-utils

Package Overview
Dependencies
Maintainers
3
Versions
50
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@blockfrost/blockfrost-utils - npm Package Compare versions

Comparing version 2.4.1-beta.3 to 2.5.0-beta.0

7

lib/cip68.d.ts

@@ -7,2 +7,3 @@ /// <reference types="node" />

}
declare type TokenStandard = 'ft' | 'nft' | 'rft';
/**

@@ -26,9 +27,11 @@ * https://github.com/websockets/utf-8-validate/blob/master/fallback.js

ft: string;
rft: string;
} | null;
export declare const getReferenceNFT: (assetHex: string) => {
hex: string;
standard: 'ft' | 'nft';
standard: TokenStandard;
} | null;
export declare const getMetadataFromOutputDatum: (datumHex: string, options: {
standard: 'ft' | 'nft';
standard: TokenStandard;
}) => ReferenceMetadataDatum | null;
export {};

@@ -36,3 +36,4 @@ "use strict";

nft: 222,
ft: 333, // FT hold by the user's wallet making use of Cardano foundation off-chain registry inner structure
ft: 333,
rft: 444, // RFT hold by the user's wallet making use of the union of CIP-0025 inner structure AND the Cardano foundation off-chain registry inner structure
};

@@ -96,2 +97,38 @@ const METADATA_SCHEME_MAP = {

},
rft: {
name: {
type: 'bytestring',
},
image: {
type: 'bytestring',
},
mediaType: {
type: 'bytestring',
optional: true,
},
description: {
type: 'bytestring',
optional: true,
},
decimals: {
type: 'number',
optional: true,
},
files: {
type: 'array',
optional: true,
items: {
name: {
type: 'bytestring',
optional: true,
},
mediaType: {
type: 'bytestring',
},
src: {
type: 'bytestring',
},
},
},
},
};

@@ -231,2 +268,3 @@ /**

const ftLabel = (0, exports.toLabel)(ASSET_NAME_LABELS.ft);
const rftLabel = (0, exports.toLabel)(ASSET_NAME_LABELS.rft);
// Build reference asset hex (policy_id|reference_label|name)

@@ -237,2 +275,3 @@ const assets = {

ft: buildAssetHex(assetParts.policyId, ftLabel, assetNameWithoutLabelPrefix),
rft: buildAssetHex(assetParts.policyId, rftLabel, assetNameWithoutLabelPrefix),
};

@@ -250,8 +289,8 @@ return assets;

return null;
const isFT = cip68Assets.ft === assetHex;
const isNFT = cip68Assets.nft === assetHex;
if (isFT || isNFT) {
const availableStandards = ['ft', 'nft', 'rft'];
const standard = availableStandards.find(s => cip68Assets[s] === assetHex);
if (standard) {
return {
hex: cip68Assets.reference_nft,
standard: isFT ? 'ft' : 'nft',
standard: standard,
};

@@ -258,0 +297,0 @@ }

@@ -129,3 +129,3 @@ "use strict";

// error.name is always "FastifyError", use error.code to provide more info to a client (eg. FST_ERR_CTP_INVALID_MEDIA_TYPE)
error: error.name,
error: error.name === 'FastifyError' ? 'error' : error.name,
message: error.message,

@@ -132,0 +132,0 @@ status_code: error.statusCode,

declare type BlockfrostNetwork = 'mainnet' | 'testnet' | 'preview' | 'preprod';
declare type SUPPORTED_PAYMENT_CRED_PREFIX = 'addr_vkh' | 'addr_vk' | 'script';
declare type PaymentCredPrefix = 'addr_vkh' | 'addr_vk' | 'script';
export declare const validateHex: (input: string) => boolean;

@@ -9,5 +9,5 @@ export declare const validateStakeAddress: (input: string, network: BlockfrostNetwork) => boolean;

paymentCred: string;
prefix: SUPPORTED_PAYMENT_CRED_PREFIX;
prefix: PaymentCredPrefix;
} | undefined;
export declare const paymentCredToBech32Address: (input: string, prefix: SUPPORTED_PAYMENT_CRED_PREFIX) => string | undefined;
export declare const paymentCredToBech32Address: (input: string, prefix: PaymentCredPrefix) => string | undefined;
export declare const detectAndValidateAddressType: (input: string, network: BlockfrostNetwork) => 'byron' | 'shelley' | undefined;

@@ -17,3 +17,3 @@ export declare const getAddressTypeAndPaymentCred: (address: string, network: BlockfrostNetwork) => {

paymentCred: string;
paymentCredPrefix: SUPPORTED_PAYMENT_CRED_PREFIX;
paymentCredPrefix: PaymentCredPrefix;
} | {

@@ -20,0 +20,0 @@ addressType: "byron" | "shelley" | undefined;

@@ -126,7 +126,2 @@ "use strict";

return bech32_1.bech32.encode(prefix, words);
case Prefixes.PAYMENT_KEY:
// Payment key was already converted to key hash, so we cannot restore the original key.
// We could supply orig via a parameter and then compare its hash to the input, but that's too much trouble.
// Due to the above return payment key hash (input) with addr_vkh prefix instead of the original addr_vk
return bech32_1.bech32.encode(Prefixes.PAYMENT_KEY_HASH, words);
default:

@@ -157,3 +152,2 @@ throw Error(`Prefix ${prefix} is not supported by paymentCredToBech32Address`);

else if (bech32Info.prefix === Prefixes.PAYMENT_KEY_HASH ||
bech32Info.prefix === Prefixes.PAYMENT_KEY ||
bech32Info.prefix === Prefixes.SCRIPT) {

@@ -160,0 +154,0 @@ // valid shelley - payment_cred

{
"name": "@blockfrost/blockfrost-utils",
"version": "2.4.1-beta.3",
"version": "2.5.0-beta.0",
"repository": "git@github.com:blockfrost/blockfrost-utils.git",

@@ -5,0 +5,0 @@ "license": "Apache-2.0",

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