Socket
Socket
Sign inDemoInstall

@marinade.finance/web3js-common

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@marinade.finance/web3js-common - npm Package Compare versions

Comparing version 2.4.4 to 2.4.5

10

package.json
{
"name": "@marinade.finance/web3js-common",
"version": "2.4.4",
"version": "2.4.5",
"description": "Web3 JS reusable utilities",

@@ -24,4 +24,4 @@ "repository": {

"devDependencies": {
"@marinade.finance/ts-common": "2.4.4",
"@solana/web3.js": "^1.91.1",
"@marinade.finance/ts-common": "2.4.5",
"@solana/web3.js": "^1.93.0",
"@solana/buffer-layout": "^4.0.1",

@@ -33,4 +33,4 @@ "bn.js": "^5.2.1",

"peerDependencies": {
"@marinade.finance/ts-common": "2.4.4",
"@solana/web3.js": "^1.91.1",
"@marinade.finance/ts-common": "2.4.5",
"@solana/web3.js": "^1.93.0",
"@solana/buffer-layout": "^4.0.1",

@@ -37,0 +37,0 @@ "bn.js": "^5.2.1",

@@ -7,2 +7,3 @@ import { Transaction, VersionedTransaction } from '@solana/web3.js';

readonly transaction?: Transaction | VersionedTransaction;
readonly transactionCauseError?: string;
constructor({ msg, txSignature, cause, logs, transaction, }: {

@@ -16,5 +17,7 @@ msg?: string;

messageWithCause(): string;
messageWithTransactionError(): string;
static fromMsg(msg: string): ExecutionError;
get [Symbol.toStringTag](): string;
static get [Symbol.species](): typeof ExecutionError;
private extractTransactionCauseError;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ExecutionError = void 0;
const web3_js_1 = require("@solana/web3.js");
class ExecutionError extends Error {

@@ -11,2 +12,3 @@ constructor({ msg, txSignature, cause, logs, transaction, }) {

this.transaction = transaction;
this.transactionCauseError = this.extractTransactionCauseError(cause);
// restore prototype chain

@@ -26,2 +28,8 @@ const actualProto = new.target.prototype;

}
messageWithTransactionError() {
const txCauseErrMessage = this.transactionCauseError
? '; transaction error: ' + this.transactionCauseError
: '';
return this.message + txCauseErrMessage;
}
static fromMsg(msg) {

@@ -36,4 +44,20 @@ return new ExecutionError({ msg });

}
extractTransactionCauseError(error) {
if (!error || !(error instanceof web3_js_1.SendTransactionError)) {
return undefined;
}
const text = error.message;
const errorNumberRegex = /Error Number: (\d+)/;
const errorMessageRegex = /Error Message: ([^.]+)/;
const errorNumberMatch = text.match(errorNumberRegex);
const errorMessageMatch = text.match(errorMessageRegex);
const result = errorMessageMatch
? errorMessageMatch[1].trim()
: undefined;
return errorNumberMatch
? `${result || ''} [err code: ${errorNumberMatch[1]}]`
: result;
}
}
exports.ExecutionError = ExecutionError;
//# sourceMappingURL=error.js.map

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

if (txResponse.err) {
throw new web3_js_1.SendTransactionError(txResponse.err, txResponse.logs || undefined);
throw new web3_js_1.SendTransactionError({
action: 'simulate',
signature: '',
transactionMessage: txResponse.err,
logs: (txResponse === null || txResponse === void 0 ? void 0 : txResponse.logs) || undefined,
});
}

@@ -112,5 +117,3 @@ }

cause: e,
logs: e.logs
? e.logs
: undefined,
logs: e.logs,
transaction: (0, ts_common_1.isLevelEnabled)(logger, 'debug') ? transaction : undefined,

@@ -117,0 +120,0 @@ });

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

BufferLayout.u8('commission'),
BufferLayout.nu64(),
BufferLayout.nu64(), // votes.length
BufferLayout.seq(BufferLayout.struct([

@@ -239,3 +239,3 @@ BufferLayout.nu64('slot'),

option(BufferLayout.nu64(), 'rootSlot'),
BufferLayout.nu64(),
BufferLayout.nu64(), // epochCredits.length
BufferLayout.seq(BufferLayout.struct([

@@ -252,3 +252,3 @@ BufferLayout.nu64('epoch'),

BufferLayout.u8('commission'),
BufferLayout.nu64(),
BufferLayout.nu64(), // votes.length
BufferLayout.seq(BufferLayout.struct([

@@ -259,3 +259,3 @@ BufferLayout.nu64('slot'),

option(BufferLayout.nu64(), 'rootSlot'),
BufferLayout.nu64(),
BufferLayout.nu64(), // authorizedVoters.length
BufferLayout.seq(BufferLayout.struct([

@@ -274,3 +274,3 @@ BufferLayout.nu64('epoch'),

], 'priorVoters'),
BufferLayout.nu64(),
BufferLayout.nu64(), // epochCredits.length
BufferLayout.seq(BufferLayout.struct([

@@ -287,3 +287,3 @@ BufferLayout.nu64('epoch'),

BufferLayout.u8('commission'),
BufferLayout.nu64(),
BufferLayout.nu64(), // votes.length
BufferLayout.seq(BufferLayout.struct([

@@ -295,3 +295,3 @@ BufferLayout.u8('latency'),

option(BufferLayout.nu64(), 'rootSlot'),
BufferLayout.nu64(),
BufferLayout.nu64(), // authorizedVoters.length
BufferLayout.seq(BufferLayout.struct([

@@ -310,3 +310,3 @@ BufferLayout.nu64('epoch'),

], 'priorVoters'),
BufferLayout.nu64(),
BufferLayout.nu64(), // epochCredits.length
BufferLayout.seq(BufferLayout.struct([

@@ -313,0 +313,0 @@ BufferLayout.nu64('epoch'),

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