Socket
Socket
Sign inDemoInstall

@taquito/michelson-encoder

Package Overview
Dependencies
Maintainers
3
Versions
199
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@taquito/michelson-encoder - npm Package Compare versions

Comparing version 12.1.1 to 13.0.0-beta-RC.0

dist/lib/tokens/comparable/tx_rollup_l2_address.js

43

dist/lib/schema/storage.js

@@ -21,12 +21,13 @@ "use strict";

}
if (val.prim === prim && val.args && val.args.length > 2) {
return Object.assign(Object.assign({}, val), { args: [
(_b = val.args) === null || _b === void 0 ? void 0 : _b[0],
const extended = val;
if (extended.prim === prim && extended.args && extended.args.length > 2) {
return Object.assign(Object.assign({}, extended), { args: [
(_b = extended.args) === null || _b === void 0 ? void 0 : _b[0],
{
prim: prim,
args: (_c = val.args) === null || _c === void 0 ? void 0 : _c.slice(1),
args: (_c = extended.args) === null || _c === void 0 ? void 0 : _c.slice(1),
},
] });
}
return val;
return extended;
}

@@ -41,3 +42,3 @@ function deepEqual(a, b) {

ac.args.length === bc.args.length &&
ac.args.every((v, i) => { var _b; return deepEqual(v, (_b = bc.args) === null || _b === void 0 ? void 0 : _b[i]); }))) &&
ac.args.every((v, i) => { var _b, _c; return deepEqual(v, (_c = (_b = bc.args) === null || _b === void 0 ? void 0 : _b[i]) !== null && _c !== void 0 ? _c : {}); }))) &&
((ac.annots === undefined && bc.annots === undefined) ||

@@ -74,3 +75,17 @@ (ac.annots !== undefined &&

Array.isArray(val.script.code) &&
val.script.code.find((x) => x.prim === 'storage');
val.script.code.find((x) => {
if (!Array.isArray(x)) {
const checkExtended = x;
if (checkExtended.prim) {
return checkExtended.prim === 'storage';
}
else {
return false;
}
}
else {
// storage passed along as original storage value
this.fromRPCResponse({ script: { code: x, storage: val.script.storage } });
}
});
if (!storage || !Array.isArray(storage.args)) {

@@ -185,2 +200,3 @@ throw new error_1.InvalidRpcResponseError(val.script);

}
// TODO check these type casts
findValue(schema, storage, valueToFind) {

@@ -190,10 +206,13 @@ if (deepEqual(valueToFind, schema)) {

}
if (Array.isArray(schema) || schema['prim'] === 'pair') {
if (Array.isArray(schema) || schema.prim === 'pair') {
const sch = collapse(schema);
const str = collapse(storage, 'Pair');
if (sch.args === undefined || str.args === undefined) {
const strg = collapse(storage, 'Pair');
if (sch.args === undefined || strg.args === undefined) {
throw new error_1.MissingArgumentError('Tokens have no arguments'); // unlikely
}
return (this.findValue(sch.args[0], str.args[0], valueToFind) ||
this.findValue(sch.args[1], str.args[1], valueToFind));
if (sch.args[0])
return (
// unsafe
this.findValue(sch.args[0], strg.args[0], valueToFind) ||
this.findValue(sch.args[1], strg.args[1], valueToFind));
}

@@ -200,0 +219,0 @@ }

@@ -57,2 +57,5 @@ "use strict";

}
if (!val.bytes) {
throw new AddressValidationError(val, this, `cannot be missing both string and bytes: ${val}`);
}
return utils_1.encodePubKey(val.bytes);

@@ -77,2 +80,5 @@ }

}
if (!bytes) {
throw new AddressValidationError({ bytes, string }, this, `cannot be missing both string and bytes ${{ string, bytes }}`);
}
return utils_1.encodePubKey(bytes);

@@ -84,14 +90,11 @@ }

};
if (isImplicit(address1) && isImplicit(address2)) {
return super.compare(address1, address2);
}
else if (isImplicit(address1)) {
const implicit1 = isImplicit(address1);
const implicit2 = isImplicit(address2);
if (implicit1 && !implicit2) {
return -1;
}
else if (isImplicit(address2)) {
else if (implicit2 && !implicit1) {
return 1;
}
else {
return super.compare(address1, address2);
}
return super.compare(address1, address2);
}

@@ -98,0 +101,0 @@ findAndReturnTokens(tokenToFind, tokens) {

@@ -33,2 +33,5 @@ "use strict";

}
if (!val.bytes) {
throw new ContractValidationError(val, this, 'must contain bytes or string');
}
return utils_1.encodePubKey(val.bytes);

@@ -66,3 +69,3 @@ }

schema: {
parameter: valueSchema.generateSchema(),
parameter: this.val.args[0] ? valueSchema.generateSchema() : {},
},

@@ -69,0 +72,0 @@ };

@@ -60,3 +60,6 @@ "use strict";

}
: val, idx, fac);
: val.prim ? val : {
prim: PairToken.prim,
args: val,
}, idx, fac);
}

@@ -63,0 +66,0 @@ args() {

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

typeWithoutAnnotations() {
const removeArgsRec = (val) => {
const handleMichelsonExpression = (val) => {
if (typeof val === 'object') {
if (Array.isArray(val)) {
const array = val;
return array.map((item) => handleMichelsonExpression(item));
}
const extended = val;
if (extended.args) {
return {
prim: extended.prim,
args: extended.args.map((x) => handleMichelsonExpression(x)),
};
}
else {
return {
prim: extended.prim,
};
}
}
return val;
};
const handleMichelsonExtended = (val) => {
if (val.args) {
return {
prim: val.prim,
args: val.args.map((x) => removeArgsRec(x)),
args: val.args.map((x) => handleMichelsonExpression(x)),
};

@@ -42,3 +63,3 @@ }

};
return removeArgsRec(this.val);
return handleMichelsonExtended(this.val);
}

@@ -45,0 +66,0 @@ annot() {

@@ -11,2 +11,3 @@ "use strict";

const bool_1 = require("./comparable/bool");
const tx_rollup_l2_address_1 = require("./comparable/tx_rollup_l2_address");
const or_1 = require("./or");

@@ -44,2 +45,3 @@ const contract_1 = require("./contract");

address_1.AddressToken,
tx_rollup_l2_address_1.TxRollupL2AddressToken,
map_1.MapToken,

@@ -46,0 +48,0 @@ bool_1.BoolToken,

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

exports.VERSION = {
"commitHash": "38da814ec2bb4e81c7ad5a45b6b183a4d0b8dc25",
"version": "12.1.1"
commitHash: '38da814ec2bb4e81c7ad5a45b6b183a4d0b8dc25',
version: '12.1.1',
};
//# sourceMappingURL=version.js.map

@@ -13,3 +13,3 @@ import { MichelsonV1Expression, ScriptResponse } from '@taquito/rpc';

[schemaTypeSymbol]: boolean;
static isSchema(obj: any): obj is Schema;
static isSchema(obj: Schema): boolean;
private bigMap?;

@@ -16,0 +16,0 @@ static fromRPCResponse(val: {

export declare type Falsy<T> = T | undefined | false;
export declare type BaseTokenSchema = {
__michelsonType: 'address' | 'bool' | 'bytes' | 'int' | 'key' | 'key_hash' | 'mutez' | 'nat' | 'string' | 'timestamp' | 'bls12_381_fr' | 'bls12_381_g1' | 'bls12_381_g2' | 'chain_id' | 'never' | 'operation' | 'chest' | 'chest_key' | 'signature' | 'unit';
__michelsonType: 'address' | 'bool' | 'bytes' | 'int' | 'key' | 'key_hash' | 'mutez' | 'nat' | 'string' | 'timestamp' | 'bls12_381_fr' | 'bls12_381_g1' | 'bls12_381_g2' | 'chain_id' | 'never' | 'operation' | 'chest' | 'chest_key' | 'signature' | 'unit' | 'tx_rollup_l2_address';
schema: string;

@@ -5,0 +5,0 @@ };

@@ -32,3 +32,3 @@ import { BaseTokenSchema } from '../schema/types';

};
EncodeObject(val: string | Uint8Array | number, semantic?: SemanticEncoding): import("@taquito/rpc").MichelsonV1ExpressionBase | import("@taquito/rpc").MichelsonV1ExpressionExtended | import("@taquito/rpc").MichelsonV1Expression[] | {
EncodeObject(val: string | Uint8Array | number, semantic?: SemanticEncoding): import("@taquito/rpc").MichelsonV1ExpressionExtended | import("@taquito/rpc").MichelsonV1ExpressionBase | import("@taquito/rpc").MichelsonV1Expression[] | {
bytes: string | number | Uint8Array;

@@ -35,0 +35,0 @@ };

@@ -28,3 +28,3 @@ import { BaseTokenSchema } from '../schema/types';

};
EncodeObject(val: string | Uint8Array, semantic?: SemanticEncoding): import("@taquito/rpc").MichelsonV1ExpressionBase | import("@taquito/rpc").MichelsonV1ExpressionExtended | import("@taquito/rpc").MichelsonV1Expression[] | {
EncodeObject(val: string | Uint8Array, semantic?: SemanticEncoding): import("@taquito/rpc").MichelsonV1ExpressionExtended | import("@taquito/rpc").MichelsonV1ExpressionBase | import("@taquito/rpc").MichelsonV1Expression[] | {
bytes: string | Uint8Array;

@@ -31,0 +31,0 @@ };

@@ -28,3 +28,3 @@ import { BaseTokenSchema } from '../schema/types';

};
EncodeObject(val: string | Uint8Array, semantic?: SemanticEncoding): import("@taquito/rpc").MichelsonV1ExpressionBase | import("@taquito/rpc").MichelsonV1ExpressionExtended | import("@taquito/rpc").MichelsonV1Expression[] | {
EncodeObject(val: string | Uint8Array, semantic?: SemanticEncoding): import("@taquito/rpc").MichelsonV1ExpressionExtended | import("@taquito/rpc").MichelsonV1ExpressionBase | import("@taquito/rpc").MichelsonV1Expression[] | {
bytes: string | Uint8Array;

@@ -31,0 +31,0 @@ };

@@ -28,3 +28,3 @@ import { BaseTokenSchema } from '../schema/types';

};
EncodeObject(val: string | Uint8Array, semantic?: SemanticEncoding): import("@taquito/rpc").MichelsonV1ExpressionBase | import("@taquito/rpc").MichelsonV1ExpressionExtended | import("@taquito/rpc").MichelsonV1Expression[] | {
EncodeObject(val: string | Uint8Array, semantic?: SemanticEncoding): import("@taquito/rpc").MichelsonV1ExpressionExtended | import("@taquito/rpc").MichelsonV1ExpressionBase | import("@taquito/rpc").MichelsonV1Expression[] | {
bytes: string | Uint8Array;

@@ -31,0 +31,0 @@ };

@@ -28,3 +28,3 @@ import { BaseTokenSchema } from '../schema/types';

};
EncodeObject(val: string | Uint8Array, semantic?: SemanticEncoding): import("@taquito/rpc").MichelsonV1ExpressionBase | import("@taquito/rpc").MichelsonV1ExpressionExtended | import("@taquito/rpc").MichelsonV1Expression[] | {
EncodeObject(val: string | Uint8Array, semantic?: SemanticEncoding): import("@taquito/rpc").MichelsonV1ExpressionExtended | import("@taquito/rpc").MichelsonV1ExpressionBase | import("@taquito/rpc").MichelsonV1Expression[] | {
bytes: string | Uint8Array;

@@ -31,0 +31,0 @@ };

@@ -35,8 +35,5 @@ import { OptionTokenSchema } from '../schema/types';

key: any;
type: {
prim: string;
args?: any[] | undefined;
};
type: Pick<import("@taquito/rpc").MichelsonV1ExpressionExtended, "prim" | "args">;
};
findAndReturnTokens(tokenToFind: string, tokens: Token[]): Token[];
}

@@ -42,8 +42,5 @@ import { OrTokenSchema } from '../schema/types';

key: any;
type: {
prim: string;
args?: any[] | undefined;
};
type: Pick<import("@taquito/rpc").MichelsonV1ExpressionExtended, "prim" | "args">;
};
findAndReturnTokens(tokenToFind: string, tokens: Token[]): Token[];
}
import { Token, TokenFactory, Semantic, ComparableToken, SemanticEncoding } from './token';
import { PairTokenSchema } from '../schema/types';
import { MichelsonV1Expression, MichelsonV1ExpressionExtended } from '@taquito/rpc';
/**

@@ -24,7 +25,3 @@ * @category Error

static prim: 'pair';
constructor(val: {
prim: string;
args: any[];
annots: any[];
} | any[], idx: number, fac: TokenFactory);
constructor(val: MichelsonV1Expression, idx: number, fac: TokenFactory);
private args;

@@ -36,6 +33,3 @@ private tokens;

key: any;
type: {
prim: string;
args?: any[] | undefined;
};
type: Pick<MichelsonV1ExpressionExtended, "prim" | "args">;
};

@@ -42,0 +36,0 @@ ToKey(val: any): {

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

import { MichelsonV1Expression } from '@taquito/rpc';
import { MichelsonV1Expression, MichelsonV1ExpressionExtended } from '@taquito/rpc';
import { TokenSchema } from '../schema/types';

@@ -21,25 +21,10 @@ /**

export declare abstract class Token {
protected val: {
prim: string;
args?: any[];
annots?: any[];
};
protected val: MichelsonV1ExpressionExtended;
protected idx: number;
protected fac: TokenFactory;
constructor(val: {
prim: string;
args?: any[];
annots?: any[];
}, idx: number, fac: TokenFactory);
protected typeWithoutAnnotations(): {
prim: string;
args?: any[] | undefined;
};
annot(): any;
constructor(val: MichelsonV1ExpressionExtended, idx: number, fac: TokenFactory);
protected typeWithoutAnnotations(): Pick<MichelsonV1ExpressionExtended, "prim" | "args">;
annot(): string;
hasAnnotations(): number | false;
get tokenVal(): {
prim: string;
args?: any[] | undefined;
annots?: any[] | undefined;
};
get tokenVal(): MichelsonV1ExpressionExtended;
createToken: TokenFactory;

@@ -69,4 +54,4 @@ /**

};
abstract ToKey(val: string): any;
abstract ToKey(val: string | MichelsonV1Expression): any;
compare(o1: string, o2: string): number;
}

@@ -8,2 +8,3 @@ import { PairToken } from './pair';

import { BoolToken } from './comparable/bool';
import { TxRollupL2AddressToken } from './comparable/tx_rollup_l2_address';
import { OrToken } from './or';

@@ -35,2 +36,2 @@ import { ContractToken } from './contract';

import { GlobalConstantToken } from './constant';
export declare const tokens: (typeof PairToken | typeof NatToken | typeof StringToken | typeof BigMapToken | typeof AddressToken | typeof MapToken | typeof BoolToken | typeof OrToken | typeof ContractToken | typeof ListToken | typeof MutezToken | typeof BytesToken | typeof OptionToken | typeof TimestampToken | typeof IntToken | typeof UnitToken | typeof KeyToken | typeof KeyHashToken | typeof SignatureToken | typeof LambdaToken | typeof OperationToken | typeof SetToken | typeof ChainIDToken | typeof TicketToken | typeof NeverToken | typeof SaplingStateToken | typeof SaplingTransactionToken | typeof Bls12381frToken | typeof Bls12381g1Token | typeof Bls12381g2Token | typeof ChestToken | typeof ChestKeyToken | typeof GlobalConstantToken)[];
export declare const tokens: (typeof PairToken | typeof NatToken | typeof StringToken | typeof BigMapToken | typeof AddressToken | typeof TxRollupL2AddressToken | typeof MapToken | typeof BoolToken | typeof OrToken | typeof ContractToken | typeof ListToken | typeof MutezToken | typeof BytesToken | typeof OptionToken | typeof TimestampToken | typeof IntToken | typeof UnitToken | typeof KeyToken | typeof KeyHashToken | typeof SignatureToken | typeof LambdaToken | typeof OperationToken | typeof SetToken | typeof ChainIDToken | typeof TicketToken | typeof NeverToken | typeof SaplingStateToken | typeof SaplingTransactionToken | typeof Bls12381frToken | typeof Bls12381g1Token | typeof Bls12381g2Token | typeof ChestToken | typeof ChestKeyToken | typeof GlobalConstantToken)[];
{
"name": "@taquito/michelson-encoder",
"version": "12.1.1",
"version": "13.0.0-beta-RC.0",
"description": "converts michelson data and types into convenient JS/TS objects",

@@ -71,4 +71,4 @@ "keywords": [

"dependencies": {
"@taquito/rpc": "^12.1.1",
"@taquito/utils": "^12.1.1",
"@taquito/rpc": "^13.0.0-beta-RC.0",
"@taquito/utils": "^13.0.0-beta-RC.0",
"bignumber.js": "^9.0.2",

@@ -78,3 +78,3 @@ "fast-json-stable-stringify": "^2.1.0"

"devDependencies": {
"@taquito/rpc": "^11.2.0",
"@taquito/rpc": "^12.1.1",
"@types/bluebird": "^3.5.36",

@@ -105,6 +105,5 @@ "@types/jest": "^26.0.23",

"ts-toolbelt": "^9.6.0",
"typedoc": "^0.20.36",
"typescript": "~4.1.5"
},
"gitHead": "e97d6f77d990f91b4e407f4e7b7f8f3785edb2ba"
"gitHead": "d9034944abf0efab2478e61f35614b1aef397cec"
}

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 too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

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