@solana/codecs-strings 2.0.0-experimental.e1ca396 → 2.0.0-experimental.e58bb22
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.
- package/README.md +194 -4
- package/dist/index.browser.js +2 -0
- package/dist/index.node.js +2 -0
- package/dist/types/index.d.ts +10 -10
- package/package.json +7 -7
- package/dist/index.development.js +0 -452
- package/dist/index.development.js.map +0 -1
- package/dist/index.production.min.js +0 -37
package/README.md
CHANGED
|
@@ -16,10 +16,200 @@
|
|
|
16
16
|
|
|
17
17
|
This package contains codecs for strings of different sizes and encodings. It can be used standalone, but it is also exported as part of the Solana JavaScript SDK [`@solana/web3.js@experimental`](https://github.com/solana-labs/solana-web3.js/tree/master/packages/library).
|
|
18
18
|
|
|
19
|
-
|
|
19
|
+
This package is also part of the [`@solana/codecs` package](https://github.com/solana-labs/solana-web3.js/tree/master/packages/codecs) which acts as an entry point for all codec packages as well as for their documentation.
|
|
20
20
|
|
|
21
|
-
|
|
21
|
+
## String helper codec
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
The `getStringCodec` function returns a `Codec<string>` that can be used to encode strings using various encodings and size strategies. It contains the following options:
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
- `encoding`: A `VariableSizeCodec<string>` responsible for encoding and decoding a string in a specific way without worrying about its size. Examples are UTF-8, base58, base64, etc. You can see all available encodings below in this documentation.
|
|
26
|
+
- `size`: This option tells the codec how long the string goes on for in the byte array. It can be one of the following three strategies:
|
|
27
|
+
- `Codec<number>`: When a number codec is provided, that codec will be used to encode and decode a size prefix for that string. This prefix allows us to know when to stop reading the string when decoding a given byte array.
|
|
28
|
+
- `number`: When a fixed number is provided, a `FixedSizeCodec` of that size will be returned such that exactly that amount of bytes will be used to encode and decode the string.
|
|
29
|
+
- `"variable"`: When the string `"variable"` is passed as a size, a `VariableSizeCodec` will be returned without any size boundary. That is, when providing a byte array to decode, the entire byte array will be decoded as a string.
|
|
30
|
+
|
|
31
|
+
When using `getStringCodec` without any options, the default encoding used is UTF-8 and the default size strategy used is a `u32` prefix codec.
|
|
32
|
+
|
|
33
|
+
```ts
|
|
34
|
+
const bytes = getStringCodec().encode('hello');
|
|
35
|
+
// 0x0500000068656c6c6f
|
|
36
|
+
// | └-- The 5 bytes of content.
|
|
37
|
+
// └-- 4-byte prefix telling us to read 5 bytes.
|
|
38
|
+
|
|
39
|
+
const value = getStringCodec().decode(bytes);
|
|
40
|
+
// "hello"
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
We can use the `size` option to provide a different integer codec for the prefix.
|
|
44
|
+
|
|
45
|
+
```ts
|
|
46
|
+
getStringCodec({ size: getU8Codec() }).encode('hello');
|
|
47
|
+
// 0x0568656c6c6f
|
|
48
|
+
// | └-- The 5 bytes of content.
|
|
49
|
+
// └-- 1-byte prefix telling us to read 5 bytes.
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
Or to provide a fixed size such that any string longer or smaller than that size will be truncated or padded respectively.
|
|
53
|
+
|
|
54
|
+
```ts
|
|
55
|
+
getStringCodec({ size: 5 }).encode('hello');
|
|
56
|
+
// 0x68656c6c6f
|
|
57
|
+
// └-- The exact 5 bytes of content.
|
|
58
|
+
|
|
59
|
+
getStringCodec({ size: 5 }).encode('hello world');
|
|
60
|
+
// 0x68656c6c6f
|
|
61
|
+
// └-- The truncated 5 bytes of content.
|
|
62
|
+
|
|
63
|
+
getStringCodec({ size: 5 }).encode('hell');
|
|
64
|
+
// 0x68656c6c00
|
|
65
|
+
// └-- The padded 5 bytes of content.
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
Or to tell the codec we do not want to create a size boundary for our string.
|
|
69
|
+
|
|
70
|
+
```ts
|
|
71
|
+
getStringCodec({ size: 'variable' }).encode('hello');
|
|
72
|
+
// 0x68656c6c6f
|
|
73
|
+
// └-- Any bytes necessary to encode our content.
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
On top of customizing the size, we may provide a custom `encoding` option like so.
|
|
77
|
+
|
|
78
|
+
```ts
|
|
79
|
+
getStringCodec({ encoding: getUtf8Codec() }).encode('hello');
|
|
80
|
+
// 0x0500000068656c6c6f (Default encoding).
|
|
81
|
+
|
|
82
|
+
getStringCodec({ encoding: getBase64Codec() }).encode('hello');
|
|
83
|
+
// 0x0300000085e965
|
|
84
|
+
|
|
85
|
+
getStringCodec({ encoding: getBase58Codec() }).encode('heLLo');
|
|
86
|
+
// 0x040000001b6a3070
|
|
87
|
+
```
|
|
88
|
+
|
|
89
|
+
Finally, separate `getStringEncoder` and `getStringDecoder` functions are also available.
|
|
90
|
+
|
|
91
|
+
```ts
|
|
92
|
+
const bytes = getStringEncoder().encode('hello');
|
|
93
|
+
const value = getStringDecoder().decode(bytes);
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
## Utf8 codec
|
|
97
|
+
|
|
98
|
+
The `getUtf8Codec` function encodes and decodes a UTF-8 string to and from a byte array.
|
|
99
|
+
|
|
100
|
+
```ts
|
|
101
|
+
const bytes = getUtf8Codec().encode('hello'); // 0x68656c6c6f
|
|
102
|
+
const value = getUtf8Codec().decode(bytes); // "hello"
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
As usual, separate `getUtf8Encoder` and `getUtf8Decoder` functions are also available.
|
|
106
|
+
|
|
107
|
+
```ts
|
|
108
|
+
const bytes = getUtf8Encoder().encode('hello'); // 0x68656c6c6f
|
|
109
|
+
const value = getUtf8Decoder().decode(bytes); // "hello"
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
## Base 64 codec
|
|
113
|
+
|
|
114
|
+
The `getBase64Codec` function encodes and decodes a base-64 string to and from a byte array.
|
|
115
|
+
|
|
116
|
+
```ts
|
|
117
|
+
const bytes = getBase64Codec().encode('hello+world'); // 0x85e965a3ec28ae57
|
|
118
|
+
const value = getBase64Codec().decode(bytes); // "hello+world"
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
As usual, separate `getBase64Encoder` and `getBase64Decoder` functions are also available.
|
|
122
|
+
|
|
123
|
+
```ts
|
|
124
|
+
const bytes = getBase64Encoder().encode('hello+world'); // 0x85e965a3ec28ae57
|
|
125
|
+
const value = getBase64Decoder().decode(bytes); // "hello+world"
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
## Base 58 codec
|
|
129
|
+
|
|
130
|
+
The `getBase58Codec` function encodes and decodes a base-58 string to and from a byte array.
|
|
131
|
+
|
|
132
|
+
```ts
|
|
133
|
+
const bytes = getBase58Codec().encode('heLLo'); // 0x1b6a3070
|
|
134
|
+
const value = getBase58Codec().decode(bytes); // "heLLo"
|
|
135
|
+
```
|
|
136
|
+
|
|
137
|
+
As usual, separate `getBase58Encoder` and `getBase58Decoder` functions are also available.
|
|
138
|
+
|
|
139
|
+
```ts
|
|
140
|
+
const bytes = getBase58Encoder().encode('heLLo'); // 0x1b6a3070
|
|
141
|
+
const value = getBase58Decoder().decode(bytes); // "heLLo"
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
## Base 16 codec
|
|
145
|
+
|
|
146
|
+
The `getBase16Codec` function encodes and decodes a base-16 string to and from a byte array.
|
|
147
|
+
|
|
148
|
+
```ts
|
|
149
|
+
const bytes = getBase16Codec().encode('deadface'); // 0xdeadface
|
|
150
|
+
const value = getBase16Codec().decode(bytes); // "deadface"
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
As usual, separate `getBase16Encoder` and `getBase16Decoder` functions are also available.
|
|
154
|
+
|
|
155
|
+
```ts
|
|
156
|
+
const bytes = getBase16Encoder().encode('deadface'); // 0xdeadface
|
|
157
|
+
const value = getBase16Decoder().decode(bytes); // "deadface"
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
## Base 10 codec
|
|
161
|
+
|
|
162
|
+
The `getBase10Codec` function encodes and decodes a base-10 string to and from a byte array.
|
|
163
|
+
|
|
164
|
+
```ts
|
|
165
|
+
const bytes = getBase10Codec().encode('1024'); // 0x0400
|
|
166
|
+
const value = getBase10Codec().decode(bytes); // "1024"
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
As usual, separate `getBase10Encoder` and `getBase10Decoder` functions are also available.
|
|
170
|
+
|
|
171
|
+
```ts
|
|
172
|
+
const bytes = getBase10Encoder().encode('1024'); // 0x0400
|
|
173
|
+
const value = getBase10Decoder().decode(bytes); // "1024"
|
|
174
|
+
```
|
|
175
|
+
|
|
176
|
+
## Base X codec
|
|
177
|
+
|
|
178
|
+
The `getBaseXCodec` accepts a custom `alphabet` of `X` characters and creates a base-X codec using that alphabet. It does so by iteratively dividing by `X` and handling leading zeros.
|
|
179
|
+
|
|
180
|
+
The base-10 and base-58 codecs use this base-x codec under the hood.
|
|
181
|
+
|
|
182
|
+
```ts
|
|
183
|
+
const alphabet = '0ehlo';
|
|
184
|
+
const bytes = getBaseXCodec(alphabet).encode('hello'); // 0x05bd
|
|
185
|
+
const value = getBaseXCodec(alphabet).decode(bytes); // "hello"
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
As usual, separate `getBaseXEncoder` and `getBaseXDecoder` functions are also available.
|
|
189
|
+
|
|
190
|
+
```ts
|
|
191
|
+
const bytes = getBaseXEncoder(alphabet).encode('hello'); // 0x05bd
|
|
192
|
+
const value = getBaseXDecoder(alphabet).decode(bytes); // "hello"
|
|
193
|
+
```
|
|
194
|
+
|
|
195
|
+
## Re-slicing base X codec
|
|
196
|
+
|
|
197
|
+
The `getBaseXResliceCodec` also creates a base-x codec but uses a different strategy. It re-slices bytes into custom chunks of bits that are then mapped to a provided `alphabet`. The number of bits per chunk is also provided and should typically be set to `log2(alphabet.length)`.
|
|
198
|
+
|
|
199
|
+
This is typically used to create codecs whose alphabet’s length is a power of 2 such as base-16 or base-64.
|
|
200
|
+
|
|
201
|
+
```ts
|
|
202
|
+
const bytes = getBaseXResliceCodec('elho', 2).encode('hellolol'); // 0x4aee
|
|
203
|
+
const value = getBaseXResliceCodec('elho', 2).decode(bytes); // "hellolol"
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
As usual, separate `getBaseXResliceEncoder` and `getBaseXResliceDecoder` functions are also available.
|
|
207
|
+
|
|
208
|
+
```ts
|
|
209
|
+
const bytes = getBaseXResliceEncoder('elho', 2).encode('hellolol'); // 0x4aee
|
|
210
|
+
const value = getBaseXResliceDecoder('elho', 2).decode(bytes); // "hellolol"
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
---
|
|
214
|
+
|
|
215
|
+
To read more about the available codecs and how to use them, check out the documentation of the main [`@solana/codecs` package](https://github.com/solana-labs/solana-web3.js/tree/master/packages/codecs).
|
package/dist/index.browser.js
CHANGED
|
@@ -261,3 +261,5 @@ function getStringCodec(config = {}) {
|
|
|
261
261
|
}
|
|
262
262
|
|
|
263
263
|
export { assertValidBaseString, getBase10Codec, getBase10Decoder, getBase10Encoder, getBase16Codec, getBase16Decoder, getBase16Encoder, getBase58Codec, getBase58Decoder, getBase58Encoder, getBase64Codec, getBase64Decoder, getBase64Encoder, getBaseXCodec, getBaseXDecoder, getBaseXEncoder, getBaseXResliceCodec, getBaseXResliceDecoder, getBaseXResliceEncoder, getStringCodec, getStringDecoder, getStringEncoder, getUtf8Codec, getUtf8Decoder, getUtf8Encoder, padNullCharacters, removeNullCharacters };
|
|
264
|
+
//# sourceMappingURL=out.js.map
|
|
265
|
+
//# sourceMappingURL=index.browser.js.map
|
package/dist/index.node.js
CHANGED
|
@@ -251,3 +251,5 @@ function getStringCodec(config = {}) {
|
|
|
251
251
|
}
|
|
252
252
|
|
|
253
253
|
export { assertValidBaseString, getBase10Codec, getBase10Decoder, getBase10Encoder, getBase16Codec, getBase16Decoder, getBase16Encoder, getBase58Codec, getBase58Decoder, getBase58Encoder, getBase64Codec, getBase64Decoder, getBase64Encoder, getBaseXCodec, getBaseXDecoder, getBaseXEncoder, getBaseXResliceCodec, getBaseXResliceDecoder, getBaseXResliceEncoder, getStringCodec, getStringDecoder, getStringEncoder, getUtf8Codec, getUtf8Decoder, getUtf8Encoder, padNullCharacters, removeNullCharacters };
|
|
254
|
+
//# sourceMappingURL=out.js.map
|
|
255
|
+
//# sourceMappingURL=index.node.js.map
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
export * from './assertions';
|
|
2
|
-
export * from './base10';
|
|
3
|
-
export * from './base16';
|
|
4
|
-
export * from './base58';
|
|
5
|
-
export * from './base64';
|
|
6
|
-
export * from './baseX';
|
|
7
|
-
export * from './baseX-reslice';
|
|
8
|
-
export * from './null-characters';
|
|
9
|
-
export * from './string';
|
|
10
|
-
export * from './utf8';
|
|
1
|
+
export * from './assertions.js';
|
|
2
|
+
export * from './base10.js';
|
|
3
|
+
export * from './base16.js';
|
|
4
|
+
export * from './base58.js';
|
|
5
|
+
export * from './base64.js';
|
|
6
|
+
export * from './baseX.js';
|
|
7
|
+
export * from './baseX-reslice.js';
|
|
8
|
+
export * from './null-characters.js';
|
|
9
|
+
export * from './string.js';
|
|
10
|
+
export * from './utf8.js';
|
|
11
11
|
//# sourceMappingURL=index.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solana/codecs-strings",
|
|
3
|
-
"version": "2.0.0-experimental.
|
|
3
|
+
"version": "2.0.0-experimental.e58bb22",
|
|
4
4
|
"description": "Codecs for strings of different sizes and encodings",
|
|
5
5
|
"exports": {
|
|
6
6
|
"browser": {
|
|
@@ -49,15 +49,15 @@
|
|
|
49
49
|
"node": ">=17.4"
|
|
50
50
|
},
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"@solana/codecs-core": "2.0.0-experimental.
|
|
53
|
-
"@solana/codecs-numbers": "2.0.0-experimental.
|
|
52
|
+
"@solana/codecs-core": "2.0.0-experimental.e58bb22",
|
|
53
|
+
"@solana/codecs-numbers": "2.0.0-experimental.e58bb22"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@solana/eslint-config-solana": "^1.0.2",
|
|
57
57
|
"@swc/jest": "^0.2.29",
|
|
58
|
-
"@types/jest": "^29.5.
|
|
58
|
+
"@types/jest": "^29.5.11",
|
|
59
59
|
"@types/node": "18.11.19",
|
|
60
|
-
"@typescript-eslint/eslint-plugin": "^6.
|
|
60
|
+
"@typescript-eslint/eslint-plugin": "^6.13.2",
|
|
61
61
|
"@typescript-eslint/parser": "^6.3.0",
|
|
62
62
|
"agadoo": "^3.0.0",
|
|
63
63
|
"eslint": "^8.45.0",
|
|
@@ -88,8 +88,8 @@
|
|
|
88
88
|
]
|
|
89
89
|
},
|
|
90
90
|
"scripts": {
|
|
91
|
-
"compile:js": "tsup --config build-scripts/tsup.config.
|
|
92
|
-
"compile:typedefs": "tsc -p ./tsconfig.declarations.json",
|
|
91
|
+
"compile:js": "tsup --config build-scripts/tsup.config.package.ts",
|
|
92
|
+
"compile:typedefs": "tsc -p ./tsconfig.declarations.json && node node_modules/build-scripts/add-js-extension-to-types.mjs",
|
|
93
93
|
"dev": "jest -c node_modules/test-config/jest-dev.config.ts --rootDir . --watch",
|
|
94
94
|
"publish-packages": "pnpm publish --tag experimental --access public --no-git-checks",
|
|
95
95
|
"style:fix": "pnpm eslint --fix src/* && pnpm prettier -w src/* package.json",
|
|
@@ -1,452 +0,0 @@
|
|
|
1
|
-
this.globalThis = this.globalThis || {};
|
|
2
|
-
this.globalThis.solanaWeb3 = (function (exports) {
|
|
3
|
-
'use strict';
|
|
4
|
-
|
|
5
|
-
// src/assertions.ts
|
|
6
|
-
function assertValidBaseString(alphabet4, testValue, givenValue = testValue) {
|
|
7
|
-
if (!testValue.match(new RegExp(`^[${alphabet4}]*$`))) {
|
|
8
|
-
throw new Error(`Expected a string of base ${alphabet4.length}, got [${givenValue}].`);
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
// ../codecs-core/dist/index.browser.js
|
|
13
|
-
function assertByteArrayIsNotEmptyForCodec(codecDescription, bytes, offset = 0) {
|
|
14
|
-
if (bytes.length - offset <= 0) {
|
|
15
|
-
throw new Error(`Codec [${codecDescription}] cannot decode empty byte arrays.`);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
function assertByteArrayHasEnoughBytesForCodec(codecDescription, expected, bytes, offset = 0) {
|
|
19
|
-
const bytesLength = bytes.length - offset;
|
|
20
|
-
if (bytesLength < expected) {
|
|
21
|
-
throw new Error(`Codec [${codecDescription}] expected ${expected} bytes, got ${bytesLength}.`);
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
var padBytes = (bytes, length) => {
|
|
25
|
-
if (bytes.length >= length)
|
|
26
|
-
return bytes;
|
|
27
|
-
const paddedBytes = new Uint8Array(length).fill(0);
|
|
28
|
-
paddedBytes.set(bytes);
|
|
29
|
-
return paddedBytes;
|
|
30
|
-
};
|
|
31
|
-
var fixBytes = (bytes, length) => padBytes(bytes.length <= length ? bytes : bytes.slice(0, length), length);
|
|
32
|
-
function getEncodedSize(value, encoder) {
|
|
33
|
-
return "fixedSize" in encoder ? encoder.fixedSize : encoder.getSizeFromValue(value);
|
|
34
|
-
}
|
|
35
|
-
function createEncoder(encoder) {
|
|
36
|
-
return Object.freeze({
|
|
37
|
-
...encoder,
|
|
38
|
-
encode: (value) => {
|
|
39
|
-
const bytes = new Uint8Array(getEncodedSize(value, encoder));
|
|
40
|
-
encoder.write(value, bytes, 0);
|
|
41
|
-
return bytes;
|
|
42
|
-
}
|
|
43
|
-
});
|
|
44
|
-
}
|
|
45
|
-
function createDecoder(decoder) {
|
|
46
|
-
return Object.freeze({
|
|
47
|
-
...decoder,
|
|
48
|
-
decode: (bytes, offset = 0) => decoder.read(bytes, offset)[0]
|
|
49
|
-
});
|
|
50
|
-
}
|
|
51
|
-
function isFixedSize(codec) {
|
|
52
|
-
return "fixedSize" in codec && typeof codec.fixedSize === "number";
|
|
53
|
-
}
|
|
54
|
-
function combineCodec(encoder, decoder) {
|
|
55
|
-
if (isFixedSize(encoder) !== isFixedSize(decoder)) {
|
|
56
|
-
throw new Error(`Encoder and decoder must either both be fixed-size or variable-size.`);
|
|
57
|
-
}
|
|
58
|
-
if (isFixedSize(encoder) && isFixedSize(decoder) && encoder.fixedSize !== decoder.fixedSize) {
|
|
59
|
-
throw new Error(
|
|
60
|
-
`Encoder and decoder must have the same fixed size, got [${encoder.fixedSize}] and [${decoder.fixedSize}].`
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
|
-
if (!isFixedSize(encoder) && !isFixedSize(decoder) && encoder.maxSize !== decoder.maxSize) {
|
|
64
|
-
throw new Error(
|
|
65
|
-
`Encoder and decoder must have the same max size, got [${encoder.maxSize}] and [${decoder.maxSize}].`
|
|
66
|
-
);
|
|
67
|
-
}
|
|
68
|
-
return {
|
|
69
|
-
...decoder,
|
|
70
|
-
...encoder,
|
|
71
|
-
decode: decoder.decode,
|
|
72
|
-
encode: encoder.encode,
|
|
73
|
-
read: decoder.read,
|
|
74
|
-
write: encoder.write
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
function fixEncoder(encoder, fixedBytes) {
|
|
78
|
-
return createEncoder({
|
|
79
|
-
fixedSize: fixedBytes,
|
|
80
|
-
write: (value, bytes, offset) => {
|
|
81
|
-
const variableByteArray = encoder.encode(value);
|
|
82
|
-
const fixedByteArray = variableByteArray.length > fixedBytes ? variableByteArray.slice(0, fixedBytes) : variableByteArray;
|
|
83
|
-
bytes.set(fixedByteArray, offset);
|
|
84
|
-
return offset + fixedBytes;
|
|
85
|
-
}
|
|
86
|
-
});
|
|
87
|
-
}
|
|
88
|
-
function fixDecoder(decoder, fixedBytes) {
|
|
89
|
-
return createDecoder({
|
|
90
|
-
fixedSize: fixedBytes,
|
|
91
|
-
read: (bytes, offset) => {
|
|
92
|
-
assertByteArrayHasEnoughBytesForCodec("fixCodec", fixedBytes, bytes, offset);
|
|
93
|
-
if (offset > 0 || bytes.length > fixedBytes) {
|
|
94
|
-
bytes = bytes.slice(offset, offset + fixedBytes);
|
|
95
|
-
}
|
|
96
|
-
if (isFixedSize(decoder)) {
|
|
97
|
-
bytes = fixBytes(bytes, decoder.fixedSize);
|
|
98
|
-
}
|
|
99
|
-
const [value] = decoder.read(bytes, 0);
|
|
100
|
-
return [value, offset + fixedBytes];
|
|
101
|
-
}
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
// src/baseX.ts
|
|
106
|
-
var getBaseXEncoder = (alphabet4) => {
|
|
107
|
-
return createEncoder({
|
|
108
|
-
getSizeFromValue: (value) => {
|
|
109
|
-
const [leadingZeroes, tailChars] = partitionLeadingZeroes(value, alphabet4[0]);
|
|
110
|
-
if (tailChars === "")
|
|
111
|
-
return value.length;
|
|
112
|
-
const base10Number = getBigIntFromBaseX(tailChars, alphabet4);
|
|
113
|
-
return leadingZeroes.length + Math.ceil(base10Number.toString(16).length / 2);
|
|
114
|
-
},
|
|
115
|
-
write(value, bytes, offset) {
|
|
116
|
-
assertValidBaseString(alphabet4, value);
|
|
117
|
-
if (value === "")
|
|
118
|
-
return offset;
|
|
119
|
-
const [leadingZeroes, tailChars] = partitionLeadingZeroes(value, alphabet4[0]);
|
|
120
|
-
if (tailChars === "") {
|
|
121
|
-
bytes.set(new Uint8Array(leadingZeroes.length).fill(0), offset);
|
|
122
|
-
return offset + leadingZeroes.length;
|
|
123
|
-
}
|
|
124
|
-
let base10Number = getBigIntFromBaseX(tailChars, alphabet4);
|
|
125
|
-
const tailBytes = [];
|
|
126
|
-
while (base10Number > 0n) {
|
|
127
|
-
tailBytes.unshift(Number(base10Number % 256n));
|
|
128
|
-
base10Number /= 256n;
|
|
129
|
-
}
|
|
130
|
-
const bytesToAdd = [...Array(leadingZeroes.length).fill(0), ...tailBytes];
|
|
131
|
-
bytes.set(bytesToAdd, offset);
|
|
132
|
-
return offset + bytesToAdd.length;
|
|
133
|
-
}
|
|
134
|
-
});
|
|
135
|
-
};
|
|
136
|
-
var getBaseXDecoder = (alphabet4) => {
|
|
137
|
-
return createDecoder({
|
|
138
|
-
read(rawBytes, offset) {
|
|
139
|
-
const bytes = offset === 0 ? rawBytes : rawBytes.slice(offset);
|
|
140
|
-
if (bytes.length === 0)
|
|
141
|
-
return ["", 0];
|
|
142
|
-
let trailIndex = bytes.findIndex((n) => n !== 0);
|
|
143
|
-
trailIndex = trailIndex === -1 ? bytes.length : trailIndex;
|
|
144
|
-
const leadingZeroes = alphabet4[0].repeat(trailIndex);
|
|
145
|
-
if (trailIndex === bytes.length)
|
|
146
|
-
return [leadingZeroes, rawBytes.length];
|
|
147
|
-
const base10Number = bytes.slice(trailIndex).reduce((sum, byte) => sum * 256n + BigInt(byte), 0n);
|
|
148
|
-
const tailChars = getBaseXFromBigInt(base10Number, alphabet4);
|
|
149
|
-
return [leadingZeroes + tailChars, rawBytes.length];
|
|
150
|
-
}
|
|
151
|
-
});
|
|
152
|
-
};
|
|
153
|
-
var getBaseXCodec = (alphabet4) => combineCodec(getBaseXEncoder(alphabet4), getBaseXDecoder(alphabet4));
|
|
154
|
-
function partitionLeadingZeroes(value, zeroCharacter) {
|
|
155
|
-
const leadingZeroIndex = [...value].findIndex((c) => c !== zeroCharacter);
|
|
156
|
-
return leadingZeroIndex === -1 ? [value, ""] : [value.slice(0, leadingZeroIndex), value.slice(leadingZeroIndex)];
|
|
157
|
-
}
|
|
158
|
-
function getBigIntFromBaseX(value, alphabet4) {
|
|
159
|
-
const base = BigInt(alphabet4.length);
|
|
160
|
-
return [...value].reduce((sum, char) => sum * base + BigInt(alphabet4.indexOf(char)), 0n);
|
|
161
|
-
}
|
|
162
|
-
function getBaseXFromBigInt(value, alphabet4) {
|
|
163
|
-
const base = BigInt(alphabet4.length);
|
|
164
|
-
const tailChars = [];
|
|
165
|
-
while (value > 0n) {
|
|
166
|
-
tailChars.unshift(alphabet4[Number(value % base)]);
|
|
167
|
-
value /= base;
|
|
168
|
-
}
|
|
169
|
-
return tailChars.join("");
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
// src/base10.ts
|
|
173
|
-
var alphabet = "0123456789";
|
|
174
|
-
var getBase10Encoder = () => getBaseXEncoder(alphabet);
|
|
175
|
-
var getBase10Decoder = () => getBaseXDecoder(alphabet);
|
|
176
|
-
var getBase10Codec = () => getBaseXCodec(alphabet);
|
|
177
|
-
|
|
178
|
-
// src/base16.ts
|
|
179
|
-
var getBase16Encoder = () => createEncoder({
|
|
180
|
-
getSizeFromValue: (value) => Math.ceil(value.length / 2),
|
|
181
|
-
write(value, bytes, offset) {
|
|
182
|
-
const lowercaseValue = value.toLowerCase();
|
|
183
|
-
assertValidBaseString("0123456789abcdef", lowercaseValue, value);
|
|
184
|
-
const matches = lowercaseValue.match(/.{1,2}/g);
|
|
185
|
-
const hexBytes = matches ? matches.map((byte) => parseInt(byte, 16)) : [];
|
|
186
|
-
bytes.set(hexBytes, offset);
|
|
187
|
-
return hexBytes.length + offset;
|
|
188
|
-
}
|
|
189
|
-
});
|
|
190
|
-
var getBase16Decoder = () => createDecoder({
|
|
191
|
-
read(bytes, offset) {
|
|
192
|
-
const value = bytes.slice(offset).reduce((str, byte) => str + byte.toString(16).padStart(2, "0"), "");
|
|
193
|
-
return [value, bytes.length];
|
|
194
|
-
}
|
|
195
|
-
});
|
|
196
|
-
var getBase16Codec = () => combineCodec(getBase16Encoder(), getBase16Decoder());
|
|
197
|
-
|
|
198
|
-
// src/base58.ts
|
|
199
|
-
var alphabet2 = "123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz";
|
|
200
|
-
var getBase58Encoder = () => getBaseXEncoder(alphabet2);
|
|
201
|
-
var getBase58Decoder = () => getBaseXDecoder(alphabet2);
|
|
202
|
-
var getBase58Codec = () => getBaseXCodec(alphabet2);
|
|
203
|
-
|
|
204
|
-
// src/baseX-reslice.ts
|
|
205
|
-
var getBaseXResliceEncoder = (alphabet4, bits) => createEncoder({
|
|
206
|
-
getSizeFromValue: (value) => Math.floor(value.length * bits / 8),
|
|
207
|
-
write(value, bytes, offset) {
|
|
208
|
-
assertValidBaseString(alphabet4, value);
|
|
209
|
-
if (value === "")
|
|
210
|
-
return offset;
|
|
211
|
-
const charIndices = [...value].map((c) => alphabet4.indexOf(c));
|
|
212
|
-
const reslicedBytes = reslice(charIndices, bits, 8, false);
|
|
213
|
-
bytes.set(reslicedBytes, offset);
|
|
214
|
-
return reslicedBytes.length + offset;
|
|
215
|
-
}
|
|
216
|
-
});
|
|
217
|
-
var getBaseXResliceDecoder = (alphabet4, bits) => createDecoder({
|
|
218
|
-
read(rawBytes, offset = 0) {
|
|
219
|
-
const bytes = offset === 0 ? rawBytes : rawBytes.slice(offset);
|
|
220
|
-
if (bytes.length === 0)
|
|
221
|
-
return ["", rawBytes.length];
|
|
222
|
-
const charIndices = reslice([...bytes], 8, bits, true);
|
|
223
|
-
return [charIndices.map((i) => alphabet4[i]).join(""), rawBytes.length];
|
|
224
|
-
}
|
|
225
|
-
});
|
|
226
|
-
var getBaseXResliceCodec = (alphabet4, bits) => combineCodec(getBaseXResliceEncoder(alphabet4, bits), getBaseXResliceDecoder(alphabet4, bits));
|
|
227
|
-
function reslice(input, inputBits, outputBits, useRemainder) {
|
|
228
|
-
const output = [];
|
|
229
|
-
let accumulator = 0;
|
|
230
|
-
let bitsInAccumulator = 0;
|
|
231
|
-
const mask = (1 << outputBits) - 1;
|
|
232
|
-
for (const value of input) {
|
|
233
|
-
accumulator = accumulator << inputBits | value;
|
|
234
|
-
bitsInAccumulator += inputBits;
|
|
235
|
-
while (bitsInAccumulator >= outputBits) {
|
|
236
|
-
bitsInAccumulator -= outputBits;
|
|
237
|
-
output.push(accumulator >> bitsInAccumulator & mask);
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
if (useRemainder && bitsInAccumulator > 0) {
|
|
241
|
-
output.push(accumulator << outputBits - bitsInAccumulator & mask);
|
|
242
|
-
}
|
|
243
|
-
return output;
|
|
244
|
-
}
|
|
245
|
-
var getBase64Encoder = () => {
|
|
246
|
-
{
|
|
247
|
-
return createEncoder({
|
|
248
|
-
getSizeFromValue: (value) => {
|
|
249
|
-
try {
|
|
250
|
-
return atob(value).length;
|
|
251
|
-
} catch (e2) {
|
|
252
|
-
throw new Error(`Expected a string of base 64, got [${value}].`);
|
|
253
|
-
}
|
|
254
|
-
},
|
|
255
|
-
write(value, bytes, offset) {
|
|
256
|
-
try {
|
|
257
|
-
const bytesToAdd = atob(value).split("").map((c) => c.charCodeAt(0));
|
|
258
|
-
bytes.set(bytesToAdd, offset);
|
|
259
|
-
return bytesToAdd.length + offset;
|
|
260
|
-
} catch (e2) {
|
|
261
|
-
throw new Error(`Expected a string of base 64, got [${value}].`);
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
});
|
|
265
|
-
}
|
|
266
|
-
};
|
|
267
|
-
var getBase64Decoder = () => {
|
|
268
|
-
{
|
|
269
|
-
return createDecoder({
|
|
270
|
-
read(bytes, offset = 0) {
|
|
271
|
-
const slice = bytes.slice(offset);
|
|
272
|
-
const value = btoa(String.fromCharCode(...slice));
|
|
273
|
-
return [value, bytes.length];
|
|
274
|
-
}
|
|
275
|
-
});
|
|
276
|
-
}
|
|
277
|
-
};
|
|
278
|
-
var getBase64Codec = () => combineCodec(getBase64Encoder(), getBase64Decoder());
|
|
279
|
-
|
|
280
|
-
// src/null-characters.ts
|
|
281
|
-
var removeNullCharacters = (value) => (
|
|
282
|
-
// eslint-disable-next-line no-control-regex
|
|
283
|
-
value.replace(/\u0000/g, "")
|
|
284
|
-
);
|
|
285
|
-
var padNullCharacters = (value, chars) => value.padEnd(chars, "\0");
|
|
286
|
-
|
|
287
|
-
// ../codecs-numbers/dist/index.browser.js
|
|
288
|
-
function assertNumberIsBetweenForCodec(codecDescription, min, max, value) {
|
|
289
|
-
if (value < min || value > max) {
|
|
290
|
-
throw new Error(
|
|
291
|
-
`Codec [${codecDescription}] expected number to be in the range [${min}, ${max}], got ${value}.`
|
|
292
|
-
);
|
|
293
|
-
}
|
|
294
|
-
}
|
|
295
|
-
function isLittleEndian(config) {
|
|
296
|
-
return (config == null ? void 0 : config.endian) === 1 ? false : true;
|
|
297
|
-
}
|
|
298
|
-
function numberEncoderFactory(input) {
|
|
299
|
-
return createEncoder({
|
|
300
|
-
fixedSize: input.size,
|
|
301
|
-
write(value, bytes, offset) {
|
|
302
|
-
if (input.range) {
|
|
303
|
-
assertNumberIsBetweenForCodec(input.name, input.range[0], input.range[1], value);
|
|
304
|
-
}
|
|
305
|
-
const arrayBuffer = new ArrayBuffer(input.size);
|
|
306
|
-
input.set(new DataView(arrayBuffer), value, isLittleEndian(input.config));
|
|
307
|
-
bytes.set(new Uint8Array(arrayBuffer), offset);
|
|
308
|
-
return offset + input.size;
|
|
309
|
-
}
|
|
310
|
-
});
|
|
311
|
-
}
|
|
312
|
-
function numberDecoderFactory(input) {
|
|
313
|
-
return createDecoder({
|
|
314
|
-
fixedSize: input.size,
|
|
315
|
-
read(bytes, offset = 0) {
|
|
316
|
-
assertByteArrayIsNotEmptyForCodec(input.name, bytes, offset);
|
|
317
|
-
assertByteArrayHasEnoughBytesForCodec(input.name, input.size, bytes, offset);
|
|
318
|
-
const view = new DataView(toArrayBuffer(bytes, offset, input.size));
|
|
319
|
-
return [input.get(view, isLittleEndian(input.config)), offset + input.size];
|
|
320
|
-
}
|
|
321
|
-
});
|
|
322
|
-
}
|
|
323
|
-
function toArrayBuffer(bytes, offset, length) {
|
|
324
|
-
const bytesOffset = bytes.byteOffset + (offset != null ? offset : 0);
|
|
325
|
-
const bytesLength = length != null ? length : bytes.byteLength;
|
|
326
|
-
return bytes.buffer.slice(bytesOffset, bytesOffset + bytesLength);
|
|
327
|
-
}
|
|
328
|
-
var getU32Encoder = (config = {}) => numberEncoderFactory({
|
|
329
|
-
config,
|
|
330
|
-
name: "u32",
|
|
331
|
-
range: [0, Number("0xffffffff")],
|
|
332
|
-
set: (view, value, le) => view.setUint32(0, value, le),
|
|
333
|
-
size: 4
|
|
334
|
-
});
|
|
335
|
-
var getU32Decoder = (config = {}) => numberDecoderFactory({
|
|
336
|
-
config,
|
|
337
|
-
get: (view, le) => view.getUint32(0, le),
|
|
338
|
-
name: "u32",
|
|
339
|
-
size: 4
|
|
340
|
-
});
|
|
341
|
-
|
|
342
|
-
// ../text-encoding-impl/dist/index.browser.js
|
|
343
|
-
var e = globalThis.TextDecoder;
|
|
344
|
-
var o = globalThis.TextEncoder;
|
|
345
|
-
|
|
346
|
-
// src/utf8.ts
|
|
347
|
-
var getUtf8Encoder = () => {
|
|
348
|
-
let textEncoder;
|
|
349
|
-
return createEncoder({
|
|
350
|
-
getSizeFromValue: (value) => (textEncoder || (textEncoder = new o())).encode(value).length,
|
|
351
|
-
write: (value, bytes, offset) => {
|
|
352
|
-
const bytesToAdd = (textEncoder || (textEncoder = new o())).encode(value);
|
|
353
|
-
bytes.set(bytesToAdd, offset);
|
|
354
|
-
return offset + bytesToAdd.length;
|
|
355
|
-
}
|
|
356
|
-
});
|
|
357
|
-
};
|
|
358
|
-
var getUtf8Decoder = () => {
|
|
359
|
-
let textDecoder;
|
|
360
|
-
return createDecoder({
|
|
361
|
-
read(bytes, offset) {
|
|
362
|
-
const value = (textDecoder || (textDecoder = new e())).decode(bytes.slice(offset));
|
|
363
|
-
return [removeNullCharacters(value), bytes.length];
|
|
364
|
-
}
|
|
365
|
-
});
|
|
366
|
-
};
|
|
367
|
-
var getUtf8Codec = () => combineCodec(getUtf8Encoder(), getUtf8Decoder());
|
|
368
|
-
|
|
369
|
-
// src/string.ts
|
|
370
|
-
function getStringEncoder(config = {}) {
|
|
371
|
-
var _a, _b;
|
|
372
|
-
const size = (_a = config.size) != null ? _a : getU32Encoder();
|
|
373
|
-
const encoding = (_b = config.encoding) != null ? _b : getUtf8Encoder();
|
|
374
|
-
if (size === "variable") {
|
|
375
|
-
return encoding;
|
|
376
|
-
}
|
|
377
|
-
if (typeof size === "number") {
|
|
378
|
-
return fixEncoder(encoding, size);
|
|
379
|
-
}
|
|
380
|
-
return createEncoder({
|
|
381
|
-
getSizeFromValue: (value) => {
|
|
382
|
-
const contentSize = getEncodedSize(value, encoding);
|
|
383
|
-
return getEncodedSize(contentSize, size) + contentSize;
|
|
384
|
-
},
|
|
385
|
-
write: (value, bytes, offset) => {
|
|
386
|
-
const contentSize = getEncodedSize(value, encoding);
|
|
387
|
-
offset = size.write(contentSize, bytes, offset);
|
|
388
|
-
return encoding.write(value, bytes, offset);
|
|
389
|
-
}
|
|
390
|
-
});
|
|
391
|
-
}
|
|
392
|
-
function getStringDecoder(config = {}) {
|
|
393
|
-
var _a, _b;
|
|
394
|
-
const size = (_a = config.size) != null ? _a : getU32Decoder();
|
|
395
|
-
const encoding = (_b = config.encoding) != null ? _b : getUtf8Decoder();
|
|
396
|
-
if (size === "variable") {
|
|
397
|
-
return encoding;
|
|
398
|
-
}
|
|
399
|
-
if (typeof size === "number") {
|
|
400
|
-
return fixDecoder(encoding, size);
|
|
401
|
-
}
|
|
402
|
-
return createDecoder({
|
|
403
|
-
read: (bytes, offset = 0) => {
|
|
404
|
-
assertByteArrayIsNotEmptyForCodec("string", bytes, offset);
|
|
405
|
-
const [lengthBigInt, lengthOffset] = size.read(bytes, offset);
|
|
406
|
-
const length = Number(lengthBigInt);
|
|
407
|
-
offset = lengthOffset;
|
|
408
|
-
const contentBytes = bytes.slice(offset, offset + length);
|
|
409
|
-
assertByteArrayHasEnoughBytesForCodec("string", length, contentBytes);
|
|
410
|
-
const [value, contentOffset] = encoding.read(contentBytes, 0);
|
|
411
|
-
offset += contentOffset;
|
|
412
|
-
return [value, offset];
|
|
413
|
-
}
|
|
414
|
-
});
|
|
415
|
-
}
|
|
416
|
-
function getStringCodec(config = {}) {
|
|
417
|
-
return combineCodec(getStringEncoder(config), getStringDecoder(config));
|
|
418
|
-
}
|
|
419
|
-
|
|
420
|
-
exports.assertValidBaseString = assertValidBaseString;
|
|
421
|
-
exports.getBase10Codec = getBase10Codec;
|
|
422
|
-
exports.getBase10Decoder = getBase10Decoder;
|
|
423
|
-
exports.getBase10Encoder = getBase10Encoder;
|
|
424
|
-
exports.getBase16Codec = getBase16Codec;
|
|
425
|
-
exports.getBase16Decoder = getBase16Decoder;
|
|
426
|
-
exports.getBase16Encoder = getBase16Encoder;
|
|
427
|
-
exports.getBase58Codec = getBase58Codec;
|
|
428
|
-
exports.getBase58Decoder = getBase58Decoder;
|
|
429
|
-
exports.getBase58Encoder = getBase58Encoder;
|
|
430
|
-
exports.getBase64Codec = getBase64Codec;
|
|
431
|
-
exports.getBase64Decoder = getBase64Decoder;
|
|
432
|
-
exports.getBase64Encoder = getBase64Encoder;
|
|
433
|
-
exports.getBaseXCodec = getBaseXCodec;
|
|
434
|
-
exports.getBaseXDecoder = getBaseXDecoder;
|
|
435
|
-
exports.getBaseXEncoder = getBaseXEncoder;
|
|
436
|
-
exports.getBaseXResliceCodec = getBaseXResliceCodec;
|
|
437
|
-
exports.getBaseXResliceDecoder = getBaseXResliceDecoder;
|
|
438
|
-
exports.getBaseXResliceEncoder = getBaseXResliceEncoder;
|
|
439
|
-
exports.getStringCodec = getStringCodec;
|
|
440
|
-
exports.getStringDecoder = getStringDecoder;
|
|
441
|
-
exports.getStringEncoder = getStringEncoder;
|
|
442
|
-
exports.getUtf8Codec = getUtf8Codec;
|
|
443
|
-
exports.getUtf8Decoder = getUtf8Decoder;
|
|
444
|
-
exports.getUtf8Encoder = getUtf8Encoder;
|
|
445
|
-
exports.padNullCharacters = padNullCharacters;
|
|
446
|
-
exports.removeNullCharacters = removeNullCharacters;
|
|
447
|
-
|
|
448
|
-
return exports;
|
|
449
|
-
|
|
450
|
-
})({});
|
|
451
|
-
//# sourceMappingURL=out.js.map
|
|
452
|
-
//# sourceMappingURL=index.development.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/assertions.ts","../../codecs-core/dist/index.browser.js","../src/baseX.ts","../src/base10.ts","../src/base16.ts","../src/base58.ts","../src/baseX-reslice.ts","../src/base64.ts","../src/null-characters.ts","../../codecs-numbers/dist/index.browser.js","../../text-encoding-impl/src/index.browser.ts","../src/utf8.ts","../src/string.ts"],"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wD,CAAC,GAAkB;AACtG,SAAO,aAAa,iBAAiB,MAAM,GAAG,iBAAiB,MAAM,CAAC;AAC1E","sourcesContent":["/**\n * Asserts that a given string matches a given alphabet.\n */\nexport function assertValidBaseString(alphabet: string, testValue: string, givenValue = testValue) {\n if (!testValue.match(new RegExp(`^[${alphabet}]*$`))) {\n // TODO: Coded error.\n throw new Error(`Expected a string of base ${alphabet.length}, got [${givenValue}].`);\n }\n}\n","// src/assertions.ts\nfunction assertByteArrayIsNotEmptyForCodec(codecDescription, bytes, offset = 0) {\n if (bytes.length - offset <= 0) {\n throw new Error(`Codec [${codecDescription}] cannot decode empty byte arrays.`);\n }\n}\nfunction assertByteArrayHasEnoughBytesForCodec(codecDescription, expected, bytes, offset = 0) {\n const bytesLength = bytes.length - offset;\n if (bytesLength < expected) {\n throw new Error(`Codec [${codecDescription}] expected ${expected} bytes, got ${bytesLength}.`);\n }\n}\n\n// src/bytes.ts\nvar mergeBytes = (byteArrays) => {\n const nonEmptyByteArrays = byteArrays.filter((arr) => arr.length);\n if (nonEmptyByteArrays.length === 0) {\n return byteArrays.length ? byteArrays[0] : new Uint8Array();\n }\n if (nonEmptyByteArrays.length === 1) {\n return nonEmptyByteArrays[0];\n }\n const totalLength = nonEmptyByteArrays.reduce((total, arr) => total + arr.length, 0);\n const result = new Uint8Array(totalLength);\n let offset = 0;\n nonEmptyByteArrays.forEach((arr) => {\n result.set(arr, offset);\n offset += arr.length;\n });\n return result;\n};\nvar padBytes = (bytes, length) => {\n if (bytes.length >= length)\n return bytes;\n const paddedBytes = new Uint8Array(length).fill(0);\n paddedBytes.set(bytes);\n return paddedBytes;\n};\nvar fixBytes = (bytes, length) => padBytes(bytes.length <= length ? bytes : bytes.slice(0, length), length);\n\n// src/codec.ts\nfunction getEncodedSize(value, encoder) {\n return \"fixedSize\" in encoder ? encoder.fixedSize : encoder.getSizeFromValue(value);\n}\nfunction createEncoder(encoder) {\n return Object.freeze({\n ...encoder,\n encode: (value) => {\n const bytes = new Uint8Array(getEncodedSize(value, encoder));\n encoder.write(value, bytes, 0);\n return bytes;\n }\n });\n}\nfunction createDecoder(decoder) {\n return Object.freeze({\n ...decoder,\n decode: (bytes, offset = 0) => decoder.read(bytes, offset)[0]\n });\n}\nfunction createCodec(codec) {\n return Object.freeze({\n ...codec,\n decode: (bytes, offset = 0) => codec.read(bytes, offset)[0],\n encode: (value) => {\n const bytes = new Uint8Array(getEncodedSize(value, codec));\n codec.write(value, bytes, 0);\n return bytes;\n }\n });\n}\nfunction isFixedSize(codec) {\n return \"fixedSize\" in codec && typeof codec.fixedSize === \"number\";\n}\nfunction assertIsFixedSize(codec, message) {\n if (!isFixedSize(codec)) {\n throw new Error(message ?? \"Expected a fixed-size codec, got a variable-size one.\");\n }\n}\nfunction isVariableSize(codec) {\n return !isFixedSize(codec);\n}\nfunction assertIsVariableSize(codec, message) {\n if (!isVariableSize(codec)) {\n throw new Error(message ?? \"Expected a variable-size codec, got a fixed-size one.\");\n }\n}\n\n// src/combine-codec.ts\nfunction combineCodec(encoder, decoder) {\n if (isFixedSize(encoder) !== isFixedSize(decoder)) {\n throw new Error(`Encoder and decoder must either both be fixed-size or variable-size.`);\n }\n if (isFixedSize(encoder) && isFixedSize(decoder) && encoder.fixedSize !== decoder.fixedSize) {\n throw new Error(\n `Encoder and decoder must have the same fixed size, got [${encoder.fixedSize}] and [${decoder.fixedSize}].`\n );\n }\n if (!isFixedSize(encoder) && !isFixedSize(decoder) && encoder.maxSize !== decoder.maxSize) {\n throw new Error(\n `Encoder and decoder must have the same max size, got [${encoder.maxSize}] and [${decoder.maxSize}].`\n );\n }\n return {\n ...decoder,\n ...encoder,\n decode: decoder.decode,\n encode: encoder.encode,\n read: decoder.read,\n write: encoder.write\n };\n}\n\n// src/fix-codec.ts\nfunction fixEncoder(encoder, fixedBytes) {\n return createEncoder({\n fixedSize: fixedBytes,\n write: (value, bytes, offset) => {\n const variableByteArray = encoder.encode(value);\n const fixedByteArray = variableByteArray.length > fixedBytes ? variableByteArray.slice(0, fixedBytes) : variableByteArray;\n bytes.set(fixedByteArray, offset);\n return offset + fixedBytes;\n }\n });\n}\nfunction fixDecoder(decoder, fixedBytes) {\n return createDecoder({\n fixedSize: fixedBytes,\n read: (bytes, offset) => {\n assertByteArrayHasEnoughBytesForCodec(\"fixCodec\", fixedBytes, bytes, offset);\n if (offset > 0 || bytes.length > fixedBytes) {\n bytes = bytes.slice(offset, offset + fixedBytes);\n }\n if (isFixedSize(decoder)) {\n bytes = fixBytes(bytes, decoder.fixedSize);\n }\n const [value] = decoder.read(bytes, 0);\n return [value, offset + fixedBytes];\n }\n });\n}\nfunction fixCodec(codec, fixedBytes) {\n return combineCodec(fixEncoder(codec, fixedBytes), fixDecoder(codec, fixedBytes));\n}\n\n// src/map-codec.ts\nfunction mapEncoder(encoder, unmap) {\n return createEncoder({\n ...isVariableSize(encoder) ? { ...encoder, getSizeFromValue: (value) => encoder.getSizeFromValue(unmap(value)) } : encoder,\n write: (value, bytes, offset) => encoder.write(unmap(value), bytes, offset)\n });\n}\nfunction mapDecoder(decoder, map) {\n return createDecoder({\n ...decoder,\n read: (bytes, offset) => {\n const [value, newOffset] = decoder.read(bytes, offset);\n return [map(value, bytes, offset), newOffset];\n }\n });\n}\nfunction mapCodec(codec, unmap, map) {\n return createCodec({\n ...mapEncoder(codec, unmap),\n read: map ? mapDecoder(codec, map).read : codec.read\n });\n}\n\n// src/reverse-codec.ts\nfunction reverseEncoder(encoder) {\n assertIsFixedSize(encoder, \"Cannot reverse a codec of variable size.\");\n return createEncoder({\n ...encoder,\n write: (value, bytes, offset) => {\n const newOffset = encoder.write(value, bytes, offset);\n const slice = bytes.slice(offset, offset + encoder.fixedSize).reverse();\n bytes.set(slice, offset);\n return newOffset;\n }\n });\n}\nfunction reverseDecoder(decoder) {\n assertIsFixedSize(decoder, \"Cannot reverse a codec of variable size.\");\n return createDecoder({\n ...decoder,\n read: (bytes, offset) => {\n const reverseEnd = offset + decoder.fixedSize;\n if (offset === 0 && bytes.length === reverseEnd) {\n return decoder.read(bytes.reverse(), offset);\n }\n const reversedBytes = bytes.slice();\n reversedBytes.set(bytes.slice(offset, reverseEnd).reverse(), offset);\n return decoder.read(reversedBytes, offset);\n }\n });\n}\nfunction reverseCodec(codec) {\n return combineCodec(reverseEncoder(codec), reverseDecoder(codec));\n}\n\nexport { assertByteArrayHasEnoughBytesForCodec, assertByteArrayIsNotEmptyForCodec, assertIsFixedSize, assertIsVariableSize, combineCodec, createCodec, createDecoder, createEncoder, fixBytes, fixCodec, fixDecoder, fixEncoder, getEncodedSize, isFixedSize, isVariableSize, mapCodec, mapDecoder, mapEncoder, mergeBytes, padBytes, reverseCodec, reverseDecoder, reverseEncoder };\n","import {\n combineCodec,\n createDecoder,\n createEncoder,\n VariableSizeCodec,\n VariableSizeDecoder,\n VariableSizeEncoder,\n} from '@solana/codecs-core';\n\nimport { assertValidBaseString } from './assertions';\n\n/**\n * Encodes a string using a custom alphabet by dividing\n * by the base and handling leading zeroes.\n * @see {@link getBaseXCodec} for a more detailed description.\n */\nexport const getBaseXEncoder = (alphabet: string): VariableSizeEncoder<string> => {\n return createEncoder({\n getSizeFromValue: (value: string): number => {\n const [leadingZeroes, tailChars] = partitionLeadingZeroes(value, alphabet[0]);\n if (tailChars === '') return value.length;\n\n const base10Number = getBigIntFromBaseX(tailChars, alphabet);\n return leadingZeroes.length + Math.ceil(base10Number.toString(16).length / 2);\n },\n write(value: string, bytes, offset) {\n // Check if the value is valid.\n assertValidBaseString(alphabet, value);\n if (value === '') return offset;\n\n // Handle leading zeroes.\n const [leadingZeroes, tailChars] = partitionLeadingZeroes(value, alphabet[0]);\n if (tailChars === '') {\n bytes.set(new Uint8Array(leadingZeroes.length).fill(0), offset);\n return offset + leadingZeroes.length;\n }\n\n // From baseX to base10.\n let base10Number = getBigIntFromBaseX(tailChars, alphabet);\n\n // From base10 to bytes.\n const tailBytes: number[] = [];\n while (base10Number > 0n) {\n tailBytes.unshift(Number(base10Number % 256n));\n base10Number /= 256n;\n }\n\n const bytesToAdd = [...Array(leadingZeroes.length).fill(0), ...tailBytes];\n bytes.set(bytesToAdd, offset);\n return offset + bytesToAdd.length;\n },\n });\n};\n\n/**\n * Decodes a string using a custom alphabet by dividing\n * by the base and handling leading zeroes.\n * @see {@link getBaseXCodec} for a more detailed description.\n */\nexport const getBaseXDecoder = (alphabet: string): VariableSizeDecoder<string> => {\n return createDecoder({\n read(rawBytes, offset): [string, number] {\n const bytes = offset === 0 ? rawBytes : rawBytes.slice(offset);\n if (bytes.length === 0) return ['', 0];\n\n // Handle leading zeroes.\n let trailIndex = bytes.findIndex(n => n !== 0);\n trailIndex = trailIndex === -1 ? bytes.length : trailIndex;\n const leadingZeroes = alphabet[0].repeat(trailIndex);\n if (trailIndex === bytes.length) return [leadingZeroes, rawBytes.length];\n\n // From bytes to base10.\n const base10Number = bytes.slice(trailIndex).reduce((sum, byte) => sum * 256n + BigInt(byte), 0n);\n\n // From base10 to baseX.\n const tailChars = getBaseXFromBigInt(base10Number, alphabet);\n\n return [leadingZeroes + tailChars, rawBytes.length];\n },\n });\n};\n\n/**\n * A string codec that requires a custom alphabet and uses\n * the length of that alphabet as the base. It then divides\n * the input by the base as many times as necessary to get\n * the output. It also supports leading zeroes by using the\n * first character of the alphabet as the zero character.\n *\n * This can be used to create codecs such as base10 or base58.\n */\nexport const getBaseXCodec = (alphabet: string): VariableSizeCodec<string> =>\n combineCodec(getBaseXEncoder(alphabet), getBaseXDecoder(alphabet));\n\nfunction partitionLeadingZeroes(value: string, zeroCharacter: string): [string, string] {\n const leadingZeroIndex = [...value].findIndex(c => c !== zeroCharacter);\n return leadingZeroIndex === -1 ? [value, ''] : [value.slice(0, leadingZeroIndex), value.slice(leadingZeroIndex)];\n}\n\nfunction getBigIntFromBaseX(value: string, alphabet: string): bigint {\n const base = BigInt(alphabet.length);\n return [...value].reduce((sum, char) => sum * base + BigInt(alphabet.indexOf(char)), 0n);\n}\n\nfunction getBaseXFromBigInt(value: bigint, alphabet: string): string {\n const base = BigInt(alphabet.length);\n const tailChars = [];\n while (value > 0n) {\n tailChars.unshift(alphabet[Number(value % base)]);\n value /= base;\n }\n return tailChars.join('');\n}\n","import { getBaseXCodec, getBaseXDecoder, getBaseXEncoder } from './baseX';\n\nconst alphabet = '0123456789';\n\n/** Encodes strings in base10. */\nexport const getBase10Encoder = () => getBaseXEncoder(alphabet);\n\n/** Decodes strings in base10. */\nexport const getBase10Decoder = () => getBaseXDecoder(alphabet);\n\n/** Encodes and decodes strings in base10. */\nexport const getBase10Codec = () => getBaseXCodec(alphabet);\n","import {\n combineCodec,\n createDecoder,\n createEncoder,\n VariableSizeCodec,\n VariableSizeDecoder,\n VariableSizeEncoder,\n} from '@solana/codecs-core';\n\nimport { assertValidBaseString } from './assertions';\n\n/** Encodes strings in base16. */\nexport const getBase16Encoder = (): VariableSizeEncoder<string> =>\n createEncoder({\n getSizeFromValue: (value: string) => Math.ceil(value.length / 2),\n write(value: string, bytes, offset) {\n const lowercaseValue = value.toLowerCase();\n assertValidBaseString('0123456789abcdef', lowercaseValue, value);\n const matches = lowercaseValue.match(/.{1,2}/g);\n const hexBytes = matches ? matches.map((byte: string) => parseInt(byte, 16)) : [];\n bytes.set(hexBytes, offset);\n return hexBytes.length + offset;\n },\n });\n\n/** Decodes strings in base16. */\nexport const getBase16Decoder = (): VariableSizeDecoder<string> =>\n createDecoder({\n read(bytes, offset) {\n const value = bytes.slice(offset).reduce((str, byte) => str + byte.toString(16).padStart(2, '0'), '');\n return [value, bytes.length];\n },\n });\n\n/** Encodes and decodes strings in base16. */\nexport const getBase16Codec = (): VariableSizeCodec<string> => combineCodec(getBase16Encoder(), getBase16Decoder());\n","import { getBaseXCodec, getBaseXDecoder, getBaseXEncoder } from './baseX';\n\nconst alphabet = '123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz';\n\n/** Encodes strings in base58. */\nexport const getBase58Encoder = () => getBaseXEncoder(alphabet);\n\n/** Decodes strings in base58. */\nexport const getBase58Decoder = () => getBaseXDecoder(alphabet);\n\n/** Encodes and decodes strings in base58. */\nexport const getBase58Codec = () => getBaseXCodec(alphabet);\n","import {\n combineCodec,\n createDecoder,\n createEncoder,\n VariableSizeCodec,\n VariableSizeDecoder,\n VariableSizeEncoder,\n} from '@solana/codecs-core';\n\nimport { assertValidBaseString } from './assertions';\n\n/**\n * Encodes a string using a custom alphabet by reslicing the bits of the byte array.\n * @see {@link getBaseXResliceCodec} for a more detailed description.\n */\nexport const getBaseXResliceEncoder = (alphabet: string, bits: number): VariableSizeEncoder<string> =>\n createEncoder({\n getSizeFromValue: (value: string) => Math.floor((value.length * bits) / 8),\n write(value: string, bytes, offset) {\n assertValidBaseString(alphabet, value);\n if (value === '') return offset;\n const charIndices = [...value].map(c => alphabet.indexOf(c));\n const reslicedBytes = reslice(charIndices, bits, 8, false);\n bytes.set(reslicedBytes, offset);\n return reslicedBytes.length + offset;\n },\n });\n\n/**\n * Decodes a string using a custom alphabet by reslicing the bits of the byte array.\n * @see {@link getBaseXResliceCodec} for a more detailed description.\n */\nexport const getBaseXResliceDecoder = (alphabet: string, bits: number): VariableSizeDecoder<string> =>\n createDecoder({\n read(rawBytes, offset = 0): [string, number] {\n const bytes = offset === 0 ? rawBytes : rawBytes.slice(offset);\n if (bytes.length === 0) return ['', rawBytes.length];\n const charIndices = reslice([...bytes], 8, bits, true);\n return [charIndices.map(i => alphabet[i]).join(''), rawBytes.length];\n },\n });\n\n/**\n * A string serializer that reslices bytes into custom chunks\n * of bits that are then mapped to a custom alphabet.\n *\n * This can be used to create serializers whose alphabet\n * is a power of 2 such as base16 or base64.\n */\nexport const getBaseXResliceCodec = (alphabet: string, bits: number): VariableSizeCodec<string> =>\n combineCodec(getBaseXResliceEncoder(alphabet, bits), getBaseXResliceDecoder(alphabet, bits));\n\n/** Helper function to reslice the bits inside bytes. */\nfunction reslice(input: number[], inputBits: number, outputBits: number, useRemainder: boolean): number[] {\n const output = [];\n let accumulator = 0;\n let bitsInAccumulator = 0;\n const mask = (1 << outputBits) - 1;\n for (const value of input) {\n accumulator = (accumulator << inputBits) | value;\n bitsInAccumulator += inputBits;\n while (bitsInAccumulator >= outputBits) {\n bitsInAccumulator -= outputBits;\n output.push((accumulator >> bitsInAccumulator) & mask);\n }\n }\n if (useRemainder && bitsInAccumulator > 0) {\n output.push((accumulator << (outputBits - bitsInAccumulator)) & mask);\n }\n return output;\n}\n","import {\n combineCodec,\n createDecoder,\n createEncoder,\n mapDecoder,\n mapEncoder,\n VariableSizeCodec,\n VariableSizeDecoder,\n VariableSizeEncoder,\n} from '@solana/codecs-core';\n\nimport { assertValidBaseString } from './assertions';\nimport { getBaseXResliceDecoder, getBaseXResliceEncoder } from './baseX-reslice';\n\nconst alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';\n\n/** Encodes strings in base64. */\nexport const getBase64Encoder = (): VariableSizeEncoder<string> => {\n if (__BROWSER__) {\n return createEncoder({\n getSizeFromValue: (value: string) => {\n try {\n return (atob as Window['atob'])(value).length;\n } catch (e) {\n // TODO: Coded error.\n throw new Error(`Expected a string of base 64, got [${value}].`);\n }\n },\n write(value: string, bytes, offset) {\n try {\n const bytesToAdd = (atob as Window['atob'])(value)\n .split('')\n .map(c => c.charCodeAt(0));\n bytes.set(bytesToAdd, offset);\n return bytesToAdd.length + offset;\n } catch (e) {\n // TODO: Coded error.\n throw new Error(`Expected a string of base 64, got [${value}].`);\n }\n },\n });\n }\n\n if (__NODEJS__) {\n return createEncoder({\n getSizeFromValue: (value: string) => Buffer.from(value, 'base64').length,\n write(value: string, bytes, offset) {\n assertValidBaseString(alphabet, value.replace(/=/g, ''));\n const buffer = Buffer.from(value, 'base64');\n bytes.set(buffer, offset);\n return buffer.length + offset;\n },\n });\n }\n\n return mapEncoder(getBaseXResliceEncoder(alphabet, 6), (value: string): string => value.replace(/=/g, ''));\n};\n\n/** Decodes strings in base64. */\nexport const getBase64Decoder = (): VariableSizeDecoder<string> => {\n if (__BROWSER__) {\n return createDecoder({\n read(bytes, offset = 0) {\n const slice = bytes.slice(offset);\n const value = (btoa as Window['btoa'])(String.fromCharCode(...slice));\n return [value, bytes.length];\n },\n });\n }\n\n if (__NODEJS__) {\n return createDecoder({\n read: (bytes, offset = 0) => [Buffer.from(bytes, offset).toString('base64'), bytes.length],\n });\n }\n\n return mapDecoder(getBaseXResliceDecoder(alphabet, 6), (value: string): string =>\n value.padEnd(Math.ceil(value.length / 4) * 4, '='),\n );\n};\n\n/** Encodes and decodes strings in base64. */\nexport const getBase64Codec = (): VariableSizeCodec<string> => combineCodec(getBase64Encoder(), getBase64Decoder());\n","/**Removes null characters from a string. */\nexport const removeNullCharacters = (value: string) =>\n // eslint-disable-next-line no-control-regex\n value.replace(/\\u0000/g, '');\n\n/** Pads a string with null characters at the end. */\nexport const padNullCharacters = (value: string, chars: number) => value.padEnd(chars, '\\u0000');\n","import { combineCodec, createEncoder, createDecoder, assertByteArrayIsNotEmptyForCodec, assertByteArrayHasEnoughBytesForCodec } from '@solana/codecs-core';\n\n// src/assertions.ts\nfunction assertNumberIsBetweenForCodec(codecDescription, min, max, value) {\n if (value < min || value > max) {\n throw new Error(\n `Codec [${codecDescription}] expected number to be in the range [${min}, ${max}], got ${value}.`\n );\n }\n}\n\n// src/common.ts\nvar Endian = /* @__PURE__ */ ((Endian2) => {\n Endian2[Endian2[\"LITTLE\"] = 0] = \"LITTLE\";\n Endian2[Endian2[\"BIG\"] = 1] = \"BIG\";\n return Endian2;\n})(Endian || {});\nfunction isLittleEndian(config) {\n return config?.endian === 1 /* BIG */ ? false : true;\n}\nfunction numberEncoderFactory(input) {\n return createEncoder({\n fixedSize: input.size,\n write(value, bytes, offset) {\n if (input.range) {\n assertNumberIsBetweenForCodec(input.name, input.range[0], input.range[1], value);\n }\n const arrayBuffer = new ArrayBuffer(input.size);\n input.set(new DataView(arrayBuffer), value, isLittleEndian(input.config));\n bytes.set(new Uint8Array(arrayBuffer), offset);\n return offset + input.size;\n }\n });\n}\nfunction numberDecoderFactory(input) {\n return createDecoder({\n fixedSize: input.size,\n read(bytes, offset = 0) {\n assertByteArrayIsNotEmptyForCodec(input.name, bytes, offset);\n assertByteArrayHasEnoughBytesForCodec(input.name, input.size, bytes, offset);\n const view = new DataView(toArrayBuffer(bytes, offset, input.size));\n return [input.get(view, isLittleEndian(input.config)), offset + input.size];\n }\n });\n}\nfunction toArrayBuffer(bytes, offset, length) {\n const bytesOffset = bytes.byteOffset + (offset ?? 0);\n const bytesLength = length ?? bytes.byteLength;\n return bytes.buffer.slice(bytesOffset, bytesOffset + bytesLength);\n}\n\n// src/f32.ts\nvar getF32Encoder = (config = {}) => numberEncoderFactory({\n config,\n name: \"f32\",\n set: (view, value, le) => view.setFloat32(0, value, le),\n size: 4\n});\nvar getF32Decoder = (config = {}) => numberDecoderFactory({\n config,\n get: (view, le) => view.getFloat32(0, le),\n name: \"f32\",\n size: 4\n});\nvar getF32Codec = (config = {}) => combineCodec(getF32Encoder(config), getF32Decoder(config));\nvar getF64Encoder = (config = {}) => numberEncoderFactory({\n config,\n name: \"f64\",\n set: (view, value, le) => view.setFloat64(0, value, le),\n size: 8\n});\nvar getF64Decoder = (config = {}) => numberDecoderFactory({\n config,\n get: (view, le) => view.getFloat64(0, le),\n name: \"f64\",\n size: 8\n});\nvar getF64Codec = (config = {}) => combineCodec(getF64Encoder(config), getF64Decoder(config));\nvar getI128Encoder = (config = {}) => numberEncoderFactory({\n config,\n name: \"i128\",\n range: [-BigInt(\"0x7fffffffffffffffffffffffffffffff\") - 1n, BigInt(\"0x7fffffffffffffffffffffffffffffff\")],\n set: (view, value, le) => {\n const leftOffset = le ? 8 : 0;\n const rightOffset = le ? 0 : 8;\n const rightMask = 0xffffffffffffffffn;\n view.setBigInt64(leftOffset, BigInt(value) >> 64n, le);\n view.setBigUint64(rightOffset, BigInt(value) & rightMask, le);\n },\n size: 16\n});\nvar getI128Decoder = (config = {}) => numberDecoderFactory({\n config,\n get: (view, le) => {\n const leftOffset = le ? 8 : 0;\n const rightOffset = le ? 0 : 8;\n const left = view.getBigInt64(leftOffset, le);\n const right = view.getBigUint64(rightOffset, le);\n return (left << 64n) + right;\n },\n name: \"i128\",\n size: 16\n});\nvar getI128Codec = (config = {}) => combineCodec(getI128Encoder(config), getI128Decoder(config));\nvar getI16Encoder = (config = {}) => numberEncoderFactory({\n config,\n name: \"i16\",\n range: [-Number(\"0x7fff\") - 1, Number(\"0x7fff\")],\n set: (view, value, le) => view.setInt16(0, value, le),\n size: 2\n});\nvar getI16Decoder = (config = {}) => numberDecoderFactory({\n config,\n get: (view, le) => view.getInt16(0, le),\n name: \"i16\",\n size: 2\n});\nvar getI16Codec = (config = {}) => combineCodec(getI16Encoder(config), getI16Decoder(config));\nvar getI32Encoder = (config = {}) => numberEncoderFactory({\n config,\n name: \"i32\",\n range: [-Number(\"0x7fffffff\") - 1, Number(\"0x7fffffff\")],\n set: (view, value, le) => view.setInt32(0, value, le),\n size: 4\n});\nvar getI32Decoder = (config = {}) => numberDecoderFactory({\n config,\n get: (view, le) => view.getInt32(0, le),\n name: \"i32\",\n size: 4\n});\nvar getI32Codec = (config = {}) => combineCodec(getI32Encoder(config), getI32Decoder(config));\nvar getI64Encoder = (config = {}) => numberEncoderFactory({\n config,\n name: \"i64\",\n range: [-BigInt(\"0x7fffffffffffffff\") - 1n, BigInt(\"0x7fffffffffffffff\")],\n set: (view, value, le) => view.setBigInt64(0, BigInt(value), le),\n size: 8\n});\nvar getI64Decoder = (config = {}) => numberDecoderFactory({\n config,\n get: (view, le) => view.getBigInt64(0, le),\n name: \"i64\",\n size: 8\n});\nvar getI64Codec = (config = {}) => combineCodec(getI64Encoder(config), getI64Decoder(config));\nvar getI8Encoder = () => numberEncoderFactory({\n name: \"i8\",\n range: [-Number(\"0x7f\") - 1, Number(\"0x7f\")],\n set: (view, value) => view.setInt8(0, value),\n size: 1\n});\nvar getI8Decoder = () => numberDecoderFactory({\n get: (view) => view.getInt8(0),\n name: \"i8\",\n size: 1\n});\nvar getI8Codec = () => combineCodec(getI8Encoder(), getI8Decoder());\nvar getShortU16Encoder = () => createEncoder({\n getSizeFromValue: (value) => {\n if (value <= 127)\n return 1;\n if (value <= 16383)\n return 2;\n return 3;\n },\n maxSize: 3,\n write: (value, bytes, offset) => {\n assertNumberIsBetweenForCodec(\"shortU16\", 0, 65535, value);\n const shortU16Bytes = [0];\n for (let ii = 0; ; ii += 1) {\n const alignedValue = value >> ii * 7;\n if (alignedValue === 0) {\n break;\n }\n const nextSevenBits = 127 & alignedValue;\n shortU16Bytes[ii] = nextSevenBits;\n if (ii > 0) {\n shortU16Bytes[ii - 1] |= 128;\n }\n }\n bytes.set(shortU16Bytes, offset);\n return offset + shortU16Bytes.length;\n }\n});\nvar getShortU16Decoder = () => createDecoder({\n maxSize: 3,\n read: (bytes, offset) => {\n let value = 0;\n let byteCount = 0;\n while (++byteCount) {\n const byteIndex = byteCount - 1;\n const currentByte = bytes[offset + byteIndex];\n const nextSevenBits = 127 & currentByte;\n value |= nextSevenBits << byteIndex * 7;\n if ((currentByte & 128) === 0) {\n break;\n }\n }\n return [value, offset + byteCount];\n }\n});\nvar getShortU16Codec = () => combineCodec(getShortU16Encoder(), getShortU16Decoder());\nvar getU128Encoder = (config = {}) => numberEncoderFactory({\n config,\n name: \"u128\",\n range: [0, BigInt(\"0xffffffffffffffffffffffffffffffff\")],\n set: (view, value, le) => {\n const leftOffset = le ? 8 : 0;\n const rightOffset = le ? 0 : 8;\n const rightMask = 0xffffffffffffffffn;\n view.setBigUint64(leftOffset, BigInt(value) >> 64n, le);\n view.setBigUint64(rightOffset, BigInt(value) & rightMask, le);\n },\n size: 16\n});\nvar getU128Decoder = (config = {}) => numberDecoderFactory({\n config,\n get: (view, le) => {\n const leftOffset = le ? 8 : 0;\n const rightOffset = le ? 0 : 8;\n const left = view.getBigUint64(leftOffset, le);\n const right = view.getBigUint64(rightOffset, le);\n return (left << 64n) + right;\n },\n name: \"u128\",\n size: 16\n});\nvar getU128Codec = (config = {}) => combineCodec(getU128Encoder(config), getU128Decoder(config));\nvar getU16Encoder = (config = {}) => numberEncoderFactory({\n config,\n name: \"u16\",\n range: [0, Number(\"0xffff\")],\n set: (view, value, le) => view.setUint16(0, value, le),\n size: 2\n});\nvar getU16Decoder = (config = {}) => numberDecoderFactory({\n config,\n get: (view, le) => view.getUint16(0, le),\n name: \"u16\",\n size: 2\n});\nvar getU16Codec = (config = {}) => combineCodec(getU16Encoder(config), getU16Decoder(config));\nvar getU32Encoder = (config = {}) => numberEncoderFactory({\n config,\n name: \"u32\",\n range: [0, Number(\"0xffffffff\")],\n set: (view, value, le) => view.setUint32(0, value, le),\n size: 4\n});\nvar getU32Decoder = (config = {}) => numberDecoderFactory({\n config,\n get: (view, le) => view.getUint32(0, le),\n name: \"u32\",\n size: 4\n});\nvar getU32Codec = (config = {}) => combineCodec(getU32Encoder(config), getU32Decoder(config));\nvar getU64Encoder = (config = {}) => numberEncoderFactory({\n config,\n name: \"u64\",\n range: [0, BigInt(\"0xffffffffffffffff\")],\n set: (view, value, le) => view.setBigUint64(0, BigInt(value), le),\n size: 8\n});\nvar getU64Decoder = (config = {}) => numberDecoderFactory({\n config,\n get: (view, le) => view.getBigUint64(0, le),\n name: \"u64\",\n size: 8\n});\nvar getU64Codec = (config = {}) => combineCodec(getU64Encoder(config), getU64Decoder(config));\nvar getU8Encoder = () => numberEncoderFactory({\n name: \"u8\",\n range: [0, Number(\"0xff\")],\n set: (view, value) => view.setUint8(0, value),\n size: 1\n});\nvar getU8Decoder = () => numberDecoderFactory({\n get: (view) => view.getUint8(0),\n name: \"u8\",\n size: 1\n});\nvar getU8Codec = () => combineCodec(getU8Encoder(), getU8Decoder());\n\nexport { Endian, assertNumberIsBetweenForCodec, getF32Codec, getF32Decoder, getF32Encoder, getF64Codec, getF64Decoder, getF64Encoder, getI128Codec, getI128Decoder, getI128Encoder, getI16Codec, getI16Decoder, getI16Encoder, getI32Codec, getI32Decoder, getI32Encoder, getI64Codec, getI64Decoder, getI64Encoder, getI8Codec, getI8Decoder, getI8Encoder, getShortU16Codec, getShortU16Decoder, getShortU16Encoder, getU128Codec, getU128Decoder, getU128Encoder, getU16Codec, getU16Decoder, getU16Encoder, getU32Codec, getU32Decoder, getU32Encoder, getU64Codec, getU64Decoder, getU64Encoder, getU8Codec, getU8Decoder, getU8Encoder };\n","export const TextDecoder = globalThis.TextDecoder;\nexport const TextEncoder = globalThis.TextEncoder;\n","import {\n Codec,\n combineCodec,\n createDecoder,\n createEncoder,\n VariableSizeDecoder,\n VariableSizeEncoder,\n} from '@solana/codecs-core';\nimport { TextDecoder, TextEncoder } from 'text-encoding-impl';\n\nimport { removeNullCharacters } from './null-characters';\n\n/** Encodes UTF-8 strings using the native `TextEncoder` API. */\nexport const getUtf8Encoder = (): VariableSizeEncoder<string> => {\n let textEncoder: TextEncoder;\n return createEncoder({\n getSizeFromValue: value => (textEncoder ||= new TextEncoder()).encode(value).length,\n write: (value: string, bytes, offset) => {\n const bytesToAdd = (textEncoder ||= new TextEncoder()).encode(value);\n bytes.set(bytesToAdd, offset);\n return offset + bytesToAdd.length;\n },\n });\n};\n\n/** Decodes UTF-8 strings using the native `TextDecoder` API. */\nexport const getUtf8Decoder = (): VariableSizeDecoder<string> => {\n let textDecoder: TextDecoder;\n return createDecoder({\n read(bytes, offset) {\n const value = (textDecoder ||= new TextDecoder()).decode(bytes.slice(offset));\n return [removeNullCharacters(value), bytes.length];\n },\n });\n};\n\n/** Encodes and decodes UTF-8 strings using the native `TextEncoder` and `TextDecoder` API. */\nexport const getUtf8Codec = (): Codec<string> => combineCodec(getUtf8Encoder(), getUtf8Decoder());\n","import {\n assertByteArrayHasEnoughBytesForCodec,\n assertByteArrayIsNotEmptyForCodec,\n Codec,\n combineCodec,\n createDecoder,\n createEncoder,\n Decoder,\n Encoder,\n fixDecoder,\n FixedSizeCodec,\n FixedSizeDecoder,\n FixedSizeEncoder,\n fixEncoder,\n getEncodedSize,\n VariableSizeCodec,\n VariableSizeDecoder,\n VariableSizeEncoder,\n} from '@solana/codecs-core';\nimport { getU32Decoder, getU32Encoder, NumberCodec, NumberDecoder, NumberEncoder } from '@solana/codecs-numbers';\n\nimport { getUtf8Decoder, getUtf8Encoder } from './utf8';\n\n/** Defines the config for string codecs. */\nexport type StringCodecConfig<\n TPrefix extends NumberCodec | NumberEncoder | NumberDecoder,\n TEncoding extends Codec<string> | Encoder<string> | Decoder<string>,\n> = {\n /**\n * The size of the string. It can be one of the following:\n * - a {@link NumberCodec} that prefixes the string with its size.\n * - a fixed number of bytes.\n * - or `'variable'` to use the rest of the byte array.\n * @defaultValue u32 prefix.\n */\n size?: TPrefix | number | 'variable';\n\n /**\n * The codec to use for encoding and decoding the content.\n * @defaultValue UTF-8 encoding.\n */\n encoding?: TEncoding;\n};\n\n/** Encodes strings from a given encoding and size strategy. */\nexport function getStringEncoder<TSize extends number>(\n config: StringCodecConfig<NumberEncoder, Encoder<string>> & { size: TSize },\n): FixedSizeEncoder<string, TSize>;\nexport function getStringEncoder<TSize extends number>(\n config: StringCodecConfig<NumberEncoder, Encoder<string>> & {\n size: 'variable';\n encoding: FixedSizeEncoder<string, TSize>;\n },\n): FixedSizeEncoder<string, TSize>;\nexport function getStringEncoder(\n config?: StringCodecConfig<NumberEncoder, Encoder<string>>,\n): VariableSizeEncoder<string>;\nexport function getStringEncoder(config: StringCodecConfig<NumberEncoder, Encoder<string>> = {}): Encoder<string> {\n const size = config.size ?? getU32Encoder();\n const encoding = config.encoding ?? getUtf8Encoder();\n\n if (size === 'variable') {\n return encoding;\n }\n\n if (typeof size === 'number') {\n return fixEncoder(encoding, size);\n }\n\n return createEncoder({\n getSizeFromValue: (value: string) => {\n const contentSize = getEncodedSize(value, encoding);\n return getEncodedSize(contentSize, size) + contentSize;\n },\n write: (value: string, bytes, offset) => {\n const contentSize = getEncodedSize(value, encoding);\n offset = size.write(contentSize, bytes, offset);\n return encoding.write(value, bytes, offset);\n },\n });\n}\n\n/** Decodes strings from a given encoding and size strategy. */\nexport function getStringDecoder<TSize extends number>(\n config: StringCodecConfig<NumberDecoder, Decoder<string>> & { size: TSize },\n): FixedSizeDecoder<string, TSize>;\nexport function getStringDecoder<TSize extends number>(\n config: StringCodecConfig<NumberDecoder, Decoder<string>> & {\n size: 'variable';\n encoding: FixedSizeDecoder<string, TSize>;\n },\n): FixedSizeDecoder<string, TSize>;\nexport function getStringDecoder(\n config?: StringCodecConfig<NumberDecoder, Decoder<string>>,\n): VariableSizeDecoder<string>;\nexport function getStringDecoder(config: StringCodecConfig<NumberDecoder, Decoder<string>> = {}): Decoder<string> {\n const size = config.size ?? getU32Decoder();\n const encoding = config.encoding ?? getUtf8Decoder();\n\n if (size === 'variable') {\n return encoding;\n }\n\n if (typeof size === 'number') {\n return fixDecoder(encoding, size);\n }\n\n return createDecoder({\n read: (bytes: Uint8Array, offset = 0) => {\n assertByteArrayIsNotEmptyForCodec('string', bytes, offset);\n const [lengthBigInt, lengthOffset] = size.read(bytes, offset);\n const length = Number(lengthBigInt);\n offset = lengthOffset;\n const contentBytes = bytes.slice(offset, offset + length);\n assertByteArrayHasEnoughBytesForCodec('string', length, contentBytes);\n const [value, contentOffset] = encoding.read(contentBytes, 0);\n offset += contentOffset;\n return [value, offset];\n },\n });\n}\n\n/** Encodes and decodes strings from a given encoding and size strategy. */\nexport function getStringCodec<TSize extends number>(\n config: StringCodecConfig<NumberCodec, Codec<string>> & { size: TSize },\n): FixedSizeCodec<string, string, TSize>;\nexport function getStringCodec<TSize extends number>(\n config: StringCodecConfig<NumberCodec, Codec<string>> & {\n size: 'variable';\n encoding: FixedSizeCodec<string, string, TSize>;\n },\n): FixedSizeCodec<string, string, TSize>;\nexport function getStringCodec(config?: StringCodecConfig<NumberCodec, Codec<string>>): VariableSizeCodec<string>;\nexport function getStringCodec(config: StringCodecConfig<NumberCodec, Codec<string>> = {}): Codec<string> {\n return combineCodec(getStringEncoder(config), getStringDecoder(config));\n}\n"]}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
this.globalThis = this.globalThis || {};
|
|
2
|
-
this.globalThis.solanaWeb3 = (function (exports) {
|
|
3
|
-
'use strict';
|
|
4
|
-
|
|
5
|
-
function l(e,r,t=r){if(!r.match(new RegExp(`^[${e}]*$`)))throw new Error(`Expected a string of base ${e.length}, got [${t}].`)}function C(e,r,t=0){if(r.length-t<=0)throw new Error(`Codec [${e}] cannot decode empty byte arrays.`)}function z(e,r,t,n=0){let i=t.length-n;if(i<r)throw new Error(`Codec [${e}] expected ${r} bytes, got ${i}.`)}var Z=(e,r)=>{if(e.length>=r)return e;let t=new Uint8Array(r).fill(0);return t.set(e),t},H=(e,r)=>Z(e.length<=r?e:e.slice(0,r),r);function S(e,r){return "fixedSize"in r?r.fixedSize:r.getSizeFromValue(e)}function a(e){return Object.freeze({...e,encode:r=>{let t=new Uint8Array(S(r,e));return e.write(r,t,0),t}})}function s(e){return Object.freeze({...e,decode:(r,t=0)=>e.read(r,t)[0]})}function m(e){return "fixedSize"in e&&typeof e.fixedSize=="number"}function d(e,r){if(m(e)!==m(r))throw new Error("Encoder and decoder must either both be fixed-size or variable-size.");if(m(e)&&m(r)&&e.fixedSize!==r.fixedSize)throw new Error(`Encoder and decoder must have the same fixed size, got [${e.fixedSize}] and [${r.fixedSize}].`);if(!m(e)&&!m(r)&&e.maxSize!==r.maxSize)throw new Error(`Encoder and decoder must have the same max size, got [${e.maxSize}] and [${r.maxSize}].`);return {...r,...e,decode:r.decode,encode:e.encode,read:r.read,write:e.write}}function F(e,r){return a({fixedSize:r,write:(t,n,i)=>{let c=e.encode(t),o=c.length>r?c.slice(0,r):c;return n.set(o,i),i+r}})}function N(e,r){return s({fixedSize:r,read:(t,n)=>{z("fixCodec",r,t,n),(n>0||t.length>r)&&(t=t.slice(n,n+r)),m(e)&&(t=H(t,e.fixedSize));let[i]=e.read(t,0);return [i,n+r]}})}var x=e=>a({getSizeFromValue:r=>{let[t,n]=A(r,e[0]);if(n==="")return r.length;let i=O(n,e);return t.length+Math.ceil(i.toString(16).length/2)},write(r,t,n){if(l(e,r),r==="")return n;let[i,c]=A(r,e[0]);if(c==="")return t.set(new Uint8Array(i.length).fill(0),n),n+i.length;let o=O(c,e),g=[];for(;o>0n;)g.unshift(Number(o%256n)),o/=256n;let u=[...Array(i.length).fill(0),...g];return t.set(u,n),n+u.length}}),b=e=>s({read(r,t){let n=t===0?r:r.slice(t);if(n.length===0)return ["",0];let i=n.findIndex(u=>u!==0);i=i===-1?n.length:i;let c=e[0].repeat(i);if(i===n.length)return [c,r.length];let o=n.slice(i).reduce((u,E)=>u*256n+BigInt(E),0n),g=J(o,e);return [c+g,r.length]}}),h=e=>d(x(e),b(e));function A(e,r){let t=[...e].findIndex(n=>n!==r);return t===-1?[e,""]:[e.slice(0,t),e.slice(t)]}function O(e,r){let t=BigInt(r.length);return [...e].reduce((n,i)=>n*t+BigInt(r.indexOf(i)),0n)}function J(e,r){let t=BigInt(r.length),n=[];for(;e>0n;)n.unshift(r[Number(e%t)]),e/=t;return n.join("")}var p="0123456789",be=()=>x(p),Ee=()=>b(p),Ce=()=>h(p);var P=()=>a({getSizeFromValue:e=>Math.ceil(e.length/2),write(e,r,t){let n=e.toLowerCase();l("0123456789abcdef",n,e);let i=n.match(/.{1,2}/g),c=i?i.map(o=>parseInt(o,16)):[];return r.set(c,t),c.length+t}}),q=()=>s({read(e,r){return [e.slice(r).reduce((n,i)=>n+i.toString(16).padStart(2,"0"),""),e.length]}}),Ve=()=>d(P(),q());var D="123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz",Te=()=>x(D),ye=()=>b(D),Ae=()=>h(D);var B=(e,r)=>a({getSizeFromValue:t=>Math.floor(t.length*r/8),write(t,n,i){if(l(e,t),t==="")return i;let c=[...t].map(g=>e.indexOf(g)),o=_(c,r,8,!1);return n.set(o,i),o.length+i}}),I=(e,r)=>s({read(t,n=0){let i=n===0?t:t.slice(n);return i.length===0?["",t.length]:[_([...i],8,r,!0).map(o=>e[o]).join(""),t.length]}}),je=(e,r)=>d(B(e,r),I(e,r));function _(e,r,t,n){let i=[],c=0,o=0,g=(1<<t)-1;for(let u of e)for(c=c<<r|u,o+=r;o>=t;)o-=t,i.push(c>>o&g);return n&&o>0&&i.push(c<<t-o&g),i}var K=()=>a({getSizeFromValue:e=>{try{return atob(e).length}catch{throw new Error(`Expected a string of base 64, got [${e}].`)}},write(e,r,t){try{let n=atob(e).split("").map(i=>i.charCodeAt(0));return r.set(n,t),n.length+t}catch{throw new Error(`Expected a string of base 64, got [${e}].`)}}}),Q=()=>s({read(e,r=0){let t=e.slice(r);return [btoa(String.fromCharCode(...t)),e.length]}}),qe=()=>d(K(),Q());var $=e=>e.replace(/\u0000/g,""),Ye=(e,r)=>e.padEnd(r,"\0");function Y(e,r,t,n){if(n<r||n>t)throw new Error(`Codec [${e}] expected number to be in the range [${r}, ${t}], got ${n}.`)}function L(e){return (e==null?void 0:e.endian)!==1}function ee(e){return a({fixedSize:e.size,write(r,t,n){e.range&&Y(e.name,e.range[0],e.range[1],r);let i=new ArrayBuffer(e.size);return e.set(new DataView(i),r,L(e.config)),t.set(new Uint8Array(i),n),n+e.size}})}function re(e){return s({fixedSize:e.size,read(r,t=0){C(e.name,r,t),z(e.name,e.size,r,t);let n=new DataView(te(r,t,e.size));return [e.get(n,L(e.config)),t+e.size]}})}function te(e,r,t){let n=e.byteOffset+(r!=null?r:0),i=t!=null?t:e.byteLength;return e.buffer.slice(n,n+i)}var R=(e={})=>ee({config:e,name:"u32",range:[0,+"0xffffffff"],set:(r,t,n)=>r.setUint32(0,t,n),size:4}),M=(e={})=>re({config:e,get:(r,t)=>r.getUint32(0,t),name:"u32",size:4});var j=globalThis.TextDecoder,v=globalThis.TextEncoder;var w=()=>{let e;return a({getSizeFromValue:r=>(e||(e=new v)).encode(r).length,write:(r,t,n)=>{let i=(e||(e=new v)).encode(r);return t.set(i,n),n+i.length}})},V=()=>{let e;return s({read(r,t){let n=(e||(e=new j)).decode(r.slice(t));return [$(n),r.length]}})},mr=()=>d(w(),V());function ne(e={}){var n,i;let r=(n=e.size)!=null?n:R(),t=(i=e.encoding)!=null?i:w();return r==="variable"?t:typeof r=="number"?F(t,r):a({getSizeFromValue:c=>{let o=S(c,t);return S(o,r)+o},write:(c,o,g)=>{let u=S(c,t);return g=r.write(u,o,g),t.write(c,o,g)}})}function ie(e={}){var n,i;let r=(n=e.size)!=null?n:M(),t=(i=e.encoding)!=null?i:V();return r==="variable"?t:typeof r=="number"?N(t,r):s({read:(c,o=0)=>{C("string",c,o);let[g,u]=r.read(c,o),E=Number(g);o=u;let U=c.slice(o,o+E);z("string",E,U);let[k,W]=t.read(U,0);return o+=W,[k,o]}})}function Nr(e={}){return d(ne(e),ie(e))}
|
|
6
|
-
|
|
7
|
-
exports.assertValidBaseString = l;
|
|
8
|
-
exports.getBase10Codec = Ce;
|
|
9
|
-
exports.getBase10Decoder = Ee;
|
|
10
|
-
exports.getBase10Encoder = be;
|
|
11
|
-
exports.getBase16Codec = Ve;
|
|
12
|
-
exports.getBase16Decoder = q;
|
|
13
|
-
exports.getBase16Encoder = P;
|
|
14
|
-
exports.getBase58Codec = Ae;
|
|
15
|
-
exports.getBase58Decoder = ye;
|
|
16
|
-
exports.getBase58Encoder = Te;
|
|
17
|
-
exports.getBase64Codec = qe;
|
|
18
|
-
exports.getBase64Decoder = Q;
|
|
19
|
-
exports.getBase64Encoder = K;
|
|
20
|
-
exports.getBaseXCodec = h;
|
|
21
|
-
exports.getBaseXDecoder = b;
|
|
22
|
-
exports.getBaseXEncoder = x;
|
|
23
|
-
exports.getBaseXResliceCodec = je;
|
|
24
|
-
exports.getBaseXResliceDecoder = I;
|
|
25
|
-
exports.getBaseXResliceEncoder = B;
|
|
26
|
-
exports.getStringCodec = Nr;
|
|
27
|
-
exports.getStringDecoder = ie;
|
|
28
|
-
exports.getStringEncoder = ne;
|
|
29
|
-
exports.getUtf8Codec = mr;
|
|
30
|
-
exports.getUtf8Decoder = V;
|
|
31
|
-
exports.getUtf8Encoder = w;
|
|
32
|
-
exports.padNullCharacters = Ye;
|
|
33
|
-
exports.removeNullCharacters = $;
|
|
34
|
-
|
|
35
|
-
return exports;
|
|
36
|
-
|
|
37
|
-
})({});
|