@solana/web3.js 1.77.3 → 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.
- package/README.md +56 -112
- package/dist/index.browser.cjs +158 -0
- package/dist/index.browser.cjs.map +1 -0
- package/dist/index.browser.js +137 -0
- package/dist/index.browser.js.map +1 -0
- package/dist/index.development.js +1044 -0
- package/dist/index.development.js.map +1 -0
- package/dist/index.native.js +139 -0
- package/dist/index.native.js.map +1 -0
- package/dist/index.node.cjs +158 -0
- package/dist/index.node.cjs.map +1 -0
- package/dist/index.node.js +139 -0
- package/dist/index.node.js.map +1 -0
- package/dist/index.production.min.js +25 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/rpc-default-config.d.ts +3 -0
- package/dist/types/rpc-integer-overflow-error.d.ts +8 -0
- package/dist/types/rpc-request-coalescer.d.ts +5 -0
- package/dist/types/rpc-request-deduplication.d.ts +2 -0
- package/dist/types/rpc-transport.d.ts +4 -0
- package/dist/types/rpc.d.ts +5 -0
- package/package.json +86 -110
- package/lib/index.browser.cjs.js +0 -9534
- package/lib/index.browser.cjs.js.map +0 -1
- package/lib/index.browser.esm.js +0 -9432
- package/lib/index.browser.esm.js.map +0 -1
- package/lib/index.cjs.js +0 -12058
- package/lib/index.cjs.js.map +0 -1
- package/lib/index.d.ts +0 -3891
- package/lib/index.esm.js +0 -11949
- package/lib/index.esm.js.map +0 -1
- package/lib/index.iife.js +0 -25985
- package/lib/index.iife.js.map +0 -1
- package/lib/index.iife.min.js +0 -20
- package/lib/index.iife.min.js.map +0 -1
- package/lib/index.native.js +0 -9534
- package/lib/index.native.js.map +0 -1
- package/src/__forks__/browser/fetch-impl.ts +0 -4
- package/src/__forks__/browser/rpc-websocket-factory.ts +0 -1
- package/src/__forks__/react-native/fetch-impl.ts +0 -4
- package/src/__forks__/react-native/rpc-websocket-factory.ts +0 -1
- package/src/account-data.ts +0 -39
- package/src/account.ts +0 -55
- package/src/blockhash.ts +0 -4
- package/src/bpf-loader-deprecated.ts +0 -5
- package/src/bpf-loader.ts +0 -45
- package/src/connection.ts +0 -6756
- package/src/epoch-schedule.ts +0 -102
- package/src/errors.ts +0 -50
- package/src/fee-calculator.ts +0 -18
- package/src/fetch-impl.ts +0 -13
- package/src/index.ts +0 -24
- package/src/instruction.ts +0 -58
- package/src/keypair.ts +0 -93
- package/src/layout.ts +0 -188
- package/src/loader.ts +0 -267
- package/src/message/account-keys.ts +0 -79
- package/src/message/compiled-keys.ts +0 -165
- package/src/message/index.ts +0 -47
- package/src/message/legacy.ts +0 -326
- package/src/message/v0.ts +0 -496
- package/src/message/versioned.ts +0 -36
- package/src/nonce-account.ts +0 -82
- package/src/programs/address-lookup-table/index.ts +0 -435
- package/src/programs/address-lookup-table/state.ts +0 -84
- package/src/programs/compute-budget.ts +0 -281
- package/src/programs/ed25519.ts +0 -157
- package/src/programs/index.ts +0 -7
- package/src/programs/secp256k1.ts +0 -228
- package/src/programs/stake.ts +0 -935
- package/src/programs/system.ts +0 -1048
- package/src/programs/vote.ts +0 -543
- package/src/publickey.ts +0 -259
- package/src/rpc-websocket-factory.ts +0 -4
- package/src/rpc-websocket.ts +0 -79
- package/src/sysvar.ts +0 -37
- package/src/timing.ts +0 -23
- package/src/transaction/constants.ts +0 -12
- package/src/transaction/expiry-custom-errors.ts +0 -48
- package/src/transaction/index.ts +0 -5
- package/src/transaction/legacy.ts +0 -918
- package/src/transaction/message.ts +0 -140
- package/src/transaction/versioned.ts +0 -126
- package/src/utils/assert.ts +0 -8
- package/src/utils/bigint.ts +0 -43
- package/src/utils/borsh-schema.ts +0 -38
- package/src/utils/cluster.ts +0 -31
- package/src/utils/ed25519.ts +0 -43
- package/src/utils/index.ts +0 -5
- package/src/utils/makeWebsocketUrl.ts +0 -26
- package/src/utils/promise-timeout.ts +0 -14
- package/src/utils/secp256k1.ts +0 -11
- package/src/utils/send-and-confirm-raw-transaction.ts +0 -102
- package/src/utils/send-and-confirm-transaction.ts +0 -98
- package/src/utils/shortvec-encoding.ts +0 -28
- package/src/utils/sleep.ts +0 -4
- package/src/utils/to-buffer.ts +0 -11
- package/src/validator-info.ts +0 -104
- package/src/vote-account.ts +0 -236
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {default} from 'rpc-websockets/dist/lib/client/websocket.browser';
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {default} from 'rpc-websockets/dist/lib/client/websocket.browser';
|
package/src/account-data.ts
DELETED
|
@@ -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
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
|
-
}
|