dash 3.21.7 → 3.22.0-dev.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/build/src/SDK/Client/Client.js +8 -2
- package/build/src/SDK/Client/Client.js.map +1 -1
- package/build/src/SDK/Client/Client.spec.js +23 -15
- package/build/src/SDK/Client/Client.spec.js.map +1 -1
- package/build/src/SDK/Client/Platform/Platform.js +4 -2
- package/build/src/SDK/Client/Platform/Platform.js.map +1 -1
- package/build/src/SDK/Client/Platform/broadcastStateTransition.js +1 -1
- package/build/src/SDK/Client/Platform/broadcastStateTransition.js.map +1 -1
- package/build/src/SDK/Client/Platform/methods/contracts/{broadcast.js → publish.js} +6 -6
- package/build/src/SDK/Client/Platform/methods/contracts/publish.js.map +1 -0
- package/build/src/SDK/Client/Platform/methods/contracts/update.js +86 -0
- package/build/src/SDK/Client/Platform/methods/contracts/update.js.map +1 -0
- package/build/src/SDK/Client/Platform/methods/documents/get.js +13 -0
- package/build/src/SDK/Client/Platform/methods/documents/get.js.map +1 -1
- package/build/src/SDK/Client/Platform/methods/documents/get.spec.js +49 -0
- package/build/src/SDK/Client/Platform/methods/documents/get.spec.js.map +1 -1
- package/build/src/SDK/Client/Platform/methods/identities/internal/createIdentityCreateTransition.js +13 -3
- 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 -2
- package/build/src/SDK/Client/Platform/methods/identities/internal/createIdnetityTopUpTransition.js.map +1 -1
- package/build/src/SDK/Client/Platform/methods/names/search.js +3 -0
- package/build/src/SDK/Client/Platform/methods/names/search.js.map +1 -1
- package/build/src/SDK/Client/Platform/methods/names/search.spec.js +2 -0
- package/build/src/SDK/Client/Platform/methods/names/search.spec.js.map +1 -1
- package/build/src/SDK/Client/Platform/signStateTransition.js +3 -1
- package/build/src/SDK/Client/Platform/signStateTransition.js.map +1 -1
- package/build/src/test/bootstrap.js +11 -0
- package/build/src/test/bootstrap.js.map +1 -1
- package/build/src/test/fixtures/createIdentityFixtureInAccount.js +2 -0
- package/build/src/test/fixtures/createIdentityFixtureInAccount.js.map +1 -1
- package/build/tests/fixtures/contracts.json +3 -1
- package/dist/src/SDK/Client/Platform/IPlatformStateProof.d.ts +1 -2
- package/dist/src/SDK/Client/Platform/Platform.d.ts +9 -3
- package/dist/src/SDK/Client/Platform/broadcastStateTransition.d.ts +2 -2
- package/dist/src/SDK/Client/Platform/methods/contracts/publish.d.ts +10 -0
- package/dist/src/SDK/Client/Platform/methods/contracts/update.d.ts +10 -0
- package/dist/src/SDK/Client/Platform/methods/documents/get.d.ts +7 -4
- package/docs/_sidebar.md +19 -17
- package/docs/examples/publishing-a-new-contract.md +6 -6
- package/docs/examples/sign-and-verify-messages.md +1 -1
- package/docs/examples/updating-a-contract.md +55 -0
- package/docs/platform/contracts/{broadcast.md → publish.md} +6 -6
- package/docs/platform/contracts/update.md +14 -0
- package/docs/platform/identities/topUp.md +2 -0
- package/docs/wallet/about-wallet-lib.md +1 -1
- package/examples/node/register-contract.js +1 -1
- package/examples/schema.json +2 -0
- package/package.json +9 -6
- package/src/SDK/Client/Client.spec.ts +5 -5
- package/src/SDK/Client/Client.ts +8 -2
- package/src/SDK/Client/Platform/IPlatformStateProof.ts +1 -2
- package/src/SDK/Client/Platform/Platform.ts +14 -5
- package/src/SDK/Client/Platform/broadcastStateTransition.ts +2 -3
- package/src/SDK/Client/Platform/methods/contracts/{broadcast.ts → publish.ts} +4 -4
- package/src/SDK/Client/Platform/methods/contracts/update.ts +39 -0
- package/src/SDK/Client/Platform/methods/documents/get.spec.ts +37 -0
- package/src/SDK/Client/Platform/methods/documents/get.ts +17 -4
- package/src/SDK/Client/Platform/methods/identities/internal/createIdentityCreateTransition.ts +7 -2
- package/src/SDK/Client/Platform/methods/identities/internal/createIdnetityTopUpTransition.ts +2 -1
- package/src/SDK/Client/Platform/methods/names/search.spec.ts +2 -0
- package/src/SDK/Client/Platform/methods/names/search.ts +3 -0
- package/src/SDK/Client/Platform/signStateTransition.ts +2 -2
- package/src/test/bootstrap.js +13 -0
- package/src/test/fixtures/createIdentityFixtureInAccount.ts +3 -1
- package/tests/fixtures/contracts.json +3 -1
- package/tests/fixtures/dp1.schema.json +2 -0
- package/tests/fixtures/ratePlatform.schema.json +1 -0
- package/build/src/SDK/Client/Platform/methods/contracts/broadcast.js.map +0 -1
- package/dist/src/SDK/Client/Platform/methods/contracts/broadcast.d.ts +0 -10
|
@@ -59,6 +59,9 @@ function search(labelPrefix, parentDomainName) {
|
|
|
59
59
|
['normalizedParentDomainName', '==', normalizedParentDomainName],
|
|
60
60
|
['normalizedLabel', 'startsWith', normalizedLabelPrefix],
|
|
61
61
|
],
|
|
62
|
+
orderBy: [
|
|
63
|
+
['normalizedLabel', 'asc']
|
|
64
|
+
]
|
|
62
65
|
})];
|
|
63
66
|
case 2:
|
|
64
67
|
documents = _a.sent();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../../../../../../src/SDK/Client/Platform/methods/names/search.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;;;;;GAKG;AACH,SAAsB,MAAM,CAAiB,WAAmB,EAAE,gBAA6B;IAA7B,iCAAA,EAAA,qBAA6B;;;;;wBAC3F,qBAAM,IAAI,CAAC,UAAU,EAAE,EAAA;;oBAAvB,SAAuB,CAAC;oBAElB,0BAA0B,GAAG,gBAAgB,CAAC,WAAW,EAAE,CAAC;oBAC5D,qBAAqB,GAAG,WAAW,CAAC,WAAW,EAAE,CAAC;oBAEtC,qBAAM,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,aAAa,EAAE;4BACtD,KAAK,EAAE;gCACH,CAAC,4BAA4B,EAAE,IAAI,EAAE,0BAA0B,CAAC;gCAChE,CAAC,iBAAiB,EAAE,YAAY,EAAE,qBAAqB,CAAC;6BAC3D;yBACJ,CAAC,EAAA;;
|
|
1
|
+
{"version":3,"file":"search.js","sourceRoot":"","sources":["../../../../../../../src/SDK/Client/Platform/methods/names/search.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;;;;;GAKG;AACH,SAAsB,MAAM,CAAiB,WAAmB,EAAE,gBAA6B;IAA7B,iCAAA,EAAA,qBAA6B;;;;;wBAC3F,qBAAM,IAAI,CAAC,UAAU,EAAE,EAAA;;oBAAvB,SAAuB,CAAC;oBAElB,0BAA0B,GAAG,gBAAgB,CAAC,WAAW,EAAE,CAAC;oBAC5D,qBAAqB,GAAG,WAAW,CAAC,WAAW,EAAE,CAAC;oBAEtC,qBAAM,IAAI,CAAC,SAAS,CAAC,GAAG,CAAC,aAAa,EAAE;4BACtD,KAAK,EAAE;gCACH,CAAC,4BAA4B,EAAE,IAAI,EAAE,0BAA0B,CAAC;gCAChE,CAAC,iBAAiB,EAAE,YAAY,EAAE,qBAAqB,CAAC;6BAC3D;4BACD,OAAO,EAAE;gCACP,CAAC,iBAAiB,EAAE,KAAK,CAAC;6BAC3B;yBACJ,CAAC,EAAA;;oBARI,SAAS,GAAG,SAQhB;oBAEF,sBAAO,SAAS,EAAC;;;;CACpB;AAjBD,wBAiBC;AAED,kBAAe,MAAM,CAAC"}
|
|
@@ -79,6 +79,7 @@ describe('Platform', function () {
|
|
|
79
79
|
["normalizedParentDomainName", "==", "dash"],
|
|
80
80
|
["normalizedLabel", "startsWith", "prefix"]
|
|
81
81
|
],
|
|
82
|
+
orderBy: [['normalizedLabel', 'asc']],
|
|
82
83
|
},
|
|
83
84
|
]);
|
|
84
85
|
chai_1.expect(documentsList).to.have.deep.members([parentDomainDocument]);
|
|
@@ -103,6 +104,7 @@ describe('Platform', function () {
|
|
|
103
104
|
["normalizedParentDomainName", "==", "dash"],
|
|
104
105
|
["normalizedLabel", "startsWith", "prefix"]
|
|
105
106
|
],
|
|
107
|
+
orderBy: [['normalizedLabel', 'asc']]
|
|
106
108
|
},
|
|
107
109
|
]);
|
|
108
110
|
chai_1.expect(documentsList).to.deep.equal([]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"search.spec.js","sourceRoot":"","sources":["../../../../../../../src/SDK/Client/Platform/methods/names/search.spec.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6BAA8B;AAE9B,oDAA8B;AAE9B,QAAQ,CAAC,UAAU,EAAE;IACjB,QAAQ,CAAC,OAAO,EAAE;QACd,QAAQ,CAAC,SAAS,EAAE;YAChB,IAAI,YAAY,CAAC;YACjB,IAAI,oBAAoB,CAAC;YACzB,IAAI,mBAAmB,CAAC;YAExB,UAAU,CAAC,SAAe,UAAU;;;wBAChC,oBAAoB,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;wBAC3C,mBAAmB,GAAG,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC;wBAEhD,YAAY,GAAG;4BACX,SAAS,EAAE;gCACP,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE;6BACzB;4BACD,UAAU,EAAG,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE;yBACjC,CAAC;;;;aACL,CAAC,CAAC;YAEH,EAAE,CAAC,0CAA0C,EAAE;;;;;4BAC3C,YAAY,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC;4BAEtC,qBAAM,gBAAM,CAAC,IAAI,CACnC,YAAY,EAAE,QAAQ,EAAE,MAAM,CACjC,EAAA;;4BAFK,aAAa,GAAG,SAErB;4BAED,aAAM,CAAC,YAAY,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;4BACzD,aAAM,CAAC,YAAY,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC;gCAC7D,aAAa;gCACb;oCACI,KAAK,EAAE;wCACH,CAAC,4BAA4B,EAAE,IAAI,EAAE,MAAM,CAAC;wCAC5C,CAAC,iBAAiB,EAAE,YAAY,EAAE,QAAQ,CAAC;qCAC9C;
|
|
1
|
+
{"version":3,"file":"search.spec.js","sourceRoot":"","sources":["../../../../../../../src/SDK/Client/Platform/methods/names/search.spec.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,6BAA8B;AAE9B,oDAA8B;AAE9B,QAAQ,CAAC,UAAU,EAAE;IACjB,QAAQ,CAAC,OAAO,EAAE;QACd,QAAQ,CAAC,SAAS,EAAE;YAChB,IAAI,YAAY,CAAC;YACjB,IAAI,oBAAoB,CAAC;YACzB,IAAI,mBAAmB,CAAC;YAExB,UAAU,CAAC,SAAe,UAAU;;;wBAChC,oBAAoB,GAAG,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;wBAC3C,mBAAmB,GAAG,EAAE,KAAK,EAAE,cAAc,EAAE,CAAC;wBAEhD,YAAY,GAAG;4BACX,SAAS,EAAE;gCACP,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE;6BACzB;4BACD,UAAU,EAAG,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE;yBACjC,CAAC;;;;aACL,CAAC,CAAC;YAEH,EAAE,CAAC,0CAA0C,EAAE;;;;;4BAC3C,YAAY,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC;4BAEtC,qBAAM,gBAAM,CAAC,IAAI,CACnC,YAAY,EAAE,QAAQ,EAAE,MAAM,CACjC,EAAA;;4BAFK,aAAa,GAAG,SAErB;4BAED,aAAM,CAAC,YAAY,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;4BACzD,aAAM,CAAC,YAAY,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC;gCAC7D,aAAa;gCACb;oCACI,KAAK,EAAE;wCACH,CAAC,4BAA4B,EAAE,IAAI,EAAE,MAAM,CAAC;wCAC5C,CAAC,iBAAiB,EAAE,YAAY,EAAE,QAAQ,CAAC;qCAC9C;oCACD,OAAO,EAAE,CAAC,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAC;iCACxC;6BACJ,CAAC,CAAC;4BAEH,aAAM,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,oBAAoB,CAAC,CAAC,CAAC;;;;iBACtE,CAAC,CAAC;YAEH,EAAE,CAAC,uDAAuD,EAAE;;;;;4BACxD,YAAY,CAAC,SAAS,CAAC,GAAG,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;4BAElB,qBAAM,gBAAM,CAAC,IAAI,CACnC,YAAY,EAAE,QAAQ,EAAE,MAAM,CACjC,EAAA;;4BAFK,aAAa,GAAG,SAErB;4BAED,aAAM,CAAC,YAAY,CAAC,SAAS,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC,EAAE,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;4BACzD,aAAM,CAAC,YAAY,CAAC,SAAS,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC;gCAC7D,aAAa;gCACb;oCACI,KAAK,EAAE;wCACH,CAAC,4BAA4B,EAAE,IAAI,EAAE,MAAM,CAAC;wCAC5C,CAAC,iBAAiB,EAAE,YAAY,EAAE,QAAQ,CAAC;qCAC9C;oCACH,OAAO,EAAE,CAAC,CAAC,iBAAiB,EAAE,KAAK,CAAC,CAAC;iCACtC;6BACJ,CAAC,CAAC;4BAEH,aAAM,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;;;;iBAC3C,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;IACP,CAAC,CAAC,CAAC;AACP,CAAC,CAAC,CAAC"}
|
|
@@ -57,7 +57,9 @@ function signStateTransition(platform, stateTransition, identity, keyIndex) {
|
|
|
57
57
|
case 1:
|
|
58
58
|
account = _a.sent();
|
|
59
59
|
privateKey = account.identities.getIdentityHDKeyById(identity.getId().toString(), keyIndex).privateKey;
|
|
60
|
-
stateTransition.sign(identity.getPublicKeyById(keyIndex), privateKey);
|
|
60
|
+
return [4 /*yield*/, stateTransition.sign(identity.getPublicKeyById(keyIndex), privateKey)];
|
|
61
|
+
case 2:
|
|
62
|
+
_a.sent();
|
|
61
63
|
return [2 /*return*/, stateTransition];
|
|
62
64
|
}
|
|
63
65
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"signStateTransition.js","sourceRoot":"","sources":["../../../../../src/SDK/Client/Platform/signStateTransition.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;;;;;;;GAOG;AACH,SAAsB,mBAAmB,CAAC,QAAkB,EAAE,eAAoB,EAAE,QAAa,EAAE,QAAoB;IAApB,yBAAA,EAAA,YAAoB;;;;;;oBAC3G,MAAM,GAAK,QAAQ,OAAb,CAAc;oBAEZ,qBAAM,MAAM,CAAC,gBAAgB,EAAE,EAAA;;oBAAzC,OAAO,GAAG,SAA+B;oBAGvC,UAAU,GAAK,OAAO,CAAC,UAAU,CAAC,oBAAoB,CAC1D,QAAQ,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE,EAC3B,QAAQ,CACX,WAHiB,CAGhB;oBAEF,eAAe,CAAC,IAAI,
|
|
1
|
+
{"version":3,"file":"signStateTransition.js","sourceRoot":"","sources":["../../../../../src/SDK/Client/Platform/signStateTransition.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEA;;;;;;;GAOG;AACH,SAAsB,mBAAmB,CAAC,QAAkB,EAAE,eAAoB,EAAE,QAAa,EAAE,QAAoB;IAApB,yBAAA,EAAA,YAAoB;;;;;;oBAC3G,MAAM,GAAK,QAAQ,OAAb,CAAc;oBAEZ,qBAAM,MAAM,CAAC,gBAAgB,EAAE,EAAA;;oBAAzC,OAAO,GAAG,SAA+B;oBAGvC,UAAU,GAAK,OAAO,CAAC,UAAU,CAAC,oBAAoB,CAC1D,QAAQ,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE,EAC3B,QAAQ,CACX,WAHiB,CAGhB;oBAEF,qBAAM,eAAe,CAAC,IAAI,CACtB,QAAQ,CAAC,gBAAgB,CAAC,QAAQ,CAAC,EACnC,UAAU,CACb,EAAA;;oBAHD,SAGC,CAAC;oBAEF,sBAAO,eAAe,EAAC;;;;CAC1B;AAjBD,kDAiBC"}
|
|
@@ -10,6 +10,17 @@ dotenvSafe.config({
|
|
|
10
10
|
});
|
|
11
11
|
use(dirtyChai);
|
|
12
12
|
use(sinonChai);
|
|
13
|
+
before(function before() {
|
|
14
|
+
if (!this.sinon) {
|
|
15
|
+
this.sinon = sinon.createSandbox();
|
|
16
|
+
}
|
|
17
|
+
else {
|
|
18
|
+
this.sinon.restore();
|
|
19
|
+
}
|
|
20
|
+
});
|
|
21
|
+
after(function after() {
|
|
22
|
+
this.sinon.restore();
|
|
23
|
+
});
|
|
13
24
|
beforeEach(function beforeEach() {
|
|
14
25
|
if (!this.sinon) {
|
|
15
26
|
this.sinon = sinon.createSandbox();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../../../src/test/bootstrap.js"],"names":[],"mappings":";AAAA,IAAM,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AAC1C,IAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAE7B,IAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAC/B,IAAM,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;AAClC,IAAA,KAAkB,OAAO,CAAC,MAAM,CAAC,EAA/B,MAAM,YAAA,EAAE,GAAG,SAAoB,CAAC;AACxC,IAAM,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;AAExC,UAAU,CAAC,MAAM,CAAC;IAChB,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC;CAClD,CAAC,CAAC;AAEH,GAAG,CAAC,SAAS,CAAC,CAAC;AACf,GAAG,CAAC,SAAS,CAAC,CAAC;AAEf,UAAU,CAAC,SAAS,UAAU;IAC5B,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;QACf,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,aAAa,EAAE,CAAC;KACpC;SAAM;QACL,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;KACtB;AACH,CAAC,CAAC,CAAC;AAEH,SAAS,CAAC,SAAS,SAAS;IAC1B,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;AACvB,CAAC,CAAC,CAAC"}
|
|
1
|
+
{"version":3,"file":"bootstrap.js","sourceRoot":"","sources":["../../../src/test/bootstrap.js"],"names":[],"mappings":";AAAA,IAAM,UAAU,GAAG,OAAO,CAAC,aAAa,CAAC,CAAC;AAC1C,IAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;AAE7B,IAAM,KAAK,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;AAC/B,IAAM,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;AAClC,IAAA,KAAkB,OAAO,CAAC,MAAM,CAAC,EAA/B,MAAM,YAAA,EAAE,GAAG,SAAoB,CAAC;AACxC,IAAM,SAAS,GAAG,OAAO,CAAC,YAAY,CAAC,CAAC;AAExC,UAAU,CAAC,MAAM,CAAC;IAChB,IAAI,EAAE,IAAI,CAAC,OAAO,CAAC,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,MAAM,CAAC;CAClD,CAAC,CAAC;AAEH,GAAG,CAAC,SAAS,CAAC,CAAC;AACf,GAAG,CAAC,SAAS,CAAC,CAAC;AAEf,MAAM,CAAC,SAAS,MAAM;IACpB,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;QACf,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,aAAa,EAAE,CAAC;KACpC;SAAM;QACL,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;KACtB;AACH,CAAC,CAAC,CAAC;AAGH,KAAK,CAAC,SAAS,KAAK;IAClB,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;AACvB,CAAC,CAAC,CAAC;AAEH,UAAU,CAAC,SAAS,UAAU;IAC5B,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE;QACf,IAAI,CAAC,KAAK,GAAG,KAAK,CAAC,aAAa,EAAE,CAAC;KACpC;SAAM;QACL,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;KACtB;AACH,CAAC,CAAC,CAAC;AAEH,SAAS,CAAC,SAAS,SAAS;IAC1B,IAAI,CAAC,KAAK,CAAC,OAAO,EAAE,CAAC;AACvB,CAAC,CAAC,CAAC"}
|
|
@@ -15,6 +15,8 @@ function createIdentityFixtureInAccount(account) {
|
|
|
15
15
|
id: 0,
|
|
16
16
|
type: IdentityPublicKey_1.default.TYPES.ECDSA_SECP256K1,
|
|
17
17
|
data: identityPrivateKey.toPublicKey().toBuffer(),
|
|
18
|
+
purpose: IdentityPublicKey_1.default.PURPOSES.AUTHENTICATION,
|
|
19
|
+
securityLevel: IdentityPublicKey_1.default.SECURITY_LEVELS.MASTER
|
|
18
20
|
});
|
|
19
21
|
account.storage.insertIdentityIdAtIndex(account.walletId, identityFixture.getId().toString(), identityFixtureIndex);
|
|
20
22
|
return identityFixture;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createIdentityFixtureInAccount.js","sourceRoot":"","sources":["../../../../src/test/fixtures/createIdentityFixtureInAccount.ts"],"names":[],"mappings":";;;;;;AAAA,kGAA4E;AAC5E,aAAa;AACb,IAAM,kBAAkB,GAAG,OAAO,CAAC,mDAAmD,CAAC,CAAC;AAExF,SAAgB,8BAA8B,CAAC,OAAO;IAClD,IAAM,eAAe,GAAG,kBAAkB,EAAE,CAAC;IAC7C,IAAM,oBAAoB,GAAG,KAAK,CAAC;IAC3B,IAAY,kBAAkB,GAAK,OAAO,CAAC,UAAU,CAAC,uBAAuB,CAAC,oBAAoB,EAAE,CAAC,CAAC,WAAxE,CAAyE;IAE/G,eAAe,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,IAAI,2BAAiB,CAAC;QAClD,EAAE,EAAE,CAAC;QACL,IAAI,EAAE,2BAAiB,CAAC,KAAK,CAAC,eAAe;QAC7C,IAAI,EAAE,kBAAkB,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE;
|
|
1
|
+
{"version":3,"file":"createIdentityFixtureInAccount.js","sourceRoot":"","sources":["../../../../src/test/fixtures/createIdentityFixtureInAccount.ts"],"names":[],"mappings":";;;;;;AAAA,kGAA4E;AAC5E,aAAa;AACb,IAAM,kBAAkB,GAAG,OAAO,CAAC,mDAAmD,CAAC,CAAC;AAExF,SAAgB,8BAA8B,CAAC,OAAO;IAClD,IAAM,eAAe,GAAG,kBAAkB,EAAE,CAAC;IAC7C,IAAM,oBAAoB,GAAG,KAAK,CAAC;IAC3B,IAAY,kBAAkB,GAAK,OAAO,CAAC,UAAU,CAAC,uBAAuB,CAAC,oBAAoB,EAAE,CAAC,CAAC,WAAxE,CAAyE;IAE/G,eAAe,CAAC,UAAU,CAAC,CAAC,CAAC,GAAG,IAAI,2BAAiB,CAAC;QAClD,EAAE,EAAE,CAAC;QACL,IAAI,EAAE,2BAAiB,CAAC,KAAK,CAAC,eAAe;QAC7C,IAAI,EAAE,kBAAkB,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE;QACjD,OAAO,EAAE,2BAAiB,CAAC,QAAQ,CAAC,cAAc;QAClD,aAAa,EAAE,2BAAiB,CAAC,eAAe,CAAC,MAAM;KAC1D,CAAC,CAAC;IAEH,OAAO,CAAC,OAAO,CAAC,uBAAuB,CACnC,OAAO,CAAC,QAAQ,EAChB,eAAe,CAAC,KAAK,EAAE,CAAC,QAAQ,EAAE,EAClC,oBAAoB,CACvB,CAAC;IAEF,OAAO,eAAe,CAAC;AAC3B,CAAC;AApBD,wEAoBC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import DashPlatformProtocol from "@dashevo/dpp";
|
|
2
2
|
import Client from "../Client";
|
|
3
|
-
import {
|
|
3
|
+
import { IStateTransitionResult } from './IStateTransitionResult';
|
|
4
4
|
/**
|
|
5
5
|
* Interface for PlatformOpts
|
|
6
6
|
*
|
|
@@ -39,6 +39,12 @@ interface Identities {
|
|
|
39
39
|
register: Function;
|
|
40
40
|
topUp: Function;
|
|
41
41
|
}
|
|
42
|
+
interface DataContracts {
|
|
43
|
+
update: Function;
|
|
44
|
+
publish: Function;
|
|
45
|
+
create: Function;
|
|
46
|
+
get: Function;
|
|
47
|
+
}
|
|
42
48
|
/**
|
|
43
49
|
* Class for Dash Platform
|
|
44
50
|
*
|
|
@@ -65,12 +71,12 @@ export declare class Platform {
|
|
|
65
71
|
* @param {Function} create - create contracts which can be broadcasted
|
|
66
72
|
* @param {Function} register - register contracts on the platform
|
|
67
73
|
*/
|
|
68
|
-
contracts:
|
|
74
|
+
contracts: DataContracts;
|
|
69
75
|
/**
|
|
70
76
|
* Broadcasts state transition
|
|
71
77
|
* @param {Object} stateTransition
|
|
72
78
|
*/
|
|
73
|
-
broadcastStateTransition(stateTransition: any): Promise<
|
|
79
|
+
broadcastStateTransition(stateTransition: any): Promise<IStateTransitionResult | void>;
|
|
74
80
|
client: Client;
|
|
75
81
|
private static readonly networkToProtocolVersion;
|
|
76
82
|
/**
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Platform } from "./Platform";
|
|
2
|
-
import {
|
|
2
|
+
import { IStateTransitionResult } from "./IStateTransitionResult";
|
|
3
3
|
/**
|
|
4
4
|
* @param {Platform} platform
|
|
5
5
|
* @param stateTransition
|
|
6
6
|
*/
|
|
7
|
-
export default function broadcastStateTransition(platform: Platform, stateTransition: any): Promise<
|
|
7
|
+
export default function broadcastStateTransition(platform: Platform, stateTransition: any): Promise<IStateTransitionResult | void>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Platform } from "../../Platform";
|
|
2
|
+
/**
|
|
3
|
+
* Publish contract onto the platform
|
|
4
|
+
*
|
|
5
|
+
* @param {Platform} this - bound instance class
|
|
6
|
+
* @param dataContract - contract
|
|
7
|
+
* @param identity - identity
|
|
8
|
+
* @return {DataContractCreateTransition}
|
|
9
|
+
*/
|
|
10
|
+
export default function publish(this: Platform, dataContract: any, identity: any): Promise<any>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { Platform } from "../../Platform";
|
|
2
|
+
/**
|
|
3
|
+
* Publish contract onto the platform
|
|
4
|
+
*
|
|
5
|
+
* @param {Platform} this - bound instance class
|
|
6
|
+
* @param {DataContract} dataContract - contract
|
|
7
|
+
* @param identity - identity
|
|
8
|
+
* @return {DataContractUpdateTransition}
|
|
9
|
+
*/
|
|
10
|
+
export default function update(this: Platform, dataContract: any, identity: any): Promise<any>;
|
|
@@ -1,17 +1,20 @@
|
|
|
1
|
+
/// <reference types="node" />
|
|
2
|
+
import Identifier from '@dashevo/dpp/lib/Identifier';
|
|
3
|
+
import Document from '@dashevo/dpp/lib/document/Document';
|
|
1
4
|
import { Platform } from "../../Platform";
|
|
2
5
|
/**
|
|
3
6
|
* @param {WhereCondition[]} [where] - where
|
|
4
7
|
* @param {OrderByCondition[]} [orderBy] - order by
|
|
5
8
|
* @param {number} [limit] - limit
|
|
6
|
-
* @param {
|
|
7
|
-
* @param {
|
|
9
|
+
* @param {string|Buffer|Document|Identifier} [startAt] - start value (included)
|
|
10
|
+
* @param {string|Buffer|Document|Identifier} [startAfter] - start value (not included)
|
|
8
11
|
*/
|
|
9
12
|
declare interface fetchOpts {
|
|
10
13
|
where?: WhereCondition[];
|
|
11
14
|
orderBy?: OrderByCondition[];
|
|
12
15
|
limit?: number;
|
|
13
|
-
startAt?:
|
|
14
|
-
startAfter?:
|
|
16
|
+
startAt?: string | Buffer | Document | Identifier;
|
|
17
|
+
startAfter?: string | Buffer | Document | Identifier;
|
|
15
18
|
}
|
|
16
19
|
declare type OrderByCondition = [string, 'asc' | 'desc'];
|
|
17
20
|
declare type WhereCondition = [string, '<' | '<=' | '==' | '>' | '>=' | 'in' | 'startsWith' | 'elementMatch' | 'length' | 'contains', WhereCondition | any];
|
package/docs/_sidebar.md
CHANGED
|
@@ -5,32 +5,33 @@
|
|
|
5
5
|
- [Dash Platform Applications](getting-started/dash-platform-applications.md)
|
|
6
6
|
- [About Schemas](getting-started/about-schemas.md)
|
|
7
7
|
- [With TypeScript](getting-started/with-typescript.md)
|
|
8
|
-
|
|
9
|
-
- Examples
|
|
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
|
|
16
|
-
- [
|
|
17
|
-
- [
|
|
18
|
-
|
|
8
|
+
|
|
9
|
+
- Examples
|
|
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 new contract](/examples/publishing-a-new-contract.md)
|
|
16
|
+
- [Updating an existing contract](/examples/updating-a-contract.md)
|
|
17
|
+
- [Use another BIP44 account](/examples/use-different-account.md)
|
|
18
|
+
- [Sign and verify messages](/examples/sign-and-verify-messages.md)
|
|
19
|
+
|
|
19
20
|
- Tutorial
|
|
20
21
|
- [Register an identity](https://dashplatform.readme.io/docs/tutorial-register-an-identity)
|
|
21
22
|
- [Register a Name for an Identity](https://dashplatform.readme.io/docs/tutorial-register-a-name-for-an-identity)
|
|
22
23
|
|
|
23
|
-
- Snippets
|
|
24
|
+
- Snippets
|
|
24
25
|
- [Create and fund wallet](https://github.com/dashevo/DashJS/tree/master/examples/node/create-and-fund-wallet.js)
|
|
25
26
|
- [Register identity](https://github.com/dashevo/DashJS/tree/master/examples/node/register-identity.js)
|
|
26
27
|
- [Register name](https://github.com/dashevo/DashJS/tree/master/examples/node/register-name.js)
|
|
27
28
|
- [Retrieve Contract](https://github.com/dashevo/DashJS/tree/master/examples/node/retrieve-contract.js)
|
|
28
29
|
- [Retrieve Documents](https://github.com/dashevo/DashJS/tree/master/examples/node/retrieve-documents.js)
|
|
29
30
|
- [Retrieve Identity](https://github.com/dashevo/DashJS/tree/master/examples/node/retrieve-identity.js)
|
|
30
|
-
- [Retrieve Name](https://github.com/dashevo/DashJS/tree/master/examples/node/retrieve-name.js)
|
|
31
|
-
|
|
32
|
-
- Usage
|
|
33
|
-
- [DAPI](usage/dapi.md)
|
|
31
|
+
- [Retrieve Name](https://github.com/dashevo/DashJS/tree/master/examples/node/retrieve-name.js)
|
|
32
|
+
|
|
33
|
+
- Usage
|
|
34
|
+
- [DAPI](usage/dapi.md)
|
|
34
35
|
- [Platform](platform/about-platform.md)
|
|
35
36
|
- [About platform](platform/about-platform.md)
|
|
36
37
|
- **Identities**
|
|
@@ -42,7 +43,8 @@
|
|
|
42
43
|
- [About contracts](platform/contracts/about-contracts.md)
|
|
43
44
|
- [`.get()`](platform/contracts/get.md)
|
|
44
45
|
- [`.create()`](platform/contracts/create.md)
|
|
45
|
-
- [`.
|
|
46
|
+
- [`.publish()`](platform/contracts/publish.md)
|
|
47
|
+
- [`.update()`](platform/contracts/update.md)
|
|
46
48
|
- **Documents**
|
|
47
49
|
- [About documents](platform/documents/about-documents.md)
|
|
48
50
|
- [`.get()`](platform/documents/get.md)
|
|
@@ -4,10 +4,10 @@ Right now, Evonet does not support publishing a public contract. You will have t
|
|
|
4
4
|
|
|
5
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
|
-
## Create your contract
|
|
7
|
+
## Create your contract
|
|
8
8
|
|
|
9
|
-
After having [registered an identity](https://dashplatform.readme.io/docs/tutorial-register-an-identity)
|
|
10
|
-
and [attached to a name](https://dashplatform.readme.io/docs/tutorial-register-a-name-for-an-identity) crafted your schema (you can see how on [about schemas](getting-started/about-schemas.md) and read the [DPNS schema](https://github.com/dashevo/dpns-contract/blob/v0.2-dev/src/schema/dpns-documents.json) as an example), you then can perform the below actions :
|
|
9
|
+
After having [registered an identity](https://dashplatform.readme.io/docs/tutorial-register-an-identity)
|
|
10
|
+
and [attached to a name](https://dashplatform.readme.io/docs/tutorial-register-a-name-for-an-identity) crafted your schema (you can see how on [about schemas](getting-started/about-schemas.md) and read the [DPNS schema](https://github.com/dashevo/dpns-contract/blob/v0.2-dev/src/schema/dpns-documents.json) as an example), you then can perform the below actions :
|
|
11
11
|
|
|
12
12
|
```js
|
|
13
13
|
const schema = {};// You JSON schema defining the app.
|
|
@@ -31,11 +31,11 @@ async function registerContract() {
|
|
|
31
31
|
const {platform} = client;
|
|
32
32
|
const identity = await getIdentity(appName);
|
|
33
33
|
const contract = platform.contracts.create(schema, identity)
|
|
34
|
-
const contractId = await platform.contracts.
|
|
34
|
+
const contractId = await platform.contracts.publish(contract, identity);
|
|
35
35
|
}
|
|
36
36
|
```
|
|
37
37
|
|
|
38
|
-
## Fetch or publish documents on your app
|
|
38
|
+
## Fetch or publish documents on your app
|
|
39
39
|
|
|
40
40
|
```js
|
|
41
41
|
const schema = {};// You JSON schema defining the app.
|
|
@@ -47,7 +47,7 @@ const client = new Dash.Client({
|
|
|
47
47
|
},
|
|
48
48
|
apps:{
|
|
49
49
|
myapp:{
|
|
50
|
-
contractId:""// The registered contract id
|
|
50
|
+
contractId:""// The registered contract id
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
});
|
|
@@ -11,4 +11,4 @@ const signed = account.sign(message, pk);
|
|
|
11
11
|
const verify = message.verify(pk.toAddress().toString(), signed.toString());
|
|
12
12
|
```
|
|
13
13
|
|
|
14
|
-
See [code snippet](https://github.com/dashevo/
|
|
14
|
+
See [code snippet](https://github.com/dashevo/platform/blob/master/packages/js-dash-sdk/examples/node/sign-and-verify-messages.js).
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
## Updating an existing contract
|
|
2
|
+
|
|
3
|
+
To update your existing data contract you have to follow these steps:
|
|
4
|
+
|
|
5
|
+
### Fetch your exising contract
|
|
6
|
+
|
|
7
|
+
```js
|
|
8
|
+
const schema = {};// You JSON schema defining the app.
|
|
9
|
+
const client = new Dash.Client({
|
|
10
|
+
wallet: {
|
|
11
|
+
mnemonic: '', // Your app mnemonic, which holds the identity
|
|
12
|
+
},
|
|
13
|
+
});
|
|
14
|
+
|
|
15
|
+
const exisingContractId = ''; // Your existing data contract id
|
|
16
|
+
|
|
17
|
+
const existingDataContract = await client.platform.contracts.get(exisingContractId);
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
### Update document definitions
|
|
21
|
+
|
|
22
|
+
```js
|
|
23
|
+
// Update an existing document
|
|
24
|
+
const documentDefinition = existingDataContract.getDocumentDefinition('myDocumentType');
|
|
25
|
+
|
|
26
|
+
// adding optional field
|
|
27
|
+
documentDefinition.properties.newField = {
|
|
28
|
+
type: 'integer',
|
|
29
|
+
minimum: 1,
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
existingDataContract.setDocumentDefinition('myDocumentType', documentDefinition);
|
|
33
|
+
|
|
34
|
+
// ... or, add a new one
|
|
35
|
+
const newDocumentDefinition = {
|
|
36
|
+
type: 'object',
|
|
37
|
+
properties: {
|
|
38
|
+
someField: {
|
|
39
|
+
type: 'integer',
|
|
40
|
+
minimum: 42,
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
required: ['someField'],
|
|
44
|
+
};
|
|
45
|
+
|
|
46
|
+
existingDataContract.setDocumentDefinition('myNewDocument', newDocumentDefinition);
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Broadcast your changes
|
|
50
|
+
|
|
51
|
+
```js
|
|
52
|
+
await client.platform.contracts.update(existingDataContract, yourExistingIdentity);
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
**Note, that update will be only allowed if schema is backward compatible. Also, version incremented by 1 and only one of following fields updated: `$defs`, `documents` or `version`**
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
**Usage**: `client.platform.contracts.
|
|
2
|
-
**Description**: This method will sign and broadcast any valid contract.
|
|
1
|
+
**Usage**: `client.platform.contracts.publish(contract, identity)`
|
|
2
|
+
**Description**: This method will sign and broadcast any valid contract.
|
|
3
3
|
|
|
4
|
-
Parameters:
|
|
4
|
+
Parameters:
|
|
5
5
|
|
|
6
|
-
| parameters | type | required | Description |
|
|
6
|
+
| parameters | type | required | Description |
|
|
7
7
|
|---------------------------|-----------|----------------| ------------------------------------------------------------------------------|
|
|
8
8
|
| **contract** | Contract | yes | A valid [created contract](../contracts/create.md) |
|
|
9
9
|
| **identity** | Identity | yes | A valid [registered `application` identity](../identities/register.md) |
|
|
@@ -14,7 +14,7 @@ const identityId = '';// Your identity identifier.
|
|
|
14
14
|
const identity = await client.platform.identities.get(identityId);
|
|
15
15
|
// See the contract.create documentation for more on how to create a dataContract
|
|
16
16
|
const contract = await client.platform.contracts.create(contractDefinitions, identity);
|
|
17
|
-
await platform.contracts.
|
|
17
|
+
await platform.contracts.publish(contract, identity);
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
Returns :
|
|
20
|
+
Returns : DataContractCreateTransition.
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
**Usage**: `client.platform.contracts.update(contract, identity)`
|
|
2
|
+
**Description**: This method will sign and broadcast an updated valid contract.
|
|
3
|
+
|
|
4
|
+
Parameters:
|
|
5
|
+
|
|
6
|
+
| parameters | type | required | Description |
|
|
7
|
+
|---------------------------|-----------|----------------| ------------------------------------------------------------------------------|
|
|
8
|
+
| **contract** | Contract | yes | A valid [created contract](/platform/contracts/create.md) |
|
|
9
|
+
| **identity** | Identity | yes | A valid [registered `application` identity](/platform/identities/register.md) |
|
|
10
|
+
|
|
11
|
+
**Example**:
|
|
12
|
+
You may check [following document](/examples/updating-a-contract.md) for an example on how to update a contract.
|
|
13
|
+
|
|
14
|
+
Returns : DataContractUpdateTransition.
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
**Usage**: `client.platform.identities.topUp(identity, amount)`
|
|
2
2
|
**Description**: This method will topup the provided identity's balance.
|
|
3
3
|
|
|
4
|
+
_The identity balance might slightly vary from the topped up amount because of the transaction fee estimation._
|
|
5
|
+
|
|
4
6
|
Parameters:
|
|
5
7
|
|
|
6
8
|
| parameters | type | required | Description |
|
|
@@ -4,4 +4,4 @@ When Dash.Client is initiated with a `mnemonic` property, a wallet instance is a
|
|
|
4
4
|
|
|
5
5
|
In order to ensure the sync-up with the network has happened, you will need to wait for the method `client.isReady()` to resolve.
|
|
6
6
|
|
|
7
|
-
You will find else where the [complete documentation of Wallet-lib](https://github.com/dashevo/wallet-lib), as we only cover the most basic pieces in this documentation.
|
|
7
|
+
You will find else where the [complete documentation of Wallet-lib](https://github.com/dashevo/platform/tree/master/packages/wallet-lib), as we only cover the most basic pieces in this documentation.
|
|
@@ -28,7 +28,7 @@ const registerContract = async function () {
|
|
|
28
28
|
|
|
29
29
|
const contract = await platform.contracts.create(contractDocuments, identity);
|
|
30
30
|
await platform.dpp.dataContract.validate(contract)
|
|
31
|
-
await platform.contracts.
|
|
31
|
+
await platform.contracts.publish(contract, identity);
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
registerContract();
|
package/examples/schema.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dash",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.22.0-dev.10",
|
|
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",
|
|
@@ -34,11 +34,14 @@
|
|
|
34
34
|
},
|
|
35
35
|
"homepage": "https://github.com/dashevo/DashJS#readme",
|
|
36
36
|
"dependencies": {
|
|
37
|
-
"@dashevo/dapi-client": "~0.
|
|
38
|
-
"@dashevo/dashcore-lib": "~0.19.
|
|
39
|
-
"@dashevo/
|
|
40
|
-
"@dashevo/
|
|
41
|
-
"@dashevo/
|
|
37
|
+
"@dashevo/dapi-client": "~0.22.0-dev.10",
|
|
38
|
+
"@dashevo/dashcore-lib": "~0.19.30",
|
|
39
|
+
"@dashevo/dashpay-contract": "~0.22.0-dev.10",
|
|
40
|
+
"@dashevo/dpns-contract": "~0.22.0-dev.10",
|
|
41
|
+
"@dashevo/dpp": "~0.22.0-dev.10",
|
|
42
|
+
"@dashevo/grpc-common": "~0.22.0-dev.10",
|
|
43
|
+
"@dashevo/masternode-reward-shares-contract": "~0.22.0-dev.10",
|
|
44
|
+
"@dashevo/wallet-lib": "~7.22.0-dev.10",
|
|
42
45
|
"bs58": "^4.0.1",
|
|
43
46
|
"node-inspect-extracted": "^1.0.8"
|
|
44
47
|
},
|
|
@@ -269,7 +269,7 @@ describe('Dash - Client', function suite() {
|
|
|
269
269
|
const interceptedSt = await client.platform.dpp.stateTransition.createFromBuffer(serializedSt);
|
|
270
270
|
|
|
271
271
|
// .to.be.true() doesn't work after TS compilation in Chrome
|
|
272
|
-
expect(interceptedSt.verifySignature(identityFixture.getPublicKeyById(0))).to.be.equal(true);
|
|
272
|
+
expect(await interceptedSt.verifySignature(identityFixture.getPublicKeyById(0))).to.be.equal(true);
|
|
273
273
|
|
|
274
274
|
const documentTransitions = interceptedSt.getTransitions();
|
|
275
275
|
|
|
@@ -278,7 +278,7 @@ describe('Dash - Client', function suite() {
|
|
|
278
278
|
});
|
|
279
279
|
});
|
|
280
280
|
|
|
281
|
-
describe('#platform.contracts.
|
|
281
|
+
describe('#platform.contracts.publish', () => {
|
|
282
282
|
it('should throw TransitionBroadcastError when transport resolves error', async () => {
|
|
283
283
|
const errorResponse = {
|
|
284
284
|
error: {
|
|
@@ -292,7 +292,7 @@ describe('Dash - Client', function suite() {
|
|
|
292
292
|
|
|
293
293
|
let error;
|
|
294
294
|
try {
|
|
295
|
-
await client.platform.contracts.
|
|
295
|
+
await client.platform.contracts.publish(dataContractFixture, identityFixture);
|
|
296
296
|
} catch (e) {
|
|
297
297
|
error = e;
|
|
298
298
|
}
|
|
@@ -307,13 +307,13 @@ describe('Dash - Client', function suite() {
|
|
|
307
307
|
proof: { }
|
|
308
308
|
});
|
|
309
309
|
|
|
310
|
-
await client.platform.contracts.
|
|
310
|
+
await client.platform.contracts.publish(dataContractFixture, identityFixture);
|
|
311
311
|
|
|
312
312
|
const serializedSt = dapiClientMock.platform.broadcastStateTransition.getCall(0).args[0];
|
|
313
313
|
const interceptedSt = await client.platform.dpp.stateTransition.createFromBuffer(serializedSt);
|
|
314
314
|
|
|
315
315
|
// .to.be.true() doesn't work after TS compilation in Chrome
|
|
316
|
-
expect(interceptedSt.verifySignature(identityFixture.getPublicKeyById(0))).to.be.equal(true);
|
|
316
|
+
expect(await interceptedSt.verifySignature(identityFixture.getPublicKeyById(0))).to.be.equal(true);
|
|
317
317
|
expect(interceptedSt.getEntropy()).to.be.deep.equal(dataContractFixture.entropy);
|
|
318
318
|
expect(interceptedSt.getDataContract().toObject()).to.be.deep.equal(dataContractFixture.toObject());
|
|
319
319
|
});
|
package/src/SDK/Client/Client.ts
CHANGED
|
@@ -4,6 +4,9 @@ import DAPIClientTransport from "@dashevo/wallet-lib/src/transport/DAPIClientTra
|
|
|
4
4
|
import { Platform } from './Platform';
|
|
5
5
|
import { Network } from "@dashevo/dashcore-lib";
|
|
6
6
|
import DAPIClient from "@dashevo/dapi-client";
|
|
7
|
+
import { contractId as dpnsContractId } from "@dashevo/dpns-contract/lib/systemIds";
|
|
8
|
+
import { contractId as dashpayContractId } from "@dashevo/dashpay-contract/lib/systemIds";
|
|
9
|
+
import { contractId as masternodeRewardSharesContractId } from "@dashevo/masternode-reward-shares-contract/lib/systemIds";
|
|
7
10
|
import { ClientApps, ClientAppsOptions } from "./ClientApps";
|
|
8
11
|
|
|
9
12
|
export interface WalletOptions extends Wallet.IWalletOptions {
|
|
@@ -107,11 +110,14 @@ export class Client extends EventEmitter {
|
|
|
107
110
|
|
|
108
111
|
this.apps = new ClientApps(Object.assign({
|
|
109
112
|
dpns: {
|
|
110
|
-
contractId:
|
|
113
|
+
contractId: dpnsContractId,
|
|
111
114
|
},
|
|
112
115
|
dashpay: {
|
|
113
|
-
contractId:
|
|
116
|
+
contractId: dashpayContractId,
|
|
114
117
|
},
|
|
118
|
+
masternodeRewardShares: {
|
|
119
|
+
contractId: masternodeRewardSharesContractId,
|
|
120
|
+
}
|
|
115
121
|
}, this.options.apps));
|
|
116
122
|
|
|
117
123
|
this.platform = new Platform({
|