Socket
Socket
Sign inDemoInstall

@metaplex-foundation/amman

Package Overview
Dependencies
Maintainers
4
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@metaplex-foundation/amman - npm Package Compare versions

Comparing version 0.3.1 to 0.3.2

7

dist/cli/utils/solana-logs.js

@@ -30,4 +30,7 @@ "use strict";

async function logLine(logger, line) {
const { newLogs, newTransaction } = await logger.addLine(line, null, programs_1.Cluster.Amman);
if (newTransaction) {
const { newLogs, newInstruction, newOuterInstruction } = await logger.addLine(line, null, programs_1.Cluster.Amman);
if (newOuterInstruction) {
console.log(ansi_colors_1.default.dim('\n--------------------------------'));
}
if (newInstruction) {
console.log('');

@@ -34,0 +37,0 @@ }

@@ -34,2 +34,4 @@ import { Keypair, PublicKey, Signer } from '@solana/web3.js';

* Adds the provided label for the provided key.
* If the label collides with an existing label, for a different key it will
* be suffixed with a number.
*/

@@ -39,2 +41,4 @@ addLabel: AddLabel;

* Adds labels for all {@link KeyLike}s it finds on the provided object
* If the label collides with an existing label, for a different key it will
* be suffixed with a number.
*/

@@ -109,2 +113,3 @@ addLabels: AddLabels;

private _findAndResolveKeypairs;
private _nonCollidingLabel;
private static _instance;

@@ -111,0 +116,0 @@ static setInstance(knownLabels: Record<string, string>, logLabel?: (msg: string) => void, ammanClient?: AmmanClient): AddressLabels;

@@ -29,2 +29,4 @@ "use strict";

* Adds the provided label for the provided key.
* If the label collides with an existing label, for a different key it will
* be suffixed with a number.
*/

@@ -35,2 +37,3 @@ this.addLabel = async (label, key) => {

return this;
label = this._nonCollidingLabel((0, address_label_mapper_1.mapLabel)(label), keyString);
this.logLabel(`🔑 ${label}: ${keyString}`);

@@ -43,2 +46,4 @@ this.knownLabels[keyString] = label;

* Adds labels for all {@link KeyLike}s it finds on the provided object
* If the label collides with an existing label, for a different key it will
* be suffixed with a number.
*/

@@ -48,8 +53,9 @@ this.addLabels = async (obj) => {

const labels = {};
for (const [label, key] of Object.entries(obj)) {
for (let [label, key] of Object.entries(obj)) {
if (typeof label === 'string' && (0, keys_1.isKeyLike)(key)) {
const keyString = (0, keys_1.publicKeyString)(key);
if ((0, utils_1.isValidSolanaAddress)(keyString)) {
label = this._nonCollidingLabel((0, address_label_mapper_1.mapLabel)(label), keyString);
labels[keyString] = label;
this.knownLabels[keyString] = label;
labels[keyString] = (0, address_label_mapper_1.mapLabel)(label);
this.logLabel(`🔑 ${label}: ${keyString}`);

@@ -209,4 +215,4 @@ }

for (let i = 0; i < labels.length; i++) {
const address = addresses[i];
const label = labels[i];
const address = addresses[i];
acc[label] = address.value;

@@ -229,2 +235,20 @@ }

}
_nonCollidingLabel(label, address) {
// We are actually trying to re-label a key that we labeled before
if (this.knownLabels[address] != null) {
return label;
}
// It's a new key, so we'll make sure that we tweak the label such that
// two different keys won't have the same label
const labels = new Set(Object.values(this.knownLabels));
if (!labels.has(label))
return label;
let i = 0;
do {
i++;
const indexedLabel = `${label}-${i}`;
if (!labels.has(indexedLabel))
return indexedLabel;
} while (true);
}
static setInstance(knownLabels, logLabel, ammanClient) {

@@ -231,0 +255,0 @@ if (AddressLabels._instance != null) {

@@ -26,5 +26,6 @@ import { TransactionError } from '@solana/web3.js';

newLogs: LogMessage[];
newTransaction: boolean;
newInstruction: boolean;
newOuterInstruction: boolean;
}>;
prettyProgramLabel(programAddress: string, cluster: Cluster): Promise<string>;
}

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

const newLogs = [];
let newTransaction = false;
let newInstruction = false;
let newOuterInstruction = false;
const prefixBuilder = (depth) => {

@@ -45,3 +46,2 @@ const prefix = new Array(depth - 1).fill('\u00A0\u00A0').join('');

if (txExecutedRx.test(line)) {
newTransaction = true;
this.resetCount();

@@ -75,2 +75,6 @@ }

else {
if (this.depth <= 1) {
newOuterInstruction = true;
}
newInstruction = true;
const log = {

@@ -153,3 +157,4 @@ prefix: prefixBuilder(this.depth),

newLogs,
newTransaction,
newInstruction,
newOuterInstruction,
};

@@ -156,0 +161,0 @@ }

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

}
socket.emit(consts_1.MSG_UPDATE_ACCOUNT_INFO, {
socket.broadcast.emit(consts_1.MSG_UPDATE_ACCOUNT_INFO, {
accountAddress,

@@ -67,0 +67,0 @@ accountInfo: { pretty, rendered },

{
"name": "@metaplex-foundation/amman",
"version": "0.3.1",
"version": "0.3.2",
"description": "A modern mandatory toolbelt to help test solana SDK libraries and apps on a locally running validator.",

@@ -5,0 +5,0 @@ "main": "dist/amman.js",

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