@solana/keys 2.0.0-experimental.d6c5c0e → 2.0.0-experimental.dfc6d58
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 +25 -11
- package/dist/index.browser.cjs +2 -0
- package/dist/index.node.js +2 -0
- package/dist/types/base58.d.ts.map +1 -0
- package/dist/types/index.d.ts.map +1 -0
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -1,3 +1,17 @@
|
|
|
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/keys/experimental.svg?style=flat
|
|
10
|
+
[npm-image]: https://img.shields.io/npm/v/@solana/keys/experimental.svg?style=flat
|
|
11
|
+
[npm-url]: https://www.npmjs.com/package/@solana/keys/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
|
+
|
|
1
15
|
# @solana/keys
|
|
2
16
|
|
|
3
17
|
This package contains utilities for validating, generating, and manipulating addresses and key material. It can be used standalone, but it is also exported as part of the Solana JavaScript SDK [`@solana/web3.js@experimental`](https://github.com/solana-labs/solana-web3.js/tree/master/packages/library).
|
|
@@ -23,16 +37,16 @@ import { assertIsBase58EncodedAddress } from '@solana/web3.js`;
|
|
|
23
37
|
|
|
24
38
|
// Imagine a function that fetches an account's balance when a user submits a form.
|
|
25
39
|
function handleSubmit() {
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
40
|
+
// We know only that what the user typed conforms to the `string` type.
|
|
41
|
+
const address: string = accountAddressInput.value;
|
|
42
|
+
try {
|
|
43
|
+
// If this type assertion function doesn't throw, then
|
|
44
|
+
// Typescript will upcast `address` to `Base58EncodedAddress`.
|
|
45
|
+
assertIsBase58EncodedAddress(address);
|
|
46
|
+
// At this point, `address` is a `Base58EncodedAddress` that can be used with the RPC.
|
|
47
|
+
const balanceInLamports = await rpc.getBalance(address).send();
|
|
48
|
+
} catch (e) {
|
|
49
|
+
// `address` turned out not to be a base58-encoded address
|
|
50
|
+
}
|
|
37
51
|
}
|
|
38
52
|
```
|
package/dist/index.browser.cjs
CHANGED
package/dist/index.node.js
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"base58.d.ts","sourceRoot":"","sources":["../../src/base58.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,oBAAoB,GAAG,MAAM,GAAG;IAAE,QAAQ,CAAC,sBAAsB,EAAE,OAAO,MAAM,CAAA;CAAE,CAAC;AAE/F,wBAAgB,4BAA4B,CACxC,4BAA4B,EAAE,MAAM,GACrC,OAAO,CAAC,4BAA4B,IAAI,oBAAoB,CAsB9D"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solana/keys",
|
|
3
|
-
"version": "2.0.0-experimental.
|
|
3
|
+
"version": "2.0.0-experimental.dfc6d58",
|
|
4
4
|
"description": "Helpers for generating and transforming key material",
|
|
5
5
|
"exports": {
|
|
6
6
|
"browser": {
|
|
@@ -68,8 +68,8 @@
|
|
|
68
68
|
"typescript": "^5.0.3",
|
|
69
69
|
"version-from-git": "^1.1.1",
|
|
70
70
|
"build-scripts": "0.0.0",
|
|
71
|
-
"
|
|
72
|
-
"
|
|
71
|
+
"tsconfig": "0.0.0",
|
|
72
|
+
"test-config": "0.0.0"
|
|
73
73
|
},
|
|
74
74
|
"bundlewatch": {
|
|
75
75
|
"defaultCompression": "gzip",
|