dash-platform-sdk 1.3.2-dev.5 → 1.4.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/bundle.min.js +17 -17
- package/package.json +2 -6
- package/proto/generated/platform.client.d.ts +20 -0
- package/proto/generated/platform.client.js +14 -0
- package/proto/generated/platform.d.ts +293 -0
- package/proto/generated/platform.js +603 -1
- package/src/DashPlatformSDK.d.ts +3 -1
- package/src/DashPlatformSDK.js +8 -5
- package/src/constants.js +1 -2
- package/src/contestedResources/getContestedResourceVoteState.js +5 -2
- package/src/dataContracts/create.d.ts +3 -3
- package/src/dataContracts/create.js +1 -1
- package/src/dataContracts/createStateTransition.js +0 -1
- package/src/dataContracts/getDataContractByIdentifier.d.ts +1 -2
- package/src/dataContracts/index.d.ts +3 -3
- package/src/documents/create.d.ts +1 -2
- package/src/documents/index.d.ts +3 -3
- package/src/documents/query.d.ts +2 -3
- package/src/documents/query.js +3 -4
- package/src/identities/getIdentityBalance.d.ts +1 -1
- package/src/identities/getIdentityByIdentifier.d.ts +1 -2
- package/src/identities/getIdentityContractNonce.d.ts +1 -1
- package/src/identities/getIdentityNonce.d.ts +1 -1
- package/src/identities/getIdentityPublicKeys.d.ts +1 -2
- package/src/identities/index.d.ts +2 -2
- package/src/identities/index.js +2 -3
- package/src/names/index.d.ts +1 -2
- package/src/node/index.d.ts +2 -3
- package/src/node/index.js +2 -4
- package/src/node/totalCredits.d.ts +1 -2
- package/src/node/totalCredits.js +2 -2
- package/src/platformAddresses/getAddressInfo.d.ts +4 -0
- package/src/platformAddresses/getAddressInfo.js +45 -0
- package/src/platformAddresses/getAddressesInfos.d.ts +4 -0
- package/src/platformAddresses/getAddressesInfos.js +43 -0
- package/src/platformAddresses/index.d.ts +22 -0
- package/src/platformAddresses/index.js +27 -0
- package/src/stateTransitions/broadcast.js +2 -3
- package/src/stateTransitions/waitForStateTransitionResult.js +8 -2
- package/src/tokens/getIdentitiesTokenBalances.d.ts +2 -3
- package/src/tokens/getIdentitiesTokenBalances.js +3 -3
- package/src/tokens/getIdentityTokensBalances.d.ts +2 -3
- package/src/tokens/getIdentityTokensBalances.js +3 -3
- package/src/tokens/getTokenContractInfo.d.ts +1 -2
- package/src/tokens/getTokenDirectPurchasePrices.d.ts +2 -1
- package/src/tokens/getTokenTotalSupply.d.ts +2 -1
- package/src/tokens/index.d.ts +2 -2
- package/src/utils/index.d.ts +1 -2
- package/src/voting/index.d.ts +2 -2
- package/test/unit/Document.spec.js +2 -31
- package/test/unit/Identity.spec.js +26 -26
- package/test/unit/Names.spec.js +2 -2
- package/test/unit/PlatformAddress.spec.d.ts +1 -0
- package/test/unit/PlatformAddress.spec.js +22 -0
- package/test/unit/Tokens.spec.js +3 -3
- package/types.d.ts +11 -7
- package/types.js +1 -1
package/src/tokens/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import GRPCConnectionPool from '../grpcConnectionPool.js';
|
|
2
|
-
import {
|
|
2
|
+
import { TokenDirectPurchasePrices, TokenTotalSupply, TokenTransitionParams, TokenTransitionType } from '../../types.js';
|
|
3
3
|
import { IdentitiesTokenBalances } from './getIdentitiesTokenBalances.js';
|
|
4
4
|
import { IdentityTokenBalances } from './getIdentityTokensBalances.js';
|
|
5
5
|
import { TokenContractInfo } from './getTokenContractInfo.js';
|
|
6
|
-
import { StateTransitionWASM, TokenBaseTransitionWASM } from 'pshenmic-dpp';
|
|
6
|
+
import { IdentifierLike, StateTransitionWASM, TokenBaseTransitionWASM } from 'pshenmic-dpp';
|
|
7
7
|
/**
|
|
8
8
|
* Tokens controller for requesting information about tokens and tokens holders
|
|
9
9
|
*
|
package/src/utils/index.d.ts
CHANGED
package/src/voting/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IdentifierLike,
|
|
2
|
-
import {
|
|
1
|
+
import { IdentifierLike, IdentifierWASM, StateTransitionWASM, VoteWASM } from 'pshenmic-dpp';
|
|
2
|
+
import { ResourceVoteChoice } from '../../types.js';
|
|
3
3
|
/**
|
|
4
4
|
* Voting controller for performing masternode votes
|
|
5
5
|
*
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { DocumentWASM,
|
|
1
|
+
import { DocumentWASM, StateTransitionWASM } from 'pshenmic-dpp';
|
|
2
2
|
import { DashPlatformSDK } from '../../src/DashPlatformSDK.js';
|
|
3
3
|
let sdk;
|
|
4
4
|
let dataContract;
|
|
@@ -42,35 +42,6 @@ describe('Document', () => {
|
|
|
42
42
|
expect(document.dataContractId.base58()).toEqual(dataContract);
|
|
43
43
|
expect(document).toEqual(expect.any(DocumentWASM));
|
|
44
44
|
});
|
|
45
|
-
test('should be able to get document with startAt', async () => {
|
|
46
|
-
const dataContract = '6hVQW16jyvZyGSQk2YVty4ND6bgFXozizYWnPt753uW5';
|
|
47
|
-
const documentType = 'torrent';
|
|
48
|
-
const limit = 5;
|
|
49
|
-
// @ts-expect-error
|
|
50
|
-
const [firstQueriedDoc] = (await sdk.documents.query(dataContract, documentType, null, null, limit)).toReversed();
|
|
51
|
-
// @ts-expect-error
|
|
52
|
-
const [secondQueriedDoc] = await sdk.documents.query(dataContract, documentType, null, null, limit, firstQueriedDoc.id);
|
|
53
|
-
expect(secondQueriedDoc.id.base58()).toEqual(firstQueriedDoc.id.base58());
|
|
54
|
-
expect(secondQueriedDoc.createdAtBlockHeight).toEqual(undefined);
|
|
55
|
-
expect(secondQueriedDoc.dataContractId.base58()).toEqual(dataContract);
|
|
56
|
-
expect(secondQueriedDoc).toEqual(expect.any(DocumentWASM));
|
|
57
|
-
});
|
|
58
|
-
test('should be able to get document with startAfter', async () => {
|
|
59
|
-
const dataContract = '6hVQW16jyvZyGSQk2YVty4ND6bgFXozizYWnPt753uW5';
|
|
60
|
-
const documentType = 'torrent';
|
|
61
|
-
const limit = 5;
|
|
62
|
-
const masterQueryLimit = limit * 2;
|
|
63
|
-
// @ts-expect-error
|
|
64
|
-
const masterQuery = await sdk.documents.query(dataContract, documentType, null, null, masterQueryLimit);
|
|
65
|
-
// @ts-expect-error
|
|
66
|
-
const [firstQueriedDoc] = (await sdk.documents.query(dataContract, documentType, null, null, limit)).toReversed();
|
|
67
|
-
// @ts-expect-error
|
|
68
|
-
const [secondQueriedDoc] = await sdk.documents.query(dataContract, documentType, null, null, limit, undefined, firstQueriedDoc.id);
|
|
69
|
-
expect(masterQuery[5].id.base58()).toEqual(secondQueriedDoc.id.base58());
|
|
70
|
-
expect(secondQueriedDoc.createdAtBlockHeight).toEqual(undefined);
|
|
71
|
-
expect(secondQueriedDoc.dataContractId.base58()).toEqual(dataContract);
|
|
72
|
-
expect(secondQueriedDoc).toEqual(expect.any(DocumentWASM));
|
|
73
|
-
});
|
|
74
45
|
describe('should be able to create state transition', () => {
|
|
75
46
|
test('should be able to create a create transition', async () => {
|
|
76
47
|
const document = sdk.documents.create(dataContract, documentType, data, identity);
|
|
@@ -96,7 +67,7 @@ describe('Document', () => {
|
|
|
96
67
|
tokenContractPosition: 0,
|
|
97
68
|
minimumTokenCost: BigInt(1000),
|
|
98
69
|
maximumTokenCost: BigInt(100000),
|
|
99
|
-
gasFeesPaidBy: GasFeesPaidByWASM.ContractOwner
|
|
70
|
+
gasFeesPaidBy: 1 /* GasFeesPaidByWASM.ContractOwner */
|
|
100
71
|
};
|
|
101
72
|
const stateTransition = sdk.documents.createStateTransition(document, 'create', { identityContractNonce, tokenPaymentInfo });
|
|
102
73
|
expect(stateTransition).toEqual(expect.any(StateTransitionWASM));
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { CoreScriptWASM, IdentityPublicKeyWASM, IdentityWASM,
|
|
1
|
+
import { CoreScriptWASM, IdentityPublicKeyWASM, IdentityWASM, PrivateKeyWASM, StateTransitionWASM } from 'pshenmic-dpp';
|
|
2
2
|
import { DashPlatformSDK } from '../../types.js';
|
|
3
3
|
import { base58 } from '@scure/base';
|
|
4
4
|
let sdk;
|
|
@@ -50,18 +50,18 @@ describe('Identity', () => {
|
|
|
50
50
|
const privateKey1 = PrivateKeyWASM.fromHex('a1286dd195e2b8e1f6bdc946c56a53e0c544750d6452ddc0f4c593ef311f21af', 'testnet');
|
|
51
51
|
const identityPublicKeyInCreation1 = {
|
|
52
52
|
id: 0,
|
|
53
|
-
purpose: Purpose.AUTHENTICATION
|
|
54
|
-
securityLevel: SecurityLevel.MASTER
|
|
55
|
-
keyType: KeyType.ECDSA_SECP256K1
|
|
53
|
+
purpose: 0 /* Purpose.AUTHENTICATION */,
|
|
54
|
+
securityLevel: 0 /* SecurityLevel.MASTER */,
|
|
55
|
+
keyType: 0 /* KeyType.ECDSA_SECP256K1 */,
|
|
56
56
|
readOnly: false,
|
|
57
57
|
data: privateKey1.getPublicKey().bytes()
|
|
58
58
|
};
|
|
59
59
|
const privateKey2 = PrivateKeyWASM.fromHex('44a8195e242364b935e9d7ff2106ed109e9baf3800907f5e58a259fdfd1ca5e5', 'testnet');
|
|
60
60
|
const identityPublicKeyInCreation2 = {
|
|
61
61
|
id: 1,
|
|
62
|
-
purpose: Purpose.AUTHENTICATION
|
|
63
|
-
securityLevel: SecurityLevel.HIGH
|
|
64
|
-
keyType: KeyType.ECDSA_SECP256K1
|
|
62
|
+
purpose: 0 /* Purpose.AUTHENTICATION */,
|
|
63
|
+
securityLevel: 2 /* SecurityLevel.HIGH */,
|
|
64
|
+
keyType: 0 /* KeyType.ECDSA_SECP256K1 */,
|
|
65
65
|
readOnly: false,
|
|
66
66
|
data: privateKey2.getPublicKey().bytes()
|
|
67
67
|
};
|
|
@@ -76,7 +76,7 @@ describe('Identity', () => {
|
|
|
76
76
|
type: 'chainLock'
|
|
77
77
|
}
|
|
78
78
|
});
|
|
79
|
-
identityCreateStateTransition.signByPrivateKey(privateKey1, KeyType.ECDSA_SECP256K1);
|
|
79
|
+
identityCreateStateTransition.signByPrivateKey(privateKey1, 0 /* KeyType.ECDSA_SECP256K1 */);
|
|
80
80
|
identityPublicKeyInCreation1.signature = identityCreateStateTransition.signature;
|
|
81
81
|
// Set identity public key signature for public key 1
|
|
82
82
|
identityCreateStateTransition = sdk.identities.createStateTransition('create', {
|
|
@@ -88,7 +88,7 @@ describe('Identity', () => {
|
|
|
88
88
|
type: 'chainLock'
|
|
89
89
|
}
|
|
90
90
|
});
|
|
91
|
-
identityCreateStateTransition.signByPrivateKey(privateKey2, KeyType.ECDSA_SECP256K1);
|
|
91
|
+
identityCreateStateTransition.signByPrivateKey(privateKey2, 0 /* KeyType.ECDSA_SECP256K1 */);
|
|
92
92
|
identityPublicKeyInCreation2.signature = identityCreateStateTransition.signature;
|
|
93
93
|
// Finalize
|
|
94
94
|
identityCreateStateTransition = sdk.identities.createStateTransition('create', {
|
|
@@ -100,7 +100,7 @@ describe('Identity', () => {
|
|
|
100
100
|
type: 'chainLock'
|
|
101
101
|
}
|
|
102
102
|
});
|
|
103
|
-
identityCreateStateTransition.signByPrivateKey(assetLockPrivateKey, KeyType.ECDSA_SECP256K1);
|
|
103
|
+
identityCreateStateTransition.signByPrivateKey(assetLockPrivateKey, 0 /* KeyType.ECDSA_SECP256K1 */);
|
|
104
104
|
});
|
|
105
105
|
test('should be able to create IdentityCreateTransition via InstantSend', async () => {
|
|
106
106
|
const assetLockPrivateKey = PrivateKeyWASM.fromHex('edd04a71bddb31e530f6c2314fd42ada333f6656bb853ece13f0577a8fd30612', 'testnet');
|
|
@@ -110,18 +110,18 @@ describe('Identity', () => {
|
|
|
110
110
|
const privateKey1 = PrivateKeyWASM.fromHex('a1286dd195e2b8e1f6bdc946c56a53e0c544750d6452ddc0f4c593ef311f21af', 'testnet');
|
|
111
111
|
const identityPublicKeyInCreation1 = {
|
|
112
112
|
id: 0,
|
|
113
|
-
purpose: Purpose.AUTHENTICATION
|
|
114
|
-
securityLevel: SecurityLevel.MASTER
|
|
115
|
-
keyType: KeyType.ECDSA_SECP256K1
|
|
113
|
+
purpose: 0 /* Purpose.AUTHENTICATION */,
|
|
114
|
+
securityLevel: 0 /* SecurityLevel.MASTER */,
|
|
115
|
+
keyType: 0 /* KeyType.ECDSA_SECP256K1 */,
|
|
116
116
|
readOnly: false,
|
|
117
117
|
data: privateKey1.getPublicKey().bytes()
|
|
118
118
|
};
|
|
119
119
|
const privateKey2 = PrivateKeyWASM.fromHex('44a8195e242364b935e9d7ff2106ed109e9baf3800907f5e58a259fdfd1ca5e5', 'testnet');
|
|
120
120
|
const identityPublicKeyInCreation2 = {
|
|
121
121
|
id: 1,
|
|
122
|
-
purpose: Purpose.AUTHENTICATION
|
|
123
|
-
securityLevel: SecurityLevel.HIGH
|
|
124
|
-
keyType: KeyType.ECDSA_SECP256K1
|
|
122
|
+
purpose: 0 /* Purpose.AUTHENTICATION */,
|
|
123
|
+
securityLevel: 2 /* SecurityLevel.HIGH */,
|
|
124
|
+
keyType: 0 /* KeyType.ECDSA_SECP256K1 */,
|
|
125
125
|
readOnly: false,
|
|
126
126
|
data: privateKey2.getPublicKey().bytes()
|
|
127
127
|
};
|
|
@@ -136,7 +136,7 @@ describe('Identity', () => {
|
|
|
136
136
|
type: 'instantLock'
|
|
137
137
|
}
|
|
138
138
|
});
|
|
139
|
-
identityCreateStateTransition.signByPrivateKey(privateKey1, KeyType.ECDSA_SECP256K1);
|
|
139
|
+
identityCreateStateTransition.signByPrivateKey(privateKey1, 0 /* KeyType.ECDSA_SECP256K1 */);
|
|
140
140
|
identityPublicKeyInCreation1.signature = identityCreateStateTransition.signature;
|
|
141
141
|
// Set identity public key signature for public key 1
|
|
142
142
|
identityCreateStateTransition = sdk.identities.createStateTransition('create', {
|
|
@@ -148,7 +148,7 @@ describe('Identity', () => {
|
|
|
148
148
|
type: 'instantLock'
|
|
149
149
|
}
|
|
150
150
|
});
|
|
151
|
-
identityCreateStateTransition.signByPrivateKey(privateKey2, KeyType.ECDSA_SECP256K1);
|
|
151
|
+
identityCreateStateTransition.signByPrivateKey(privateKey2, 0 /* KeyType.ECDSA_SECP256K1 */);
|
|
152
152
|
identityPublicKeyInCreation2.signature = identityCreateStateTransition.signature;
|
|
153
153
|
// Finalize
|
|
154
154
|
identityCreateStateTransition = sdk.identities.createStateTransition('create', {
|
|
@@ -160,7 +160,7 @@ describe('Identity', () => {
|
|
|
160
160
|
type: 'instantLock'
|
|
161
161
|
}
|
|
162
162
|
});
|
|
163
|
-
identityCreateStateTransition.signByPrivateKey(assetLockPrivateKey, KeyType.ECDSA_SECP256K1);
|
|
163
|
+
identityCreateStateTransition.signByPrivateKey(assetLockPrivateKey, 0 /* KeyType.ECDSA_SECP256K1 */);
|
|
164
164
|
});
|
|
165
165
|
test('should be able to create IdentityTopUpTransition via InstantSend', async () => {
|
|
166
166
|
const transaction = '03000800011a468e6a7cf1c5111b09b7bca6743f2571a9bf13d2ff6d21d3d230fd1dea1e97000000006b483045022100fceb25c45e77e1a273660e4f4c9a09042fb858a57704806e14bf80a734af232a02201929893dd720cf5855e31dda577cda16df29520a9774b4f3e813a4cc468fe086012103e16ede6dc5c99f28e3a5733f47a7494992bc6ce4f98551c092645910b9888b8fffffffff0200e1f50500000000026a004054fa02000000001976a91416bbe230f46eea86fc4bf4dd550be45dc9adfcb488ac0000000024010100e1f505000000001976a9147f78813975a3282e09e284d97d93c083b202e34188ac';
|
|
@@ -177,7 +177,7 @@ describe('Identity', () => {
|
|
|
177
177
|
type: 'instantLock'
|
|
178
178
|
}
|
|
179
179
|
});
|
|
180
|
-
identityTopUpTransaction.signByPrivateKey(assetLockPrivateKey, undefined, KeyType.ECDSA_SECP256K1);
|
|
180
|
+
identityTopUpTransaction.signByPrivateKey(assetLockPrivateKey, undefined, 0 /* KeyType.ECDSA_SECP256K1 */);
|
|
181
181
|
});
|
|
182
182
|
test('should be able to create IdentityTopUpTransition via ChainLock', async () => {
|
|
183
183
|
const txid = '61aede830477254876d435a317241ad46753c4b1350dc991a45ebcf19ab80a11';
|
|
@@ -194,7 +194,7 @@ describe('Identity', () => {
|
|
|
194
194
|
type: 'chainLock'
|
|
195
195
|
}
|
|
196
196
|
});
|
|
197
|
-
identityTopUpTransaction.signByPrivateKey(assetLockPrivateKey, undefined, KeyType.ECDSA_SECP256K1);
|
|
197
|
+
identityTopUpTransaction.signByPrivateKey(assetLockPrivateKey, undefined, 0 /* KeyType.ECDSA_SECP256K1 */);
|
|
198
198
|
});
|
|
199
199
|
test('should be able to create IdentityUpdateTransition', async () => {
|
|
200
200
|
const identityId = 'HT3pUBM1Uv2mKgdPEN1gxa7A4PdsvNY89aJbdSKQb5wR';
|
|
@@ -207,9 +207,9 @@ describe('Identity', () => {
|
|
|
207
207
|
const identityPrivateKey = PrivateKeyWASM.fromHex('16f614c6242580628d849e3616491dda1eccce99642a85667eb9a364dc85324a', 'testnet');
|
|
208
208
|
const identityPublicKeyInCreation = {
|
|
209
209
|
id: keyId,
|
|
210
|
-
purpose: Purpose.AUTHENTICATION
|
|
211
|
-
securityLevel: SecurityLevel.HIGH
|
|
212
|
-
keyType: KeyType.ECDSA_SECP256K1
|
|
210
|
+
purpose: 0 /* Purpose.AUTHENTICATION */,
|
|
211
|
+
securityLevel: 2 /* SecurityLevel.HIGH */,
|
|
212
|
+
keyType: 0 /* KeyType.ECDSA_SECP256K1 */,
|
|
213
213
|
readOnly: false,
|
|
214
214
|
data: identityPrivateKey.getPublicKey().bytes()
|
|
215
215
|
};
|
|
@@ -219,7 +219,7 @@ describe('Identity', () => {
|
|
|
219
219
|
identityNonce,
|
|
220
220
|
addPublicKeys: [identityPublicKeyInCreation]
|
|
221
221
|
});
|
|
222
|
-
identityUpdateTransition.signByPrivateKey(masterPrivateKey, masterKeyId, KeyType.ECDSA_SECP256K1);
|
|
222
|
+
identityUpdateTransition.signByPrivateKey(masterPrivateKey, masterKeyId, 0 /* KeyType.ECDSA_SECP256K1 */);
|
|
223
223
|
identityPublicKeyInCreation.signature = identityUpdateTransition.signature;
|
|
224
224
|
identityUpdateTransition = sdk.identities.createStateTransition('update', {
|
|
225
225
|
identityId,
|
|
@@ -227,7 +227,7 @@ describe('Identity', () => {
|
|
|
227
227
|
identityNonce,
|
|
228
228
|
addPublicKeys: [identityPublicKeyInCreation]
|
|
229
229
|
});
|
|
230
|
-
identityUpdateTransition.signByPrivateKey(masterPrivateKey, masterKeyId, KeyType.ECDSA_SECP256K1);
|
|
230
|
+
identityUpdateTransition.signByPrivateKey(masterPrivateKey, masterKeyId, 0 /* KeyType.ECDSA_SECP256K1 */);
|
|
231
231
|
});
|
|
232
232
|
test('should able be create credit transfer transition', async () => {
|
|
233
233
|
const identityId = 'QMfCRPcjXoTnZa9sA9JR2KWgGxZXMRJ4akgS3Uia1Qv';
|
package/test/unit/Names.spec.js
CHANGED
|
@@ -14,12 +14,12 @@ describe('DPNS names', () => {
|
|
|
14
14
|
sdk.stateTransitions.broadcast = jest.fn();
|
|
15
15
|
sdk.stateTransitions.waitForStateTransitionResult = jest.fn();
|
|
16
16
|
});
|
|
17
|
-
|
|
17
|
+
test('should be able to search names by DPNS name', async () => {
|
|
18
18
|
const documents = await sdk.names.searchByName('xyz.dash');
|
|
19
19
|
expect(documents?.length).toEqual(1);
|
|
20
20
|
expect(documents[0]).toEqual(expect.any(DocumentWASM));
|
|
21
21
|
});
|
|
22
|
-
|
|
22
|
+
test('should be able to search names by identity', async () => {
|
|
23
23
|
const documents = await sdk.names.searchByIdentity('36LGwPSXef8q8wpdnx4EdDeVNuqCYNAE9boDu5bxytsm');
|
|
24
24
|
expect(documents?.length).toEqual(3);
|
|
25
25
|
const [xyzDocument] = documents;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { DashPlatformSDK } from '../../src/DashPlatformSDK.js';
|
|
2
|
+
let sdk;
|
|
3
|
+
describe('PlatformAddress', () => {
|
|
4
|
+
beforeAll(() => {
|
|
5
|
+
sdk = new DashPlatformSDK({ network: 'testnet' });
|
|
6
|
+
});
|
|
7
|
+
test('getAddressInfo', async () => {
|
|
8
|
+
const info = await sdk.platformAddresses.getAddressInfo('tdashevo1qpgz9hk6tkn5zj3653s8qkjmk9439qkf0gl4yxxw');
|
|
9
|
+
expect(info.balance).toBeDefined();
|
|
10
|
+
expect(info.nonce).toBeDefined();
|
|
11
|
+
expect(info.address).toBeDefined();
|
|
12
|
+
});
|
|
13
|
+
test('getAddressesInfos', async () => {
|
|
14
|
+
const addresses = [
|
|
15
|
+
'tdashevo1qpgz9hk6tkn5zj3653s8qkjmk9439qkf0gl4yxxw',
|
|
16
|
+
'tdashevo1qq79z66rh34l4u2axlz3jv34zwshggnenut9k093',
|
|
17
|
+
'tdashevo1qpwyg4khd0rh8px5cjphv9wx38psl6hma5krg9gk'
|
|
18
|
+
];
|
|
19
|
+
const info = await sdk.platformAddresses.getAddressesInfos(addresses);
|
|
20
|
+
expect(info).toHaveLength(addresses.length);
|
|
21
|
+
});
|
|
22
|
+
});
|
package/test/unit/Tokens.spec.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { StateTransitionWASM, TokenBaseTransitionWASM
|
|
1
|
+
import { StateTransitionWASM, TokenBaseTransitionWASM } from 'pshenmic-dpp';
|
|
2
2
|
import { DashPlatformSDK } from '../../src/DashPlatformSDK.js';
|
|
3
3
|
let sdk;
|
|
4
4
|
describe('Tokens', () => {
|
|
@@ -29,7 +29,7 @@ describe('Tokens', () => {
|
|
|
29
29
|
]);
|
|
30
30
|
expect(tokensPrices.length).toEqual(2);
|
|
31
31
|
expect(tokensPrices[0].tokenId).toBeTruthy();
|
|
32
|
-
expect(tokensPrices[0].
|
|
32
|
+
expect(tokensPrices[0].pricingSchedule).toBeTruthy();
|
|
33
33
|
});
|
|
34
34
|
test('should be able to get tokens direct purchase prices', async () => {
|
|
35
35
|
const tokensIdentityBalance = await sdk.tokens.getIdentitiesTokenBalances(['8eTDkBhpQjHeqgbVeriwLeZr1tCa6yBGw76SckvD1cwc'], '9YxdbQUjJmQsmVPen95HjAU3Esj7tVkWSY2EQWT84ZQP');
|
|
@@ -95,7 +95,7 @@ describe('Tokens', () => {
|
|
|
95
95
|
test('should be able to create emergency action transition', async () => {
|
|
96
96
|
const tokenId = '6niNoQpsT9zyVDJtXcbpV3tR3qEGi6BC6xoDdJyx1u7C';
|
|
97
97
|
const owner = 'HT3pUBM1Uv2mKgdPEN1gxa7A4PdsvNY89aJbdSKQb5wR';
|
|
98
|
-
const emergencyAction = TokenEmergencyActionWASM.Pause
|
|
98
|
+
const emergencyAction = 0 /* TokenEmergencyActionWASM.Pause */;
|
|
99
99
|
const tokenBaseTransition = await sdk.tokens.createBaseTransition(tokenId, owner);
|
|
100
100
|
const stateTransition = sdk.tokens.createStateTransition(tokenBaseTransition, owner, 'emergencyAction', { emergencyAction });
|
|
101
101
|
expect(stateTransition).toBeInstanceOf(StateTransitionWASM);
|
package/types.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { CoreScriptWASM, DocumentWASM, GasFeesPaidByWASM, IdentifierWASM, KeyType, Purpose, SecurityLevel, TokenEmergencyActionWASM, TokenPricingScheduleWASM } from 'pshenmic-dpp';
|
|
2
|
-
export { CoreScriptWASM, DocumentWASM, GasFeesPaidByWASM, IdentifierWASM, KeyType, Purpose, SecurityLevel, TokenEmergencyActionWASM, TokenPricingScheduleWASM, StateTransitionWASM, BatchTransitionWASM, IdentityPublicKeyWASM, PrivateKeyWASM, DataContractUpdateTransitionWASM, IdentityWASM, IdentityUpdateTransitionWASM, IdentityCreditTransferWASM, MasternodeVoteTransitionWASM } from 'pshenmic-dpp';
|
|
3
|
-
export type IdentifierLike = IdentifierWASM | string | Uint8Array;
|
|
1
|
+
import { CoreScriptWASM, DocumentWASM, GasFeesPaidByWASM, IdentifierLike, IdentifierWASM, KeyType, PlatformAddressWASM, Purpose, SecurityLevel, TokenEmergencyActionWASM, TokenPricingScheduleWASM } from 'pshenmic-dpp';
|
|
2
|
+
export { CoreScriptWASM, DocumentWASM, GasFeesPaidByWASM, IdentifierWASM, KeyType, Purpose, SecurityLevel, TokenEmergencyActionWASM, TokenPricingScheduleWASM, StateTransitionWASM, BatchTransitionWASM, IdentityPublicKeyWASM, PrivateKeyWASM, DataContractUpdateTransitionWASM, IdentityWASM, IdentityUpdateTransitionWASM, IdentityCreditTransferWASM, MasternodeVoteTransitionWASM, IdentifierLike, PlatformAddressLike } from 'pshenmic-dpp';
|
|
4
3
|
export type Network = 'mainnet' | 'testnet';
|
|
5
4
|
export { DashPlatformSDK } from './src/DashPlatformSDK.js';
|
|
6
5
|
export type MasternodeList = Record<string, MasternodeInfo>;
|
|
@@ -113,10 +112,10 @@ export interface Contender {
|
|
|
113
112
|
export interface FinishedVoteInfo {
|
|
114
113
|
type: string;
|
|
115
114
|
wonByIdentityId?: IdentifierWASM | undefined;
|
|
116
|
-
finishedAtBlockHeight:
|
|
115
|
+
finishedAtBlockHeight: bigint;
|
|
117
116
|
finishedAtCoreBlockHeight: number;
|
|
118
|
-
finishedAtBlockTimeMs:
|
|
119
|
-
finishedAtEpoch
|
|
117
|
+
finishedAtBlockTimeMs: bigint;
|
|
118
|
+
finishedAtEpoch?: number;
|
|
120
119
|
}
|
|
121
120
|
export interface ContestedResourceVoteState {
|
|
122
121
|
contenders: Contender[];
|
|
@@ -203,6 +202,11 @@ export interface TokenTotalSupply {
|
|
|
203
202
|
}
|
|
204
203
|
export interface TokenDirectPurchasePrices {
|
|
205
204
|
tokenId: IdentifierWASM;
|
|
206
|
-
|
|
205
|
+
pricingSchedule?: TokenPricingScheduleWASM | undefined;
|
|
207
206
|
}
|
|
208
207
|
export type ResourceVoteChoice = IdentifierLike | 'lock' | 'abstain';
|
|
208
|
+
export interface PlatformAddressInfo {
|
|
209
|
+
address: PlatformAddressWASM;
|
|
210
|
+
nonce: number;
|
|
211
|
+
balance: bigint;
|
|
212
|
+
}
|
package/types.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { CoreScriptWASM, DocumentWASM,
|
|
1
|
+
export { CoreScriptWASM, DocumentWASM, IdentifierWASM, TokenPricingScheduleWASM, StateTransitionWASM, BatchTransitionWASM, IdentityPublicKeyWASM, PrivateKeyWASM, DataContractUpdateTransitionWASM, IdentityWASM, IdentityUpdateTransitionWASM, IdentityCreditTransferWASM, MasternodeVoteTransitionWASM } from 'pshenmic-dpp';
|
|
2
2
|
export { DashPlatformSDK } from './src/DashPlatformSDK.js';
|
|
3
3
|
export var ContestedStateResultType;
|
|
4
4
|
(function (ContestedStateResultType) {
|