dash-platform-sdk 1.3.2-dev.5 → 1.3.3

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.
Files changed (2) hide show
  1. package/README.md +120 -0
  2. package/package.json +1 -2
package/README.md ADDED
@@ -0,0 +1,120 @@
1
+ # dash-platform-sdk v1.3.3
2
+ [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/pshenmic/dash-platform-sdk/blob/master/LICENSE) ![npm version](https://img.shields.io/npm/v/react.svg?style=flat) ![a](https://github.com/pshenmic/platform-explorer/actions/workflows/build.yml/badge.svg)
3
+
4
+
5
+ Javascript SDK for Dash Platform network that let you interact with the chain.
6
+
7
+ _Does not support Core chain by design_
8
+
9
+ It can be used to query network, create, sign and broadcast the transactions in any Javascript environment. It works both
10
+ in Node.js, Browsers, and with modern frontend frameworks
11
+
12
+ SDK uses a pre-defined set of seed nodes (public RPC) at the start, and then tries to switch to the latest list of nodes from the network
13
+
14
+ Currently, only minimal features are included, such as document querying and creation of the documents, and all necessary related functions to do that
15
+ There is no input validation and error handling implemented yet relying on a happy path, this is going to be fixed in next versions
16
+
17
+
18
+ ## Features
19
+
20
+ * Cryptographic proofs for DAPI (GRPC) queries
21
+ * Create, Sign, and Broadcast Dash Platform (Dash Evolution) transactions
22
+ * Rich API compatible with ESNext
23
+ * Isomorphic library (works in Web and Node.js environments)
24
+ * Autogenerated documentation
25
+
26
+ ## Versioning
27
+
28
+ #### v1.4.x (next)
29
+ React Native support
30
+ #### v1.3.x
31
+ Dash Platform v3.0 support, improved codebase, better compatibility across different environments
32
+ #### v1.2.x
33
+ Token support, Identity State Transitions (create, topup, update), Identity Public Keys management,
34
+ #### v1.1.x
35
+ Dash Platform v2.0 support, improved codebase (more methods and typings)
36
+ #### v1.0.x
37
+ First, PoC version, only documents creation / signing support
38
+
39
+ ## Browser Support
40
+
41
+ The SDK is isomorphic and works in both Node.js and web browsers without requiring polyfills. When using in browsers, make sure to include the library from CDN or bundle it with your application.
42
+
43
+ ## Documentation
44
+
45
+ https://pshenmic.github.io/dash-platform-sdk/index.html
46
+
47
+ ## Quickstart
48
+
49
+ ## Install
50
+
51
+ ```bash
52
+ $ npm install dash-platform-sdk
53
+ ```
54
+
55
+ Alternatively, you could simply include the library from the CDN:
56
+
57
+ https://unpkg.com/dash-platform-sdk/dist/main.js
58
+
59
+ ## Import
60
+
61
+ To use the SDK, simply import the library and instantiate an instance of DashPlatformSDK:
62
+ ```javascript
63
+ // ES6 / EcmaScript
64
+ import {DashPlatformSDK} from 'dash-platform-sdk'
65
+
66
+ // CommonJS
67
+ const {DashPlatformSDK} = require('dash-platform-sdk')
68
+
69
+ const sdk = new DashPlatformSDK({network: 'testnet'})
70
+ ```
71
+
72
+ Or load it straight from the web page:
73
+
74
+ ```html
75
+ <script src="https://unpkg.com/dash-platform-sdk/bundle.min.js"></script>
76
+ <script>
77
+ const {DashPlatformSDK} = window.DashPlatformSDK
78
+ const sdk = new DashPlatformSDK.DashPlatformSDK({network: 'testnet'})
79
+ </script>
80
+ ```
81
+
82
+ Now you're ready to make queries in the network and push your data!
83
+
84
+ See [docs/Quickstart.md](https://github.com/pshenmic/dash-platform-sdk/blob/v1.3.3/docs/Quickstart.md) for basic usage examples (register data contract, push/update/delete documents).
85
+
86
+ ## API Documentation
87
+
88
+ The full autogenerated typedoc reference is available at https://pshenmic.github.io/dash-platform-sdk/index.html
89
+
90
+ ## Error Handling
91
+
92
+ The SDK currently relies on a happy path and doesn't include comprehensive error handling. This will be improved in future versions. For now, wrap SDK calls in try-catch blocks:
93
+
94
+ ```javascript
95
+ try {
96
+ const identity = await sdk.identities.getIdentityByIdentifier('invalid-id')
97
+ } catch (error) {
98
+ console.error('Failed to fetch identity:', error)
99
+ }
100
+ ```
101
+
102
+ ## Examples
103
+ The folder `docs/examples` in this repo contains useful example code snippets.
104
+
105
+ | | |
106
+ |---|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
107
+ | [Quickstart.md](https://github.com/pshenmic/dash-platform-sdk/blob/v1.3.3/docs/Quickstart.md) | Install, Import, Register Data Contract, Push / Update / Delete Document |
108
+ | [DataContracts.md](https://github.com/pshenmic/dash-platform-sdk/blob/v1.3.3/docs/examples/DataContracts.md) | Get Data Contract By Identifier, Create Data Contract, Create State Transition |
109
+ | [Documents.md](https://github.com/pshenmic/dash-platform-sdk/blob/v1.3.3/docs/examples/Documents.md) | Create Document, Query Documents, Create State Transition (Create / Replace/ Delete / Transfer / Purchase / UpdatePrice) |
110
+ | [Tokens.md](https://github.com/pshenmic/dash-platform-sdk/blob/v1.3.3/docs/examples/Tokens.md) | Get Balance, Get Contract Info, Get Supply, Get prices, Create State Transition |
111
+ | [Identities.md](https://github.com/pshenmic/dash-platform-sdk/blob/v1.3.3/docs/examples/Identities.md) | Get Identity, Get Identity Balance, Get Identity Nonce, Get Identity Public Keys, Create Identity (from AssetLockProof), Top Up Identity (from AssetLockProof), Update Identity, Credit Transfer, Credit Withdrawal |
112
+ | [Voting.md](https://github.com/pshenmic/dash-platform-sdk/blob/v1.3.3/docs/examples/Voting.md) | Casting Masternode Vote against Contested Resource |
113
+ | [StateTransitions.md](https://github.com/pshenmic/dash-platform-sdk/blob/v1.3.3/docs/examples/StateTransitions.md) | Broadcast Transaction, Wait for State Transition Result (wait for finalization) |
114
+ | [Names.md](https://github.com/pshenmic/dash-platform-sdk/blob/v1.3.3/docs/examples/Names.md) | Search By Dash Username (DPNS Name), Search by Identity's Identifier, Register Dash Username (DPNS Name), Test Name Contested (validation), Validate Name (validation) |
115
+ | [Node.md](https://github.com/pshenmic/dash-platform-sdk/blob/v1.3.3/docs/examples/Node.md) | Node Status, Total Credits (locked in Platform), Epochs Info |
116
+ | [Utils.md](https://github.com/pshenmic/dash-platform-sdk/blob/v1.3.3/docs/examples/Utils.md) | useful utility functions, like hex/base58 encoding, createVoterIdentifier, createMasternodeIdentifier, validateIdentifier |
117
+ | [KeyPair.md](https://github.com/pshenmic/dash-platform-sdk/blob/v1.3.3/docs/examples/KeyPair.md) | Mnemonic to Seed, Seed to HD Key, Derive Identity Private Key, Derive Child, Derive Path, P2PKH Address conversion |
118
+ | [ContestedResources.md](https://github.com/pshenmic/dash-platform-sdk/blob/v1.3.3/docs/examples/ContestedResources.md) | Contested Resource Vote State Info |
119
+
120
+
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dash-platform-sdk",
3
- "version": "1.3.2-dev.5",
3
+ "version": "1.3.3",
4
4
  "main": "index.js",
5
5
  "description": "Lightweight SDK for accessing Dash Platform blockchain",
6
6
  "ts-standard": {
@@ -54,7 +54,6 @@
54
54
  "@bufbuild/protobuf": "^2.6.0",
55
55
  "@protobuf-ts/grpcweb-transport": "^2.11.1",
56
56
  "@scure/base": "^1.2.4",
57
-
58
57
  "@scure/bip32": "^2.0.0",
59
58
  "@scure/bip39": "^2.0.0",
60
59
  "@scure/btc-signer": "^2.0.1",