From c36a208c9143c962413d05e604ae25857a44f066 Mon Sep 17 00:00:00 2001 From: thephez Date: Thu, 31 Aug 2023 11:58:35 -0400 Subject: [PATCH 01/12] docs: import docsify sdk docs --- docs/sdk-js/dash-sdk-overview.md | 43 ++++++ ...xamples-fetch-an-identity-from-its-name.md | 17 +++ ...sh-sdk-examples-generate-a-new-mnemonic.md | 48 +++++++ ...-sdk-examples-paying-to-another-address.md | 28 ++++ ...xamples-receive-money-and-check-balance.md | 90 +++++++++++++ ...h-sdk-examples-sign-and-verify-messages.md | 24 ++++ ...dash-sdk-examples-use-different-account.md | 11 ++ docs/sdk-js/examples/dash-sdk-examples.md | 8 ++ .../dash-sdk-getting-started-about-schemas.md | 5 + .../dash-sdk-getting-started-core-concepts.md | 30 +++++ ...ting-started-dash-platform-applications.md | 7 + .../dash-sdk-getting-started-quick-start.md | 46 +++++++ ...ash-sdk-getting-started-with-typescript.md | 34 +++++ ...ting-started-working-with-multiple-apps.md | 23 ++++ .../dash-sdk-getting-started.md | 8 ++ .../contracts/dash-sdk-contracts-create.md | 36 ++++++ .../contracts/dash-sdk-contracts-get.md | 12 ++ .../contracts/dash-sdk-contracts-publish.md | 21 +++ .../contracts/dash-sdk-contracts-update.md | 11 ++ .../platform/contracts/dash-sdk-contracts.md | 5 + docs/sdk-js/platform/dash-sdk-platform.md | 11 ++ .../documents/dash-sdk-documents-broadcast.md | 30 +++++ .../documents/dash-sdk-documents-create.md | 28 ++++ .../documents/dash-sdk-documents-get.md | 33 +++++ .../platform/documents/dash-sdk-documents.md | 6 + .../identities/dash-sdk-identities-get.md | 12 ++ .../dash-sdk-identities-register.md | 14 ++ .../identities/dash-sdk-identities-topup.md | 23 ++++ .../identities/dash-sdk-identities.md | 11 ++ .../platform/names/dash-sdk-names-register.md | 16 +++ .../platform/names/dash-sdk-names-resolve.md | 12 ++ .../names/dash-sdk-names-resolvebyrecord.md | 20 +++ .../platform/names/dash-sdk-names-search.md | 22 ++++ docs/sdk-js/platform/names/dash-sdk-names.md | 9 ++ docs/sdk-js/usage/dash-sdk-usage-dapi.md | 11 ++ .../dash-sdk-usage-dashcore-lib-primitives.md | 122 ++++++++++++++++++ docs/sdk-js/usage/dash-sdk-usage.md | 4 + .../sdk-js/wallet/dash-sdk-wallet-accounts.md | 25 ++++ .../wallet/dash-sdk-wallet-signing-encrypt.md | 28 ++++ docs/sdk-js/wallet/dash-sdk-wallet.md | 7 + 40 files changed, 951 insertions(+) create mode 100644 docs/sdk-js/dash-sdk-overview.md create mode 100644 docs/sdk-js/examples/dash-sdk-examples-fetch-an-identity-from-its-name.md create mode 100644 docs/sdk-js/examples/dash-sdk-examples-generate-a-new-mnemonic.md create mode 100644 docs/sdk-js/examples/dash-sdk-examples-paying-to-another-address.md create mode 100644 docs/sdk-js/examples/dash-sdk-examples-receive-money-and-check-balance.md create mode 100644 docs/sdk-js/examples/dash-sdk-examples-sign-and-verify-messages.md create mode 100644 docs/sdk-js/examples/dash-sdk-examples-use-different-account.md create mode 100644 docs/sdk-js/examples/dash-sdk-examples.md create mode 100644 docs/sdk-js/getting-started/dash-sdk-getting-started-about-schemas.md create mode 100644 docs/sdk-js/getting-started/dash-sdk-getting-started-core-concepts.md create mode 100644 docs/sdk-js/getting-started/dash-sdk-getting-started-dash-platform-applications.md create mode 100644 docs/sdk-js/getting-started/dash-sdk-getting-started-quick-start.md create mode 100644 docs/sdk-js/getting-started/dash-sdk-getting-started-with-typescript.md create mode 100644 docs/sdk-js/getting-started/dash-sdk-getting-started-working-with-multiple-apps.md create mode 100644 docs/sdk-js/getting-started/dash-sdk-getting-started.md create mode 100644 docs/sdk-js/platform/contracts/dash-sdk-contracts-create.md create mode 100644 docs/sdk-js/platform/contracts/dash-sdk-contracts-get.md create mode 100644 docs/sdk-js/platform/contracts/dash-sdk-contracts-publish.md create mode 100644 docs/sdk-js/platform/contracts/dash-sdk-contracts-update.md create mode 100644 docs/sdk-js/platform/contracts/dash-sdk-contracts.md create mode 100644 docs/sdk-js/platform/dash-sdk-platform.md create mode 100644 docs/sdk-js/platform/documents/dash-sdk-documents-broadcast.md create mode 100644 docs/sdk-js/platform/documents/dash-sdk-documents-create.md create mode 100644 docs/sdk-js/platform/documents/dash-sdk-documents-get.md create mode 100644 docs/sdk-js/platform/documents/dash-sdk-documents.md create mode 100644 docs/sdk-js/platform/identities/dash-sdk-identities-get.md create mode 100644 docs/sdk-js/platform/identities/dash-sdk-identities-register.md create mode 100644 docs/sdk-js/platform/identities/dash-sdk-identities-topup.md create mode 100644 docs/sdk-js/platform/identities/dash-sdk-identities.md create mode 100644 docs/sdk-js/platform/names/dash-sdk-names-register.md create mode 100644 docs/sdk-js/platform/names/dash-sdk-names-resolve.md create mode 100644 docs/sdk-js/platform/names/dash-sdk-names-resolvebyrecord.md create mode 100644 docs/sdk-js/platform/names/dash-sdk-names-search.md create mode 100644 docs/sdk-js/platform/names/dash-sdk-names.md create mode 100644 docs/sdk-js/usage/dash-sdk-usage-dapi.md create mode 100644 docs/sdk-js/usage/dash-sdk-usage-dashcore-lib-primitives.md create mode 100644 docs/sdk-js/usage/dash-sdk-usage.md create mode 100644 docs/sdk-js/wallet/dash-sdk-wallet-accounts.md create mode 100644 docs/sdk-js/wallet/dash-sdk-wallet-signing-encrypt.md create mode 100644 docs/sdk-js/wallet/dash-sdk-wallet.md diff --git a/docs/sdk-js/dash-sdk-overview.md b/docs/sdk-js/dash-sdk-overview.md new file mode 100644 index 000000000..dffe13064 --- /dev/null +++ b/docs/sdk-js/dash-sdk-overview.md @@ -0,0 +1,43 @@ +# Dash SDK + +[![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, ...) + +Dash library provides access via [DAPI](https://dashplatform.readme.io/docs/explanation-dapi) 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](https://dashplatform.readme.io/docs/generate-a-new-mnemonic) +- [Receive money and display balance](https://dashplatform.readme.io/docs/dash-sdk-examples-receive-money-and-check-balance) +- [Pay to another address](https://dashplatform.readme.io/docs/dash-sdk-examples-paying-to-another-address) +- [Use another BIP44 account](https://dashplatform.readme.io/docs/use-different-account) + +### Dash Platform Tutorials + +See the [Tutorial section](https://dashplatform.readme.io/docs/tutorials-introduction) of the Dash Platform documentation for examples. + +## Licence + +[MIT](https://github.com/dashevo/dashjs/blob/master/LICENCE.md) © Dash Core Group, Inc. \ No newline at end of file diff --git a/docs/sdk-js/examples/dash-sdk-examples-fetch-an-identity-from-its-name.md b/docs/sdk-js/examples/dash-sdk-examples-fetch-an-identity-from-its-name.md new file mode 100644 index 000000000..aba53a4de --- /dev/null +++ b/docs/sdk-js/examples/dash-sdk-examples-fetch-an-identity-from-its-name.md @@ -0,0 +1,17 @@ +## Fetching an identity from its name + +Assuming you have created an identity and attached a name to it (see how to [register an identity](https://dashplatform.readme.io/docs/tutorial-register-an-identity) and how to [attach it to a name](https://dashplatform.readme.io/docs/tutorial-register-a-name-for-an-identity)), 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); +``` \ No newline at end of file diff --git a/docs/sdk-js/examples/dash-sdk-examples-generate-a-new-mnemonic.md b/docs/sdk-js/examples/dash-sdk-examples-generate-a-new-mnemonic.md new file mode 100644 index 000000000..429098664 --- /dev/null +++ b/docs/sdk-js/examples/dash-sdk-examples-generate-a-new-mnemonic.md @@ -0,0 +1,48 @@ +## 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. \ No newline at end of file diff --git a/docs/sdk-js/examples/dash-sdk-examples-paying-to-another-address.md b/docs/sdk-js/examples/dash-sdk-examples-paying-to-another-address.md new file mode 100644 index 000000000..91f9b07a4 --- /dev/null +++ b/docs/sdk-js/examples/dash-sdk-examples-paying-to-another-address.md @@ -0,0 +1,28 @@ +## Paying to another address + +In order to pay, you need to have an [existing balance](https://dashplatform.readme.io/docs/dash-sdk-examples-receive-money-and-check-balance). +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/). \ No newline at end of file diff --git a/docs/sdk-js/examples/dash-sdk-examples-receive-money-and-check-balance.md b/docs/sdk-js/examples/dash-sdk-examples-receive-money-and-check-balance.md new file mode 100644 index 000000000..4999a22a1 --- /dev/null +++ b/docs/sdk-js/examples/dash-sdk-examples-receive-money-and-check-balance.md @@ -0,0 +1,90 @@ +## Receive money and display balance + +Initialize the SDK Client with your [generated mnemonic](https://dashplatform.readme.io/docs/dash-sdk-examples-generate-a-new-mnemonic) 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](https://dashplatform.readme.io/docs/dash-sdk-examples-use-different-account). + +## 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'); +} +``` \ No newline at end of file diff --git a/docs/sdk-js/examples/dash-sdk-examples-sign-and-verify-messages.md b/docs/sdk-js/examples/dash-sdk-examples-sign-and-verify-messages.md new file mode 100644 index 000000000..b7fe116fd --- /dev/null +++ b/docs/sdk-js/examples/dash-sdk-examples-sign-and-verify-messages.md @@ -0,0 +1,24 @@ +## 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()); +} +``` \ No newline at end of file diff --git a/docs/sdk-js/examples/dash-sdk-examples-use-different-account.md b/docs/sdk-js/examples/dash-sdk-examples-use-different-account.md new file mode 100644 index 000000000..2213bd8ae --- /dev/null +++ b/docs/sdk-js/examples/dash-sdk-examples-use-different-account.md @@ -0,0 +1,11 @@ +## 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/examples/dash-sdk-examples.md b/docs/sdk-js/examples/dash-sdk-examples.md new file mode 100644 index 000000000..782bc121c --- /dev/null +++ b/docs/sdk-js/examples/dash-sdk-examples.md @@ -0,0 +1,8 @@ +The following pages cover: + +- [Fetching an identity from its name](https://dashplatform.readme.io/docs/dash-sdk-examples-fetch-an-identity-from-its-name) +- [Generate a new mnemonic](https://dashplatform.readme.io/docs/dash-sdk-examples-generate-a-new-mnemonic) +- [Pay to another address](https://dashplatform.readme.io/docs/dash-sdk-examples-paying-to-another-address) +- [Receive money and check balance](https://dashplatform.readme.io/docs/dash-sdk-examples-receive-money-and-check-balance) +- [Sign and verify messages](https://dashplatform.readme.io/docs/dash-sdk-examples-sign-and-verify-messages) +- [Use different account](https://dashplatform.readme.io/docs/dash-sdk-examples-use-different-account) \ No newline at end of file diff --git a/docs/sdk-js/getting-started/dash-sdk-getting-started-about-schemas.md b/docs/sdk-js/getting-started/dash-sdk-getting-started-about-schemas.md new file mode 100644 index 000000000..036965588 --- /dev/null +++ b/docs/sdk-js/getting-started/dash-sdk-getting-started-about-schemas.md @@ -0,0 +1,5 @@ +# 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](https://dashplatform.readme.io/docs/explanation-platform-protocol-data-contract). \ No newline at end of file diff --git a/docs/sdk-js/getting-started/dash-sdk-getting-started-core-concepts.md b/docs/sdk-js/getting-started/dash-sdk-getting-started-core-concepts.md new file mode 100644 index 000000000..d068291dd --- /dev/null +++ b/docs/sdk-js/getting-started/dash-sdk-getting-started-core-concepts.md @@ -0,0 +1,30 @@ +## Core concepts + +The [Dash Core Developer Guide](https://dashcore.readme.io/docs/core-guide-introduction) 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://dashcore.readme.io/docs/core-guide-block-chain-transaction-data) 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](https://dashplatform.readme.io/docs/dash-sdk-examples-use-different-account) 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](https://dashplatform.readme.io/docs/dash-sdk-getting-started-working-with-multiple-apps) \ No newline at end of file diff --git a/docs/sdk-js/getting-started/dash-sdk-getting-started-dash-platform-applications.md b/docs/sdk-js/getting-started/dash-sdk-getting-started-dash-platform-applications.md new file mode 100644 index 000000000..7ba76c026 --- /dev/null +++ b/docs/sdk-js/getting-started/dash-sdk-getting-started-dash-platform-applications.md @@ -0,0 +1,7 @@ +## DPNS + +DPNS is handled in the Dash SDK Client under the namespace `client.platform.names.*'`. [Read more here](https://dashplatform.readme.io/docs/dash-sdk-names) + +## DashPay + +The DashPay contract is registered on testnet under contract id `Bwr4WHCPz5rFVAD87RqTs3izo4zpzwsEdKPWUT1NS1C7`. Its functionality is not incorporated with the Dash SDK at this time. \ No newline at end of file diff --git a/docs/sdk-js/getting-started/dash-sdk-getting-started-quick-start.md b/docs/sdk-js/getting-started/dash-sdk-getting-started-quick-start.md new file mode 100644 index 000000000..f49608314 --- /dev/null +++ b/docs/sdk-js/getting-started/dash-sdk-getting-started-quick-start.md @@ -0,0 +1,46 @@ +# 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](https://dashplatform.readme.io/docs/tutorials-introduction) of the Dash Platform documentation for examples. \ No newline at end of file diff --git a/docs/sdk-js/getting-started/dash-sdk-getting-started-with-typescript.md b/docs/sdk-js/getting-started/dash-sdk-getting-started-with-typescript.md new file mode 100644 index 000000000..cb4ffbfb5 --- /dev/null +++ b/docs/sdk-js/getting-started/dash-sdk-getting-started-with-typescript.md @@ -0,0 +1,34 @@ +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` \ No newline at end of file diff --git a/docs/sdk-js/getting-started/dash-sdk-getting-started-working-with-multiple-apps.md b/docs/sdk-js/getting-started/dash-sdk-getting-started-working-with-multiple-apps.md new file mode 100644 index 000000000..60466b892 --- /dev/null +++ b/docs/sdk-js/getting-started/dash-sdk-getting-started-working-with-multiple-apps.md @@ -0,0 +1,23 @@ +# 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' }); +``` \ No newline at end of file diff --git a/docs/sdk-js/getting-started/dash-sdk-getting-started.md b/docs/sdk-js/getting-started/dash-sdk-getting-started.md new file mode 100644 index 000000000..9083efbbb --- /dev/null +++ b/docs/sdk-js/getting-started/dash-sdk-getting-started.md @@ -0,0 +1,8 @@ +The following pages cover: + +- [About schemas](https://dashplatform.readme.io/docs/dash-sdk-getting-started-about-schemas) +- [Core concepts](https://dashplatform.readme.io/docs/dash-sdk-getting-started-core-concepts) +- [Dash platform applications](https://dashplatform.readme.io/docs/dash-sdk-getting-started-dash-platform-applications) +- [Working with multiple apps](https://dashplatform.readme.io/docs/dash-sdk-getting-started-working-with-multiple-apps) +- [Quick starting the library](https://dashplatform.readme.io/docs/dash-sdk-getting-started-quick-start) +- [Use Dash SDK with TypeScript.](https://dashplatform.readme.io/docs/dash-sdk-getting-started-with-typescript) \ No newline at end of file diff --git a/docs/sdk-js/platform/contracts/dash-sdk-contracts-create.md b/docs/sdk-js/platform/contracts/dash-sdk-contracts-create.md new file mode 100644 index 000000000..e8fc0a8b0 --- /dev/null +++ b/docs/sdk-js/platform/contracts/dash-sdk-contracts-create.md @@ -0,0 +1,36 @@ +**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](https://dashplatform.readme.io/docs/explanation-platform-protocol-data-contract) | +| **identity** | Identity | yes | A valid [registered `application` identity](https://dashplatform.readme.io/docs/dash-sdk-identities-register) | + +**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](https://dashplatform.readme.io/docs/dash-sdk-contracts-publish) method to register it. + +Returns: Contract. \ No newline at end of file diff --git a/docs/sdk-js/platform/contracts/dash-sdk-contracts-get.md b/docs/sdk-js/platform/contracts/dash-sdk-contracts-get.md new file mode 100644 index 000000000..ea9fec2b3 --- /dev/null +++ b/docs/sdk-js/platform/contracts/dash-sdk-contracts-get.md @@ -0,0 +1,12 @@ +**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). \ No newline at end of file diff --git a/docs/sdk-js/platform/contracts/dash-sdk-contracts-publish.md b/docs/sdk-js/platform/contracts/dash-sdk-contracts-publish.md new file mode 100644 index 000000000..825018035 --- /dev/null +++ b/docs/sdk-js/platform/contracts/dash-sdk-contracts-publish.md @@ -0,0 +1,21 @@ +**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](https://dashplatform.readme.io/docs/dash-sdk-documents-create) | +| **identity** | Identity | yes | A valid [registered `application` identity](https://dashplatform.readme.io/docs/dash-sdk-names-register) | + +**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. \ No newline at end of file diff --git a/docs/sdk-js/platform/contracts/dash-sdk-contracts-update.md b/docs/sdk-js/platform/contracts/dash-sdk-contracts-update.md new file mode 100644 index 000000000..976bf5903 --- /dev/null +++ b/docs/sdk-js/platform/contracts/dash-sdk-contracts-update.md @@ -0,0 +1,11 @@ +**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](https://dashplatform.readme.io/docs/dash-sdk-contracts-create) | +| **identity** | Identity | yes | A valid [registered `application` identity](https://dashplatform.readme.io/docs/dash-sdk-identities-register) | + +Returns: DataContractUpdateTransition. \ No newline at end of file diff --git a/docs/sdk-js/platform/contracts/dash-sdk-contracts.md b/docs/sdk-js/platform/contracts/dash-sdk-contracts.md new file mode 100644 index 000000000..d856ad3ca --- /dev/null +++ b/docs/sdk-js/platform/contracts/dash-sdk-contracts.md @@ -0,0 +1,5 @@ +## What is a contract + +Contracts are registered sets of rules defined in a [JSON Application Schema](https://dashplatform.readme.io/docs/core-concepts). + +See the Dash Platform documentation for more information about [Data Contracts](https://dashplatform.readme.io/docs/explanation-platform-protocol-data-contract). \ No newline at end of file diff --git a/docs/sdk-js/platform/dash-sdk-platform.md b/docs/sdk-js/platform/dash-sdk-platform.md new file mode 100644 index 000000000..7eab3d1e1 --- /dev/null +++ b/docs/sdk-js/platform/dash-sdk-platform.md @@ -0,0 +1,11 @@ +### About Dash 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?](https://dashplatform.readme.io/docs/introduction-what-is-dash-platform) + +### 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 \ No newline at end of file diff --git a/docs/sdk-js/platform/documents/dash-sdk-documents-broadcast.md b/docs/sdk-js/platform/documents/dash-sdk-documents-broadcast.md new file mode 100644 index 000000000..3fae01108 --- /dev/null +++ b/docs/sdk-js/platform/documents/dash-sdk-documents-broadcast.md @@ -0,0 +1,30 @@ +**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](https://dashplatform.readme.io/docs/dash-sdk-documents-create) to create | +| **documents.replace** | ExtendedDocument\[] | no | array of valid [created document](https://dashplatform.readme.io/docs/dash-sdk-documents-create) to replace | +| **documents.delete** | ExtendedDocument\[] | no | array of valid [created document](https://dashplatform.readme.io/docs/dash-sdk-documents-create) to delete | +| **identity** | Identity | yes | A valid [registered identity](https://dashplatform.readme.io/docs/dash-sdk-identities-register) | + +**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. \ No newline at end of file diff --git a/docs/sdk-js/platform/documents/dash-sdk-documents-create.md b/docs/sdk-js/platform/documents/dash-sdk-documents-create.md new file mode 100644 index 000000000..e6d0e8d7e --- /dev/null +++ b/docs/sdk-js/platform/documents/dash-sdk-documents-create.md @@ -0,0 +1,28 @@ +**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](https://dashplatform.readme.io/docs/dash-sdk-identities-register) | +| **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](https://dashplatform.readme.io/docs/dash-sdk-documents-broadcast) method to register it. + +Returns: ExtendedDocument \ No newline at end of file diff --git a/docs/sdk-js/platform/documents/dash-sdk-documents-get.md b/docs/sdk-js/platform/documents/dash-sdk-documents-get.md new file mode 100644 index 000000000..f451564c2 --- /dev/null +++ b/docs/sdk-js/platform/documents/dash-sdk-documents-get.md @@ -0,0 +1,33 @@ +**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 | how many objects to fetch | +| **startAt** | integer | no | number of objects to skip | +| **startAfter** | integer | no | exclusive skip | + +[Learn more about query syntax](https://dashplatform.readme.io/docs/reference-query-syntax). + +**Example**: + +```js + const queryOpts = { + where: [ + ['normalizedLabel', '==', 'alice'], + ['normalizedParentDomainName', '==', 'dash'], + ], + }; + await client.platform.documents.get('dpns.domain', queryOpts); +``` \ No newline at end of file diff --git a/docs/sdk-js/platform/documents/dash-sdk-documents.md b/docs/sdk-js/platform/documents/dash-sdk-documents.md new file mode 100644 index 000000000..281e76337 --- /dev/null +++ b/docs/sdk-js/platform/documents/dash-sdk-documents.md @@ -0,0 +1,6 @@ +## 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](https://dashplatform.readme.io/docs/explanation-platform-protocol-data-contract). \ No newline at end of file diff --git a/docs/sdk-js/platform/identities/dash-sdk-identities-get.md b/docs/sdk-js/platform/identities/dash-sdk-identities-get.md new file mode 100644 index 000000000..46d1026ab --- /dev/null +++ b/docs/sdk-js/platform/identities/dash-sdk-identities-get.md @@ -0,0 +1,12 @@ +**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). \ No newline at end of file diff --git a/docs/sdk-js/platform/identities/dash-sdk-identities-register.md b/docs/sdk-js/platform/identities/dash-sdk-identities-register.md new file mode 100644 index 000000000..0c03e5db7 --- /dev/null +++ b/docs/sdk-js/platform/identities/dash-sdk-identities-register.md @@ -0,0 +1,14 @@ +**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](https://dashplatform.readme.io/docs/dash-sdk-examples-use-different-account). + +Returns: Identity. \ No newline at end of file diff --git a/docs/sdk-js/platform/identities/dash-sdk-identities-topup.md b/docs/sdk-js/platform/identities/dash-sdk-identities-topup.md new file mode 100644 index 000000000..820a2400b --- /dev/null +++ b/docs/sdk-js/platform/identities/dash-sdk-identities-topup.md @@ -0,0 +1,23 @@ +**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](https://dashplatform.readme.io/docs/dash-sdk-identities-register) | +| **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. \ No newline at end of file diff --git a/docs/sdk-js/platform/identities/dash-sdk-identities.md b/docs/sdk-js/platform/identities/dash-sdk-identities.md new file mode 100644 index 000000000..b59eceebc --- /dev/null +++ b/docs/sdk-js/platform/identities/dash-sdk-identities.md @@ -0,0 +1,11 @@ +## 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](https://dashplatform.readme.io/docs/explanation-identity). +You might also want to consult the usage for the [DPNS Name Service](https://dashplatform.readme.io/docs/dash-sdk-names) in order to attach a name to your created identity. + +## Credits + +Each identity contains a credit balance. The ratio is 1 duff = 1000 credits. \ No newline at end of file diff --git a/docs/sdk-js/platform/names/dash-sdk-names-register.md b/docs/sdk-js/platform/names/dash-sdk-names-register.md new file mode 100644 index 000000000..901054b41 --- /dev/null +++ b/docs/sdk-js/platform/names/dash-sdk-names-register.md @@ -0,0 +1,16 @@ +**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.dashUniqueIdentityId** | String | no | Unique Identity ID for this name record | +| **records.dashAliasIdentityId** | String | no | Used to signify that this name is the alias for another id | +| **identity** | Identity | yes | A valid [registered identity](https://dashplatform.readme.io/docs/dash-sdk-identities-register) | + +**Example**: `await client.platform.names.register('alice', { dashUniqueIdentityId: identity.getId() }, identity)` + +Returns: the created domain document \ No newline at end of file diff --git a/docs/sdk-js/platform/names/dash-sdk-names-resolve.md b/docs/sdk-js/platform/names/dash-sdk-names-resolve.md new file mode 100644 index 000000000..5f6aac867 --- /dev/null +++ b/docs/sdk-js/platform/names/dash-sdk-names-resolve.md @@ -0,0 +1,12 @@ +**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). \ No newline at end of file diff --git a/docs/sdk-js/platform/names/dash-sdk-names-resolvebyrecord.md b/docs/sdk-js/platform/names/dash-sdk-names-resolvebyrecord.md new file mode 100644 index 000000000..c0369d001 --- /dev/null +++ b/docs/sdk-js/platform/names/dash-sdk-names-resolvebyrecord.md @@ -0,0 +1,20 @@ +**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 (`dashUniqueIdentityId` or `dashAliasIdentityId`) | +| **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('dashUniqueIdentityId', identityId); +``` + +Returns: array of ExtendedDocument. \ No newline at end of file diff --git a/docs/sdk-js/platform/names/dash-sdk-names-search.md b/docs/sdk-js/platform/names/dash-sdk-names-search.md new file mode 100644 index 000000000..0c59369cf --- /dev/null +++ b/docs/sdk-js/platform/names/dash-sdk-names-search.md @@ -0,0 +1,22 @@ +**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. \ No newline at end of file diff --git a/docs/sdk-js/platform/names/dash-sdk-names.md b/docs/sdk-js/platform/names/dash-sdk-names.md new file mode 100644 index 000000000..000005c9f --- /dev/null +++ b/docs/sdk-js/platform/names/dash-sdk-names.md @@ -0,0 +1,9 @@ +## 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. \ No newline at end of file diff --git a/docs/sdk-js/usage/dash-sdk-usage-dapi.md b/docs/sdk-js/usage/dash-sdk-usage-dapi.md new file mode 100644 index 000000000..5da156eff --- /dev/null +++ b/docs/sdk-js/usage/dash-sdk-usage-dapi.md @@ -0,0 +1,11 @@ +## 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](https://dashplatform.readme.io/docs/explanation-dapi). \ No newline at end of file diff --git a/docs/sdk-js/usage/dash-sdk-usage-dashcore-lib-primitives.md b/docs/sdk-js/usage/dash-sdk-usage-dashcore-lib-primitives.md new file mode 100644 index 000000000..269da2340 --- /dev/null +++ b/docs/sdk-js/usage/dash-sdk-usage-dashcore-lib-primitives.md @@ -0,0 +1,122 @@ +# 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) \ No newline at end of file diff --git a/docs/sdk-js/usage/dash-sdk-usage.md b/docs/sdk-js/usage/dash-sdk-usage.md new file mode 100644 index 000000000..3012f7a1b --- /dev/null +++ b/docs/sdk-js/usage/dash-sdk-usage.md @@ -0,0 +1,4 @@ +The following pages cover: + +- [Dapi](https://dashplatform.readme.io/docs/dash-sdk-usage-dapi) +- [Dashcore Lib Primitives](https://dashplatform.readme.io/docs/dash-sdk-usage-dashcore-lib-primitives) \ No newline at end of file diff --git a/docs/sdk-js/wallet/dash-sdk-wallet-accounts.md b/docs/sdk-js/wallet/dash-sdk-wallet-accounts.md new file mode 100644 index 000000000..1e38c434c --- /dev/null +++ b/docs/sdk-js/wallet/dash-sdk-wallet-accounts.md @@ -0,0 +1,25 @@ +## 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. + +``` +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. \ No newline at end of file diff --git a/docs/sdk-js/wallet/dash-sdk-wallet-signing-encrypt.md b/docs/sdk-js/wallet/dash-sdk-wallet-signing-encrypt.md new file mode 100644 index 000000000..f64a49628 --- /dev/null +++ b/docs/sdk-js/wallet/dash-sdk-wallet-signing-encrypt.md @@ -0,0 +1,28 @@ +## 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'); +``` \ No newline at end of file diff --git a/docs/sdk-js/wallet/dash-sdk-wallet.md b/docs/sdk-js/wallet/dash-sdk-wallet.md new file mode 100644 index 000000000..359f44856 --- /dev/null +++ b/docs/sdk-js/wallet/dash-sdk-wallet.md @@ -0,0 +1,7 @@ +### 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/) \ No newline at end of file From fb5159f4a33ef9b8f8594264a1f7c8854e16d6a5 Mon Sep 17 00:00:00 2001 From: thephez Date: Thu, 31 Aug 2023 12:28:17 -0400 Subject: [PATCH 02/12] refactor: update rename script and run --- ...from-its-name.md => fetch-an-identity-from-its-name.md} | 0 ...nerate-a-new-mnemonic.md => generate-a-new-mnemonic.md} | 0 ...-to-another-address.md => paying-to-another-address.md} | 0 ...check-balance.md => receive-money-and-check-balance.md} | 0 ...-and-verify-messages.md => sign-and-verify-messages.md} | 0 ...s-use-different-account.md => use-different-account.md} | 0 ...k-getting-started-about-schemas.md => about-schemas.md} | 0 ...k-getting-started-core-concepts.md => core-concepts.md} | 0 ...tform-applications.md => dash-platform-applications.md} | 0 ...h-sdk-getting-started-quick-start.md => quick-start.md} | 0 ...tting-started-with-typescript.md => with-typescript.md} | 0 ...with-multiple-apps.md => working-with-multiple-apps.md} | 0 docs/sdk-js/{dash-sdk-overview.md => overview.md} | 0 .../contracts/{dash-sdk-contracts-create.md => create.md} | 0 .../contracts/{dash-sdk-contracts-get.md => get.md} | 0 .../{dash-sdk-contracts-publish.md => publish.md} | 0 .../contracts/{dash-sdk-contracts-update.md => update.md} | 0 .../{dash-sdk-documents-broadcast.md => broadcast.md} | 0 .../documents/{dash-sdk-documents-create.md => create.md} | 0 .../documents/{dash-sdk-documents-get.md => get.md} | 0 .../identities/{dash-sdk-identities-get.md => get.md} | 0 .../{dash-sdk-identities-register.md => register.md} | 0 .../identities/{dash-sdk-identities-topup.md => topup.md} | 0 .../names/{dash-sdk-names-register.md => register.md} | 0 .../names/{dash-sdk-names-resolve.md => resolve.md} | 0 ...ash-sdk-names-resolvebyrecord.md => resolvebyrecord.md} | 0 .../platform/names/{dash-sdk-names-search.md => search.md} | 0 scripts/1-readme-rename.sh | 7 +++++++ 28 files changed, 7 insertions(+) rename docs/sdk-js/examples/{dash-sdk-examples-fetch-an-identity-from-its-name.md => fetch-an-identity-from-its-name.md} (100%) rename docs/sdk-js/examples/{dash-sdk-examples-generate-a-new-mnemonic.md => generate-a-new-mnemonic.md} (100%) rename docs/sdk-js/examples/{dash-sdk-examples-paying-to-another-address.md => paying-to-another-address.md} (100%) rename docs/sdk-js/examples/{dash-sdk-examples-receive-money-and-check-balance.md => receive-money-and-check-balance.md} (100%) rename docs/sdk-js/examples/{dash-sdk-examples-sign-and-verify-messages.md => sign-and-verify-messages.md} (100%) rename docs/sdk-js/examples/{dash-sdk-examples-use-different-account.md => use-different-account.md} (100%) rename docs/sdk-js/getting-started/{dash-sdk-getting-started-about-schemas.md => about-schemas.md} (100%) rename docs/sdk-js/getting-started/{dash-sdk-getting-started-core-concepts.md => core-concepts.md} (100%) rename docs/sdk-js/getting-started/{dash-sdk-getting-started-dash-platform-applications.md => dash-platform-applications.md} (100%) rename docs/sdk-js/getting-started/{dash-sdk-getting-started-quick-start.md => quick-start.md} (100%) rename docs/sdk-js/getting-started/{dash-sdk-getting-started-with-typescript.md => with-typescript.md} (100%) rename docs/sdk-js/getting-started/{dash-sdk-getting-started-working-with-multiple-apps.md => working-with-multiple-apps.md} (100%) rename docs/sdk-js/{dash-sdk-overview.md => overview.md} (100%) rename docs/sdk-js/platform/contracts/{dash-sdk-contracts-create.md => create.md} (100%) rename docs/sdk-js/platform/contracts/{dash-sdk-contracts-get.md => get.md} (100%) rename docs/sdk-js/platform/contracts/{dash-sdk-contracts-publish.md => publish.md} (100%) rename docs/sdk-js/platform/contracts/{dash-sdk-contracts-update.md => update.md} (100%) rename docs/sdk-js/platform/documents/{dash-sdk-documents-broadcast.md => broadcast.md} (100%) rename docs/sdk-js/platform/documents/{dash-sdk-documents-create.md => create.md} (100%) rename docs/sdk-js/platform/documents/{dash-sdk-documents-get.md => get.md} (100%) rename docs/sdk-js/platform/identities/{dash-sdk-identities-get.md => get.md} (100%) rename docs/sdk-js/platform/identities/{dash-sdk-identities-register.md => register.md} (100%) rename docs/sdk-js/platform/identities/{dash-sdk-identities-topup.md => topup.md} (100%) rename docs/sdk-js/platform/names/{dash-sdk-names-register.md => register.md} (100%) rename docs/sdk-js/platform/names/{dash-sdk-names-resolve.md => resolve.md} (100%) rename docs/sdk-js/platform/names/{dash-sdk-names-resolvebyrecord.md => resolvebyrecord.md} (100%) rename docs/sdk-js/platform/names/{dash-sdk-names-search.md => search.md} (100%) diff --git a/docs/sdk-js/examples/dash-sdk-examples-fetch-an-identity-from-its-name.md b/docs/sdk-js/examples/fetch-an-identity-from-its-name.md similarity index 100% rename from docs/sdk-js/examples/dash-sdk-examples-fetch-an-identity-from-its-name.md rename to docs/sdk-js/examples/fetch-an-identity-from-its-name.md diff --git a/docs/sdk-js/examples/dash-sdk-examples-generate-a-new-mnemonic.md b/docs/sdk-js/examples/generate-a-new-mnemonic.md similarity index 100% rename from docs/sdk-js/examples/dash-sdk-examples-generate-a-new-mnemonic.md rename to docs/sdk-js/examples/generate-a-new-mnemonic.md diff --git a/docs/sdk-js/examples/dash-sdk-examples-paying-to-another-address.md b/docs/sdk-js/examples/paying-to-another-address.md similarity index 100% rename from docs/sdk-js/examples/dash-sdk-examples-paying-to-another-address.md rename to docs/sdk-js/examples/paying-to-another-address.md diff --git a/docs/sdk-js/examples/dash-sdk-examples-receive-money-and-check-balance.md b/docs/sdk-js/examples/receive-money-and-check-balance.md similarity index 100% rename from docs/sdk-js/examples/dash-sdk-examples-receive-money-and-check-balance.md rename to docs/sdk-js/examples/receive-money-and-check-balance.md diff --git a/docs/sdk-js/examples/dash-sdk-examples-sign-and-verify-messages.md b/docs/sdk-js/examples/sign-and-verify-messages.md similarity index 100% rename from docs/sdk-js/examples/dash-sdk-examples-sign-and-verify-messages.md rename to docs/sdk-js/examples/sign-and-verify-messages.md diff --git a/docs/sdk-js/examples/dash-sdk-examples-use-different-account.md b/docs/sdk-js/examples/use-different-account.md similarity index 100% rename from docs/sdk-js/examples/dash-sdk-examples-use-different-account.md rename to docs/sdk-js/examples/use-different-account.md diff --git a/docs/sdk-js/getting-started/dash-sdk-getting-started-about-schemas.md b/docs/sdk-js/getting-started/about-schemas.md similarity index 100% rename from docs/sdk-js/getting-started/dash-sdk-getting-started-about-schemas.md rename to docs/sdk-js/getting-started/about-schemas.md diff --git a/docs/sdk-js/getting-started/dash-sdk-getting-started-core-concepts.md b/docs/sdk-js/getting-started/core-concepts.md similarity index 100% rename from docs/sdk-js/getting-started/dash-sdk-getting-started-core-concepts.md rename to docs/sdk-js/getting-started/core-concepts.md diff --git a/docs/sdk-js/getting-started/dash-sdk-getting-started-dash-platform-applications.md b/docs/sdk-js/getting-started/dash-platform-applications.md similarity index 100% rename from docs/sdk-js/getting-started/dash-sdk-getting-started-dash-platform-applications.md rename to docs/sdk-js/getting-started/dash-platform-applications.md diff --git a/docs/sdk-js/getting-started/dash-sdk-getting-started-quick-start.md b/docs/sdk-js/getting-started/quick-start.md similarity index 100% rename from docs/sdk-js/getting-started/dash-sdk-getting-started-quick-start.md rename to docs/sdk-js/getting-started/quick-start.md diff --git a/docs/sdk-js/getting-started/dash-sdk-getting-started-with-typescript.md b/docs/sdk-js/getting-started/with-typescript.md similarity index 100% rename from docs/sdk-js/getting-started/dash-sdk-getting-started-with-typescript.md rename to docs/sdk-js/getting-started/with-typescript.md diff --git a/docs/sdk-js/getting-started/dash-sdk-getting-started-working-with-multiple-apps.md b/docs/sdk-js/getting-started/working-with-multiple-apps.md similarity index 100% rename from docs/sdk-js/getting-started/dash-sdk-getting-started-working-with-multiple-apps.md rename to docs/sdk-js/getting-started/working-with-multiple-apps.md diff --git a/docs/sdk-js/dash-sdk-overview.md b/docs/sdk-js/overview.md similarity index 100% rename from docs/sdk-js/dash-sdk-overview.md rename to docs/sdk-js/overview.md diff --git a/docs/sdk-js/platform/contracts/dash-sdk-contracts-create.md b/docs/sdk-js/platform/contracts/create.md similarity index 100% rename from docs/sdk-js/platform/contracts/dash-sdk-contracts-create.md rename to docs/sdk-js/platform/contracts/create.md diff --git a/docs/sdk-js/platform/contracts/dash-sdk-contracts-get.md b/docs/sdk-js/platform/contracts/get.md similarity index 100% rename from docs/sdk-js/platform/contracts/dash-sdk-contracts-get.md rename to docs/sdk-js/platform/contracts/get.md diff --git a/docs/sdk-js/platform/contracts/dash-sdk-contracts-publish.md b/docs/sdk-js/platform/contracts/publish.md similarity index 100% rename from docs/sdk-js/platform/contracts/dash-sdk-contracts-publish.md rename to docs/sdk-js/platform/contracts/publish.md diff --git a/docs/sdk-js/platform/contracts/dash-sdk-contracts-update.md b/docs/sdk-js/platform/contracts/update.md similarity index 100% rename from docs/sdk-js/platform/contracts/dash-sdk-contracts-update.md rename to docs/sdk-js/platform/contracts/update.md diff --git a/docs/sdk-js/platform/documents/dash-sdk-documents-broadcast.md b/docs/sdk-js/platform/documents/broadcast.md similarity index 100% rename from docs/sdk-js/platform/documents/dash-sdk-documents-broadcast.md rename to docs/sdk-js/platform/documents/broadcast.md diff --git a/docs/sdk-js/platform/documents/dash-sdk-documents-create.md b/docs/sdk-js/platform/documents/create.md similarity index 100% rename from docs/sdk-js/platform/documents/dash-sdk-documents-create.md rename to docs/sdk-js/platform/documents/create.md diff --git a/docs/sdk-js/platform/documents/dash-sdk-documents-get.md b/docs/sdk-js/platform/documents/get.md similarity index 100% rename from docs/sdk-js/platform/documents/dash-sdk-documents-get.md rename to docs/sdk-js/platform/documents/get.md diff --git a/docs/sdk-js/platform/identities/dash-sdk-identities-get.md b/docs/sdk-js/platform/identities/get.md similarity index 100% rename from docs/sdk-js/platform/identities/dash-sdk-identities-get.md rename to docs/sdk-js/platform/identities/get.md diff --git a/docs/sdk-js/platform/identities/dash-sdk-identities-register.md b/docs/sdk-js/platform/identities/register.md similarity index 100% rename from docs/sdk-js/platform/identities/dash-sdk-identities-register.md rename to docs/sdk-js/platform/identities/register.md diff --git a/docs/sdk-js/platform/identities/dash-sdk-identities-topup.md b/docs/sdk-js/platform/identities/topup.md similarity index 100% rename from docs/sdk-js/platform/identities/dash-sdk-identities-topup.md rename to docs/sdk-js/platform/identities/topup.md diff --git a/docs/sdk-js/platform/names/dash-sdk-names-register.md b/docs/sdk-js/platform/names/register.md similarity index 100% rename from docs/sdk-js/platform/names/dash-sdk-names-register.md rename to docs/sdk-js/platform/names/register.md diff --git a/docs/sdk-js/platform/names/dash-sdk-names-resolve.md b/docs/sdk-js/platform/names/resolve.md similarity index 100% rename from docs/sdk-js/platform/names/dash-sdk-names-resolve.md rename to docs/sdk-js/platform/names/resolve.md diff --git a/docs/sdk-js/platform/names/dash-sdk-names-resolvebyrecord.md b/docs/sdk-js/platform/names/resolvebyrecord.md similarity index 100% rename from docs/sdk-js/platform/names/dash-sdk-names-resolvebyrecord.md rename to docs/sdk-js/platform/names/resolvebyrecord.md diff --git a/docs/sdk-js/platform/names/dash-sdk-names-search.md b/docs/sdk-js/platform/names/search.md similarity index 100% rename from docs/sdk-js/platform/names/dash-sdk-names-search.md rename to docs/sdk-js/platform/names/search.md diff --git a/scripts/1-readme-rename.sh b/scripts/1-readme-rename.sh index 2d0697590..371437546 100755 --- a/scripts/1-readme-rename.sh +++ b/scripts/1-readme-rename.sh @@ -10,5 +10,12 @@ find docs/intro -iname "*.md" -type f -name 'intro-*' -print0 | xargs -0 rename find docs/protocol-ref -iname "*.md" -type f -name 'platform-protocol-reference-*' -print0 | xargs -0 rename $RENAME_ARGS 's/platform-protocol-reference-//' find docs/reference -iname "*.md" -type f -name 'reference-*' -print0 | xargs -0 rename $RENAME_ARGS 's/reference-//' find docs/resources -iname "*.md" -type f -name 'resources-*' -print0 | xargs -0 rename $RENAME_ARGS 's/resources-//' +find docs/sdk-js -iname "*.md" -type f -name 'dash-sdk-overview*' -print0 | xargs -0 rename $RENAME_ARGS 's/dash-sdk-//' +find docs/sdk-js/examples -iname "*.md" -type f -name 'dash-sdk-examples-*' -print0 | xargs -0 rename $RENAME_ARGS 's/dash-sdk-examples-//' +find docs/sdk-js/getting-started -iname "*.md" -type f -name 'dash-sdk-getting-started-*' -print0 | xargs -0 rename $RENAME_ARGS 's/dash-sdk-getting-started-//' +find docs/sdk-js/platform -iname "*.md" -type f -name 'dash-sdk-contracts-*' -print0 | xargs -0 rename $RENAME_ARGS 's/dash-sdk-contracts-//' +find docs/sdk-js/platform -iname "*.md" -type f -name 'dash-sdk-documents-*' -print0 | xargs -0 rename $RENAME_ARGS 's/dash-sdk-documents-//' +find docs/sdk-js/platform -iname "*.md" -type f -name 'dash-sdk-identities-*' -print0 | xargs -0 rename $RENAME_ARGS 's/dash-sdk-identities-//' +find docs/sdk-js/platform -iname "*.md" -type f -name 'dash-sdk-names-*' -print0 | xargs -0 rename $RENAME_ARGS 's/dash-sdk-names-//' find docs/tutorials -iname "*.md" -type f -name 'tutorials-*' -print0 | xargs -0 rename $RENAME_ARGS 's/tutorials-//' find docs/tutorials -iname "*.md" -type f -name 'tutorial-*' -print0 | xargs -0 rename $RENAME_ARGS 's/tutorial-//' From 39c8497807d0ddc049c9dfd9159f21c9c33b5cb5 Mon Sep 17 00:00:00 2001 From: thephez Date: Thu, 31 Aug 2023 12:35:48 -0400 Subject: [PATCH 03/12] docs: add toctree for examples section --- docs/index.md | 10 ++++++++++ docs/sdk-js/examples/examples.md | 13 +++++++++++++ .../examples/fetch-an-identity-from-its-name.md | 2 +- docs/sdk-js/examples/generate-a-new-mnemonic.md | 2 +- docs/sdk-js/examples/paying-to-another-address.md | 2 +- .../examples/receive-money-and-check-balance.md | 4 +++- docs/sdk-js/examples/sign-and-verify-messages.md | 2 +- docs/sdk-js/examples/use-different-account.md | 2 +- docs/sdk-js/overview.md | 2 +- 9 files changed, 32 insertions(+), 7 deletions(-) create mode 100644 docs/sdk-js/examples/examples.md diff --git a/docs/index.md b/docs/index.md index 4245443be..6d9554b31 100644 --- a/docs/index.md +++ b/docs/index.md @@ -100,3 +100,13 @@ dapi-client-js/overview dapi-client-js/quick-start dapi-client-js/usage/usage ``` + +```{toctree} +:maxdepth: 2 +:titlesonly: +:caption: Dash SDK +:hidden: + +sdk-js/overview +sdk-js/examples/examples +``` diff --git a/docs/sdk-js/examples/examples.md b/docs/sdk-js/examples/examples.md new file mode 100644 index 000000000..e3aac57c3 --- /dev/null +++ b/docs/sdk-js/examples/examples.md @@ -0,0 +1,13 @@ +# 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 index aba53a4de..2e50c57a5 100644 --- a/docs/sdk-js/examples/fetch-an-identity-from-its-name.md +++ b/docs/sdk-js/examples/fetch-an-identity-from-its-name.md @@ -1,4 +1,4 @@ -## Fetching an identity from its name +# Fetching an identity from its name Assuming you have created an identity and attached a name to it (see how to [register an identity](https://dashplatform.readme.io/docs/tutorial-register-an-identity) and how to [attach it to a name](https://dashplatform.readme.io/docs/tutorial-register-a-name-for-an-identity)), you will then be able to directly recover an identity from its names. See below: diff --git a/docs/sdk-js/examples/generate-a-new-mnemonic.md b/docs/sdk-js/examples/generate-a-new-mnemonic.md index 429098664..9fb6bfcd6 100644 --- a/docs/sdk-js/examples/generate-a-new-mnemonic.md +++ b/docs/sdk-js/examples/generate-a-new-mnemonic.md @@ -1,4 +1,4 @@ -## Generate a new mnemonic +# 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. diff --git a/docs/sdk-js/examples/paying-to-another-address.md b/docs/sdk-js/examples/paying-to-another-address.md index 91f9b07a4..edbfca027 100644 --- a/docs/sdk-js/examples/paying-to-another-address.md +++ b/docs/sdk-js/examples/paying-to-another-address.md @@ -1,4 +1,4 @@ -## Paying to another address +# Paying to another address In order to pay, you need to have an [existing balance](https://dashplatform.readme.io/docs/dash-sdk-examples-receive-money-and-check-balance). The below code will allow you to pay to a single address a specific amount of satoshis. diff --git a/docs/sdk-js/examples/receive-money-and-check-balance.md b/docs/sdk-js/examples/receive-money-and-check-balance.md index 4999a22a1..4b8719770 100644 --- a/docs/sdk-js/examples/receive-money-and-check-balance.md +++ b/docs/sdk-js/examples/receive-money-and-check-balance.md @@ -1,4 +1,6 @@ -## Receive money and display balance +# Receive money and display balance + +## Initialize client Initialize the SDK Client with your [generated mnemonic](https://dashplatform.readme.io/docs/dash-sdk-examples-generate-a-new-mnemonic) passed as an option. diff --git a/docs/sdk-js/examples/sign-and-verify-messages.md b/docs/sdk-js/examples/sign-and-verify-messages.md index b7fe116fd..5faa38d48 100644 --- a/docs/sdk-js/examples/sign-and-verify-messages.md +++ b/docs/sdk-js/examples/sign-and-verify-messages.md @@ -1,4 +1,4 @@ -## Sign and verify messages +# Sign and verify messages Dash SDK exports the Message constructor inside the Core namespace `new Dash.Core.Message` diff --git a/docs/sdk-js/examples/use-different-account.md b/docs/sdk-js/examples/use-different-account.md index 2213bd8ae..e316a0e98 100644 --- a/docs/sdk-js/examples/use-different-account.md +++ b/docs/sdk-js/examples/use-different-account.md @@ -1,4 +1,4 @@ -## Using a different account +# 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). diff --git a/docs/sdk-js/overview.md b/docs/sdk-js/overview.md index dffe13064..249648485 100644 --- a/docs/sdk-js/overview.md +++ b/docs/sdk-js/overview.md @@ -1,4 +1,4 @@ -# Dash SDK +# 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) From e116fd5aa98e655b38fb66b72ccccb7260258592 Mon Sep 17 00:00:00 2001 From: thephez Date: Thu, 31 Aug 2023 13:00:52 -0400 Subject: [PATCH 04/12] docs: getting started section added --- docs/index.md | 1 + docs/sdk-js/examples/dash-sdk-examples.md | 8 -------- docs/sdk-js/getting-started/core-concepts.md | 2 +- .../getting-started/dash-platform-applications.md | 2 ++ .../getting-started/dash-sdk-getting-started.md | 8 -------- docs/sdk-js/getting-started/getting-started.md | 12 ++++++++++++ docs/sdk-js/getting-started/with-typescript.md | 2 ++ 7 files changed, 18 insertions(+), 17 deletions(-) delete mode 100644 docs/sdk-js/examples/dash-sdk-examples.md delete mode 100644 docs/sdk-js/getting-started/dash-sdk-getting-started.md create mode 100644 docs/sdk-js/getting-started/getting-started.md diff --git a/docs/index.md b/docs/index.md index 6d9554b31..f32f66869 100644 --- a/docs/index.md +++ b/docs/index.md @@ -109,4 +109,5 @@ dapi-client-js/usage/usage sdk-js/overview sdk-js/examples/examples +sdk-js/getting-started/getting-started ``` diff --git a/docs/sdk-js/examples/dash-sdk-examples.md b/docs/sdk-js/examples/dash-sdk-examples.md deleted file mode 100644 index 782bc121c..000000000 --- a/docs/sdk-js/examples/dash-sdk-examples.md +++ /dev/null @@ -1,8 +0,0 @@ -The following pages cover: - -- [Fetching an identity from its name](https://dashplatform.readme.io/docs/dash-sdk-examples-fetch-an-identity-from-its-name) -- [Generate a new mnemonic](https://dashplatform.readme.io/docs/dash-sdk-examples-generate-a-new-mnemonic) -- [Pay to another address](https://dashplatform.readme.io/docs/dash-sdk-examples-paying-to-another-address) -- [Receive money and check balance](https://dashplatform.readme.io/docs/dash-sdk-examples-receive-money-and-check-balance) -- [Sign and verify messages](https://dashplatform.readme.io/docs/dash-sdk-examples-sign-and-verify-messages) -- [Use different account](https://dashplatform.readme.io/docs/dash-sdk-examples-use-different-account) \ No newline at end of file diff --git a/docs/sdk-js/getting-started/core-concepts.md b/docs/sdk-js/getting-started/core-concepts.md index d068291dd..d57002715 100644 --- a/docs/sdk-js/getting-started/core-concepts.md +++ b/docs/sdk-js/getting-started/core-concepts.md @@ -1,4 +1,4 @@ -## Core concepts +# Core concepts The [Dash Core Developer Guide](https://dashcore.readme.io/docs/core-guide-introduction) 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. diff --git a/docs/sdk-js/getting-started/dash-platform-applications.md b/docs/sdk-js/getting-started/dash-platform-applications.md index 7ba76c026..81d9915d9 100644 --- a/docs/sdk-js/getting-started/dash-platform-applications.md +++ b/docs/sdk-js/getting-started/dash-platform-applications.md @@ -1,3 +1,5 @@ +# Dash Platform applications + ## DPNS DPNS is handled in the Dash SDK Client under the namespace `client.platform.names.*'`. [Read more here](https://dashplatform.readme.io/docs/dash-sdk-names) diff --git a/docs/sdk-js/getting-started/dash-sdk-getting-started.md b/docs/sdk-js/getting-started/dash-sdk-getting-started.md deleted file mode 100644 index 9083efbbb..000000000 --- a/docs/sdk-js/getting-started/dash-sdk-getting-started.md +++ /dev/null @@ -1,8 +0,0 @@ -The following pages cover: - -- [About schemas](https://dashplatform.readme.io/docs/dash-sdk-getting-started-about-schemas) -- [Core concepts](https://dashplatform.readme.io/docs/dash-sdk-getting-started-core-concepts) -- [Dash platform applications](https://dashplatform.readme.io/docs/dash-sdk-getting-started-dash-platform-applications) -- [Working with multiple apps](https://dashplatform.readme.io/docs/dash-sdk-getting-started-working-with-multiple-apps) -- [Quick starting the library](https://dashplatform.readme.io/docs/dash-sdk-getting-started-quick-start) -- [Use Dash SDK with TypeScript.](https://dashplatform.readme.io/docs/dash-sdk-getting-started-with-typescript) \ No newline at end of file diff --git a/docs/sdk-js/getting-started/getting-started.md b/docs/sdk-js/getting-started/getting-started.md new file mode 100644 index 000000000..d77eb3fcf --- /dev/null +++ b/docs/sdk-js/getting-started/getting-started.md @@ -0,0 +1,12 @@ +# 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/with-typescript.md b/docs/sdk-js/getting-started/with-typescript.md index cb4ffbfb5..635e19157 100644 --- a/docs/sdk-js/getting-started/with-typescript.md +++ b/docs/sdk-js/getting-started/with-typescript.md @@ -1,3 +1,5 @@ +# TypeScript + In order to use Dash SDK with TypeScript. Create an index.ts file From 542b399574830fe43dd5cde59f4bb75a30b1adee Mon Sep 17 00:00:00 2001 From: thephez Date: Thu, 31 Aug 2023 13:29:29 -0400 Subject: [PATCH 05/12] docs: rename files --- .../{dash-sdk-contracts.md => contracts.md} | 14 +++++++++++++- .../{dash-sdk-documents.md => documents.md} | 12 +++++++++++- .../{dash-sdk-identities.md => identities.md} | 12 +++++++++++- .../names/{dash-sdk-names.md => names.md} | 13 ++++++++++++- .../{dash-sdk-platform.md => platform.md} | 15 ++++++++++++--- 5 files changed, 59 insertions(+), 7 deletions(-) rename docs/sdk-js/platform/contracts/{dash-sdk-contracts.md => contracts.md} (70%) rename docs/sdk-js/platform/documents/{dash-sdk-documents.md => documents.md} (82%) rename docs/sdk-js/platform/identities/{dash-sdk-identities.md => identities.md} (88%) rename docs/sdk-js/platform/names/{dash-sdk-names.md => names.md} (78%) rename docs/sdk-js/platform/{dash-sdk-platform.md => platform.md} (75%) diff --git a/docs/sdk-js/platform/contracts/dash-sdk-contracts.md b/docs/sdk-js/platform/contracts/contracts.md similarity index 70% rename from docs/sdk-js/platform/contracts/dash-sdk-contracts.md rename to docs/sdk-js/platform/contracts/contracts.md index d856ad3ca..6d2cdbbb4 100644 --- a/docs/sdk-js/platform/contracts/dash-sdk-contracts.md +++ b/docs/sdk-js/platform/contracts/contracts.md @@ -1,5 +1,17 @@ +# Contracts + ## What is a contract Contracts are registered sets of rules defined in a [JSON Application Schema](https://dashplatform.readme.io/docs/core-concepts). -See the Dash Platform documentation for more information about [Data Contracts](https://dashplatform.readme.io/docs/explanation-platform-protocol-data-contract). \ No newline at end of file +See the Dash Platform documentation for more information about [Data Contracts](https://dashplatform.readme.io/docs/explanation-platform-protocol-data-contract). + +```{toctree} +:maxdepth: 2 +:titleonly: + +create +get +publish +update +``` diff --git a/docs/sdk-js/platform/documents/dash-sdk-documents.md b/docs/sdk-js/platform/documents/documents.md similarity index 82% rename from docs/sdk-js/platform/documents/dash-sdk-documents.md rename to docs/sdk-js/platform/documents/documents.md index 281e76337..8f8c31610 100644 --- a/docs/sdk-js/platform/documents/dash-sdk-documents.md +++ b/docs/sdk-js/platform/documents/documents.md @@ -1,6 +1,16 @@ +# 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](https://dashplatform.readme.io/docs/explanation-platform-protocol-data-contract). \ No newline at end of file +See more on the Dash Platform documentation about [Data Contract](https://dashplatform.readme.io/docs/explanation-platform-protocol-data-contract). + +```{toctree} +:maxdepth: 2 + +broadcast +create +get +``` diff --git a/docs/sdk-js/platform/identities/dash-sdk-identities.md b/docs/sdk-js/platform/identities/identities.md similarity index 88% rename from docs/sdk-js/platform/identities/dash-sdk-identities.md rename to docs/sdk-js/platform/identities/identities.md index b59eceebc..eabb9b7f2 100644 --- a/docs/sdk-js/platform/identities/dash-sdk-identities.md +++ b/docs/sdk-js/platform/identities/identities.md @@ -1,3 +1,5 @@ +# Identities + ## What is an identity An Identity is a blockchain-based identifier for individuals (users) and applications. @@ -8,4 +10,12 @@ You might also want to consult the usage for the [DPNS Name Service](https://das ## Credits -Each identity contains a credit balance. The ratio is 1 duff = 1000 credits. \ No newline at end of file +Each identity contains a credit balance. The ratio is 1 duff = 1000 credits. + +```{toctree} +:maxdepth: 2 + +get +register +topup +``` diff --git a/docs/sdk-js/platform/names/dash-sdk-names.md b/docs/sdk-js/platform/names/names.md similarity index 78% rename from docs/sdk-js/platform/names/dash-sdk-names.md rename to docs/sdk-js/platform/names/names.md index 000005c9f..1a21e6f81 100644 --- a/docs/sdk-js/platform/names/dash-sdk-names.md +++ b/docs/sdk-js/platform/names/names.md @@ -1,3 +1,5 @@ +# Names + ## What is DPNS DPNS is a special Dash Platform Application that is intended to provide a naming service for the Application Chain. @@ -6,4 +8,13 @@ Decoupling name from the blockchain identity enables a unique user experience co Limitation: max length of 63 characters on charset `0-9`,`A-Z`(case insensitive), `-`. -Domain names are linked to an Identity. \ No newline at end of file +Domain names are linked to an Identity. + +```{toctree} +:maxdepth: 2 + +register +resovle +resolvebyrecord +search +``` diff --git a/docs/sdk-js/platform/dash-sdk-platform.md b/docs/sdk-js/platform/platform.md similarity index 75% rename from docs/sdk-js/platform/dash-sdk-platform.md rename to docs/sdk-js/platform/platform.md index 7eab3d1e1..3a3b3dd47 100644 --- a/docs/sdk-js/platform/dash-sdk-platform.md +++ b/docs/sdk-js/platform/platform.md @@ -1,11 +1,20 @@ -### About Dash Platform +# 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?](https://dashplatform.readme.io/docs/introduction-what-is-dash-platform) -### Platform components +## 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 \ No newline at end of file +- DPNS: Naming service provided by a Dash Platform App + +```{toctree} +:maxdepth: 3 + +contracts/contracts +documents/documents +identities/identities +names/names +``` From d3423c4aed1cc36fa1c64c10f1b5b2c51f718cc5 Mon Sep 17 00:00:00 2001 From: thephez Date: Thu, 31 Aug 2023 13:30:11 -0400 Subject: [PATCH 06/12] docs: add headings --- docs/sdk-js/platform/contracts/create.md | 2 ++ docs/sdk-js/platform/contracts/get.md | 2 ++ docs/sdk-js/platform/contracts/publish.md | 2 ++ docs/sdk-js/platform/contracts/update.md | 2 ++ docs/sdk-js/platform/documents/broadcast.md | 2 ++ docs/sdk-js/platform/documents/create.md | 2 ++ docs/sdk-js/platform/documents/get.md | 2 ++ docs/sdk-js/platform/identities/get.md | 2 ++ docs/sdk-js/platform/identities/register.md | 2 ++ docs/sdk-js/platform/identities/topup.md | 2 ++ docs/sdk-js/platform/names/register.md | 2 ++ docs/sdk-js/platform/names/resolve.md | 2 ++ docs/sdk-js/platform/names/resolvebyrecord.md | 2 ++ docs/sdk-js/platform/names/search.md | 2 ++ 14 files changed, 28 insertions(+) diff --git a/docs/sdk-js/platform/contracts/create.md b/docs/sdk-js/platform/contracts/create.md index e8fc0a8b0..9757ea444 100644 --- a/docs/sdk-js/platform/contracts/create.md +++ b/docs/sdk-js/platform/contracts/create.md @@ -1,3 +1,5 @@ +# 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. diff --git a/docs/sdk-js/platform/contracts/get.md b/docs/sdk-js/platform/contracts/get.md index ea9fec2b3..7cf5587b0 100644 --- a/docs/sdk-js/platform/contracts/get.md +++ b/docs/sdk-js/platform/contracts/get.md @@ -1,3 +1,5 @@ +# Get + **Usage**: `client.platform.contracts.get(contractId)` **Description**: This method will allow you to fetch back a contract from its id. diff --git a/docs/sdk-js/platform/contracts/publish.md b/docs/sdk-js/platform/contracts/publish.md index 825018035..3efc0efa6 100644 --- a/docs/sdk-js/platform/contracts/publish.md +++ b/docs/sdk-js/platform/contracts/publish.md @@ -1,3 +1,5 @@ +# Publish + **Usage**: `client.platform.contracts.publish(contract, identity)` **Description**: This method will sign and broadcast any valid contract. diff --git a/docs/sdk-js/platform/contracts/update.md b/docs/sdk-js/platform/contracts/update.md index 976bf5903..fd7ac060a 100644 --- a/docs/sdk-js/platform/contracts/update.md +++ b/docs/sdk-js/platform/contracts/update.md @@ -1,3 +1,5 @@ +# Update + **Usage**: `client.platform.contracts.update(contract, identity)` **Description**: This method will sign and broadcast an updated valid contract. diff --git a/docs/sdk-js/platform/documents/broadcast.md b/docs/sdk-js/platform/documents/broadcast.md index 3fae01108..94eb876ad 100644 --- a/docs/sdk-js/platform/documents/broadcast.md +++ b/docs/sdk-js/platform/documents/broadcast.md @@ -1,3 +1,5 @@ +# Broadcast + **Usage**: `client.platform.document.broadcast(documents, identity)` **Description**: This method will broadcast the document on the Application Chain diff --git a/docs/sdk-js/platform/documents/create.md b/docs/sdk-js/platform/documents/create.md index e6d0e8d7e..e8e6365cb 100644 --- a/docs/sdk-js/platform/documents/create.md +++ b/docs/sdk-js/platform/documents/create.md @@ -1,3 +1,5 @@ +# 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. diff --git a/docs/sdk-js/platform/documents/get.md b/docs/sdk-js/platform/documents/get.md index f451564c2..1d77c5862 100644 --- a/docs/sdk-js/platform/documents/get.md +++ b/docs/sdk-js/platform/documents/get.md @@ -1,3 +1,5 @@ +# Get + **Usage**: `client.platform.documents.get(typeLocator, opts)` **Description**: This method will allow you to fetch back documents matching the provided parameters. diff --git a/docs/sdk-js/platform/identities/get.md b/docs/sdk-js/platform/identities/get.md index 46d1026ab..b9ba54088 100644 --- a/docs/sdk-js/platform/identities/get.md +++ b/docs/sdk-js/platform/identities/get.md @@ -1,3 +1,5 @@ +# Get + **Usage**: `client.platform.identities.get(identityId)` **Description**: This method will allow you to fetch back an identity from its id. diff --git a/docs/sdk-js/platform/identities/register.md b/docs/sdk-js/platform/identities/register.md index 0c03e5db7..c4678aba4 100644 --- a/docs/sdk-js/platform/identities/register.md +++ b/docs/sdk-js/platform/identities/register.md @@ -1,3 +1,5 @@ +# Register + **Usage**: `client.platform.identities.register()` **Description**: This method will register a new identity for you. diff --git a/docs/sdk-js/platform/identities/topup.md b/docs/sdk-js/platform/identities/topup.md index 820a2400b..347718c32 100644 --- a/docs/sdk-js/platform/identities/topup.md +++ b/docs/sdk-js/platform/identities/topup.md @@ -1,3 +1,5 @@ +# Topup + **Usage**: `client.platform.identities.topUp(identity, amount)` **Description**: This method will topup the provided identity's balance. diff --git a/docs/sdk-js/platform/names/register.md b/docs/sdk-js/platform/names/register.md index 901054b41..3c563c93e 100644 --- a/docs/sdk-js/platform/names/register.md +++ b/docs/sdk-js/platform/names/register.md @@ -1,3 +1,5 @@ +# 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. diff --git a/docs/sdk-js/platform/names/resolve.md b/docs/sdk-js/platform/names/resolve.md index 5f6aac867..ecd4a082c 100644 --- a/docs/sdk-js/platform/names/resolve.md +++ b/docs/sdk-js/platform/names/resolve.md @@ -1,3 +1,5 @@ +# Resovle + **Usage**: `client.platform.names.resolve('.dash')` **Description**: This method will allow you to resolve a DPNS record from its humanized name. diff --git a/docs/sdk-js/platform/names/resolvebyrecord.md b/docs/sdk-js/platform/names/resolvebyrecord.md index c0369d001..63b272456 100644 --- a/docs/sdk-js/platform/names/resolvebyrecord.md +++ b/docs/sdk-js/platform/names/resolvebyrecord.md @@ -1,3 +1,5 @@ +# ResolveByRecord + **Usage**: `client.platform.names.resolveByRecord(record, value)` **Description**: This method will allow you to resolve a DPNS record by identity ID. diff --git a/docs/sdk-js/platform/names/search.md b/docs/sdk-js/platform/names/search.md index 0c59369cf..0a3bc0141 100644 --- a/docs/sdk-js/platform/names/search.md +++ b/docs/sdk-js/platform/names/search.md @@ -1,3 +1,5 @@ +# 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. From acf544237f6640ce255d860fe80b47dea782eb2b Mon Sep 17 00:00:00 2001 From: thephez Date: Thu, 31 Aug 2023 13:30:32 -0400 Subject: [PATCH 07/12] docs: update dash sdk toctree location and content --- docs/index.md | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/docs/index.md b/docs/index.md index f32f66869..0b1135f25 100644 --- a/docs/index.md +++ b/docs/index.md @@ -93,21 +93,22 @@ Previous Version of Docs ```{toctree} :maxdepth: 2 :titlesonly: -:caption: DAPI Client +:caption: Dash SDK :hidden: -dapi-client-js/overview -dapi-client-js/quick-start -dapi-client-js/usage/usage +sdk-js/overview +sdk-js/examples/examples +sdk-js/getting-started/getting-started +sdk-js/platform/platform ``` ```{toctree} :maxdepth: 2 :titlesonly: -:caption: Dash SDK +:caption: DAPI Client :hidden: -sdk-js/overview -sdk-js/examples/examples -sdk-js/getting-started/getting-started +dapi-client-js/overview +dapi-client-js/quick-start +dapi-client-js/usage/usage ``` From 5d3013009972fb3c1817512764f8dff51542e410 Mon Sep 17 00:00:00 2001 From: thephez Date: Thu, 31 Aug 2023 13:50:52 -0400 Subject: [PATCH 08/12] docs: minor fixes --- docs/sdk-js/platform/contracts/contracts.md | 1 - docs/sdk-js/platform/names/names.md | 2 +- 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/docs/sdk-js/platform/contracts/contracts.md b/docs/sdk-js/platform/contracts/contracts.md index 6d2cdbbb4..5d8d03792 100644 --- a/docs/sdk-js/platform/contracts/contracts.md +++ b/docs/sdk-js/platform/contracts/contracts.md @@ -8,7 +8,6 @@ See the Dash Platform documentation for more information about [Data Contracts]( ```{toctree} :maxdepth: 2 -:titleonly: create get diff --git a/docs/sdk-js/platform/names/names.md b/docs/sdk-js/platform/names/names.md index 1a21e6f81..59400072b 100644 --- a/docs/sdk-js/platform/names/names.md +++ b/docs/sdk-js/platform/names/names.md @@ -14,7 +14,7 @@ Domain names are linked to an Identity. :maxdepth: 2 register -resovle +resolve resolvebyrecord search ``` From 3cde524c215f9bcf8a4908702969dd62f7498ee9 Mon Sep 17 00:00:00 2001 From: thephez Date: Thu, 31 Aug 2023 14:03:00 -0400 Subject: [PATCH 09/12] docs: add usage and wallet sections --- docs/index.md | 2 ++ .../usage/{dash-sdk-usage-dapi.md => dapi.md} | 2 ++ docs/sdk-js/usage/dash-sdk-usage.md | 4 ---- ...ib-primitives.md => dashcore-lib-primitives.md} | 0 docs/sdk-js/usage/usage.md | 9 +++++++++ .../{dash-sdk-wallet-accounts.md => accounts.md} | 2 ++ ...allet-signing-encrypt.md => signing-encrypt.md} | 2 ++ .../wallet/{dash-sdk-wallet.md => wallet.md} | 14 ++++++++++++-- scripts/1-readme-rename.sh | 2 ++ 9 files changed, 31 insertions(+), 6 deletions(-) rename docs/sdk-js/usage/{dash-sdk-usage-dapi.md => dapi.md} (97%) delete mode 100644 docs/sdk-js/usage/dash-sdk-usage.md rename docs/sdk-js/usage/{dash-sdk-usage-dashcore-lib-primitives.md => dashcore-lib-primitives.md} (100%) create mode 100644 docs/sdk-js/usage/usage.md rename docs/sdk-js/wallet/{dash-sdk-wallet-accounts.md => accounts.md} (98%) rename docs/sdk-js/wallet/{dash-sdk-wallet-signing-encrypt.md => signing-encrypt.md} (95%) rename docs/sdk-js/wallet/{dash-sdk-wallet.md => wallet.md} (65%) diff --git a/docs/index.md b/docs/index.md index 0b1135f25..8e6aef021 100644 --- a/docs/index.md +++ b/docs/index.md @@ -100,6 +100,8 @@ 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} diff --git a/docs/sdk-js/usage/dash-sdk-usage-dapi.md b/docs/sdk-js/usage/dapi.md similarity index 97% rename from docs/sdk-js/usage/dash-sdk-usage-dapi.md rename to docs/sdk-js/usage/dapi.md index 5da156eff..4fdb6208b 100644 --- a/docs/sdk-js/usage/dash-sdk-usage-dapi.md +++ b/docs/sdk-js/usage/dapi.md @@ -1,3 +1,5 @@ +# DAPI + ## About DAPI DAPI (Decentralized API) is a distributed and decentralized endpoints provided by the Masternode Network. diff --git a/docs/sdk-js/usage/dash-sdk-usage.md b/docs/sdk-js/usage/dash-sdk-usage.md deleted file mode 100644 index 3012f7a1b..000000000 --- a/docs/sdk-js/usage/dash-sdk-usage.md +++ /dev/null @@ -1,4 +0,0 @@ -The following pages cover: - -- [Dapi](https://dashplatform.readme.io/docs/dash-sdk-usage-dapi) -- [Dashcore Lib Primitives](https://dashplatform.readme.io/docs/dash-sdk-usage-dashcore-lib-primitives) \ No newline at end of file diff --git a/docs/sdk-js/usage/dash-sdk-usage-dashcore-lib-primitives.md b/docs/sdk-js/usage/dashcore-lib-primitives.md similarity index 100% rename from docs/sdk-js/usage/dash-sdk-usage-dashcore-lib-primitives.md rename to docs/sdk-js/usage/dashcore-lib-primitives.md diff --git a/docs/sdk-js/usage/usage.md b/docs/sdk-js/usage/usage.md new file mode 100644 index 000000000..dd2c4456a --- /dev/null +++ b/docs/sdk-js/usage/usage.md @@ -0,0 +1,9 @@ +# Usage + +```{toctree} +:maxdepth: 2 +:titlesonly: + +dapi +dashcore-lib-primitives +``` diff --git a/docs/sdk-js/wallet/dash-sdk-wallet-accounts.md b/docs/sdk-js/wallet/accounts.md similarity index 98% rename from docs/sdk-js/wallet/dash-sdk-wallet-accounts.md rename to docs/sdk-js/wallet/accounts.md index 1e38c434c..fdacb8ff4 100644 --- a/docs/sdk-js/wallet/dash-sdk-wallet-accounts.md +++ b/docs/sdk-js/wallet/accounts.md @@ -1,3 +1,5 @@ +# Accounts + ## Getting an account When Wallet is initialized with `mnemonic`, it holds multiple Accounts according to BIP44. diff --git a/docs/sdk-js/wallet/dash-sdk-wallet-signing-encrypt.md b/docs/sdk-js/wallet/signing-encrypt.md similarity index 95% rename from docs/sdk-js/wallet/dash-sdk-wallet-signing-encrypt.md rename to docs/sdk-js/wallet/signing-encrypt.md index f64a49628..b6d78ec8b 100644 --- a/docs/sdk-js/wallet/dash-sdk-wallet-signing-encrypt.md +++ b/docs/sdk-js/wallet/signing-encrypt.md @@ -1,3 +1,5 @@ +# Signing and encryption + ## Obtain account ```js diff --git a/docs/sdk-js/wallet/dash-sdk-wallet.md b/docs/sdk-js/wallet/wallet.md similarity index 65% rename from docs/sdk-js/wallet/dash-sdk-wallet.md rename to docs/sdk-js/wallet/wallet.md index 359f44856..f0f9513b6 100644 --- a/docs/sdk-js/wallet/dash-sdk-wallet.md +++ b/docs/sdk-js/wallet/wallet.md @@ -1,7 +1,17 @@ -### About Wallet-lib +# 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/) \ No newline at end of file +Find out more about the Wallet in its [complete documentation](https://dashpay.github.io/platform/Wallet-library/) + +```{toctree} +:maxdepth: 2 +:titlesonly: + +accounts +signing-encrypt +``` diff --git a/scripts/1-readme-rename.sh b/scripts/1-readme-rename.sh index 371437546..15900b4b9 100755 --- a/scripts/1-readme-rename.sh +++ b/scripts/1-readme-rename.sh @@ -17,5 +17,7 @@ find docs/sdk-js/platform -iname "*.md" -type f -name 'dash-sdk-contracts-*' -pr find docs/sdk-js/platform -iname "*.md" -type f -name 'dash-sdk-documents-*' -print0 | xargs -0 rename $RENAME_ARGS 's/dash-sdk-documents-//' find docs/sdk-js/platform -iname "*.md" -type f -name 'dash-sdk-identities-*' -print0 | xargs -0 rename $RENAME_ARGS 's/dash-sdk-identities-//' find docs/sdk-js/platform -iname "*.md" -type f -name 'dash-sdk-names-*' -print0 | xargs -0 rename $RENAME_ARGS 's/dash-sdk-names-//' +find docs/sdk-js/usage -iname "*.md" -type f -name 'dash-sdk-usage-*' -print0 | xargs -0 rename $RENAME_ARGS 's/dash-sdk-usage-//' +find docs/sdk-js/wallet -iname "*.md" -type f -name 'dash-sdk-wallet-*' -print0 | xargs -0 rename $RENAME_ARGS 's/dash-sdk-wallet-//' find docs/tutorials -iname "*.md" -type f -name 'tutorials-*' -print0 | xargs -0 rename $RENAME_ARGS 's/tutorials-//' find docs/tutorials -iname "*.md" -type f -name 'tutorial-*' -print0 | xargs -0 rename $RENAME_ARGS 's/tutorial-//' From ee20ad92c60dde388f7618c47089b11481a1166e Mon Sep 17 00:00:00 2001 From: thephez Date: Thu, 31 Aug 2023 14:52:20 -0400 Subject: [PATCH 10/12] docs: update some links from readme.io -> rtd --- .../examples/fetch-an-identity-from-its-name.md | 2 +- docs/sdk-js/examples/paying-to-another-address.md | 2 +- .../examples/receive-money-and-check-balance.md | 4 ++-- docs/sdk-js/getting-started/about-schemas.md | 2 +- docs/sdk-js/getting-started/core-concepts.md | 4 ++-- .../getting-started/dash-platform-applications.md | 2 +- docs/sdk-js/overview.md | 12 ++++++------ 7 files changed, 14 insertions(+), 14 deletions(-) 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 index 2e50c57a5..c32c8ff34 100644 --- a/docs/sdk-js/examples/fetch-an-identity-from-its-name.md +++ b/docs/sdk-js/examples/fetch-an-identity-from-its-name.md @@ -1,6 +1,6 @@ # Fetching an identity from its name -Assuming you have created an identity and attached a name to it (see how to [register an identity](https://dashplatform.readme.io/docs/tutorial-register-an-identity) and how to [attach it to a name](https://dashplatform.readme.io/docs/tutorial-register-a-name-for-an-identity)), you will then be able to directly recover an identity from its names. See below: +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({ diff --git a/docs/sdk-js/examples/paying-to-another-address.md b/docs/sdk-js/examples/paying-to-another-address.md index edbfca027..1eba64a9b 100644 --- a/docs/sdk-js/examples/paying-to-another-address.md +++ b/docs/sdk-js/examples/paying-to-another-address.md @@ -1,6 +1,6 @@ # Paying to another address -In order to pay, you need to have an [existing balance](https://dashplatform.readme.io/docs/dash-sdk-examples-receive-money-and-check-balance). +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 diff --git a/docs/sdk-js/examples/receive-money-and-check-balance.md b/docs/sdk-js/examples/receive-money-and-check-balance.md index 4b8719770..b0bd85aa2 100644 --- a/docs/sdk-js/examples/receive-money-and-check-balance.md +++ b/docs/sdk-js/examples/receive-money-and-check-balance.md @@ -2,7 +2,7 @@ ## Initialize client -Initialize the SDK Client with your [generated mnemonic](https://dashplatform.readme.io/docs/dash-sdk-examples-generate-a-new-mnemonic) passed as an option. +Initialize the SDK Client with your [generated mnemonic](../examples/generate-a-new-mnemonic.md) passed as an option. ```js const Dash = require("dash"); @@ -23,7 +23,7 @@ async function showBalance() { 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](https://dashplatform.readme.io/docs/dash-sdk-examples-use-different-account). +You can read more on [how to use a different account](../examples/use-different-account.md). ## Generate a receiving address diff --git a/docs/sdk-js/getting-started/about-schemas.md b/docs/sdk-js/getting-started/about-schemas.md index 036965588..edc7dbf46 100644 --- a/docs/sdk-js/getting-started/about-schemas.md +++ b/docs/sdk-js/getting-started/about-schemas.md @@ -2,4 +2,4 @@ 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](https://dashplatform.readme.io/docs/explanation-platform-protocol-data-contract). \ No newline at end of file +You can read more in the [Dash Platform Documentation - Data contract section](../../explanations/platform-protocol-data-contract.md). \ No newline at end of file diff --git a/docs/sdk-js/getting-started/core-concepts.md b/docs/sdk-js/getting-started/core-concepts.md index d57002715..1a66f2e25 100644 --- a/docs/sdk-js/getting-started/core-concepts.md +++ b/docs/sdk-js/getting-started/core-concepts.md @@ -16,7 +16,7 @@ Since the introduction of deterministic wallets ([BIP44](https://github.com/bitc 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](https://dashplatform.readme.io/docs/dash-sdk-examples-use-different-account) if you need to get an account at a specific index. +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 @@ -27,4 +27,4 @@ When registered, those applications schemas are called contracts and contains a 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](https://dashplatform.readme.io/docs/dash-sdk-getting-started-working-with-multiple-apps) \ No newline at end of file +See: [how to use multiple apps](../getting-started/working-with-multiple-apps.md) \ No newline at end of file diff --git a/docs/sdk-js/getting-started/dash-platform-applications.md b/docs/sdk-js/getting-started/dash-platform-applications.md index 81d9915d9..f07a91ed8 100644 --- a/docs/sdk-js/getting-started/dash-platform-applications.md +++ b/docs/sdk-js/getting-started/dash-platform-applications.md @@ -2,7 +2,7 @@ ## DPNS -DPNS is handled in the Dash SDK Client under the namespace `client.platform.names.*'`. [Read more here](https://dashplatform.readme.io/docs/dash-sdk-names) +DPNS is handled in the Dash SDK Client under the namespace `client.platform.names.*'`. [Read more here](../platform/names/names.md) ## DashPay diff --git a/docs/sdk-js/overview.md b/docs/sdk-js/overview.md index 249648485..8ecc33dd6 100644 --- a/docs/sdk-js/overview.md +++ b/docs/sdk-js/overview.md @@ -7,7 +7,7 @@ Dash library for JavaScript/TypeScript ecosystem (Wallet, DAPI, Primitives, BLS, ...) -Dash library provides access via [DAPI](https://dashplatform.readme.io/docs/explanation-dapi) 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. +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 @@ -29,14 +29,14 @@ npm install dash ### Usage examples -- [Generate a mnemonic](https://dashplatform.readme.io/docs/generate-a-new-mnemonic) -- [Receive money and display balance](https://dashplatform.readme.io/docs/dash-sdk-examples-receive-money-and-check-balance) -- [Pay to another address](https://dashplatform.readme.io/docs/dash-sdk-examples-paying-to-another-address) -- [Use another BIP44 account](https://dashplatform.readme.io/docs/use-different-account) +- [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](https://dashplatform.readme.io/docs/tutorials-introduction) of the Dash Platform documentation for examples. +See the [Tutorial section](../tutorials/introduction.md) of the Dash Platform documentation for examples. ## Licence From c64708f04949e71e22694cba72037f948762a528 Mon Sep 17 00:00:00 2001 From: thephez Date: Thu, 31 Aug 2023 16:11:35 -0400 Subject: [PATCH 11/12] docs: update links --- docs/sdk-js/getting-started/quick-start.md | 2 +- docs/sdk-js/platform/contracts/contracts.md | 4 ++-- docs/sdk-js/platform/contracts/create.md | 6 +++--- docs/sdk-js/platform/contracts/publish.md | 4 ++-- docs/sdk-js/platform/contracts/update.md | 4 ++-- docs/sdk-js/platform/documents/broadcast.md | 8 ++++---- docs/sdk-js/platform/documents/create.md | 4 ++-- docs/sdk-js/platform/documents/documents.md | 2 +- docs/sdk-js/platform/documents/get.md | 2 +- docs/sdk-js/platform/identities/identities.md | 4 ++-- docs/sdk-js/platform/identities/register.md | 2 +- docs/sdk-js/platform/identities/topup.md | 2 +- docs/sdk-js/platform/names/register.md | 2 +- docs/sdk-js/platform/platform.md | 2 +- docs/sdk-js/usage/dapi.md | 2 +- 15 files changed, 25 insertions(+), 25 deletions(-) diff --git a/docs/sdk-js/getting-started/quick-start.md b/docs/sdk-js/getting-started/quick-start.md index f49608314..ae84f7bdc 100644 --- a/docs/sdk-js/getting-started/quick-start.md +++ b/docs/sdk-js/getting-started/quick-start.md @@ -43,4 +43,4 @@ client.wallet.getAccount().then(async (account) => { ## Interact with Dash Platform -See the [Tutorial section](https://dashplatform.readme.io/docs/tutorials-introduction) of the Dash Platform documentation for examples. \ No newline at end of file +See the [Tutorial section](../../tutorials/introduction.md) of the Dash Platform documentation for examples. \ No newline at end of file diff --git a/docs/sdk-js/platform/contracts/contracts.md b/docs/sdk-js/platform/contracts/contracts.md index 5d8d03792..a1b4f52e9 100644 --- a/docs/sdk-js/platform/contracts/contracts.md +++ b/docs/sdk-js/platform/contracts/contracts.md @@ -2,9 +2,9 @@ ## What is a contract -Contracts are registered sets of rules defined in a [JSON Application Schema](https://dashplatform.readme.io/docs/core-concepts). +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](https://dashplatform.readme.io/docs/explanation-platform-protocol-data-contract). +See the Dash Platform documentation for more information about [Data Contracts](../../../explanations/platform-protocol-data-contract.md). ```{toctree} :maxdepth: 2 diff --git a/docs/sdk-js/platform/contracts/create.md b/docs/sdk-js/platform/contracts/create.md index 9757ea444..b6e1bed22 100644 --- a/docs/sdk-js/platform/contracts/create.md +++ b/docs/sdk-js/platform/contracts/create.md @@ -7,8 +7,8 @@ Parameters: | parameters | type | required | Description | | ----------------------- | ---------------- | -------- | ---------------------------------------------------------------------------------------------------------------------- | -| **contractDefinitions** | JSONDataContract | yes | The defined [JSON Application Schema](https://dashplatform.readme.io/docs/explanation-platform-protocol-data-contract) | -| **identity** | Identity | yes | A valid [registered `application` identity](https://dashplatform.readme.io/docs/dash-sdk-identities-register) | +| **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**: @@ -33,6 +33,6 @@ Parameters: const validationResult = client.platform.dpp.dataContract.validate(contract); ``` -**Note**: When your contract is created, it will only exist locally. Use the [publish](https://dashplatform.readme.io/docs/dash-sdk-contracts-publish) method to register it. +**Note**: When your contract is created, it will only exist locally. Use the [publish](../contracts/publish.md) method to register it. Returns: Contract. \ No newline at end of file diff --git a/docs/sdk-js/platform/contracts/publish.md b/docs/sdk-js/platform/contracts/publish.md index 3efc0efa6..9eb493f14 100644 --- a/docs/sdk-js/platform/contracts/publish.md +++ b/docs/sdk-js/platform/contracts/publish.md @@ -7,8 +7,8 @@ Parameters: | parameters | type | required | Description | | ------------ | -------- | -------- | -------------------------------------------------------------------------------------------------------- | -| **contract** | Contract | yes | A valid [created contract](https://dashplatform.readme.io/docs/dash-sdk-documents-create) | -| **identity** | Identity | yes | A valid [registered `application` identity](https://dashplatform.readme.io/docs/dash-sdk-names-register) | +| **contract** | Contract | yes | A valid [created contract](../contracts/create.md) | +| **identity** | Identity | yes | A valid [registered `application` identity](../identities/register.md) | **Example**: diff --git a/docs/sdk-js/platform/contracts/update.md b/docs/sdk-js/platform/contracts/update.md index fd7ac060a..e6ac2b0bf 100644 --- a/docs/sdk-js/platform/contracts/update.md +++ b/docs/sdk-js/platform/contracts/update.md @@ -7,7 +7,7 @@ Parameters: | parameters | type | required | Description | | ------------ | -------- | -------- | ------------------------------------------------------------------------------------------------------------- | -| **contract** | Contract | yes | A valid [created contract](https://dashplatform.readme.io/docs/dash-sdk-contracts-create) | -| **identity** | Identity | yes | A valid [registered `application` identity](https://dashplatform.readme.io/docs/dash-sdk-identities-register) | +| **contract** | Contract | yes | A valid [created contract](../contracts/create.md) | +| **identity** | Identity | yes | A valid [registered `application` identity](../identities/register.md) | Returns: DataContractUpdateTransition. \ No newline at end of file diff --git a/docs/sdk-js/platform/documents/broadcast.md b/docs/sdk-js/platform/documents/broadcast.md index 94eb876ad..da9d88c42 100644 --- a/docs/sdk-js/platform/documents/broadcast.md +++ b/docs/sdk-js/platform/documents/broadcast.md @@ -8,10 +8,10 @@ Parameters: | parameters | type | required | Description | | --------------------- | ------------------- | -------- | ----------------------------------------------------------------------------------------------------------- | | **documents** | Object | yes | | -| **documents.create** | ExtendedDocument\[] | no | array of valid [created document](https://dashplatform.readme.io/docs/dash-sdk-documents-create) to create | -| **documents.replace** | ExtendedDocument\[] | no | array of valid [created document](https://dashplatform.readme.io/docs/dash-sdk-documents-create) to replace | -| **documents.delete** | ExtendedDocument\[] | no | array of valid [created document](https://dashplatform.readme.io/docs/dash-sdk-documents-create) to delete | -| **identity** | Identity | yes | A valid [registered identity](https://dashplatform.readme.io/docs/dash-sdk-identities-register) | +| **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**: diff --git a/docs/sdk-js/platform/documents/create.md b/docs/sdk-js/platform/documents/create.md index e8e6365cb..f261034d7 100644 --- a/docs/sdk-js/platform/documents/create.md +++ b/docs/sdk-js/platform/documents/create.md @@ -8,7 +8,7 @@ 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](https://dashplatform.readme.io/docs/dash-sdk-identities-register) | +| **identity** | Identity | yes | A valid [registered identity](../identities/register.md) | | **docOpts** | Object | yes | A valid data that match the data contract structure | **Example**: @@ -25,6 +25,6 @@ const helloWorldDocument = await client.platform.documents.create( ); ``` -**Note**: When your document is created, it will only exist locally, use the [broadcast](https://dashplatform.readme.io/docs/dash-sdk-documents-broadcast) method to register it. +**Note**: When your document is created, it will only exist locally, use the [broadcast](../documents/broadcast.md) method to register it. Returns: ExtendedDocument \ No newline at end of file diff --git a/docs/sdk-js/platform/documents/documents.md b/docs/sdk-js/platform/documents/documents.md index 8f8c31610..f44b9180f 100644 --- a/docs/sdk-js/platform/documents/documents.md +++ b/docs/sdk-js/platform/documents/documents.md @@ -5,7 +5,7 @@ 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](https://dashplatform.readme.io/docs/explanation-platform-protocol-data-contract). +See more on the Dash Platform documentation about [Data Contract](../../../explanations/platform-protocol-data-contract.md). ```{toctree} :maxdepth: 2 diff --git a/docs/sdk-js/platform/documents/get.md b/docs/sdk-js/platform/documents/get.md index 1d77c5862..4772a6e12 100644 --- a/docs/sdk-js/platform/documents/get.md +++ b/docs/sdk-js/platform/documents/get.md @@ -20,7 +20,7 @@ Parameters: | **startAt** | integer | no | number of objects to skip | | **startAfter** | integer | no | exclusive skip | -[Learn more about query syntax](https://dashplatform.readme.io/docs/reference-query-syntax). +[Learn more about query syntax](../../../reference/query-syntax.md). **Example**: diff --git a/docs/sdk-js/platform/identities/identities.md b/docs/sdk-js/platform/identities/identities.md index eabb9b7f2..467ceeafc 100644 --- a/docs/sdk-js/platform/identities/identities.md +++ b/docs/sdk-js/platform/identities/identities.md @@ -5,8 +5,8 @@ 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](https://dashplatform.readme.io/docs/explanation-identity). -You might also want to consult the usage for the [DPNS Name Service](https://dashplatform.readme.io/docs/dash-sdk-names) in order to attach a name to your created identity. +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 diff --git a/docs/sdk-js/platform/identities/register.md b/docs/sdk-js/platform/identities/register.md index c4678aba4..cfd037c78 100644 --- a/docs/sdk-js/platform/identities/register.md +++ b/docs/sdk-js/platform/identities/register.md @@ -11,6 +11,6 @@ Parameters: **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](https://dashplatform.readme.io/docs/dash-sdk-examples-use-different-account). +**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. \ No newline at end of file diff --git a/docs/sdk-js/platform/identities/topup.md b/docs/sdk-js/platform/identities/topup.md index 347718c32..bca04e36f 100644 --- a/docs/sdk-js/platform/identities/topup.md +++ b/docs/sdk-js/platform/identities/topup.md @@ -9,7 +9,7 @@ Parameters: | parameters | type | required | Description | | ------------ | -------- | -------- | ----------------------------------------------------------------------------------------------- | -| **identity** | Identity | yes | A valid [registered identity](https://dashplatform.readme.io/docs/dash-sdk-identities-register) | +| **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**: diff --git a/docs/sdk-js/platform/names/register.md b/docs/sdk-js/platform/names/register.md index 3c563c93e..59482fc80 100644 --- a/docs/sdk-js/platform/names/register.md +++ b/docs/sdk-js/platform/names/register.md @@ -11,7 +11,7 @@ Parameters: | **records** | Object | yes | records object having only one of the following items | | **records.dashUniqueIdentityId** | String | no | Unique Identity ID for this name record | | **records.dashAliasIdentityId** | String | no | Used to signify that this name is the alias for another id | -| **identity** | Identity | yes | A valid [registered identity](https://dashplatform.readme.io/docs/dash-sdk-identities-register) | +| **identity** | Identity | yes | A valid [registered identity](../identities/register.md) | **Example**: `await client.platform.names.register('alice', { dashUniqueIdentityId: identity.getId() }, identity)` diff --git a/docs/sdk-js/platform/platform.md b/docs/sdk-js/platform/platform.md index 3a3b3dd47..11f4f1d4b 100644 --- a/docs/sdk-js/platform/platform.md +++ b/docs/sdk-js/platform/platform.md @@ -2,7 +2,7 @@ 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?](https://dashplatform.readme.io/docs/introduction-what-is-dash-platform) +You can learn more from the [Dash Platform Documentation - What is Dash Platform?](../../intro/what-is-dash-platform.md) ## Platform components diff --git a/docs/sdk-js/usage/dapi.md b/docs/sdk-js/usage/dapi.md index 4fdb6208b..83ade98b8 100644 --- a/docs/sdk-js/usage/dapi.md +++ b/docs/sdk-js/usage/dapi.md @@ -10,4 +10,4 @@ DAPI (Decentralized API) is a distributed and decentralized endpoints provided b const dapiClient = client.getDAPIClient(); ``` -The usage is then [described here](https://dashplatform.readme.io/docs/explanation-dapi). \ No newline at end of file +The usage is then [described here](../../explanations/dapi.md). \ No newline at end of file From b270fa83f12038d4e69feafe7b3f61731ce14c36 Mon Sep 17 00:00:00 2001 From: thephez Date: Thu, 31 Aug 2023 16:30:16 -0400 Subject: [PATCH 12/12] docs: update core links --- docs/dapi-client-js/usage/core/broadcasttransaction.md | 2 +- docs/intro/what-is-dash.md | 2 +- docs/reference/dapi-endpoints-core-grpc-endpoints.md | 2 +- docs/reference/dapi-endpoints.md | 2 +- docs/reference/glossary.md | 6 +++--- docs/sdk-js/getting-started/core-concepts.md | 4 ++-- 6 files changed, 9 insertions(+), 9 deletions(-) diff --git a/docs/dapi-client-js/usage/core/broadcasttransaction.md b/docs/dapi-client-js/usage/core/broadcasttransaction.md index 49cabc979..2dd20c4c0 100644 --- a/docs/dapi-client-js/usage/core/broadcasttransaction.md +++ b/docs/dapi-client-js/usage/core/broadcasttransaction.md @@ -14,4 +14,4 @@ Parameters: Returns : transactionId (string). -N.B : The TransactionID provided is subject to [transaction malleability](https://dashcore.readme.io/docs/core-guide-transactions-transaction-malleability), 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 +N.B : The TransactionID provided is subject to [transaction malleability](https://docs.dash.org/projects/core/en/stable/docs/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/intro/what-is-dash.md b/docs/intro/what-is-dash.md index 5f9c76a89..7cc511fa5 100644 --- a/docs/intro/what-is-dash.md +++ b/docs/intro/what-is-dash.md @@ -52,7 +52,7 @@ However, the Dash network has a second layer of network participants that provid ### Long-Living Masternode Quorums -Dash's [long-living masternode quorums](https://dashcore.readme.io/docs/core-guide-dash-features-masternode-quorums) (LLMQs) are used to facilitate the operation of masternode-provided features in a decentralized, deterministic way. These LLMQs are deterministic subsets of the overall masternode list that are formed via a [distributed key generation](../reference/glossary.md#distributed-key-generation-dkg) protocol and remain active for long periods of time (e.g. hours to days). The main task of LLMQs is to perform threshold signing of consensus-related messages for features like InstantSend and ChainLocks. +Dash's [long-living masternode quorums](https://docs.dash.org/projects/core/en/stable/docs/guide/dash-features-masternode-quorums.html) (LLMQs) are used to facilitate the operation of masternode-provided features in a decentralized, deterministic way. These LLMQs are deterministic subsets of the overall masternode list that are formed via a [distributed key generation](../reference/glossary.md#distributed-key-generation-dkg) protocol and remain active for long periods of time (e.g. hours to days). The main task of LLMQs is to perform threshold signing of consensus-related messages for features like InstantSend and ChainLocks. ### InstantSend diff --git a/docs/reference/dapi-endpoints-core-grpc-endpoints.md b/docs/reference/dapi-endpoints-core-grpc-endpoints.md index 6c9ce89e0..6e9628530 100644 --- a/docs/reference/dapi-endpoints-core-grpc-endpoints.md +++ b/docs/reference/dapi-endpoints-core-grpc-endpoints.md @@ -395,7 +395,7 @@ GetTransactionResponse { ### subscribeToBlockHeadersWithChainLocks -This endpoint helps support simplified payment verification ([SPV](https://dashcore.readme.io/docs/core-guide-operating-modes-simplified-payment-verification-spv)) via DAPI by providing access to block headers which can then be used to verify transactions and simplified masternode lists. +This endpoint helps support simplified payment verification ([SPV](https://docs.dash.org/projects/core/en/stable/docs/guide/operating-modes-simplified-payment-verification-spv.html)) via DAPI by providing access to block headers which can then be used to verify transactions and simplified masternode lists. **Returns**: streams the requested block header information **Parameters**: diff --git a/docs/reference/dapi-endpoints.md b/docs/reference/dapi-endpoints.md index 9548e6175..66f20fbc4 100644 --- a/docs/reference/dapi-endpoints.md +++ b/docs/reference/dapi-endpoints.md @@ -21,7 +21,7 @@ | 1 | [`getStatus`](../reference/dapi-endpoints-core-grpc-endpoints.md#getstatus) | Returns blockchain status information | | 1 | [`getTransaction`](../reference/dapi-endpoints-core-grpc-endpoints.md#gettransaction) | Returns details for the requested transaction | | 1 | [`subscribeTo` `BlockHeadersWithChainLocks`](../reference/dapi-endpoints-core-grpc-endpoints.md#subscribetoblockheaderswithchainlocks) | Returns the requested block headers along with the associated ChainLocks.
_Added in Dash Platform v0.22_ | -| 1 | [`subscribeTo` `TransactionsWithProofs`](../reference/dapi-endpoints-core-grpc-endpoints.md#subscribetotransactionswithproofs) | Returns transactions matching the provided bloom filter along with the associated [`islock` message](https://dashcore.readme.io/docs/core-ref-p2p-network-instantsend-messages#islock) and [merkle block](https://dashcore.readme.io/docs/core-ref-p2p-network-data-messages#merkleblock) | +| 1 | [`subscribeTo` `TransactionsWithProofs`](../reference/dapi-endpoints-core-grpc-endpoints.md#subscribetotransactionswithproofs) | Returns transactions matching the provided bloom filter along with the associated [`islock` message](https://docs.dash.org/projects/core/en/stable/docs/reference/p2p-network-instantsend-messages.html#islock) and [merkle block](https://docs.dash.org/projects/core/en/stable/docs/reference/p2p-network-data-messages.html#merkleblock) | ### Platform gRPC Service diff --git a/docs/reference/glossary.md b/docs/reference/glossary.md index 3e2071724..27baa8fae 100644 --- a/docs/reference/glossary.md +++ b/docs/reference/glossary.md @@ -66,7 +66,7 @@ An organization where decision making is governed according to a set of rules th ## Devnet -A development environment in which developers can obtain and spend Dash that has no real-world value on a network that is very similar to the Dash [mainnet](#mainnet). Multiple independent devnets can coexist without interference. Devnets can be either public or private networks. See the Testing Applications page for a more detailed description of network types. +A development environment in which developers can obtain and spend Dash that has no real-world value on a network that is very similar to the Dash [mainnet](#mainnet). Multiple independent devnets can coexist without interference. Devnets can be either public or private networks. See the Testing Applications page for a more detailed description of network types. ## Direct Settlement Payment Channel (DSPC) @@ -123,7 +123,7 @@ BLS signature resulting from some agreement within a masternode quorum ## Regtest -A local regression testing environment in which developers can almost instantly generate blocks on demand for testing events, and can create private Dash with no real-world value. See the Testing Applications page for a more detailed description of network types. +A local regression testing environment in which developers can almost instantly generate blocks on demand for testing events, and can create private Dash with no real-world value. See the Testing Applications page for a more detailed description of network types. ## Simple Payment Verification A method for verifying if transactions are part of a block without downloading the whole block. This is useful for lightweight clients which don't run continuously and which don't have the storage space or bandwidth for a full copy of the blockchain. @@ -142,7 +142,7 @@ Dash fork of [Tendermint](https://tendermint.com/core) modified for use in Dash ## Testnet -A global testing environment in which developers can obtain and spend Dash that has no real-world value on a network that is very similar to the Dash [mainnet](#mainnet). See the Testing Applications page for a more detailed description of network types. +A global testing environment in which developers can obtain and spend Dash that has no real-world value on a network that is very similar to the Dash [mainnet](#mainnet). See the Testing Applications page for a more detailed description of network types. See: [Intro to Testnet](../intro/to-testnet.md) for more information diff --git a/docs/sdk-js/getting-started/core-concepts.md b/docs/sdk-js/getting-started/core-concepts.md index 1a66f2e25..dc2ca8f96 100644 --- a/docs/sdk-js/getting-started/core-concepts.md +++ b/docs/sdk-js/getting-started/core-concepts.md @@ -1,10 +1,10 @@ # Core concepts -The [Dash Core Developer Guide](https://dashcore.readme.io/docs/core-guide-introduction) 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. +The [Dash Core Developer Guide](https://docs.dash.org/projects/core/en/stable/docs/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://dashcore.readme.io/docs/core-guide-block-chain-transaction-data) that are controlled by a Wallet instance. +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/projects/core/en/stable/docs/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.