@solana/web3.js 2.0.0-development → 2.0.0-experimental.0099b2a
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/LICENSE +1 -1
- package/README.md +4 -4
- package/dist/index.browser.cjs +779 -10
- package/dist/index.browser.cjs.map +1 -1
- package/dist/index.browser.js +750 -11
- package/dist/index.browser.js.map +1 -1
- package/dist/index.development.js +3531 -395
- package/dist/index.development.js.map +1 -1
- package/dist/index.native.js +737 -11
- package/dist/index.native.js.map +1 -1
- package/dist/index.node.cjs +768 -10
- package/dist/index.node.cjs.map +1 -1
- package/dist/index.node.js +737 -11
- package/dist/index.node.js.map +1 -1
- package/dist/index.production.min.js +78 -16
- package/dist/types/airdrop-confirmer.d.ts +20 -0
- package/dist/types/airdrop.d.ts +23 -0
- package/dist/types/cached-abortable-iterable.d.ts +11 -0
- package/dist/types/index.d.ts +10 -0
- package/dist/types/rpc-subscription-coalescer.d.ts +10 -0
- package/dist/types/rpc-websocket-autopinger.d.ts +8 -0
- package/dist/types/rpc-websocket-connection-sharding.d.ts +13 -0
- package/dist/types/rpc-websocket-transport.d.ts +13 -0
- package/dist/types/rpc.d.ts +5 -3
- package/dist/types/send-transaction.d.ts +37 -0
- package/dist/types/transaction-confirmation-strategy-blockheight.d.ts +10 -0
- package/dist/types/transaction-confirmation-strategy-nonce.d.ts +15 -0
- package/dist/types/transaction-confirmation-strategy-racer.d.ts +14 -0
- package/dist/types/transaction-confirmation-strategy-recent-signature.d.ts +13 -0
- package/dist/types/transaction-confirmation-strategy-timeout.d.ts +8 -0
- package/dist/types/transaction-confirmation.d.ts +37 -0
- package/package.json +24 -22
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -77,19 +77,19 @@ Unimplemented.
|
|
|
77
77
|
|
|
78
78
|
Client applications primarily deal with addresses and public keys in the form of base58-encoded strings. Addresses and public keys returned from the RPC API conform to the type `Base58EncodedAddress`. You can use a value of that type wherever a base58-encoded address or key is expected.
|
|
79
79
|
|
|
80
|
-
From time to time you might acquire a string, that you expect to validate as an address, from an untrusted network API or user input. To assert that such an arbitrary string is a base58-encoded address, use the `
|
|
80
|
+
From time to time you might acquire a string, that you expect to validate as an address, from an untrusted network API or user input. To assert that such an arbitrary string is a base58-encoded address, use the `assertIsAddress` function.
|
|
81
81
|
|
|
82
82
|
```ts
|
|
83
|
-
import {
|
|
83
|
+
import { assertIsAddress } from '@solana/web3.js';
|
|
84
84
|
|
|
85
85
|
// Imagine a function that fetches an account's balance when a user submits a form.
|
|
86
|
-
function handleSubmit() {
|
|
86
|
+
async function handleSubmit() {
|
|
87
87
|
// We know only that what the user typed conforms to the `string` type.
|
|
88
88
|
const address: string = accountAddressInput.value;
|
|
89
89
|
try {
|
|
90
90
|
// If this type assertion function doesn't throw, then
|
|
91
91
|
// Typescript will upcast `address` to `Base58EncodedAddress`.
|
|
92
|
-
|
|
92
|
+
assertIsAddress(address);
|
|
93
93
|
// At this point, `address` is a `Base58EncodedAddress` that can be used with the RPC.
|
|
94
94
|
const balanceInLamports = await rpc.getBalance(address).send();
|
|
95
95
|
} catch (e) {
|