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
|
@@ -2,12 +2,14 @@
|
|
|
2
2
|
import DashPlatformProtocol from "@dashevo/dpp";
|
|
3
3
|
|
|
4
4
|
import Client from "../Client";
|
|
5
|
+
import { IStateTransitionResult } from './IStateTransitionResult';
|
|
5
6
|
|
|
6
7
|
import broadcastDocument from "./methods/documents/broadcast";
|
|
7
8
|
import createDocument from "./methods/documents/create";
|
|
8
9
|
import getDocument from "./methods/documents/get";
|
|
9
10
|
|
|
10
|
-
import
|
|
11
|
+
import publishContract from "./methods/contracts/publish";
|
|
12
|
+
import updateContract from "./methods/contracts/update";
|
|
11
13
|
import createContract from "./methods/contracts/create";
|
|
12
14
|
import getContract from "./methods/contracts/get";
|
|
13
15
|
|
|
@@ -20,7 +22,6 @@ import resolveName from "./methods/names/resolve";
|
|
|
20
22
|
import resolveNameByRecord from "./methods/names/resolveByRecord";
|
|
21
23
|
import searchName from "./methods/names/search";
|
|
22
24
|
import broadcastStateTransition from "./broadcastStateTransition";
|
|
23
|
-
import { IPlatformStateProof } from "./IPlatformStateProof";
|
|
24
25
|
import StateRepository from './StateRepository';
|
|
25
26
|
import { latestVersion as latestProtocolVersion } from "@dashevo/dpp/lib/version/protocolVersion";
|
|
26
27
|
|
|
@@ -66,6 +67,13 @@ interface Identities {
|
|
|
66
67
|
topUp: Function,
|
|
67
68
|
}
|
|
68
69
|
|
|
70
|
+
interface DataContracts {
|
|
71
|
+
update: Function,
|
|
72
|
+
publish: Function,
|
|
73
|
+
create: Function,
|
|
74
|
+
get: Function,
|
|
75
|
+
}
|
|
76
|
+
|
|
69
77
|
/**
|
|
70
78
|
* Class for Dash Platform
|
|
71
79
|
*
|
|
@@ -93,13 +101,13 @@ export class Platform {
|
|
|
93
101
|
* @param {Function} create - create contracts which can be broadcasted
|
|
94
102
|
* @param {Function} register - register contracts on the platform
|
|
95
103
|
*/
|
|
96
|
-
public contracts:
|
|
104
|
+
public contracts: DataContracts;
|
|
97
105
|
|
|
98
106
|
/**
|
|
99
107
|
* Broadcasts state transition
|
|
100
108
|
* @param {Object} stateTransition
|
|
101
109
|
*/
|
|
102
|
-
public broadcastStateTransition(stateTransition: any): Promise<
|
|
110
|
+
public broadcastStateTransition(stateTransition: any): Promise<IStateTransitionResult|void> {
|
|
103
111
|
return broadcastStateTransition(this, stateTransition);
|
|
104
112
|
};
|
|
105
113
|
|
|
@@ -121,7 +129,8 @@ export class Platform {
|
|
|
121
129
|
get: getDocument.bind(this),
|
|
122
130
|
};
|
|
123
131
|
this.contracts = {
|
|
124
|
-
|
|
132
|
+
publish: publishContract.bind(this),
|
|
133
|
+
update: updateContract.bind(this),
|
|
125
134
|
create: createContract.bind(this),
|
|
126
135
|
get: getContract.bind(this),
|
|
127
136
|
};
|
|
@@ -2,7 +2,6 @@ import crypto from "crypto";
|
|
|
2
2
|
import { Platform } from "./Platform";
|
|
3
3
|
import { StateTransitionBroadcastError } from "../../../errors/StateTransitionBroadcastError";
|
|
4
4
|
import { IStateTransitionResult } from "./IStateTransitionResult";
|
|
5
|
-
import { IPlatformStateProof } from "./IPlatformStateProof";
|
|
6
5
|
|
|
7
6
|
const ResponseError = require('@dashevo/dapi-client/lib/transport/errors/response/ResponseError');
|
|
8
7
|
const InvalidRequestDPPError = require('@dashevo/dapi-client/lib/transport/errors/response/InvalidRequestDPPError');
|
|
@@ -15,7 +14,7 @@ const GrpcError = require('@dashevo/grpc-common/lib/server/error/GrpcError');
|
|
|
15
14
|
* @param {Platform} platform
|
|
16
15
|
* @param stateTransition
|
|
17
16
|
*/
|
|
18
|
-
export default async function broadcastStateTransition(platform: Platform, stateTransition: any): Promise<
|
|
17
|
+
export default async function broadcastStateTransition(platform: Platform, stateTransition: any): Promise<IStateTransitionResult|void> {
|
|
19
18
|
const { client, dpp } = platform;
|
|
20
19
|
|
|
21
20
|
const result = await dpp.stateTransition.validateBasic(stateTransition);
|
|
@@ -83,5 +82,5 @@ export default async function broadcastStateTransition(platform: Platform, state
|
|
|
83
82
|
);
|
|
84
83
|
}
|
|
85
84
|
|
|
86
|
-
return stateTransitionResult
|
|
85
|
+
return stateTransitionResult;
|
|
87
86
|
}
|
|
@@ -3,19 +3,19 @@ import broadcastStateTransition from "../../broadcastStateTransition";
|
|
|
3
3
|
import { signStateTransition } from "../../signStateTransition";
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
|
-
*
|
|
6
|
+
* Publish contract onto the platform
|
|
7
7
|
*
|
|
8
8
|
* @param {Platform} this - bound instance class
|
|
9
9
|
* @param dataContract - contract
|
|
10
10
|
* @param identity - identity
|
|
11
|
-
* @return
|
|
11
|
+
* @return {DataContractCreateTransition}
|
|
12
12
|
*/
|
|
13
|
-
export default async function
|
|
13
|
+
export default async function publish(this: Platform, dataContract: any, identity: any): Promise<any> {
|
|
14
14
|
await this.initialize();
|
|
15
15
|
|
|
16
16
|
const { dpp } = this;
|
|
17
17
|
|
|
18
|
-
const dataContractCreateTransition = dpp.dataContract.
|
|
18
|
+
const dataContractCreateTransition = dpp.dataContract.createDataContractCreateTransition(dataContract);
|
|
19
19
|
|
|
20
20
|
await signStateTransition(this, dataContractCreateTransition, identity);
|
|
21
21
|
await broadcastStateTransition(this, dataContractCreateTransition);
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { Platform } from "../../Platform";
|
|
2
|
+
import broadcastStateTransition from "../../broadcastStateTransition";
|
|
3
|
+
import { signStateTransition } from "../../signStateTransition";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Publish contract onto the platform
|
|
7
|
+
*
|
|
8
|
+
* @param {Platform} this - bound instance class
|
|
9
|
+
* @param {DataContract} dataContract - contract
|
|
10
|
+
* @param identity - identity
|
|
11
|
+
* @return {DataContractUpdateTransition}
|
|
12
|
+
*/
|
|
13
|
+
export default async function update(this: Platform, dataContract: any, identity: any): Promise<any> {
|
|
14
|
+
await this.initialize();
|
|
15
|
+
|
|
16
|
+
const { dpp } = this;
|
|
17
|
+
|
|
18
|
+
// Clone contract
|
|
19
|
+
const updatedDataContract = await this.dpp.dataContract.createFromObject(
|
|
20
|
+
dataContract.toObject(),
|
|
21
|
+
);
|
|
22
|
+
|
|
23
|
+
updatedDataContract.incrementVersion();
|
|
24
|
+
|
|
25
|
+
const dataContractUpdateTransition = dpp.dataContract.createDataContractUpdateTransition(updatedDataContract);
|
|
26
|
+
|
|
27
|
+
await signStateTransition(this, dataContractUpdateTransition, identity);
|
|
28
|
+
await broadcastStateTransition(this, dataContractUpdateTransition);
|
|
29
|
+
|
|
30
|
+
// Update app with updated data contract if available
|
|
31
|
+
for (const appName of this.client.getApps().getNames()) {
|
|
32
|
+
const appDefinition = this.client.getApps().get(appName);
|
|
33
|
+
if (appDefinition.contractId.equals(updatedDataContract.getId()) && appDefinition.contract) {
|
|
34
|
+
appDefinition.contract = updatedDataContract;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return dataContractUpdateTransition;
|
|
39
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import getDataContractFixture from '@dashevo/dpp/lib/test/fixtures/getDataContractFixture';
|
|
2
2
|
import generateRandomIdentifier from '@dashevo/dpp/lib/test/utils/generateRandomIdentifier';
|
|
3
3
|
import createDPPMock from '@dashevo/dpp/lib/test/mocks/createDPPMock';
|
|
4
|
+
import getDocumentsFixture from '@dashevo/dpp/lib/test/fixtures/getDocumentsFixture';
|
|
4
5
|
import getResponseMetadataFixture from '../../../../../test/fixtures/getResponseMetadataFixture';
|
|
5
6
|
const GetDocumentsResponse = require("@dashevo/dapi-client/lib/methods/platform/getDocuments/GetDocumentsResponse");
|
|
6
7
|
|
|
@@ -84,6 +85,42 @@ describe('Client - Platform - Documents - .get()', () => {
|
|
|
84
85
|
]);
|
|
85
86
|
});
|
|
86
87
|
|
|
88
|
+
it('should convert Document to identifiers inside where condition for "startAt" and "startAfter"', async () => {
|
|
89
|
+
const [docA, docB] = getDocumentsFixture();
|
|
90
|
+
|
|
91
|
+
await get.call(platform, 'app.withByteArrays', {
|
|
92
|
+
startAt: docA,
|
|
93
|
+
startAfter: docB,
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
expect(getDocumentsMock.getCall(0).args).to.have.deep.members([
|
|
97
|
+
appDefinition.contractId,
|
|
98
|
+
'withByteArrays',
|
|
99
|
+
{
|
|
100
|
+
startAt: docA.getId(),
|
|
101
|
+
startAfter: docB.getId(),
|
|
102
|
+
},
|
|
103
|
+
]);
|
|
104
|
+
});
|
|
105
|
+
|
|
106
|
+
it('should convert string to identifiers inside where condition for "startAt" and "startAfter"', async () => {
|
|
107
|
+
const [docA, docB] = getDocumentsFixture();
|
|
108
|
+
|
|
109
|
+
await get.call(platform, 'app.withByteArrays', {
|
|
110
|
+
startAt: docA.getId().toString('base58'),
|
|
111
|
+
startAfter: docB.getId().toString('base58'),
|
|
112
|
+
});
|
|
113
|
+
|
|
114
|
+
expect(getDocumentsMock.getCall(0).args).to.have.deep.members([
|
|
115
|
+
appDefinition.contractId,
|
|
116
|
+
'withByteArrays',
|
|
117
|
+
{
|
|
118
|
+
startAt: docA.getId(),
|
|
119
|
+
startAfter: docB.getId(),
|
|
120
|
+
},
|
|
121
|
+
]);
|
|
122
|
+
});
|
|
123
|
+
|
|
87
124
|
it('should convert nested identifier properties inside where condition if `elementMatch` is used', async () => {
|
|
88
125
|
const id = generateRandomIdentifier();
|
|
89
126
|
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import Identifier from '@dashevo/dpp/lib/Identifier';
|
|
2
2
|
import Metadata from "@dashevo/dpp/lib/Metadata";
|
|
3
|
+
import Document from '@dashevo/dpp/lib/document/Document';
|
|
3
4
|
|
|
4
5
|
import {Platform} from "../../Platform";
|
|
5
6
|
|
|
@@ -7,15 +8,15 @@ import {Platform} from "../../Platform";
|
|
|
7
8
|
* @param {WhereCondition[]} [where] - where
|
|
8
9
|
* @param {OrderByCondition[]} [orderBy] - order by
|
|
9
10
|
* @param {number} [limit] - limit
|
|
10
|
-
* @param {
|
|
11
|
-
* @param {
|
|
11
|
+
* @param {string|Buffer|Document|Identifier} [startAt] - start value (included)
|
|
12
|
+
* @param {string|Buffer|Document|Identifier} [startAfter] - start value (not included)
|
|
12
13
|
*/
|
|
13
14
|
declare interface fetchOpts {
|
|
14
15
|
where?: WhereCondition[];
|
|
15
16
|
orderBy?: OrderByCondition[];
|
|
16
17
|
limit?: number;
|
|
17
|
-
startAt?:
|
|
18
|
-
startAfter?:
|
|
18
|
+
startAt?: string|Buffer|Document|Identifier;
|
|
19
|
+
startAfter?: string|Buffer|Document|Identifier;
|
|
19
20
|
}
|
|
20
21
|
|
|
21
22
|
type OrderByCondition = [
|
|
@@ -121,6 +122,18 @@ export async function get(this: Platform, typeLocator: string, opts: fetchOpts):
|
|
|
121
122
|
opts.where = opts.where.map((whereCondition) => convertIdentifierProperties(whereCondition, binaryProperties));
|
|
122
123
|
}
|
|
123
124
|
|
|
125
|
+
if (opts.startAt instanceof Document) {
|
|
126
|
+
opts.startAt = opts.startAt.getId();
|
|
127
|
+
} else if (typeof opts.startAt === 'string') {
|
|
128
|
+
opts.startAt = Identifier.from(opts.startAt);
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
if (opts.startAfter instanceof Document) {
|
|
132
|
+
opts.startAfter = opts.startAfter.getId();
|
|
133
|
+
} else if (typeof opts.startAfter === 'string') {
|
|
134
|
+
opts.startAfter = Identifier.from(opts.startAfter);
|
|
135
|
+
}
|
|
136
|
+
|
|
124
137
|
// @ts-ignore
|
|
125
138
|
const documentsResponse = await this.client.getDAPIClient().platform.getDocuments(
|
|
126
139
|
appDefinition.contractId,
|
package/src/SDK/Client/Platform/methods/identities/internal/createIdentityCreateTransition.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { PrivateKey } from "@dashevo/dashcore-lib";
|
|
2
2
|
import { Platform } from "../../../Platform";
|
|
3
|
+
import IdentityPublicKey from "@dashevo/dpp/lib/identity/IdentityPublicKey"
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Creates a funding transaction for the platform identity and returns one-time key to sign the state transition
|
|
@@ -24,13 +25,17 @@ export default async function createIdentityCreateTransition(platform : Platform
|
|
|
24
25
|
// Create Identity
|
|
25
26
|
// @ts-ignore
|
|
26
27
|
const identity = dpp.identity.create(
|
|
27
|
-
assetLockProof, [
|
|
28
|
+
assetLockProof, [{
|
|
29
|
+
key: identityPublicKey,
|
|
30
|
+
purpose: IdentityPublicKey.PURPOSES.AUTHENTICATION,
|
|
31
|
+
securityLevel: IdentityPublicKey.SECURITY_LEVELS.MASTER
|
|
32
|
+
}]
|
|
28
33
|
);
|
|
29
34
|
|
|
30
35
|
// Create ST
|
|
31
36
|
const identityCreateTransition = dpp.identity.createIdentityCreateTransition(identity);
|
|
32
37
|
|
|
33
|
-
identityCreateTransition.signByPrivateKey(assetLockPrivateKey);
|
|
38
|
+
await identityCreateTransition.signByPrivateKey(assetLockPrivateKey, IdentityPublicKey.TYPES.ECDSA_SECP256K1);
|
|
34
39
|
|
|
35
40
|
const result = await dpp.stateTransition.validateBasic(identityCreateTransition);
|
|
36
41
|
|
package/src/SDK/Client/Platform/methods/identities/internal/createIdnetityTopUpTransition.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { PrivateKey } from "@dashevo/dashcore-lib";
|
|
2
2
|
import { Platform } from "../../../Platform";
|
|
3
|
+
import IdentityPublicKey from "@dashevo/dpp/lib/identity/IdentityPublicKey"
|
|
3
4
|
|
|
4
5
|
/**
|
|
5
6
|
* Creates a funding transaction for the platform identity and returns one-time key to sign the state transition
|
|
@@ -20,7 +21,7 @@ export default async function createIdentityTopUpTransition(platform : Platform,
|
|
|
20
21
|
identityId, assetLockProof
|
|
21
22
|
);
|
|
22
23
|
|
|
23
|
-
identityTopUpTransition.signByPrivateKey(assetLockPrivateKey);
|
|
24
|
+
await identityTopUpTransition.signByPrivateKey(assetLockPrivateKey, IdentityPublicKey.TYPES.ECDSA_SECP256K1);
|
|
24
25
|
|
|
25
26
|
const result = await dpp.stateTransition.validateBasic(identityTopUpTransition);
|
|
26
27
|
|
|
@@ -36,6 +36,7 @@ describe('Platform', () => {
|
|
|
36
36
|
["normalizedParentDomainName", "==", "dash"],
|
|
37
37
|
["normalizedLabel", "startsWith", "prefix"]
|
|
38
38
|
],
|
|
39
|
+
orderBy: [['normalizedLabel', 'asc']],
|
|
39
40
|
},
|
|
40
41
|
]);
|
|
41
42
|
|
|
@@ -57,6 +58,7 @@ describe('Platform', () => {
|
|
|
57
58
|
["normalizedParentDomainName", "==", "dash"],
|
|
58
59
|
["normalizedLabel", "startsWith", "prefix"]
|
|
59
60
|
],
|
|
61
|
+
orderBy: [['normalizedLabel', 'asc']]
|
|
60
62
|
},
|
|
61
63
|
]);
|
|
62
64
|
|
|
@@ -17,6 +17,9 @@ export async function search(this: Platform, labelPrefix: string, parentDomainNa
|
|
|
17
17
|
['normalizedParentDomainName', '==', normalizedParentDomainName],
|
|
18
18
|
['normalizedLabel', 'startsWith', normalizedLabelPrefix],
|
|
19
19
|
],
|
|
20
|
+
orderBy: [
|
|
21
|
+
['normalizedLabel', 'asc']
|
|
22
|
+
]
|
|
20
23
|
});
|
|
21
24
|
|
|
22
25
|
return documents;
|
|
@@ -19,10 +19,10 @@ export async function signStateTransition(platform: Platform, stateTransition: a
|
|
|
19
19
|
keyIndex,
|
|
20
20
|
);
|
|
21
21
|
|
|
22
|
-
stateTransition.sign(
|
|
22
|
+
await stateTransition.sign(
|
|
23
23
|
identity.getPublicKeyById(keyIndex),
|
|
24
24
|
privateKey,
|
|
25
25
|
);
|
|
26
26
|
|
|
27
27
|
return stateTransition;
|
|
28
|
-
}
|
|
28
|
+
}
|
package/src/test/bootstrap.js
CHANGED
|
@@ -13,6 +13,19 @@ dotenvSafe.config({
|
|
|
13
13
|
use(dirtyChai);
|
|
14
14
|
use(sinonChai);
|
|
15
15
|
|
|
16
|
+
before(function before() {
|
|
17
|
+
if (!this.sinon) {
|
|
18
|
+
this.sinon = sinon.createSandbox();
|
|
19
|
+
} else {
|
|
20
|
+
this.sinon.restore();
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
after(function after() {
|
|
26
|
+
this.sinon.restore();
|
|
27
|
+
});
|
|
28
|
+
|
|
16
29
|
beforeEach(function beforeEach() {
|
|
17
30
|
if (!this.sinon) {
|
|
18
31
|
this.sinon = sinon.createSandbox();
|
|
@@ -11,6 +11,8 @@ export function createIdentityFixtureInAccount(account) {
|
|
|
11
11
|
id: 0,
|
|
12
12
|
type: IdentityPublicKey.TYPES.ECDSA_SECP256K1,
|
|
13
13
|
data: identityPrivateKey.toPublicKey().toBuffer(),
|
|
14
|
+
purpose: IdentityPublicKey.PURPOSES.AUTHENTICATION,
|
|
15
|
+
securityLevel: IdentityPublicKey.SECURITY_LEVELS.MASTER
|
|
14
16
|
});
|
|
15
17
|
|
|
16
18
|
account.storage.insertIdentityIdAtIndex(
|
|
@@ -20,4 +22,4 @@ export function createIdentityFixtureInAccount(account) {
|
|
|
20
22
|
);
|
|
21
23
|
|
|
22
24
|
return identityFixture;
|
|
23
|
-
}
|
|
25
|
+
}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"broadcast.js","sourceRoot":"","sources":["../../../../../../../src/SDK/Client/Platform/methods/contracts/broadcast.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AACA,4FAAsE;AACtE,iEAAgE;AAEhE;;;;;;;GAOG;AACH,SAA8B,SAAS,CAAiB,YAAiB,EAAE,QAAa;;;;;wBACpF,qBAAM,IAAI,CAAC,UAAU,EAAE,EAAA;;oBAAvB,SAAuB,CAAC;oBAEhB,GAAG,GAAK,IAAI,IAAT,CAAU;oBAEf,4BAA4B,GAAG,GAAG,CAAC,YAAY,CAAC,qBAAqB,CAAC,YAAY,CAAC,CAAC;oBAE1F,qBAAM,yCAAmB,CAAC,IAAI,EAAE,4BAA4B,EAAE,QAAQ,CAAC,EAAA;;oBAAvE,SAAuE,CAAC;oBACxE,qBAAM,kCAAwB,CAAC,IAAI,EAAE,4BAA4B,CAAC,EAAA;;oBAAlE,SAAkE,CAAC;oBAEnE,sBAAO,4BAA4B,EAAC;;;;CACvC;AAXD,4BAWC"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { Platform } from "../../Platform";
|
|
2
|
-
/**
|
|
3
|
-
* Broadcast contract onto the platform
|
|
4
|
-
*
|
|
5
|
-
* @param {Platform} this - bound instance class
|
|
6
|
-
* @param dataContract - contract
|
|
7
|
-
* @param identity - identity
|
|
8
|
-
* @return dataContract
|
|
9
|
-
*/
|
|
10
|
-
export default function broadcast(this: Platform, dataContract: any, identity: any): Promise<any>;
|