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

banano-nft-crawler

Package Overview
Dependencies
Maintainers
1
Versions
36
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

banano-nft-crawler - npm Package Compare versions

Comparing version 1.0.9 to 1.0.10

dist/account-data-type.d.ts

2

dist/src/account-data-type.js

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

// Match against hex patterns for encoded data.
var publicKeyHex = get_banano_account_public_key_1.getBananoAccountPublicKey(account);
var publicKeyHex = (0, get_banano_account_public_key_1.getBananoAccountPublicKey)(account);
if (publicKeyHex.match(constants_1.SUPPLY_HEX_PATTERN)) {

@@ -19,0 +19,0 @@ return "supply";

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

else {
throw Error("MintBlockError: Unexpected mint block subtype: " + _mintBlock.subtype + ". Expected 'send' or 'change'");
throw Error("MintBlockError: Unexpected mint block subtype: ".concat(_mintBlock.subtype, ". Expected 'send' or 'change'"));
}

@@ -73,0 +73,0 @@ return [2 /*return*/];

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

var representative = block.representative;
var atomicSwapConditions = atomic_swap_1.parseAtomicSwapRepresentative(representative);
var atomicSwapConditions = (0, atomic_swap_1.parseAtomicSwapRepresentative)(representative);
var ownershipBlockHeight = BigInt(assetCrawler.frontier.nanoBlock.height);

@@ -143,0 +143,0 @@ var attemptTradeWithSelf = payingAccount == ownerAccount;

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

recipient = assetCrawler.frontier.owner;
return [4 /*yield*/, find_receive_block_1.findReceiveBlock(nanoNode, sender, sendBlockHash, recipient)];
return [4 /*yield*/, (0, find_receive_block_1.findReceiveBlock)(nanoNode, sender, sendBlockHash, recipient)];
case 1:

@@ -58,0 +58,0 @@ receiveBlock = _a.sent();

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

paymentHeight = BigInt(assetCrawler.frontier.nanoBlock.height) + BigInt(1);
return [4 /*yield*/, find_block_at_height_and_previous_block_1.findBlockAtHeightAndPreviousBlock(nanoNode, payingAccount, paymentHeight)];
return [4 /*yield*/, (0, find_block_at_height_and_previous_block_1.findBlockAtHeightAndPreviousBlock)(nanoNode, payingAccount, paymentHeight)];
case 1:

@@ -69,3 +69,3 @@ _a = _b.sent(), previousBlock = _a[0], nextBlock = _a[1];

if (sendAtomicSwap.state !== 'atomic_swap_receivable') {
throw Error("UnexpectedMetaChain: Expected states of the chain to be pending_atomic_swap -> pending_payment -> ... Got: " + sendAtomicSwap.state + " -> " + assetCrawler.frontier.state + " -> ...");
throw Error("UnexpectedMetaChain: Expected states of the chain to be pending_atomic_swap -> pending_payment -> ... Got: ".concat(sendAtomicSwap.state, " -> ").concat(assetCrawler.frontier.state, " -> ..."));
}

@@ -93,6 +93,6 @@ // NB: Trace length from findBlockAtHeight might be significantly larger than 1.

case "change":
type = nextBlock.subtype + "#abort_payment";
type = "".concat(nextBlock.subtype, "#abort_payment");
break;
default:
throw Error("UnexpectedBlockSubtype: Pending atomic swap got unexpected block subtype: " + nextBlock.subtype + " with block hash: " + nextBlock.hash);
throw Error("UnexpectedBlockSubtype: Pending atomic swap got unexpected block subtype: ".concat(nextBlock.subtype, " with block hash: ").concat(nextBlock.hash));
}

@@ -99,0 +99,0 @@ assetCrawler.assetChain.push({

@@ -52,6 +52,6 @@ "use strict";

representative = sendAtomicSwap.nanoBlock.representative;
atomicSwapConditions = atomic_swap_1.parseAtomicSwapRepresentative(representative);
atomicSwapConditions = (0, atomic_swap_1.parseAtomicSwapRepresentative)(representative);
// guard
if (typeof atomicSwapConditions === 'undefined') {
throw Error("AtomicSwapError: Unable to parse conditions for representative: " + sendAtomicSwap.nanoBlock.representative);
throw Error("AtomicSwapError: Unable to parse conditions for representative: ".concat(sendAtomicSwap.nanoBlock.representative));
}

@@ -62,3 +62,3 @@ payerAccount = sendAtomicSwap.account;

assetCrawler.traceLength += BigInt(1);
return [4 /*yield*/, find_block_at_height_and_previous_block_1.findBlockAtHeightAndPreviousBlock(nanoNode, payerAccount, atomicSwapConditions.receiveHeight)];
return [4 /*yield*/, (0, find_block_at_height_and_previous_block_1.findBlockAtHeightAndPreviousBlock)(nanoNode, payerAccount, atomicSwapConditions.receiveHeight)];
case 1:

@@ -65,0 +65,0 @@ blocks = _a.sent();

@@ -69,5 +69,5 @@ "use strict";

}
throw Error("Unabled to find atomic_swap_receivable for asset: " + assetChain[0].nanoBlock.hash);
throw Error("Unabled to find atomic_swap_receivable for asset: ".concat(assetChain[0].nanoBlock.hash));
;
}
//# sourceMappingURL=return-to-nft-seller.js.map

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

if (!(!this._assetChain || this._assetChain.length === 0)) return [3 /*break*/, 2];
return [4 /*yield*/, mint_1.assetMintCrawl(nanoNode, this, this._mintBlock).catch(function (error) { throw (error); })];
return [4 /*yield*/, (0, mint_1.assetMintCrawl)(nanoNode, this, this._mintBlock).catch(function (error) { throw (error); })];
case 1:

@@ -112,3 +112,3 @@ _a.sent();

case 1: return [2 /*return*/, _a.sent()];
case 2: throw Error("UnhandledAssetState: \"" + this.frontier.state + "\" was not handled for block: " + this.frontier.nanoBlock.hash);
case 2: throw Error("UnhandledAssetState: \"".concat(this.frontier.state, "\" was not handled for block: ").concat(this.frontier.nanoBlock.hash));
}

@@ -128,3 +128,3 @@ });

var atomicSwapRepresentative = sendAtomicSwap.nanoBlock.representative;
var atomicSwapConditions = atomic_swap_1.parseAtomicSwapRepresentative(atomicSwapRepresentative);
var atomicSwapConditions = (0, atomic_swap_1.parseAtomicSwapRepresentative)(atomicSwapRepresentative);
return atomicSwapConditions;

@@ -131,0 +131,0 @@ };

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

if (delegation === void 0) { delegation = false; }
var atomicSwapHex = get_banano_account_public_key_1.getBananoAccountPublicKey(representative);
var atomicSwapHex = (0, get_banano_account_public_key_1.getBananoAccountPublicKey)(representative);
var hexPattern = delegation ? constants_1.ATOMIC_SWAP_DELEGATION_HEX_PATTERN : constants_1.ATOMIC_SWAP_HEX_PATTERN;

@@ -14,5 +14,5 @@ var match = atomicSwapHex.match(hexPattern);

return {
assetHeight: BigInt("0x" + match.groups.assetHeight),
receiveHeight: BigInt("0x" + match.groups.receiveHeight),
minRaw: BigInt("0x" + match.groups.minRaw)
assetHeight: BigInt("0x".concat(match.groups.assetHeight)),
receiveHeight: BigInt("0x".concat(match.groups.receiveHeight)),
minRaw: BigInt("0x".concat(match.groups.minRaw))
};

@@ -19,0 +19,0 @@ }

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

function parseSupplyRepresentative(representative) {
var supplyHex = get_banano_account_public_key_1.getBananoAccountPublicKey(representative);
var supplyHex = (0, get_banano_account_public_key_1.getBananoAccountPublicKey)(representative);
var match = supplyHex.match(constants_1.SUPPLY_HEX_PATTERN);

@@ -13,7 +13,7 @@ if (!match) {

}
var major = BigInt("0x" + match.groups.major).toString(10);
var minor = BigInt("0x" + match.groups.minor).toString(10);
var patch = BigInt("0x" + match.groups.patch).toString(10);
var version = major + "." + minor + "." + patch;
var maxSupply = BigInt("0x" + match.groups.maxSupply);
var major = BigInt("0x".concat(match.groups.major)).toString(10);
var minor = BigInt("0x".concat(match.groups.minor)).toString(10);
var patch = BigInt("0x".concat(match.groups.patch)).toString(10);
var version = "".concat(major, ".").concat(minor, ".").concat(patch);
var maxSupply = BigInt("0x".concat(match.groups.maxSupply));
return {

@@ -26,3 +26,3 @@ version: version,

function parseFinishSupplyRepresentative(representative) {
var finishSupplyHex = get_banano_account_public_key_1.getBananoAccountPublicKey(representative);
var finishSupplyHex = (0, get_banano_account_public_key_1.getBananoAccountPublicKey)(representative);
var match = finishSupplyHex.match(constants_1.FINISH_SUPPLY_HEX_PATTERN);

@@ -32,5 +32,5 @@ if (!match) {

}
return { supplyBlockHeight: BigInt("0x" + match.groups.supplyBlockHeight) };
return { supplyBlockHeight: BigInt("0x".concat(match.groups.supplyBlockHeight)) };
}
exports.parseFinishSupplyRepresentative = parseFinishSupplyRepresentative;
//# sourceMappingURL=supply.js.map

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

exports.META_PROTOCOL_PATCH = BigInt('0');
exports.META_PROTOCOL_VERSION = exports.META_PROTOCOL_MAJOR + "." + exports.META_PROTOCOL_MINOR + "." + exports.META_PROTOCOL_PATCH;
exports.META_PROTOCOL_VERSION = "".concat(exports.META_PROTOCOL_MAJOR, ".").concat(exports.META_PROTOCOL_MINOR, ".").concat(exports.META_PROTOCOL_PATCH);
exports.META_PROTOCOL_SUPPORTED_VERSIONS = ["1.0.0"];

@@ -22,10 +22,10 @@ // Settings

exports.ATOMIC_SWAP_HEADER = "23559C159E22C"; // must be 13 chars
exports.ATOMIC_SWAP_HEX_PATTERN = RegExp("^" + exports.ATOMIC_SWAP_HEADER + "(?<assetHeight>[0-9A-F]{10})(?<receiveHeight>[0-9A-F]{10})(?<minRaw>[0-9A-F]{31})$", "i");
exports.ATOMIC_SWAP_HEX_PATTERN = RegExp("^".concat(exports.ATOMIC_SWAP_HEADER, "(?<assetHeight>[0-9A-F]{10})(?<receiveHeight>[0-9A-F]{10})(?<minRaw>[0-9A-F]{31})$"), "i");
exports.ATOMIC_SWAP_DELEGATION_HEADER = "A3559C159E22C"; // must be 13 chars
exports.ATOMIC_SWAP_DELEGATION_HEX_PATTERN = RegExp("^" + exports.ATOMIC_SWAP_DELEGATION_HEADER + "(?<assetHeight>[0-9A-F]{10})(?<receiveHeight>[0-9A-F]{10})(?<minRaw>[0-9A-F]{31})$", "i");
exports.ATOMIC_SWAP_DELEGATION_HEX_PATTERN = RegExp("^".concat(exports.ATOMIC_SWAP_DELEGATION_HEADER, "(?<assetHeight>[0-9A-F]{10})(?<receiveHeight>[0-9A-F]{10})(?<minRaw>[0-9A-F]{31})$"), "i");
// https://github.com/Airtune/73-meta-tokens/blob/main/meta_ledger_protocol/supply_block.md
exports.SUPPLY_HEX_HEADER = "51BACEED6078000000"; // must be 18 char hex
exports.SUPPLY_HEX_PATTERN = RegExp("^" + exports.SUPPLY_HEX_HEADER + "(?<major>[0-9A-F]{10})(?<minor>[0-9A-F]{10})(?<patch>[0-9A-F]{10})(?<maxSupply>[0-9A-F]{16})$", "i");
exports.SUPPLY_HEX_PATTERN = RegExp("^".concat(exports.SUPPLY_HEX_HEADER, "(?<major>[0-9A-F]{10})(?<minor>[0-9A-F]{10})(?<patch>[0-9A-F]{10})(?<maxSupply>[0-9A-F]{16})$"), "i");
exports.FINISH_SUPPLY_HEX_HEADER = "3614865E0051BA0033BB581E"; // must be 24 char hex
exports.FINISH_SUPPLY_HEX_PATTERN = RegExp("^" + exports.FINISH_SUPPLY_HEX_HEADER + "(?<supplyBlockHeight>[0-9A-F]{40})$", "i");
exports.FINISH_SUPPLY_HEX_PATTERN = RegExp("^".concat(exports.FINISH_SUPPLY_HEX_HEADER, "(?<supplyBlockHeight>[0-9A-F]{40})$"), "i");
// Representative used to cancel NFT supply block with a change block in place of the first mint block.

@@ -32,0 +32,0 @@ exports.CANCEL_SUPPLY_REPRESENTATIVE = 'ban_1nftsupp1ycance1111oops1111that1111was1111my1111bad1hq5sjhey';

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

if (!this.parseSupplyBlock(block)) {
throw Error("SupplyBlockError: Unable to parse supply block: " + block.hash);
throw Error("SupplyBlockError: Unable to parse supply block: ".concat(block.hash));
}

@@ -96,3 +96,3 @@ }

;
validate_mint_block_1.validateMintBlock(block);
(0, validate_mint_block_1.validateMintBlock)(block);
this.parseFirstMint(block);

@@ -103,3 +103,3 @@ this._mintBlocks.push(block);

try {
validate_mint_block_1.validateMintBlock(block);
(0, validate_mint_block_1.validateMintBlock)(block);
this._mintBlocks.push(block);

@@ -184,3 +184,3 @@ }

MintBlocksCrawler.prototype.parseSupplyBlock = function (block) {
var supplyData = supply_1.parseSupplyRepresentative(block.representative);
var supplyData = (0, supply_1.parseSupplyRepresentative)(block.representative);
if (!supplyData) {

@@ -197,3 +197,3 @@ return false;

MintBlocksCrawler.prototype.parseFinishSupplyBlock = function (block) {
var finishSupplyData = supply_1.parseFinishSupplyRepresentative(block.representative);
var finishSupplyData = (0, supply_1.parseFinishSupplyRepresentative)(block.representative);
if (!finishSupplyData) {

@@ -200,0 +200,0 @@ return false;

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

// Mint block representative must not be special accounts or contain a data encoding header.
if (account_data_type_1.accountDataType(followedByBlock.representative) !== "unknown") {
if ((0, account_data_type_1.accountDataType)(followedByBlock.representative) !== "unknown") {
return false;

@@ -140,3 +140,3 @@ }

// Check if representative is a parsable supply_representative with a supported version
var supplyData = supply_1.parseSupplyRepresentative(block.representative);
var supplyData = (0, supply_1.parseSupplyRepresentative)(block.representative);
if (!supplyData) {

@@ -143,0 +143,0 @@ return false;

@@ -9,9 +9,9 @@ "use strict";

var representative = block.representative;
var representativeType = account_data_type_1.accountDataType(representative);
var representativeType = (0, account_data_type_1.accountDataType)(representative);
if (representativeType !== "unknown") {
throw Error("UnexpectedMintRepresentative: Expected representative to encode IPFS CID. Got type: " + representativeType + " for " + representative);
throw Error("UnexpectedMintRepresentative: Expected representative to encode IPFS CID. Got type: ".concat(representativeType, " for ").concat(representative));
}
var representativeHex = bananojs.getAccountPublicKey(representative);
if (representativeHex.match(constants_1.SUPPLY_HEX_PATTERN)) {
throw Error("MintBlockError: Expected metadataRepresentative encoded from IPFS CID. Got nftSupplyRepresentative: " + representative);
throw Error("MintBlockError: Expected metadataRepresentative encoded from IPFS CID. Got nftSupplyRepresentative: ".concat(representative));
}

@@ -31,9 +31,9 @@ }

case 'epoch':
throw Error("MintBlockError: Unexpected block subtype. Expected 'send' or 'change'. Got: '" + mintBlock.subtype + "' for block: " + mintBlock.hash);
throw Error("MintBlockError: Unexpected block subtype. Expected 'send' or 'change'. Got: '".concat(mintBlock.subtype, "' for block: ").concat(mintBlock.hash));
default:
throw Error("MintBlockError: Unknown block subtype. Expected 'send' or 'change'. Got: " + mintBlock.subtype + " for block: " + mintBlock.hash);
throw Error("MintBlockError: Unknown block subtype. Expected 'send' or 'change'. Got: ".concat(mintBlock.subtype, " for block: ").concat(mintBlock.hash));
}
}
else {
throw Error("MintBlockError: Unexpected block type. Expected 'state'. Got: '" + mintBlock.type + "' for block: " + mintBlock.hash);
throw Error("MintBlockError: Unexpected block type. Expected 'state'. Got: '".concat(mintBlock.type, "' for block: ").concat(mintBlock.hash));
}

@@ -40,0 +40,0 @@ }

{
"name": "banano-nft-crawler",
"version": "1.0.9",
"version": "1.0.10",
"description": "Library for crawling across the Banano ledger to trace NFTs.",
"type": "module",
"main": "./dist/index.js",
"types": "./dist/index.d.ts",
"files": [

@@ -14,3 +11,3 @@ "dist/**/*.*",

"build": "npx tsc --build tsconfig.json",
"test": "mocha --require ts-node/register ./test/**/*.ts",
"test": "mocha --require ts-node/register ./test/*.spec.ts",
"testSupplyBlocksCrawler": "mocha --require ts-node/register ./test/supply-blocks-crawler.spec.ts",

@@ -23,4 +20,5 @@ "testMintBlocksCrawler": "mocha --require ts-node/register ./test/mint-blocks-crawler.spec.ts",

"dependencies": {
"@bananocoin/bananojs": "^2.4.26",
"nano-account-crawler": "^1.0.18",
"@bananocoin/bananojs": "^2.6.2",
"chai-as-promised": "^7.1.1",
"nano-account-crawler": "^1.0.19",
"nano-ipfs": "^1.0.4",

@@ -30,7 +28,6 @@ "node-fetch": "^2.6.1"

"devDependencies": {
"@types/mocha": "^9.0.0",
"@types/node": "^16.4.8",
"chai": "^4.3.4",
"chai-as-promised": "^7.1.1",
"mocha": "^9.0.3",
"@types/mocha": "^9.1.0",
"@types/node": "^16.11.26",
"chai": "^4.3.6",
"mocha": "^9.2.2",
"ts-node": "^10.1.0",

@@ -37,0 +34,0 @@ "typescript": "^4.3.5"

@@ -57,3 +57,3 @@ // Version for on-chain protocol

import * as bananojs from "@bananocoin/bananojs";
const bananojs = require("@bananocoin/bananojs");
// throws error on invalid checksum

@@ -60,0 +60,0 @@ bananojs.getAccountPublicKey(CANCEL_SUPPLY_REPRESENTATIVE);

@@ -1,2 +0,2 @@

import * as bananojs from "@bananocoin/bananojs";
const bananojs = require("@bananocoin/bananojs");
import { NanoIpfs } from 'nano-ipfs';

@@ -3,0 +3,0 @@

import { TAccount, TBlockHash, TPublicKey } from "../types/banano";
import * as bananojs from "@bananocoin/bananojs";
const bananojs = require("@bananocoin/bananojs");

@@ -4,0 +4,0 @@ export const getBananoAccountPublicKey = (account: TAccount): TPublicKey => {

@@ -1,2 +0,2 @@

import * as bananojs from "@bananocoin/bananojs";
const bananojs = require("@bananocoin/bananojs");
import { SUPPLY_HEX_PATTERN } from "./constants";

@@ -3,0 +3,0 @@ import { accountDataType } from "./account-data-type";

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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