@solana/web3.js 2.0.0-experimental.c144a41 → 2.0.0-experimental.c168e0c
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 +6 -4
- package/dist/index.browser.cjs +176 -788
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +125 -767
- package/dist/index.browser.js.map +1 -1
- package/dist/index.development.js +4357 -2575
- package/dist/index.development.js.map +1 -1
- package/dist/index.native.js +125 -756
- package/dist/index.native.js.map +1 -1
- package/dist/index.node.cjs +176 -777
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.js +125 -756
- package/dist/index.node.js.map +1 -1
- package/dist/index.production.min.js +278 -82
- package/dist/types/airdrop-internal.d.ts +16 -0
- package/dist/types/airdrop-internal.d.ts.map +1 -0
- package/dist/types/airdrop.d.ts +7 -16
- package/dist/types/airdrop.d.ts.map +1 -1
- package/dist/types/decode-transaction.d.ts +9 -0
- package/dist/types/decode-transaction.d.ts.map +1 -0
- package/dist/types/index.d.ts +9 -7
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/send-transaction-internal.d.ts +27 -0
- package/dist/types/send-transaction-internal.d.ts.map +1 -0
- package/dist/types/send-transaction.d.ts +16 -31
- package/dist/types/send-transaction.d.ts.map +1 -1
- package/package.json +24 -40
- package/dist/types/airdrop-confirmer.d.ts +0 -19
- package/dist/types/airdrop-confirmer.d.ts.map +0 -1
- package/dist/types/cached-abortable-iterable.d.ts +0 -11
- package/dist/types/cached-abortable-iterable.d.ts.map +0 -1
- package/dist/types/rpc-default-config.d.ts +0 -3
- package/dist/types/rpc-default-config.d.ts.map +0 -1
- package/dist/types/rpc-integer-overflow-error.d.ts +0 -8
- package/dist/types/rpc-integer-overflow-error.d.ts.map +0 -1
- package/dist/types/rpc-request-coalescer.d.ts +0 -5
- package/dist/types/rpc-request-coalescer.d.ts.map +0 -1
- package/dist/types/rpc-request-deduplication.d.ts +0 -2
- package/dist/types/rpc-request-deduplication.d.ts.map +0 -1
- package/dist/types/rpc-subscription-coalescer.d.ts +0 -10
- package/dist/types/rpc-subscription-coalescer.d.ts.map +0 -1
- package/dist/types/rpc-transport.d.ts +0 -3
- package/dist/types/rpc-transport.d.ts.map +0 -1
- package/dist/types/rpc-websocket-autopinger.d.ts +0 -8
- package/dist/types/rpc-websocket-autopinger.d.ts.map +0 -1
- package/dist/types/rpc-websocket-connection-sharding.d.ts +0 -13
- package/dist/types/rpc-websocket-connection-sharding.d.ts.map +0 -1
- package/dist/types/rpc-websocket-transport.d.ts +0 -12
- package/dist/types/rpc-websocket-transport.d.ts.map +0 -1
- package/dist/types/rpc.d.ts +0 -6
- package/dist/types/rpc.d.ts.map +0 -1
- package/dist/types/transaction-confirmation-strategy-blockheight.d.ts +0 -9
- package/dist/types/transaction-confirmation-strategy-blockheight.d.ts.map +0 -1
- package/dist/types/transaction-confirmation-strategy-nonce.d.ts +0 -14
- package/dist/types/transaction-confirmation-strategy-nonce.d.ts.map +0 -1
- package/dist/types/transaction-confirmation-strategy-racer.d.ts +0 -14
- package/dist/types/transaction-confirmation-strategy-racer.d.ts.map +0 -1
- package/dist/types/transaction-confirmation-strategy-recent-signature.d.ts +0 -12
- package/dist/types/transaction-confirmation-strategy-recent-signature.d.ts.map +0 -1
- package/dist/types/transaction-confirmation-strategy-timeout.d.ts +0 -8
- package/dist/types/transaction-confirmation-strategy-timeout.d.ts.map +0 -1
- package/dist/types/transaction-confirmation.d.ts +0 -32
- package/dist/types/transaction-confirmation.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -102,7 +102,7 @@ Enter web3.js 2.0. The new API aims to deliver a re-imagined experience of build
|
|
|
102
102
|
|
|
103
103
|
## Features
|
|
104
104
|
|
|
105
|
-
The new (2.0) version of `@solana/web3.js` aims to address shortcomings in the legacy library first, then goes even further
|
|
105
|
+
The new (2.0) version of `@solana/web3.js` aims to address shortcomings in the legacy library first, then goes even further.
|
|
106
106
|
|
|
107
107
|
### Tree-Shaking
|
|
108
108
|
|
|
@@ -547,7 +547,7 @@ for await (const notification of accountNotifications) {
|
|
|
547
547
|
|
|
548
548
|
One of the most crucial aspects of any subscription API is managing potential missed messages. Missing messages, such as account state updates, could be catastrophic for an application. That’s why the new library provides native support for recovering missed messages using the `AsyncIterator`.
|
|
549
549
|
|
|
550
|
-
When a connection fails unexpectedly, any messages you miss while disconnected can result in your UI falling behind or becoming corrupt. Because subscription failure is now made explicit in the new API, you can implement ‘catch up’ logic after re-
|
|
550
|
+
When a connection fails unexpectedly, any messages you miss while disconnected can result in your UI falling behind or becoming corrupt. Because subscription failure is now made explicit in the new API, you can implement ‘catch up’ logic after re-establishing the subscription.
|
|
551
551
|
|
|
552
552
|
Here’s an example of such logic:
|
|
553
553
|
|
|
@@ -750,7 +750,7 @@ const transactionSignedWithFeePayer = await signTransaction([signer], transactio
|
|
|
750
750
|
|
|
751
751
|
Transaction objects are also ********frozen by these functions******** to prevent transactions from being mutated in place by functions you pass them to.
|
|
752
752
|
|
|
753
|
-
Building transactions in this manner might feel different
|
|
753
|
+
Building transactions in this manner might feel different from what you’re used to. Also, we certainly wouldn’t want you to have to bind transformed transactions to a new variable at each step, so we have released a functional programming library dubbed `@solana/functional` that lets you build transactions in **********************************pipelines**********************************. Here’s how it can be used:
|
|
754
754
|
|
|
755
755
|
```tsx
|
|
756
756
|
import { pipe } from '@solana/functional';
|
|
@@ -784,6 +784,8 @@ Solana’s codecs libraries are broken up into modular components so you only ne
|
|
|
784
784
|
- `@solana/codecs-data-structures`: Codecs and serializers for structs
|
|
785
785
|
- `@solana/options`: Designed to build codecs and serializers for types that mimic Rust’s enums, which can include embedded data within their variants such as values, tuples, and structs
|
|
786
786
|
|
|
787
|
+
These packages are included in the main `@solana/web3.js` library but you may also import them from `@solana/codecs` if you only need the codecs.
|
|
788
|
+
|
|
787
789
|
Here’s an example of encoding and decoding a custom struct with some strings and numbers:
|
|
788
790
|
|
|
789
791
|
```tsx
|
|
@@ -909,7 +911,7 @@ const blockWithRewardsAndTransactionsResponse = await rpc.getBlock(0n, {
|
|
|
909
911
|
|
|
910
912
|
### Catching Compile-Time Bugs with TypeScript
|
|
911
913
|
|
|
912
|
-
As previously mentioned, the type coverage in web3.js 2.0
|
|
914
|
+
As previously mentioned, the type coverage in web3.js 2.0 allows developers to catch common bugs at compile time, rather than runtime.
|
|
913
915
|
|
|
914
916
|
In the example below, a transaction is created and then attempted to be compiled without setting the fee payer. This would result in a runtime error from the RPC, but instead you will see a type error from TypeScript as you type:
|
|
915
917
|
|