@solana/codecs-strings 2.0.0-20241006045741

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.
@@ -0,0 +1,8 @@
1
+ import { VariableSizeCodec, VariableSizeDecoder, VariableSizeEncoder } from '@solana/codecs-core';
2
+ /** Encodes strings in base16. */
3
+ export declare const getBase16Encoder: () => VariableSizeEncoder<string>;
4
+ /** Decodes strings in base16. */
5
+ export declare const getBase16Decoder: () => VariableSizeDecoder<string>;
6
+ /** Encodes and decodes strings in base16. */
7
+ export declare const getBase16Codec: () => VariableSizeCodec<string>;
8
+ //# sourceMappingURL=base16.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base16.d.ts","sourceRoot":"","sources":["../../src/base16.ts"],"names":[],"mappings":"AAAA,OAAO,EAIH,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACtB,MAAM,qBAAqB,CAAC;AAuB7B,iCAAiC;AACjC,eAAO,MAAM,gBAAgB,QAAO,mBAAmB,CAAC,MAAM,CAqCxD,CAAC;AAEP,iCAAiC;AACjC,eAAO,MAAM,gBAAgB,QAAO,mBAAmB,CAAC,MAAM,CAMxD,CAAC;AAEP,6CAA6C;AAC7C,eAAO,MAAM,cAAc,QAAO,iBAAiB,CAAC,MAAM,CAAyD,CAAC"}
@@ -0,0 +1,7 @@
1
+ /** Encodes strings in base58. */
2
+ export declare const getBase58Encoder: () => import("@solana/codecs-core").VariableSizeEncoder<string>;
3
+ /** Decodes strings in base58. */
4
+ export declare const getBase58Decoder: () => import("@solana/codecs-core").VariableSizeDecoder<string>;
5
+ /** Encodes and decodes strings in base58. */
6
+ export declare const getBase58Codec: () => import("@solana/codecs-core").VariableSizeCodec<string>;
7
+ //# sourceMappingURL=base58.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base58.d.ts","sourceRoot":"","sources":["../../src/base58.ts"],"names":[],"mappings":"AAIA,iCAAiC;AACjC,eAAO,MAAM,gBAAgB,iEAAkC,CAAC;AAEhE,iCAAiC;AACjC,eAAO,MAAM,gBAAgB,iEAAkC,CAAC;AAEhE,6CAA6C;AAC7C,eAAO,MAAM,cAAc,+DAAgC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { VariableSizeCodec, VariableSizeDecoder, VariableSizeEncoder } from '@solana/codecs-core';
2
+ /** Encodes strings in base64. */
3
+ export declare const getBase64Encoder: () => VariableSizeEncoder<string>;
4
+ /** Decodes strings in base64. */
5
+ export declare const getBase64Decoder: () => VariableSizeDecoder<string>;
6
+ /** Encodes and decodes strings in base64. */
7
+ export declare const getBase64Codec: () => VariableSizeCodec<string>;
8
+ //# sourceMappingURL=base64.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"base64.d.ts","sourceRoot":"","sources":["../../src/base64.ts"],"names":[],"mappings":"AAAA,OAAO,EAMH,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACtB,MAAM,qBAAqB,CAAC;AAQ7B,iCAAiC;AACjC,eAAO,MAAM,gBAAgB,QAAO,mBAAmB,CAAC,MAAM,CA6C7D,CAAC;AAEF,iCAAiC;AACjC,eAAO,MAAM,gBAAgB,QAAO,mBAAmB,CAAC,MAAM,CAoB7D,CAAC;AAEF,6CAA6C;AAC7C,eAAO,MAAM,cAAc,QAAO,iBAAiB,CAAC,MAAM,CAAyD,CAAC"}
@@ -0,0 +1,20 @@
1
+ import { VariableSizeCodec, VariableSizeDecoder, VariableSizeEncoder } from '@solana/codecs-core';
2
+ /**
3
+ * Encodes a string using a custom alphabet by reslicing the bits of the byte array.
4
+ * @see {@link getBaseXResliceCodec} for a more detailed description.
5
+ */
6
+ export declare const getBaseXResliceEncoder: (alphabet: string, bits: number) => VariableSizeEncoder<string>;
7
+ /**
8
+ * Decodes a string using a custom alphabet by reslicing the bits of the byte array.
9
+ * @see {@link getBaseXResliceCodec} for a more detailed description.
10
+ */
11
+ export declare const getBaseXResliceDecoder: (alphabet: string, bits: number) => VariableSizeDecoder<string>;
12
+ /**
13
+ * A string serializer that reslices bytes into custom chunks
14
+ * of bits that are then mapped to a custom alphabet.
15
+ *
16
+ * This can be used to create serializers whose alphabet
17
+ * is a power of 2 such as base16 or base64.
18
+ */
19
+ export declare const getBaseXResliceCodec: (alphabet: string, bits: number) => VariableSizeCodec<string>;
20
+ //# sourceMappingURL=baseX-reslice.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"baseX-reslice.d.ts","sourceRoot":"","sources":["../../src/baseX-reslice.ts"],"names":[],"mappings":"AAAA,OAAO,EAIH,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACtB,MAAM,qBAAqB,CAAC;AAI7B;;;GAGG;AACH,eAAO,MAAM,sBAAsB,aAAc,MAAM,QAAQ,MAAM,KAAG,mBAAmB,CAAC,MAAM,CAW5F,CAAC;AAEP;;;GAGG;AACH,eAAO,MAAM,sBAAsB,aAAc,MAAM,QAAQ,MAAM,KAAG,mBAAmB,CAAC,MAAM,CAQ5F,CAAC;AAEP;;;;;;GAMG;AACH,eAAO,MAAM,oBAAoB,aAAc,MAAM,QAAQ,MAAM,KAAG,iBAAiB,CAAC,MAAM,CACE,CAAC"}
@@ -0,0 +1,24 @@
1
+ import { VariableSizeCodec, VariableSizeDecoder, VariableSizeEncoder } from '@solana/codecs-core';
2
+ /**
3
+ * Encodes a string using a custom alphabet by dividing
4
+ * by the base and handling leading zeroes.
5
+ * @see {@link getBaseXCodec} for a more detailed description.
6
+ */
7
+ export declare const getBaseXEncoder: (alphabet: string) => VariableSizeEncoder<string>;
8
+ /**
9
+ * Decodes a string using a custom alphabet by dividing
10
+ * by the base and handling leading zeroes.
11
+ * @see {@link getBaseXCodec} for a more detailed description.
12
+ */
13
+ export declare const getBaseXDecoder: (alphabet: string) => VariableSizeDecoder<string>;
14
+ /**
15
+ * A string codec that requires a custom alphabet and uses
16
+ * the length of that alphabet as the base. It then divides
17
+ * the input by the base as many times as necessary to get
18
+ * the output. It also supports leading zeroes by using the
19
+ * first character of the alphabet as the zero character.
20
+ *
21
+ * This can be used to create codecs such as base10 or base58.
22
+ */
23
+ export declare const getBaseXCodec: (alphabet: string) => VariableSizeCodec<string>;
24
+ //# sourceMappingURL=baseX.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"baseX.d.ts","sourceRoot":"","sources":["../../src/baseX.ts"],"names":[],"mappings":"AAAA,OAAO,EAIH,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACtB,MAAM,qBAAqB,CAAC;AAI7B;;;;GAIG;AACH,eAAO,MAAM,eAAe,aAAc,MAAM,KAAG,mBAAmB,CAAC,MAAM,CAoC5E,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,eAAe,aAAc,MAAM,KAAG,mBAAmB,CAAC,MAAM,CAqB5E,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,aAAa,aAAc,MAAM,KAAG,iBAAiB,CAAC,MAAM,CACH,CAAC"}
@@ -0,0 +1,10 @@
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 './utf8';
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,iBAAiB,CAAC;AAChC,cAAc,mBAAmB,CAAC;AAClC,cAAc,QAAQ,CAAC"}
@@ -0,0 +1,5 @@
1
+ /**Removes null characters from a string. */
2
+ export declare const removeNullCharacters: (value: string) => string;
3
+ /** Pads a string with null characters at the end. */
4
+ export declare const padNullCharacters: (value: string, chars: number) => string;
5
+ //# sourceMappingURL=null-characters.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"null-characters.d.ts","sourceRoot":"","sources":["../../src/null-characters.ts"],"names":[],"mappings":"AAAA,4CAA4C;AAC5C,eAAO,MAAM,oBAAoB,UAAW,MAAM,WAElB,CAAC;AAEjC,qDAAqD;AACrD,eAAO,MAAM,iBAAiB,UAAW,MAAM,SAAS,MAAM,WAAkC,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { VariableSizeCodec, VariableSizeDecoder, VariableSizeEncoder } from '@solana/codecs-core';
2
+ /** Encodes UTF-8 strings using the native `TextEncoder` API. */
3
+ export declare const getUtf8Encoder: () => VariableSizeEncoder<string>;
4
+ /** Decodes UTF-8 strings using the native `TextDecoder` API. */
5
+ export declare const getUtf8Decoder: () => VariableSizeDecoder<string>;
6
+ /** Encodes and decodes UTF-8 strings using the native `TextEncoder` and `TextDecoder` API. */
7
+ export declare const getUtf8Codec: () => VariableSizeCodec<string>;
8
+ //# sourceMappingURL=utf8.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utf8.d.ts","sourceRoot":"","sources":["../../src/utf8.ts"],"names":[],"mappings":"AAAA,OAAO,EAIH,iBAAiB,EACjB,mBAAmB,EACnB,mBAAmB,EACtB,MAAM,qBAAqB,CAAC;AAK7B,gEAAgE;AAChE,eAAO,MAAM,cAAc,QAAO,mBAAmB,CAAC,MAAM,CAU3D,CAAC;AAEF,gEAAgE;AAChE,eAAO,MAAM,cAAc,QAAO,mBAAmB,CAAC,MAAM,CAQ3D,CAAC;AAEF,8FAA8F;AAC9F,eAAO,MAAM,YAAY,QAAO,iBAAiB,CAAC,MAAM,CAAqD,CAAC"}
package/package.json ADDED
@@ -0,0 +1,93 @@
1
+ {
2
+ "name": "@solana/codecs-strings",
3
+ "version": "2.0.0-20241006045741",
4
+ "description": "Codecs for strings of different sizes and encodings",
5
+ "exports": {
6
+ "edge-light": {
7
+ "import": "./dist/index.node.mjs",
8
+ "require": "./dist/index.node.cjs"
9
+ },
10
+ "workerd": {
11
+ "import": "./dist/index.node.mjs",
12
+ "require": "./dist/index.node.cjs"
13
+ },
14
+ "browser": {
15
+ "import": "./dist/index.browser.mjs",
16
+ "require": "./dist/index.browser.cjs"
17
+ },
18
+ "node": {
19
+ "import": "./dist/index.node.mjs",
20
+ "require": "./dist/index.node.cjs"
21
+ },
22
+ "react-native": "./dist/index.native.mjs",
23
+ "types": "./dist/types/index.d.ts"
24
+ },
25
+ "browser": {
26
+ "./dist/index.node.cjs": "./dist/index.browser.cjs",
27
+ "./dist/index.node.mjs": "./dist/index.browser.mjs"
28
+ },
29
+ "main": "./dist/index.node.cjs",
30
+ "module": "./dist/index.node.mjs",
31
+ "react-native": "./dist/index.native.mjs",
32
+ "types": "./dist/types/index.d.ts",
33
+ "type": "commonjs",
34
+ "files": [
35
+ "./dist/"
36
+ ],
37
+ "sideEffects": false,
38
+ "keywords": [
39
+ "blockchain",
40
+ "solana",
41
+ "web3"
42
+ ],
43
+ "author": "Solana Labs Maintainers <maintainers@solanalabs.com>",
44
+ "license": "MIT",
45
+ "repository": {
46
+ "type": "git",
47
+ "url": "https://github.com/solana-labs/solana-web3.js"
48
+ },
49
+ "bugs": {
50
+ "url": "http://github.com/solana-labs/solana-web3.js/issues"
51
+ },
52
+ "browserslist": [
53
+ "supports bigint and not dead",
54
+ "maintained node versions"
55
+ ],
56
+ "engine": {
57
+ "node": ">=17.4"
58
+ },
59
+ "dependencies": {
60
+ "@solana/codecs-core": "2.0.0-20241006045741",
61
+ "@solana/codecs-numbers": "2.0.0-20241006045741",
62
+ "@solana/errors": "2.0.0-20241006045741"
63
+ },
64
+ "peerDependencies": {
65
+ "fastestsmallesttextencoderdecoder": "^1.0.22",
66
+ "typescript": ">=5"
67
+ },
68
+ "bundlewatch": {
69
+ "defaultCompression": "gzip",
70
+ "files": [
71
+ {
72
+ "path": "./dist/index*.js"
73
+ }
74
+ ]
75
+ },
76
+ "scripts": {
77
+ "benchmark": "./src/__benchmarks__/run.ts",
78
+ "compile:js": "tsup --config build-scripts/tsup.config.package.ts",
79
+ "compile:typedefs": "tsc -p ./tsconfig.declarations.json",
80
+ "dev": "jest -c ../../node_modules/@solana/test-config/jest-dev.config.ts --rootDir . --watch",
81
+ "publish-impl": "npm view $npm_package_name@$npm_package_version > /dev/null 2>&1 || pnpm publish --tag ${PUBLISH_TAG:-canary} --access public --no-git-checks",
82
+ "publish-packages": "pnpm prepublishOnly && pnpm publish-impl",
83
+ "style:fix": "pnpm eslint --fix src && pnpm prettier --log-level warn --ignore-unknown --write ./*",
84
+ "test:lint": "TERM_OVERRIDE=\"${TURBO_HASH:+dumb}\" TERM=${TERM_OVERRIDE:-$TERM} jest -c ../../node_modules/@solana/test-config/jest-lint.config.ts --rootDir . --silent",
85
+ "test:prettier": "TERM_OVERRIDE=\"${TURBO_HASH:+dumb}\" TERM=${TERM_OVERRIDE:-$TERM} jest -c ../../node_modules/@solana/test-config/jest-prettier.config.ts --rootDir . --silent",
86
+ "test:treeshakability:browser": "agadoo dist/index.browser.mjs",
87
+ "test:treeshakability:native": "agadoo dist/index.native.mjs",
88
+ "test:treeshakability:node": "agadoo dist/index.node.mjs",
89
+ "test:typecheck": "tsc --noEmit",
90
+ "test:unit:browser": "TERM_OVERRIDE=\"${TURBO_HASH:+dumb}\" TERM=${TERM_OVERRIDE:-$TERM} jest -c ../../node_modules/@solana/test-config/jest-unit.config.browser.ts --rootDir . --silent",
91
+ "test:unit:node": "TERM_OVERRIDE=\"${TURBO_HASH:+dumb}\" TERM=${TERM_OVERRIDE:-$TERM} jest -c ../../node_modules/@solana/test-config/jest-unit.config.node.ts --rootDir . --silent"
92
+ }
93
+ }