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

@multiversx/sdk-core

Package Overview
Dependencies
Maintainers
10
Versions
102
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@multiversx/sdk-core - npm Package Compare versions

Comparing version 12.1.1 to 12.2.0

6

out/errors.d.ts

@@ -148,8 +148,2 @@ /**

/**
* Signals a usage error related to "contract.methods" vs. "contract.methodsExplicit".
*/
export declare class ErrTypeInferenceSystemRequiresRegularJavascriptObjects extends ErrTypingSystem {
constructor(index: number);
}
/**
* Signals a missing field on a struct.

@@ -156,0 +150,0 @@ */

15

out/errors.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ErrGasLimitShouldBe0ForInnerTransaction = exports.ErrInvalidRelayedV2BuilderArguments = exports.ErrInvalidRelayedV1BuilderArguments = exports.ErrNotImplemented = exports.ErrContractInteraction = exports.ErrCodec = exports.ErrCannotParseTransactionOutcome = exports.ErrCannotParseContractResults = exports.ErrMissingFieldOnEnum = exports.ErrMissingFieldOnStruct = exports.ErrTypeInferenceSystemRequiresRegularJavascriptObjects = exports.ErrTypingSystem = exports.ErrMock = exports.ErrContractHasNoAddress = exports.ErrContract = exports.ErrExpectedTransactionEventsNotFound = exports.ErrExpectedTransactionStatusNotReached = exports.ErrTransactionWatcherTimeout = exports.ErrAsyncTimerAborted = exports.ErrAsyncTimerAlreadyRunning = exports.ErrInvalidFunctionName = exports.ErrSignatureCannotCreate = exports.ErrTransactionOptionsInvalid = exports.ErrTransactionVersionInvalid = exports.ErrNonceInvalid = exports.ErrNotEnoughGas = exports.ErrAddressEmpty = exports.ErrAddressBadHrp = exports.ErrAddressCannotCreate = exports.ErrUnexpectedCondition = exports.ErrInvariantFailed = exports.ErrBadType = exports.ErrUnsupportedOperation = exports.ErrInvalidArgument = exports.Err = void 0;
exports.ErrGasLimitShouldBe0ForInnerTransaction = exports.ErrInvalidRelayedV2BuilderArguments = exports.ErrInvalidRelayedV1BuilderArguments = exports.ErrNotImplemented = exports.ErrContractInteraction = exports.ErrCodec = exports.ErrCannotParseTransactionOutcome = exports.ErrCannotParseContractResults = exports.ErrMissingFieldOnEnum = exports.ErrMissingFieldOnStruct = exports.ErrTypingSystem = exports.ErrMock = exports.ErrContractHasNoAddress = exports.ErrContract = exports.ErrExpectedTransactionEventsNotFound = exports.ErrExpectedTransactionStatusNotReached = exports.ErrTransactionWatcherTimeout = exports.ErrAsyncTimerAborted = exports.ErrAsyncTimerAlreadyRunning = exports.ErrInvalidFunctionName = exports.ErrSignatureCannotCreate = exports.ErrTransactionOptionsInvalid = exports.ErrTransactionVersionInvalid = exports.ErrNonceInvalid = exports.ErrNotEnoughGas = exports.ErrAddressEmpty = exports.ErrAddressBadHrp = exports.ErrAddressCannotCreate = exports.ErrUnexpectedCondition = exports.ErrInvariantFailed = exports.ErrBadType = exports.ErrUnsupportedOperation = exports.ErrInvalidArgument = exports.Err = void 0;
/**

@@ -238,15 +238,2 @@ * The base class for exceptions (errors).

/**
* Signals a usage error related to "contract.methods" vs. "contract.methodsExplicit".
*/
class ErrTypeInferenceSystemRequiresRegularJavascriptObjects extends ErrTypingSystem {
constructor(index) {
super(`
argument at position ${index} seems to be a TypedValue. The automatic type inference system requires regular javascript objects as input.
This error might occur when you pass a TypedValue to contract.methods.myFunction([...]). For passing TypedValues instead of regular javascript objects, and bypass the automatic type inference system, use contract.methodsExplicit.myFunction([...]) instead.
Also see https://github.com/multiversx/mx-sdk-js-core/pull/187.
`);
}
}
exports.ErrTypeInferenceSystemRequiresRegularJavascriptObjects = ErrTypeInferenceSystemRequiresRegularJavascriptObjects;
/**
* Signals a missing field on a struct.

@@ -253,0 +240,0 @@ */

4

out/smartcontracts/nativeSerializer.d.ts
/// <reference types="node" />
import { IAddress } from "../interface";
import { ArgumentErrorContext } from "./argumentErrorContext";
import { EndpointDefinition, TypedValue } from "./typesystem";
import { ArgumentErrorContext } from "./argumentErrorContext";
import { IAddress } from "../interface";
export declare namespace NativeTypes {

@@ -6,0 +6,0 @@ type NativeBuffer = Buffer | string;

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

const bignumber_js_1 = __importDefault(require("bignumber.js"));
const typesystem_1 = require("./typesystem");
const argumentErrorContext_1 = require("./argumentErrorContext");
const typesystem_2 = require("./typesystem");
const address_1 = require("../address");
const errors_1 = require("../errors");
const utils_codec_1 = require("../utils.codec");
const argumentErrorContext_1 = require("./argumentErrorContext");
const typesystem_1 = require("./typesystem");
var NativeSerializer;

@@ -22,3 +21,2 @@ (function (NativeSerializer) {

args = args || [];
assertNotTypedValues(args);
args = handleVariadicArgsAndRePack(args, endpoint);

@@ -36,10 +34,2 @@ let parameters = endpoint.input;

NativeSerializer.nativeToTypedValues = nativeToTypedValues;
function assertNotTypedValues(args) {
for (let i = 0; i < args.length; i++) {
let arg = args[i];
if (arg && arg.belongsToTypesystem) {
throw new errors_1.ErrTypeInferenceSystemRequiresRegularJavascriptObjects(i);
}
}
}
function handleVariadicArgsAndRePack(args, endpoint) {

@@ -52,5 +42,14 @@ let parameters = endpoint.input;

if (variadic) {
let lastArgIndex = parameters.length - 1;
let lastArg = args.slice(lastArgIndex);
args[lastArgIndex] = lastArg;
const lastEndpointParamIndex = parameters.length - 1;
const argAtIndex = args[lastEndpointParamIndex];
if (argAtIndex.belongsToTypesystem) {
const isVariadicValue = argAtIndex.hasClassOrSuperclass(typesystem_1.VariadicValue.ClassName);
if (!isVariadicValue) {
throw new errors_1.ErrInvalidArgument(`Wrong argument type for endpoint ${endpoint.name}: typed value provided; expected variadic type, have ${argAtIndex.getClassName()}`);
}
// Do not repack.
}
else {
args[lastEndpointParamIndex] = args.slice(lastEndpointParamIndex);
}
}

@@ -80,26 +79,30 @@ return args;

}
function convertToTypedValue(native, type, errorContext) {
function convertToTypedValue(value, type, errorContext) {
if (value && value.belongsToTypesystem) {
// Value is already typed, no need to convert it.
return value;
}
if (type instanceof typesystem_1.OptionType) {
return toOptionValue(native, type, errorContext);
return toOptionValue(value, type, errorContext);
}
if (type instanceof typesystem_1.OptionalType) {
return toOptionalValue(native, type, errorContext);
return toOptionalValue(value, type, errorContext);
}
if (type instanceof typesystem_1.VariadicType) {
return toVariadicValue(native, type, errorContext);
return toVariadicValue(value, type, errorContext);
}
if (type instanceof typesystem_1.CompositeType) {
return toCompositeValue(native, type, errorContext);
return toCompositeValue(value, type, errorContext);
}
if (type instanceof typesystem_1.TupleType) {
return toTupleValue(native, type, errorContext);
return toTupleValue(value, type, errorContext);
}
if (type instanceof typesystem_2.StructType) {
return toStructValue(native, type, errorContext);
if (type instanceof typesystem_1.StructType) {
return toStructValue(value, type, errorContext);
}
if (type instanceof typesystem_1.ListType) {
return toListValue(native, type, errorContext);
return toListValue(value, type, errorContext);
}
if (type instanceof typesystem_1.PrimitiveType) {
return toPrimitive(native, type, errorContext);
return toPrimitive(value, type, errorContext);
}

@@ -159,3 +162,3 @@ errorContext.throwError(`convertToTypedValue: unhandled type ${type}`);

}
return typesystem_2.Tuple.fromItems(typedValues);
return typesystem_1.Tuple.fromItems(typedValues);
}

@@ -170,5 +173,5 @@ function toStructValue(native, type, errorContext) {

const fieldTypedValue = convertToTypedValue(fieldNativeValue, fields[i].type, errorContext);
structFieldValues.push(new typesystem_2.Field(fieldTypedValue, fieldName));
structFieldValues.push(new typesystem_1.Field(fieldTypedValue, fieldName));
}
return new typesystem_2.Struct(type, structFieldValues);
return new typesystem_1.Struct(type, structFieldValues);
}

@@ -194,2 +197,3 @@ function toPrimitive(native, type, errorContext) {

}
// TODO: move logic to typesystem/bytes.ts
function convertNativeToBytesValue(native, errorContext) {

@@ -214,2 +218,3 @@ const innerValue = native.valueOf();

}
// TODO: move logic to typesystem/string.ts
function convertNativeToString(native, errorContext) {

@@ -227,2 +232,3 @@ if (native === undefined) {

}
// TODO: move logic to typesystem/address.ts
function convertNativeToAddress(native, errorContext) {

@@ -244,2 +250,3 @@ if (native.bech32) {

NativeSerializer.convertNativeToAddress = convertNativeToAddress;
// TODO: move logic to typesystem/numerical.ts
function convertNumericalType(number, type, errorContext) {

@@ -246,0 +253,0 @@ switch (type.constructor) {

@@ -1,5 +0,4 @@

import { Struct } from "./struct";
import { Field } from "./fields";
import { Struct, StructType } from "./struct";
import { Type, TypedValue } from "./types";
import { StructType } from "./struct";
export declare class TupleType extends StructType {

@@ -6,0 +5,0 @@ static ClassName: string;

@@ -24,6 +24,5 @@ "use strict";

const errors = __importStar(require("../../errors"));
const fields_1 = require("./fields");
const struct_1 = require("./struct");
const fields_1 = require("./fields");
const struct_2 = require("./struct");
class TupleType extends struct_2.StructType {
class TupleType extends struct_1.StructType {
constructor(...typeParameters) {

@@ -37,3 +36,3 @@ super(TupleType.prepareName(typeParameters), TupleType.prepareFieldDefinitions(typeParameters));

let fields = typeParameters.map(type => type.toString()).join(", ");
let result = `tuple${fields.length}<${fields}>`;
let result = `tuple<${fields}>`;
return result;

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

{
"name": "@multiversx/sdk-core",
"version": "12.1.1",
"version": "12.2.0",
"description": "MultiversX SDK for JavaScript and TypeScript",

@@ -5,0 +5,0 @@ "main": "out/index.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

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