@ecadlabs/tezos-parser
Advanced tools
Comparing version 0.1.5 to 0.1.6
@@ -27,3 +27,6 @@ "use strict"; | ||
ListToken.prototype.Execute = function (val) { | ||
return ''; | ||
var schema = this.createToken(this.val.args[0], 0); | ||
return val.reduce(function (prev, current) { | ||
return prev.concat([schema.Execute(current)]); | ||
}, []); | ||
}; | ||
@@ -30,0 +33,0 @@ ListToken.prototype.ExtractSchema = function () { |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var pair_1 = require("./pair"); | ||
var nat_1 = require("./nat"); | ||
var string_1 = require("./string"); | ||
var nat_1 = require("./comparable/nat"); | ||
var string_1 = require("./comparable/string"); | ||
var bigmap_1 = require("./bigmap"); | ||
var address_1 = require("./address"); | ||
var address_1 = require("./comparable/address"); | ||
var map_1 = require("./map"); | ||
var bool_1 = require("./bool"); | ||
var bool_1 = require("./comparable/bool"); | ||
var or_1 = require("./or"); | ||
var contract_1 = require("./contract"); | ||
var list_1 = require("./list"); | ||
var mutez_1 = require("./mutez"); | ||
var mutez_1 = require("./comparable/mutez"); | ||
var bytes_1 = require("./comparable/bytes"); | ||
var option_1 = require("./option"); | ||
var timestamp_1 = require("./comparable/timestamp"); | ||
var int_1 = require("./comparable/int"); | ||
var unit_1 = require("./unit"); | ||
exports.tokens = [ | ||
@@ -25,4 +30,9 @@ pair_1.PairToken, | ||
list_1.ListToken, | ||
mutez_1.MutezToken | ||
mutez_1.MutezToken, | ||
bytes_1.BytesToken, | ||
option_1.OptionToken, | ||
timestamp_1.TimestampToken, | ||
int_1.IntToken, | ||
unit_1.UnitToken | ||
]; | ||
//# sourceMappingURL=tokens.js.map |
@@ -204,2 +204,8 @@ import { Buffer } from 'buffer'; | ||
}; | ||
NatToken.prototype.ToBigMapKey = function (val) { | ||
return { | ||
key: { int: val }, | ||
type: { prim: NatToken.prim } | ||
}; | ||
}; | ||
NatToken.prim = 'nat'; | ||
@@ -228,2 +234,8 @@ return NatToken; | ||
}; | ||
StringToken.prototype.ToBigMapKey = function (val) { | ||
return { | ||
key: { string: val }, | ||
type: { prim: StringToken.prim } | ||
}; | ||
}; | ||
StringToken.prim = 'string'; | ||
@@ -400,3 +412,6 @@ return StringToken; | ||
ListToken.prototype.Execute = function (val) { | ||
return ''; | ||
var schema = this.createToken(this.val.args[0], 0); | ||
return val.reduce(function (prev, current) { | ||
return prev.concat([schema.Execute(current)]); | ||
}, []); | ||
}; | ||
@@ -425,2 +440,8 @@ ListToken.prototype.ExtractSchema = function () { | ||
}; | ||
MutezToken.prototype.ToBigMapKey = function (val) { | ||
return { | ||
key: { int: val }, | ||
type: { prim: MutezToken.prim } | ||
}; | ||
}; | ||
MutezToken.prim = 'mutez'; | ||
@@ -430,2 +451,127 @@ return MutezToken; | ||
var BytesToken = /** @class */ (function (_super) { | ||
__extends(BytesToken, _super); | ||
function BytesToken(val, idx, fac) { | ||
var _this = _super.call(this, val, idx, fac) || this; | ||
_this.val = val; | ||
_this.idx = idx; | ||
_this.fac = fac; | ||
return _this; | ||
} | ||
BytesToken.prototype.ToBigMapKey = function (val) { | ||
return { | ||
key: { bytes: val }, | ||
type: { prim: BytesToken.prim } | ||
}; | ||
}; | ||
BytesToken.prototype.Execute = function (val) { | ||
return val.bytes; | ||
}; | ||
BytesToken.prototype.ExtractSchema = function () { | ||
return BytesToken.prim; | ||
}; | ||
BytesToken.prototype.ToKey = function (_a) { | ||
var bytes = _a.bytes, string = _a.string; | ||
if (string) { | ||
return string; | ||
} | ||
return bytes; | ||
}; | ||
BytesToken.prim = 'bytes'; | ||
return BytesToken; | ||
}(Token)); | ||
var OptionToken = /** @class */ (function (_super) { | ||
__extends(OptionToken, _super); | ||
function OptionToken(val, idx, fac) { | ||
var _this = _super.call(this, val, idx, fac) || this; | ||
_this.val = val; | ||
_this.idx = idx; | ||
_this.fac = fac; | ||
return _this; | ||
} | ||
OptionToken.prototype.Execute = function (val) { | ||
var schema = this.createToken(this.val.args[0], 0); | ||
return schema.Execute(val.args[0]); | ||
}; | ||
OptionToken.prototype.ExtractSchema = function () { | ||
return OptionToken.prim; | ||
}; | ||
OptionToken.prim = 'option'; | ||
return OptionToken; | ||
}(Token)); | ||
var TimestampToken = /** @class */ (function (_super) { | ||
__extends(TimestampToken, _super); | ||
function TimestampToken(val, idx, fac) { | ||
var _this = _super.call(this, val, idx, fac) || this; | ||
_this.val = val; | ||
_this.idx = idx; | ||
_this.fac = fac; | ||
return _this; | ||
} | ||
TimestampToken.prototype.Execute = function (val) { | ||
return val.timestamp; | ||
}; | ||
TimestampToken.prototype.ExtractSchema = function () { | ||
return TimestampToken.prim; | ||
}; | ||
TimestampToken.prototype.ToKey = function (_a) { | ||
var timestamp = _a.timestamp; | ||
return timestamp; | ||
}; | ||
TimestampToken.prototype.ToBigMapKey = function (val) { | ||
return { | ||
key: { timestamp: val }, | ||
type: { prim: TimestampToken.prim } | ||
}; | ||
}; | ||
TimestampToken.prim = 'timestamp'; | ||
return TimestampToken; | ||
}(Token)); | ||
var IntToken = /** @class */ (function (_super) { | ||
__extends(IntToken, _super); | ||
function IntToken(val, idx, fac) { | ||
var _this = _super.call(this, val, idx, fac) || this; | ||
_this.val = val; | ||
_this.idx = idx; | ||
_this.fac = fac; | ||
return _this; | ||
} | ||
IntToken.prototype.Execute = function (val) { | ||
return val.int; | ||
}; | ||
IntToken.prototype.ExtractSchema = function () { | ||
return IntToken.prim; | ||
}; | ||
IntToken.prototype.ToBigMapKey = function (val) { | ||
return { | ||
key: { int: val }, | ||
type: { prim: IntToken.prim } | ||
}; | ||
}; | ||
IntToken.prim = 'int'; | ||
return IntToken; | ||
}(Token)); | ||
var UnitToken = /** @class */ (function (_super) { | ||
__extends(UnitToken, _super); | ||
function UnitToken(val, idx, fac) { | ||
var _this = _super.call(this, val, idx, fac) || this; | ||
_this.val = val; | ||
_this.idx = idx; | ||
_this.fac = fac; | ||
return _this; | ||
} | ||
UnitToken.prototype.Execute = function (val) { | ||
return null; | ||
}; | ||
UnitToken.prototype.ExtractSchema = function () { | ||
return UnitToken.prim; | ||
}; | ||
UnitToken.prim = 'unit'; | ||
return UnitToken; | ||
}(Token)); | ||
var tokens = [ | ||
@@ -442,3 +588,8 @@ PairToken, | ||
ListToken, | ||
MutezToken | ||
MutezToken, | ||
BytesToken, | ||
OptionToken, | ||
TimestampToken, | ||
IntToken, | ||
UnitToken | ||
]; | ||
@@ -445,0 +596,0 @@ |
@@ -208,2 +208,8 @@ (function (global, factory) { | ||
}; | ||
NatToken.prototype.ToBigMapKey = function (val) { | ||
return { | ||
key: { int: val }, | ||
type: { prim: NatToken.prim } | ||
}; | ||
}; | ||
NatToken.prim = 'nat'; | ||
@@ -232,2 +238,8 @@ return NatToken; | ||
}; | ||
StringToken.prototype.ToBigMapKey = function (val) { | ||
return { | ||
key: { string: val }, | ||
type: { prim: StringToken.prim } | ||
}; | ||
}; | ||
StringToken.prim = 'string'; | ||
@@ -404,3 +416,6 @@ return StringToken; | ||
ListToken.prototype.Execute = function (val) { | ||
return ''; | ||
var schema = this.createToken(this.val.args[0], 0); | ||
return val.reduce(function (prev, current) { | ||
return prev.concat([schema.Execute(current)]); | ||
}, []); | ||
}; | ||
@@ -429,2 +444,8 @@ ListToken.prototype.ExtractSchema = function () { | ||
}; | ||
MutezToken.prototype.ToBigMapKey = function (val) { | ||
return { | ||
key: { int: val }, | ||
type: { prim: MutezToken.prim } | ||
}; | ||
}; | ||
MutezToken.prim = 'mutez'; | ||
@@ -434,2 +455,127 @@ return MutezToken; | ||
var BytesToken = /** @class */ (function (_super) { | ||
__extends(BytesToken, _super); | ||
function BytesToken(val, idx, fac) { | ||
var _this = _super.call(this, val, idx, fac) || this; | ||
_this.val = val; | ||
_this.idx = idx; | ||
_this.fac = fac; | ||
return _this; | ||
} | ||
BytesToken.prototype.ToBigMapKey = function (val) { | ||
return { | ||
key: { bytes: val }, | ||
type: { prim: BytesToken.prim } | ||
}; | ||
}; | ||
BytesToken.prototype.Execute = function (val) { | ||
return val.bytes; | ||
}; | ||
BytesToken.prototype.ExtractSchema = function () { | ||
return BytesToken.prim; | ||
}; | ||
BytesToken.prototype.ToKey = function (_a) { | ||
var bytes = _a.bytes, string = _a.string; | ||
if (string) { | ||
return string; | ||
} | ||
return bytes; | ||
}; | ||
BytesToken.prim = 'bytes'; | ||
return BytesToken; | ||
}(Token)); | ||
var OptionToken = /** @class */ (function (_super) { | ||
__extends(OptionToken, _super); | ||
function OptionToken(val, idx, fac) { | ||
var _this = _super.call(this, val, idx, fac) || this; | ||
_this.val = val; | ||
_this.idx = idx; | ||
_this.fac = fac; | ||
return _this; | ||
} | ||
OptionToken.prototype.Execute = function (val) { | ||
var schema = this.createToken(this.val.args[0], 0); | ||
return schema.Execute(val.args[0]); | ||
}; | ||
OptionToken.prototype.ExtractSchema = function () { | ||
return OptionToken.prim; | ||
}; | ||
OptionToken.prim = 'option'; | ||
return OptionToken; | ||
}(Token)); | ||
var TimestampToken = /** @class */ (function (_super) { | ||
__extends(TimestampToken, _super); | ||
function TimestampToken(val, idx, fac) { | ||
var _this = _super.call(this, val, idx, fac) || this; | ||
_this.val = val; | ||
_this.idx = idx; | ||
_this.fac = fac; | ||
return _this; | ||
} | ||
TimestampToken.prototype.Execute = function (val) { | ||
return val.timestamp; | ||
}; | ||
TimestampToken.prototype.ExtractSchema = function () { | ||
return TimestampToken.prim; | ||
}; | ||
TimestampToken.prototype.ToKey = function (_a) { | ||
var timestamp = _a.timestamp; | ||
return timestamp; | ||
}; | ||
TimestampToken.prototype.ToBigMapKey = function (val) { | ||
return { | ||
key: { timestamp: val }, | ||
type: { prim: TimestampToken.prim } | ||
}; | ||
}; | ||
TimestampToken.prim = 'timestamp'; | ||
return TimestampToken; | ||
}(Token)); | ||
var IntToken = /** @class */ (function (_super) { | ||
__extends(IntToken, _super); | ||
function IntToken(val, idx, fac) { | ||
var _this = _super.call(this, val, idx, fac) || this; | ||
_this.val = val; | ||
_this.idx = idx; | ||
_this.fac = fac; | ||
return _this; | ||
} | ||
IntToken.prototype.Execute = function (val) { | ||
return val.int; | ||
}; | ||
IntToken.prototype.ExtractSchema = function () { | ||
return IntToken.prim; | ||
}; | ||
IntToken.prototype.ToBigMapKey = function (val) { | ||
return { | ||
key: { int: val }, | ||
type: { prim: IntToken.prim } | ||
}; | ||
}; | ||
IntToken.prim = 'int'; | ||
return IntToken; | ||
}(Token)); | ||
var UnitToken = /** @class */ (function (_super) { | ||
__extends(UnitToken, _super); | ||
function UnitToken(val, idx, fac) { | ||
var _this = _super.call(this, val, idx, fac) || this; | ||
_this.val = val; | ||
_this.idx = idx; | ||
_this.fac = fac; | ||
return _this; | ||
} | ||
UnitToken.prototype.Execute = function (val) { | ||
return null; | ||
}; | ||
UnitToken.prototype.ExtractSchema = function () { | ||
return UnitToken.prim; | ||
}; | ||
UnitToken.prim = 'unit'; | ||
return UnitToken; | ||
}(Token)); | ||
var tokens = [ | ||
@@ -446,3 +592,8 @@ PairToken, | ||
ListToken, | ||
MutezToken | ||
MutezToken, | ||
BytesToken, | ||
OptionToken, | ||
TimestampToken, | ||
IntToken, | ||
UnitToken | ||
]; | ||
@@ -449,0 +600,0 @@ |
@@ -12,3 +12,3 @@ import { RpcTransaction } from './model'; | ||
key: { | ||
bytes: string; | ||
[key: string]: string; | ||
}; | ||
@@ -15,0 +15,0 @@ type: { |
@@ -1,2 +0,2 @@ | ||
import { Token, TokenFactory } from './token'; | ||
import { Token, TokenFactory, ComparableToken } from './token'; | ||
export declare class BigMapToken extends Token { | ||
@@ -17,3 +17,3 @@ protected val: { | ||
readonly ValueSchema: Token; | ||
readonly KeySchema: Token; | ||
readonly KeySchema: ComparableToken; | ||
ExtractSchema(): { | ||
@@ -20,0 +20,0 @@ [x: number]: any; |
@@ -16,4 +16,4 @@ import { Token, TokenFactory } from './token'; | ||
}, idx: number, fac: TokenFactory); | ||
Execute(val: any): string; | ||
Execute(val: any): any; | ||
ExtractSchema(): string; | ||
} |
export declare type TokenFactory = (val: any, idx: number) => Token; | ||
export interface ComparableToken extends Token { | ||
ToBigMapKey(val: string): { | ||
key: { | ||
[key: string]: string; | ||
}; | ||
type: { | ||
prim: string; | ||
}; | ||
}; | ||
} | ||
export declare abstract class Token { | ||
@@ -3,0 +13,0 @@ protected val: { |
import { PairToken } from './pair'; | ||
import { NatToken } from './nat'; | ||
import { StringToken } from './string'; | ||
import { NatToken } from './comparable/nat'; | ||
import { StringToken } from './comparable/string'; | ||
import { BigMapToken } from './bigmap'; | ||
import { AddressToken } from './address'; | ||
import { AddressToken } from './comparable/address'; | ||
import { MapToken } from './map'; | ||
import { BoolToken } from './bool'; | ||
import { BoolToken } from './comparable/bool'; | ||
import { OrToken } from './or'; | ||
import { ContractToken } from './contract'; | ||
import { ListToken } from './list'; | ||
import { MutezToken } from './mutez'; | ||
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)[]; | ||
import { MutezToken } from './comparable/mutez'; | ||
import { BytesToken } from './comparable/bytes'; | ||
import { OptionToken } from './option'; | ||
import { TimestampToken } from './comparable/timestamp'; | ||
import { IntToken } from './comparable/int'; | ||
import { UnitToken } from './unit'; | ||
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)[]; |
{ | ||
"name": "@ecadlabs/tezos-parser", | ||
"version": "0.1.5", | ||
"version": "0.1.6", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "keywords": [], |
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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
202070
93
3094