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.
Files changed (124) hide show
  1. package/README.md +57 -14
  2. package/build/src/SDK/Client/Client.spec.js +2 -4
  3. package/build/src/SDK/Client/Client.spec.js.map +1 -1
  4. package/build/src/SDK/Client/Platform/Platform.js +12 -0
  5. package/build/src/SDK/Client/Platform/Platform.js.map +1 -1
  6. package/build/src/SDK/Client/Platform/broadcastStateTransition.js +16 -9
  7. package/build/src/SDK/Client/Platform/broadcastStateTransition.js.map +1 -1
  8. package/build/src/SDK/Client/Platform/createAssetLockTransaction.js +8 -4
  9. package/build/src/SDK/Client/Platform/createAssetLockTransaction.js.map +1 -1
  10. package/build/src/SDK/Client/Platform/methods/contracts/publish.js +1 -1
  11. package/build/src/SDK/Client/Platform/methods/contracts/publish.js.map +1 -1
  12. package/build/src/SDK/Client/Platform/methods/contracts/update.js +1 -1
  13. package/build/src/SDK/Client/Platform/methods/contracts/update.js.map +1 -1
  14. package/build/src/SDK/Client/Platform/methods/documents/broadcast.js +1 -1
  15. package/build/src/SDK/Client/Platform/methods/documents/broadcast.js.map +1 -1
  16. package/build/src/SDK/Client/Platform/methods/identities/internal/createAssetLockProof.js +8 -4
  17. package/build/src/SDK/Client/Platform/methods/identities/internal/createAssetLockProof.js.map +1 -1
  18. package/build/src/SDK/Client/Platform/methods/identities/internal/createIdentityCreateTransition.js +42 -17
  19. package/build/src/SDK/Client/Platform/methods/identities/internal/createIdentityCreateTransition.js.map +1 -1
  20. package/build/src/SDK/Client/Platform/methods/identities/internal/createIdnetityTopUpTransition.js +8 -4
  21. package/build/src/SDK/Client/Platform/methods/identities/internal/createIdnetityTopUpTransition.js.map +1 -1
  22. package/build/src/SDK/Client/Platform/methods/identities/internal/waitForCoreChainLockedHeight.js +7 -3
  23. package/build/src/SDK/Client/Platform/methods/identities/internal/waitForCoreChainLockedHeight.js.map +1 -1
  24. package/build/src/SDK/Client/Platform/methods/identities/register.js +31 -8
  25. package/build/src/SDK/Client/Platform/methods/identities/register.js.map +1 -1
  26. package/build/src/SDK/Client/Platform/methods/identities/topUp.js +5 -7
  27. package/build/src/SDK/Client/Platform/methods/identities/topUp.js.map +1 -1
  28. package/build/src/SDK/Client/Platform/methods/identities/update.js +34 -5
  29. package/build/src/SDK/Client/Platform/methods/identities/update.js.map +1 -1
  30. package/build/src/SDK/SDK.js +10 -0
  31. package/build/src/SDK/SDK.js.map +1 -1
  32. package/build/src/test/fixtures/createIdentityFixtureInAccount.js +13 -3
  33. package/build/src/test/fixtures/createIdentityFixtureInAccount.js.map +1 -1
  34. package/build/src/test/fixtures/createTransactionFixtureInAccount.js +2 -2
  35. package/build/src/test/fixtures/createTransactionFixtureInAccount.js.map +1 -1
  36. package/build/src/test/mocks/createAndAttachTransportMocksToClient.js +2 -2
  37. package/build/src/test/mocks/createAndAttachTransportMocksToClient.js.map +1 -1
  38. package/build/tests/fixtures/contracts.json +1 -1
  39. package/build-utils/ws.js +15 -0
  40. package/dist/dash.min.js +9 -0
  41. package/dist/dash.min.js.LICENSE.txt +80 -0
  42. package/dist/dash.min.js.map +1 -0
  43. package/dist/src/SDK/Client/Platform/Platform.d.ts +7 -0
  44. package/dist/src/SDK/Client/Platform/broadcastStateTransition.d.ts +6 -1
  45. package/dist/src/SDK/Client/Platform/createAssetLockTransaction.d.ts +3 -2
  46. package/dist/src/SDK/Client/Platform/methods/identities/internal/createAssetLockProof.d.ts +3 -2
  47. package/dist/src/SDK/Client/Platform/methods/identities/internal/createIdentityCreateTransition.d.ts +3 -2
  48. package/dist/src/SDK/Client/Platform/methods/identities/internal/createIdnetityTopUpTransition.d.ts +3 -2
  49. package/dist/src/SDK/Client/Platform/methods/identities/internal/waitForCoreChainLockedHeight.d.ts +2 -1
  50. package/dist/src/SDK/Client/Platform/methods/identities/update.d.ts +4 -0
  51. package/dist/src/SDK/SDK.d.ts +9 -0
  52. package/docs/README.md +11 -52
  53. package/docs/_sidebar.md +0 -17
  54. package/docs/examples/fetch-an-identity-from-its-name.md +5 -9
  55. package/docs/examples/generate-a-new-mnemonic.md +1 -1
  56. package/docs/examples/pay-to-another-address.md +16 -13
  57. package/docs/examples/receive-money-and-check-balance.md +55 -39
  58. package/docs/examples/sign-and-verify-messages.md +19 -9
  59. package/docs/examples/use-different-account.md +5 -17
  60. package/docs/getting-started/core-concepts.md +6 -5
  61. package/docs/getting-started/dash-platform-applications.md +1 -1
  62. package/docs/getting-started/quickstart.md +7 -24
  63. package/docs/getting-started/with-typescript.md +5 -2
  64. package/docs/index.html +2 -2
  65. package/docs/platform/about-platform.md +5 -5
  66. package/docs/platform/contracts/about-contracts.md +2 -2
  67. package/docs/platform/contracts/create.md +5 -5
  68. package/docs/platform/contracts/get.md +1 -1
  69. package/docs/platform/contracts/publish.md +3 -3
  70. package/docs/platform/contracts/update.md +1 -4
  71. package/docs/platform/documents/broadcast.md +15 -15
  72. package/docs/platform/documents/create.md +5 -5
  73. package/docs/platform/documents/get.md +6 -5
  74. package/docs/platform/identities/about-identity.md +1 -1
  75. package/docs/platform/identities/get.md +1 -1
  76. package/docs/platform/identities/register.md +1 -1
  77. package/docs/platform/identities/topUp.md +2 -2
  78. package/docs/platform/names/about-dpns.md +1 -1
  79. package/docs/platform/names/register.md +9 -9
  80. package/docs/platform/names/resolve.md +1 -1
  81. package/docs/platform/names/resolveByRecord.md +9 -8
  82. package/docs/platform/names/search.md +1 -1
  83. package/docs/usage/dashcorelib-primitives.md +48 -37
  84. package/docs/wallet/about-wallet-lib.md +3 -3
  85. package/docs/wallet/accounts.md +11 -7
  86. package/docs/wallet/signing-encrypt.md +12 -6
  87. package/package.json +19 -15
  88. package/src/SDK/Client/Client.spec.ts +2 -4
  89. package/src/SDK/Client/Platform/Platform.ts +21 -0
  90. package/src/SDK/Client/Platform/broadcastStateTransition.ts +15 -6
  91. package/src/SDK/Client/Platform/createAssetLockTransaction.ts +5 -2
  92. package/src/SDK/Client/Platform/methods/contracts/publish.ts +1 -1
  93. package/src/SDK/Client/Platform/methods/contracts/update.ts +1 -1
  94. package/src/SDK/Client/Platform/methods/documents/broadcast.ts +1 -1
  95. package/src/SDK/Client/Platform/methods/identities/internal/createAssetLockProof.ts +5 -2
  96. package/src/SDK/Client/Platform/methods/identities/internal/createIdentityCreateTransition.ts +38 -7
  97. package/src/SDK/Client/Platform/methods/identities/internal/createIdnetityTopUpTransition.ts +5 -2
  98. package/src/SDK/Client/Platform/methods/identities/internal/waitForCoreChainLockedHeight.ts +4 -3
  99. package/src/SDK/Client/Platform/methods/identities/register.ts +33 -9
  100. package/src/SDK/Client/Platform/methods/identities/topUp.ts +5 -8
  101. package/src/SDK/Client/Platform/methods/identities/update.ts +35 -1
  102. package/src/SDK/SDK.ts +34 -21
  103. package/src/test/fixtures/createIdentityFixtureInAccount.ts +14 -3
  104. package/src/test/fixtures/createTransactionFixtureInAccount.ts +2 -2
  105. package/src/test/mocks/createAndAttachTransportMocksToClient.ts +2 -2
  106. package/tests/fixtures/contracts.json +1 -1
  107. package/tests/fixtures/ratePlatform.schema.json +1 -1
  108. package/webpack.base.config.js +14 -0
  109. package/webpack.config.js +6 -2
  110. package/docs/examples/publishing-a-new-contract.md +0 -68
  111. package/docs/examples/updating-a-contract.md +0 -55
  112. package/docs/examples/use-local-evonet.md +0 -19
  113. package/examples/node/create-and-fund-wallet.js +0 -28
  114. package/examples/node/register-contract.js +0 -34
  115. package/examples/node/register-identity.js +0 -23
  116. package/examples/node/register-name.js +0 -19
  117. package/examples/node/retrieve-contract.js +0 -20
  118. package/examples/node/retrieve-documents.js +0 -22
  119. package/examples/node/retrieve-identity.js +0 -20
  120. package/examples/node/retrieve-name.js +0 -14
  121. package/examples/node/sign-and-verify-messages.js +0 -29
  122. package/examples/schema.json +0 -58
  123. package/examples/web/usage.web.html +0 -12
  124. 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.getWalletAccount().then(async (account) => {
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.getWalletAccount().then(async (account) => {
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
- ## Read a document
44
+ ## Interact with Dash Platform
52
45
 
53
- At the time of writing, you will need to have registered a data contract yourself. See [publishing a new contract](../examples/publishing-a-new-contract.md).
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
- client.isReady().then(()=> console.log('isReady'));
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://raw.githubusercontent.com/dashevo/js-dash-sdk/master/CHANGELOG.md',
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 provide a technology stack on top of the Dash Network allowing the creation of feature-rich decentralized application.
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 will learn more on the [Dash Platform Documentation - What is Dash Platform ?](https://dashplatform.readme.io/docs/introduction-what-is-dash-platform).
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 is being run by all Masternode and offer a gRPC endpoints for retrieving payment chain metadata (block, transaction), aswell as application data (documents, contracts, identities).
10
- - Drive : Application chain storage layer. Where the data defined by a Data Contract are managed.
11
- - DPNS : A Naming serving
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 a [registered](../../examples/publishing-a-new-contract.md) set of rules defined in a [JSON Application Schema](../../getting-started/core-concepts#schemas).
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 more on the Dash Platform documentation about [Data Contract](https://dashplatform.readme.io/docs/explanation-platform-protocol-data-contract).
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, use the [broadcast](../contracts/broadcast.md) method to register it.
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 : Contract.
36
+ Returns: Contract.
@@ -9,4 +9,4 @@ Parameters:
9
9
 
10
10
  **Example**: `await client.platform.contracts.get('77w8Xqn25HwJhjodrHW133aXhjuTsTv9ozQaYpSHACE3')`
11
11
 
12
- Returns : Contract (or `null` if it's not a registered contract).
12
+ Returns: Contract (or `null` if it's not a registered 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
- **Example**:
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
- // Assume a contract helloWorldContract is registered with a field note
22
- 'helloWorldContract.note',
23
- identity,
24
- { message: 'Hello World'},
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 : documents.
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(dotLocator, opts)`
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 | type | required | Description |
7
- |-------------------|---------|------------------| -------------------------------------------------------------------|
8
- | **dotLocator** | string | yes | Field of a specific application, under the form `appName.fieldName`|
9
- | **opts** | object | no (default: {}) | Query options of the request |
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
- Identity is the atomic element that linked with additional applications can be extended to provide new functionality.
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.
@@ -9,4 +9,4 @@ Parameters:
9
9
 
10
10
  **Example**: `await client.platform.identities.get('3GegupTgRfdN9JMS8R6QXF3B2VbZtiw63eyudh1oMJAk')`
11
11
 
12
- Returns : Identity (or `null` if it does not exist).
12
+ Returns: Identity (or `null` if it does not exist).
@@ -11,4 +11,4 @@ Parameters:
11
11
 
12
12
  **Note**: The created identity will be associated to the active account. You might want to know more about how to [change your active account](../../examples/use-different-account.md).
13
13
 
14
- Returns : Identity.
14
+ Returns: 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 : Boolean.
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 : max length of 63 characters on charset `0-9`,`A-Z`(case insensitive), `-`.
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.identities.register('alice', { dashUniqueIdentityId: identity.getId() }, identity)`
15
+ **Example**: `await client.platform.names.register('alice', { dashUniqueIdentityId: identity.getId() }, identity)`
16
16
 
17
- Return: the created domain document
17
+ Returns: the created domain document
@@ -1,4 +1,4 @@
1
- **Usage**: `client.platform.names.resolve(name.domain)`
1
+ **Usage**: `client.platform.names.resolve('<name>.dash')`
2
2
  **Description**: This method will allow you to resolve a DPNS record from its humanized name.
3
3
 
4
4
  Parameters:
@@ -1,18 +1,19 @@
1
- **Usage**: `client.platform.names.resolve(name.domain)`
2
- **Description**: This method will allow you to resolve a DPNS record from its identity ID.
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 | type | required | Description |
7
- |---------------------------|-----------|----------------| ----------------------------------------------------------------------------- |
8
- | **name** | String | yes | An alphanumeric (2-63) value used for human-identification (can contains `-`) |
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, but other records field will works too.
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('dashIdentity',identityId);
16
+ const document = await client.platform.names.resolveByRecord('dashUniqueIdentityId', identityId);
16
17
  ```
17
18
 
18
- Returns : array of Document.
19
+ Returns: array of Document.
@@ -19,4 +19,4 @@ const parentDomain = 'dash';
19
19
  const document = await client.platform.names.search(labelPrefix, parentDomain);
20
20
  ```
21
21
 
22
- Returns : Documents matching the label prefix on the parent domain.
22
+ Returns: Documents matching the label prefix on the parent domain.
@@ -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 easy creation and manipulation of transactions. It also allows signing when provided with a privatekey.
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
- import { Transaction } from 'dash';
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
- import { Address } from 'dash';
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 hexadecimal string 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.
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
- Transactions of the block can also be explored by iterating over elements in array (`block.transactions`).
44
+ The block's transactions can also be explored by iterating over elements in array (`block.transactions`).
28
45
 
29
- `import { Block } from 'dash'`
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
- `import { UnspentOutput } from 'dash'`
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
- `import { HDPublicKey } from 'dash'`
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
- `import { HDPrivateKey } from 'dash'`
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
- `import { PublicKey } from 'dash'`
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
- `import { PrivateKey } from 'dash'`
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
- Allow to generate random mnemonic on the language set needed, validate a mnemonic or get the HDPrivateKey associated.
92
+ Generates a random mnemonic with the chosen language, validates a mnemonic or returns the associated HDPrivateKey.
76
93
 
77
- `import { Mnemonic } from 'dash'`
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 used. By default, all primitives works with 'livenet', this class allow to have an testnet instance to used on the other primitives (such as Addresses), or for Wallet-lib.
100
+ A representation of the internal parameters relative to the selected network. By default, all primitives works with 'livenet'.
84
101
 
85
- `import { Network } from 'dash'`
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
- In Dash, transaction have in their inputs and outputs some script, very simple programming language with a stack-based evaluation and which is not Turing Complete.
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
- `import { Input } from 'dash'`
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
- `import { Output } from 'dash'`
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 is automatically created accessible via `client.wallet` as well as an `client.account` instance.
3
+ When Dash.Client is initiated with a `mnemonic` property, a wallet instance becomes accessible via `client.wallet` property.
4
4
 
5
- In order to ensure the sync-up with the network has happened, you will need to wait for the method `client.isReady()` to resolve.
5
+ To initialize the wallet account and synchronize with the network, use `client.wallet.getAccount()`.
6
6
 
7
- You will find else where the [complete documentation of Wallet-lib](https://github.com/dashevo/platform/tree/master/packages/wallet-lib), as we only cover the most basic pieces in this documentation.
7
+ Find out more about the Wallet in its [complete documentation](https://dashevo.github.io/platform/Wallet-library/)
@@ -1,7 +1,9 @@
1
1
  ## Getting an account
2
2
 
3
- A Wallet is actually a holders of multiple Account that hold the keys needed to make a payment.
4
- So the first thing will be on accessing your account :
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
- client.isReady().then(()=>{
13
- const {account} = client;
14
- // Do something with account
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
- You will also see that we wait for isReady to resolve before making any operation. This allow us to access an account instance that will have synced-up with network and that our UTXOS set are ready to be used for payment/signing.
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