@waves/money-like-to-node
Advanced tools
Comparing version 0.0.6 to 0.0.7
import { TRANSACTION_TYPE } from '@waves/ts-types'; | ||
export declare const TYPES: typeof TRANSACTION_TYPE; | ||
export declare const ALIAS: { | ||
AVAILABLE_CHARS: string; | ||
MAX_ALIAS_LENGTH: number; | ||
MIN_ALIAS_LENGTH: number; | ||
}; |
@@ -21,2 +21,7 @@ "use strict"; | ||
}; | ||
exports.ALIAS = { | ||
AVAILABLE_CHARS: '-.0123456789@_abcdefghijklmnopqrstuvwxyz', | ||
MAX_ALIAS_LENGTH: 30, | ||
MIN_ALIAS_LENGTH: 4, | ||
}; | ||
//# sourceMappingURL=index.js.map |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.factory = function (transform) { return function (data) { | ||
return Object.entries(transform) | ||
var errors = []; | ||
var result = Object.entries(transform) | ||
.reduce(function (acc, _a) { | ||
var _b; | ||
var name = _a[0], transformer = _a[1]; | ||
return Object.assign(acc, (_b = {}, _b[name] = transformer(data), _b)); | ||
try { | ||
var value = transformer(data); | ||
return Object.assign(acc, (_b = {}, _b[name] = value, _b)); | ||
} | ||
catch (e) { | ||
errors.push({ | ||
path: name, | ||
message: e.message | ||
}); | ||
} | ||
}, Object.create(null)); | ||
if (errors.length) { | ||
throw new Error("Errors: " + JSON.stringify(errors, null, 4)); | ||
} | ||
return result; | ||
}; }; | ||
//# sourceMappingURL=factory.js.map |
import { TYPES } from '../constants'; | ||
import { IAliasTransaction } from '@waves/ts-types'; | ||
import { IDefaultGuiTx } from './general'; | ||
import { TWithPartialFee } from '../types'; | ||
export declare const alias: (data: IWavesGuiAlias) => TWithPartialFee<IAliasTransaction<string>>; | ||
export declare const alias: (data: IWavesGuiAlias) => IAliasTransaction<string>; | ||
export interface IWavesGuiAlias extends IDefaultGuiTx<typeof TYPES.ALIAS> { | ||
alias: string; | ||
} |
@@ -14,6 +14,8 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var constants_1 = require("../constants"); | ||
var factory_1 = require("../core/factory"); | ||
var general_1 = require("./general"); | ||
var utils_1 = require("../utils"); | ||
exports.alias = factory_1.factory(__assign({}, general_1.getDefaultTransform(), { alias: utils_1.prop('alias') })); | ||
var validators_1 = require("../validators"); | ||
exports.alias = factory_1.factory(__assign({}, general_1.getDefaultTransform(), { alias: utils_1.pipe(utils_1.prop('alias'), validators_1.validate(validators_1.requiredValidator('alias'), validators_1.createValidator(validators_1.isString, 'Alias is not a string!'), validators_1.createValidator(utils_1.pipe(utils_1.length, utils_1.gt(constants_1.ALIAS.MAX_ALIAS_LENGTH)), "Alias max length is " + constants_1.ALIAS.MAX_ALIAS_LENGTH), validators_1.createValidator(utils_1.pipe(utils_1.length, utils_1.lt(constants_1.ALIAS.MIN_ALIAS_LENGTH)), "Alias min length is " + constants_1.ALIAS.MIN_ALIAS_LENGTH), validators_1.createValidator(validators_1.charsInDictionary(constants_1.ALIAS.AVAILABLE_CHARS), "Available alias chars is \"" + constants_1.ALIAS.AVAILABLE_CHARS + "\""))) })); | ||
//# sourceMappingURL=alias.js.map |
@@ -32,2 +32,3 @@ "use strict"; | ||
matcherFee: utils_1.pipe(utils_1.prop('matcherFee'), utils_1.getCoins), | ||
matcherFeeAssetId: utils_1.pipe(utils_1.prop('matcherFee'), utils_1.getAssetId), | ||
assetPair: getAssetPair | ||
@@ -34,0 +35,0 @@ }); |
@@ -7,3 +7,3 @@ import { TLong, TMoney } from '../types'; | ||
timestamp: (data: T) => number; | ||
fee: (data: T) => string | null; | ||
fee: (data: T) => string; | ||
}; | ||
@@ -13,5 +13,5 @@ export interface IDefaultGuiTx<TYPE> { | ||
version: number; | ||
fee?: TLong | TMoney; | ||
senderPublicKey?: string; | ||
senderPublicKey: string; | ||
timestamp?: number; | ||
fee: TLong | TMoney; | ||
} |
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var utils_1 = require("../utils"); | ||
var validators_1 = require("../validators"); | ||
var processTimestamp = function (timestamp) { return timestamp || Date.now(); }; | ||
exports.getDefaultTransform = function () { return ({ | ||
type: utils_1.pipe(utils_1.prop('type'), utils_1.emptyError('Transaction type is required!')), | ||
version: utils_1.pipe(utils_1.prop('version'), utils_1.emptyError('Transaction version is required!')), | ||
senderPublicKey: utils_1.pipe(utils_1.prop('senderPublicKey'), utils_1.emptyError('Transaction senderPublicKey is required!')), | ||
timestamp: utils_1.pipe(utils_1.prop('timestamp'), function (timestamp) { return timestamp || Date.now(); }), | ||
fee: utils_1.pipe(utils_1.prop('fee'), utils_1.getCoins), | ||
type: utils_1.pipe(utils_1.prop('type'), validators_1.validate(validators_1.requiredValidator('type'))), | ||
version: utils_1.pipe(utils_1.prop('version'), validators_1.validate(validators_1.requiredValidator('version'))), | ||
senderPublicKey: utils_1.pipe(utils_1.prop('senderPublicKey'), validators_1.validate(validators_1.requiredValidator('senderPublicKey'))), | ||
timestamp: utils_1.pipe(utils_1.prop('timestamp'), processTimestamp), | ||
fee: utils_1.pipe(utils_1.prop('fee'), utils_1.getCoins, validators_1.validate(validators_1.requiredValidator('fee'))) | ||
}); }; | ||
//# sourceMappingURL=general.js.map |
@@ -18,3 +18,3 @@ import { IWavesGuiAlias } from './alias'; | ||
export declare const node: { | ||
alias: (data: IWavesGuiAlias) => TWithPartialFee<import("@waves/ts-types").IAliasTransaction<string>>; | ||
alias: (data: IWavesGuiAlias) => import("@waves/ts-types").IAliasTransaction<string>; | ||
burn: (data: TWavesGuiBurn) => TWithPartialFee<import("@waves/ts-types").IBurnTransaction<string>>; | ||
@@ -21,0 +21,0 @@ cancelLease: (data: IWavesGuiCancelLease) => TWithPartialFee<import("@waves/ts-types").ICancelLeaseTransaction<string>>; |
@@ -15,2 +15,7 @@ import { TLong, TMoney } from '../types'; | ||
}>(data: any): data is T; | ||
export declare const length: (some: string | any[]) => number; | ||
export declare const lt: IComparator; | ||
export declare const gt: IComparator; | ||
export declare const lte: IComparator; | ||
export declare const gte: IComparator; | ||
export declare const head: <T>(list: T[]) => T | undefined; | ||
@@ -21,2 +26,6 @@ export declare const defaultTo: <T>(value: T) => (data: T | null | undefined) => T; | ||
export declare const pipe: IPipe; | ||
interface IComparator { | ||
(a: number, b: number): boolean; | ||
(a: number): (b: number) => boolean; | ||
} | ||
interface IHas { | ||
@@ -35,2 +44,3 @@ <T extends { | ||
interface IPipe { | ||
<A, B>(cb1: (a: A) => B): (a: A) => B; | ||
<A, B, R>(cb1: (a: A) => B, cb2: (b: B) => R): (a: A) => R; | ||
@@ -37,0 +47,0 @@ <A, B, C, R>(cb1: (a: A) => B, cb2: (b: B) => C, cb3: (c: C) => R): (a: A) => R; |
@@ -79,2 +79,7 @@ "use strict"; | ||
exports.isOrder = isOrder; | ||
exports.length = function (some) { return some.length; }; | ||
exports.lt = exports.curry(function (a, b) { return a < b; }); | ||
exports.gt = exports.curry(function (a, b) { return a > b; }); | ||
exports.lte = exports.curry(function (a, b) { return a <= b; }); | ||
exports.gte = exports.curry(function (a, b) { return a >= b; }); | ||
exports.head = function (list) { return list[0]; }; | ||
@@ -81,0 +86,0 @@ exports.defaultTo = function (value) { return function (data) { return data == null ? value : data; }; }; |
{ | ||
"name": "@waves/money-like-to-node", | ||
"version": "0.0.6", | ||
"version": "0.0.7", | ||
"main": "dist/index.js", | ||
@@ -10,3 +10,3 @@ "typings": "dist/index.d.ts", | ||
"dependencies": { | ||
"@waves/ts-types": "^0.2.0-beta-6" | ||
"@waves/ts-types": "^0.2.0-beta-8" | ||
}, | ||
@@ -29,3 +29,3 @@ "scripts": { | ||
"jest": { | ||
"collectCoverage": true, | ||
"collectCoverage": false, | ||
"coveragePathIgnorePatterns": [ | ||
@@ -32,0 +32,0 @@ "/node_modules/", |
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
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
76453
73
1096
1