@solana/web3.js 1.74.0 → 2.0.0-experimental.1b52291

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 (102) hide show
  1. package/README.md +55 -112
  2. package/dist/index.browser.cjs +77 -0
  3. package/dist/index.browser.cjs.map +1 -0
  4. package/dist/index.browser.js +68 -0
  5. package/dist/index.browser.js.map +1 -0
  6. package/dist/index.development.js +539 -0
  7. package/dist/index.development.js.map +1 -0
  8. package/dist/index.native.js +70 -0
  9. package/dist/index.native.js.map +1 -0
  10. package/dist/index.node.cjs +79 -0
  11. package/dist/index.node.cjs.map +1 -0
  12. package/dist/index.node.js +70 -0
  13. package/dist/index.node.js.map +1 -0
  14. package/dist/index.production.min.js +13 -0
  15. package/dist/types/index.d.ts +4 -0
  16. package/dist/types/index.d.ts.map +1 -0
  17. package/dist/types/rpc-default-config.d.ts +3 -0
  18. package/dist/types/rpc-default-config.d.ts.map +1 -0
  19. package/dist/types/rpc-integer-overflow-error.d.ts +8 -0
  20. package/dist/types/rpc-integer-overflow-error.d.ts.map +1 -0
  21. package/dist/types/rpc-transport.d.ts +4 -0
  22. package/dist/types/rpc-transport.d.ts.map +1 -0
  23. package/dist/types/rpc.d.ts +5 -0
  24. package/dist/types/rpc.d.ts.map +1 -0
  25. package/package.json +86 -113
  26. package/lib/index.browser.cjs.js +0 -9485
  27. package/lib/index.browser.cjs.js.map +0 -1
  28. package/lib/index.browser.esm.js +0 -9379
  29. package/lib/index.browser.esm.js.map +0 -1
  30. package/lib/index.cjs.js +0 -12009
  31. package/lib/index.cjs.js.map +0 -1
  32. package/lib/index.d.ts +0 -3865
  33. package/lib/index.esm.js +0 -11896
  34. package/lib/index.esm.js.map +0 -1
  35. package/lib/index.iife.js +0 -24568
  36. package/lib/index.iife.js.map +0 -1
  37. package/lib/index.iife.min.js +0 -13
  38. package/lib/index.iife.min.js.map +0 -1
  39. package/lib/index.native.js +0 -9485
  40. package/lib/index.native.js.map +0 -1
  41. package/src/__forks__/browser/fetch-impl.ts +0 -4
  42. package/src/__forks__/browser/rpc-websocket-factory.ts +0 -1
  43. package/src/__forks__/react-native/fetch-impl.ts +0 -4
  44. package/src/__forks__/react-native/rpc-websocket-factory.ts +0 -1
  45. package/src/account-data.ts +0 -39
  46. package/src/account.ts +0 -55
  47. package/src/blockhash.ts +0 -4
  48. package/src/bpf-loader-deprecated.ts +0 -5
  49. package/src/bpf-loader.ts +0 -45
  50. package/src/connection.ts +0 -6678
  51. package/src/epoch-schedule.ts +0 -102
  52. package/src/errors.ts +0 -50
  53. package/src/fee-calculator.ts +0 -18
  54. package/src/fetch-impl.ts +0 -13
  55. package/src/index.ts +0 -24
  56. package/src/instruction.ts +0 -58
  57. package/src/keypair.ts +0 -93
  58. package/src/layout.ts +0 -188
  59. package/src/loader.ts +0 -236
  60. package/src/message/account-keys.ts +0 -79
  61. package/src/message/compiled-keys.ts +0 -165
  62. package/src/message/index.ts +0 -47
  63. package/src/message/legacy.ts +0 -326
  64. package/src/message/v0.ts +0 -496
  65. package/src/message/versioned.ts +0 -36
  66. package/src/nonce-account.ts +0 -82
  67. package/src/programs/address-lookup-table/index.ts +0 -435
  68. package/src/programs/address-lookup-table/state.ts +0 -84
  69. package/src/programs/compute-budget.ts +0 -281
  70. package/src/programs/ed25519.ts +0 -157
  71. package/src/programs/index.ts +0 -7
  72. package/src/programs/secp256k1.ts +0 -228
  73. package/src/programs/stake.ts +0 -935
  74. package/src/programs/system.ts +0 -1048
  75. package/src/programs/vote.ts +0 -541
  76. package/src/publickey.ts +0 -259
  77. package/src/rpc-websocket-factory.ts +0 -4
  78. package/src/rpc-websocket.ts +0 -79
  79. package/src/sysvar.ts +0 -37
  80. package/src/timing.ts +0 -23
  81. package/src/transaction/constants.ts +0 -12
  82. package/src/transaction/expiry-custom-errors.ts +0 -48
  83. package/src/transaction/index.ts +0 -5
  84. package/src/transaction/legacy.ts +0 -908
  85. package/src/transaction/message.ts +0 -140
  86. package/src/transaction/versioned.ts +0 -126
  87. package/src/utils/assert.ts +0 -8
  88. package/src/utils/bigint.ts +0 -43
  89. package/src/utils/borsh-schema.ts +0 -38
  90. package/src/utils/cluster.ts +0 -31
  91. package/src/utils/ed25519.ts +0 -46
  92. package/src/utils/index.ts +0 -5
  93. package/src/utils/makeWebsocketUrl.ts +0 -26
  94. package/src/utils/promise-timeout.ts +0 -14
  95. package/src/utils/secp256k1.ts +0 -18
  96. package/src/utils/send-and-confirm-raw-transaction.ts +0 -102
  97. package/src/utils/send-and-confirm-transaction.ts +0 -98
  98. package/src/utils/shortvec-encoding.ts +0 -28
  99. package/src/utils/sleep.ts +0 -4
  100. package/src/utils/to-buffer.ts +0 -11
  101. package/src/validator-info.ts +0 -104
  102. 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
- }