UNPKG

@swtc/serializer

Version:
165 lines 4.88 kB
import { IAmount } from "./model"; declare const Factory: (Wallet?: any) => { new (): { _value: any; _offset: any; _is_native: any; _is_negative: any; _currency: any; _issuer: any; bi_xns_max: any; is_valid(): boolean; currency(): string; is_native(): boolean; offset(): number; is_negative(): boolean; is_positive(): boolean; is_zero(): boolean; issuer(): string; /** * Only set the issuer if the input is a valid address. * * @param {string} issuer * @returns {Amount} * @memberof Amount */ parse_issuer(issuer: string): any; /** * For SWT, only keep as the integer with precision * * @param {string} j * @returns {Amount} * @memberof Amount */ parse_swt_value(j: string): any; /** * Parse a non-native Tum value for the json wire format. * Requires _currency not as SWT! * * @param {(number | string)} j * @returns {Amount} * @memberof Amount */ parse_tum_value(j: number | string): any; /** * Convert the internal obj to JSON * * @returns {IAmount} * @memberof Amount */ to_json(): IAmount; /** * Convert the internal Tum Code to byte array for serialization. * Input: a string represents the Tum. * Output: Bytes array of size 20 (UINT160). * * @returns {number[]} * @memberof Amount */ tum_to_bytes(): number[]; /** * Convert the input JSON data into a valid Amount object * Amount should have 3 properties: value、issuer/counterparty & currency * * Amount: * * number: 123456 * * string: "123456" * * obj: {"value": 129757.754575, "issuer":"", "currency":"USD"} * * @param {(number | string | IAmount)} in_json * @returns {Amount} * @memberof Amount */ parse_json(in_json: number | string | IAmount): any; }; DataCheck: { allNumeric: (text: any) => boolean; isCustomTum: (code: any) => boolean; isRelation: (str: any) => boolean; isTumCode: (code: any) => boolean; isCurrency: (code: any) => boolean; isLetterNumer: (str: any) => boolean; isAmount: (obj: any) => boolean; isBalance: (obj: any) => boolean; }; from_json(j: any): { _value: any; _offset: any; _is_native: any; _is_negative: any; _currency: any; _issuer: any; bi_xns_max: any; is_valid(): boolean; currency(): string; is_native(): boolean; offset(): number; is_negative(): boolean; is_positive(): boolean; is_zero(): boolean; issuer(): string; /** * Only set the issuer if the input is a valid address. * * @param {string} issuer * @returns {Amount} * @memberof Amount */ parse_issuer(issuer: string): any; /** * For SWT, only keep as the integer with precision * * @param {string} j * @returns {Amount} * @memberof Amount */ parse_swt_value(j: string): any; /** * Parse a non-native Tum value for the json wire format. * Requires _currency not as SWT! * * @param {(number | string)} j * @returns {Amount} * @memberof Amount */ parse_tum_value(j: number | string): any; /** * Convert the internal obj to JSON * * @returns {IAmount} * @memberof Amount */ to_json(): IAmount; /** * Convert the internal Tum Code to byte array for serialization. * Input: a string represents the Tum. * Output: Bytes array of size 20 (UINT160). * * @returns {number[]} * @memberof Amount */ tum_to_bytes(): number[]; /** * Convert the input JSON data into a valid Amount object * Amount should have 3 properties: value、issuer/counterparty & currency * * Amount: * * number: 123456 * * string: "123456" * * obj: {"value": 129757.754575, "issuer":"", "currency":"USD"} * * @param {(number | string | IAmount)} in_json * @returns {Amount} * @memberof Amount */ parse_json(in_json: number | string | IAmount): any; }; }; export { Factory }; //# sourceMappingURL=TumAmount.d.ts.map