From b7f05398bfc2b20dd39cb4fbaad9c7866b93e1a1 Mon Sep 17 00:00:00 2001 From: thephez Date: Tue, 17 Mar 2026 13:18:46 -0400 Subject: [PATCH 1/4] chore: remove old js sdk and dapi-client sections They are nearly deprecated and shouldn't be represented here --- docs/dapi-client-js/overview.md | 47 ------- docs/dapi-client-js/quick-start.md | 41 ------ .../usage/core/broadcasttransaction.md | 17 --- docs/dapi-client-js/usage/core/core.md | 22 ---- .../usage/core/getbestblockhash.md | 12 -- .../usage/core/getblockbyhash.md | 13 -- .../usage/core/getblockbyheight.md | 13 -- .../dapi-client-js/usage/core/getblockhash.md | 13 -- docs/dapi-client-js/usage/core/getstatus.md | 31 ----- .../usage/core/gettransaction.md | 13 -- .../subscribetoblockheaderswithchainlocks.md | 40 ------ .../usage/core/subscribetomasternodelist.md | 26 ---- .../core/subscribetotransactionswithproofs.md | 49 ------- docs/dapi-client-js/usage/dapiclient.md | 27 ---- .../platform/broadcaststatetransition.md | 13 -- .../usage/platform/getdatacontract.md | 12 -- .../usage/platform/getdocuments.md | 18 --- .../usage/platform/getidentity.md | 12 -- .../platform/getidentitybyfirstpublickey.md | 12 -- .../platform/getidentityidbyfirstpublickey.md | 12 -- .../dapi-client-js/usage/platform/platform.md | 18 --- docs/dapi-client-js/usage/usage.md | 14 -- docs/index.md | 45 ------- docs/sdk-js/examples/examples.md | 13 -- .../fetch-an-identity-from-its-name.md | 17 --- .../examples/generate-a-new-mnemonic.md | 48 ------- .../examples/paying-to-another-address.md | 28 ---- .../receive-money-and-check-balance.md | 92 ------------- .../examples/sign-and-verify-messages.md | 24 ---- docs/sdk-js/examples/use-different-account.md | 11 -- docs/sdk-js/getting-started/about-schemas.md | 5 - docs/sdk-js/getting-started/core-concepts.md | 30 ----- .../dash-platform-applications.md | 9 -- .../sdk-js/getting-started/getting-started.md | 12 -- docs/sdk-js/getting-started/quick-start.md | 45 ------- .../sdk-js/getting-started/with-typescript.md | 36 ------ .../working-with-multiple-apps.md | 23 ---- docs/sdk-js/overview.md | 54 -------- docs/sdk-js/platform/contracts/contracts.md | 17 --- docs/sdk-js/platform/contracts/create.md | 38 ------ docs/sdk-js/platform/contracts/get.md | 14 -- docs/sdk-js/platform/contracts/history.md | 32 ----- docs/sdk-js/platform/contracts/publish.md | 23 ---- docs/sdk-js/platform/contracts/update.md | 13 -- docs/sdk-js/platform/documents/broadcast.md | 32 ----- docs/sdk-js/platform/documents/create.md | 30 ----- docs/sdk-js/platform/documents/documents.md | 16 --- docs/sdk-js/platform/documents/get.md | 35 ----- .../platform/identities/credit-transfer.md | 31 ----- .../platform/identities/credit-withdrawal.md | 31 ----- docs/sdk-js/platform/identities/get.md | 14 -- docs/sdk-js/platform/identities/identities.md | 24 ---- docs/sdk-js/platform/identities/register.md | 16 --- docs/sdk-js/platform/identities/topup.md | 25 ---- docs/sdk-js/platform/identities/update.md | 30 ----- docs/sdk-js/platform/names/names.md | 20 --- docs/sdk-js/platform/names/register.md | 17 --- docs/sdk-js/platform/names/resolve.md | 14 -- docs/sdk-js/platform/names/resolvebyrecord.md | 22 ---- docs/sdk-js/platform/names/search.md | 24 ---- docs/sdk-js/platform/platform.md | 20 --- docs/sdk-js/usage/dapi.md | 13 -- docs/sdk-js/usage/dashcore-lib-primitives.md | 122 ------------------ docs/sdk-js/usage/usage.md | 9 -- docs/sdk-js/wallet/accounts.md | 27 ---- docs/sdk-js/wallet/signing-encrypt.md | 30 ----- docs/sdk-js/wallet/wallet.md | 17 --- 67 files changed, 1723 deletions(-) delete mode 100644 docs/dapi-client-js/overview.md delete mode 100644 docs/dapi-client-js/quick-start.md delete mode 100644 docs/dapi-client-js/usage/core/broadcasttransaction.md delete mode 100644 docs/dapi-client-js/usage/core/core.md delete mode 100644 docs/dapi-client-js/usage/core/getbestblockhash.md delete mode 100644 docs/dapi-client-js/usage/core/getblockbyhash.md delete mode 100644 docs/dapi-client-js/usage/core/getblockbyheight.md delete mode 100644 docs/dapi-client-js/usage/core/getblockhash.md delete mode 100644 docs/dapi-client-js/usage/core/getstatus.md delete mode 100644 docs/dapi-client-js/usage/core/gettransaction.md delete mode 100644 docs/dapi-client-js/usage/core/subscribetoblockheaderswithchainlocks.md delete mode 100644 docs/dapi-client-js/usage/core/subscribetomasternodelist.md delete mode 100644 docs/dapi-client-js/usage/core/subscribetotransactionswithproofs.md delete mode 100644 docs/dapi-client-js/usage/dapiclient.md delete mode 100644 docs/dapi-client-js/usage/platform/broadcaststatetransition.md delete mode 100644 docs/dapi-client-js/usage/platform/getdatacontract.md delete mode 100644 docs/dapi-client-js/usage/platform/getdocuments.md delete mode 100644 docs/dapi-client-js/usage/platform/getidentity.md delete mode 100644 docs/dapi-client-js/usage/platform/getidentitybyfirstpublickey.md delete mode 100644 docs/dapi-client-js/usage/platform/getidentityidbyfirstpublickey.md delete mode 100644 docs/dapi-client-js/usage/platform/platform.md delete mode 100644 docs/dapi-client-js/usage/usage.md delete mode 100644 docs/sdk-js/examples/examples.md delete mode 100644 docs/sdk-js/examples/fetch-an-identity-from-its-name.md delete mode 100644 docs/sdk-js/examples/generate-a-new-mnemonic.md delete mode 100644 docs/sdk-js/examples/paying-to-another-address.md delete mode 100644 docs/sdk-js/examples/receive-money-and-check-balance.md delete mode 100644 docs/sdk-js/examples/sign-and-verify-messages.md delete mode 100644 docs/sdk-js/examples/use-different-account.md delete mode 100644 docs/sdk-js/getting-started/about-schemas.md delete mode 100644 docs/sdk-js/getting-started/core-concepts.md delete mode 100644 docs/sdk-js/getting-started/dash-platform-applications.md delete mode 100644 docs/sdk-js/getting-started/getting-started.md delete mode 100644 docs/sdk-js/getting-started/quick-start.md delete mode 100644 docs/sdk-js/getting-started/with-typescript.md delete mode 100644 docs/sdk-js/getting-started/working-with-multiple-apps.md delete mode 100644 docs/sdk-js/overview.md delete mode 100644 docs/sdk-js/platform/contracts/contracts.md delete mode 100644 docs/sdk-js/platform/contracts/create.md delete mode 100644 docs/sdk-js/platform/contracts/get.md delete mode 100644 docs/sdk-js/platform/contracts/history.md delete mode 100644 docs/sdk-js/platform/contracts/publish.md delete mode 100644 docs/sdk-js/platform/contracts/update.md delete mode 100644 docs/sdk-js/platform/documents/broadcast.md delete mode 100644 docs/sdk-js/platform/documents/create.md delete mode 100644 docs/sdk-js/platform/documents/documents.md delete mode 100644 docs/sdk-js/platform/documents/get.md delete mode 100644 docs/sdk-js/platform/identities/credit-transfer.md delete mode 100644 docs/sdk-js/platform/identities/credit-withdrawal.md delete mode 100644 docs/sdk-js/platform/identities/get.md delete mode 100644 docs/sdk-js/platform/identities/identities.md delete mode 100644 docs/sdk-js/platform/identities/register.md delete mode 100644 docs/sdk-js/platform/identities/topup.md delete mode 100644 docs/sdk-js/platform/identities/update.md delete mode 100644 docs/sdk-js/platform/names/names.md delete mode 100644 docs/sdk-js/platform/names/register.md delete mode 100644 docs/sdk-js/platform/names/resolve.md delete mode 100644 docs/sdk-js/platform/names/resolvebyrecord.md delete mode 100644 docs/sdk-js/platform/names/search.md delete mode 100644 docs/sdk-js/platform/platform.md delete mode 100644 docs/sdk-js/usage/dapi.md delete mode 100644 docs/sdk-js/usage/dashcore-lib-primitives.md delete mode 100644 docs/sdk-js/usage/usage.md delete mode 100644 docs/sdk-js/wallet/accounts.md delete mode 100644 docs/sdk-js/wallet/signing-encrypt.md delete mode 100644 docs/sdk-js/wallet/wallet.md diff --git a/docs/dapi-client-js/overview.md b/docs/dapi-client-js/overview.md deleted file mode 100644 index 7177f3950..000000000 --- a/docs/dapi-client-js/overview.md +++ /dev/null @@ -1,47 +0,0 @@ -```{eval-rst} -.. _dapi-client-js-index: -``` - -# Overview - -:::{attention} -This documentation is based on the [docs directory in the repository](https://github.com/dashpay/platform/tree/master/packages/js-dapi-client/docs) and may not always reflect recent code changes. For the most up-to-date information, please refer to the latest version of the code. -::: - -## DAPI-Client - -[![NPM Version](https://img.shields.io/npm/v/@dashevo/dapi-client)](https://www.npmjs.com/package/@dashevo/dapi-client) -[![Build Status](https://github.com/dashevo/js-dapi-client/actions/workflows/test_and_release.yml/badge.svg)](https://github.com/dashevo/js-dapi-client/actions/workflows/test_and_release.yml) -[![Release Date](https://img.shields.io/github/release-date/dashpay/platform)](https://github.com/dashpay/platform/releases/latest) -[![standard-readme compliant](https://img.shields.io/badge/readme%20style-standard-brightgreen)](https://github.com/RichardLitt/standard-readme) - -Client library used to access Dash DAPI endpoints - -This library enables HTTP-based interaction with the Dash blockchain and Dash Platform via the decentralized API ([DAPI](https://github.com/dashpay/platform/tree/master/packages/dapi)) hosted on Dash masternodes. - -- `DAPI-Client` provides automatic server (masternode) discovery using either a default seed node or a user-supplied one -- `DAPI-Client` maps to DAPI's [RPC](https://github.com/dashpay/platform/tree/master/packages/dapi/lib/rpcServer/commands) and [gRPC](https://github.com/dashpay/platform/tree/master/packages/dapi/lib/grpcServer/handlers) endpoints - -### Install - -### ES5/ES6 via NPM - -In order to use this library in Node, you will need to add it to your project as a dependency. - -Having [NodeJS](https://nodejs.org/) installed, just type in your terminal : - -```sh -npm install @dashevo/dapi-client -``` - -### CDN Standalone - -For browser usage, you can also directly rely on unpkg : - -``` - -``` - -## Licence - -[MIT](https://github.com/dashevo/dapi-client/blob/master/LICENCE.md) © Dash Core Group, Inc. \ No newline at end of file diff --git a/docs/dapi-client-js/quick-start.md b/docs/dapi-client-js/quick-start.md deleted file mode 100644 index cdbf81f56..000000000 --- a/docs/dapi-client-js/quick-start.md +++ /dev/null @@ -1,41 +0,0 @@ -:::{attention} -This documentation is based on the [docs directory in the repository](https://github.com/dashpay/platform/tree/master/packages/js-dapi-client/docs) and may not always reflect recent code changes. For the most up-to-date information, please refer to the latest version of the code. -::: - -# Quick start - -## ES5/ES6 via NPM - -In order to use this library in Node, you will need to add it to your project as a dependency. - -Having [NodeJS](https://nodejs.org/) installed, just type in your terminal : - -```sh -npm install @dashevo/dapi-client -``` - -## CDN Standalone - -For browser usage, you can also directly rely on unpkg : - -``` - -``` - -You can see an [example usage here](https://github.com/dashpay/platform/blob/master/packages/js-dapi-client/examples/web/web.usage.html) . - -## Initialization - -```js -const DAPIClient = require('@dashevo/dapi-client'); -const client = new DAPIClient({ network: 'testnet' }); - -(async () => { - const bestBlockHash = await client.core.getBestBlockHash(); - console.log(bestBlockHash); -})(); -``` - -## Quicknotes - -This package allows you to fetch & send information from both the payment chain (layer 1) and the application chain (layer 2, a.k.a Platform chain). \ No newline at end of file diff --git a/docs/dapi-client-js/usage/core/broadcasttransaction.md b/docs/dapi-client-js/usage/core/broadcasttransaction.md deleted file mode 100644 index 6d9e12d03..000000000 --- a/docs/dapi-client-js/usage/core/broadcasttransaction.md +++ /dev/null @@ -1,17 +0,0 @@ -# broadcastTransaction - -**Usage**: `await client.core.broadcastTransaction(transaction)` -**Description**: Allow to broadcast a valid **signed** transaction to the network. - -Parameters: - -| parameters | type | required | Description | -| ------------------------- | ------- | ---------- | ---------------------------------------------------------------------------------------------------------------- | -| **transaction** | Buffer | yes | A valid Buffer representation of a transaction | -| **options** | Object | | | -| **options.allowHighFees** | Boolean | no[=false] | As safety measure, "absurd" fees are rejected when considered to high. This allow to overwrite that comportement | -| **options.bypassLimits** | Boolean | no[=false] | Allow to bypass default transaction policy rules limitation | - -Returns : transactionId (string). - -N.B : The TransactionID provided is subject to [transaction malleability](https://docs.dash.org/en/stable/docs/core/guide/transactions-transaction-malleability.html), and is not a source of truth (the transaction might be included in a block with a different txid). \ No newline at end of file diff --git a/docs/dapi-client-js/usage/core/core.md b/docs/dapi-client-js/usage/core/core.md deleted file mode 100644 index 3e521f133..000000000 --- a/docs/dapi-client-js/usage/core/core.md +++ /dev/null @@ -1,22 +0,0 @@ -# Core - -:::{attention} -This documentation is based on the [docs directory in the repository](https://github.com/dashpay/platform/tree/master/packages/js-dapi-client/docs) and may not always reflect recent code changes. For the most up-to-date information, please refer to the latest version of the code. -::: - -```{toctree} -:maxdepth: 2 -:titlesonly: - - -broadcasttransaction -getbestblockhash -getblockbyhash -getblockbyheight -getblockhash -getstatus -gettransaction -subscribetoblockheaderswithchainlocks -subscribetomasternodelist -subscribetotransactionswithproofs -``` diff --git a/docs/dapi-client-js/usage/core/getbestblockhash.md b/docs/dapi-client-js/usage/core/getbestblockhash.md deleted file mode 100644 index 86a673a66..000000000 --- a/docs/dapi-client-js/usage/core/getbestblockhash.md +++ /dev/null @@ -1,12 +0,0 @@ -# getBestBlockHash - -**Usage**: `await client.core.getBestBlockHash(options)` -**Description**: Allow to fetch the best (highest/latest block hash) from the network - -Parameters: - -| parameters | type | required | Description | -| ----------- | ----------------- | -------- | ----------- | -| **options** | DAPIClientOptions | no | | - -Returns : {Promise} - The best block hash \ No newline at end of file diff --git a/docs/dapi-client-js/usage/core/getblockbyhash.md b/docs/dapi-client-js/usage/core/getblockbyhash.md deleted file mode 100644 index f5518ab86..000000000 --- a/docs/dapi-client-js/usage/core/getblockbyhash.md +++ /dev/null @@ -1,13 +0,0 @@ -# getBlockByHash - -**Usage**: `await client.core.getBlockByHash(hash, options)` -**Description**: Allow to fetch a specific block by its hash - -Parameters: - -| parameters | type | required | Description | -| ----------- | ----------------- | -------- | ------------------ | -| **hash** | String | yes | A valid block hash | -| **options** | DAPIClientOptions | no | | - -Returns : {Promise\} - The specified bufferized block \ No newline at end of file diff --git a/docs/dapi-client-js/usage/core/getblockbyheight.md b/docs/dapi-client-js/usage/core/getblockbyheight.md deleted file mode 100644 index 61ffc1108..000000000 --- a/docs/dapi-client-js/usage/core/getblockbyheight.md +++ /dev/null @@ -1,13 +0,0 @@ -# getBlockByHeight - -**Usage**: `await client.core.getBlockByHeight(height, options)` -**Description**: Allow to fetch a specific block by its height - -Parameters: - -| parameters | type | required | Description | -| ----------- | ----------------- | -------- | -------------------- | -| **height** | Number | yes | A valid block height | -| **options** | DAPIClientOptions | no | | - -Returns : {Promise\} - The specified bufferized block \ No newline at end of file diff --git a/docs/dapi-client-js/usage/core/getblockhash.md b/docs/dapi-client-js/usage/core/getblockhash.md deleted file mode 100644 index 4f2ad087e..000000000 --- a/docs/dapi-client-js/usage/core/getblockhash.md +++ /dev/null @@ -1,13 +0,0 @@ -# getBlockHash - -**Usage**: `await client.core.getBlockHash(height, options)` -**Description**: Allow to fetch a specific block hash from its height - -Parameters: - -| parameters | type | required | Description | -| ----------- | ----------------- | -------- | -------------------- | -| **height** | Number | yes | A valid block height | -| **options** | DAPIClientOptions | no | | - -Returns : {Promise\} - the corresponding block hash \ No newline at end of file diff --git a/docs/dapi-client-js/usage/core/getstatus.md b/docs/dapi-client-js/usage/core/getstatus.md deleted file mode 100644 index 9ba84315a..000000000 --- a/docs/dapi-client-js/usage/core/getstatus.md +++ /dev/null @@ -1,31 +0,0 @@ -# getStatus - -**Usage**: `await client.core.getStatus(options)` -**Description**: Allow to fetch a specific block hash from its height - -Parameters: - -| parameters | type | required | Description | -| ----------- | ----------------- | -------- | ----------- | -| **options** | DAPIClientOptions | no | | - -Returns : {Promise} - Status object - -```js -const status = await client.core.getStatus() -/** -{ - coreVersion: 150000, - protocolVersion: 70216, - blocks: 10630, - timeOffset: 0, - connections: 58, - proxy: '', - difficulty: 0.001745769130443678, - testnet: false, - relayFee: 0.00001, - errors: '', - network: 'testnet' -} -**/ -``` \ No newline at end of file diff --git a/docs/dapi-client-js/usage/core/gettransaction.md b/docs/dapi-client-js/usage/core/gettransaction.md deleted file mode 100644 index 12e81f651..000000000 --- a/docs/dapi-client-js/usage/core/gettransaction.md +++ /dev/null @@ -1,13 +0,0 @@ -# getTransaction - -**Usage**: `await client.core.getTransaction(id, options)` -**Description**: Allow to fetch a transaction by ID - -Parameters: - -| parameters | type | required | Description | -| ----------- | ----------------- | -------- | ------------------------------- | -| **id** | string | yes | A valid transaction id to fetch | -| **options** | DAPIClientOptions | no | | - -Returns : {Promise\} - The bufferized transaction \ No newline at end of file diff --git a/docs/dapi-client-js/usage/core/subscribetoblockheaderswithchainlocks.md b/docs/dapi-client-js/usage/core/subscribetoblockheaderswithchainlocks.md deleted file mode 100644 index db87e9f4d..000000000 --- a/docs/dapi-client-js/usage/core/subscribetoblockheaderswithchainlocks.md +++ /dev/null @@ -1,40 +0,0 @@ -# subscribeToBlockHeadersWithChainLocks - -**Usage**: `await client.core.subscribeToBlockHeadersWithChainLocks(options = { count: 0 })`\ -**Description**: Returns a ClientReadableStream streaming of block headers and chainlocks. - -Parameters: - -| parameters | type | required | Description | -|----------------------------|------------------|----------------| ------------------------------------------------------------------------------------------------ | -| **options.fromBlockHash** | String | yes | Specifies block hash to start syncing from | -| **options.fromBlockHeight**| Number | yes | Specifies block height to start syncing from | -| **options.count** | Number | no (default: 0)| Number of blocks to sync, if set to 0 syncing is continuously sends new data as well | - -Returns : Promise|!grpc.web.ClientReadableStream - -Example : - -```js -const { BlockHeader, ChainLock } = require('@dashevo/dashcore-lib'); - -const stream = await client.subscribeToBlockHeadersWithChainLocks({ fromBlockHeight: 0 }); - -stream - .on('data', (response) => { - const rawHeaders = response.getBlockHeaders(); - const rawChainLock = response.getChainLock(); - - if (headers.length > 0) { - const headers = rawHeaders.map((rawHeader) => new BlockHeader(rawHeader)); - console.dir(headers); - } - - if (rawChainLock) { - const chainLock = new ChainLock(rawChainLock); - } - }) - .on('error', (err) => { - // do something with err - }); -``` diff --git a/docs/dapi-client-js/usage/core/subscribetomasternodelist.md b/docs/dapi-client-js/usage/core/subscribetomasternodelist.md deleted file mode 100644 index f79737eac..000000000 --- a/docs/dapi-client-js/usage/core/subscribetomasternodelist.md +++ /dev/null @@ -1,26 +0,0 @@ -# subscribeToMasternodeList - -**Usage**: `await client.core.subscribeToMasternodeList(options = {})`\ -**Description**: Returns a ClientReadableStream streaming of masternode list diffs ([DIP-4](https://github.com/dashpay/dips/blob/master/dip-0004.md)). As a first message it returns a diff from the first block to the current tip and a diff for each new chainlocked block. - -Returns : Promise|!grpc.web.ClientReadableStream - -Example : - -```js -const { SimplifiedMNList, SimplifiedMNListDiff } = require('@dashevo/dashcore-lib'); - -const stream = await client.subscribeToMasternodeList(); - -const list = new SimplifiedMNList(); - -stream - .on('data', (response) => { - const diffBuffer = Buffer.from(response.getMasternodeListDiff_asU8()); - const diff = new SimplifiedMNListDiff(diffBuffer); - list.applyDiff(diff); - }) - .on('error', (err) => { - // do something with err - }); -``` diff --git a/docs/dapi-client-js/usage/core/subscribetotransactionswithproofs.md b/docs/dapi-client-js/usage/core/subscribetotransactionswithproofs.md deleted file mode 100644 index e6d10adc0..000000000 --- a/docs/dapi-client-js/usage/core/subscribetotransactionswithproofs.md +++ /dev/null @@ -1,49 +0,0 @@ -# subscribeToTransactionsWithProofs - -**Usage**: `await client.core.subscribeToTransactionsWithProofs(bloomFilter, options = { count: 0 })` -**Description**: For any provided bloomfilter, it will return a ClientReadableStream streaming the transaction matching the filter. - -Parameters: - -| parameters | type | required | Description | -|----------------------------|------------------|----------------| ------------------------------------------------------------------------------------------------ | -| **bloomFilter.vData** | Uint8Array/Array | yes | The filter itself is simply a bit field of arbitrary byte-aligned size. The maximum size is 36,000 bytes. | -| **bloomFilter.nHashFuncs** | Number | yes | The number of hash functions to use in this filter. The maximum value allowed in this field is 50. | -| **bloomFilter.nTweak** | Number | yes | A random value to add to the seed value in the hash function used by the bloom filter. | -| **bloomFilter.nFlags** | Number | yes | A set of flags that control how matched items are added to the filter. | -| **options.fromBlockHash** | String | yes | Specifies block hash to start syncing from | -| **options.fromBlockHeight**| Number | yes | Specifies block height to start syncing from | -| **options.count** | Number | no (default: 0)| Number of blocks to sync, if set to 0 syncing is continuously sends new data as well | - -Returns : Promise|!grpc.web.ClientReadableStream - -Example : - -```js -const { BloomFilter, Transaction, MerkleBlock } = require('@dashevo/dashcore-lib'); - -const filter = BloomFilter.create(1, 0.001); // A BloomFilter object -const stream = await client.subscribeToTransactionsWithProofs(filter, { fromBlockHeight: 0 }); - -stream - .on('data', (response) => { - const rawMerkleBlock = response.getRawMerkleBlock(); - const rawTransactions = response.getRawTransactions(); - - if (merkleBlock) { - const merkleBlock = new MerkleBlock(rawMerkleBlock); - console.dir(merkleBlock); - } - - if (transactions.length > 0) { - // tx are probabilistic, so you will have to verify it's yours - const transactions = transactions.getTransactionsList() - .map((tx) => new Transaction(Buffer.from(tx))); - - console.dir(transactions); - } - }) - .on('error', (err) => { - // do something with err - }); -``` diff --git a/docs/dapi-client-js/usage/dapiclient.md b/docs/dapi-client-js/usage/dapiclient.md deleted file mode 100644 index ee576394d..000000000 --- a/docs/dapi-client-js/usage/dapiclient.md +++ /dev/null @@ -1,27 +0,0 @@ -# DAPIClient - -**Usage**: `new DAPIClient(options)` -**Description**: This method creates a new DAPIClient instance. - -Parameters: - -| parameters | type | required[def value] | Description | -| :------------------------------ | :------------------ | :-------------------------- | :--------------------------------------------------------------------------------------------- | -| **options** | Object | | | -| **options.dapiAddressProvider** | DAPIAddressProvider | no[ListDAPIAddressProvider] | Allow to override the default dapiAddressProvider (do not allow seeds or dapiAddresses params) | -| **options.seeds** | string\[] | no[seeds] | Allow to override default seeds (to connect to specific node) | -| **options.network** | string | no[=evonet] | Allow to setup the network to be used (livenet, testnet, evonet,..) | -| **options.timeout** | number | no[=2000] | Used to specify the timeout time in milliseconds. | -| **options.retries** | number | no[=3] | Used to specify the number of retries before aborting and erroring a request. | -| **options.baseBanTime** | number | no[=6000] | | - -Returns : DAPIClient instance. - -```js -const DAPIClient = require('@dashevo/dapi-client'); -const client = new DAPIClient({ - timeout: 5000, - retries: 3, - network: 'livenet' -}); -``` \ No newline at end of file diff --git a/docs/dapi-client-js/usage/platform/broadcaststatetransition.md b/docs/dapi-client-js/usage/platform/broadcaststatetransition.md deleted file mode 100644 index 344514f2f..000000000 --- a/docs/dapi-client-js/usage/platform/broadcaststatetransition.md +++ /dev/null @@ -1,13 +0,0 @@ -# broadcastStateTransition - -**Usage**: `async client.platform.broadcastStateTransition(stateTransition, options)` -**Description**: Send State Transition to machine - -Parameters: - -| parameters | type | required | Description | -| ------------------- | ----------------- | -------- | ----------------------------------- | -| **stateTransition** | Buffer | yes | A valid bufferized state transition | -| **options** | DAPIClientOptions | no | A valid state transition | - -Returns : Promise\ \ No newline at end of file diff --git a/docs/dapi-client-js/usage/platform/getdatacontract.md b/docs/dapi-client-js/usage/platform/getdatacontract.md deleted file mode 100644 index 4ad46924a..000000000 --- a/docs/dapi-client-js/usage/platform/getdatacontract.md +++ /dev/null @@ -1,12 +0,0 @@ -# getDataContract - -**Usage**: `async client.platform.getDataContract(contractId)` -**Description**: Fetch Data Contract by id - -Parameters: - -| parameters | type | required | Description | -| -------------- | ------ | -------- | ----------------------------- | -| **contractId** | String | yes | A valid registered contractId | - -Returns : Promise \ No newline at end of file diff --git a/docs/dapi-client-js/usage/platform/getdocuments.md b/docs/dapi-client-js/usage/platform/getdocuments.md deleted file mode 100644 index a46d31022..000000000 --- a/docs/dapi-client-js/usage/platform/getdocuments.md +++ /dev/null @@ -1,18 +0,0 @@ -# getDocuments - -**Usage**: `async client.platform.getDocuments(contractId, type, options)` -**Description**: Fetch Documents from Drive - -Parameters: - -| parameters | type | required | Description | -| ---------------------- | ------ | -------- | -------------------------------------------------- | -| **contractId** | String | yes | A valid registered contractId | -| **type** | String | yes | DAP object type to fetch (e.g: 'preorder' in DPNS) | -| **options.where** | Object | yes | Mongo-like query | -| **options.orderBy** | Object | yes | Mongo-like sort field | -| **options.limit** | Number | yes | Limit the number of object to fetch | -| **options.startAt** | Number | yes | number of objects to skip | -| **options.startAfter** | Number | yes | exclusive skip | - -Returns : Promise\ \ No newline at end of file diff --git a/docs/dapi-client-js/usage/platform/getidentity.md b/docs/dapi-client-js/usage/platform/getidentity.md deleted file mode 100644 index 1e0937ce4..000000000 --- a/docs/dapi-client-js/usage/platform/getidentity.md +++ /dev/null @@ -1,12 +0,0 @@ -# getIdentity - -**Usage**: `async client.platform.getIdentity(id)` -**Description**: Fetch the identity by id - -Parameters: - -| parameters | type | required | Description | -| ---------- | ------ | -------- | --------------------------- | -| **id** | String | yes | A valid registered identity | - -Returns : Promise\ \ No newline at end of file diff --git a/docs/dapi-client-js/usage/platform/getidentitybyfirstpublickey.md b/docs/dapi-client-js/usage/platform/getidentitybyfirstpublickey.md deleted file mode 100644 index 72d237c20..000000000 --- a/docs/dapi-client-js/usage/platform/getidentitybyfirstpublickey.md +++ /dev/null @@ -1,12 +0,0 @@ -# getIdentityByFirstPublicKey - -**Usage**: `async client.platform.getIdentityByFirstPublicKey(publicKeyHash)` -**Description**: Fetch the identity using the public key hash of the identity's first key - -Parameters: - -| parameters | type | required | Description | -| ----------------- | ------ | -------- | ----------------------- | -| **publicKeyHash** | String | yes | A valid public key hash | - -Returns : Promise\ \ No newline at end of file diff --git a/docs/dapi-client-js/usage/platform/getidentityidbyfirstpublickey.md b/docs/dapi-client-js/usage/platform/getidentityidbyfirstpublickey.md deleted file mode 100644 index 0d8c0f167..000000000 --- a/docs/dapi-client-js/usage/platform/getidentityidbyfirstpublickey.md +++ /dev/null @@ -1,12 +0,0 @@ -# getIdentityIdByFirstPublicKey - -**Usage**: `async client.platform.getIdentityIdByFirstPublicKey(publicKeyHash)` -**Description**: Fetch the identity ID using the public key hash of the identity's first key - -Parameters: - -| parameters | type | required | Description | -| ----------------- | ------ | -------- | ----------------------- | -| **publicKeyHash** | String | yes | A valid public key hash | - -Returns : Promise\ \ No newline at end of file diff --git a/docs/dapi-client-js/usage/platform/platform.md b/docs/dapi-client-js/usage/platform/platform.md deleted file mode 100644 index bfca147ce..000000000 --- a/docs/dapi-client-js/usage/platform/platform.md +++ /dev/null @@ -1,18 +0,0 @@ -# Platform - -:::{attention} -This documentation is based on the [docs directory in the repository](https://github.com/dashpay/platform/tree/master/packages/js-dapi-client/docs) and may not always reflect recent code changes. For the most up-to-date information, please refer to the latest version of the code. -::: - -```{toctree} -:maxdepth: 2 -:titlesonly: - - -broadcaststatetransition -getdatacontract -getdocuments -getidentity -getidentitybyfirstpublickey -getidentityidbyfirstpublickey -``` diff --git a/docs/dapi-client-js/usage/usage.md b/docs/dapi-client-js/usage/usage.md deleted file mode 100644 index a01f9a427..000000000 --- a/docs/dapi-client-js/usage/usage.md +++ /dev/null @@ -1,14 +0,0 @@ -# Usage - -:::{attention} -This documentation is based on the [docs directory in the repository](https://github.com/dashpay/platform/tree/master/packages/js-dapi-client/docs) and may not always reflect recent code changes. For the most up-to-date information, please refer to the latest version of the code. -::: - -```{toctree} -:maxdepth: 2 -:titlesonly: - -dapiclient -core/core -platform/platform -``` diff --git a/docs/index.md b/docs/index.md index 9766b0b08..2961ebc84 100644 --- a/docs/index.md +++ b/docs/index.md @@ -70,26 +70,6 @@ cryptocurrency. Let's jump right in! +++ :ref:`Click to begin ` - - .. grid-item-card:: 🛠️ Dash SDK - :margin: 2 2 auto auto - :link-type: ref - :link: sdk-js-index - - JavaScript SDK documentation - - +++ - :ref:`Click to begin ` - - .. grid-item-card:: 🛠️ DAPI Client - :margin: 2 2 auto auto - :link-type: ref - :link: dapi-client-js-index - - JavaScript DAPI-Client documentation - - +++ - :ref:`Click to begin ` ``` ```{toctree} @@ -185,20 +165,6 @@ resources/source-code Previous Version of Docs ``` -```{toctree} -:maxdepth: 2 -:titlesonly: -:caption: JavaScript SDK -:hidden: - -sdk-js/overview -sdk-js/examples/examples -sdk-js/getting-started/getting-started -sdk-js/platform/platform -sdk-js/usage/usage -sdk-js/wallet/wallet -``` - ```{toctree} :maxdepth: 2 :titlesonly: @@ -208,14 +174,3 @@ sdk-js/wallet/wallet sdk-rs/overview sdk-rs/quick-start ``` - -```{toctree} -:maxdepth: 2 -:titlesonly: -:caption: DAPI Client -:hidden: - -dapi-client-js/overview -dapi-client-js/quick-start -dapi-client-js/usage/usage -``` diff --git a/docs/sdk-js/examples/examples.md b/docs/sdk-js/examples/examples.md deleted file mode 100644 index e3aac57c3..000000000 --- a/docs/sdk-js/examples/examples.md +++ /dev/null @@ -1,13 +0,0 @@ -# Examples - -```{toctree} -:maxdepth: 2 -:titlesonly: - -fetch-an-identity-from-its-name -generate-a-new-mnemonic -paying-to-another-address -receive-money-and-check-balance -sign-and-verify-messages -use-different-account -``` diff --git a/docs/sdk-js/examples/fetch-an-identity-from-its-name.md b/docs/sdk-js/examples/fetch-an-identity-from-its-name.md deleted file mode 100644 index aa4700dd3..000000000 --- a/docs/sdk-js/examples/fetch-an-identity-from-its-name.md +++ /dev/null @@ -1,17 +0,0 @@ -# Fetching an identity from its name - -Assuming you have created an identity and attached a name to it (see how to [register an identity](../../tutorials/identities-and-names/register-an-identity.md) and how to [attach it to a name](../../tutorials/identities-and-names/register-a-name-for-an-identity.md)), you will then be able to directly recover an identity from its names. See below: - -```js -const client = new Dash.Client({ - wallet: { - mnemonic: '', // Your app mnemonic, which holds the identity - }, -}); - -// This is the name previously registered in DPNS. -const identityName = 'alice'; - -const nameDocument = await client.platform.names.resolve(`${identityName}.dash`); -const identity = await client.platform.identities.get(nameDocument.ownerId); -``` diff --git a/docs/sdk-js/examples/generate-a-new-mnemonic.md b/docs/sdk-js/examples/generate-a-new-mnemonic.md deleted file mode 100644 index 3d38f5c5b..000000000 --- a/docs/sdk-js/examples/generate-a-new-mnemonic.md +++ /dev/null @@ -1,48 +0,0 @@ -# Generate a new mnemonic - -In order to be able to keep your private keys private, we encourage to create your own mnemonic instead of using those from the examples (that might be empty). -Below, you will be proposed two options allowing you to create a new mnemonic, depending on the level of customisation you need. - -## Dash.Client - -By passing `null` to the mnemonic value of the wallet options, you can get Wallet-lib to generate a new mnemonic for you. - -```js -const Dash = require("dash"); -const client = new Dash.Client({ - network: "testnet", - wallet: { - mnemonic: null, - }, -}); -const mnemonic = client.wallet.exportWallet(); -console.log({mnemonic}); -``` - -## Dash.Mnemonic - -```js -const Dash = require("dash"); -const {Mnemonic} = Dash.Core; - -const mnemnonic = new Mnemonic().toString() -``` - -### Language selection - -```js -const {Mnemonic} = Dash.Core; -const {CHINESE, ENGLISH, FRENCH, ITALIAN, JAPANESE, SPANISH} = Mnemonic.Words; -console.log(new Mnemonic(Mnemonic.Words.FRENCH).toString()) -``` - -### Entropy size - -By default, the value for mnemonic is `128` (12 words), but you can generate a 24 words (or other) : - -```js -const {Mnemonic} = Dash.Core; -console.log(new Mnemonic(256).toString()) -``` - -You can even replace the word list by your own, providing a list of 2048 unique words. diff --git a/docs/sdk-js/examples/paying-to-another-address.md b/docs/sdk-js/examples/paying-to-another-address.md deleted file mode 100644 index b31187d8e..000000000 --- a/docs/sdk-js/examples/paying-to-another-address.md +++ /dev/null @@ -1,28 +0,0 @@ -# Paying to another address - -In order to pay, you need to have an [existing balance](../examples/receive-money-and-check-balance.md). -The below code will allow you to pay to a single address a specific amount of satoshis. - -```js -const Dash = require('dash'); - -const mnemonic = ''; // your mnemonic here. -const client = new Dash.Client({ - wallet: { - mnemonic, - }, -}); - -async function payToRecipient(account) { - const transaction = account.createTransaction({ - recipient: 'yNPbcFfabtNmmxKdGwhHomdYfVs6gikbPf', - satoshis: 10000, - }); - const transactionId = await account.broadcastTransaction(transaction); -} - -client.wallet.getAccount().then(payToRecipient); - -``` - -See more on create [transaction options here](https://dashpay.github.io/platform/Wallet-library/account/createTransaction/). diff --git a/docs/sdk-js/examples/receive-money-and-check-balance.md b/docs/sdk-js/examples/receive-money-and-check-balance.md deleted file mode 100644 index c32808512..000000000 --- a/docs/sdk-js/examples/receive-money-and-check-balance.md +++ /dev/null @@ -1,92 +0,0 @@ -# Receive money and display balance - -## Initialize client - -Initialize the SDK Client with your [generated mnemonic](../examples/generate-a-new-mnemonic.md) passed as an option. - -```js -const Dash = require("dash"); -const mnemonic = ''// your mnemonic here. -const client = new Dash.Client({ - wallet: { - mnemonic, - } -}); - -async function showBalance() { - const account = await client.wallet.getAccount(); - const totalBalance = account.getTotalBalance(); - console.log(`Account's total balance: ${totalBalance} duffs`); -} -``` - -Having your `client` instance set up, you will be able to access the `account` and `wallet` instance generated from your mnemonic. - -By default `getAccount()` returns the first BIP44 account. -You can read more on [how to use a different account](../examples/use-different-account.md). - -## Generate a receiving address - -Dash wallet supports two different types of addresses: - -- `external` addresses used for receiving funds from other addresses -- `internal` addresses used for change outputs of outgoing transactions -- For your privacy, you might want to generate a new address for each payment: - -```js -async function generateUnusedAddress() { - const account = await client.wallet.getAccount(); - const { address } = account.getUnusedAddress(); - console.log(`Unused external address: ${address}`); -} -``` - -This above code will generate a new unique (never used) address. - -## Displaying your balance - -_Dash Wallet returns the balance in duffs (1 Dash is equal to 100.000.000 duffs)_ - -`getTotalBalance()` function takes into account `confirmed` and `unconfirmed` transactions (not included in a block). -It is recommended to check the confirmed balance before making a payment: - -```js -async function showBalance() { - const account = await client.wallet.getAccount(); - const totalBalance = account.getTotalBalance(); - const confirmedBalance = account.getConfirmedBalance(); - const unconfirmedBalance = account.getUnconfirmedBalance(); - console.log(`Account balance: - Confirmed: ${confirmedBalance} - Unconfirmed: ${unconfirmedBalance} - Total: ${totalBalance} - `); -} -``` - -## Listen for event on received transaction - -When a new unconfirmed transaction is received, you can receive an event, and then validate the address or perform an action if needed. - -```js -// FETCHED/UNCONFIRMED_TRANSACTION event is currently disabled - -async function listenUnconfirmedTransaction() { - const account = await client.wallet.getAccount(); - account.on('FETCHED/UNCONFIRMED_TRANSACTION', (data) => { - console.dir(data); - }); -} -``` - -## Get address at specific index - -In case you want to retrieve an address at specific index: - -```js -async function getAddressAtIndex() { - const account = await client.wallet.getAccount(); - const { address: externalAddress } = account.getAddress(2); - const { address: internalAddress } = account.getAddress(2, 'internal'); -} -``` diff --git a/docs/sdk-js/examples/sign-and-verify-messages.md b/docs/sdk-js/examples/sign-and-verify-messages.md deleted file mode 100644 index 89274ca26..000000000 --- a/docs/sdk-js/examples/sign-and-verify-messages.md +++ /dev/null @@ -1,24 +0,0 @@ -# Sign and verify messages - -Dash SDK exports the Message constructor inside the Core namespace `new Dash.Core.Message` - -```js -const Dash = require('dash'); - -const mnemonic = ''; - -const client = new Dash.Client({ - wallet: { - mnemonic, - }, -}); - -async function signAndVerify() { - const account = await client.wallet.getAccount(); - - const pk = new Dash.Core.PrivateKey(); - const message = new Dash.Core.Message('hello, world'); - const signed = account.sign(message, pk); - const verified = message.verify(pk.toAddress().toString(), signed.toString()); -} -``` diff --git a/docs/sdk-js/examples/use-different-account.md b/docs/sdk-js/examples/use-different-account.md deleted file mode 100644 index e316a0e98..000000000 --- a/docs/sdk-js/examples/use-different-account.md +++ /dev/null @@ -1,11 +0,0 @@ -# Using a different account - -Clients initialized with a mnemonic support multiple accounts as defined in [BIP44](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki). - -By default `client.wallet.getAccount()` returns the account at index `0`. - -To access other accounts, pass the `index` option: - -``` -const secondAccount = await client.wallet.getAccount({ index: 1 }) -``` \ No newline at end of file diff --git a/docs/sdk-js/getting-started/about-schemas.md b/docs/sdk-js/getting-started/about-schemas.md deleted file mode 100644 index 566d8f2ad..000000000 --- a/docs/sdk-js/getting-started/about-schemas.md +++ /dev/null @@ -1,5 +0,0 @@ -# About Schemas - -Schemas represents the application data structure, a JSON Schema language based set of rules that allows the creation of a Data Contract. - -You can read more in the [Dash Platform Documentation - Data contract section](../../explanations/platform-protocol-data-contract.md). diff --git a/docs/sdk-js/getting-started/core-concepts.md b/docs/sdk-js/getting-started/core-concepts.md deleted file mode 100644 index 2f1cca7b2..000000000 --- a/docs/sdk-js/getting-started/core-concepts.md +++ /dev/null @@ -1,30 +0,0 @@ -# Core concepts - -The [Dash Core Developer Guide](https://docs.dash.org/en/stable/docs/core/guide/introduction.html) will answer most of questions about the fundamentals of Dash. However, some elements provided by the SDK need to be grasped, so we will quickly cover some of those. - -## Wallet - -At the core of Dash is the Payment Chain. In order to be able to transact on it, one needs to have a set of [UTXOs](https://docs.dash.org/en/stable/docs/core/guide/block-chain-transaction-data.html) that are controlled by a Wallet instance. - -In order to access your UTXO, you will have to provide a valid mnemonic that will unlock the Wallet and automatically fetch the associated UTXOs. - -When an SDK instance is created, you can access your wallet via the `client.wallet` variable. (Check [wallet-lib documentation](https://dashpay.github.io/platform/Wallet-library/) for more details) - -## Account - -Since the introduction of deterministic wallets ([BIP44](https://github.com/bitcoin/bips/blob/master/bip-0044.mediawiki)), a wallet is represented by multiple accounts. - -It is the instance you will use most of the time for receiving or broadcasting payments. - -You can access your account with `client.getWalletAccount()`. See [how to use a different account](../examples/use-different-account.md) if you need to get an account at a specific index. - -## App Schema and Contracts - -The Dash Platform Chain provides developers with the ability to create applications. -Each application requires a set of rules and conditions described as a portable document in the form of a JSON Schema. - -When registered, those applications schemas are called contracts and contains a contractId (namespace : `client.platform.contracts`). - -By default, this library supports Dash Platform Name Service (DPNS) (to attach a name to an identity), under the namespace `client.platform.names` for testnet. - -See: [how to use multiple apps](../getting-started/working-with-multiple-apps.md) diff --git a/docs/sdk-js/getting-started/dash-platform-applications.md b/docs/sdk-js/getting-started/dash-platform-applications.md deleted file mode 100644 index 335dee6dd..000000000 --- a/docs/sdk-js/getting-started/dash-platform-applications.md +++ /dev/null @@ -1,9 +0,0 @@ -# Dash Platform applications - -## DPNS - -DPNS is handled in the Dash SDK Client under the namespace `client.platform.names.*'`. [Read more here](../platform/names/names.md) - -## DashPay - -The DashPay contract is registered on testnet under contract id `Bwr4WHCPz5rFVAD87RqTs3izo4zpzwsEdKPWUT1NS1C7`. Its functionality is not incorporated with the Dash SDK at this time. diff --git a/docs/sdk-js/getting-started/getting-started.md b/docs/sdk-js/getting-started/getting-started.md deleted file mode 100644 index d77eb3fcf..000000000 --- a/docs/sdk-js/getting-started/getting-started.md +++ /dev/null @@ -1,12 +0,0 @@ -# Getting started - -```{toctree} -:maxdepth: 2 - -about-schemas -core-concepts -dash-platform-applications -working-with-multiple-apps -quick-start -with-typescript -``` diff --git a/docs/sdk-js/getting-started/quick-start.md b/docs/sdk-js/getting-started/quick-start.md deleted file mode 100644 index f2f9f4d25..000000000 --- a/docs/sdk-js/getting-started/quick-start.md +++ /dev/null @@ -1,45 +0,0 @@ -# Quick start - -In order to use this library, you will need to add our [NPM package](https://www.npmjs.com/dash) to your project. - -Having [NodeJS](https://nodejs.org/) installed, just type : - -```bash -npm install dash -``` - -## Initialization - -Let's create a Dash SDK client instance specifying both our mnemonic and the schema we wish to work with. - -```js -const Dash = require('dash'); -const opts = { - wallet: { - mnemonic: "arena light cheap control apple buffalo indicate rare motor valid accident isolate", - }, -}; -const client = new Dash.Client(opts); -client.wallet.getAccount().then(async (account) => { - // Do something -}) -``` - -Quick note: -If no `mnemonic` is provided or `mnemonic: null` is passed inside the `wallet` option, a new mnemonic will be generated. - -## Make a payment - -```js -client.wallet.getAccount().then(async (account) => { - const transaction = account.createTransaction({ - recipient: 'yixnmigzC236WmTXp9SBZ42csyp9By6Hw8', - amount: 0.12, - }); - await account.broadcastTransaction(transaction); -}); -``` - -## Interact with Dash Platform - -See the [Tutorial section](../../tutorials/introduction.md) of the Dash Platform documentation for examples. diff --git a/docs/sdk-js/getting-started/with-typescript.md b/docs/sdk-js/getting-started/with-typescript.md deleted file mode 100644 index 4c31af221..000000000 --- a/docs/sdk-js/getting-started/with-typescript.md +++ /dev/null @@ -1,36 +0,0 @@ -# TypeScript - -In order to use Dash SDK with TypeScript. - -Create an index.ts file - -```js -import Dash from 'dash'; -const clientOpts = { - wallet: { - mnemonic: null, // Will generate a new address, you should keep it. - }, -}; -const client = new Dash.Client(clientOpts); - -const initializeAccount = async () => { - const account = await client.wallet.getAccount(); - const balance = account.getTotalBalance(); - console.log(`Account balance: ${balance}`) -} -``` - -Have a following `tsconfig.json` file - -```json -{ - "compilerOptions": { - "module": "commonjs", - "moduleResolution": "node", - "esModuleInterop": true - } -} -``` - -**Compile:** `tsc -p tsconfig.json` -**Run:** `node index.js` diff --git a/docs/sdk-js/getting-started/working-with-multiple-apps.md b/docs/sdk-js/getting-started/working-with-multiple-apps.md deleted file mode 100644 index 32dddf840..000000000 --- a/docs/sdk-js/getting-started/working-with-multiple-apps.md +++ /dev/null @@ -1,23 +0,0 @@ -# Working with multiple apps - -When working with other registered contracts, you will need to know their `contractId` and reference it in the SDK constructor. - -Assuming a contract DashPay has the following `contractId: "77w8Xqn25HwJhjodrHW133aXhjuTsTv9ozQaYpSHACE3"`. -You can then pass it as an option. - -```js -const client = new Dash.Client({ - apps: { - dashpay: { - contractId: '77w8Xqn25HwJhjodrHW133aXhjuTsTv9ozQaYpSHACE3' - } - } -}); -``` - -This allow the method `client.platform.documents.get` to provide you field selection. -Therefore, if the contract has a `profile` field that you wish to access, the SDK will allow you to use dot-syntax for access : - -```js -const bobProfile = await client.platform.documents.get('dashpay.profile', { name: 'bob' }); -``` diff --git a/docs/sdk-js/overview.md b/docs/sdk-js/overview.md deleted file mode 100644 index bd5d891f1..000000000 --- a/docs/sdk-js/overview.md +++ /dev/null @@ -1,54 +0,0 @@ -```{eval-rst} -.. _sdk-js-index: -``` - -# Overview - -[![NPM Version](https://img.shields.io/npm/v/dash)](https://www.npmjs.org/package/dash) -[![Release Packages](https://github.com/dashpay/platform/actions/workflows/release.yml/badge.svg)](https://github.com/dashpay/platform/actions/workflows/release.yml) -[![Release Date](https://img.shields.io/github/release-date/dashpay/platform)](https://github.com/dashpay/platform/releases/latest) -[![standard-readme compliant](https://img.shields.io/badge/readme%20style-standard-brightgreen)](https://github.com/RichardLitt/standard-readme) - -Dash library for JavaScript/TypeScript ecosystem (Wallet, DAPI, Primitives, BLS, ...) - -:::{warning} -The JavaScript SDK should only be used in production when connected to trusted nodes. While it -provides easy access to Dash Platform without requiring a full node, it **_does not support Dash -Platform's proofs or verify synchronized blockchain data_**. Therefore, it is less secure than the -[Rust SDK](../sdk-rs/overview.md), which requests proofs for all queried data. -::: - -Dash library provides access via [DAPI](../explanations/dapi.md) to use both the Dash Core network and Dash Platform on [supported networks](https://github.com/dashpay/platform/#supported-networks). The Dash Core network can be used to broadcast and receive payments. Dash Platform can be used to manage identities, register data contracts for applications, and submit or retrieve application data via documents. - -## Install - -### From NPM - -In order to use this library, you will need to add our [NPM package](https://www.npmjs.com/dash) to your project. - -Having [NodeJS](https://nodejs.org/) installed, just type: - -```bash -npm install dash -``` - -### From unpkg - -```html - -``` - -### Usage examples - -- [Generate a mnemonic](./examples/generate-a-new-mnemonic.md) -- [Receive money and display balance](./examples/receive-money-and-check-balance.md) -- [Pay to another address](./examples/paying-to-another-address.md) -- [Use another BIP44 account](./examples/use-different-account.md) - -### Dash Platform Tutorials - -See the [Tutorial section](../tutorials/introduction.md) of the Dash Platform documentation for examples. - -## Licence - -[MIT](https://github.com/dashevo/dashjs/blob/master/LICENCE.md) © Dash Core Group, Inc. diff --git a/docs/sdk-js/platform/contracts/contracts.md b/docs/sdk-js/platform/contracts/contracts.md deleted file mode 100644 index 161acc681..000000000 --- a/docs/sdk-js/platform/contracts/contracts.md +++ /dev/null @@ -1,17 +0,0 @@ -# Contracts - -## What is a contract - -Contracts are registered sets of rules defined in a [JSON Application Schema](../../getting-started/core-concepts.md). - -See the Dash Platform documentation for more information about [Data Contracts](../../../explanations/platform-protocol-data-contract.md). - -```{toctree} -:maxdepth: 2 - -create -get -history -publish -update -``` diff --git a/docs/sdk-js/platform/contracts/create.md b/docs/sdk-js/platform/contracts/create.md deleted file mode 100644 index 5b17d0fa0..000000000 --- a/docs/sdk-js/platform/contracts/create.md +++ /dev/null @@ -1,38 +0,0 @@ -# Create - -**Usage**: `client.platform.contracts.create(contractDefinitions, identity)` -**Description**: This method will return a Contract object initialized with the parameters defined and apply to the used identity. - -Parameters: - -| Parameters | Type | Required | Description | -| ----------------------- | ---------------- | -------- | ---------------------------------------------------------------------------------------------------------------------- | -| **contractDefinitions** | JSONDataContract | yes | The defined [JSON Application Schema](../../../explanations/platform-protocol-data-contract.md) | -| **identity** | Identity | yes | A valid [registered `application` identity](../identities/register.md) | - -**Example**: - -```js - const identityId = '';// Your identity identifier. - - // Your valid json contract definitions - const contractDefinitions = { - note: { - properties: { - message: { - type: "string" - } - }, - additionalProperties: false - } - }; - const identity = await client.platform.identities.get(identityId); - const contract = client.platform.contracts.create(contractDefinitions, identity); - - // You can use the validate method from DPP to validate the created contract - const validationResult = client.platform.dpp.dataContract.validate(contract); -``` - -**Note**: When your contract is created, it will only exist locally. Use the [publish](../contracts/publish.md) method to register it. - -Returns: Contract. diff --git a/docs/sdk-js/platform/contracts/get.md b/docs/sdk-js/platform/contracts/get.md deleted file mode 100644 index 679830899..000000000 --- a/docs/sdk-js/platform/contracts/get.md +++ /dev/null @@ -1,14 +0,0 @@ -# Get - -**Usage**: `client.platform.contracts.get(contractId)` -**Description**: This method will allow you to fetch back a contract from its id. - -Parameters: - -| Parameters | Type | Required | Description | -| -------------- | ------ | -------- | ---------------------------------------------------- | -| **identifier** | string | yes | Will fetch back the contract matching the identifier | - -**Example**: `await client.platform.contracts.get('77w8Xqn25HwJhjodrHW133aXhjuTsTv9ozQaYpSHACE3')` - -Returns: Contract (or `null` if it's not a registered contract). diff --git a/docs/sdk-js/platform/contracts/history.md b/docs/sdk-js/platform/contracts/history.md deleted file mode 100644 index 6115333c0..000000000 --- a/docs/sdk-js/platform/contracts/history.md +++ /dev/null @@ -1,32 +0,0 @@ -# History - -**Usage**: `client.platform.contracts.history(identifier, startAtMs, limit, offset)` -**Description**: Fetches the historical changes of a Data Contract by its identifier over time. - -Parameters: - -| Parameters | Type | Required | Description | -| -------------- | --------------- | -------- | ---------------------------------------------------------------------------------------------------- | -| **identifier** | string \| Identifier | yes | The identifier of the contract to fetch. Can be a string or an `Identifier` object. | -| **startAtMs** | number | yes | Timestamp in milliseconds from which to start fetching the contract history. | -| **limit** | number | yes | The maximum number of history entries to return. | -| **offset** | number | yes | The number of history entries to skip. Useful for pagination. | - -**Example**: - -```js -const identifier = 'yourContractIdentifier'; // Your Data Contract identifier. -const startAtMs = Date.now() - (24 * 60 * 60 * 1000); // 24 hours ago -const limit = 10; // Maximum number of history entries to fetch -const offset = 0; // Start from the first entry - -const history = await client.platform.contracts.history(identifier, startAtMs, limit, offset); - -if (history) { - console.log('Contract history:', history); -} else { - console.log('Contract not found or no history available.'); -} -``` - -Returns: An object where keys are timestamps of the contract updates and values are the `DataContract` objects representing the state of the contract at that time. Returns `null` if the contract or its history cannot be found. diff --git a/docs/sdk-js/platform/contracts/publish.md b/docs/sdk-js/platform/contracts/publish.md deleted file mode 100644 index 0dbaa44d5..000000000 --- a/docs/sdk-js/platform/contracts/publish.md +++ /dev/null @@ -1,23 +0,0 @@ -# Publish - -**Usage**: `client.platform.contracts.publish(contract, identity)` -**Description**: This method will sign and broadcast any valid contract. - -Parameters: - -| Parameters | Type | Required | Description | -| ------------ | -------- | -------- | -------------------------------------------------------------------------------------------------------- | -| **contract** | Contract | yes | A valid [created contract](../contracts/create.md) | -| **identity** | Identity | yes | A valid [registered `application` identity](../identities/register.md) | - -**Example**: - -```js -const identityId = '';// Your identity identifier. -const identity = await client.platform.identities.get(identityId); -// See the contract.create documentation for more on how to create a dataContract -const contract = await client.platform.contracts.create(contractDefinitions, identity); -await client.platform.contracts.publish(contract, identity); -``` - -Returns : DataContractCreateTransition. diff --git a/docs/sdk-js/platform/contracts/update.md b/docs/sdk-js/platform/contracts/update.md deleted file mode 100644 index 59956f17c..000000000 --- a/docs/sdk-js/platform/contracts/update.md +++ /dev/null @@ -1,13 +0,0 @@ -# Update - -**Usage**: `client.platform.contracts.update(contract, identity)` -**Description**: This method will sign and broadcast an updated valid contract. - -Parameters: - -| Parameters | Type | Required | Description | -| ------------ | -------- | -------- | ------------------------------------------------------------------------------------------------------------- | -| **contract** | Contract | yes | A valid [created contract](../contracts/create.md) | -| **identity** | Identity | yes | A valid [registered `application` identity](../identities/register.md) | - -Returns: DataContractUpdateTransition. diff --git a/docs/sdk-js/platform/documents/broadcast.md b/docs/sdk-js/platform/documents/broadcast.md deleted file mode 100644 index e1e3245a7..000000000 --- a/docs/sdk-js/platform/documents/broadcast.md +++ /dev/null @@ -1,32 +0,0 @@ -# Broadcast - -**Usage**: `client.platform.document.broadcast(documents, identity)` -**Description**: This method will broadcast the document on the Application Chain - -Parameters: - -| Parameters | Type | Required | Description | -| --------------------- | ------------------- | -------- | ----------------------------------------------------------------------------------------------------------- | -| **documents** | Object | yes | | -| **documents.create** | ExtendedDocument\[] | no | array of valid [created document](../documents/create.md) to create | -| **documents.replace** | ExtendedDocument\[] | no | array of valid [created document](../documents/create.md) to replace | -| **documents.delete** | ExtendedDocument\[] | no | array of valid [created document](../documents/create.md) to delete | -| **identity** | Identity | yes | A valid [registered identity](../identities/register.md) | - -**Example**: - -```js -const identityId = '';// Your identity identifier -const identity = await client.platform.identities.get(identityId); - -const helloWorldDocument = await client.platform.documents.create( - // Assuming a contract tutorialContract is registered with a field note - 'tutorialContract.note', - identity, - { message: 'Hello World'}, -); - -await client.platform.documents.broadcast({ create: [helloWorldDocument] }, identity); -``` - -Returns: documents. diff --git a/docs/sdk-js/platform/documents/create.md b/docs/sdk-js/platform/documents/create.md deleted file mode 100644 index 77200900e..000000000 --- a/docs/sdk-js/platform/documents/create.md +++ /dev/null @@ -1,30 +0,0 @@ -# Create - -**Usage**: `client.platform.documents.create(typeLocator, identity, documentOpts)` -**Description**: This method will return a ExtendedDocument object initialized with the parameters defined and apply to the used identity. - -Parameters: - -| Parameters | Type | Required | Description | -| -------------- | -------- | -------- | ----------------------------------------------------------------------------------------------- | -| **dotLocator** | string | yes | Field of a specific application, under the form `appName.fieldName` | -| **identity** | Identity | yes | A valid [registered identity](../identities/register.md) | -| **docOpts** | Object | yes | A valid data that match the data contract structure | - -**Example**: - -```js -const identityId = '';// Your identity identifier -const identity = await client.platform.identities.get(identityId); - -const helloWorldDocument = await client.platform.documents.create( - // Assume a contract helloWorldContract is registered with a field note - 'helloWorldContract.note', - identity, - { message: 'Hello World'}, - ); -``` - -**Note**: When your document is created, it will only exist locally, use the [broadcast](../documents/broadcast.md) method to register it. - -Returns: ExtendedDocument diff --git a/docs/sdk-js/platform/documents/documents.md b/docs/sdk-js/platform/documents/documents.md deleted file mode 100644 index f44b9180f..000000000 --- a/docs/sdk-js/platform/documents/documents.md +++ /dev/null @@ -1,16 +0,0 @@ -# Documents - -## What is a document - -Documents in Dash Platform are similar to those in standard document-oriented databases (MongoDB,...). -They represent a record consisting of one, or multiples field-value pairs and should respect the structure of the dataContract on which they are submitted in. - -See more on the Dash Platform documentation about [Data Contract](../../../explanations/platform-protocol-data-contract.md). - -```{toctree} -:maxdepth: 2 - -broadcast -create -get -``` diff --git a/docs/sdk-js/platform/documents/get.md b/docs/sdk-js/platform/documents/get.md deleted file mode 100644 index 06d1787cf..000000000 --- a/docs/sdk-js/platform/documents/get.md +++ /dev/null @@ -1,35 +0,0 @@ -# Get - -**Usage**: `client.platform.documents.get(typeLocator, opts)` -**Description**: This method will allow you to fetch back documents matching the provided parameters. - -Parameters: - -| Parameters | Type | Required | Description | -| --------------- | ------ | ---------------- | ------------------------------------------------------------------- | -| **typeLocator** | string | yes | Field of a specific application, under the form `appName.fieldName` | -| **opts** | object | no (default: {}) | Query options of the request | - -**Queries options**: - -| Parameters | Type | Required | Description | -| -------------- | ------- | -------- | ------------------------- | -| **where** | array | no | Mongo-like where query | -| **orderBy** | array | no | Mongo-like orderBy query | -| **limit** | integer | no | Number of objects to fetch | -| **startAt** | identifier | no | Return results starting at the document with the specified identifier | -| **startAfter** | identifier | no | Return results starting after the document with the specified identifier | - -[Learn more about query syntax](../../../reference/query-syntax.md). - -**Example**: - -```js - const queryOpts = { - where: [ - ['normalizedLabel', '==', 'alice'], - ['normalizedParentDomainName', '==', 'dash'], - ], - }; - await client.platform.documents.get('dpns.domain', queryOpts); -``` diff --git a/docs/sdk-js/platform/identities/credit-transfer.md b/docs/sdk-js/platform/identities/credit-transfer.md deleted file mode 100644 index 6313a373f..000000000 --- a/docs/sdk-js/platform/identities/credit-transfer.md +++ /dev/null @@ -1,31 +0,0 @@ -# Credit Transfer - -**Usage**: `await client.platform.identities.creditTransfer(identity, recipientId, amount)` - -**Description**: Transfers credits from one identity to another within the Dash Platform. - -Parameters: - -| Parameters | Type | Required | Description | -| ------------ | ------------------- | -------- | --------------------------------------------------------------------------- | -| **identity** | Identity | Yes | The identity object initiating the transfer. | -| **recipientId** | Identifier \| string | Yes | The identifier of the recipient identity. Can be an Identifier object or a string. | -| **amount** | number | Yes | The amount of credits to transfer. | - -**Example**: - -```js -const identity = await client.platform.identities.get('yourIdentityId'); -const recipientId = 'recipientIdentityId'; // The recipient's identity ID. -const amount = 1000; // Amount of credits to transfer. - -await client.platform.identities.creditTransfer(identity, recipientId, amount); -``` - -**Note**: - -- Ensure both the sender and recipient identities are registered on Dash Platform. -- The amount must be less than the available balance of the identity initiating the transfer. -- Transfers are irreversible once broadcasted. - -Returns: A promise that resolves to `true` upon successful execution of the credit transfer. diff --git a/docs/sdk-js/platform/identities/credit-withdrawal.md b/docs/sdk-js/platform/identities/credit-withdrawal.md deleted file mode 100644 index 9f2d7224d..000000000 --- a/docs/sdk-js/platform/identities/credit-withdrawal.md +++ /dev/null @@ -1,31 +0,0 @@ -# Credit Withdrawal - -**Usage**: `await client.platform.identities.creditWithdrawal(identity, amount, to, options)` - -**Description**: This method facilitates the withdrawal of platform credits from a specified identity to a Dash address. - -Parameters: - -| Parameters | Type | Required | Description | -| ----------------- | ----------------- | -------- | ----------- | -| **identity** | Identity | Yes | The identity withdrawing credits. | -| **amount** | number | Yes | The amount of credits to withdraw. | -| **to** | string | Yes | The Dash address receiving the withdrawn value. | -| **options** | WithdrawalOptions | No | Optional settings for the withdrawal, including `signingKeyIndex` (default: 2) to specify the key used for signing. | - -**Example**: - -```js -const identity = await client.platform.identities.get('yourIdentityId'); -const toAddress = 'XyZ...abc'; // Dash L1 address to receive the withdrawn credits -const amount = 1000000; // Amount of credits to withdraw - -await client.platform.identities.creditWithdrawal(identity, amount, toAddress, { signingKeyIndex: 2 }); -``` - -**Note**: - -- The `amount` must be greater than the `MINIMAL_WITHDRAWAL_AMOUNT` (190000 credits) to avoid dust errors from the Dash network. -- The `to` address must be valid in the specified Dash network environment (e.g., mainnet, testnet). - -Returns: A promise that resolves to `true` upon successful execution of the credit withdrawal. diff --git a/docs/sdk-js/platform/identities/get.md b/docs/sdk-js/platform/identities/get.md deleted file mode 100644 index fb0644834..000000000 --- a/docs/sdk-js/platform/identities/get.md +++ /dev/null @@ -1,14 +0,0 @@ -# Get - -**Usage**: `client.platform.identities.get(identityId)` -**Description**: This method will allow you to fetch back an identity from its id. - -Parameters: - -| Parameters | Type | Required | Description | -| -------------- | ------ | -------- | ---------------------------------------------------- | -| **identifier** | string | yes | Will fetch back the identity matching the identifier | - -**Example**: `await client.platform.identities.get('3GegupTgRfdN9JMS8R6QXF3B2VbZtiw63eyudh1oMJAk')` - -Returns: Identity (or `null` if it does not exist). diff --git a/docs/sdk-js/platform/identities/identities.md b/docs/sdk-js/platform/identities/identities.md deleted file mode 100644 index 8884b09c1..000000000 --- a/docs/sdk-js/platform/identities/identities.md +++ /dev/null @@ -1,24 +0,0 @@ -# Identities - -## What is an identity - -An Identity is a blockchain-based identifier for individuals (users) and applications. -Identities are the atomic element that, when linked with additional applications, can be extended to provide new functionality. - -Read more on the Dash Platform documentation about [Identity](../../../explanations/identity.md). -You might also want to consult the usage for the [DPNS Name Service](../names/names.md) in order to attach a name to your created identity. - -## Credits - -Each identity contains a credit balance. The ratio is 1 duff = 1000 credits. - -```{toctree} -:maxdepth: 2 - -credit-transfer -credit-withdrawal -get -register -topup -update -``` diff --git a/docs/sdk-js/platform/identities/register.md b/docs/sdk-js/platform/identities/register.md deleted file mode 100644 index 359ed598b..000000000 --- a/docs/sdk-js/platform/identities/register.md +++ /dev/null @@ -1,16 +0,0 @@ -# Register - -**Usage**: `client.platform.identities.register()` -**Description**: This method will register a new identity for you. - -Parameters: - -| Parameters | Type | Required | Description | -| ------------- | ------ | -------- | ------------------------------------------------------------------- | -| fundingAmount | number | no | Defaults: 10000. Allow to set a funding amount in duffs (satoshis). | - -**Example**: `await client.platform.identities.register()` - -**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). - -Returns: Identity. diff --git a/docs/sdk-js/platform/identities/topup.md b/docs/sdk-js/platform/identities/topup.md deleted file mode 100644 index 24cd4eea7..000000000 --- a/docs/sdk-js/platform/identities/topup.md +++ /dev/null @@ -1,25 +0,0 @@ -# Topup - -**Usage**: `client.platform.identities.topUp(identity, amount)` -**Description**: This method will topup the provided identity's balance. - -_The identity balance might slightly vary from the topped up amount because of the transaction fee estimation._ - -Parameters: - -| Parameters | Type | Required | Description | -| ------------ | -------- | -------- | ----------------------------------------------------------------------------------------------- | -| **identity** | Identity | yes | A valid [registered identity](../identities/register.md) | -| **amount** | number | yes | A duffs (satoshis) value corresponding to the amount you want to top up to the identity. | - -**Example**: - -```js -const identityId = '';// Your identity identifier -const identity = await client.platform.identities.get(identityId); -await client.platform.identities.topUp(identity.getId(), 10000); - -console.log(`New identity balance: ${identity.balance}`) -``` - -Returns: Boolean. diff --git a/docs/sdk-js/platform/identities/update.md b/docs/sdk-js/platform/identities/update.md deleted file mode 100644 index 22ff9e7a0..000000000 --- a/docs/sdk-js/platform/identities/update.md +++ /dev/null @@ -1,30 +0,0 @@ -# Update - -**Usage**: `await client.platform.identities.update(identity, publicKeys, privateKeys)` - -**Description**: This method updates an existing identity with new or disabled public keys. It signs and broadcasts an identity update transition to the network. - -Parameters: - -| Parameters | Type | Required | Description | -| -------------- | ------------------------------------- | -------- | --------------------------------------------------------------------------------------------------- | -| **identity** | Identity | yes | The identity object to update. | -| **publicKeys** | { add?: IdentityPublicKey[]; disable?: IdentityPublicKey[] } | no | An object containing arrays of `IdentityPublicKey` objects to add or disable. | -| **privateKeys**| Object | yes when adding keys | An object mapping public key IDs to their corresponding private keys for signing the new keys. | - -**Example**: - -```js -const identity = await client.platform.identities.get('yourIdentityId'); -const publicKeysToDisable = ['2']; // IDs of public keys to disable - -await client.platform.identities.update(identity, { disable: publicKeysToDisable }); -``` - -**Note**: - -- Adding a public key requires the corresponding private key to sign the new key addition. -- Disabling a key does not require its private key since the identity's key is used for the update transaction. -- Make sure the identity and keys are valid and the identity has sufficient balance for the transaction fees. - -Returns: A promise that resolves to `true` upon successful broadcast of the identity update transition. diff --git a/docs/sdk-js/platform/names/names.md b/docs/sdk-js/platform/names/names.md deleted file mode 100644 index 59400072b..000000000 --- a/docs/sdk-js/platform/names/names.md +++ /dev/null @@ -1,20 +0,0 @@ -# Names - -## What is DPNS - -DPNS is a special Dash Platform Application that is intended to provide a naming service for the Application Chain. - -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/). - -Limitation: max length of 63 characters on charset `0-9`,`A-Z`(case insensitive), `-`. - -Domain names are linked to an Identity. - -```{toctree} -:maxdepth: 2 - -register -resolve -resolvebyrecord -search -``` diff --git a/docs/sdk-js/platform/names/register.md b/docs/sdk-js/platform/names/register.md deleted file mode 100644 index 7795c4711..000000000 --- a/docs/sdk-js/platform/names/register.md +++ /dev/null @@ -1,17 +0,0 @@ -# Register - -**Usage**: `client.platform.names.register(name, records, identity)` -**Description**: This method will create a DPNS record matching your identity to the user or appname defined. - -Parameters: - -| Parameters | Type | Required | Description | -| -------------------------------- | -------- | -------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| **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. | -| **records** | Object | yes | records object having only one of the following items | -| **records.identity** | String | yes | Identity ID for this name record | -| **identity** | Identity | yes | A valid [registered identity](../identities/register.md) | - -**Example**: `await client.platform.names.register('alice', { identity: identity.getId() }, identity)` - -Returns: the created domain document diff --git a/docs/sdk-js/platform/names/resolve.md b/docs/sdk-js/platform/names/resolve.md deleted file mode 100644 index 70e9808be..000000000 --- a/docs/sdk-js/platform/names/resolve.md +++ /dev/null @@ -1,14 +0,0 @@ -# Resolve - -**Usage**: `client.platform.names.resolve('.dash')` -**Description**: This method will allow you to resolve a DPNS record from its humanized name. - -Parameters: - -| Parameters | Type | Required | Description | -| ---------- | ------ | -------- | ----------------------------------------------------------------------------- | -| **name** | String | yes | An alphanumeric (2-63) value used for human-identification (can contains `-`) | - -**Example**: `await client.platform.names.resolve('alice.dash')` - -Returns : ExtendedDocument (or `null` if do not exist). diff --git a/docs/sdk-js/platform/names/resolvebyrecord.md b/docs/sdk-js/platform/names/resolvebyrecord.md deleted file mode 100644 index 645bc40d1..000000000 --- a/docs/sdk-js/platform/names/resolvebyrecord.md +++ /dev/null @@ -1,22 +0,0 @@ -# ResolveByRecord - -**Usage**: `client.platform.names.resolveByRecord(record, value)` -**Description**: This method will allow you to resolve a DPNS record by identity ID. - -Parameters: - -| Parameters | Type | Required | Description | -| ---------- | ------ | -------- | -------------------------------------------------------------------- | -| **record** | String | yes | Type of the record (`identity`) | -| **value** | String | yes | Identifier value for the record | - -**Example**: - -This example will describe how to resolve names by the dash unique identity id. - -```js -const identityId = '3ge4yjGinQDhxh2aVpyLTQaoka45BkijkoybfAkDepoN'; -const document = await client.platform.names.resolveByRecord('identity', identityId); -``` - -Returns: array of ExtendedDocument. diff --git a/docs/sdk-js/platform/names/search.md b/docs/sdk-js/platform/names/search.md deleted file mode 100644 index 272959e9d..000000000 --- a/docs/sdk-js/platform/names/search.md +++ /dev/null @@ -1,24 +0,0 @@ -# Search - -**Usage**: `client.platform.names.search(labelPrefix, parentDomain)` -**Description**: This method will allow you to search all records matching the label prefix on the specified parent domain. - -Parameters: - -| Parameters | Type | Required | Description | -| ---------------- | ------ | -------- | ------------------------------------------------- | -| **labelPrefix** | String | yes | label prefix to search for | -| **parentDomain** | String | yes | parent domain name on which to perform the search | - -**Example**: - -This example will describe how to search all names on the parent domain `dash` that starts with the label prefix `al`. -It will resolves names documents such as `alice`, `alex` etc... - -```js -const labelPrefix = 'al'; -const parentDomain = 'dash'; -const document = await client.platform.names.search(labelPrefix, parentDomain); -``` - -Returns: Documents matching the label prefix on the parent domain. diff --git a/docs/sdk-js/platform/platform.md b/docs/sdk-js/platform/platform.md deleted file mode 100644 index 65f2a561b..000000000 --- a/docs/sdk-js/platform/platform.md +++ /dev/null @@ -1,20 +0,0 @@ -# Platform - -The Dash Platform provides a technology stack on the top of Dash Network that allows creation of feature-rich decentralized applications. - -You can learn more from the [Dash Platform Documentation - What is Dash Platform?](../../intro/what-is-dash-platform.md) - -## Platform components - -- 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). -- Drive: Application chain storage layer where the data defined by Data Contracts is stored and managed. -- DPNS: Naming service provided by a Dash Platform App - -```{toctree} -:maxdepth: 3 - -contracts/contracts -documents/documents -identities/identities -names/names -``` diff --git a/docs/sdk-js/usage/dapi.md b/docs/sdk-js/usage/dapi.md deleted file mode 100644 index a89965201..000000000 --- a/docs/sdk-js/usage/dapi.md +++ /dev/null @@ -1,13 +0,0 @@ -# DAPI - -## About DAPI - -DAPI (Decentralized API) is a distributed and decentralized endpoints provided by the Masternode Network. - -## Get the DAPI-Client instance - -```js - const dapiClient = client.getDAPIClient(); -``` - -The usage is then [described here](../../explanations/dapi.md). diff --git a/docs/sdk-js/usage/dashcore-lib-primitives.md b/docs/sdk-js/usage/dashcore-lib-primitives.md deleted file mode 100644 index 50d4a6453..000000000 --- a/docs/sdk-js/usage/dashcore-lib-primitives.md +++ /dev/null @@ -1,122 +0,0 @@ -# Dashcore Lib primitives - -All Dashcore lib primitives are exposed via the `Core` namespace. - -```js -const Dash = require('dash'); -const { - Core: { - Block, - Transaction, - Address, - // ... - } -} = Dash; -``` - -## Transaction - -The Transaction primitive allows creating and manipulating transactions. It also allows signing transactions with a private key. -Supports fee control and input/output access (which allows passing a specific script). - -```js -const { Transaction } = Dash.Core; -const tx = new Transaction(txProps) -``` - -Access the [Transaction documentation on dashpay/dashcore-lib](https://github.com/dashpay/dashcore-lib/blob/master/docs/core-concepts/transaction.md) - -## Address - -Standardized representation of a Dash Address. Address can be instantiated from a String, PrivateKey, PublicKey, HDPrivateKey or HdPublicKey. -Pay-to-script-hash (P2SH) multi-signature addresses from an array of PublicKeys are also supported. - -```js -const { Address } = Dash.Core; -``` - -Access the [Address documentation on dashpay/dashcore-lib](https://github.com/dashpay/dashcore-lib/blob/master/docs/core-concepts/address.md) - -## Block - -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. - -The block's transactions can also be explored by iterating over elements in array (`block.transactions`). - -`const { Block } = Dash.Core;` - -Access the [Block documentation on dashpay/dashcore-lib](https://github.com/dashpay/dashcore-lib/blob/master/docs/core-concepts/block.md) - -## UnspentOutput - -Representation of an UnspentOutput (also called UTXO as in Unspent Transaction Output). -Mostly useful in association with a Transaction and for Scripts. - -`const { UnspentOutput } = Dash.Core.Transaction;` - -Access the [UnspentOutput documentation on dashpay/dashcore-lib](https://github.com/dashpay/dashcore-lib/blob/master/docs/core-concepts/unspentoutput.md) - -## HDPublicKey - -Hierarchical Deterministic (HD) version of the PublicKey. -Used internally by Wallet-lib and for exchange between peers (DashPay) - -const { HDPublicKey } = Dash.Core;\` - -Access the [HDKeys documentation on dashpay/dashcore-lib](https://github.com/dashpay/dashcore-lib/blob/master/docs/core-concepts/hierarchical.md#hdpublickey) - -## HDPrivateKey - -Hierarchical Deterministic (HD) version of the PrivateKey. -Used internally by Wallet-lib. - -`const { HDPrivateKey } = Dash.Core;` - -Access the [HDKeys documentation on dashpay/dashcore-lib](https://github.com/dashpay/dashcore-lib/blob/master/docs/core-concepts/hierarchical.md#hdprivatekey) - -## PublicKey - -`const { PublicKey } = Dash.Core;` - -Access the [PublicKey documentation on dashpay/dashcore-lib](https://github.com/dashpay/dashcore-lib/blob/master/docs/core-concepts/publickey.md) - -## PrivateKey - -`const { PrivateKey } = Dash.Core;` - -Access the [PrivateKey documentation on dashpay/dashcore-lib](https://github.com/dashpay/dashcore-lib/blob/master/docs/core-concepts/privatekey.md) - -## Mnemonic - -Implementation of [BIP39 Mnemonic code for generative deterministic keys](https://github.com/bitcoin/bips/blob/master/bip-0039.mediawiki). -Generates a random mnemonic with the chosen language, validates a mnemonic or returns the associated HDPrivateKey. - -`const { Mnemonic } = Dash.Core;` - -Access the [Mnemonic documentation on dashpay/dashcore-lib](https://github.com/dashpay/dashcore-lib/blob/master/docs/core-concepts/mnemonic.md) - -## Network - -A representation of the internal parameters relative to the selected network. By default, all primitives works with 'livenet'. - -`const { Network } = Dash.Core;` - -Access the [Network documentation on dashpay/dashcore-lib](https://github.com/dashpay/dashcore-lib/blob/master/docs/core-concepts/networks.md) - -## Script - -`const { Script } = Dash.Core.Transaction;` - -Access the [Script documentation on dashpay/dashcore-lib](https://github.com/dashpay/dashcore-lib/blob/master/docs/core-concepts/script.md) - -## Input - -`const { Input } = Dash.Core.Transaction;` - -Access the [Transaction documentation on dashpay/dashcore-lib](https://github.com/dashpay/dashcore-lib/blob/master/docs/core-concepts/transaction.md#adding-inputs) - -## Output - -`const { Output } = Dash.Core.Transaction;` - -Access the [Transaction documentation on dashpay/dashcore-lib](https://github.com/dashpay/dashcore-lib/blob/master/docs/core-concepts/transaction.md#handling-outputs) diff --git a/docs/sdk-js/usage/usage.md b/docs/sdk-js/usage/usage.md deleted file mode 100644 index dd2c4456a..000000000 --- a/docs/sdk-js/usage/usage.md +++ /dev/null @@ -1,9 +0,0 @@ -# Usage - -```{toctree} -:maxdepth: 2 -:titlesonly: - -dapi -dashcore-lib-primitives -``` diff --git a/docs/sdk-js/wallet/accounts.md b/docs/sdk-js/wallet/accounts.md deleted file mode 100644 index 4f3806420..000000000 --- a/docs/sdk-js/wallet/accounts.md +++ /dev/null @@ -1,27 +0,0 @@ -# Accounts - -## Getting an account - -When Wallet is initialized with `mnemonic`, it holds multiple Accounts according to BIP44. -Each Account holds the keys needed to make a payments from it. - -Wallet's `getAccount` method used to access an account: - -```js -const client = new Dash.Client({ - wallet: { - mnemonic: "maximum blast eight orchard waste wood gospel siren parent deer athlete impact", - }, -}); - -const account = await client.wallet.getAccount() -// Do something with account -``` - -As optional parameter, an integer representing the account `index` can be passed as parameter. By default, index account on call is 0. - -```js -client.wallet.getAccount({ index: 1 }) -``` - -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. diff --git a/docs/sdk-js/wallet/signing-encrypt.md b/docs/sdk-js/wallet/signing-encrypt.md deleted file mode 100644 index e86114c8f..000000000 --- a/docs/sdk-js/wallet/signing-encrypt.md +++ /dev/null @@ -1,30 +0,0 @@ -# Signing and encryption - -## Obtain account - -```js -const account = await client.wallet.getAccount(); -``` - -## Sign a Transaction - -```js -const tx = new Dash.Core.Transaction({ - // ...txOpts -}); -const signedTx = account.sign(tx); -``` - -## Encrypt a message - -```js - const message = 'Something'; - const signedMessage = account.encrypt('AES', message, 'secret'); -``` - -## Decrypt a message - -```js -const encrypted = 'U2FsdGVkX19JLa+1UpbMcut1/QFWLMlKUS+iqz+7Wl4='; -const message = account.decrypt('AES', encrypted, 'secret'); -``` diff --git a/docs/sdk-js/wallet/wallet.md b/docs/sdk-js/wallet/wallet.md deleted file mode 100644 index f0f9513b6..000000000 --- a/docs/sdk-js/wallet/wallet.md +++ /dev/null @@ -1,17 +0,0 @@ -# Wallet - -## About Wallet-lib - -When Dash.Client is initiated with a `mnemonic` property, a wallet instance becomes accessible via `client.wallet` property. - -To initialize the wallet account and synchronize with the network, use `client.wallet.getAccount()`. - -Find out more about the Wallet in its [complete documentation](https://dashpay.github.io/platform/Wallet-library/) - -```{toctree} -:maxdepth: 2 -:titlesonly: - -accounts -signing-encrypt -``` From e63bbd30d649bd1955ba20e04ff17c87cbc87c66 Mon Sep 17 00:00:00 2001 From: thephez Date: Tue, 17 Mar 2026 13:41:08 -0400 Subject: [PATCH 2/4] chore: update repo overview and remove extraneous file --- docs/index.md | 3 +- docs/resources/repository-overview.md | 124 +++++++------------------- docs/resources/source-code.md | 6 -- 3 files changed, 34 insertions(+), 99 deletions(-) delete mode 100644 docs/resources/source-code.md diff --git a/docs/index.md b/docs/index.md index 2961ebc84..fad4902ab 100644 --- a/docs/index.md +++ b/docs/index.md @@ -161,8 +161,7 @@ Platform Explorer Testnet Block Explorer Testnet Faucet JavaScript SDK -resources/source-code -Previous Version of Docs +Previous Version of Docs ``` ```{toctree} diff --git a/docs/resources/repository-overview.md b/docs/resources/repository-overview.md index 39d53fa32..6d1d7e0d2 100644 --- a/docs/resources/repository-overview.md +++ b/docs/resources/repository-overview.md @@ -4,106 +4,48 @@ # Repository Overview -> 📘 Change to monorepo -> -> Dash Platform v0.21 migrated to a [monorepo](https://en.wikipedia.org/wiki/Monorepo) structure to streamline continuous integration builds and testing. A number of the libraries below were previously independent repositories but now are aggregated into the [`packages` directory](https://github.com/dashpay/platform/tree/master/packages) of the monorepo (). +Dash Platform uses a [monorepo](https://en.wikipedia.org/wiki/Monorepo) structure containing most +packages that comprise Dash Platform. Packages are located in the +[packages](https://github.com/dashpay/platform/tree/master/packages) directory. -## js-dash-sdk +## SDKs -Dash client-side JavaScript library for application development and wallet payment/signing. Uses wallet-lib, dapi-client, and dashcore-lib to expose layer-1 and layer-2 functionality. Main user is app developers. +These are the primary tools for developers building on Dash Platform. -npm: `dash` -[Repository](https://github.com/dashpay/platform/tree/master/packages/js-dash-sdk) +| Component | Description | +| - | - | +| [js-evo-sdk](https://github.com/dashpay/platform/tree/master/packages/js-evo-sdk) | JavaScript SDK (`npm install @dashevo/evo-sdk`) | +| [rs-sdk](https://github.com/dashpay/platform/tree/master/packages/rs-sdk) | Rust SDK for building applications on Dash Platform | +| [rs-sdk-ffi](https://github.com/dashpay/platform/tree/master/packages/rs-sdk-ffi) / [swift-sdk](https://github.com/dashpay/platform/tree/master/packages/swift-sdk) | FFI layer and iOS/Swift SDK | +| [wasm-sdk](https://github.com/dashpay/platform/tree/master/packages/wasm-sdk) | WebAssembly bindings for browser-based applications | -## js-dapi-client +## Platform and Supporting Repositories -Client library for accessing [DAPI Endpoints](../reference/dapi-endpoints.md) . Enables interaction with Dash platform through the [DAPI](../explanations/dapi.md) hosted on masternodes. Provides automatic masternode discovery starting from any initial masternode. +These run on the network and process data. -npm: `@dashevo/dapi-client` -[Repository](https://github.com/dashpay/platform/tree/master/packages/js-dapi-client) +| Component | Description | +| - | - | +| [dapi](https://github.com/dashpay/platform/tree/master/packages/dapi) / [rs-dapi](https://github.com/dashpay/platform/tree/master/packages/rs-dapi) | Decentralized API server implementations | +| [rs-drive](https://github.com/dashpay/platform/tree/master/packages/rs-drive) | Drive query and indexing layer over GroveDB | +| [rs-dpp](https://github.com/dashpay/platform/tree/master/packages/rs-dpp) | Dash Platform Protocol (data contracts, documents, state transitions, identities) | +| [dashmate](https://github.com/dashpay/platform/tree/master/packages/dashmate) | Node management and local development tool | +| [rs-tenderdash-abci](https://github.com/dashpay/rs-tenderdash-abci) | Tenderdash ABCI application | +| [grovedb](https://github.com/dashpay/grovedb) | Hierarchical authenticated data structure | +| [tenderdash](https://github.com/dashpay/tenderdash) | Byzantine fault-tolerant consensus engine | +| [rust-dashcore](https://github.com/dashpay/rust-dashcore) | Rust implementation of Dash Core primitives | -## dapi +## Contracts -A decentralized API for the Dash network. Exposes endpoints for interacting with the layer 1 blockchain and layer 2 platform services. +Built-in data contracts used by the network. -[Repository](https://github.com/dashpay/platform/tree/master/packages/dapi) +| Component | Description | +| - | - | +| [dashpay-contract](https://github.com/dashpay/platform/tree/master/packages/dashpay-contract) | DashPay contract documents JSON Schema | +| [dpns-contract](https://github.com/dashpay/platform/tree/master/packages/dpns-contract) | DPNS contract documents JSON Schema | -## js-dpp +## Source Code Location -JavaScript implementation of [Dash Platform Protocol](../explanations/platform-protocol.md). Performs validation of all data submitted to the platform. +All source code produced by Dash Core Group is located in two GitHub organizations: -npm: `@dashevo/dpp` -[Repository](https://github.com/dashpay/platform/tree/master/packages/js-dpp) - -## Supporting Repositories - -### drive - -Manages the platform state and provides decentralized application storage on the Dash network. - -[Repository](https://github.com/dashpay/platform/tree/master/packages/js-drive) - -### dashcore-lib - -A JavaScript Dash library - -npm: `@dashevo/dashcore-lib` -Repository: - -### grove-db - -A hierarchical authenticated data structure. The construction is based on [Database Outsourcing with Hierarchical Authenticated Data Structures](https://eprint.iacr.org/2015/351.pdf). - -[Repository](https://github.com/dashpay/grovedb) - -### wallet-lib - -An extensible JavaScript Wallet Library for Dash. Provides layer 1 SPV wallet functionality. - -npm: `@dashevo/wallet-lib` -[Repository](https://github.com/dashpay/platform/tree/master/packages/wallet-lib) - -### dapi-grpc - -Decentralized API gRPC definition files and generated clients. Used by clients (e.g. dapi-client) to interact with DAPI endpoints. - -npm: `@dashevo/dapi-grpc` -[Repository](https://github.com/dashpay/platform/tree/master/packages/dapi-grpc) - -### dash-network-deploy - -Tool for assisting Dash devnet network deployment and testing. - - - -### platform-test-suite - -Test suite for end-to-end testing of Dash Platform by running some real-life scenarios against a Dash Network. - -[Repository](https://github.com/dashpay/platform/tree/master/packages/platform-test-suite) - -### rs-drive - -Implements secondary indices for Platform in conjunction with GroveDB. - -[Repository](https://github.com/dashpay/platform/tree/master/packages/rs-drive) - -### dashmate - -A distribution package for Dash masternode installation. - -[Repository](https://github.com/dashpay/platform/tree/master/packages/dashmate) - -## Contract Repositories - -### dashpay-contract - -DashPay contract documents JSON Schema - -[Repository](https://github.com/dashpay/platform/tree/master/packages/dashpay-contract) - -### dpns-contract - -DPNS contract documents JSON Schema - -[Repository](https://github.com/dashpay/platform/tree/master/packages/dpns-contract) +- [Dashpay](https://github.com/dashpay) - Dash Core and Platform software and documentation +- [Dashevo](https://github.com/dashevo) - Original source of Dash Platform development. Archived for historical reference diff --git a/docs/resources/source-code.md b/docs/resources/source-code.md deleted file mode 100644 index 96160d25d..000000000 --- a/docs/resources/source-code.md +++ /dev/null @@ -1,6 +0,0 @@ -# Source Code - -Source code produced by Dash Core Group is located in two GitHub organizations: - -- [Dashpay](https://github.com/dashpay) - Dash Core and Platform software and documentation -- [Dashevo](https://github.com/dashevo) - Original source of Dash Platform development. Archived for historical reference From 50ea1078c6466b0f9693334e3fae3dee5b02d727 Mon Sep 17 00:00:00 2001 From: thephez Date: Tue, 17 Mar 2026 13:45:27 -0400 Subject: [PATCH 3/4] docs: add platform bridge --- docs/index.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/index.md b/docs/index.md index fad4902ab..d20bcf76d 100644 --- a/docs/index.md +++ b/docs/index.md @@ -157,6 +157,7 @@ protocol-ref/errors resources/faq resources/repository-overview +Platform Bridge Platform Explorer Testnet Block Explorer Testnet Faucet From 770b91bdc669a7164ebf44d43b4f527985710ad1 Mon Sep 17 00:00:00 2001 From: thephez Date: Tue, 17 Mar 2026 13:55:56 -0400 Subject: [PATCH 4/4] chore: sync sidebar --- _templates/sidebar-main.html | 494 ++--------------------------------- docs/index.md | 1 - 2 files changed, 15 insertions(+), 480 deletions(-) diff --git a/_templates/sidebar-main.html b/_templates/sidebar-main.html index e983e2e38..ce7d7dca7 100644 --- a/_templates/sidebar-main.html +++ b/_templates/sidebar-main.html @@ -90,11 +90,6 @@ Update an identity -
  • - - Retrieve an account’s identities - -
  • Transfer to an Identity @@ -173,11 +168,6 @@ Send funds
  • -
  • - - Use DAPI client methods - -
  • Set up a node @@ -439,6 +429,16 @@ Data Trigger
  • +
  • + + Platform Address System + +
  • +
  • + + Protocol Constants + +
  • Consensus Errors @@ -461,6 +461,11 @@ Repository Overview
  • +
  • + + Platform Bridge + +
  • Platform Explorer @@ -476,334 +481,12 @@ Testnet Faucet
  • -
  • - - Source Code - -
  • Previous Version of Docs
  • -

    - - JavaScript SDK - -

    -

    Rust SDK @@ -821,153 +504,6 @@ -

    - - DAPI Client - -

    -

    Core Docs diff --git a/docs/index.md b/docs/index.md index d20bcf76d..97708f394 100644 --- a/docs/index.md +++ b/docs/index.md @@ -161,7 +161,6 @@ Platform Bridge Platform Explorer Testnet Block Explorer Testnet Faucet -JavaScript SDK Previous Version of Docs ```