@solana/sysvars 2.0.0-preview.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +17 -0
  3. package/dist/index.browser.cjs +813 -0
  4. package/dist/index.browser.cjs.map +1 -0
  5. package/dist/index.browser.js +759 -0
  6. package/dist/index.browser.js.map +1 -0
  7. package/dist/index.native.js +759 -0
  8. package/dist/index.native.js.map +1 -0
  9. package/dist/index.node.cjs +813 -0
  10. package/dist/index.node.cjs.map +1 -0
  11. package/dist/index.node.js +759 -0
  12. package/dist/index.node.js.map +1 -0
  13. package/dist/types/clock.d.ts +30 -0
  14. package/dist/types/clock.d.ts.map +1 -0
  15. package/dist/types/epoch-rewards.d.ts +42 -0
  16. package/dist/types/epoch-rewards.d.ts.map +1 -0
  17. package/dist/types/epoch-schedule.d.ts +29 -0
  18. package/dist/types/epoch-schedule.d.ts.map +1 -0
  19. package/dist/types/fees.d.ts +28 -0
  20. package/dist/types/fees.d.ts.map +1 -0
  21. package/dist/types/index.d.ts +12 -0
  22. package/dist/types/index.d.ts.map +1 -0
  23. package/dist/types/last-restart-slot.d.ts +33 -0
  24. package/dist/types/last-restart-slot.d.ts.map +1 -0
  25. package/dist/types/recent-blockhashes.d.ts +29 -0
  26. package/dist/types/recent-blockhashes.d.ts.map +1 -0
  27. package/dist/types/rent.d.ts +27 -0
  28. package/dist/types/rent.d.ts.map +1 -0
  29. package/dist/types/slot-hashes.d.ts +26 -0
  30. package/dist/types/slot-hashes.d.ts.map +1 -0
  31. package/dist/types/slot-history.d.ts +27 -0
  32. package/dist/types/slot-history.d.ts.map +1 -0
  33. package/dist/types/stake-history.d.ts +27 -0
  34. package/dist/types/stake-history.d.ts.map +1 -0
  35. package/dist/types/sysvar.d.ts +33 -0
  36. package/dist/types/sysvar.d.ts.map +1 -0
  37. package/package.json +80 -0
@@ -0,0 +1,27 @@
1
+ import { type FetchAccountConfig } from '@solana/accounts';
2
+ import { type VariableSizeCodec, type VariableSizeDecoder, type VariableSizeEncoder } from '@solana/codecs';
3
+ import type { GetAccountInfoApi } from '@solana/rpc-api';
4
+ import type { Rpc } from '@solana/rpc-spec';
5
+ import { type LamportsUnsafeBeyond2Pow53Minus1 } from '@solana/rpc-types';
6
+ type Entry = Readonly<{
7
+ activating: LamportsUnsafeBeyond2Pow53Minus1;
8
+ deactivating: LamportsUnsafeBeyond2Pow53Minus1;
9
+ effective: LamportsUnsafeBeyond2Pow53Minus1;
10
+ }>;
11
+ /**
12
+ * The `StakeHistory` sysvar.
13
+ *
14
+ * History of stake activations and de-activations.
15
+ */
16
+ export type SysvarStakeHistory = Entry[];
17
+ export declare function getSysvarStakeHistoryEncoder(): VariableSizeEncoder<SysvarStakeHistory>;
18
+ export declare function getSysvarStakeHistoryDecoder(): VariableSizeDecoder<SysvarStakeHistory>;
19
+ export declare function getSysvarStakeHistoryCodec(): VariableSizeCodec<SysvarStakeHistory>;
20
+ /**
21
+ * Fetch the `StakeHistory` sysvar.
22
+ *
23
+ * History of stake activations and de-activations.
24
+ */
25
+ export declare function fetchSysvarStakeHistory(rpc: Rpc<GetAccountInfoApi>, config?: FetchAccountConfig): Promise<SysvarStakeHistory>;
26
+ export {};
27
+ //# sourceMappingURL=stake-history.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"stake-history.d.ts","sourceRoot":"","sources":["../../src/stake-history.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsC,KAAK,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAC/F,OAAO,EAMH,KAAK,iBAAiB,EACtB,KAAK,mBAAmB,EACxB,KAAK,mBAAmB,EAC3B,MAAM,gBAAgB,CAAC;AACxB,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,iBAAiB,CAAC;AACzD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAC;AAC5C,OAAO,EAA0C,KAAK,gCAAgC,EAAE,MAAM,mBAAmB,CAAC;AAIlH,KAAK,KAAK,GAAG,QAAQ,CAAC;IAClB,UAAU,EAAE,gCAAgC,CAAC;IAC7C,YAAY,EAAE,gCAAgC,CAAC;IAC/C,SAAS,EAAE,gCAAgC,CAAC;CAC/C,CAAC,CAAC;AAEH;;;;GAIG;AACH,MAAM,MAAM,kBAAkB,GAAG,KAAK,EAAE,CAAC;AAEzC,wBAAgB,4BAA4B,IAAI,mBAAmB,CAAC,kBAAkB,CAAC,CAQtF;AAED,wBAAgB,4BAA4B,IAAI,mBAAmB,CAAC,kBAAkB,CAAC,CAQtF;AAED,wBAAgB,0BAA0B,IAAI,iBAAiB,CAAC,kBAAkB,CAAC,CAElF;AAED;;;;GAIG;AACH,wBAAsB,uBAAuB,CACzC,GAAG,EAAE,GAAG,CAAC,iBAAiB,CAAC,EAC3B,MAAM,CAAC,EAAE,kBAAkB,GAC5B,OAAO,CAAC,kBAAkB,CAAC,CAK7B"}
@@ -0,0 +1,33 @@
1
+ import { type FetchAccountConfig, type MaybeAccount, type MaybeEncodedAccount } from '@solana/accounts';
2
+ import type { Address } from '@solana/addresses';
3
+ import type { GetAccountInfoApi } from '@solana/rpc-api';
4
+ import type { JsonParsedSysvarAccount } from '@solana/rpc-parsed-types';
5
+ import type { Rpc } from '@solana/rpc-spec';
6
+ export declare const SYSVAR_CLOCK_ADDRESS: Address<"SysvarC1ock11111111111111111111111111111111">;
7
+ export declare const SYSVAR_EPOCH_REWARDS_ADDRESS: Address<"SysvarEpochRewards1111111111111111111111111">;
8
+ export declare const SYSVAR_EPOCH_SCHEDULE_ADDRESS: Address<"SysvarEpochSchedu1e111111111111111111111111">;
9
+ export declare const SYSVAR_FEES_ADDRESS: Address<"SysvarFees111111111111111111111111111111111">;
10
+ export declare const SYSVAR_INSTRUCTIONS_ADDRESS: Address<"Sysvar1nstructions1111111111111111111111111">;
11
+ export declare const SYSVAR_LAST_RESTART_SLOT_ADDRESS: Address<"SysvarLastRestartS1ot1111111111111111111111">;
12
+ export declare const SYSVAR_RECENT_BLOCKHASHES_ADDRESS: Address<"SysvarRecentB1ockHashes11111111111111111111">;
13
+ export declare const SYSVAR_RENT_ADDRESS: Address<"SysvarRent111111111111111111111111111111111">;
14
+ export declare const SYSVAR_SLOT_HASHES_ADDRESS: Address<"SysvarS1otHashes111111111111111111111111111">;
15
+ export declare const SYSVAR_SLOT_HISTORY_ADDRESS: Address<"SysvarS1otHistory11111111111111111111111111">;
16
+ export declare const SYSVAR_STAKE_HISTORY_ADDRESS: Address<"SysvarStakeHistory1111111111111111111111111">;
17
+ type SysvarAddress = typeof SYSVAR_CLOCK_ADDRESS | typeof SYSVAR_EPOCH_REWARDS_ADDRESS | typeof SYSVAR_EPOCH_SCHEDULE_ADDRESS | typeof SYSVAR_FEES_ADDRESS | typeof SYSVAR_INSTRUCTIONS_ADDRESS | typeof SYSVAR_LAST_RESTART_SLOT_ADDRESS | typeof SYSVAR_RECENT_BLOCKHASHES_ADDRESS | typeof SYSVAR_RENT_ADDRESS | typeof SYSVAR_SLOT_HASHES_ADDRESS | typeof SYSVAR_SLOT_HISTORY_ADDRESS | typeof SYSVAR_STAKE_HISTORY_ADDRESS;
18
+ /**
19
+ * Fetch an encoded sysvar account.
20
+ *
21
+ * Sysvars are special accounts that contain dynamically-updated data about the
22
+ * network cluster, the blockchain history, and the executing transaction.
23
+ */
24
+ export declare function fetchEncodedSysvarAccount<TAddress extends SysvarAddress>(rpc: Rpc<GetAccountInfoApi>, address: TAddress, config?: FetchAccountConfig): Promise<MaybeEncodedAccount<TAddress>>;
25
+ /**
26
+ * Fetch a JSON-parsed sysvar account.
27
+ *
28
+ * Sysvars are special accounts that contain dynamically-updated data about the
29
+ * network cluster, the blockchain history, and the executing transaction.
30
+ */
31
+ export declare function fetchJsonParsedSysvarAccount<TAddress extends SysvarAddress>(rpc: Rpc<GetAccountInfoApi>, address: TAddress, config?: FetchAccountConfig): Promise<MaybeAccount<JsonParsedSysvarAccount, TAddress> | MaybeEncodedAccount<T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,SAAS,aAAa,EAC1E,GAAG,EAAE,GAAG,CAAC,iBAAiB,CAAC,EAC3B,OAAO,EAAE,QAAQ,EACjB,MAAM,CAAC,EAAE,kBAAkB,GAC5B,OAAO,CAAC,mBAAmB,CAAC,QAAQ,CAAC,CAAC,CAExC;AAED;;;;;GAKG;AACH,wBAAsB,4BAA4B,CAAC,QAAQ,SAAS,aAAa,EAC7E,GAAG,EAAE,GAAG,CAAC,iBAAiB,CAAC,EAC3B,OAAO,EAAE,QAAQ,EACjB,MAAM,CAAC,EAAE,kBAAkB,GAC5B,OAAO,CAAC,YAAY,CAAC,uBAAuB,EAAE,QAAQ,CAAC,GAAG,mBAAmB,CAAC,QAAQ,CAAC,CAAC,CAE1F"}
package/package.json ADDED
@@ -0,0 +1,80 @@
1
+ {
2
+ "name": "@solana/sysvars",
3
+ "version": "2.0.0-preview.1",
4
+ "description": "An abstraction layer over signing messages and transactions in Solana",
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
+ "engine": {
49
+ "node": ">=17.4"
50
+ },
51
+ "dependencies": {
52
+ "@solana/accounts": "2.0.0-preview.1",
53
+ "@solana/codecs": "2.0.0-preview.1",
54
+ "@solana/errors": "2.0.0-preview.1"
55
+ },
56
+ "bundlewatch": {
57
+ "defaultCompression": "gzip",
58
+ "files": [
59
+ {
60
+ "path": "./dist/index*.js"
61
+ }
62
+ ]
63
+ },
64
+ "scripts": {
65
+ "compile:js": "tsup --config build-scripts/tsup.config.package.ts",
66
+ "compile:typedefs": "tsc -p ./tsconfig.declarations.json && node ../../node_modules/@solana/build-scripts/add-js-extension-to-types.mjs",
67
+ "dev": "jest -c ../../node_modules/@solana/test-config/jest-dev.config.ts --rootDir . --watch",
68
+ "publish-impl": "npm view $npm_package_name@$npm_package_version > /dev/null 2>&1 || pnpm publish --tag ${PUBLISH_TAG:-preview} --access public --no-git-checks",
69
+ "publish-packages": "pnpm prepublishOnly && pnpm publish-impl",
70
+ "style:fix": "pnpm eslint --fix src/* && pnpm prettier -w src/* package.json",
71
+ "test:lint": "jest -c ../../node_modules/@solana/test-config/jest-lint.config.ts --rootDir . --silent",
72
+ "test:prettier": "jest -c ../../node_modules/@solana/test-config/jest-prettier.config.ts --rootDir . --silent",
73
+ "test:treeshakability:browser": "agadoo dist/index.browser.js",
74
+ "test:treeshakability:native": "agadoo dist/index.native.js",
75
+ "test:treeshakability:node": "agadoo dist/index.node.js",
76
+ "test:typecheck": "tsc --noEmit",
77
+ "test:unit:browser": "jest -c ../../node_modules/@solana/test-config/jest-unit.config.browser.ts --globalSetup @solana/test-config/test-validator-setup.js --globalTeardown @solana/test-config/test-validator-teardown.js --rootDir . --silent",
78
+ "test:unit:node": "jest -c ../../node_modules/@solana/test-config/jest-unit.config.node.ts --globalSetup @solana/test-config/test-validator-setup.js --globalTeardown @solana/test-config/test-validator-teardown.js --rootDir . --silent"
79
+ }
80
+ }