@solana/accounts 2.0.0-development

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,42 @@
1
+ import { Address } from '@solana/addresses';
2
+ import type { Base58EncodedBytes, Base58EncodedDataResponse, Base64EncodedDataResponse, Base64EncodedZStdCompressedDataResponse, LamportsUnsafeBeyond2Pow53Minus1, U64UnsafeBeyond2Pow53Minus1 } from '@solana/rpc-types';
3
+ export type DataSlice = Readonly<{
4
+ offset: number;
5
+ length: number;
6
+ }>;
7
+ export type AccountInfoBase = Readonly<{
8
+ /** indicates if the account contains a program (and is strictly read-only) */
9
+ executable: boolean;
10
+ /** number of lamports assigned to this account */
11
+ lamports: LamportsUnsafeBeyond2Pow53Minus1;
12
+ /** pubkey of the program this account has been assigned to */
13
+ owner: Address;
14
+ /** the epoch at which this account will next owe rent */
15
+ rentEpoch: U64UnsafeBeyond2Pow53Minus1;
16
+ }>;
17
+ /** @deprecated */
18
+ export type AccountInfoWithBase58Bytes = Readonly<{
19
+ data: Base58EncodedBytes;
20
+ }>;
21
+ /** @deprecated */
22
+ export type AccountInfoWithBase58EncodedData = Readonly<{
23
+ data: Base58EncodedDataResponse;
24
+ }>;
25
+ export type AccountInfoWithBase64EncodedData = Readonly<{
26
+ data: Base64EncodedDataResponse;
27
+ }>;
28
+ export type AccountInfoWithBase64EncodedZStdCompressedData = Readonly<{
29
+ data: Base64EncodedZStdCompressedDataResponse;
30
+ }>;
31
+ export type AccountInfoWithJsonData = Readonly<{
32
+ data: JsonParsedDataResponse | Base64EncodedDataResponse;
33
+ }>;
34
+ export type JsonParsedDataResponse<TData = object> = Readonly<{
35
+ program: string;
36
+ parsed: {
37
+ info?: TData;
38
+ type: string;
39
+ };
40
+ space: U64UnsafeBeyond2Pow53Minus1;
41
+ }>;
42
+ //# sourceMappingURL=common.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"common.d.ts","sourceRoot":"","sources":["../../../src/r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,IAAI,CAAC,EAAE,KAAK,CAAC;QACb,IAAI,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,KAAK,EAAE,2BAA2B,CAAC;CACtC,CAAC,CAAC"}
@@ -0,0 +1,34 @@
1
+ import type { Address } from '@solana/addresses';
2
+ import type { Commitment, IRpcApiMethods, RpcResponse, Slot } from '@solana/rpc-types';
3
+ import { AccountInfoBase, AccountInfoWithBase58Bytes, AccountInfoWithBase58EncodedData, AccountInfoWithBase64EncodedData, AccountInfoWithBase64EncodedZStdCompressedData, AccountInfoWithJsonData, DataSlice } from './common.js';
4
+ type GetAccountInfoApiResponseBase = RpcResponse<AccountInfoBase | null>;
5
+ type NestInRpcResponseOrNull<T> = Readonly<{
6
+ value: T | null;
7
+ }>;
8
+ type GetAccountInfoApiCommonConfig = Readonly<{
9
+ commitment?: Commitment;
10
+ minContextSlot?: Slot;
11
+ }>;
12
+ type GetAccountInfoApiSliceableCommonConfig = Readonly<{
13
+ dataSlice?: DataSlice;
14
+ }>;
15
+ export interface GetAccountInfoApi extends IRpcApiMethods {
16
+ /**
17
+ * Returns all information associated with the account of provided public key
18
+ */
19
+ getAccountInfo(address: Address, config: GetAccountInfoApiCommonConfig & GetAccountInfoApiSliceableCommonConfig & Readonly<{
20
+ encoding: 'base64';
21
+ }>): GetAccountInfoApiResponseBase & NestInRpcResponseOrNull<AccountInfoWithBase64EncodedData>;
22
+ getAccountInfo(address: Address, config: GetAccountInfoApiCommonConfig & GetAccountInfoApiSliceableCommonConfig & Readonly<{
23
+ encoding: 'base64+zstd';
24
+ }>): GetAccountInfoApiResponseBase & NestInRpcResponseOrNull<AccountInfoWithBase64EncodedZStdCompressedData>;
25
+ getAccountInfo(address: Address, config: GetAccountInfoApiCommonConfig & Readonly<{
26
+ encoding: 'jsonParsed';
27
+ }>): GetAccountInfoApiResponseBase & NestInRpcResponseOrNull<AccountInfoWithJsonData>;
28
+ getAccountInfo(address: Address, config: GetAccountInfoApiCommonConfig & GetAccountInfoApiSliceableCommonConfig & Readonly<{
29
+ encoding: 'base58';
30
+ }>): GetAccountInfoApiResponseBase & NestInRpcResponseOrNull<AccountInfoWithBase58EncodedData>;
31
+ getAccountInfo(address: Address, config?: GetAccountInfoApiCommonConfig): GetAccountInfoApiResponseBase & NestInRpcResponseOrNull<AccountInfoWithBase58Bytes>;
32
+ }
33
+ export {};
34
+ //# sourceMappingURL=getAccountInfo.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getAccountInfo.d.ts","sourceRoot":"","sources":["../../../src/rpc-api/getAccountInfo.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AACjD,OAAO,KAAK,EAAE,UAAU,EAAE,cAAc,EAAE,WAAW,EAAE,IAAI,EAAE,MAAM,mBAAmB,CAAC;AAEvF,OAAO,EACH,eAAe,EACf,0BAA0B,EAC1B,gCAAgC,EAChC,gCAAgC,EAChC,8CAA8C,EAC9C,uBAAuB,EACvB,SAAS,EACZ,MAAM,UAAU,CAAC;AAElB,KAAK,6BAA6B,GAAG,WAAW,CAAC,eAAe,GAAG,IAAI,CAAC,CAAC;AAEzE,KAAK,uBAAuB,CAAC,CAAC,IAAI,QAAQ,CAAC;IACvC,KAAK,EAAE,CAAC,GAAG,IAAI,CAAC;CACnB,CAAC,CAAC;AAEH,KAAK,6BAA6B,GAAG,QAAQ,CAAC;IAE1C,UAAU,CAAC,EAAE,UAAU,CAAC;IAExB,cAAc,CAAC,EAAE,IAAI,CAAC;CACzB,CAAC,CAAC;AAEH,KAAK,sCAAsC,GAAG,QAAQ,CAAC;IAEnD,SAAS,CAAC,EAAE,SAAS,CAAC;CACzB,CAAC,CAAC;AAEH,MAAM,WAAW,iBAAkB,SAAQ,cAAc;IACrD;;OAEG;IACH,cAAc,CACV,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,6BAA6B,GACjC,sCAAsC,GACtC,QAAQ,CAAC;QACL,QAAQ,EAAE,QAAQ,CAAC;KACtB,CAAC,GACP,6BAA6B,GAAG,uBAAuB,CAAC,gCAAgC,CAAC,CAAC;IAC7F,cAAc,CACV,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,6BAA6B,GACjC,sCAAsC,GACtC,QAAQ,CAAC;QACL,QAAQ,EAAE,aAAa,CAAC;KAC3B,CAAC,GACP,6BAA6B,GAAG,uBAAuB,CAAC,8CAA8C,CAAC,CAAC;IAC3G,cAAc,CACV,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,6BAA6B,GACjC,QAAQ,CAAC;QACL,QAAQ,EAAE,YAAY,CAAC;KAC1B,CAAC,GACP,6BAA6B,GAAG,uBAAuB,CAAC,uBAAuB,CAAC,CAAC;IACpF,cAAc,CACV,OAAO,EAAE,OAAO,EAChB,MAAM,EAAE,6BAA6B,GACjC,sCAAsC,GACtC,QAAQ,CAAC;QACL,QAAQ,EAAE,QAAQ,CAAC;KACtB,CAAC,GACP,6BAA6B,GAAG,uBAAuB,CAAC,gCAAgC,CAAC,CAAC;IAC7F,cAAc,CACV,OAAO,EAAE,OAAO,EAChB,MAAM,CAAC,EAAE,6BAA6B,GACvC,6BAA6B,GAAG,uBAAuB,CAAC,0BAA0B,CAAC,CAAC;CAC1F"}
@@ -0,0 +1,44 @@
1
+ import type { Address } from '@solana/addresses';
2
+ import type { Commitment, IRpcApiMethods, RpcResponse, Slot } from '@solana/rpc-types';
3
+ import { AccountInfoBase, AccountInfoWithBase58EncodedData, AccountInfoWithBase64EncodedData, AccountInfoWithBase64EncodedZStdCompressedData, AccountInfoWithJsonData, DataSlice } from './common.js';
4
+ type GetMultipleAccountsApiResponseBase = AccountInfoBase | null;
5
+ type GetMultipleAccountsApiCommonConfig = Readonly<{
6
+ /** Defaults to `finalized` */
7
+ commitment?: Commitment;
8
+ /** The minimum slot that the request can be evaluated at */
9
+ minContextSlot?: Slot;
10
+ }>;
11
+ type GetMultipleAccountsApiSliceableCommonConfig = Readonly<{
12
+ /** Limit the returned account data */
13
+ dataSlice?: DataSlice;
14
+ }>;
15
+ export interface GetMultipleAccountsApi extends IRpcApiMethods {
16
+ /**
17
+ * Returns the account information for a list of Pubkeys.
18
+ */
19
+ getMultipleAccounts(
20
+ /** An array of up to 100 Pubkeys to query */
21
+ addresses: Address[], config: GetMultipleAccountsApiCommonConfig & GetMultipleAccountsApiSliceableCommonConfig & Readonly<{
22
+ encoding: 'base64';
23
+ }>): RpcResponse<(GetMultipleAccountsApiResponseBase & (AccountInfoWithBase64EncodedData | null))[]>;
24
+ getMultipleAccounts(
25
+ /** An array of up to 100 Pubkeys to query */
26
+ addresses: Address[], config: GetMultipleAccountsApiCommonConfig & GetMultipleAccountsApiSliceableCommonConfig & Readonly<{
27
+ encoding: 'base64+zstd';
28
+ }>): RpcResponse<(GetMultipleAccountsApiResponseBase & (AccountInfoWithBase64EncodedZStdCompressedData | null))[]>;
29
+ getMultipleAccounts(
30
+ /** An array of up to 100 Pubkeys to query */
31
+ addresses: Address[], config: GetMultipleAccountsApiCommonConfig & Readonly<{
32
+ encoding: 'jsonParsed';
33
+ }>): RpcResponse<(GetMultipleAccountsApiResponseBase & (AccountInfoWithJsonData | null))[]>;
34
+ getMultipleAccounts(
35
+ /** An array of up to 100 Pubkeys to query */
36
+ addresses: Address[], config: GetMultipleAccountsApiCommonConfig & GetMultipleAccountsApiSliceableCommonConfig & Readonly<{
37
+ encoding: 'base58';
38
+ }>): RpcResponse<(GetMultipleAccountsApiResponseBase & (AccountInfoWithBase58EncodedData | null))[]>;
39
+ getMultipleAccounts(
40
+ /** An array of up to 100 Pubkeys to query */
41
+ addresses: Address[], config?: GetMultipleAccountsApiCommonConfig): RpcResponse<(GetMultipleAccountsApiResponseBase & (AccountInfoWithBase64EncodedData | null))[]>;
42
+ }
43
+ export {};
44
+ //# sourceMappingURL=getMultipleAccounts.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"getMultipleAccounts.d.ts","sourceRoot":"","sources":["../../../src/rpc-api/getMultipleAccounts.ts"],"names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,MAAM,EAAE,kCAAkC,GACtC,QAAQ,CAAC;QACL,QAAQ,EAAE,YAAY,CAAC;KAC1B,CAAC,GACP,WAAW,CAAC,CAAC,kCAAkC,GAAG,CAAC,uBAAuB,GAAG,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC;IAC1F,mBAAmB;IACf,6CAA6C;IAC7C,SAAS,EAAE,OAAO,EAAE,EACpB,MAAM,EAAE,kCAAkC,GACtC,2CAA2C,GAC3C,QAAQ,CAAC;QACL,QAAQ,EAAE,QAAQ,CAAC;KACtB,CAAC,GACP,WAAW,CAAC,CAAC,kCAAkC,GAAG,CAAC,gCAAgC,GAAG,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC;IACnG,mBAAmB;IACf,6CAA6C;IAC7C,SAAS,EAAE,OAAO,EAAE,EACpB,MAAM,CAAC,EAAE,kCAAkC,GAC5C,WAAW,CAAC,CAAC,kCAAkC,GAAG,CAAC,gCAAgC,GAAG,IAAI,CAAC,CAAC,EAAE,CAAC,CAAC;CACtG"}
@@ -0,0 +1,4 @@
1
+ export * from './common.js';
2
+ export * from './getAccountInfo.js';
3
+ export * from './getMultipleAccounts.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/rpc-api/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,kBAAkB,CAAC;AACjC,cAAc,uBAAuB,CAAC"}
package/package.json ADDED
@@ -0,0 +1,98 @@
1
+ {
2
+ "name": "@solana/accounts",
3
+ "version": "2.0.0-development",
4
+ "description": "Helpers for representing, fetching and decoding Solana accounts",
5
+ "exports": {
6
+ "browser": {
7
+ "import": "./dist/index.browser.js",
8
+ "require": "./dist/index.browser.cjs"
9
+ },
10
+ "node": {
11
+ "import": "./dist/index.node.js",
12
+ "require": "./dist/index.node.cjs"
13
+ },
14
+ "react-native": "./dist/index.native.js",
15
+ "types": "./dist/types/index.d.ts"
16
+ },
17
+ "browser": {
18
+ "./dist/index.node.cjs": "./dist/index.browser.cjs",
19
+ "./dist/index.node.js": "./dist/index.browser.js"
20
+ },
21
+ "main": "./dist/index.node.cjs",
22
+ "module": "./dist/index.node.js",
23
+ "react-native": "./dist/index.native.js",
24
+ "types": "./dist/types/index.d.ts",
25
+ "type": "module",
26
+ "files": [
27
+ "./dist/"
28
+ ],
29
+ "sideEffects": false,
30
+ "keywords": [
31
+ "blockchain",
32
+ "solana",
33
+ "web3"
34
+ ],
35
+ "author": "Solana Labs Maintainers <maintainers@solanalabs.com>",
36
+ "license": "MIT",
37
+ "repository": {
38
+ "type": "git",
39
+ "url": "https://github.com/solana-labs/solana-web3.js"
40
+ },
41
+ "bugs": {
42
+ "url": "http://github.com/solana-labs/solana-web3.js/issues"
43
+ },
44
+ "browserslist": [
45
+ "supports bigint and not dead",
46
+ "maintained node versions"
47
+ ],
48
+ "dependencies": {
49
+ "@solana/addresses": "2.0.0-experimental.b93299a",
50
+ "@solana/codecs-core": "2.0.0-experimental.b93299a",
51
+ "@solana/codecs-strings": "2.0.0-experimental.b93299a",
52
+ "@solana/rpc-types": "2.0.0-experimental.b93299a"
53
+ },
54
+ "devDependencies": {
55
+ "@solana/eslint-config-solana": "^1.0.2",
56
+ "@swc/jest": "^0.2.29",
57
+ "@types/jest": "^29.5.11",
58
+ "@typescript-eslint/eslint-plugin": "^6.13.2",
59
+ "@typescript-eslint/parser": "^6.3.0",
60
+ "agadoo": "^3.0.0",
61
+ "eslint": "^8.45.0",
62
+ "eslint-plugin-sort-keys-fix": "^1.1.2",
63
+ "jest": "^29.7.0",
64
+ "jest-runner-eslint": "^2.1.2",
65
+ "jest-runner-prettier": "^1.0.0",
66
+ "prettier": "^3.1",
67
+ "tsup": "^8.0.1",
68
+ "typescript": "^5.2.2",
69
+ "version-from-git": "^1.1.1",
70
+ "build-scripts": "0.0.0",
71
+ "test-config": "0.0.0",
72
+ "test-matchers": "0.0.0",
73
+ "tsconfig": "0.0.0"
74
+ },
75
+ "bundlewatch": {
76
+ "defaultCompression": "gzip",
77
+ "files": [
78
+ {
79
+ "path": "./dist/index*.js"
80
+ }
81
+ ]
82
+ },
83
+ "scripts": {
84
+ "compile:js": "tsup --config build-scripts/tsup.config.package.ts",
85
+ "compile:typedefs": "tsc -p ./tsconfig.declarations.json && node node_modules/build-scripts/add-js-extension-to-types.mjs",
86
+ "dev": "jest -c node_modules/test-config/jest-dev.config.ts --rootDir . --watch",
87
+ "publish-packages": "pnpm publish --tag experimental --access public --no-git-checks",
88
+ "style:fix": "pnpm eslint --fix src/* && pnpm prettier -w src/* package.json",
89
+ "test:lint": "jest -c node_modules/test-config/jest-lint.config.ts --rootDir . --silent",
90
+ "test:prettier": "jest -c node_modules/test-config/jest-prettier.config.ts --rootDir . --silent",
91
+ "test:treeshakability:browser": "agadoo dist/index.browser.js",
92
+ "test:treeshakability:native": "agadoo dist/index.native.js",
93
+ "test:treeshakability:node": "agadoo dist/index.node.js",
94
+ "test:typecheck": "tsc --noEmit",
95
+ "test:unit:browser": "jest -c node_modules/test-config/jest-unit.config.browser.ts --rootDir . --silent",
96
+ "test:unit:node": "jest -c node_modules/test-config/jest-unit.config.node.ts --rootDir . --silent"
97
+ }
98
+ }