dash 3.23.0-dev.1 → 3.23.0-dev.10
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 +57 -14
- package/build/src/SDK/Client/Client.spec.js +2 -4
- package/build/src/SDK/Client/Client.spec.js.map +1 -1
- package/build/src/SDK/Client/Platform/Platform.js +12 -0
- package/build/src/SDK/Client/Platform/Platform.js.map +1 -1
- package/build/src/SDK/Client/Platform/broadcastStateTransition.js +16 -9
- package/build/src/SDK/Client/Platform/broadcastStateTransition.js.map +1 -1
- package/build/src/SDK/Client/Platform/createAssetLockTransaction.js +8 -4
- package/build/src/SDK/Client/Platform/createAssetLockTransaction.js.map +1 -1
- package/build/src/SDK/Client/Platform/methods/contracts/publish.js +1 -1
- package/build/src/SDK/Client/Platform/methods/contracts/publish.js.map +1 -1
- package/build/src/SDK/Client/Platform/methods/contracts/update.js +1 -1
- package/build/src/SDK/Client/Platform/methods/contracts/update.js.map +1 -1
- package/build/src/SDK/Client/Platform/methods/documents/broadcast.js +1 -1
- package/build/src/SDK/Client/Platform/methods/documents/broadcast.js.map +1 -1
- package/build/src/SDK/Client/Platform/methods/identities/internal/createAssetLockProof.js +8 -4
- package/build/src/SDK/Client/Platform/methods/identities/internal/createAssetLockProof.js.map +1 -1
- package/build/src/SDK/Client/Platform/methods/identities/internal/createIdentityCreateTransition.js +42 -17
- package/build/src/SDK/Client/Platform/methods/identities/internal/createIdentityCreateTransition.js.map +1 -1
- package/build/src/SDK/Client/Platform/methods/identities/internal/createIdnetityTopUpTransition.js +8 -4
- package/build/src/SDK/Client/Platform/methods/identities/internal/createIdnetityTopUpTransition.js.map +1 -1
- package/build/src/SDK/Client/Platform/methods/identities/internal/waitForCoreChainLockedHeight.js +7 -3
- package/build/src/SDK/Client/Platform/methods/identities/internal/waitForCoreChainLockedHeight.js.map +1 -1
- package/build/src/SDK/Client/Platform/methods/identities/register.js +31 -8
- package/build/src/SDK/Client/Platform/methods/identities/register.js.map +1 -1
- package/build/src/SDK/Client/Platform/methods/identities/topUp.js +5 -7
- package/build/src/SDK/Client/Platform/methods/identities/topUp.js.map +1 -1
- package/build/src/SDK/Client/Platform/methods/identities/update.js +34 -5
- package/build/src/SDK/Client/Platform/methods/identities/update.js.map +1 -1
- package/build/src/SDK/SDK.js +10 -0
- package/build/src/SDK/SDK.js.map +1 -1
- package/build/src/test/fixtures/createIdentityFixtureInAccount.js +13 -3
- package/build/src/test/fixtures/createIdentityFixtureInAccount.js.map +1 -1
- package/build/src/test/fixtures/createTransactionFixtureInAccount.js +2 -2
- package/build/src/test/fixtures/createTransactionFixtureInAccount.js.map +1 -1
- package/build/src/test/mocks/createAndAttachTransportMocksToClient.js +2 -2
- package/build/src/test/mocks/createAndAttachTransportMocksToClient.js.map +1 -1
- package/build/tests/fixtures/contracts.json +1 -1
- package/build-utils/ws.js +15 -0
- package/dist/dash.min.js +9 -0
- package/dist/dash.min.js.LICENSE.txt +80 -0
- package/dist/dash.min.js.map +1 -0
- package/dist/src/SDK/Client/Platform/Platform.d.ts +7 -0
- package/dist/src/SDK/Client/Platform/broadcastStateTransition.d.ts +6 -1
- package/dist/src/SDK/Client/Platform/createAssetLockTransaction.d.ts +3 -2
- package/dist/src/SDK/Client/Platform/methods/identities/internal/createAssetLockProof.d.ts +3 -2
- package/dist/src/SDK/Client/Platform/methods/identities/internal/createIdentityCreateTransition.d.ts +3 -2
- package/dist/src/SDK/Client/Platform/methods/identities/internal/createIdnetityTopUpTransition.d.ts +3 -2
- package/dist/src/SDK/Client/Platform/methods/identities/internal/waitForCoreChainLockedHeight.d.ts +2 -1
- package/dist/src/SDK/Client/Platform/methods/identities/update.d.ts +4 -0
- package/dist/src/SDK/SDK.d.ts +9 -0
- package/docs/README.md +11 -52
- package/docs/_sidebar.md +0 -17
- package/docs/examples/fetch-an-identity-from-its-name.md +5 -9
- package/docs/examples/generate-a-new-mnemonic.md +1 -1
- package/docs/examples/pay-to-another-address.md +16 -13
- package/docs/examples/receive-money-and-check-balance.md +55 -39
- package/docs/examples/sign-and-verify-messages.md +19 -9
- package/docs/examples/use-different-account.md +5 -17
- package/docs/getting-started/core-concepts.md +6 -5
- package/docs/getting-started/dash-platform-applications.md +1 -1
- package/docs/getting-started/quickstart.md +7 -24
- package/docs/getting-started/with-typescript.md +5 -2
- package/docs/index.html +2 -2
- package/docs/platform/about-platform.md +5 -5
- package/docs/platform/contracts/about-contracts.md +2 -2
- package/docs/platform/contracts/create.md +5 -5
- package/docs/platform/contracts/get.md +1 -1
- package/docs/platform/contracts/publish.md +3 -3
- package/docs/platform/contracts/update.md +1 -4
- package/docs/platform/documents/broadcast.md +15 -15
- package/docs/platform/documents/create.md +5 -5
- package/docs/platform/documents/get.md +6 -5
- package/docs/platform/identities/about-identity.md +1 -1
- package/docs/platform/identities/get.md +1 -1
- package/docs/platform/identities/register.md +1 -1
- package/docs/platform/identities/topUp.md +2 -2
- package/docs/platform/names/about-dpns.md +1 -1
- package/docs/platform/names/register.md +9 -9
- package/docs/platform/names/resolve.md +1 -1
- package/docs/platform/names/resolveByRecord.md +9 -8
- package/docs/platform/names/search.md +1 -1
- package/docs/usage/dashcorelib-primitives.md +48 -37
- package/docs/wallet/about-wallet-lib.md +3 -3
- package/docs/wallet/accounts.md +11 -7
- package/docs/wallet/signing-encrypt.md +12 -6
- package/package.json +19 -15
- package/src/SDK/Client/Client.spec.ts +2 -4
- package/src/SDK/Client/Platform/Platform.ts +21 -0
- package/src/SDK/Client/Platform/broadcastStateTransition.ts +15 -6
- package/src/SDK/Client/Platform/createAssetLockTransaction.ts +5 -2
- package/src/SDK/Client/Platform/methods/contracts/publish.ts +1 -1
- package/src/SDK/Client/Platform/methods/contracts/update.ts +1 -1
- package/src/SDK/Client/Platform/methods/documents/broadcast.ts +1 -1
- package/src/SDK/Client/Platform/methods/identities/internal/createAssetLockProof.ts +5 -2
- package/src/SDK/Client/Platform/methods/identities/internal/createIdentityCreateTransition.ts +38 -7
- package/src/SDK/Client/Platform/methods/identities/internal/createIdnetityTopUpTransition.ts +5 -2
- package/src/SDK/Client/Platform/methods/identities/internal/waitForCoreChainLockedHeight.ts +4 -3
- package/src/SDK/Client/Platform/methods/identities/register.ts +33 -9
- package/src/SDK/Client/Platform/methods/identities/topUp.ts +5 -8
- package/src/SDK/Client/Platform/methods/identities/update.ts +35 -1
- package/src/SDK/SDK.ts +34 -21
- package/src/test/fixtures/createIdentityFixtureInAccount.ts +14 -3
- package/src/test/fixtures/createTransactionFixtureInAccount.ts +2 -2
- package/src/test/mocks/createAndAttachTransportMocksToClient.ts +2 -2
- package/tests/fixtures/contracts.json +1 -1
- package/tests/fixtures/ratePlatform.schema.json +1 -1
- package/webpack.base.config.js +14 -0
- package/webpack.config.js +6 -2
- package/docs/examples/publishing-a-new-contract.md +0 -68
- package/docs/examples/updating-a-contract.md +0 -55
- package/docs/examples/use-local-evonet.md +0 -19
- package/examples/node/create-and-fund-wallet.js +0 -28
- package/examples/node/register-contract.js +0 -34
- package/examples/node/register-identity.js +0 -23
- package/examples/node/register-name.js +0 -19
- package/examples/node/retrieve-contract.js +0 -20
- package/examples/node/retrieve-documents.js +0 -22
- package/examples/node/retrieve-identity.js +0 -20
- package/examples/node/retrieve-name.js +0 -14
- package/examples/node/sign-and-verify-messages.js +0 -29
- package/examples/schema.json +0 -58
- package/examples/web/usage.web.html +0 -12
- package/examples/web/usage.web.js +0 -28
|
@@ -15,49 +15,32 @@ Let's create a Dash SDK client instance specifying both our mnemonic and the sch
|
|
|
15
15
|
```js
|
|
16
16
|
const Dash = require('dash');
|
|
17
17
|
const opts = {
|
|
18
|
-
apps: {
|
|
19
|
-
dashpay: {
|
|
20
|
-
contractId: '77w8Xqn25HwJhjodrHW133aXhjuTsTv9ozQaYpSHACE3',
|
|
21
|
-
},
|
|
22
|
-
},
|
|
23
18
|
wallet: {
|
|
24
19
|
mnemonic: "arena light cheap control apple buffalo indicate rare motor valid accident isolate",
|
|
25
20
|
},
|
|
26
21
|
};
|
|
27
22
|
const client = new Dash.Client(opts);
|
|
28
|
-
client.
|
|
23
|
+
client.wallet.getAccount().then(async (account) => {
|
|
29
24
|
// Do something
|
|
30
25
|
})
|
|
31
26
|
```
|
|
32
27
|
|
|
33
|
-
Quick note
|
|
34
|
-
|
|
35
|
-
- If no mnemonic is provided, the sub-instance `client.Wallet` will not be initialized (writing capabilities of Dash Platform won't be usable).
|
|
28
|
+
Quick note:
|
|
29
|
+
If no `mnemonic` is provided or `mnemonic: null` is passed inside the `wallet` option, a new mnemonic will be generated.
|
|
36
30
|
|
|
37
|
-
If you do not have a mnemonic, you can pass `null` to have one generated or omit that parameter to only use Dash.Client for `read-only` operations.
|
|
38
31
|
|
|
39
32
|
## Make a payment
|
|
40
33
|
|
|
41
34
|
```js
|
|
42
|
-
client.
|
|
35
|
+
client.wallet.getAccount().then(async (account) => {
|
|
43
36
|
const transaction = account.createTransaction({
|
|
44
37
|
recipient: 'yixnmigzC236WmTXp9SBZ42csyp9By6Hw8',
|
|
45
38
|
amount: 0.12,
|
|
46
39
|
});
|
|
47
|
-
account.broadcastTransaction(transaction);
|
|
40
|
+
await account.broadcastTransaction(transaction);
|
|
48
41
|
});
|
|
49
42
|
```
|
|
50
43
|
|
|
51
|
-
##
|
|
44
|
+
## Interact with Dash Platform
|
|
52
45
|
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
```js
|
|
56
|
-
|
|
57
|
-
client.platform.documents.get(
|
|
58
|
-
'tutorialContract.note',
|
|
59
|
-
{ limit: 1 }, // Only retrieve 1 document
|
|
60
|
-
).then(async (documents) => {
|
|
61
|
-
console.log(documents);
|
|
62
|
-
});
|
|
63
|
-
```
|
|
46
|
+
See the [Tutorial section](https://dashplatform.readme.io/docs/tutorials-introduction) of the Dash Platform documentation for examples.
|
|
@@ -5,14 +5,17 @@ Create an index.ts file
|
|
|
5
5
|
```js
|
|
6
6
|
import Dash from 'dash';
|
|
7
7
|
const clientOpts = {
|
|
8
|
-
network: 'testnet',
|
|
9
8
|
wallet: {
|
|
10
9
|
mnemonic: null, // Will generate a new address, you should keep it.
|
|
11
10
|
},
|
|
12
11
|
};
|
|
13
12
|
const client = new Dash.Client(clientOpts);
|
|
14
13
|
|
|
15
|
-
|
|
14
|
+
const initializeAccount = async () => {
|
|
15
|
+
const account = await client.wallet.getAccount();
|
|
16
|
+
const balance = account.getTotalBalance();
|
|
17
|
+
console.log(`Account balance: ${balance}`)
|
|
18
|
+
}
|
|
16
19
|
```
|
|
17
20
|
|
|
18
21
|
Have a following `tsconfig.json` file
|
package/docs/index.html
CHANGED
|
@@ -14,10 +14,10 @@
|
|
|
14
14
|
<script>
|
|
15
15
|
window.$docsify = {
|
|
16
16
|
alias: {
|
|
17
|
-
'.*?/changelog': 'https://
|
|
17
|
+
'.*?/changelog': 'https://github.com/dashevo/platform/tree/master/packages/js-dash-sdk/CHANGELOG.md',
|
|
18
18
|
},
|
|
19
19
|
name: 'Dash SDK',
|
|
20
|
-
repo: 'https://github.com/dashevo/js-dash-sdk',
|
|
20
|
+
repo: 'https://github.com/dashevo/platform/tree/master/packages/js-dash-sdk',
|
|
21
21
|
loadSidebar: "_sidebar.md",
|
|
22
22
|
maxLevel: 4,
|
|
23
23
|
subMaxLevel: 2,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
### About Dash Platform
|
|
2
2
|
|
|
3
|
-
The Dash Platform
|
|
3
|
+
The Dash Platform provides a technology stack on the top of Dash Network that allows creation of feature-rich decentralized applications.
|
|
4
4
|
|
|
5
|
-
You
|
|
5
|
+
You can learn more from the [Dash Platform Documentation - What is Dash Platform?](https://dashplatform.readme.io/docs/introduction-what-is-dash-platform)
|
|
6
6
|
|
|
7
7
|
### Platform components
|
|
8
8
|
|
|
9
|
-
- DAPI: A decentralized API that
|
|
10
|
-
- Drive
|
|
11
|
-
- DPNS
|
|
9
|
+
- DAPI: A decentralized API that runs on all Masternodes and offers gRPC endpoints for retrieving payment chain metadata (blocks, transactions), as well as application data (documents, contracts, identities).
|
|
10
|
+
- Drive: Application chain storage layer where the data defined by Data Contracts is stored and managed.
|
|
11
|
+
- DPNS: Naming service provided by a Dash Platform App
|
|
12
12
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
## What is a contract
|
|
2
2
|
|
|
3
|
-
Contracts are
|
|
3
|
+
Contracts are registered sets of rules defined in a [JSON Application Schema](../../getting-started/core-concepts#app-schema-and-contracts).
|
|
4
4
|
|
|
5
|
-
See
|
|
5
|
+
See the Dash Platform documentation for more information about [Data Contracts](https://dashplatform.readme.io/docs/explanation-platform-protocol-data-contract).
|
|
6
6
|
|
|
@@ -3,10 +3,10 @@
|
|
|
3
3
|
|
|
4
4
|
Parameters:
|
|
5
5
|
|
|
6
|
-
| parameters | type | required | Description
|
|
7
|
-
|--------------------------|-------------------|------------------
|
|
6
|
+
| parameters | type | required | Description |
|
|
7
|
+
|--------------------------|-------------------|------------------ |------------------------------------------------------------------------------------------------------------------------|
|
|
8
8
|
| **contractDefinitions** | JSONDataContract | yes | The defined [JSON Application Schema](https://dashplatform.readme.io/docs/explanation-platform-protocol-data-contract) |
|
|
9
|
-
| **identity** | Identity | yes | A valid [registered `application` identity](../identities/register.md)
|
|
9
|
+
| **identity** | Identity | yes | A valid [registered `application` identity](../identities/register.md) |
|
|
10
10
|
|
|
11
11
|
**Example**:
|
|
12
12
|
|
|
@@ -31,6 +31,6 @@ Parameters:
|
|
|
31
31
|
const validationResult = client.platform.dpp.dataContract.validate(contract);
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
-
**Note**: When your contract is created, it will only exist locally
|
|
34
|
+
**Note**: When your contract is created, it will only exist locally. Use the [publish](/contracts/publish.md) method to register it.
|
|
35
35
|
|
|
36
|
-
Returns
|
|
36
|
+
Returns: Contract.
|
|
@@ -3,8 +3,8 @@
|
|
|
3
3
|
|
|
4
4
|
Parameters:
|
|
5
5
|
|
|
6
|
-
| parameters | type | required | Description
|
|
7
|
-
|
|
6
|
+
| parameters | type | required | Description |
|
|
7
|
+
|---------------------------|-----------|----------------|---------------------------------------------------------------------------------|
|
|
8
8
|
| **contract** | Contract | yes | A valid [created contract](../contracts/create.md) |
|
|
9
9
|
| **identity** | Identity | yes | A valid [registered `application` identity](../identities/register.md) |
|
|
10
10
|
|
|
@@ -14,7 +14,7 @@ const identityId = '';// Your identity identifier.
|
|
|
14
14
|
const identity = await client.platform.identities.get(identityId);
|
|
15
15
|
// See the contract.create documentation for more on how to create a dataContract
|
|
16
16
|
const contract = await client.platform.contracts.create(contractDefinitions, identity);
|
|
17
|
-
await platform.contracts.publish(contract, identity);
|
|
17
|
+
await client.platform.contracts.publish(contract, identity);
|
|
18
18
|
```
|
|
19
19
|
|
|
20
20
|
Returns : DataContractCreateTransition.
|
|
@@ -8,7 +8,4 @@ Parameters:
|
|
|
8
8
|
| **contract** | Contract | yes | A valid [created contract](/platform/contracts/create.md) |
|
|
9
9
|
| **identity** | Identity | yes | A valid [registered `application` identity](/platform/identities/register.md) |
|
|
10
10
|
|
|
11
|
-
|
|
12
|
-
You may check [following document](/examples/updating-a-contract.md) for an example on how to update a contract.
|
|
13
|
-
|
|
14
|
-
Returns : DataContractUpdateTransition.
|
|
11
|
+
Returns: DataContractUpdateTransition.
|
|
@@ -3,13 +3,13 @@
|
|
|
3
3
|
|
|
4
4
|
Parameters:
|
|
5
5
|
|
|
6
|
-
| parameters | type | required | Description
|
|
7
|
-
|
|
8
|
-
| **documents** | Object | yes |
|
|
9
|
-
| **documents.create** | Document[] | no | array of valid [created document](../documents/create.md) to create
|
|
10
|
-
| **documents.replace** | Document[] | no | array of valid [created document](../documents/create.md) to replace
|
|
11
|
-
| **documents.delete** | Document[] | no | array of valid [created document](../documents/create.md) to delete
|
|
12
|
-
| **identity** | Identity | yes | A valid [registered identity](../identities/register.md)
|
|
6
|
+
| parameters | type | required | Description |
|
|
7
|
+
|----------------------------|------------|----------|------------------------------------------------------------------------------|
|
|
8
|
+
| **documents** | Object | yes | |
|
|
9
|
+
| **documents.create** | Document[] | no | array of valid [created document](../documents/create.md) to create |
|
|
10
|
+
| **documents.replace** | Document[] | no | array of valid [created document](../documents/create.md) to replace |
|
|
11
|
+
| **documents.delete** | Document[] | no | array of valid [created document](../documents/create.md) to delete |
|
|
12
|
+
| **identity** | Identity | yes | A valid [registered identity](../identities/register.md) |
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
**Example**:
|
|
@@ -17,13 +17,13 @@ Parameters:
|
|
|
17
17
|
const identityId = '';// Your identity identifier
|
|
18
18
|
const identity = await client.platform.identities.get(identityId);
|
|
19
19
|
|
|
20
|
-
const helloWorldDocument = await platform.documents.create(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
const helloWorldDocument = await client.platform.documents.create(
|
|
21
|
+
// Assuming a contract tutorialContract is registered with a field note
|
|
22
|
+
'tutorialContract.note',
|
|
23
|
+
identity,
|
|
24
|
+
{ message: 'Hello World'},
|
|
25
|
+
);
|
|
26
26
|
|
|
27
|
-
await platform.documents.broadcast({create: [helloWorldDocument]}, identity);
|
|
27
|
+
await client.platform.documents.broadcast({ create: [helloWorldDocument] }, identity);
|
|
28
28
|
```
|
|
29
|
-
Returns
|
|
29
|
+
Returns: documents.
|
|
@@ -3,18 +3,18 @@
|
|
|
3
3
|
|
|
4
4
|
Parameters:
|
|
5
5
|
|
|
6
|
-
| parameters | type | required | Description
|
|
7
|
-
|-------------------|---------|------------------
|
|
6
|
+
| parameters | type | required | Description |
|
|
7
|
+
|-------------------|---------|------------------ |--------------------------------------------------------------------|
|
|
8
8
|
| **dotLocator** | string | yes | Field of a specific application, under the form `appName.fieldName` |
|
|
9
|
-
| **identity** | Identity| yes | A valid [registered identity](../identities/register.md)
|
|
10
|
-
| **docOpts** | Object | yes | A valid data that match the data contract structure
|
|
9
|
+
| **identity** | Identity| yes | A valid [registered identity](../identities/register.md) |
|
|
10
|
+
| **docOpts** | Object | yes | A valid data that match the data contract structure |
|
|
11
11
|
|
|
12
12
|
**Example**:
|
|
13
13
|
```js
|
|
14
14
|
const identityId = '';// Your identity identifier
|
|
15
15
|
const identity = await client.platform.identities.get(identityId);
|
|
16
16
|
|
|
17
|
-
const helloWorldDocument = await platform.documents.create(
|
|
17
|
+
const helloWorldDocument = await client.platform.documents.create(
|
|
18
18
|
// Assume a contract helloWorldContract is registered with a field note
|
|
19
19
|
'helloWorldContract.note',
|
|
20
20
|
identity,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
**Usage**: `client.platform.documents.get(
|
|
1
|
+
**Usage**: `client.platform.documents.get(typeLocator, opts)`
|
|
2
2
|
**Description**: This method will allow you to fetch back documents matching the provided parameters.
|
|
3
3
|
|
|
4
4
|
Parameters:
|
|
5
5
|
|
|
6
|
-
| parameters
|
|
7
|
-
|
|
8
|
-
| **
|
|
9
|
-
| **opts**
|
|
6
|
+
| parameters | type | required | Description |
|
|
7
|
+
|-----------------|---------|------------------| -------------------------------------------------------------------|
|
|
8
|
+
| **typeLocator** | string | yes | Field of a specific application, under the form `appName.fieldName`|
|
|
9
|
+
| **opts** | object | no (default: {}) | Query options of the request |
|
|
10
10
|
|
|
11
11
|
**Queries options**:
|
|
12
12
|
|
|
@@ -18,6 +18,7 @@ Parameters:
|
|
|
18
18
|
| **startAt** | integer | no | number of objects to skip |
|
|
19
19
|
| **startAfter** | integer | no | exclusive skip |
|
|
20
20
|
|
|
21
|
+
Learn more about query syntax at https://dashplatform.readme.io/docs/reference-query-syntax
|
|
21
22
|
|
|
22
23
|
**Example**:
|
|
23
24
|
```js
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
## What is an identity
|
|
2
2
|
|
|
3
3
|
An Identity is a blockchain-based identifier for individuals (users) and applications.
|
|
4
|
-
|
|
4
|
+
Identities are the atomic element that, when linked with additional applications, can be extended to provide new functionality.
|
|
5
5
|
|
|
6
6
|
Read more on the Dash Platform documentation about [Identity](https://dashplatform.readme.io/docs/explanation-identity).
|
|
7
7
|
You might also want to consult the usage for the [DPNS Name Service](../names/about-dpns.md) in order to attach a name to your created identity.
|
|
@@ -14,9 +14,9 @@ Parameters:
|
|
|
14
14
|
```js
|
|
15
15
|
const identityId = '';// Your identity identifier
|
|
16
16
|
const identity = await client.platform.identities.get(identityId);
|
|
17
|
-
await platform.identities.topUp(identity, 10000);
|
|
17
|
+
await client.platform.identities.topUp(identity.getId(), 10000);
|
|
18
18
|
|
|
19
19
|
console.log(`New identity balance: ${identity.balance}`)
|
|
20
20
|
```
|
|
21
21
|
|
|
22
|
-
Returns
|
|
22
|
+
Returns: Boolean.
|
|
@@ -4,6 +4,6 @@ DPNS is a special Dash Platform Application that is intended to provide a naming
|
|
|
4
4
|
|
|
5
5
|
Decoupling name from the blockchain identity enables a unique user experience coupled with the highest security while remaining compatible with [Decentralized Identifiers](https://www.w3.org/TR/did-core/).
|
|
6
6
|
|
|
7
|
-
Limitation
|
|
7
|
+
Limitation: max length of 63 characters on charset `0-9`,`A-Z`(case insensitive), `-`.
|
|
8
8
|
|
|
9
9
|
Domain names are linked to an Identity.
|
|
@@ -1,17 +1,17 @@
|
|
|
1
|
-
**Usage**: `client.platform.names.register(name, identity)`
|
|
1
|
+
**Usage**: `client.platform.names.register(name, records, identity)`
|
|
2
2
|
**Description**: This method will create a DPNS record matching your identity to the user or appname defined.
|
|
3
3
|
|
|
4
4
|
Parameters:
|
|
5
5
|
|
|
6
|
-
| parameters | type | required | Description
|
|
7
|
-
|
|
6
|
+
| parameters | type | required | Description |
|
|
7
|
+
|----------------------------------|-----------|----------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|
8
8
|
| **name** | String | yes | An alphanumeric (1-63 character) value used for human-identification (can contain `-` but not as the first or last character). If a name with no parent domain is entered, '.dash' is used. |
|
|
9
|
-
| **records** | Object | yes | records object having only one of the following items
|
|
10
|
-
| **records.dashUniqueIdentityId** | String | no | Unique Identity ID for this name record
|
|
11
|
-
| **records.dashAliasIdentityId** | String | no | Used to signify that this name is the alias for another id
|
|
12
|
-
| **identity** | Identity | yes | A valid [registered identity](../identities/register.md)
|
|
9
|
+
| **records** | Object | yes | records object having only one of the following items |
|
|
10
|
+
| **records.dashUniqueIdentityId** | String | no | Unique Identity ID for this name record |
|
|
11
|
+
| **records.dashAliasIdentityId** | String | no | Used to signify that this name is the alias for another id |
|
|
12
|
+
| **identity** | Identity | yes | A valid [registered identity](../identities/register.md) |
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
**Example**: `await client.platform.
|
|
15
|
+
**Example**: `await client.platform.names.register('alice', { dashUniqueIdentityId: identity.getId() }, identity)`
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
Returns: the created domain document
|
|
@@ -1,18 +1,19 @@
|
|
|
1
|
-
**Usage**: `client.platform.names.
|
|
2
|
-
**Description**: This method will allow you to resolve a DPNS record
|
|
1
|
+
**Usage**: `client.platform.names.resolveByRecord(record, value)`
|
|
2
|
+
**Description**: This method will allow you to resolve a DPNS record by identity ID.
|
|
3
3
|
|
|
4
4
|
Parameters:
|
|
5
5
|
|
|
6
|
-
| parameters
|
|
7
|
-
|
|
8
|
-
| **
|
|
6
|
+
| parameters | type | required | Description |
|
|
7
|
+
|------------|-----------|----------------|----------------------------------------------------------------------|
|
|
8
|
+
| **record** | String | yes | Type of the record (`dashUniqueIdentityId` or `dashAliasIdentityId`) |
|
|
9
|
+
| **value** | String | yes | Identifier value for the record |
|
|
9
10
|
|
|
10
11
|
**Example**:
|
|
11
12
|
|
|
12
|
-
This example will describe how to resolve names by the identity id
|
|
13
|
+
This example will describe how to resolve names by the dash unique identity id.
|
|
13
14
|
```js
|
|
14
15
|
const identityId = '3ge4yjGinQDhxh2aVpyLTQaoka45BkijkoybfAkDepoN';
|
|
15
|
-
const document = await client.platform.names.resolveByRecord('
|
|
16
|
+
const document = await client.platform.names.resolveByRecord('dashUniqueIdentityId', identityId);
|
|
16
17
|
```
|
|
17
18
|
|
|
18
|
-
Returns
|
|
19
|
+
Returns: array of Document.
|
|
@@ -1,13 +1,30 @@
|
|
|
1
|
+
# Dashcore Lib primitives
|
|
2
|
+
|
|
3
|
+
All Dashcore lib primitives are exposed via the `Core` namespace.
|
|
4
|
+
|
|
5
|
+
```js
|
|
6
|
+
const Dash = require('dash');
|
|
7
|
+
const {
|
|
8
|
+
Core: {
|
|
9
|
+
Block,
|
|
10
|
+
Transaction,
|
|
11
|
+
Address,
|
|
12
|
+
// ...
|
|
13
|
+
}
|
|
14
|
+
} = Dash;
|
|
15
|
+
```
|
|
16
|
+
|
|
1
17
|
## Transaction
|
|
2
18
|
|
|
3
|
-
The Transaction primitive allows
|
|
19
|
+
The Transaction primitive allows creating and manipulating transactions. It also allows signing transactions with a private key.
|
|
4
20
|
Supports fee control and input/output access (which allows passing a specific script).
|
|
21
|
+
|
|
5
22
|
```js
|
|
6
|
-
|
|
23
|
+
const { Transaction } = Dash.Core;
|
|
7
24
|
const tx = new Transaction(txProps)
|
|
8
25
|
```
|
|
9
26
|
|
|
10
|
-
Access the [Transaction documentation on dashevo/dashcore-lib](https://github.com/dashevo/dashcore-lib/blob/master/docs/transaction.md)
|
|
27
|
+
Access the [Transaction documentation on dashevo/dashcore-lib](https://github.com/dashevo/dashcore-lib/blob/master/docs/core-concepts/transaction.md)
|
|
11
28
|
|
|
12
29
|
## Address
|
|
13
30
|
|
|
@@ -15,100 +32,94 @@ Standardized representation of a Dash Address. Address can be instantiated from
|
|
|
15
32
|
Pay-to-script-hash (P2SH) multi-signature addresses from an array of PublicKeys are also supported.
|
|
16
33
|
|
|
17
34
|
```js
|
|
18
|
-
|
|
35
|
+
const { Address } = Dash.Core;
|
|
19
36
|
```
|
|
20
37
|
|
|
21
|
-
Access the [Address documentation on dashevo/dashcore-lib](https://github.com/dashevo/dashcore-lib/blob/master/docs/address.md)
|
|
38
|
+
Access the [Address documentation on dashevo/dashcore-lib](https://github.com/dashevo/dashcore-lib/blob/master/docs/core-concepts/address.md)
|
|
22
39
|
|
|
23
40
|
## Block
|
|
24
41
|
|
|
25
|
-
Given a
|
|
42
|
+
Given a binary representation of the block as input, the Block class allows you to have a deserialized representation of a Block or its header. It also allows validating the transactions in the block against the header merkle root.
|
|
26
43
|
|
|
27
|
-
|
|
44
|
+
The block's transactions can also be explored by iterating over elements in array (`block.transactions`).
|
|
28
45
|
|
|
29
|
-
`
|
|
46
|
+
`const { Block } = Dash.Core;`
|
|
30
47
|
|
|
31
|
-
Access the [Block documentation on dashevo/dashcore-lib](https://github.com/dashevo/dashcore-lib/blob/master/docs/block.md)
|
|
48
|
+
Access the [Block documentation on dashevo/dashcore-lib](https://github.com/dashevo/dashcore-lib/blob/master/docs/core-concepts/block.md)
|
|
32
49
|
|
|
33
50
|
## UnspentOutput
|
|
34
51
|
|
|
35
52
|
Representation of an UnspentOutput (also called UTXO as in Unspent Transaction Output).
|
|
36
53
|
Mostly useful in association with a Transaction and for Scripts.
|
|
37
54
|
|
|
38
|
-
`
|
|
55
|
+
`const { UnspentOutput } = Dash.Core.Transaction;`
|
|
39
56
|
|
|
40
|
-
Access the [UnspentOutput documentation on dashevo/dashcore-lib](https://github.com/dashevo/dashcore-lib/blob/master/docs/unspentoutput.md)
|
|
57
|
+
Access the [UnspentOutput documentation on dashevo/dashcore-lib](https://github.com/dashevo/dashcore-lib/blob/master/docs/core-concepts/unspentoutput.md)
|
|
41
58
|
|
|
42
59
|
## HDPublicKey
|
|
43
60
|
|
|
44
61
|
Hierarchical Deterministic (HD) version of the PublicKey.
|
|
45
62
|
Used internally by Wallet-lib and for exchange between peers (DashPay)
|
|
46
63
|
|
|
47
|
-
|
|
64
|
+
const { HDPublicKey } = Dash.Core;`
|
|
48
65
|
|
|
49
|
-
Access the [HDKeys documentation on dashevo/dashcore-lib](https://github.com/dashevo/dashcore-lib/blob/master/docs/hierarchical.md)
|
|
66
|
+
Access the [HDKeys documentation on dashevo/dashcore-lib](https://github.com/dashevo/dashcore-lib/blob/master/docs/core-concepts/hierarchical.md#hdpublickey)
|
|
50
67
|
|
|
51
68
|
## HDPrivateKey
|
|
52
69
|
|
|
53
70
|
Hierarchical Deterministic (HD) version of the PrivateKey.
|
|
54
71
|
Used internally by Wallet-lib.
|
|
55
72
|
|
|
56
|
-
`
|
|
73
|
+
`const { HDPrivateKey } = Dash.Core;`
|
|
57
74
|
|
|
58
|
-
Access the [HDKeys documentation on dashevo/dashcore-lib](https://github.com/dashevo/dashcore-lib/blob/master/docs/hierarchical.md)
|
|
75
|
+
Access the [HDKeys documentation on dashevo/dashcore-lib](https://github.com/dashevo/dashcore-lib/blob/master/docs/core-concepts/hierarchical.md#hdprivatekey)
|
|
59
76
|
|
|
60
77
|
## PublicKey
|
|
61
78
|
|
|
62
|
-
`
|
|
79
|
+
`const { PublicKey } = Dash.Core;`
|
|
63
80
|
|
|
64
|
-
Access the [PublicKey documentation on dashevo/dashcore-lib](https://github.com/dashevo/dashcore-lib/blob/master/docs/publickey.md)
|
|
81
|
+
Access the [PublicKey documentation on dashevo/dashcore-lib](https://github.com/dashevo/dashcore-lib/blob/master/docs/core-concepts/publickey.md)
|
|
65
82
|
|
|
66
83
|
## PrivateKey
|
|
67
84
|
|
|
68
|
-
`
|
|
85
|
+
`const { PrivateKey } = Dash.Core;`
|
|
69
86
|
|
|
70
|
-
Access the [PrivateKey documentation on dashevo/dashcore-lib](https://github.com/dashevo/dashcore-lib/blob/master/docs/privatekey.md)
|
|
87
|
+
Access the [PrivateKey documentation on dashevo/dashcore-lib](https://github.com/dashevo/dashcore-lib/blob/master/docs/core-concepts/privatekey.md)
|
|
71
88
|
|
|
72
89
|
## Mnemonic
|
|
73
90
|
|
|
74
91
|
Implementation of [BIP39 Mnemonic code for generative deterministic keys](https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki).
|
|
75
|
-
|
|
92
|
+
Generates a random mnemonic with the chosen language, validates a mnemonic or returns the associated HDPrivateKey.
|
|
76
93
|
|
|
77
|
-
`
|
|
94
|
+
`const { Mnemonic } = Dash.Core;`
|
|
78
95
|
|
|
79
|
-
Access the [Mnemonic documentation on dashevo/dashcore-lib](https://github.com/dashevo/dashcore-lib/blob/master/docs/mnemonic.md)
|
|
96
|
+
Access the [Mnemonic documentation on dashevo/dashcore-lib](https://github.com/dashevo/dashcore-lib/blob/master/docs/core-concepts/mnemonic.md)
|
|
80
97
|
|
|
81
98
|
## Network
|
|
82
99
|
|
|
83
|
-
A representation of the internal parameters relative to the network
|
|
100
|
+
A representation of the internal parameters relative to the selected network. By default, all primitives works with 'livenet'.
|
|
84
101
|
|
|
85
|
-
`
|
|
102
|
+
`const { Network } = Dash.Core;`
|
|
86
103
|
|
|
87
104
|
|
|
88
|
-
Access the [Network documentation on dashevo/dashcore-lib](https://github.com/dashevo/dashcore-lib/blob/master/docs/networks.md)
|
|
105
|
+
Access the [Network documentation on dashevo/dashcore-lib](https://github.com/dashevo/dashcore-lib/blob/master/docs/core-concepts/networks.md)
|
|
89
106
|
|
|
90
107
|
## Script
|
|
91
108
|
|
|
92
|
-
|
|
93
|
-
A valid Transaction is a transaction which output script are evaluated as valid.
|
|
94
|
-
|
|
95
|
-
Some operations of this language, such as OP_RETURN has been used to store hashes and B64 data on the payment chain.
|
|
96
|
-
Learn more on our walkthrough [Transaction script manipulation with the OP_RETURN example](/docs/walkthroughs/op_return/or_return.md)
|
|
97
|
-
|
|
98
|
-
`import { Script } from 'dash'`
|
|
109
|
+
`const { Script } = Dash.Core.Transaction;`
|
|
99
110
|
|
|
100
|
-
Access the [Script documentation on dashevo/dashcore-lib](https://github.com/dashevo/dashcore-lib/blob/master/docs/script.md)
|
|
111
|
+
Access the [Script documentation on dashevo/dashcore-lib](https://github.com/dashevo/dashcore-lib/blob/master/docs/core-concepts/script.md)
|
|
101
112
|
|
|
102
113
|
|
|
103
114
|
## Input
|
|
104
115
|
|
|
105
|
-
`
|
|
116
|
+
`const { Input } = Dash.Core.Transaction;`
|
|
106
117
|
|
|
107
|
-
Access the [Transaction documentation on dashevo/dashcore-lib](https://github.com/dashevo/dashcore-lib/blob/master/docs/transaction.md)
|
|
118
|
+
Access the [Transaction documentation on dashevo/dashcore-lib](https://github.com/dashevo/dashcore-lib/blob/master/docs/core-concepts/transaction.md#adding-inputs)
|
|
108
119
|
|
|
109
120
|
|
|
110
121
|
## Output
|
|
111
122
|
|
|
112
|
-
`
|
|
123
|
+
`const { Output } = Dash.Core.Transaction;`
|
|
113
124
|
|
|
114
|
-
Access the [Transaction documentation on dashevo/dashcore-lib](https://github.com/dashevo/dashcore-lib/blob/master/docs/transaction.md)
|
|
125
|
+
Access the [Transaction documentation on dashevo/dashcore-lib](https://github.com/dashevo/dashcore-lib/blob/master/docs/core-concepts/transaction.md#handling-outputs)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
### About Wallet-lib
|
|
2
2
|
|
|
3
|
-
When Dash.Client is initiated with a `mnemonic` property, a wallet instance
|
|
3
|
+
When Dash.Client is initiated with a `mnemonic` property, a wallet instance becomes accessible via `client.wallet` property.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
To initialize the wallet account and synchronize with the network, use `client.wallet.getAccount()`.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
Find out more about the Wallet in its [complete documentation](https://dashevo.github.io/platform/Wallet-library/)
|
package/docs/wallet/accounts.md
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
## Getting an account
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
When Wallet is initialized with `mnemonic`, it holds multiple Accounts according to BIP44.
|
|
4
|
+
Each Account holds the keys needed to make a payments from it.
|
|
5
|
+
|
|
6
|
+
Wallet's `getAccount` method used to access an account:
|
|
5
7
|
|
|
6
8
|
```js
|
|
7
9
|
const client = new Dash.Client({
|
|
@@ -9,13 +11,15 @@ const client = new Dash.Client({
|
|
|
9
11
|
mnemonic: "maximum blast eight orchard waste wood gospel siren parent deer athlete impact",
|
|
10
12
|
},
|
|
11
13
|
});
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
});
|
|
14
|
+
|
|
15
|
+
const account = await client.wallet.getAccount()
|
|
16
|
+
// Do something with account
|
|
16
17
|
```
|
|
17
18
|
|
|
18
19
|
As optional parameter, an integer representing the account `index` can be passed as parameter. By default, index account on call is 0.
|
|
20
|
+
```
|
|
21
|
+
client.wallet.getAccount({ index: 1 })
|
|
22
|
+
```
|
|
19
23
|
|
|
20
|
-
|
|
24
|
+
Awaiting for the `getAccount()` promise is necessary to ensure the wallet is synced-up with the network and make sure that the UTXO set is ready to be used for payment/signing.
|
|
21
25
|
|