dash 3.21.0-dev.9 → 3.21.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.mocharc.yml +1 -0
- package/CHANGELOG.md +34 -0
- package/build/src/SDK/Client/Client.js +2 -2
- package/build/src/SDK/Client/Platform/createAssetLockTransaction.js +1 -1
- package/build/src/SDK/Client/Platform/methods/documents/create.js +3 -0
- package/build/src/SDK/Client/Platform/methods/documents/create.js.map +1 -1
- package/build/src/SDK/Client/Platform/methods/names/register.js +1 -1
- package/build/src/SDK/Client/Platform/methods/names/register.js.map +1 -1
- package/build/src/utils/createFakeIntantLock.js +2 -0
- package/build/src/utils/createFakeIntantLock.js.map +1 -1
- package/dist/dash.min.js +7 -61
- package/dist/dash.min.js.LICENSE.txt +47 -0
- package/dist/src/SDK/Client/Platform/createAssetLockTransaction.d.ts +1 -1
- package/dist/src/SDK/SDK.d.ts +167 -4
- package/docs/README.md +6 -6
- package/docs/_sidebar.md +8 -8
- package/docs/examples/pay-to-another-address.md +1 -1
- package/docs/examples/publishing-a-new-contract.md +1 -1
- package/docs/examples/receive-money-and-check-balance.md +2 -2
- package/docs/getting-started/core-concepts.md +2 -2
- package/docs/getting-started/dash-platform-applications.md +1 -1
- package/docs/getting-started/quickstart.md +1 -1
- package/docs/platform/contracts/about-contracts.md +1 -1
- package/docs/platform/contracts/broadcast.md +2 -2
- package/docs/platform/contracts/create.md +2 -2
- package/docs/platform/documents/broadcast.md +4 -4
- package/docs/platform/documents/create.md +2 -2
- package/docs/platform/identities/about-identity.md +1 -1
- package/docs/platform/identities/register.md +1 -1
- package/docs/platform/identities/topUp.md +1 -1
- package/docs/platform/names/register.md +1 -1
- package/karma.conf.js +4 -1
- package/package.json +39 -22
- package/src/SDK/Client/Client.ts +2 -2
- package/src/SDK/Client/Platform/createAssetLockTransaction.ts +1 -1
- package/src/SDK/Client/Platform/methods/documents/create.ts +4 -0
- package/src/SDK/Client/Platform/methods/names/register.ts +1 -1
- package/src/utils/createFakeIntantLock.ts +2 -0
- package/webpack.base.config.js +23 -9
- package/webpack.config.js +23 -11
- package/.editorconfig +0 -2
- package/.github/ISSUE_TEMPLATE/bug_report.md +0 -38
- package/.github/ISSUE_TEMPLATE/feature_request.md +0 -27
- package/.github/PULL_REQUEST_TEMPLATE.md +0 -32
- package/.github/workflows/.env +0 -4
- package/.github/workflows/test_and_release.yml +0 -170
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/*!
|
|
2
|
+
* The buffer module from node.js, for the browser.
|
|
3
|
+
*
|
|
4
|
+
* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
|
|
5
|
+
* @license MIT
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
/*!
|
|
9
|
+
* The buffer module from node.js, for the browser.
|
|
10
|
+
*
|
|
11
|
+
* @author Feross Aboukhadijeh <https://feross.org>
|
|
12
|
+
* @license MIT
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/*! https://mths.be/punycode v1.3.2 by @mathias */
|
|
16
|
+
|
|
17
|
+
/*! ieee754. BSD-3-Clause License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
18
|
+
|
|
19
|
+
/*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @license
|
|
23
|
+
* Lodash <https://lodash.com/>
|
|
24
|
+
* Copyright OpenJS Foundation and other contributors <https://openjsf.org/>
|
|
25
|
+
* Released under MIT license <https://lodash.com/license>
|
|
26
|
+
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
|
|
27
|
+
* Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
|
|
28
|
+
*/
|
|
29
|
+
|
|
30
|
+
/** @license URI.js v4.4.1 (c) 2011 Gary Court. License: http://github.com/garycourt/uri-js */
|
|
31
|
+
|
|
32
|
+
/** @preserve
|
|
33
|
+
* Counter block mode compatible with Dr Brian Gladman fileenc.c
|
|
34
|
+
* derived from CryptoJS.mode.CTR
|
|
35
|
+
* Jan Hruby jhruby.web@gmail.com
|
|
36
|
+
*/
|
|
37
|
+
|
|
38
|
+
/** @preserve
|
|
39
|
+
(c) 2012 by Cédric Mesnil. All rights reserved.
|
|
40
|
+
|
|
41
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:
|
|
42
|
+
|
|
43
|
+
- Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
|
|
44
|
+
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
|
45
|
+
|
|
46
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
47
|
+
*/
|
|
@@ -4,7 +4,7 @@ import { Platform } from "./Platform";
|
|
|
4
4
|
* Creates a funding transaction for the platform identity and returns one-time key to sign the state transition
|
|
5
5
|
* @param {Platform} platform
|
|
6
6
|
* @param {number} fundingAmount - amount of dash to fund the identity's credits
|
|
7
|
-
* @return {{transaction: Transaction, privateKey: PrivateKey}} - transaction and one time private key
|
|
7
|
+
* @return {Promise<{transaction: Transaction, privateKey: PrivateKey}>} - transaction and one time private key
|
|
8
8
|
* that can be used to sign registration/top-up state transition
|
|
9
9
|
*/
|
|
10
10
|
export default function createAssetLockTransaction(platform: Platform, fundingAmount: any): Promise<{
|
package/dist/src/SDK/SDK.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
1
2
|
import { Client as _Client } from './Client';
|
|
2
3
|
import { Platform as _Platform } from './Platform';
|
|
3
4
|
import { Wallet as _Wallet, Account as _Account, KeyChain as _KeyChain } from '@dashevo/wallet-lib';
|
|
@@ -10,10 +11,172 @@ export declare namespace SDK {
|
|
|
10
11
|
let Account: typeof _Account;
|
|
11
12
|
let KeyChain: typeof _KeyChain;
|
|
12
13
|
let WalletLib: {
|
|
13
|
-
CONSTANTS:
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
CONSTANTS: {
|
|
15
|
+
BIP45: string;
|
|
16
|
+
BIP44: string;
|
|
17
|
+
DUFFS_PER_DASH: number;
|
|
18
|
+
BIP44_ADDRESS_GAP: number;
|
|
19
|
+
SECURE_TRANSACTION_CONFIRMATIONS_NB: number;
|
|
20
|
+
BIP32__ROOT_PATH: string;
|
|
21
|
+
BIP44_LIVENET_ROOT_PATH: string;
|
|
22
|
+
BIP44_TESTNET_ROOT_PATH: string;
|
|
23
|
+
DIP9_LIVENET_ROOT_PATH: string;
|
|
24
|
+
DIP9_TESTNET_ROOT_PATH: string;
|
|
25
|
+
UTXO_SELECTION_MAX_SINGLE_UTXO_FACTOR: number;
|
|
26
|
+
UTXO_SELECTION_MIN_TX_AMOUNT_VS_UTXO_FACTOR: number;
|
|
27
|
+
UTXO_SELECTION_MAX_FEE_VS_TX_AMOUNT_FACTOR: number;
|
|
28
|
+
UTXO_SELECTION_MAX_FEE_VS_SINGLE_UTXO_FEE_FACTOR: number;
|
|
29
|
+
MAX_STANDARD_TX_SIZE: number;
|
|
30
|
+
MAX_P2SH_SIGOPS: number;
|
|
31
|
+
COINBASE_MATURITY: number;
|
|
32
|
+
UTXO_CHAINED_SPENDING_LIMIT_FOR_TX: number;
|
|
33
|
+
FEES: {
|
|
34
|
+
DUST_RELAY_TX_FEE: number;
|
|
35
|
+
ZERO: number;
|
|
36
|
+
ECONOMIC: number;
|
|
37
|
+
NORMAL: number;
|
|
38
|
+
PRIORITY: number;
|
|
39
|
+
INSTANT_FEE_PER_INPUTS: number;
|
|
40
|
+
};
|
|
41
|
+
UNCONFIRMED_TRANSACTION_STATUS_CODE: number;
|
|
42
|
+
WALLET_TYPES: {
|
|
43
|
+
ADDRESS: string;
|
|
44
|
+
PUBLICKEY: string;
|
|
45
|
+
PRIVATEKEY: string;
|
|
46
|
+
SINGLE_ADDRESS: string;
|
|
47
|
+
HDWALLET: string;
|
|
48
|
+
HDPUBLIC: string;
|
|
49
|
+
};
|
|
50
|
+
INJECTION_LISTS: {
|
|
51
|
+
SAFE_FUNCTIONS: string[];
|
|
52
|
+
UNSAFE_FUNCTIONS: string[];
|
|
53
|
+
UNSAFE_PROPERTIES: string[];
|
|
54
|
+
SAFE_PROPERTIES: string[];
|
|
55
|
+
};
|
|
56
|
+
TRANSACTION_HISTORY_TYPES: {
|
|
57
|
+
RECEIVED: string;
|
|
58
|
+
SENT: string;
|
|
59
|
+
ADDRESS_TRANSFER: string;
|
|
60
|
+
ACCOUNT_TRANSFER: string;
|
|
61
|
+
UNKNOWN: string;
|
|
62
|
+
};
|
|
63
|
+
STORAGE: {
|
|
64
|
+
autosaveIntervalTime: number;
|
|
65
|
+
};
|
|
66
|
+
TXIN_OUTPOINT_TXID_BYTES: number;
|
|
67
|
+
TXIN_OUTPOINT_INDEX_BYTES: number;
|
|
68
|
+
TXIN_SEQUENCE_BYTES: number;
|
|
69
|
+
TXOUT_DUFFS_VALUE_BYTES: number;
|
|
70
|
+
VERSION_BYTES: number;
|
|
71
|
+
N_LOCKTIME_BYTES: number;
|
|
72
|
+
BLOOM_FALSE_POSITIVE_RATE: number;
|
|
73
|
+
NULL_HASH: string;
|
|
74
|
+
};
|
|
75
|
+
EVENTS: {
|
|
76
|
+
PREFETCHED: string;
|
|
77
|
+
CREATED: string;
|
|
78
|
+
STARTED: string;
|
|
79
|
+
READY: string;
|
|
80
|
+
CONFIRMED_BALANCE_CHANGED: string;
|
|
81
|
+
UNCONFIRMED_BALANCE_CHANGED: string;
|
|
82
|
+
BLOCKHEIGHT_CHANGED: string;
|
|
83
|
+
BLOCK: string;
|
|
84
|
+
TRANSACTION: string;
|
|
85
|
+
BLOCKHEADER: string;
|
|
86
|
+
FETCHED_ADDRESS: string;
|
|
87
|
+
ERROR_UPDATE_ADDRESS: string;
|
|
88
|
+
FETCHED_TRANSACTION: string;
|
|
89
|
+
FETCHED_UNCONFIRMED_TRANSACTION: string;
|
|
90
|
+
FETCHED_CONFIRMED_TRANSACTION: string;
|
|
91
|
+
GENERATED_ADDRESS: string;
|
|
92
|
+
DISCOVERY_STARTED: string;
|
|
93
|
+
CONFIGURED: string;
|
|
94
|
+
INITIALIZED: string;
|
|
95
|
+
SAVE_STATE_FAILED: string;
|
|
96
|
+
SAVE_STATE_SUCCESS: string;
|
|
97
|
+
REHYDRATE_STATE_FAILED: string;
|
|
98
|
+
REHYDRATE_STATE_SUCCESS: string;
|
|
99
|
+
INSTANT_LOCK: string;
|
|
100
|
+
};
|
|
101
|
+
plugins: {
|
|
102
|
+
StandardPlugin: typeof import("@dashevo/wallet-lib/src/plugins/StandardPlugin");
|
|
103
|
+
Worker: typeof import("@dashevo/wallet-lib/src/plugins/Worker");
|
|
104
|
+
};
|
|
105
|
+
utils: {
|
|
106
|
+
extendTransactionsWithMetadata: (transactions: any, transactionsMetadata: any) => any[];
|
|
107
|
+
varIntSizeBytesFromLength: (length: any) => number;
|
|
108
|
+
calculateTransactionFees: typeof import("@dashevo/wallet-lib/src/utils/calculateTransactionFees");
|
|
109
|
+
categorizeTransactions: typeof import("@dashevo/wallet-lib/src/utils/categorizeTransactions");
|
|
110
|
+
mnemonicToHDPrivateKey: (mnemonic: any, network?: any, passphrase?: string) => any;
|
|
111
|
+
generateNewMnemonic: () => any;
|
|
112
|
+
seedToHDPrivateKey: (seed: any, network?: string) => any;
|
|
113
|
+
mnemonicToWalletId: (mnemonic: any) => string;
|
|
114
|
+
filterTransactions: typeof import("@dashevo/wallet-lib/src/utils/filterTransactions");
|
|
115
|
+
classifyAddresses: typeof import("@dashevo/wallet-lib/src/utils/classifyAddresses");
|
|
116
|
+
mnemonicToSeed: (mnemonic: any, password?: string) => any;
|
|
117
|
+
feeCalculation: (type?: string) => {
|
|
118
|
+
type: null;
|
|
119
|
+
value: null;
|
|
120
|
+
};
|
|
121
|
+
coinSelection: (utxosList: any, outputsList: any, deductFee?: boolean, feeCategory?: string, strategy?: (utxosList: any, outputsList: any, deductFee?: any, feeCategory?: any) => {
|
|
122
|
+
utxos: never[];
|
|
123
|
+
outputs: never[];
|
|
124
|
+
feeCategory: any;
|
|
125
|
+
estimatedFee: number;
|
|
126
|
+
utxosValue: number;
|
|
127
|
+
}) => {
|
|
128
|
+
utxos: never[];
|
|
129
|
+
outputs: never[];
|
|
130
|
+
feeCategory: any;
|
|
131
|
+
estimatedFee: number;
|
|
132
|
+
utxosValue: number;
|
|
133
|
+
};
|
|
134
|
+
doubleSha256: (data: any) => Buffer;
|
|
135
|
+
dashToDuffs: typeof import("@dashevo/wallet-lib/src/utils/dashToDuffs");
|
|
136
|
+
duffsToDash: typeof import("@dashevo/wallet-lib/src/utils/duffsToDash");
|
|
137
|
+
fundWallet: typeof import("@dashevo/wallet-lib/src/utils/fundWallet");
|
|
138
|
+
getBytesOf: typeof import("@dashevo/wallet-lib/src/utils/getBytesOf");
|
|
139
|
+
hasMethod: typeof import("@dashevo/wallet-lib/src/utils/hasMethod");
|
|
140
|
+
hasProp: typeof import("@dashevo/wallet-lib/src/utils/hasProp");
|
|
141
|
+
sha256: (data: any) => Buffer;
|
|
142
|
+
hash: (alg: any, data: any) => Buffer;
|
|
143
|
+
is: {
|
|
144
|
+
arr: (arr: any) => boolean;
|
|
145
|
+
num: (num: any) => boolean;
|
|
146
|
+
float: (float: any) => boolean;
|
|
147
|
+
int: (int: any) => boolean;
|
|
148
|
+
hex: (h: any) => boolean;
|
|
149
|
+
string: (str: any) => boolean;
|
|
150
|
+
bool: (b: any) => boolean;
|
|
151
|
+
obj: (obj: any) => boolean;
|
|
152
|
+
fn: (fn: any) => boolean;
|
|
153
|
+
type(val: any, type: any): boolean;
|
|
154
|
+
def: (val: any) => boolean;
|
|
155
|
+
undef: (val: any) => boolean;
|
|
156
|
+
null: (val: any) => boolean;
|
|
157
|
+
exist: (val: any) => boolean;
|
|
158
|
+
undefOrNull: (val: any) => boolean;
|
|
159
|
+
promise: (fn: any) => boolean;
|
|
160
|
+
JSON(val: any): boolean;
|
|
161
|
+
stringified(val: any): boolean;
|
|
162
|
+
mnemonic: (mnemonic: any) => boolean;
|
|
163
|
+
network: (network: any) => boolean;
|
|
164
|
+
publicKey: (pKey: any) => any;
|
|
165
|
+
privateKey: (pKey: any) => any;
|
|
166
|
+
HDPrivateKey: (hdKey: any) => any;
|
|
167
|
+
HDPublicKey: (hdKey: any) => any;
|
|
168
|
+
seed: (seed: any) => boolean;
|
|
169
|
+
address: (addr: any) => boolean;
|
|
170
|
+
addressObj: (addrObj: any) => boolean;
|
|
171
|
+
transactionObj: (tx: any) => boolean;
|
|
172
|
+
dashcoreTransaction: (tx: any) => boolean;
|
|
173
|
+
feeRate: (feeRate: any) => boolean;
|
|
174
|
+
txid: (txid: any) => boolean;
|
|
175
|
+
utxo: (utxo: any) => boolean;
|
|
176
|
+
output: (output: any) => boolean;
|
|
177
|
+
rawtx: (rawtx: any) => boolean;
|
|
178
|
+
};
|
|
179
|
+
};
|
|
17
180
|
};
|
|
18
181
|
}
|
|
19
182
|
export { SDK as default };
|
package/docs/README.md
CHANGED
|
@@ -65,12 +65,12 @@ client.getWalletAccount().then(async (account) => {
|
|
|
65
65
|
|
|
66
66
|
### Use-cases examples
|
|
67
67
|
|
|
68
|
-
- [Generate a mnemonic](
|
|
69
|
-
- [Receive money and display balance](
|
|
70
|
-
- [Pay to another address](
|
|
71
|
-
- [Use a local evonet](
|
|
72
|
-
- [Publishing a new contract](
|
|
73
|
-
- [Use another BIP44 account](
|
|
68
|
+
- [Generate a mnemonic](examples/generate-a-new-mnemonic.md)
|
|
69
|
+
- [Receive money and display balance](examples/receive-money-and-check-balance.md)
|
|
70
|
+
- [Pay to another address](examples/pay-to-another-address.md)
|
|
71
|
+
- [Use a local evonet](examples/use-local-evonet.md)
|
|
72
|
+
- [Publishing a new contract](examples/publishing-a-new-contract.md)
|
|
73
|
+
- [Use another BIP44 account](examples/use-different-account.md)
|
|
74
74
|
|
|
75
75
|
### Tutorial
|
|
76
76
|
|
package/docs/_sidebar.md
CHANGED
|
@@ -7,14 +7,14 @@
|
|
|
7
7
|
- [With TypeScript](getting-started/with-typescript.md)
|
|
8
8
|
|
|
9
9
|
- Examples
|
|
10
|
-
- [Generate a mnemonic](
|
|
11
|
-
- [Receive money and display balance](
|
|
12
|
-
- [Pay to another address](
|
|
13
|
-
- [Use a local evonet](
|
|
14
|
-
- [Fetch an identity from its name](
|
|
15
|
-
- [Publishing a new contract](
|
|
16
|
-
- [Use another BIP44 account](
|
|
17
|
-
- [Sign and verify messages](
|
|
10
|
+
- [Generate a mnemonic](examples/generate-a-new-mnemonic.md)
|
|
11
|
+
- [Receive money and display balance](examples/receive-money-and-check-balance.md)
|
|
12
|
+
- [Pay to another address](examples/pay-to-another-address.md)
|
|
13
|
+
- [Use a local evonet](examples/use-local-evonet.md)
|
|
14
|
+
- [Fetch an identity from its name](examples/fetch-an-identity-from-its-name.md)
|
|
15
|
+
- [Publishing a new contract](examples/publishing-a-new-contract.md)
|
|
16
|
+
- [Use another BIP44 account](examples/use-different-account.md)
|
|
17
|
+
- [Sign and verify messages](examples/sign-and-verify-messages.md)
|
|
18
18
|
|
|
19
19
|
- Tutorial
|
|
20
20
|
- [Register an identity](https://dashplatform.readme.io/docs/tutorial-register-an-identity)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
## Paying to another address
|
|
2
2
|
|
|
3
|
-
In order to pay, you need to have an [existing balance](
|
|
3
|
+
In order to pay, you need to have an [existing balance](../examples/receive-money-and-check-balance.md).
|
|
4
4
|
The below code will allow you to pay to a single address a specific amount of satoshis.
|
|
5
5
|
|
|
6
6
|
```js
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Right now, Evonet does not support publishing a public contract. You will have to run a local instance or wait for updates to the [Dash Platform documentation](https://dashplatform.readme.io/docs) regarding how to run a devnet locally and publish a contract.
|
|
4
4
|
|
|
5
|
-
For now you can try your luck using the [Dash Network Deploy tool](https://github.com/dashevo/dash-network-deploy) and refer to [how to use a local evonet](
|
|
5
|
+
For now you can try your luck using the [Dash Network Deploy tool](https://github.com/dashevo/dash-network-deploy) and refer to [how to use a local evonet](../examples/use-local-evonet.md).
|
|
6
6
|
|
|
7
7
|
## Create your contract
|
|
8
8
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
## Receive money and display balance
|
|
2
2
|
|
|
3
|
-
Initialize the SDK Client with your [generated mnemonic](
|
|
3
|
+
Initialize the SDK Client with your [generated mnemonic](../examples/generate-a-new-mnemonic.md) passed as an option.
|
|
4
4
|
By default, the SDK Client will work on Evonet, the only network having DAPI at the time of writing.
|
|
5
5
|
|
|
6
6
|
```js
|
|
@@ -13,7 +13,7 @@ const client = new Dash.Client({
|
|
|
13
13
|
|
|
14
14
|
Having set up your `client` instance, you be able to access the `account` and `wallet` instance generated from your mnemonic.
|
|
15
15
|
|
|
16
|
-
You can read more on [how to use a different account](
|
|
16
|
+
You can read more on [how to use a different account](../examples/use-different-account.md) as by default, you are on the first BIP44 account.
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
## Generate a receiving address
|
|
@@ -16,7 +16,7 @@ Since the introduction of deterministic wallets ([BIP44](https://github.com/bitc
|
|
|
16
16
|
|
|
17
17
|
It is the instance you will use most of the time for receiving or broadcasting payments.
|
|
18
18
|
|
|
19
|
-
You can access your account with `client.getWalletAccount()` and see [how to use a different account](
|
|
19
|
+
You can access your account with `client.getWalletAccount()` and see [how to use a different account](../examples/use-different-account.md) if you need to get a specific account index.
|
|
20
20
|
|
|
21
21
|
## App Schema and Contracts
|
|
22
22
|
|
|
@@ -25,4 +25,4 @@ The Dash Platform Chain, provides to developers the ability to create applicatio
|
|
|
25
25
|
When registered, those applications schemas are called contracts and contains a contractId (namespace : `client.platform.contracts`).
|
|
26
26
|
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.
|
|
27
27
|
|
|
28
|
-
You can read more on [how to use DPNS on a local Evonet devnet](
|
|
28
|
+
You can read more on [how to use DPNS on a local Evonet devnet](../examples/use-local-evonet.md) or [how to use multiple apps](../getting-started/multiple-apps.md).
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
## DPNS
|
|
2
2
|
|
|
3
|
-
DPNS is handled in the Dash SDK Client under the namespace `client.platform.names.*'`. [Read more here](
|
|
3
|
+
DPNS is handled in the Dash SDK Client under the namespace `client.platform.names.*'`. [Read more here](../platform/names/about-dpns.md)
|
|
4
4
|
|
|
5
5
|
## DashPay
|
|
6
6
|
|
|
@@ -50,7 +50,7 @@ client.getWalletAccount().then(async (account) => {
|
|
|
50
50
|
|
|
51
51
|
## Read a document
|
|
52
52
|
|
|
53
|
-
At the time of writing, you will need to have registered a data contract yourself. See [publishing a new contract](
|
|
53
|
+
At the time of writing, you will need to have registered a data contract yourself. See [publishing a new contract](../examples/publishing-a-new-contract.md).
|
|
54
54
|
|
|
55
55
|
```js
|
|
56
56
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
## What is a contract
|
|
2
2
|
|
|
3
|
-
Contracts are a [registered](
|
|
3
|
+
Contracts are a [registered](../../examples/publishing-a-new-contract.md) set of rules defined in a [JSON Application Schema](../../getting-started/core-concepts#schemas).
|
|
4
4
|
|
|
5
5
|
See more on the Dash Platform documentation about [Data Contract](https://dashplatform.readme.io/docs/explanation-platform-protocol-data-contract).
|
|
6
6
|
|
|
@@ -5,8 +5,8 @@ Parameters:
|
|
|
5
5
|
|
|
6
6
|
| parameters | type | required | Description |
|
|
7
7
|
|---------------------------|-----------|----------------| ------------------------------------------------------------------------------|
|
|
8
|
-
| **contract** | Contract | yes | A valid [created contract](
|
|
9
|
-
| **identity** | Identity | yes | A valid [registered `application` identity](
|
|
8
|
+
| **contract** | Contract | yes | A valid [created contract](../contracts/create.md) |
|
|
9
|
+
| **identity** | Identity | yes | A valid [registered `application` identity](../identities/register.md) |
|
|
10
10
|
|
|
11
11
|
**Example**:
|
|
12
12
|
```js
|
|
@@ -6,7 +6,7 @@ Parameters:
|
|
|
6
6
|
| parameters | type | required | Description |
|
|
7
7
|
|--------------------------|-------------------|------------------ | ----------------------------------------------------------------- |
|
|
8
8
|
| **contractDefinitions** | JSONDataContract | yes | The defined [JSON Application Schema](https://dashplatform.readme.io/docs/explanation-platform-protocol-data-contract) |
|
|
9
|
-
| **identity** | Identity | yes | A valid [registered `application` identity](
|
|
9
|
+
| **identity** | Identity | yes | A valid [registered `application` identity](../identities/register.md) |
|
|
10
10
|
|
|
11
11
|
**Example**:
|
|
12
12
|
|
|
@@ -31,6 +31,6 @@ Parameters:
|
|
|
31
31
|
const validationResult = client.platform.dpp.dataContract.validate(contract);
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
-
**Note**: When your contract is created, it will only exist locally, use the [broadcast](
|
|
34
|
+
**Note**: When your contract is created, it will only exist locally, use the [broadcast](../contracts/broadcast.md) method to register it.
|
|
35
35
|
|
|
36
36
|
Returns : Contract.
|
|
@@ -6,10 +6,10 @@ Parameters:
|
|
|
6
6
|
| parameters | type | required | Description |
|
|
7
7
|
|----------------------------|------------|----------| ----------------------------------------------------------------------------|
|
|
8
8
|
| **documents** | Object | yes | |
|
|
9
|
-
| **documents.create** | Document[] | no | array of valid [created document](
|
|
10
|
-
| **documents.replace** | Document[] | no | array of valid [created document](
|
|
11
|
-
| **documents.delete** | Document[] | no | array of valid [created document](
|
|
12
|
-
| **identity** | Identity | yes | A valid [registered identity](
|
|
9
|
+
| **documents.create** | Document[] | no | array of valid [created document](../documents/create.md) to create |
|
|
10
|
+
| **documents.replace** | Document[] | no | array of valid [created document](../documents/create.md) to replace |
|
|
11
|
+
| **documents.delete** | Document[] | no | array of valid [created document](../documents/create.md) to delete |
|
|
12
|
+
| **identity** | Identity | yes | A valid [registered identity](../identities/register.md) |
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
**Example**:
|
|
@@ -6,7 +6,7 @@ Parameters:
|
|
|
6
6
|
| parameters | type | required | Description |
|
|
7
7
|
|-------------------|---------|------------------ | ----------------------------------------------------------------- |
|
|
8
8
|
| **dotLocator** | string | yes | Field of a specific application, under the form `appName.fieldName` |
|
|
9
|
-
| **identity** | Identity| yes | A valid [registered identity](
|
|
9
|
+
| **identity** | Identity| yes | A valid [registered identity](../identities/register.md) |
|
|
10
10
|
| **docOpts** | Object | yes | A valid data that match the data contract structure |
|
|
11
11
|
|
|
12
12
|
**Example**:
|
|
@@ -21,6 +21,6 @@ const helloWorldDocument = await platform.documents.create(
|
|
|
21
21
|
{ message: 'Hello World'},
|
|
22
22
|
);
|
|
23
23
|
```
|
|
24
|
-
**Note**: When your document is created, it will only exist locally, use the [broadcast](
|
|
24
|
+
**Note**: When your document is created, it will only exist locally, use the [broadcast](../documents/broadcast.md) method to register it.
|
|
25
25
|
|
|
26
26
|
Returns: Document
|
|
@@ -4,7 +4,7 @@ An Identity is a blockchain-based identifier for individuals (users) and applica
|
|
|
4
4
|
Identity is the atomic element that linked with additional applications can be extended to provide new functionality.
|
|
5
5
|
|
|
6
6
|
Read more on the Dash Platform documentation about [Identity](https://dashplatform.readme.io/docs/explanation-identity).
|
|
7
|
-
You might also want to consult the usage for the [DPNS Name Service](/
|
|
7
|
+
You might also want to consult the usage for the [DPNS Name Service](../names/about-dpns.md) in order to attach a name to your created identity.
|
|
8
8
|
|
|
9
9
|
## Credits
|
|
10
10
|
|
|
@@ -9,6 +9,6 @@ Parameters:
|
|
|
9
9
|
|
|
10
10
|
**Example**: `await client.platform.identities.register()`
|
|
11
11
|
|
|
12
|
-
**Note**: The created identity will be associated to the active account. You might want to know more about how to [change your active account](
|
|
12
|
+
**Note**: The created identity will be associated to the active account. You might want to know more about how to [change your active account](../../examples/use-different-account.md).
|
|
13
13
|
|
|
14
14
|
Returns : Identity.
|
|
@@ -5,7 +5,7 @@ Parameters:
|
|
|
5
5
|
|
|
6
6
|
| parameters | type | required | Description |
|
|
7
7
|
|-------------------|---------|------------------| ----------------------------------------------------------------------------------------|
|
|
8
|
-
| **identity** | Identity| yes | A valid [registered identity](
|
|
8
|
+
| **identity** | Identity| yes | A valid [registered identity](../identities/register.md) |
|
|
9
9
|
| **amount** | number | yes | A duffs (satoshis) value corresponding to the amount you want to top up to the identity.|
|
|
10
10
|
|
|
11
11
|
**Example**:
|
|
@@ -9,7 +9,7 @@ Parameters:
|
|
|
9
9
|
| **records** | Object | yes | records object having only one of the following items |
|
|
10
10
|
| **records.dashUniqueIdentityId** | String | no | Unique Identity ID for this name record |
|
|
11
11
|
| **records.dashAliasIdentityId** | String | no | Used to signify that this name is the alias for another id |
|
|
12
|
-
| **identity** | Identity | yes | A valid [registered identity](
|
|
12
|
+
| **identity** | Identity | yes | A valid [registered identity](../identities/register.md) |
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
**Example**: `await client.platform.identities.register('alice', { dashUniqueIdentityId: identity.getId() }, identity)`
|
package/karma.conf.js
CHANGED
|
@@ -25,6 +25,7 @@ module.exports = (config) => {
|
|
|
25
25
|
...webpackBaseConfig,
|
|
26
26
|
mode: 'development',
|
|
27
27
|
plugins: [
|
|
28
|
+
...webpackBaseConfig.plugins,
|
|
28
29
|
new webpack.EnvironmentPlugin(
|
|
29
30
|
dotenvResult.parsed,
|
|
30
31
|
),
|
|
@@ -38,7 +39,9 @@ module.exports = (config) => {
|
|
|
38
39
|
browsers: ['ChromeHeadless', 'FirefoxHeadless'],
|
|
39
40
|
singleRun: false,
|
|
40
41
|
concurrency: Infinity,
|
|
41
|
-
browserNoActivityTimeout: 7 * 60 * 1000,
|
|
42
|
+
browserNoActivityTimeout: 7 * 60 * 1000, // 30000 default
|
|
43
|
+
browserDisconnectTimeout: 3 * 2000, // 2000 default
|
|
44
|
+
pingTimeout: 3 * 5000, // 5000 default
|
|
42
45
|
plugins: [
|
|
43
46
|
'karma-mocha',
|
|
44
47
|
'karma-mocha-reporter',
|
package/package.json
CHANGED
|
@@ -1,22 +1,28 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dash",
|
|
3
|
-
"version": "3.21.
|
|
3
|
+
"version": "3.21.4",
|
|
4
4
|
"description": "Dash library for JavaScript/TypeScript ecosystem (Wallet, DAPI, Primitives, BLS, ...)",
|
|
5
5
|
"main": "build/src/index.js",
|
|
6
6
|
"unpkg": "dist/dash.min.js",
|
|
7
7
|
"types": "dist/src/index.d.ts",
|
|
8
8
|
"scripts": {
|
|
9
9
|
"start:dev": "nodemon --exec 'npm run build && npm run test:unit'",
|
|
10
|
-
"build": "npm run build:
|
|
11
|
-
"build:web": "npm run build:ts && webpack --
|
|
10
|
+
"build": "npm run build:ts",
|
|
11
|
+
"build:web": "npm run build:ts && webpack --stats-error-details",
|
|
12
12
|
"build:ts": "tsc",
|
|
13
|
+
"lint": "",
|
|
13
14
|
"test": "npm run test:unit && npm run test:functional && npm run test:browsers",
|
|
14
15
|
"test:browsers": "karma start ./karma.conf.js --single-run",
|
|
15
|
-
"test:unit": "mocha -r ts-node/register \"src/**/*.spec.ts\"",
|
|
16
|
+
"test:unit": "TS_NODE_COMPILER_OPTIONS={\"target\":\"es6\"} mocha -r ts-node/register/transpile-only \"src/**/*.spec.ts\"",
|
|
16
17
|
"test:functional": "npm run build && mocha --recursive tests/functional/**/*.js",
|
|
17
|
-
"prepublishOnly": "npm run build",
|
|
18
|
+
"prepublishOnly": "npm run build:web",
|
|
18
19
|
"prepare": "npm run build"
|
|
19
20
|
},
|
|
21
|
+
"ultra": {
|
|
22
|
+
"concurrent": [
|
|
23
|
+
"test"
|
|
24
|
+
]
|
|
25
|
+
},
|
|
20
26
|
"repository": {
|
|
21
27
|
"type": "git",
|
|
22
28
|
"url": "git+https://github.com/dashevo/DashJS.git"
|
|
@@ -28,13 +34,13 @@
|
|
|
28
34
|
},
|
|
29
35
|
"homepage": "https://github.com/dashevo/DashJS#readme",
|
|
30
36
|
"dependencies": {
|
|
31
|
-
"@dashevo/dapi-client": "~0.21.
|
|
32
|
-
"@dashevo/dashcore-lib": "~0.19.
|
|
33
|
-
"@dashevo/dpp": "~0.21.
|
|
34
|
-
"@dashevo/grpc-common": "~0.
|
|
35
|
-
"@dashevo/wallet-lib": "~7.21.
|
|
37
|
+
"@dashevo/dapi-client": "~0.21.4",
|
|
38
|
+
"@dashevo/dashcore-lib": "~0.19.27",
|
|
39
|
+
"@dashevo/dpp": "~0.21.4",
|
|
40
|
+
"@dashevo/grpc-common": "~0.21.4",
|
|
41
|
+
"@dashevo/wallet-lib": "~7.21.4",
|
|
36
42
|
"bs58": "^4.0.1",
|
|
37
|
-
"node-inspect-extracted": "1.0.
|
|
43
|
+
"node-inspect-extracted": "^1.0.8"
|
|
38
44
|
},
|
|
39
45
|
"devDependencies": {
|
|
40
46
|
"@types/chai": "^4.2.12",
|
|
@@ -44,28 +50,39 @@
|
|
|
44
50
|
"@types/node": "^14.6.0",
|
|
45
51
|
"@types/sinon": "^9.0.4",
|
|
46
52
|
"@types/sinon-chai": "^3.2.4",
|
|
47
|
-
"
|
|
53
|
+
"assert": "^2.0.0",
|
|
54
|
+
"browserify-zlib": "^0.2.0",
|
|
55
|
+
"buffer": "^6.0.3",
|
|
56
|
+
"chai": "^4.3.4",
|
|
48
57
|
"chance": "^1.1.6",
|
|
58
|
+
"crypto-browserify": "^3.12.0",
|
|
49
59
|
"dirty-chai": "^2.0.1",
|
|
50
60
|
"dotenv-safe": "^8.2.0",
|
|
51
|
-
"
|
|
61
|
+
"https-browserify": "^1.0.0",
|
|
62
|
+
"karma": "^6.3.4",
|
|
52
63
|
"karma-chai": "^0.1.0",
|
|
53
64
|
"karma-chrome-launcher": "^3.1.0",
|
|
54
|
-
"karma-firefox-launcher": "^1.
|
|
65
|
+
"karma-firefox-launcher": "^2.1.1",
|
|
55
66
|
"karma-mocha": "^2.0.1",
|
|
56
67
|
"karma-mocha-reporter": "^2.2.5",
|
|
57
|
-
"karma-webpack": "^
|
|
58
|
-
"mocha": "^
|
|
68
|
+
"karma-webpack": "^5.0.0",
|
|
69
|
+
"mocha": "^9.1.2",
|
|
59
70
|
"nodemon": "^2.0.4",
|
|
71
|
+
"os-browserify": "^0.3.0",
|
|
72
|
+
"path-browserify": "^1.0.1",
|
|
73
|
+
"process": "^0.11.10",
|
|
60
74
|
"rimraf": "^3.0.2",
|
|
61
|
-
"sinon": "^
|
|
62
|
-
"sinon-chai": "^3.
|
|
75
|
+
"sinon": "^11.1.2",
|
|
76
|
+
"sinon-chai": "^3.7.0",
|
|
77
|
+
"stream-browserify": "^3.0.0",
|
|
78
|
+
"stream-http": "^3.2.0",
|
|
63
79
|
"ts-loader": "^8.0.2",
|
|
64
80
|
"ts-mock-imports": "^1.3.0",
|
|
65
|
-
"ts-node": "^
|
|
81
|
+
"ts-node": "^10.4.0",
|
|
66
82
|
"typescript": "^3.9.5",
|
|
67
|
-
"
|
|
68
|
-
"
|
|
69
|
-
"webpack
|
|
83
|
+
"url": "^0.11.0",
|
|
84
|
+
"util": "^0.12.4",
|
|
85
|
+
"webpack": "^5.59.1",
|
|
86
|
+
"webpack-cli": "^4.9.1"
|
|
70
87
|
}
|
|
71
88
|
}
|
package/src/SDK/Client/Client.ts
CHANGED
|
@@ -107,10 +107,10 @@ export class Client extends EventEmitter {
|
|
|
107
107
|
|
|
108
108
|
this.apps = new ClientApps(Object.assign({
|
|
109
109
|
dpns: {
|
|
110
|
-
contractId: '
|
|
110
|
+
contractId: 'Bw9PUC3aSEGQ4j5qrvpNLrRNFPVMiUHZLr1atgfYJcmf'
|
|
111
111
|
},
|
|
112
112
|
dashpay: {
|
|
113
|
-
contractId: '
|
|
113
|
+
contractId: '2Vuou3EfbrtunwCZvQp1XS5PXZ5CgC1pGBz4VPT4ojmy',
|
|
114
114
|
},
|
|
115
115
|
}, this.options.apps));
|
|
116
116
|
|
|
@@ -9,7 +9,7 @@ const ASSET_LOCK_OUTPUT_INDEX = 0;
|
|
|
9
9
|
* Creates a funding transaction for the platform identity and returns one-time key to sign the state transition
|
|
10
10
|
* @param {Platform} platform
|
|
11
11
|
* @param {number} fundingAmount - amount of dash to fund the identity's credits
|
|
12
|
-
* @return {{transaction: Transaction, privateKey: PrivateKey}} - transaction and one time private key
|
|
12
|
+
* @return {Promise<{transaction: Transaction, privateKey: PrivateKey}>} - transaction and one time private key
|
|
13
13
|
* that can be used to sign registration/top-up state transition
|
|
14
14
|
*/
|
|
15
15
|
export default async function createAssetLockTransaction(platform : Platform, fundingAmount): Promise<{ transaction: Transaction, privateKey: PrivateKey, outputIndex: number }> {
|
|
@@ -26,6 +26,10 @@ export async function create(this: Platform, typeLocator: string, identity: any,
|
|
|
26
26
|
|
|
27
27
|
const dataContract = await this.contracts.get(contractId);
|
|
28
28
|
|
|
29
|
+
if (dataContract === null) {
|
|
30
|
+
throw new Error(`Contract ${appName} not found. Ensure contractId ${contractId} is correct.`)
|
|
31
|
+
}
|
|
32
|
+
|
|
29
33
|
return dpp.document.create(
|
|
30
34
|
dataContract,
|
|
31
35
|
identity.getId(),
|