@solana/web3.js 2.0.0-experimental.cc1b7bb → 2.0.0-experimental.d6c5c0e

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 ADDED
@@ -0,0 +1,98 @@
1
+ [![npm][npm-image]][npm-url]
2
+ [![npm-downloads][npm-downloads-image]][npm-url]
3
+ [![semantic-release][semantic-release-image]][semantic-release-url]
4
+ <br />
5
+ [![code-style-prettier][code-style-prettier-image]][code-style-prettier-url]
6
+
7
+ [code-style-prettier-image]: https://img.shields.io/badge/code_style-prettier-ff69b4.svg?style=flat-square
8
+ [code-style-prettier-url]: https://github.com/prettier/prettier
9
+ [npm-downloads-image]: https://img.shields.io/npm/dm/@solana/web3.js/experimental.svg?style=flat
10
+ [npm-image]: https://img.shields.io/npm/v/@solana/web3.js/experimental.svg?style=flat
11
+ [npm-url]: https://www.npmjs.com/package/@solana/web3.js/v/experimental
12
+ [semantic-release-image]: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg
13
+ [semantic-release-url]: https://github.com/semantic-release/semantic-release
14
+
15
+ # Experimental Solana JavaScript SDK
16
+
17
+ Use this to interact with accounts and programs on the Solana network through the Solana [JSON-RPC API](https://docs.solana.com/apps/jsonrpc-api).
18
+
19
+ **This library is experimental**. It is unsuitable for production use, because the API is unstable and may change without warning. If you want to build a production Solana application, use the [1.x branch](https://www.npmjs.com/package/@solana/web3.js).
20
+
21
+ ## Installation
22
+
23
+ ### For use in Node.js, React Native, or a web application
24
+
25
+ ```shell
26
+ npm install --save @solana/web3.js@experimental
27
+ ```
28
+
29
+ ### For use in a browser, without a build system
30
+
31
+ ```html
32
+ <!-- Development (debug mode, unminified) -->
33
+ <script src="https://unpkg.com/@solana/web3.js@experimental/dist/index.development.js"></script>
34
+
35
+ <!-- Production (minified) -->
36
+ <script src="https://unpkg.com/@solana/web3.js@experimental/dist/index.production.min.js"></script>
37
+ ```
38
+
39
+ ## Usage
40
+
41
+ There are 3 main applications of this library.
42
+
43
+ 1. **RPC**. Solana apps interact with the network by calling methods on the Solana JSON-RPC.
44
+ 2. **Transactions**. Solana apps interact with Solana program by building and sending transactions.
45
+ 3. **Keys**. People use cryptographic keys to verify the provenance of messages and to attest to the ownership of their accounts.
46
+
47
+ ### RPC
48
+
49
+ First, configure your connection to an RPC server. This might be a server that you host, one that you lease, or one of the limited-use [public RPC servers](https://docs.solana.com/cluster/rpc-endpoints).
50
+
51
+ ```ts
52
+ import { createDefaultRpcTransport } from '@solana/web3.js';
53
+ const devnetTransport = createDefaultRpcTransport({ url: 'https://api.devnet.solana.com' });
54
+ ```
55
+
56
+ Second, construct an RPC instance that uses that transport.
57
+
58
+ ```ts
59
+ const devnetRpc = createSolanaRpc({ transport: devnetTransport });
60
+ ```
61
+
62
+ Now, you can use it to call methods on your RPC server. For instance, here is how you would fetch an account's balance.
63
+
64
+ ```ts
65
+ const balanceInLamports = await devnetRpc.getBalance('11111111111111111111111111111111' as Base58EncodedAddress);
66
+ console.log('Balance of account 11111111111111111111111111111111 in Lamports', balanceInLamports);
67
+ ```
68
+
69
+ ### Transactions
70
+
71
+ Unimplemented.
72
+
73
+ ### Keys
74
+
75
+ #### Addresses and public keys
76
+
77
+ 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.
78
+
79
+ 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 `assertIsBase58EncodedAddress` function.
80
+
81
+ ```ts
82
+ import { assertIsBase58EncodedAddress } from '@solana/web3.js`;
83
+
84
+ // Imagine a function that fetches an account's balance when a user submits a form.
85
+ function handleSubmit() {
86
+ // We know only that what the user typed conforms to the `string` type.
87
+ const address: string = accountAddressInput.value;
88
+ try {
89
+ // If this type assertion function doesn't throw, then
90
+ // Typescript will upcast `address` to `Base58EncodedAddress`.
91
+ assertIsBase58EncodedAddress(address);
92
+ // At this point, `address` is a `Base58EncodedAddress` that can be used with the RPC.
93
+ const balanceInLamports = await rpc.getBalance(address);
94
+ } catch (e) {
95
+ // `address` turned out not to be a base58-encoded address
96
+ }
97
+ }
98
+ ```
@@ -75,3 +75,5 @@ Object.keys(keys).forEach(function (k) {
75
75
  get: function () { return keys[k]; }
76
76
  });
77
77
  });
78
+ //# sourceMappingURL=out.js.map
79
+ //# sourceMappingURL=index.browser.cjs.map
@@ -75,5 +75,3 @@ Object.keys(keys).forEach(function (k) {
75
75
  get: function () { return keys[k]; }
76
76
  });
77
77
  });
78
- //# sourceMappingURL=out.js.map
79
- //# sourceMappingURL=index.node.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,OAAO,CAAC;AACtB,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rpc-default-config.d.ts","sourceRoot":"","sources":["../../src/rpc-default-config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,kBAAkB,CAAC;AAGtD,eAAO,MAAM,kBAAkB,EAAE,OAAO,CAAC,UAAU,CAAC,OAAO,kBAAkB,CAAC,CAAC,CAAC,CAAC,CAIhF,CAAC"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rpc-integer-overflow-error.d.ts","sourceRoot":"","sources":["../../src/rpc-integer-overflow-error.ts"],"names":[],"mappings":"AAAA,qBAAa,iCAAkC,SAAQ,KAAK;IACxD,QAAQ,CAAC,UAAU,EAAE,MAAM,CAAC;IAC5B,QAAQ,CAAC,OAAO,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,CAAC;IACtC,QAAQ,CAAC,KAAK,EAAE,MAAM,CAAC;gBACX,UAAU,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,MAAM,GAAG,MAAM,CAAC,EAAE,EAAE,KAAK,EAAE,MAAM;IA+B3E,IAAI,IAAI,WAEP;CACJ"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rpc-transport.d.ts","sourceRoot":"","sources":["../../src/rpc-transport.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,6DAA6D,CAAC;AAe5F,wBAAgB,yBAAyB,CAAC,MAAM,EAAE,UAAU,CAAC,OAAO,mBAAmB,CAAC,CAAC,CAAC,CAAC,GAAG,aAAa,CAW1G"}
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rpc.d.ts","sourceRoot":"","sources":["../../src/rpc.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,gBAAgB,EAAsB,MAAM,kBAAkB,CAAC;AAGxE,OAAO,EAAE,aAAa,EAAE,MAAM,uBAAuB,CAAC;AACtD,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iDAAiD,CAAC;AAE3E,wBAAgB,eAAe,CAAC,MAAM,EAAE,IAAI,CAAC,UAAU,CAAC,OAAO,aAAa,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,GAAG,GAAG,CAAC,gBAAgB,CAAC,CAK/G"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@solana/web3.js",
3
- "version": "2.0.0-experimental.cc1b7bb",
3
+ "version": "2.0.0-experimental.d6c5c0e",
4
4
  "description": "Solana Javascript API",
5
5
  "exports": {
6
6
  "browser": {
@@ -49,9 +49,9 @@
49
49
  "maintained node versions"
50
50
  ],
51
51
  "dependencies": {
52
- "@solana/keys": "2.0.0-experimental.cc1b7bb",
53
- "@solana/rpc-core": "2.0.0-experimental.cc1b7bb",
54
- "@solana/rpc-transport": "2.0.0-experimental.cc1b7bb"
52
+ "@solana/keys": "2.0.0-experimental.d6c5c0e",
53
+ "@solana/rpc-core": "2.0.0-development",
54
+ "@solana/rpc-transport": "2.0.0-experimental.d6c5c0e"
55
55
  },
56
56
  "devDependencies": {
57
57
  "@solana/eslint-config-solana": "^1.0.0",