@solana/web3.js 1.78.0 → 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.
Files changed (99) hide show
  1. package/README.md +56 -112
  2. package/dist/index.browser.cjs +158 -0
  3. package/dist/index.browser.cjs.map +1 -0
  4. package/dist/index.browser.js +137 -0
  5. package/dist/index.browser.js.map +1 -0
  6. package/dist/index.development.js +1044 -0
  7. package/dist/index.development.js.map +1 -0
  8. package/dist/index.native.js +139 -0
  9. package/dist/index.native.js.map +1 -0
  10. package/dist/index.node.cjs +158 -0
  11. package/dist/index.node.cjs.map +1 -0
  12. package/dist/index.node.js +139 -0
  13. package/dist/index.node.js.map +1 -0
  14. package/dist/index.production.min.js +25 -0
  15. package/dist/types/index.d.ts +5 -0
  16. package/dist/types/rpc-default-config.d.ts +3 -0
  17. package/dist/types/rpc-integer-overflow-error.d.ts +8 -0
  18. package/dist/types/rpc-request-coalescer.d.ts +5 -0
  19. package/dist/types/rpc-request-deduplication.d.ts +2 -0
  20. package/dist/types/rpc-transport.d.ts +4 -0
  21. package/dist/types/rpc.d.ts +5 -0
  22. package/package.json +86 -111
  23. package/lib/index.browser.cjs.js +0 -10248
  24. package/lib/index.browser.cjs.js.map +0 -1
  25. package/lib/index.browser.esm.js +0 -10145
  26. package/lib/index.browser.esm.js.map +0 -1
  27. package/lib/index.cjs.js +0 -12748
  28. package/lib/index.cjs.js.map +0 -1
  29. package/lib/index.d.ts +0 -3904
  30. package/lib/index.esm.js +0 -12638
  31. package/lib/index.esm.js.map +0 -1
  32. package/lib/index.iife.js +0 -26757
  33. package/lib/index.iife.js.map +0 -1
  34. package/lib/index.iife.min.js +0 -20
  35. package/lib/index.iife.min.js.map +0 -1
  36. package/lib/index.native.js +0 -10248
  37. package/lib/index.native.js.map +0 -1
  38. package/src/__forks__/browser/fetch-impl.ts +0 -4
  39. package/src/__forks__/browser/rpc-websocket-factory.ts +0 -1
  40. package/src/__forks__/react-native/fetch-impl.ts +0 -4
  41. package/src/__forks__/react-native/rpc-websocket-factory.ts +0 -1
  42. package/src/account-data.ts +0 -39
  43. package/src/account.ts +0 -55
  44. package/src/blockhash.ts +0 -4
  45. package/src/bpf-loader-deprecated.ts +0 -5
  46. package/src/bpf-loader.ts +0 -45
  47. package/src/connection.ts +0 -6796
  48. package/src/epoch-schedule.ts +0 -102
  49. package/src/errors.ts +0 -50
  50. package/src/fee-calculator.ts +0 -18
  51. package/src/fetch-impl.ts +0 -13
  52. package/src/index.ts +0 -24
  53. package/src/instruction.ts +0 -58
  54. package/src/keypair.ts +0 -93
  55. package/src/layout.ts +0 -188
  56. package/src/loader.ts +0 -267
  57. package/src/message/account-keys.ts +0 -79
  58. package/src/message/compiled-keys.ts +0 -165
  59. package/src/message/index.ts +0 -47
  60. package/src/message/legacy.ts +0 -326
  61. package/src/message/v0.ts +0 -496
  62. package/src/message/versioned.ts +0 -36
  63. package/src/nonce-account.ts +0 -82
  64. package/src/programs/address-lookup-table/index.ts +0 -435
  65. package/src/programs/address-lookup-table/state.ts +0 -84
  66. package/src/programs/compute-budget.ts +0 -281
  67. package/src/programs/ed25519.ts +0 -157
  68. package/src/programs/index.ts +0 -7
  69. package/src/programs/secp256k1.ts +0 -228
  70. package/src/programs/stake.ts +0 -935
  71. package/src/programs/system.ts +0 -1048
  72. package/src/programs/vote.ts +0 -543
  73. package/src/publickey.ts +0 -259
  74. package/src/rpc-websocket-factory.ts +0 -4
  75. package/src/rpc-websocket.ts +0 -79
  76. package/src/sysvar.ts +0 -37
  77. package/src/timing.ts +0 -23
  78. package/src/transaction/constants.ts +0 -12
  79. package/src/transaction/expiry-custom-errors.ts +0 -48
  80. package/src/transaction/index.ts +0 -5
  81. package/src/transaction/legacy.ts +0 -918
  82. package/src/transaction/message.ts +0 -140
  83. package/src/transaction/versioned.ts +0 -126
  84. package/src/utils/assert.ts +0 -8
  85. package/src/utils/bigint.ts +0 -43
  86. package/src/utils/borsh-schema.ts +0 -38
  87. package/src/utils/cluster.ts +0 -31
  88. package/src/utils/ed25519.ts +0 -43
  89. package/src/utils/index.ts +0 -5
  90. package/src/utils/makeWebsocketUrl.ts +0 -26
  91. package/src/utils/promise-timeout.ts +0 -14
  92. package/src/utils/secp256k1.ts +0 -11
  93. package/src/utils/send-and-confirm-raw-transaction.ts +0 -102
  94. package/src/utils/send-and-confirm-transaction.ts +0 -98
  95. package/src/utils/shortvec-encoding.ts +0 -28
  96. package/src/utils/sleep.ts +0 -4
  97. package/src/utils/to-buffer.ts +0 -11
  98. package/src/validator-info.ts +0 -104
  99. package/src/vote-account.ts +0 -236
@@ -1,4 +0,0 @@
1
- export const Headers = globalThis.Headers;
2
- export const Request = globalThis.Request;
3
- export const Response = globalThis.Response;
4
- export default globalThis.fetch;
@@ -1 +0,0 @@
1
- export {default} from 'rpc-websockets/dist/lib/client/websocket.browser';
@@ -1,4 +0,0 @@
1
- export const Headers = globalThis.Headers;
2
- export const Request = globalThis.Request;
3
- export const Response = globalThis.Response;
4
- export default globalThis.fetch;
@@ -1 +0,0 @@
1
- export {default} from 'rpc-websockets/dist/lib/client/websocket.browser';
@@ -1,39 +0,0 @@
1
- import * as BufferLayout from '@solana/buffer-layout';
2
-
3
- export interface IAccountStateData {
4
- readonly typeIndex: number;
5
- }
6
-
7
- /**
8
- * @internal
9
- */
10
- export type AccountType<TInputData extends IAccountStateData> = {
11
- /** The account type index (from solana upstream program) */
12
- index: number;
13
- /** The BufferLayout to use to build data */
14
- layout: BufferLayout.Layout<TInputData>;
15
- };
16
-
17
- /**
18
- * Decode account data buffer using an AccountType
19
- * @internal
20
- */
21
- export function decodeData<TAccountStateData extends IAccountStateData>(
22
- type: AccountType<TAccountStateData>,
23
- data: Uint8Array,
24
- ): TAccountStateData {
25
- let decoded: TAccountStateData;
26
- try {
27
- decoded = type.layout.decode(data);
28
- } catch (err) {
29
- throw new Error('invalid instruction; ' + err);
30
- }
31
-
32
- if (decoded.typeIndex !== type.index) {
33
- throw new Error(
34
- `invalid account data; account type mismatch ${decoded.typeIndex} != ${type.index}`,
35
- );
36
- }
37
-
38
- return decoded;
39
- }
package/src/account.ts DELETED
@@ -1,55 +0,0 @@
1
- import {Buffer} from 'buffer';
2
-
3
- import {generatePrivateKey, getPublicKey} from './utils/ed25519';
4
- import {toBuffer} from './utils/to-buffer';
5
- import {PublicKey} from './publickey';
6
-
7
- /**
8
- * An account key pair (public and secret keys).
9
- *
10
- * @deprecated since v1.10.0, please use {@link Keypair} instead.
11
- */
12
- export class Account {
13
- /** @internal */
14
- private _publicKey: Buffer;
15
- /** @internal */
16
- private _secretKey: Buffer;
17
-
18
- /**
19
- * Create a new Account object
20
- *
21
- * If the secretKey parameter is not provided a new key pair is randomly
22
- * created for the account
23
- *
24
- * @param secretKey Secret key for the account
25
- */
26
- constructor(secretKey?: Uint8Array | Array<number>) {
27
- if (secretKey) {
28
- const secretKeyBuffer = toBuffer(secretKey);
29
- if (secretKey.length !== 64) {
30
- throw new Error('bad secret key size');
31
- }
32
- this._publicKey = secretKeyBuffer.slice(32, 64);
33
- this._secretKey = secretKeyBuffer.slice(0, 32);
34
- } else {
35
- this._secretKey = toBuffer(generatePrivateKey());
36
- this._publicKey = toBuffer(getPublicKey(this._secretKey));
37
- }
38
- }
39
-
40
- /**
41
- * The public key for this account
42
- */
43
- get publicKey(): PublicKey {
44
- return new PublicKey(this._publicKey);
45
- }
46
-
47
- /**
48
- * The **unencrypted** secret key for this account. The first 32 bytes
49
- * is the private scalar and the last 32 bytes is the public key.
50
- * Read more: https://blog.mozilla.org/warner/2011/11/29/ed25519-keys/
51
- */
52
- get secretKey(): Buffer {
53
- return Buffer.concat([this._secretKey, this._publicKey], 64);
54
- }
55
- }
package/src/blockhash.ts DELETED
@@ -1,4 +0,0 @@
1
- /**
2
- * Blockhash as Base58 string.
3
- */
4
- export type Blockhash = string;
@@ -1,5 +0,0 @@
1
- import {PublicKey} from './publickey';
2
-
3
- export const BPF_LOADER_DEPRECATED_PROGRAM_ID = new PublicKey(
4
- 'BPFLoader1111111111111111111111111111111111',
5
- );
package/src/bpf-loader.ts DELETED
@@ -1,45 +0,0 @@
1
- import type {Buffer} from 'buffer';
2
-
3
- import {PublicKey} from './publickey';
4
- import {Loader} from './loader';
5
- import type {Connection} from './connection';
6
- import type {Signer} from './keypair';
7
-
8
- export const BPF_LOADER_PROGRAM_ID = new PublicKey(
9
- 'BPFLoader2111111111111111111111111111111111',
10
- );
11
-
12
- /**
13
- * Factory class for transactions to interact with a program loader
14
- */
15
- export class BpfLoader {
16
- /**
17
- * Minimum number of signatures required to load a program not including
18
- * retries
19
- *
20
- * Can be used to calculate transaction fees
21
- */
22
- static getMinNumSignatures(dataLength: number): number {
23
- return Loader.getMinNumSignatures(dataLength);
24
- }
25
-
26
- /**
27
- * Load a SBF program
28
- *
29
- * @param connection The connection to use
30
- * @param payer Account that will pay program loading fees
31
- * @param program Account to load the program into
32
- * @param elf The entire ELF containing the SBF program
33
- * @param loaderProgramId The program id of the BPF loader to use
34
- * @return true if program was loaded successfully, false if program was already loaded
35
- */
36
- static load(
37
- connection: Connection,
38
- payer: Signer,
39
- program: Signer,
40
- elf: Buffer | Uint8Array | Array<number>,
41
- loaderProgramId: PublicKey,
42
- ): Promise<boolean> {
43
- return Loader.load(connection, payer, program, loaderProgramId, elf);
44
- }
45
- }