dash 3.22.11 → 3.22.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +57 -14
- package/build/src/SDK/Client/Platform/Platform.js +12 -0
- package/build/src/SDK/Client/Platform/Platform.js.map +1 -1
- package/build/src/SDK/Client/Platform/createAssetLockTransaction.js +8 -4
- package/build/src/SDK/Client/Platform/createAssetLockTransaction.js.map +1 -1
- package/build/src/SDK/Client/Platform/methods/identities/internal/createAssetLockProof.js +8 -4
- package/build/src/SDK/Client/Platform/methods/identities/internal/createAssetLockProof.js.map +1 -1
- package/build/src/SDK/Client/Platform/methods/identities/internal/createIdentityCreateTransition.js +8 -4
- package/build/src/SDK/Client/Platform/methods/identities/internal/createIdentityCreateTransition.js.map +1 -1
- package/build/src/SDK/Client/Platform/methods/identities/internal/createIdnetityTopUpTransition.js +8 -4
- package/build/src/SDK/Client/Platform/methods/identities/internal/createIdnetityTopUpTransition.js.map +1 -1
- package/build/src/SDK/Client/Platform/methods/identities/internal/waitForCoreChainLockedHeight.js +7 -3
- package/build/src/SDK/Client/Platform/methods/identities/internal/waitForCoreChainLockedHeight.js.map +1 -1
- package/build/src/SDK/Client/Platform/methods/identities/register.js +5 -6
- package/build/src/SDK/Client/Platform/methods/identities/register.js.map +1 -1
- package/build/src/SDK/Client/Platform/methods/identities/topUp.js +5 -7
- package/build/src/SDK/Client/Platform/methods/identities/topUp.js.map +1 -1
- package/build/src/SDK/SDK.js +10 -0
- package/build/src/SDK/SDK.js.map +1 -1
- package/build-utils/ws.js +15 -0
- package/dist/dash.min.js +9 -0
- package/dist/dash.min.js.LICENSE.txt +80 -0
- package/dist/dash.min.js.map +1 -0
- package/dist/src/SDK/Client/Platform/Platform.d.ts +7 -0
- package/dist/src/SDK/Client/Platform/createAssetLockTransaction.d.ts +3 -2
- package/dist/src/SDK/Client/Platform/methods/identities/internal/createAssetLockProof.d.ts +3 -2
- package/dist/src/SDK/Client/Platform/methods/identities/internal/createIdentityCreateTransition.d.ts +3 -2
- package/dist/src/SDK/Client/Platform/methods/identities/internal/createIdnetityTopUpTransition.d.ts +3 -2
- package/dist/src/SDK/Client/Platform/methods/identities/internal/waitForCoreChainLockedHeight.d.ts +2 -1
- package/dist/src/SDK/SDK.d.ts +9 -0
- package/docs/README.md +11 -52
- package/docs/_sidebar.md +0 -17
- package/docs/examples/fetch-an-identity-from-its-name.md +5 -9
- package/docs/examples/generate-a-new-mnemonic.md +1 -1
- package/docs/examples/pay-to-another-address.md +16 -13
- package/docs/examples/receive-money-and-check-balance.md +55 -39
- package/docs/examples/sign-and-verify-messages.md +19 -9
- package/docs/examples/use-different-account.md +5 -17
- package/docs/getting-started/core-concepts.md +6 -5
- package/docs/getting-started/dash-platform-applications.md +1 -1
- package/docs/getting-started/quickstart.md +7 -24
- package/docs/getting-started/with-typescript.md +5 -2
- package/docs/index.html +2 -2
- package/docs/platform/about-platform.md +5 -5
- package/docs/platform/contracts/about-contracts.md +2 -2
- package/docs/platform/contracts/create.md +5 -5
- package/docs/platform/contracts/get.md +1 -1
- package/docs/platform/contracts/publish.md +3 -3
- package/docs/platform/contracts/update.md +1 -4
- package/docs/platform/documents/broadcast.md +15 -15
- package/docs/platform/documents/create.md +5 -5
- package/docs/platform/documents/get.md +6 -5
- package/docs/platform/identities/about-identity.md +1 -1
- package/docs/platform/identities/get.md +1 -1
- package/docs/platform/identities/register.md +1 -1
- package/docs/platform/identities/topUp.md +2 -2
- package/docs/platform/names/about-dpns.md +1 -1
- package/docs/platform/names/register.md +9 -9
- package/docs/platform/names/resolve.md +1 -1
- package/docs/platform/names/resolveByRecord.md +9 -8
- package/docs/platform/names/search.md +1 -1
- package/docs/usage/dashcorelib-primitives.md +48 -37
- package/docs/wallet/about-wallet-lib.md +3 -3
- package/docs/wallet/accounts.md +11 -7
- package/docs/wallet/signing-encrypt.md +12 -6
- package/package.json +16 -12
- package/src/SDK/Client/Platform/Platform.ts +21 -0
- package/src/SDK/Client/Platform/createAssetLockTransaction.ts +5 -2
- package/src/SDK/Client/Platform/methods/identities/internal/createAssetLockProof.ts +5 -2
- package/src/SDK/Client/Platform/methods/identities/internal/createIdentityCreateTransition.ts +5 -2
- package/src/SDK/Client/Platform/methods/identities/internal/createIdnetityTopUpTransition.ts +5 -2
- package/src/SDK/Client/Platform/methods/identities/internal/waitForCoreChainLockedHeight.ts +4 -3
- package/src/SDK/Client/Platform/methods/identities/register.ts +7 -8
- package/src/SDK/Client/Platform/methods/identities/topUp.ts +5 -8
- package/src/SDK/SDK.ts +34 -21
- package/webpack.base.config.js +14 -0
- package/webpack.config.js +6 -2
- package/docs/examples/publishing-a-new-contract.md +0 -68
- package/docs/examples/updating-a-contract.md +0 -55
- package/docs/examples/use-local-evonet.md +0 -19
- package/examples/node/create-and-fund-wallet.js +0 -28
- package/examples/node/register-contract.js +0 -34
- package/examples/node/register-identity.js +0 -23
- package/examples/node/register-name.js +0 -19
- package/examples/node/retrieve-contract.js +0 -20
- package/examples/node/retrieve-documents.js +0 -22
- package/examples/node/retrieve-identity.js +0 -20
- package/examples/node/retrieve-name.js +0 -14
- package/examples/node/sign-and-verify-messages.js +0 -29
- package/examples/schema.json +0 -58
- package/examples/web/usage.web.html +0 -12
- package/examples/web/usage.web.js +0 -28
package/README.md
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
# Dash SDK
|
|
2
2
|
|
|
3
3
|
[](https://www.npmjs.org/package/dash)
|
|
4
|
-
[](https://github.com/dashevo/platform/actions/workflows/release.yml)
|
|
5
|
+
[](https://github.com/dashevo/platform/releases/latest)
|
|
6
6
|
[](https://github.com/RichardLitt/standard-readme)
|
|
7
7
|
|
|
8
8
|
Dash library for JavaScript/TypeScript ecosystem (Wallet, DAPI, Primitives, BLS, ...)
|
|
9
9
|
|
|
10
|
-
Dash library
|
|
10
|
+
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/dashevo/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.
|
|
11
11
|
|
|
12
12
|
## Table of Contents
|
|
13
13
|
- [Install](#install)
|
|
@@ -41,39 +41,82 @@ For browser usage, you can also directly rely on unpkg :
|
|
|
41
41
|
## Usage
|
|
42
42
|
|
|
43
43
|
```js
|
|
44
|
-
const Dash = require("dash");
|
|
44
|
+
const Dash = require("dash"); // or import Dash from "dash"
|
|
45
45
|
|
|
46
46
|
const client = new Dash.Client({
|
|
47
|
-
network: "testnet",
|
|
48
47
|
wallet: {
|
|
49
48
|
mnemonic: "arena light cheap control apple buffalo indicate rare motor valid accident isolate",
|
|
50
49
|
},
|
|
50
|
+
apps: {
|
|
51
|
+
tutorialContract: {
|
|
52
|
+
// Learn more on how to register Data Contract
|
|
53
|
+
// https://dashplatform.readme.io/docs/tutorial-register-a-data-contract#registering-the-data-contract
|
|
54
|
+
contractId: "<tutorial-contract-id>"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
51
57
|
});
|
|
52
58
|
|
|
53
59
|
// Accessing an account allow you to transact with the Dash Network
|
|
54
|
-
client.
|
|
55
|
-
console.log(
|
|
60
|
+
client.wallet.getAccount().then(async (account) => {
|
|
61
|
+
console.log('Funding address', account.getUnusedAddress().address);
|
|
56
62
|
|
|
57
63
|
const balance = account.getConfirmedBalance();
|
|
58
|
-
console.log(
|
|
64
|
+
console.log('Confirmed Balance', balance);
|
|
65
|
+
|
|
66
|
+
if (balance > 0) {
|
|
67
|
+
// Obtain identity - the base of all platform interactions
|
|
68
|
+
// Read more on how to create an identity here: https://dashplatform.readme.io/docs/tutorial-register-an-identity
|
|
69
|
+
const identityIds = account.identities.getIdentityIds();
|
|
70
|
+
const identity = await client.platform.identities.get(identityIds[0]);
|
|
59
71
|
|
|
60
|
-
if(balance > 0){
|
|
61
|
-
// Creating an identity is the basis of all interactions with the Dash Platform
|
|
62
|
-
const identity = await client.platform.identities.register()
|
|
63
|
-
|
|
64
72
|
// Prepare a new document containing a simple hello world sent to a hypothetical tutorial contract
|
|
65
|
-
const document = await platform.documents.create(
|
|
73
|
+
const document = await client.platform.documents.create(
|
|
66
74
|
'tutorialContract.note',
|
|
67
75
|
identity,
|
|
68
76
|
{ message: 'Hello World' },
|
|
69
77
|
);
|
|
70
78
|
|
|
71
79
|
// Broadcast the document into a new state transition
|
|
72
|
-
await platform.documents.broadcast({create:[document]}, identity);
|
|
80
|
+
await client.platform.documents.broadcast({ create: [document] }, identity);
|
|
81
|
+
|
|
82
|
+
// Retrieve documents
|
|
83
|
+
const documents = await client.platform.documents.get('tutorialContract.note', {
|
|
84
|
+
limit: 2,
|
|
85
|
+
});
|
|
86
|
+
|
|
87
|
+
console.log(documents);
|
|
73
88
|
}
|
|
74
89
|
});
|
|
75
90
|
```
|
|
76
91
|
|
|
92
|
+
### Primitives and essentials
|
|
93
|
+
Dash SDK bundled into a standalone package,
|
|
94
|
+
so that the end user never have to worry about mananaging polyfills or related dependencies
|
|
95
|
+
|
|
96
|
+
```javascript
|
|
97
|
+
const Dash = require('dash')
|
|
98
|
+
|
|
99
|
+
const {
|
|
100
|
+
Essentials: {
|
|
101
|
+
Buffer // Node.JS Buffer polyfill.
|
|
102
|
+
},
|
|
103
|
+
Core: { // @dashevo/dashcore-lib essentials
|
|
104
|
+
Transaction,
|
|
105
|
+
PrivateKey,
|
|
106
|
+
BlockHeader,
|
|
107
|
+
// ...
|
|
108
|
+
},
|
|
109
|
+
PlatformProtocol: { // @dashevo/dpp essentials
|
|
110
|
+
Identity,
|
|
111
|
+
Identifier,
|
|
112
|
+
},
|
|
113
|
+
WalletLib: { // @dashevo/wallet-lib essentials
|
|
114
|
+
EVENTS
|
|
115
|
+
},
|
|
116
|
+
DAPIClient, // @dashevo/dapi-client
|
|
117
|
+
} = Dash;
|
|
118
|
+
```
|
|
119
|
+
|
|
77
120
|
## Dependencies
|
|
78
121
|
|
|
79
122
|
The Dash SDK works using multiple dependencies that might interest you:
|
|
@@ -53,6 +53,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
53
53
|
exports.Platform = void 0;
|
|
54
54
|
// @ts-ignore
|
|
55
55
|
var dpp_1 = __importDefault(require("@dashevo/dpp"));
|
|
56
|
+
var createAssetLockTransaction_1 = __importDefault(require("./createAssetLockTransaction"));
|
|
56
57
|
var broadcast_1 = __importDefault(require("./methods/documents/broadcast"));
|
|
57
58
|
var create_1 = __importDefault(require("./methods/documents/create"));
|
|
58
59
|
var get_1 = __importDefault(require("./methods/documents/get"));
|
|
@@ -63,6 +64,10 @@ var get_2 = __importDefault(require("./methods/contracts/get"));
|
|
|
63
64
|
var get_3 = __importDefault(require("./methods/identities/get"));
|
|
64
65
|
var register_1 = __importDefault(require("./methods/identities/register"));
|
|
65
66
|
var topUp_1 = __importDefault(require("./methods/identities/topUp"));
|
|
67
|
+
var createIdentityCreateTransition_1 = __importDefault(require("./methods/identities/internal/createIdentityCreateTransition"));
|
|
68
|
+
var createIdnetityTopUpTransition_1 = __importDefault(require("./methods/identities/internal/createIdnetityTopUpTransition"));
|
|
69
|
+
var createAssetLockProof_1 = __importDefault(require("./methods/identities/internal/createAssetLockProof"));
|
|
70
|
+
var waitForCoreChainLockedHeight_1 = __importDefault(require("./methods/identities/internal/waitForCoreChainLockedHeight"));
|
|
66
71
|
var register_2 = __importDefault(require("./methods/names/register"));
|
|
67
72
|
var resolve_1 = __importDefault(require("./methods/names/resolve"));
|
|
68
73
|
var resolveByRecord_1 = __importDefault(require("./methods/names/resolveByRecord"));
|
|
@@ -106,6 +111,13 @@ var Platform = /** @class */ (function () {
|
|
|
106
111
|
register: register_1.default.bind(this),
|
|
107
112
|
get: get_3.default.bind(this),
|
|
108
113
|
topUp: topUp_1.default.bind(this),
|
|
114
|
+
utils: {
|
|
115
|
+
createAssetLockProof: createAssetLockProof_1.default.bind(this),
|
|
116
|
+
createAssetLockTransaction: createAssetLockTransaction_1.default.bind(this),
|
|
117
|
+
createIdentityCreateTransition: createIdentityCreateTransition_1.default.bind(this),
|
|
118
|
+
createIdentityTopUpTransition: createIdnetityTopUpTransition_1.default.bind(this),
|
|
119
|
+
waitForCoreChainLockedHeight: waitForCoreChainLockedHeight_1.default.bind(this),
|
|
120
|
+
}
|
|
109
121
|
};
|
|
110
122
|
this.client = options.client;
|
|
111
123
|
var mappedProtocolVersion = Platform.networkToProtocolVersion.get(options.network);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Platform.js","sourceRoot":"","sources":["../../../../../src/SDK/Client/Platform/Platform.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,aAAa;AACb,qDAAgD;AAKhD,4EAA8D;AAC9D,sEAAwD;AACxD,gEAAkD;AAElD,wEAA0D;AAC1D,sEAAwD;AACxD,sEAAwD;AACxD,gEAAkD;AAElD,iEAAmD;AACnD,2EAA6D;AAC7D,qEAAuD;
|
|
1
|
+
{"version":3,"file":"Platform.js","sourceRoot":"","sources":["../../../../../src/SDK/Client/Platform/Platform.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,aAAa;AACb,qDAAgD;AAKhD,4FAAsE;AAEtE,4EAA8D;AAC9D,sEAAwD;AACxD,gEAAkD;AAElD,wEAA0D;AAC1D,sEAAwD;AACxD,sEAAwD;AACxD,gEAAkD;AAElD,iEAAmD;AACnD,2EAA6D;AAC7D,qEAAuD;AACvD,gIAA0G;AAC1G,8HAAwG;AACxG,4GAAsF;AACtF,4HAAsG;AAEtG,sEAAoD;AACpD,oEAAkD;AAClD,oFAAkE;AAClE,kEAAgD;AAChD,wFAAkE;AAClE,sEAAgD;AAChD,4EAAkG;AA0DlG;;;;;;;GAOG;AACH;IAmCI;;;;OAIG;IACH,kBAAY,OAAqB;QAC7B,IAAI,CAAC,SAAS,GAAG;YACb,SAAS,EAAE,mBAAiB,CA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,GAAG,OAAO,CAAC,MAAM,CAAC;QAE7B,IAAM,qBAAqB,GAAG,QAAQ,CAAC,wBAAwB,CAAC,GAAG,CAC/D,OAAO,CAAC,OAAO,CAClB,CAAC;QAEF,2CAA2C;QAC3C,2BAA2B;QAC3B,qDAAqD;QACrD,IAAM,oBAAoB,GAAG,OAAO,CAAC,oBAAoB,KAAK,SAAS;YACrE,CAAC,CAAC,OAAO,CAAC,oBAAoB;YAC9B,CAAC,CAAC,CAAC,qBAAqB,KAAK,SAAS,CAAC,CAAC,CAAC,qBAAqB,CAAC,CAAC,CAAC,+BAAqB,CAAC,CAAC;QAE1F,IAAM,eAAe,GAAG,IAAI,yBAAe,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QAEzD,IAAI,CAAC,GAAG,GAAG,IAAI,aAAoB,YAC/B,eAAe,iBAAA,EACf,eAAe,EAAE,oBAAoB,IAClC,OAAO,EACZ,CAAC;IACP,CAAC;IAtED;;;OAGG;IACI,2CAAwB,GAA/B,UAAgC,eAAoB;QAChD,OAAO,kCAAwB,CAAC,IAAI,EAAE,eAAe,CAAC,CAAC;IAC3D,CAAC;IAAA,CAAC;IAkEI,6BAAU,GAAhB;;;;4BACI,qBAAM,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,EAAA;;wBAA3B,SAA2B,CAAC;;;;;KAC/B;IAhEuB,iCAAwB,GAAwB,IAAI,GAAG,CAAC;QAC5E,CAAC,SAAS,EAAE,CAAC,CAAC;KACjB,CAAC,CAAC;IA+DP,eAAC;CAAA,AAhGD,IAgGC;AAhGY,4BAAQ"}
|
|
@@ -36,23 +36,26 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.createAssetLockTransaction = void 0;
|
|
39
40
|
var dashcore_lib_1 = require("@dashevo/dashcore-lib");
|
|
40
41
|
var wallet_lib_1 = require("@dashevo/wallet-lib");
|
|
41
42
|
// We're creating a new transaction every time and the index is always 0
|
|
42
43
|
var ASSET_LOCK_OUTPUT_INDEX = 0;
|
|
43
44
|
/**
|
|
44
45
|
* Creates a funding transaction for the platform identity and returns one-time key to sign the state transition
|
|
45
|
-
* @param {Platform}
|
|
46
|
+
* @param {Platform} this
|
|
46
47
|
* @param {number} fundingAmount - amount of dash to fund the identity's credits
|
|
47
48
|
* @return {Promise<{transaction: Transaction, privateKey: PrivateKey}>} - transaction and one time private key
|
|
48
49
|
* that can be used to sign registration/top-up state transition
|
|
49
50
|
*/
|
|
50
|
-
function createAssetLockTransaction(
|
|
51
|
+
function createAssetLockTransaction(fundingAmount) {
|
|
51
52
|
return __awaiter(this, void 0, void 0, function () {
|
|
52
|
-
var account, assetLockOneTimePrivateKey, assetLockOneTimePublicKey, identityAddress, changeAddress, lockTransaction, output, utxos, balance, selection, utxoAddresses, utxoHDPrivateKey, signingKeys, transaction;
|
|
53
|
+
var platform, account, assetLockOneTimePrivateKey, assetLockOneTimePublicKey, identityAddress, changeAddress, lockTransaction, output, utxos, balance, selection, utxoAddresses, utxoHDPrivateKey, signingKeys, transaction;
|
|
53
54
|
return __generator(this, function (_a) {
|
|
54
55
|
switch (_a.label) {
|
|
55
|
-
case 0:
|
|
56
|
+
case 0:
|
|
57
|
+
platform = this;
|
|
58
|
+
return [4 /*yield*/, platform.client.getWalletAccount()];
|
|
56
59
|
case 1:
|
|
57
60
|
account = _a.sent();
|
|
58
61
|
assetLockOneTimePrivateKey = new dashcore_lib_1.PrivateKey();
|
|
@@ -88,5 +91,6 @@ function createAssetLockTransaction(platform, fundingAmount) {
|
|
|
88
91
|
});
|
|
89
92
|
});
|
|
90
93
|
}
|
|
94
|
+
exports.createAssetLockTransaction = createAssetLockTransaction;
|
|
91
95
|
exports.default = createAssetLockTransaction;
|
|
92
96
|
//# sourceMappingURL=createAssetLockTransaction.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createAssetLockTransaction.js","sourceRoot":"","sources":["../../../../../src/SDK/Client/Platform/createAssetLockTransaction.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createAssetLockTransaction.js","sourceRoot":"","sources":["../../../../../src/SDK/Client/Platform/createAssetLockTransaction.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,sDAAgE;AAChE,kDAA4C;AAG5C,wEAAwE;AACxE,IAAM,uBAAuB,GAAG,CAAC,CAAC;AAElC;;;;;;GAMG;AACH,SAAsB,0BAA0B,CAAkB,aAAa;;;;;;oBACrE,QAAQ,GAAG,IAAI,CAAC;oBACN,qBAAM,QAAQ,CAAC,MAAM,CAAC,gBAAgB,EAAE,EAAA;;oBAAlD,OAAO,GAAG,SAAwC;oBAGlD,0BAA0B,GAAG,IAAI,yBAAU,EAAE,CAAC;oBAC9C,yBAAyB,GAAG,0BAA0B,CAAC,WAAW,EAAE,CAAC;oBAErE,eAAe,GAAG,yBAAyB,CAAC,SAAS,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,QAAQ,EAAE,CAAC;oBAE1F,aAAa,GAAG,OAAO,CAAC,gBAAgB,CAAC,UAAU,CAAC,CAAC,OAAO,CAAC;oBAE7D,eAAe,GAAG,IAAI,0BAAW,CAAC,SAAS,CAAC,CAAC;oBAE7C,MAAM,GAAG;wBACX,QAAQ,EAAE,aAAa;wBACvB,OAAO,EAAE,eAAe;qBAC3B,CAAC;oBAEI,KAAK,GAAG,OAAO,CAAC,QAAQ,EAAE,CAAC;oBAC3B,OAAO,GAAG,OAAO,CAAC,eAAe,EAAE,CAAC;oBAE1C,IAAI,OAAO,GAAG,MAAM,CAAC,QAAQ,EAAE;wBAC3B,MAAM,IAAI,KAAK,CAAC,yBAAuB,OAAO,kCAA6B,aAAe,CAAC,CAAC;qBAC/F;oBAEK,SAAS,GAAG,kBAAK,CAAC,aAAa,CAAC,KAAK,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;oBAEvD,eAAe;yBACV,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;wBACtB,aAAa;yBACZ,aAAa,CAAC,MAAM,CAAC,QAAQ,EAAE,yBAAyB,CAAC,MAAM,EAAE,CAAC;yBAClE,MAAM,CAAC,aAAa,CAAC,CAAC;oBAErB,aAAa,GAAG,SAAS,CAAC,KAAK,CAAC,GAAG,CAAC,UAAC,IAAS,IAAK,OAAA,IAAI,CAAC,OAAO,CAAC,QAAQ,EAAE,EAAvB,CAAuB,CAAC,CAAC;oBAG5E,gBAAgB,GAAG,OAAO,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC;oBAGzD,WAAW,GAAG,gBAAgB,CAAC,GAAG,CAAC,UAAC,YAAY,IAAK,OAAA,YAAY,CAAC,UAAU,EAAvB,CAAuB,CAAC,CAAC;oBAE9E,WAAW,GAAG,eAAe,CAAC,IAAI,CAAC,WAAW,CAAC,CAAC;oBAEtD,sBAAO;4BACH,WAAW,aAAA;4BACX,UAAU,EAAE,0BAA0B;4BACtC,WAAW,EAAE,uBAAuB;yBACvC,EAAC;;;;CACL;AAjDD,gEAiDC;AAED,kBAAe,0BAA0B,CAAC"}
|
|
@@ -39,22 +39,25 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
39
39
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
40
|
};
|
|
41
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.createAssetLockProof = void 0;
|
|
42
43
|
var waitForCoreChainLockedHeight_1 = __importDefault(require("./waitForCoreChainLockedHeight"));
|
|
43
44
|
var _a = require('@dashevo/wallet-lib/src/errors'), InstantLockTimeoutError = _a.InstantLockTimeoutError, TxMetadataTimeoutError = _a.TxMetadataTimeoutError;
|
|
44
45
|
/**
|
|
45
46
|
* Creates a funding transaction for the platform identity and returns one-time key to sign the state transition
|
|
46
|
-
* @param {Platform}
|
|
47
|
+
* @param {Platform} this
|
|
47
48
|
* @param {Transaction} assetLockTransaction
|
|
48
49
|
* @param {number} outputIndex - index of the funding output in the asset lock transaction
|
|
49
50
|
* @return {AssetLockProof} - asset lock proof to be used in the state transition
|
|
50
51
|
* that can be used to sign registration/top-up state transition
|
|
51
52
|
*/
|
|
52
|
-
function createAssetLockProof(
|
|
53
|
+
function createAssetLockProof(assetLockTransaction, outputIndex) {
|
|
53
54
|
return __awaiter(this, void 0, void 0, function () {
|
|
54
|
-
var account, dpp, _a, instantLockPromise, cancelInstantLock, _b, txMetadataPromise, cancelTxMetadata, cancelObtainCoreChainLockedHeight, rejectTimer, rejectionTimeout;
|
|
55
|
+
var platform, account, dpp, _a, instantLockPromise, cancelInstantLock, _b, txMetadataPromise, cancelTxMetadata, cancelObtainCoreChainLockedHeight, rejectTimer, rejectionTimeout;
|
|
55
56
|
return __generator(this, function (_c) {
|
|
56
57
|
switch (_c.label) {
|
|
57
|
-
case 0:
|
|
58
|
+
case 0:
|
|
59
|
+
platform = this;
|
|
60
|
+
return [4 /*yield*/, platform.initialize()];
|
|
58
61
|
case 1:
|
|
59
62
|
_c.sent();
|
|
60
63
|
return [4 /*yield*/, platform.client.getWalletAccount()];
|
|
@@ -131,5 +134,6 @@ function createAssetLockProof(platform, assetLockTransaction, outputIndex) {
|
|
|
131
134
|
});
|
|
132
135
|
});
|
|
133
136
|
}
|
|
137
|
+
exports.createAssetLockProof = createAssetLockProof;
|
|
134
138
|
exports.default = createAssetLockProof;
|
|
135
139
|
//# sourceMappingURL=createAssetLockProof.js.map
|
package/build/src/SDK/Client/Platform/methods/identities/internal/createAssetLockProof.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createAssetLockProof.js","sourceRoot":"","sources":["../../../../../../../../src/SDK/Client/Platform/methods/identities/internal/createAssetLockProof.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createAssetLockProof.js","sourceRoot":"","sources":["../../../../../../../../src/SDK/Client/Platform/methods/identities/internal/createAssetLockProof.ts"],"names":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oCAEnB,IAAI,iCAAiC,EAAE;wCACrC,iCAAiC,EAAE,CAAC;qCACrC;oCAED,iBAAiB,EAAE,CAAC;oCAEpB,MAAM,CAAC,IAAI,KAAK,CAAC,mCAAmC,CAAC,CAAC,CAAC;gCACzD,CAAC,EAAE,gBAAgB,CAAC,CAAA;4BACtB,CAAC,CAAC;yBACH,CAAC,EAAC;;;;CACN;AA1GD,oDA0GC;AAED,kBAAe,oBAAoB,CAAC"}
|
package/build/src/SDK/Client/Platform/methods/identities/internal/createIdentityCreateTransition.js
CHANGED
|
@@ -39,21 +39,24 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
39
39
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
40
|
};
|
|
41
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.createIdentityCreateTransition = void 0;
|
|
42
43
|
var IdentityPublicKey_1 = __importDefault(require("@dashevo/dpp/lib/identity/IdentityPublicKey"));
|
|
43
44
|
/**
|
|
44
45
|
* Creates a funding transaction for the platform identity and returns one-time key to sign the state transition
|
|
45
|
-
* @param {Platform}
|
|
46
|
+
* @param {Platform} this
|
|
46
47
|
* @param {AssetLockProof} assetLockProof - asset lock transaction proof for the identity create transition
|
|
47
48
|
* @param {PrivateKey} assetLockPrivateKey - private key used in asset lock
|
|
48
49
|
* @return {{identity: Identity, identityCreateTransition: IdentityCreateTransition}} - identity, state transition and index of the key used to create it
|
|
49
50
|
* that can be used to sign registration/top-up state transition
|
|
50
51
|
*/
|
|
51
|
-
function createIdentityCreateTransition(
|
|
52
|
+
function createIdentityCreateTransition(assetLockProof, assetLockPrivateKey) {
|
|
52
53
|
return __awaiter(this, void 0, void 0, function () {
|
|
53
|
-
var account, dpp, identityIndex, identityPrivateKey, identityPublicKey, identity, identityCreateTransition, result;
|
|
54
|
+
var platform, account, dpp, identityIndex, identityPrivateKey, identityPublicKey, identity, identityCreateTransition, result;
|
|
54
55
|
return __generator(this, function (_a) {
|
|
55
56
|
switch (_a.label) {
|
|
56
|
-
case 0:
|
|
57
|
+
case 0:
|
|
58
|
+
platform = this;
|
|
59
|
+
return [4 /*yield*/, platform.initialize()];
|
|
57
60
|
case 1:
|
|
58
61
|
_a.sent();
|
|
59
62
|
return [4 /*yield*/, platform.client.getWalletAccount()];
|
|
@@ -85,5 +88,6 @@ function createIdentityCreateTransition(platform, assetLockProof, assetLockPriva
|
|
|
85
88
|
});
|
|
86
89
|
});
|
|
87
90
|
}
|
|
91
|
+
exports.createIdentityCreateTransition = createIdentityCreateTransition;
|
|
88
92
|
exports.default = createIdentityCreateTransition;
|
|
89
93
|
//# sourceMappingURL=createIdentityCreateTransition.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createIdentityCreateTransition.js","sourceRoot":"","sources":["../../../../../../../../src/SDK/Client/Platform/methods/identities/internal/createIdentityCreateTransition.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createIdentityCreateTransition.js","sourceRoot":"","sources":["../../../../../../../../src/SDK/Client/Platform/methods/identities/internal/createIdentityCreateTransition.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,kGAA2E;AAE3E;;;;;;;GAOG;AACH,SAAsB,8BAA8B,CAAkB,cAAmB,EAAE,mBAA+B;;;;;;oBAChH,QAAQ,GAAG,IAAI,CAAC;oBACtB,qBAAM,QAAQ,CAAC,UAAU,EAAE,EAAA;;oBAA3B,SAA2B,CAAC;oBAEZ,qBAAM,QAAQ,CAAC,MAAM,CAAC,gBAAgB,EAAE,EAAA;;oBAAlD,OAAO,GAAG,SAAwC;oBAChD,GAAG,GAAK,QAAQ,IAAb,CAAc;oBAEH,qBAAM,OAAO,CAAC,sBAAsB,EAAE,EAAA;;oBAAtD,aAAa,GAAG,SAAsC;oBAGxC,kBAAkB,GAAK,OAAO,CAAC,UAAU,CAAC,uBAAuB,CAAC,aAAa,EAAE,CAAC,CAAC,WAAjE,CAAkE;oBAClG,iBAAiB,GAAG,kBAAkB,CAAC,WAAW,EAAE,CAAC;oBAIrD,QAAQ,GAAG,GAAG,CAAC,QAAQ,CAAC,MAAM,CAChC,cAAc,EAAE,CAAC;4BACf,GAAG,EAAE,iBAAiB;4BACtB,OAAO,EAAE,2BAAiB,CAAC,QAAQ,CAAC,cAAc;4BAClD,aAAa,EAAE,2BAAiB,CAAC,eAAe,CAAC,MAAM;yBACxD,CAAC,CACL,CAAC;oBAGI,wBAAwB,GAAG,GAAG,CAAC,QAAQ,CAAC,8BAA8B,CAAC,QAAQ,CAAC,CAAC;oBAEvF,qBAAM,wBAAwB,CAAC,gBAAgB,CAAC,mBAAmB,EAAE,2BAAiB,CAAC,KAAK,CAAC,eAAe,CAAC,EAAA;;oBAA7G,SAA6G,CAAC;oBAE/F,qBAAM,GAAG,CAAC,eAAe,CAAC,aAAa,CAAC,wBAAwB,CAAC,EAAA;;oBAA1E,MAAM,GAAG,SAAiE;oBAEhF,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE;wBACnB,MAAM,IAAI,KAAK,CAAC,kCAAgC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,EAAE,CAAG,CAAC,CAAC;qBACzF;oBAED,sBAAO,EAAE,QAAQ,UAAA,EAAE,wBAAwB,0BAAA,EAAE,aAAa,eAAA,EAAE,EAAC;;;;CAChE;AAnCD,wEAmCC;AAED,kBAAe,8BAA8B,CAAC"}
|
package/build/src/SDK/Client/Platform/methods/identities/internal/createIdnetityTopUpTransition.js
CHANGED
|
@@ -39,22 +39,25 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
39
39
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
40
40
|
};
|
|
41
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.createIdentityTopUpTransition = void 0;
|
|
42
43
|
var IdentityPublicKey_1 = __importDefault(require("@dashevo/dpp/lib/identity/IdentityPublicKey"));
|
|
43
44
|
/**
|
|
44
45
|
* Creates a funding transaction for the platform identity and returns one-time key to sign the state transition
|
|
45
|
-
* @param {Platform}
|
|
46
|
+
* @param {Platform} this
|
|
46
47
|
* @param {AssetLockProof} assetLockProof - asset lock transaction proof for the identity create transition
|
|
47
48
|
* @param {PrivateKey} assetLockPrivateKey - private key used in asset lock
|
|
48
49
|
* @param {string|Buffer|Identifier} identityId
|
|
49
50
|
* @return {{identity: Identity, identityCreateTransition: IdentityCreateTransition}} - identity, state transition and index of the key used to create it
|
|
50
51
|
* that can be used to sign registration/top-up state transition
|
|
51
52
|
*/
|
|
52
|
-
function createIdentityTopUpTransition(
|
|
53
|
+
function createIdentityTopUpTransition(assetLockProof, assetLockPrivateKey, identityId) {
|
|
53
54
|
return __awaiter(this, void 0, void 0, function () {
|
|
54
|
-
var dpp, identityTopUpTransition, result;
|
|
55
|
+
var platform, dpp, identityTopUpTransition, result;
|
|
55
56
|
return __generator(this, function (_a) {
|
|
56
57
|
switch (_a.label) {
|
|
57
|
-
case 0:
|
|
58
|
+
case 0:
|
|
59
|
+
platform = this;
|
|
60
|
+
return [4 /*yield*/, platform.initialize()];
|
|
58
61
|
case 1:
|
|
59
62
|
_a.sent();
|
|
60
63
|
dpp = platform.dpp;
|
|
@@ -73,5 +76,6 @@ function createIdentityTopUpTransition(platform, assetLockProof, assetLockPrivat
|
|
|
73
76
|
});
|
|
74
77
|
});
|
|
75
78
|
}
|
|
79
|
+
exports.createIdentityTopUpTransition = createIdentityTopUpTransition;
|
|
76
80
|
exports.default = createIdentityTopUpTransition;
|
|
77
81
|
//# sourceMappingURL=createIdnetityTopUpTransition.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createIdnetityTopUpTransition.js","sourceRoot":"","sources":["../../../../../../../../src/SDK/Client/Platform/methods/identities/internal/createIdnetityTopUpTransition.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"createIdnetityTopUpTransition.js","sourceRoot":"","sources":["../../../../../../../../src/SDK/Client/Platform/methods/identities/internal/createIdnetityTopUpTransition.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,kGAA2E;AAE3E;;;;;;;;GAQG;AACH,SAAsB,6BAA6B,CAAkB,cAAmB,EAAE,mBAA+B,EAAE,UAAe;;;;;;oBAChI,QAAQ,GAAG,IAAI,CAAC;oBACtB,qBAAM,QAAQ,CAAC,UAAU,EAAE,EAAA;;oBAA3B,SAA2B,CAAC;oBAEpB,GAAG,GAAK,QAAQ,IAAb,CAAc;oBAGnB,uBAAuB,GAAG,GAAG,CAAC,QAAQ,CAAC,6BAA6B,CACtE,UAAU,EAAG,cAAc,CAC9B,CAAC;oBAEF,qBAAM,uBAAuB,CAAC,gBAAgB,CAAC,mBAAmB,EAAE,2BAAiB,CAAC,KAAK,CAAC,eAAe,CAAC,EAAA;;oBAA5G,SAA4G,CAAC;oBAE9F,qBAAM,GAAG,CAAC,eAAe,CAAC,aAAa,CAAC,uBAAuB,CAAC,EAAA;;oBAAzE,MAAM,GAAG,SAAgE;oBAE/E,IAAI,CAAC,MAAM,CAAC,OAAO,EAAE,EAAE;wBACnB,MAAM,IAAI,KAAK,CAAC,kCAAgC,IAAI,CAAC,SAAS,CAAC,MAAM,CAAC,SAAS,EAAE,CAAG,CAAC,CAAC;qBACzF;oBAED,sBAAO,uBAAuB,EAAC;;;;CAClC;AApBD,sEAoBC;AAED,kBAAe,6BAA6B,CAAC"}
|
package/build/src/SDK/Client/Platform/methods/identities/internal/waitForCoreChainLockedHeight.js
CHANGED
|
@@ -36,8 +36,9 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
|
36
36
|
}
|
|
37
37
|
};
|
|
38
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
39
|
+
exports.waitForCoreChainLockedHeight = void 0;
|
|
39
40
|
var systemIds_1 = require("@dashevo/dpns-contract/lib/systemIds");
|
|
40
|
-
function waitForCoreChainLockedHeight(
|
|
41
|
+
function waitForCoreChainLockedHeight(expectedCoreHeight) {
|
|
41
42
|
return __awaiter(this, void 0, void 0, function () {
|
|
42
43
|
function cancel() {
|
|
43
44
|
if (timeout) {
|
|
@@ -45,10 +46,12 @@ function waitForCoreChainLockedHeight(platform, expectedCoreHeight) {
|
|
|
45
46
|
}
|
|
46
47
|
isCanceled = true;
|
|
47
48
|
}
|
|
48
|
-
var interval, isCanceled, timeout, coreChainLockedHeight, promise;
|
|
49
|
+
var platform, interval, isCanceled, timeout, coreChainLockedHeight, promise;
|
|
49
50
|
return __generator(this, function (_a) {
|
|
50
51
|
switch (_a.label) {
|
|
51
|
-
case 0:
|
|
52
|
+
case 0:
|
|
53
|
+
platform = this;
|
|
54
|
+
return [4 /*yield*/, platform.initialize()];
|
|
52
55
|
case 1:
|
|
53
56
|
_a.sent();
|
|
54
57
|
interval = 5000;
|
|
@@ -99,5 +102,6 @@ function waitForCoreChainLockedHeight(platform, expectedCoreHeight) {
|
|
|
99
102
|
});
|
|
100
103
|
});
|
|
101
104
|
}
|
|
105
|
+
exports.waitForCoreChainLockedHeight = waitForCoreChainLockedHeight;
|
|
102
106
|
exports.default = waitForCoreChainLockedHeight;
|
|
103
107
|
//# sourceMappingURL=waitForCoreChainLockedHeight.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"waitForCoreChainLockedHeight.js","sourceRoot":"","sources":["../../../../../../../../src/SDK/Client/Platform/methods/identities/internal/waitForCoreChainLockedHeight.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"waitForCoreChainLockedHeight.js","sourceRoot":"","sources":["../../../../../../../../src/SDK/Client/Platform/methods/identities/internal/waitForCoreChainLockedHeight.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA,kEAA8E;AAE9E,SAAsB,4BAA4B,CAEhD,kBAA2B;;QA+C3B,SAAS,MAAM;YACb,IAAI,OAAO,EAAE;gBACX,YAAY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|
40
40
|
};
|
|
41
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
-
var createAssetLockTransaction_1 = __importDefault(require("../../createAssetLockTransaction"));
|
|
43
|
-
var createIdentityCreateTransition_1 = __importDefault(require("./internal/createIdentityCreateTransition"));
|
|
44
|
-
var createAssetLockProof_1 = __importDefault(require("./internal/createAssetLockProof"));
|
|
45
42
|
var broadcastStateTransition_1 = __importDefault(require("../../broadcastStateTransition"));
|
|
46
43
|
/**
|
|
47
44
|
* Register identities to the platform
|
|
@@ -62,7 +59,7 @@ function register(fundingAmount) {
|
|
|
62
59
|
return [4 /*yield*/, client.getWalletAccount()];
|
|
63
60
|
case 2:
|
|
64
61
|
account = _c.sent();
|
|
65
|
-
return [4 /*yield*/,
|
|
62
|
+
return [4 /*yield*/, this.identities.utils.createAssetLockTransaction(fundingAmount)];
|
|
66
63
|
case 3:
|
|
67
64
|
_a = _c.sent(), assetLockTransaction = _a.transaction, assetLockPrivateKey = _a.privateKey, assetLockOutputIndex = _a.outputIndex;
|
|
68
65
|
// Broadcast Asset Lock transaction
|
|
@@ -70,10 +67,12 @@ function register(fundingAmount) {
|
|
|
70
67
|
case 4:
|
|
71
68
|
// Broadcast Asset Lock transaction
|
|
72
69
|
_c.sent();
|
|
73
|
-
return [4 /*yield*/,
|
|
70
|
+
return [4 /*yield*/, this.identities.utils
|
|
71
|
+
.createAssetLockProof(assetLockTransaction, assetLockOutputIndex)];
|
|
74
72
|
case 5:
|
|
75
73
|
assetLockProof = _c.sent();
|
|
76
|
-
return [4 /*yield*/,
|
|
74
|
+
return [4 /*yield*/, this.identities.utils
|
|
75
|
+
.createIdentityCreateTransition(assetLockProof, assetLockPrivateKey)];
|
|
77
76
|
case 6:
|
|
78
77
|
_b = _c.sent(), identity = _b.identity, identityCreateTransition = _b.identityCreateTransition, identityIndex = _b.identityIndex;
|
|
79
78
|
return [4 /*yield*/, broadcastStateTransition_1.default(this, identityCreateTransition)];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"register.js","sourceRoot":"","sources":["../../../../../../../src/SDK/Client/Platform/methods/identities/register.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,
|
|
1
|
+
{"version":3,"file":"register.js","sourceRoot":"","sources":["../../../../../../../src/SDK/Client/Platform/methods/identities/register.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,4FAAsE;AAEtE;;;;;GAKG;AACH,SAA8B,QAAQ,CAEpC,aAA8B;IAA9B,8BAAA,EAAA,qBAA8B;;;;;wBAE5B,qBAAM,IAAI,CAAC,UAAU,EAAE,EAAA;;oBAAvB,SAAuB,CAAC;oBAEhB,MAAM,GAAK,IAAI,OAAT,CAAU;oBAER,qBAAM,MAAM,CAAC,gBAAgB,EAAE,EAAA;;oBAAzC,OAAO,GAAG,SAA+B;oBAM3C,qBAAM,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,0BAA0B,CAAC,aAAa,CAAC,EAAA;;oBAJnE,KAIF,SAAqE,EAHxD,oBAAoB,iBAAA,EACrB,mBAAmB,gBAAA,EAClB,oBAAoB,iBAAA;oBAGrC,mCAAmC;oBACnC,qBAAM,OAAO,CAAC,oBAAoB,CAAC,oBAAoB,CAAC,EAAA;;oBADxD,mCAAmC;oBACnC,SAAwD,CAAC;oBAElC,qBAAM,IAAI,CAAC,UAAU,CAAC,KAAK;6BAC/C,oBAAoB,CAAC,oBAAoB,EAAE,oBAAoB,CAAC,EAAA;;oBAD7D,cAAc,GAAG,SAC4C;oBAEL,qBAAM,IAAI,CAAC,UAAU,CAAC,KAAK;6BACtF,8BAA8B,CAAC,cAAc,EAAE,mBAAmB,CAAC,EAAA;;oBADhE,KAAwD,SACQ,EAD9D,QAAQ,cAAA,EAAE,wBAAwB,8BAAA,EAAE,aAAa,mBAAA;oBAGzD,qBAAM,kCAAwB,CAAC,IAAI,EAAE,wBAAwB,CAAC,EAAA;;oBAA9D,SAA8D,CAAC;oBAE/D,uFAAuF;oBACxF,OAAO,CAAC,OAAO;yBACb,cAAc,CAAC,OAAO,CAAC,QAAQ,CAAC;yBAChC,uBAAuB,CACtB,QAAQ,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE,EAC3B,aAAa,CACd,CAAC;oBAGyB,qBAAM,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,QAAQ,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE,CAAC,EAAA;;oBAA3E,kBAAkB,GAAG,SAAsD;oBAEjF,yDAAyD;oBACzD,wEAAwE;oBACxE,QAAQ,CAAC,WAAW,CAAC,kBAAkB,CAAC,QAAQ,CAAC,CAAC;oBAClD,QAAQ,CAAC,UAAU,CAAC,kBAAkB,CAAC,OAAO,CAAC,CAAC;oBAEhD,sBAAO,QAAQ,EAAC;;;;CACnB;AA5CD,2BA4CC"}
|
|
@@ -40,11 +40,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
40
40
|
};
|
|
41
41
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
42
|
exports.topUp = void 0;
|
|
43
|
-
// @ts-ignore
|
|
44
43
|
var Identifier_1 = __importDefault(require("@dashevo/dpp/lib/Identifier"));
|
|
45
|
-
var createAssetLockTransaction_1 = __importDefault(require("../../createAssetLockTransaction"));
|
|
46
|
-
var createAssetLockProof_1 = __importDefault(require("./internal/createAssetLockProof"));
|
|
47
|
-
var createIdnetityTopUpTransition_1 = __importDefault(require("./internal/createIdnetityTopUpTransition"));
|
|
48
44
|
var broadcastStateTransition_1 = __importDefault(require("../../broadcastStateTransition"));
|
|
49
45
|
/**
|
|
50
46
|
* Register identities to the platform
|
|
@@ -67,7 +63,7 @@ function topUp(identityId, amount) {
|
|
|
67
63
|
return [4 /*yield*/, client.getWalletAccount()];
|
|
68
64
|
case 2:
|
|
69
65
|
account = _b.sent();
|
|
70
|
-
return [4 /*yield*/,
|
|
66
|
+
return [4 /*yield*/, this.identities.utils.createAssetLockTransaction(amount)];
|
|
71
67
|
case 3:
|
|
72
68
|
_a = _b.sent(), assetLockTransaction = _a.transaction, assetLockPrivateKey = _a.privateKey, assetLockOutputIndex = _a.outputIndex;
|
|
73
69
|
// Broadcast Asset Lock transaction
|
|
@@ -75,10 +71,12 @@ function topUp(identityId, amount) {
|
|
|
75
71
|
case 4:
|
|
76
72
|
// Broadcast Asset Lock transaction
|
|
77
73
|
_b.sent();
|
|
78
|
-
return [4 /*yield*/,
|
|
74
|
+
return [4 /*yield*/, this.identities.utils
|
|
75
|
+
.createAssetLockProof(assetLockTransaction, assetLockOutputIndex)];
|
|
79
76
|
case 5:
|
|
80
77
|
assetLockProof = _b.sent();
|
|
81
|
-
return [4 /*yield*/,
|
|
78
|
+
return [4 /*yield*/, this.identities.utils
|
|
79
|
+
.createIdentityTopUpTransition(assetLockProof, assetLockPrivateKey, identityId)];
|
|
82
80
|
case 6:
|
|
83
81
|
identityTopUpTransition = _b.sent();
|
|
84
82
|
// Broadcast ST
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"topUp.js","sourceRoot":"","sources":["../../../../../../../src/SDK/Client/Platform/methods/identities/topUp.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,
|
|
1
|
+
{"version":3,"file":"topUp.js","sourceRoot":"","sources":["../../../../../../../src/SDK/Client/Platform/methods/identities/topUp.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,2EAAqD;AAGrD,4FAAsE;AAEtE;;;;;;;GAOG;AACH,SAAsB,KAAK,CAAiB,UAA+B,EAAE,MAAc;;;;;wBACvF,qBAAM,IAAI,CAAC,UAAU,EAAE,EAAA;;oBAAvB,SAAuB,CAAC;oBAEhB,MAAM,GAAK,IAAI,OAAT,CAAU;oBAExB,UAAU,GAAG,oBAAU,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC;oBAEzB,qBAAM,MAAM,CAAC,gBAAgB,EAAE,EAAA;;oBAAzC,OAAO,GAAG,SAA+B;oBAM3C,qBAAM,IAAI,CAAC,UAAU,CAAC,KAAK,CAAC,0BAA0B,CAAC,MAAM,CAAC,EAAA;;oBAJ5D,KAIF,SAA8D,EAHjD,oBAAoB,iBAAA,EACrB,mBAAmB,gBAAA,EAClB,oBAAoB,iBAAA;oBAGrC,mCAAmC;oBACnC,qBAAM,OAAO,CAAC,oBAAoB,CAAC,oBAAoB,CAAC,EAAA;;oBADxD,mCAAmC;oBACnC,SAAwD,CAAC;oBAElC,qBAAM,IAAI,CAAC,UAAU,CAAC,KAAK;6BAC/C,oBAAoB,CAAC,oBAAoB,EAAE,oBAAoB,CAAC,EAAA;;oBAD7D,cAAc,GAAG,SAC4C;oBAEnC,qBAAM,IAAI,CAAC,UAAU,CAAC,KAAK;6BACxD,6BAA6B,CAAC,cAAc,EAAE,mBAAmB,EAAE,UAAU,CAAC,EAAA;;oBAD3E,uBAAuB,GAAG,SACiD;oBAEjF,eAAe;oBACf,qBAAM,kCAAwB,CAAC,IAAI,EAAE,uBAAuB,CAAC,EAAA;;oBAD7D,eAAe;oBACf,SAA6D,CAAC;oBAE9D,sBAAO,IAAI,EAAC;;;;CACf;AA5BD,sBA4BC;AAED,kBAAe,KAAK,CAAC"}
|
package/build/src/SDK/SDK.js
CHANGED
|
@@ -8,23 +8,33 @@ var Client_1 = require("./Client");
|
|
|
8
8
|
var Core_1 = require("./Core");
|
|
9
9
|
var Platform_1 = require("./Platform");
|
|
10
10
|
var dapi_client_1 = __importDefault(require("@dashevo/dapi-client"));
|
|
11
|
+
var StateTransitionBroadcastError_1 = require("../errors/StateTransitionBroadcastError");
|
|
11
12
|
var wallet_lib_1 = require("@dashevo/wallet-lib");
|
|
12
13
|
var SDK;
|
|
13
14
|
(function (SDK) {
|
|
14
15
|
SDK.DAPIClient = dapi_client_1.default;
|
|
15
16
|
SDK.Client = Client_1.Client;
|
|
16
17
|
SDK.Core = Core_1.Core;
|
|
18
|
+
// TODO: consider marking as DEPRECATED and use PlatformProtocol below instead
|
|
17
19
|
SDK.Platform = Platform_1.Platform;
|
|
18
20
|
// Wallet-lib primitives
|
|
19
21
|
SDK.Wallet = wallet_lib_1.Wallet;
|
|
20
22
|
SDK.Account = wallet_lib_1.Account;
|
|
21
23
|
SDK.KeyChain = wallet_lib_1.DerivableKeyChain;
|
|
24
|
+
// TODO: consider merging into Wallet above and mark as DEPRECATED
|
|
22
25
|
SDK.WalletLib = {
|
|
23
26
|
CONSTANTS: wallet_lib_1.CONSTANTS,
|
|
24
27
|
EVENTS: wallet_lib_1.EVENTS,
|
|
25
28
|
plugins: wallet_lib_1.plugins,
|
|
26
29
|
utils: wallet_lib_1.utils,
|
|
27
30
|
};
|
|
31
|
+
SDK.PlatformProtocol = SDK.Platform.DashPlatformProtocol;
|
|
32
|
+
SDK.Essentials = {
|
|
33
|
+
Buffer: Buffer,
|
|
34
|
+
};
|
|
35
|
+
SDK.Errors = {
|
|
36
|
+
StateTransitionBroadcastError: StateTransitionBroadcastError_1.StateTransitionBroadcastError
|
|
37
|
+
};
|
|
28
38
|
})(SDK = exports.SDK || (exports.SDK = {}));
|
|
29
39
|
exports.default = SDK;
|
|
30
40
|
//# sourceMappingURL=SDK.js.map
|
package/build/src/SDK/SDK.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SDK.js","sourceRoot":"","sources":["../../../src/SDK/SDK.ts"],"names":[],"mappings":";;;;;;AAAA,mCAA6C;AAC7C,+BAAuC;AACvC,uCAAmD;AACnD,qEAA8D;AAE9D,kDAQ6B;AAE7B,IAAiB,GAAG,
|
|
1
|
+
{"version":3,"file":"SDK.js","sourceRoot":"","sources":["../../../src/SDK/SDK.ts"],"names":[],"mappings":";;;;;;AAAA,mCAA6C;AAC7C,+BAAuC;AACvC,uCAAmD;AACnD,qEAA8D;AAE9D,yFAAuF;AAEvF,kDAQ6B;AAE7B,IAAiB,GAAG,CA8BnB;AA9BD,WAAiB,GAAG;IACP,cAAU,GAAG,qBAAW,CAAC;IACzB,UAAM,GAAG,eAAO,CAAC;IAEjB,QAAI,GAAG,WAAK,CAAC;IACxB,8EAA8E;IACnE,YAAQ,GAAG,mBAAS,CAAC;IAEhC,wBAAwB;IACb,UAAM,GAAG,mBAAO,CAAC;IACjB,WAAO,GAAG,oBAAQ,CAAC;IACnB,YAAQ,GAAG,8BAAS,CAAC;IAEhC,kEAAkE;IACvD,aAAS,GAAG;QACrB,SAAS,EAAE,sBAAmB;QAC9B,MAAM,EAAE,mBAAgB;QACxB,OAAO,EAAE,oBAAiB;QAC1B,KAAK,EAAE,kBAAe;KACvB,CAAA;IAEU,oBAAgB,GAAG,IAAA,QAAQ,CAAC,oBAAoB,CAAC;IAEjD,cAAU,GAAG;QACtB,MAAM,QAAA;KACP,CAAA;IAEU,UAAM,GAAG;QAClB,6BAA6B,+DAAA;KAC9B,CAAA;AACH,CAAC,EA9BgB,GAAG,GAAH,WAAG,KAAH,WAAG,QA8BnB;AACe,sBAAO"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* WebSocket shim for webpack browser builds
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
var ws;
|
|
6
|
+
|
|
7
|
+
if (typeof WebSocket !== 'undefined') {
|
|
8
|
+
ws = WebSocket;
|
|
9
|
+
} else if (typeof MozWebSocket !== 'undefined') {
|
|
10
|
+
ws = MozWebSocket;
|
|
11
|
+
} else {
|
|
12
|
+
ws = window.WebSocket || window.MozWebSocket;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
module.exports = ws;
|