@vostokplatform/signature-generator
Advanced tools
Comparing version 2.0.0-RC1 to 2.0.0-RC2
@@ -56,2 +56,7 @@ import { BigNumber } from '@waves/data-entities'; | ||
} | ||
export declare class ByteArrayWithSize extends ByteProcessor<Uint8Array | string> { | ||
constructor(required: boolean); | ||
getValidationError(value: Uint8Array | string): string; | ||
getBytes(value: Uint8Array | string): Promise<Uint8Array>; | ||
} | ||
export declare class StringWithLength extends ByteProcessor<string> { | ||
@@ -69,7 +74,2 @@ constructor(required: boolean); | ||
} | ||
export declare class Attachment extends ByteProcessor<Uint8Array | string> { | ||
constructor(required: boolean); | ||
getValidationError(value: Uint8Array | string): string; | ||
getBytes(value: Uint8Array | string): Promise<Uint8Array>; | ||
} | ||
export declare class MandatoryAssetId extends ByteProcessor<string> { | ||
@@ -76,0 +76,0 @@ constructor(required: boolean); |
@@ -33,2 +33,3 @@ "use strict"; | ||
var converters_1 = require("../libs/converters"); | ||
// StringWithLength Attachment | ||
// NOTE : Waves asset ID in blockchain transactions equals to an empty string | ||
@@ -234,2 +235,26 @@ function blockchainifyAssetId(assetId) { | ||
exports.Integer = Integer; | ||
var ByteArrayWithSize = /** @class */ (function (_super) { | ||
__extends(ByteArrayWithSize, _super); | ||
function ByteArrayWithSize(required) { | ||
return _super.call(this, required) || this; | ||
} | ||
ByteArrayWithSize.prototype.getValidationError = function (value) { | ||
if (typeof value === 'string') { | ||
value = Uint8Array.from(convert_1.default.stringToByteArray(value)); | ||
} | ||
if (value.length > constants_2.TRANSFER_ATTACHMENT_BYTE_LIMIT) { | ||
return 'Maximum length is exceeded'; | ||
} | ||
return null; | ||
}; | ||
ByteArrayWithSize.prototype.getBytes = function (value) { | ||
if (typeof value === 'string') { | ||
value = Uint8Array.from(convert_1.default.stringToByteArray(value)); | ||
} | ||
var valueWithLength = convert_1.default.bytesToByteArrayWithSize(value); | ||
return Promise.resolve(Uint8Array.from(valueWithLength)); | ||
}; | ||
return ByteArrayWithSize; | ||
}(ByteProcessor)); | ||
exports.ByteArrayWithSize = ByteArrayWithSize; | ||
var StringWithLength = /** @class */ (function (_super) { | ||
@@ -276,26 +301,2 @@ __extends(StringWithLength, _super); | ||
exports.AssetId = AssetId; | ||
var Attachment = /** @class */ (function (_super) { | ||
__extends(Attachment, _super); | ||
function Attachment(required) { | ||
return _super.call(this, required) || this; | ||
} | ||
Attachment.prototype.getValidationError = function (value) { | ||
if (typeof value === 'string') { | ||
value = Uint8Array.from(convert_1.default.stringToByteArray(value)); | ||
} | ||
if (value.length > constants_2.TRANSFER_ATTACHMENT_BYTE_LIMIT) { | ||
return 'Maximum attachment length is exceeded'; | ||
} | ||
return null; | ||
}; | ||
Attachment.prototype.getBytes = function (value) { | ||
if (typeof value === 'string') { | ||
value = Uint8Array.from(convert_1.default.stringToByteArray(value)); | ||
} | ||
var valueWithLength = convert_1.default.bytesToByteArrayWithSize(value); | ||
return Promise.resolve(Uint8Array.from(valueWithLength)); | ||
}; | ||
return Attachment; | ||
}(ByteProcessor)); | ||
exports.Attachment = Attachment; | ||
var MandatoryAssetId = /** @class */ (function (_super) { | ||
@@ -302,0 +303,0 @@ __extends(MandatoryAssetId, _super); |
{ | ||
"name": "@vostokplatform/signature-generator", | ||
"version": "2.0.0-RC1", | ||
"version": "2.0.0-RC2", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "files": [ |
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 too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
5922329
101164