dash-platform-sdk 1.0.0
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/.github/workflows/build.yml +35 -0
- package/.github/workflows/publish.yml +18 -0
- package/LICENSE +21 -0
- package/README.md +43 -0
- package/babel.config.js +3 -0
- package/dist/main.js +2 -0
- package/dist/main.js.LICENSE.txt +12 -0
- package/index.js +76 -0
- package/package.json +37 -0
- package/proto/platform.proto +1768 -0
- package/src/dapi/getDocuments.js +33 -0
- package/src/dapi/getStatus.js +19 -0
- package/test/unit/index.spec.js +64 -0
- package/webpack.config.js +18 -0
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
name: Build
|
|
2
|
+
|
|
3
|
+
on:
|
|
4
|
+
push:
|
|
5
|
+
branches: [ "master" ]
|
|
6
|
+
pull_request:
|
|
7
|
+
branches: [ "master" ]
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
build:
|
|
11
|
+
runs-on: ubuntu-latest
|
|
12
|
+
|
|
13
|
+
strategy:
|
|
14
|
+
matrix:
|
|
15
|
+
node-version: [18.x, 20.x, 22.x]
|
|
16
|
+
|
|
17
|
+
steps:
|
|
18
|
+
- uses: actions/checkout@v4
|
|
19
|
+
|
|
20
|
+
- name: Use Node.js ${{ matrix.node-version }}
|
|
21
|
+
uses: actions/setup-node@v4
|
|
22
|
+
with:
|
|
23
|
+
node-version: ${{ matrix.node-version }}
|
|
24
|
+
|
|
25
|
+
- name: Install dependencies
|
|
26
|
+
run: |
|
|
27
|
+
yarn
|
|
28
|
+
|
|
29
|
+
- name: Generate GRPC client
|
|
30
|
+
run: |
|
|
31
|
+
yarn build:grpc
|
|
32
|
+
|
|
33
|
+
- name: Build with Webpack
|
|
34
|
+
run: |
|
|
35
|
+
yarn build
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
name: Publish Package to NPM
|
|
2
|
+
on:
|
|
3
|
+
release:
|
|
4
|
+
types: [published]
|
|
5
|
+
jobs:
|
|
6
|
+
publish:
|
|
7
|
+
runs-on: ubuntu-latest
|
|
8
|
+
steps:
|
|
9
|
+
- uses: actions/checkout@v4
|
|
10
|
+
# Setup .npmrc file to publish to npm
|
|
11
|
+
- uses: actions/setup-node@v4
|
|
12
|
+
with:
|
|
13
|
+
node-version: '20.x'
|
|
14
|
+
registry-url: 'https://registry.npmjs.org'
|
|
15
|
+
- run: yarn
|
|
16
|
+
- run: yarn npm publish // for Yarn version 1, use `yarn publish` instead
|
|
17
|
+
env:
|
|
18
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 pshenmic
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# dash-platform-sdk
|
|
2
|
+
|
|
3
|
+
This is an experimental alternative SDK for Dash Platform chain to access basic actions.
|
|
4
|
+
|
|
5
|
+
#### Development is ongoing, breaking changes may be each release
|
|
6
|
+
|
|
7
|
+
Features implemented:
|
|
8
|
+
|
|
9
|
+
* getStatus (retrieve node status)
|
|
10
|
+
* getDocuments (without deserialization atm)
|
|
11
|
+
|
|
12
|
+
# How to use
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
1) Install NPM package (by GitHub ATM)
|
|
16
|
+
```bash
|
|
17
|
+
$ npm install pshenmic/dash-platform-sdk
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
2) Import:
|
|
22
|
+
```javascript
|
|
23
|
+
// ES6 / EcmaScript
|
|
24
|
+
import DashPlatformSDK from 'dash-platform-sdk'
|
|
25
|
+
|
|
26
|
+
// CommonJS
|
|
27
|
+
const { default: DashPlatformSDK } = require('dash-platform-sdk')
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
3) Run:
|
|
31
|
+
```javascript
|
|
32
|
+
const sdk = new DashPlatformSDK() // new DashPlatformSDK({ network: 'testnet', dapiUrls: ['https://52.33.28.47:1443']})
|
|
33
|
+
|
|
34
|
+
// Retrieve node status
|
|
35
|
+
const status = await sdk.utils.getStatus()
|
|
36
|
+
|
|
37
|
+
console.log(status)
|
|
38
|
+
|
|
39
|
+
// Get Documents
|
|
40
|
+
const documents = await sdk.documents.get('GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec', 'domain')
|
|
41
|
+
|
|
42
|
+
console.log(documents)
|
|
43
|
+
```
|
package/babel.config.js
ADDED