@taquito/michel-codec 18.0.0-RC.0 → 19.0.0-beta-RC.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. package/dist/lib/base58.js +0 -1
  2. package/dist/lib/binary.js +39 -40
  3. package/dist/lib/errors.js +0 -1
  4. package/dist/lib/formatters.js +9 -10
  5. package/dist/lib/global-constants.js +0 -1
  6. package/dist/lib/macros.js +2 -3
  7. package/dist/lib/micheline-emitter.js +0 -1
  8. package/dist/lib/micheline-parser.js +7 -8
  9. package/dist/lib/micheline.js +0 -1
  10. package/dist/lib/michelson-contract.js +11 -12
  11. package/dist/lib/michelson-typecheck.js +57 -58
  12. package/dist/lib/michelson-types.js +5 -8
  13. package/dist/lib/michelson-validator.js +0 -1
  14. package/dist/lib/scan.js +1 -2
  15. package/dist/lib/taquito-michel-codec.js +5 -2
  16. package/dist/lib/utils.js +10 -11
  17. package/dist/lib/version.js +2 -3
  18. package/dist/taquito-michel-codec.es6.js +5657 -5657
  19. package/dist/taquito-michel-codec.es6.js.map +1 -1
  20. package/dist/taquito-michel-codec.umd.js +5657 -5659
  21. package/dist/taquito-michel-codec.umd.js.map +1 -1
  22. package/dist/types/base58.d.ts +13 -13
  23. package/dist/types/binary.d.ts +127 -127
  24. package/dist/types/errors.d.ts +57 -57
  25. package/dist/types/formatters.d.ts +6 -6
  26. package/dist/types/global-constants.d.ts +3 -3
  27. package/dist/types/macros.d.ts +13 -13
  28. package/dist/types/micheline-emitter.d.ts +17 -17
  29. package/dist/types/micheline-parser.d.ts +130 -130
  30. package/dist/types/micheline.d.ts +44 -44
  31. package/dist/types/michelson-contract.d.ts +24 -24
  32. package/dist/types/michelson-typecheck.d.ts +38 -38
  33. package/dist/types/michelson-types.d.ts +135 -137
  34. package/dist/types/michelson-validator.d.ts +66 -66
  35. package/dist/types/scan.d.ts +26 -26
  36. package/dist/types/taquito-michel-codec.d.ts +16 -16
  37. package/dist/types/utils.d.ts +77 -77
  38. package/dist/types/version.d.ts +4 -4
  39. package/package.json +24 -26
  40. package/signature.json +28 -10
  41. package/dist/lib/base58.js.map +0 -1
  42. package/dist/lib/binary.js.map +0 -1
  43. package/dist/lib/errors.js.map +0 -1
  44. package/dist/lib/formatters.js.map +0 -1
  45. package/dist/lib/global-constants.js.map +0 -1
  46. package/dist/lib/macros.js.map +0 -1
  47. package/dist/lib/micheline-emitter.js.map +0 -1
  48. package/dist/lib/micheline-parser.js.map +0 -1
  49. package/dist/lib/micheline.js.map +0 -1
  50. package/dist/lib/michelson-contract.js.map +0 -1
  51. package/dist/lib/michelson-typecheck.js.map +0 -1
  52. package/dist/lib/michelson-types.js.map +0 -1
  53. package/dist/lib/michelson-validator.js.map +0 -1
  54. package/dist/lib/scan.js.map +0 -1
  55. package/dist/lib/taquito-michel-codec.js.map +0 -1
  56. package/dist/lib/utils.js.map +0 -1
  57. package/dist/lib/version.js.map +0 -1
@@ -1,13 +1,13 @@
1
- import { TaquitoError } from '@taquito/core';
2
- /**
3
- * @category Error
4
- * @description Error that indicates a failure when decoding a base58 encoding
5
- */
6
- export declare class Base58DecodingError extends TaquitoError {
7
- readonly message: string;
8
- constructor(message: string);
9
- }
10
- export declare function decodeBase58(src: string): number[];
11
- export declare function encodeBase58(src: number[] | Uint8Array): string;
12
- export declare function decodeBase58Check(src: string): number[];
13
- export declare function encodeBase58Check(src: number[] | Uint8Array): string;
1
+ import { TaquitoError } from '@taquito/core';
2
+ /**
3
+ * @category Error
4
+ * @description Error that indicates a failure when decoding a base58 encoding
5
+ */
6
+ export declare class Base58DecodingError extends TaquitoError {
7
+ readonly message: string;
8
+ constructor(message: string);
9
+ }
10
+ export declare function decodeBase58(src: string): number[];
11
+ export declare function encodeBase58(src: number[] | Uint8Array): string;
12
+ export declare function decodeBase58Check(src: string): number[];
13
+ export declare function encodeBase58Check(src: number[] | Uint8Array): string;
@@ -1,127 +1,127 @@
1
- import { BytesLiteral } from './micheline';
2
- import { MichelsonData, MichelsonType } from './michelson-types';
3
- declare type AddressType = 'ED25519PublicKeyHash' | 'SECP256K1PublicKeyHash' | 'P256PublicKeyHash' | 'ContractHash';
4
- export interface Address {
5
- type: AddressType;
6
- hash: number[] | Uint8Array;
7
- entryPoint?: string;
8
- }
9
- export declare type PublicKeyType = 'ED25519PublicKey' | 'SECP256K1PublicKey' | 'P256PublicKey';
10
- export interface PublicKey {
11
- type: PublicKeyType;
12
- publicKey: number[] | Uint8Array;
13
- }
14
- /**
15
- * Serializes any value of packable type to its optimized binary representation
16
- * identical to the one used by PACK and UNPACK Michelson instructions.
17
- * Without a type definition (not recommended) the data will be encoded as a binary form of a generic Michelson expression.
18
- * Type definition allows some types like `timestamp` and `address` and other base58 representable types to be encoded to
19
- * corresponding optimized binary forms borrowed from the Tezos protocol
20
- *
21
- * ```typescript
22
- * const data: MichelsonData = {
23
- * string: "KT1RvkwF4F7pz1gCoxkyZrG1RkrxQy3gmFTv%foo"
24
- * };
25
- *
26
- * const typ: MichelsonType = {
27
- * prim: "address"
28
- * };
29
- *
30
- * const packed = packData(data, typ);
31
- *
32
- * // 050a0000001901be41ee922ddd2cf33201e49d32da0afec571dce300666f6f
33
- * ```
34
- *
35
- * Without a type definition the base58 encoded address will be treated as a string
36
- * ```typescript
37
- * const data: MichelsonData = {
38
- * string: "KT1RvkwF4F7pz1gCoxkyZrG1RkrxQy3gmFTv%foo"
39
- * };
40
- *
41
- * const packed = packData(data);
42
- *
43
- * // 0501000000284b543152766b7746344637707a3167436f786b795a724731526b7278517933676d46547625666f6f
44
- * ```
45
- * @param d Data object
46
- * @param t Optional type definition
47
- * @returns Binary representation as numeric array
48
- */
49
- export declare function packData(d: MichelsonData, t?: MichelsonType): number[];
50
- /**
51
- * Serializes any value of packable type to its optimized binary representation
52
- * identical to the one used by PACK and UNPACK Michelson instructions.
53
- * Same as {@link packData} but returns a `bytes` Michelson data literal instead of an array
54
- *
55
- * ```typescript
56
- * const data: MichelsonData = {
57
- * string: "2019-09-26T10:59:51Z"
58
- * };
59
- *
60
- * const typ: MichelsonType = {
61
- * prim: "timestamp"
62
- * };
63
- *
64
- * const packed = packDataBytes(data, typ);
65
- *
66
- * // { bytes: "0500a7e8e4d80b" }
67
- * ```
68
- * @param d Data object
69
- * @param t Optional type definition
70
- * @returns Binary representation as a bytes literal
71
- */
72
- export declare function packDataBytes(d: MichelsonData, t?: MichelsonType): BytesLiteral;
73
- /**
74
- * Deserialize a byte array into the corresponding Michelson value.
75
- * Without a type definition (not recommended) the binary data will be treated as a binary form of a generic Michelson expression and returned as is.
76
- * Type definition allows some types like `timestamp` and `address` and other types usually encoded in optimized binary forms to be transformed
77
- * back to their string representations like base58 and ISO timestamps.
78
- *
79
- * ```typescript
80
- * const src = [0x05, 0x00, 0xa7, 0xe8, 0xe4, 0xd8, 0x0b];
81
- *
82
- * const typ: MichelsonType = {
83
- * prim: "timestamp"
84
- * };
85
- *
86
- * const data = unpackData(src, typ);
87
- *
88
- * // { string: "2019-09-26T10:59:51Z" }
89
- * ```
90
- *
91
- * Same binary data without a type definition
92
- * ```typescript
93
- * const src = [0x05, 0x00, 0xa7, 0xe8, 0xe4, 0xd8, 0x0b];
94
- *
95
- * const data = unpackData(src);
96
- *
97
- * // { int: "1569495591" }
98
- * ```
99
- * @param src Byte array
100
- * @param t Optional type definition
101
- * @returns Deserialized data
102
- */
103
- export declare function unpackData(src: number[] | Uint8Array, t?: MichelsonType): MichelsonData;
104
- /**
105
- * Deserialize a byte array into the corresponding Michelson value.
106
- * Same as {@link unpackData} but takes a `bytes` Michelson data literal instead of an array
107
- *
108
- * ```typescript
109
- * const src = { bytes: "0500a7e8e4d80b" };
110
- *
111
- * const typ: MichelsonType = {
112
- * prim: "timestamp"
113
- * };
114
- *
115
- * const data = unpackDataBytes(src, typ);
116
- *
117
- * // { string: "2019-09-26T10:59:51Z" }
118
- * ```
119
- * @param src Bytes object
120
- * @param t Optional type definition
121
- * @returns Deserialized data
122
- */
123
- export declare function unpackDataBytes(src: BytesLiteral, t?: MichelsonType): MichelsonData;
124
- export declare function decodeAddressBytes(b: BytesLiteral): Address;
125
- export declare function decodePublicKeyHashBytes(b: BytesLiteral): Address;
126
- export declare function decodePublicKeyBytes(b: BytesLiteral): PublicKey;
127
- export {};
1
+ import { BytesLiteral } from './micheline';
2
+ import { MichelsonData, MichelsonType } from './michelson-types';
3
+ type AddressType = 'ED25519PublicKeyHash' | 'SECP256K1PublicKeyHash' | 'P256PublicKeyHash' | 'ContractHash';
4
+ export interface Address {
5
+ type: AddressType;
6
+ hash: number[] | Uint8Array;
7
+ entryPoint?: string;
8
+ }
9
+ export type PublicKeyType = 'ED25519PublicKey' | 'SECP256K1PublicKey' | 'P256PublicKey';
10
+ export interface PublicKey {
11
+ type: PublicKeyType;
12
+ publicKey: number[] | Uint8Array;
13
+ }
14
+ /**
15
+ * Serializes any value of packable type to its optimized binary representation
16
+ * identical to the one used by PACK and UNPACK Michelson instructions.
17
+ * Without a type definition (not recommended) the data will be encoded as a binary form of a generic Michelson expression.
18
+ * Type definition allows some types like `timestamp` and `address` and other base58 representable types to be encoded to
19
+ * corresponding optimized binary forms borrowed from the Tezos protocol
20
+ *
21
+ * ```typescript
22
+ * const data: MichelsonData = {
23
+ * string: "KT1RvkwF4F7pz1gCoxkyZrG1RkrxQy3gmFTv%foo"
24
+ * };
25
+ *
26
+ * const typ: MichelsonType = {
27
+ * prim: "address"
28
+ * };
29
+ *
30
+ * const packed = packData(data, typ);
31
+ *
32
+ * // 050a0000001901be41ee922ddd2cf33201e49d32da0afec571dce300666f6f
33
+ * ```
34
+ *
35
+ * Without a type definition the base58 encoded address will be treated as a string
36
+ * ```typescript
37
+ * const data: MichelsonData = {
38
+ * string: "KT1RvkwF4F7pz1gCoxkyZrG1RkrxQy3gmFTv%foo"
39
+ * };
40
+ *
41
+ * const packed = packData(data);
42
+ *
43
+ * // 0501000000284b543152766b7746344637707a3167436f786b795a724731526b7278517933676d46547625666f6f
44
+ * ```
45
+ * @param d Data object
46
+ * @param t Optional type definition
47
+ * @returns Binary representation as numeric array
48
+ */
49
+ export declare function packData(d: MichelsonData, t?: MichelsonType): number[];
50
+ /**
51
+ * Serializes any value of packable type to its optimized binary representation
52
+ * identical to the one used by PACK and UNPACK Michelson instructions.
53
+ * Same as {@link packData} but returns a `bytes` Michelson data literal instead of an array
54
+ *
55
+ * ```typescript
56
+ * const data: MichelsonData = {
57
+ * string: "2019-09-26T10:59:51Z"
58
+ * };
59
+ *
60
+ * const typ: MichelsonType = {
61
+ * prim: "timestamp"
62
+ * };
63
+ *
64
+ * const packed = packDataBytes(data, typ);
65
+ *
66
+ * // { bytes: "0500a7e8e4d80b" }
67
+ * ```
68
+ * @param d Data object
69
+ * @param t Optional type definition
70
+ * @returns Binary representation as a bytes literal
71
+ */
72
+ export declare function packDataBytes(d: MichelsonData, t?: MichelsonType): BytesLiteral;
73
+ /**
74
+ * Deserialize a byte array into the corresponding Michelson value.
75
+ * Without a type definition (not recommended) the binary data will be treated as a binary form of a generic Michelson expression and returned as is.
76
+ * Type definition allows some types like `timestamp` and `address` and other types usually encoded in optimized binary forms to be transformed
77
+ * back to their string representations like base58 and ISO timestamps.
78
+ *
79
+ * ```typescript
80
+ * const src = [0x05, 0x00, 0xa7, 0xe8, 0xe4, 0xd8, 0x0b];
81
+ *
82
+ * const typ: MichelsonType = {
83
+ * prim: "timestamp"
84
+ * };
85
+ *
86
+ * const data = unpackData(src, typ);
87
+ *
88
+ * // { string: "2019-09-26T10:59:51Z" }
89
+ * ```
90
+ *
91
+ * Same binary data without a type definition
92
+ * ```typescript
93
+ * const src = [0x05, 0x00, 0xa7, 0xe8, 0xe4, 0xd8, 0x0b];
94
+ *
95
+ * const data = unpackData(src);
96
+ *
97
+ * // { int: "1569495591" }
98
+ * ```
99
+ * @param src Byte array
100
+ * @param t Optional type definition
101
+ * @returns Deserialized data
102
+ */
103
+ export declare function unpackData(src: number[] | Uint8Array, t?: MichelsonType): MichelsonData;
104
+ /**
105
+ * Deserialize a byte array into the corresponding Michelson value.
106
+ * Same as {@link unpackData} but takes a `bytes` Michelson data literal instead of an array
107
+ *
108
+ * ```typescript
109
+ * const src = { bytes: "0500a7e8e4d80b" };
110
+ *
111
+ * const typ: MichelsonType = {
112
+ * prim: "timestamp"
113
+ * };
114
+ *
115
+ * const data = unpackDataBytes(src, typ);
116
+ *
117
+ * // { string: "2019-09-26T10:59:51Z" }
118
+ * ```
119
+ * @param src Bytes object
120
+ * @param t Optional type definition
121
+ * @returns Deserialized data
122
+ */
123
+ export declare function unpackDataBytes(src: BytesLiteral, t?: MichelsonType): MichelsonData;
124
+ export declare function decodeAddressBytes(b: BytesLiteral): Address;
125
+ export declare function decodePublicKeyHashBytes(b: BytesLiteral): Address;
126
+ export declare function decodePublicKeyBytes(b: BytesLiteral): PublicKey;
127
+ export {};
@@ -1,57 +1,57 @@
1
- import { ParameterValidationError, TaquitoError } from '@taquito/core';
2
- /**
3
- * @category Error
4
- * @description Error that indicates an invalid Michelson being passed or used
5
- */
6
- export declare class InvalidMichelsonError extends ParameterValidationError {
7
- readonly message: string;
8
- constructor(message: string);
9
- }
10
- /**
11
- * @category Error
12
- * @description Error that indicates an invalid type expression being passed or used
13
- */
14
- export declare class InvalidTypeExpressionError extends ParameterValidationError {
15
- readonly message: string;
16
- constructor(message: string);
17
- }
18
- /**
19
- * @category Error
20
- * @description Error that indicates an invalid data expression being passed or used
21
- */
22
- export declare class InvalidDataExpressionError extends ParameterValidationError {
23
- readonly message: string;
24
- constructor(message: string);
25
- }
26
- /**
27
- * @category Error
28
- * @description Error that indicates an invalid contract entrypoint being referenced or passed
29
- */
30
- export declare class InvalidEntrypointError extends ParameterValidationError {
31
- readonly entrypoint?: string | undefined;
32
- constructor(entrypoint?: string | undefined);
33
- }
34
- /**
35
- * @category Error
36
- * @description Error that indicates a failure happening when trying to encode Tezos ID
37
- */
38
- export declare class TezosIdEncodeError extends ParameterValidationError {
39
- readonly message: string;
40
- constructor(message: string);
41
- }
42
- /**
43
- * @category Error
44
- * @description Error that indicates a general error happening when trying to create a LongInteger
45
- */
46
- export declare class LongIntegerError extends TaquitoError {
47
- readonly message: string;
48
- constructor(message: string);
49
- }
50
- /**
51
- * @category Error
52
- * @description Error that indicates a failure occurring when trying to parse a hex byte
53
- */
54
- export declare class HexParseError extends TaquitoError {
55
- readonly hexByte: string;
56
- constructor(hexByte: string);
57
- }
1
+ import { ParameterValidationError, TaquitoError } from '@taquito/core';
2
+ /**
3
+ * @category Error
4
+ * @description Error that indicates an invalid Michelson being passed or used
5
+ */
6
+ export declare class InvalidMichelsonError extends ParameterValidationError {
7
+ readonly message: string;
8
+ constructor(message: string);
9
+ }
10
+ /**
11
+ * @category Error
12
+ * @description Error that indicates an invalid type expression being passed or used
13
+ */
14
+ export declare class InvalidTypeExpressionError extends ParameterValidationError {
15
+ readonly message: string;
16
+ constructor(message: string);
17
+ }
18
+ /**
19
+ * @category Error
20
+ * @description Error that indicates an invalid data expression being passed or used
21
+ */
22
+ export declare class InvalidDataExpressionError extends ParameterValidationError {
23
+ readonly message: string;
24
+ constructor(message: string);
25
+ }
26
+ /**
27
+ * @category Error
28
+ * @description Error that indicates an invalid contract entrypoint being referenced or passed
29
+ */
30
+ export declare class InvalidEntrypointError extends ParameterValidationError {
31
+ readonly entrypoint?: string | undefined;
32
+ constructor(entrypoint?: string | undefined);
33
+ }
34
+ /**
35
+ * @category Error
36
+ * @description Error that indicates a failure happening when trying to encode Tezos ID
37
+ */
38
+ export declare class TezosIdEncodeError extends ParameterValidationError {
39
+ readonly message: string;
40
+ constructor(message: string);
41
+ }
42
+ /**
43
+ * @category Error
44
+ * @description Error that indicates a general error happening when trying to create a LongInteger
45
+ */
46
+ export declare class LongIntegerError extends TaquitoError {
47
+ readonly message: string;
48
+ constructor(message: string);
49
+ }
50
+ /**
51
+ * @category Error
52
+ * @description Error that indicates a failure occurring when trying to parse a hex byte
53
+ */
54
+ export declare class HexParseError extends TaquitoError {
55
+ readonly hexByte: string;
56
+ constructor(hexByte: string);
57
+ }
@@ -1,6 +1,6 @@
1
- import { InstructionTrace } from './michelson-typecheck';
2
- import { MichelsonError } from './utils';
3
- import { MichelsonReturnType } from './michelson-types';
4
- export declare function formatStack(s: MichelsonReturnType): string;
5
- export declare function traceDumpFunc(blocks: boolean, cb: (s: string) => void): (v: InstructionTrace) => void;
6
- export declare function formatError(err: MichelsonError): string;
1
+ import { InstructionTrace } from './michelson-typecheck';
2
+ import { MichelsonError } from './utils';
3
+ import { MichelsonReturnType } from './michelson-types';
4
+ export declare function formatStack(s: MichelsonReturnType): string;
5
+ export declare function traceDumpFunc(blocks: boolean, cb: (s: string) => void): (v: InstructionTrace) => void;
6
+ export declare function formatError(err: MichelsonError): string;
@@ -1,3 +1,3 @@
1
- import { Prim, Expr } from './micheline';
2
- import { GlobalConstantHashAndValue } from './micheline-parser';
3
- export declare function expandGlobalConstants(ex: Prim, hashAndValue: GlobalConstantHashAndValue): Expr;
1
+ import { Prim, Expr } from './micheline';
2
+ import { GlobalConstantHashAndValue } from './micheline-parser';
3
+ export declare function expandGlobalConstants(ex: Prim, hashAndValue: GlobalConstantHashAndValue): Expr;
@@ -1,13 +1,13 @@
1
- import { TaquitoError } from '@taquito/core';
2
- import { Prim, Expr } from './micheline';
3
- import { ProtocolOptions } from './michelson-types';
4
- /**
5
- * @category Error
6
- * @description Error that indicates macros failed to be expanded
7
- */
8
- export declare class MacroError extends TaquitoError {
9
- readonly prim: Prim;
10
- readonly message: string;
11
- constructor(prim: Prim, message: string);
12
- }
13
- export declare function expandMacros(ex: Prim, opt?: ProtocolOptions): Expr;
1
+ import { TaquitoError } from '@taquito/core';
2
+ import { Prim, Expr } from './micheline';
3
+ import { ProtocolOptions } from './michelson-types';
4
+ /**
5
+ * @category Error
6
+ * @description Error that indicates macros failed to be expanded
7
+ */
8
+ export declare class MacroError extends TaquitoError {
9
+ readonly prim: Prim;
10
+ readonly message: string;
11
+ constructor(prim: Prim, message: string);
12
+ }
13
+ export declare function expandMacros(ex: Prim, opt?: ProtocolOptions): Expr;
@@ -1,17 +1,17 @@
1
- import { Expr } from './micheline';
2
- export interface FormatOptions {
3
- /**
4
- * A string used for code indentation if desired. Usually a tab character or a number of spaces.
5
- */
6
- indent?: string;
7
- /**
8
- * A string used for line separation. Usually a newline character ("\n");
9
- */
10
- newline?: string;
11
- }
12
- /**
13
- * Formats Micheline expression
14
- * @param expr An AST node
15
- * @param opt Options
16
- */
17
- export declare function emitMicheline(expr: Expr, opt?: FormatOptions, foldMacros?: boolean): string;
1
+ import { Expr } from './micheline';
2
+ export interface FormatOptions {
3
+ /**
4
+ * A string used for code indentation if desired. Usually a tab character or a number of spaces.
5
+ */
6
+ indent?: string;
7
+ /**
8
+ * A string used for line separation. Usually a newline character ("\n");
9
+ */
10
+ newline?: string;
11
+ }
12
+ /**
13
+ * Formats Micheline expression
14
+ * @param expr An AST node
15
+ * @param opt Options
16
+ */
17
+ export declare function emitMicheline(expr: Expr, opt?: FormatOptions, foldMacros?: boolean): string;