dash-platform-sdk 1.3.0-dev.8 → 1.4.0-dev.1
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 -5
- package/proto/generated/platform.client.d.ts +10 -0
- package/proto/generated/platform.client.js +7 -0
- package/proto/generated/platform.d.ts +114 -0
- package/proto/generated/platform.js +224 -1
- package/src/DashPlatformSDK.d.ts +1 -5
- package/src/DashPlatformSDK.js +0 -5
- package/src/constants.d.ts +2 -0
- package/src/constants.js +1 -0
- package/src/contestedResources/getContestedResourceVoteState.d.ts +1 -1
- package/src/contestedResources/getContestedResourceVoteState.js +10 -5
- package/src/contestedResources/index.d.ts +1 -1
- package/src/dataContracts/create.d.ts +3 -3
- package/src/dataContracts/create.js +3 -2
- package/src/dataContracts/createStateTransition.js +0 -1
- package/src/dataContracts/getDataContractByIdentifier.d.ts +1 -1
- package/src/dataContracts/getDataContractByIdentifier.js +3 -3
- package/src/dataContracts/index.d.ts +3 -3
- package/src/documents/create.d.ts +1 -1
- package/src/documents/create.js +1 -1
- package/src/documents/createStateTransition.d.ts +1 -1
- package/src/documents/index.d.ts +3 -3
- package/src/documents/query.d.ts +3 -3
- package/src/documents/query.js +3 -3
- package/src/grpcConnectionPool.d.ts +1 -1
- package/src/identities/createStateTransition.d.ts +2 -2
- package/src/identities/createStateTransition.js +11 -1
- package/src/identities/getIdentityBalance.d.ts +1 -1
- package/src/identities/getIdentityBalance.js +3 -2
- package/src/identities/getIdentityByIdentifier.d.ts +1 -1
- package/src/identities/getIdentityByIdentifier.js +3 -2
- package/src/identities/getIdentityByNonUniquePublicKeyHash.js +3 -2
- package/src/identities/getIdentityByPublicKeyHash.js +3 -2
- package/src/identities/getIdentityContractNonce.d.ts +1 -1
- package/src/identities/getIdentityContractNonce.js +3 -2
- package/src/identities/getIdentityNonce.d.ts +1 -1
- package/src/identities/getIdentityNonce.js +3 -2
- package/src/identities/getIdentityPublicKeys.d.ts +2 -2
- package/src/identities/getIdentityPublicKeys.js +19 -9
- package/src/identities/index.d.ts +8 -5
- package/src/identities/index.js +17 -5
- package/src/keyPair/index.d.ts +1 -1
- package/src/names/index.d.ts +1 -1
- package/src/node/epochs.js +3 -2
- package/src/node/index.d.ts +1 -1
- package/src/node/status.d.ts +1 -1
- package/src/node/totalCredits.d.ts +1 -1
- package/src/node/totalCredits.js +3 -3
- package/src/stateTransitions/broadcast.js +1 -1
- package/src/stateTransitions/waitForStateTransitionResult.js +68 -5
- package/src/tokens/createStateTransition.d.ts +1 -1
- package/src/tokens/getIdentitiesTokenBalances.d.ts +2 -2
- package/src/tokens/getIdentitiesTokenBalances.js +6 -5
- package/src/tokens/getIdentityTokensBalances.d.ts +2 -2
- package/src/tokens/getIdentityTokensBalances.js +6 -5
- package/src/tokens/getTokenContractInfo.d.ts +1 -1
- package/src/tokens/getTokenContractInfo.js +3 -2
- package/src/tokens/getTokenDirectPurchasePrices.d.ts +1 -1
- package/src/tokens/getTokenDirectPurchasePrices.js +3 -2
- package/src/tokens/getTokenTotalSupply.d.ts +1 -1
- package/src/tokens/getTokenTotalSupply.js +3 -2
- package/src/tokens/index.d.ts +1 -1
- package/src/utils/getEvonodeList.d.ts +1 -1
- package/src/utils/index.d.ts +8 -0
- package/src/utils/index.js +17 -0
- package/src/voting/index.d.ts +1 -1
- package/test/unit/ContestedResources.spec.js +5 -3
- package/test/unit/DataContract.spec.js +4 -3
- package/test/unit/Document.spec.js +2 -2
- package/test/unit/Identity.spec.js +61 -27
- package/test/unit/Names.spec.js +2 -0
- package/test/unit/Tokens.spec.js +3 -3
- package/{src/types.d.ts → types.d.ts} +15 -8
- package/{src/types.js → types.js} +2 -2
- package/src/signer/AbstractSigner.d.ts +0 -12
- package/src/signer/AbstractSigner.js +0 -1
- package/src/signer/PrivateKeySigner.d.ts +0 -1
- package/src/signer/PrivateKeySigner.js +0 -65
- package/src/signer/setSigner.d.ts +0 -2
- package/src/signer/setSigner.js +0 -5
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import { IdentifierWASM, StateTransitionWASM, TokenBaseTransitionWASM } from 'pshenmic-dpp';
|
|
2
|
-
import { TokenTransitionParams, TokenTransitionType } from '
|
|
2
|
+
import { TokenTransitionParams, TokenTransitionType } from '../../types.js';
|
|
3
3
|
export default function createStateTransition(base: TokenBaseTransitionWASM, ownerId: IdentifierWASM, type: TokenTransitionType, params: TokenTransitionParams): StateTransitionWASM;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import GRPCConnectionPool from '../grpcConnectionPool.js';
|
|
2
|
-
import { IdentifierLike } from '
|
|
2
|
+
import { IdentifierLike } from '../../types.js';
|
|
3
3
|
import { IdentifierWASM } from 'pshenmic-dpp';
|
|
4
4
|
export interface IdentitiesTokenBalances {
|
|
5
5
|
identityId: IdentifierWASM;
|
|
6
|
-
balance?:
|
|
6
|
+
balance?: bigint | undefined;
|
|
7
7
|
}
|
|
8
8
|
export default function getIdentitiesTokenBalances(grpcPool: GRPCConnectionPool, identifiers: IdentifierLike[], tokenIdentifier: IdentifierLike): Promise<IdentitiesTokenBalances[]>;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { GetIdentitiesTokenBalancesRequest } from '../../proto/generated/platform.js';
|
|
2
|
-
import { IdentifierWASM,
|
|
2
|
+
import { IdentifierWASM, verifyTokenBalancesForIdentitiesProof } from 'pshenmic-dpp';
|
|
3
3
|
import { getQuorumPublicKey } from '../utils/getQuorumPublicKey.js';
|
|
4
4
|
import bytesToHex from '../utils/bytesToHex.js';
|
|
5
5
|
import verifyTenderdashProof from '../utils/verifyTenderdashProof.js';
|
|
6
|
+
import { LATEST_PLATFORM_VERSION } from '../constants.js';
|
|
6
7
|
export default async function getIdentitiesTokenBalances(grpcPool, identifiers, tokenIdentifier) {
|
|
7
8
|
const ids = identifiers.map(identifier => new IdentifierWASM(identifier));
|
|
8
9
|
const tokenId = new IdentifierWASM(tokenIdentifier);
|
|
@@ -29,15 +30,15 @@ export default async function getIdentitiesTokenBalances(grpcPool, identifiers,
|
|
|
29
30
|
if (metadata == null) {
|
|
30
31
|
throw new Error('Metadata not found');
|
|
31
32
|
}
|
|
32
|
-
const { rootHash, balances } = verifyTokenBalancesForIdentitiesProof(proof.grovedbProof, tokenId, true, ids,
|
|
33
|
+
const { rootHash, balances } = verifyTokenBalancesForIdentitiesProof(proof.grovedbProof, tokenId, true, ids, LATEST_PLATFORM_VERSION);
|
|
33
34
|
const quorumPublicKey = await getQuorumPublicKey(grpcPool.network, proof.quorumType, bytesToHex(proof.quorumHash));
|
|
34
35
|
const verify = await verifyTenderdashProof(proof, metadata, rootHash, quorumPublicKey);
|
|
35
36
|
if (!verify) {
|
|
36
37
|
throw new Error('Failed to verify query');
|
|
37
38
|
}
|
|
38
39
|
return balances
|
|
39
|
-
.map((
|
|
40
|
-
identityId: new IdentifierWASM(
|
|
41
|
-
balance
|
|
40
|
+
.map(({ id, balance }) => ({
|
|
41
|
+
identityId: new IdentifierWASM(id),
|
|
42
|
+
balance
|
|
42
43
|
}));
|
|
43
44
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import GRPCConnectionPool from '../grpcConnectionPool.js';
|
|
2
|
-
import { IdentifierLike } from '
|
|
2
|
+
import { IdentifierLike } from '../../types.js';
|
|
3
3
|
import { IdentifierWASM } from 'pshenmic-dpp';
|
|
4
4
|
export interface IdentityTokenBalances {
|
|
5
5
|
tokenId: IdentifierWASM;
|
|
6
|
-
balance?:
|
|
6
|
+
balance?: bigint | undefined;
|
|
7
7
|
}
|
|
8
8
|
export default function getIdentityTokensBalances(grpcPool: GRPCConnectionPool, identifier: IdentifierLike, tokenIdentifiers: IdentifierLike[]): Promise<IdentityTokenBalances[]>;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { IdentifierWASM,
|
|
1
|
+
import { IdentifierWASM, verifyTokensBalancesForIdentityProof } from 'pshenmic-dpp';
|
|
2
2
|
import { GetIdentityTokenBalancesRequest } from '../../proto/generated/platform.js';
|
|
3
3
|
import { getQuorumPublicKey } from '../utils/getQuorumPublicKey.js';
|
|
4
4
|
import bytesToHex from '../utils/bytesToHex.js';
|
|
5
5
|
import verifyTenderdashProof from '../utils/verifyTenderdashProof.js';
|
|
6
|
+
import { LATEST_PLATFORM_VERSION } from '../constants.js';
|
|
6
7
|
export default async function getIdentityTokensBalances(grpcPool, identifier, tokenIdentifiers) {
|
|
7
8
|
const id = new IdentifierWASM(identifier);
|
|
8
9
|
const tokenIds = tokenIdentifiers.map(tokenIdentifier => new IdentifierWASM(tokenIdentifier));
|
|
@@ -29,15 +30,15 @@ export default async function getIdentityTokensBalances(grpcPool, identifier, to
|
|
|
29
30
|
if (metadata == null) {
|
|
30
31
|
throw new Error('Metadata not found');
|
|
31
32
|
}
|
|
32
|
-
const { rootHash, balances } = verifyTokensBalancesForIdentityProof(proof.grovedbProof, tokenIds, id, true,
|
|
33
|
+
const { rootHash, balances } = verifyTokensBalancesForIdentityProof(proof.grovedbProof, tokenIds, id, true, LATEST_PLATFORM_VERSION);
|
|
33
34
|
const quorumPublicKey = await getQuorumPublicKey(grpcPool.network, proof.quorumType, bytesToHex(proof.quorumHash));
|
|
34
35
|
const verify = await verifyTenderdashProof(proof, metadata, rootHash, quorumPublicKey);
|
|
35
36
|
if (!verify) {
|
|
36
37
|
throw new Error('Failed to verify query');
|
|
37
38
|
}
|
|
38
39
|
return balances
|
|
39
|
-
.map((
|
|
40
|
-
tokenId: new IdentifierWASM(
|
|
41
|
-
balance
|
|
40
|
+
.map(({ id, balance }) => ({
|
|
41
|
+
tokenId: new IdentifierWASM(id),
|
|
42
|
+
balance
|
|
42
43
|
}));
|
|
43
44
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import GRPCConnectionPool from '../grpcConnectionPool.js';
|
|
2
|
-
import { IdentifierLike } from '
|
|
2
|
+
import { IdentifierLike } from '../../types.js';
|
|
3
3
|
import { IdentifierWASM } from 'pshenmic-dpp';
|
|
4
4
|
export interface TokenContractInfo {
|
|
5
5
|
dataContractId: IdentifierWASM;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { GetTokenContractInfoRequest } from '../../proto/generated/platform.js';
|
|
2
|
-
import { IdentifierWASM,
|
|
2
|
+
import { IdentifierWASM, verifyTokenContractInfoProof } from 'pshenmic-dpp';
|
|
3
3
|
import { getQuorumPublicKey } from '../utils/getQuorumPublicKey.js';
|
|
4
4
|
import bytesToHex from '../utils/bytesToHex.js';
|
|
5
5
|
import verifyTenderdashProof from '../utils/verifyTenderdashProof.js';
|
|
6
|
+
import { LATEST_PLATFORM_VERSION } from '../constants.js';
|
|
6
7
|
export default async function getTokenContractInfo(grpcPool, tokenIdentifier) {
|
|
7
8
|
const tokenId = new IdentifierWASM(tokenIdentifier);
|
|
8
9
|
const getTokenContractInfoRequest = GetTokenContractInfoRequest.create({
|
|
@@ -27,7 +28,7 @@ export default async function getTokenContractInfo(grpcPool, tokenIdentifier) {
|
|
|
27
28
|
if (metadata == null) {
|
|
28
29
|
throw new Error('Metadata not found');
|
|
29
30
|
}
|
|
30
|
-
const { rootHash, contractInfo } = verifyTokenContractInfoProof(proof.grovedbProof, tokenId, true,
|
|
31
|
+
const { rootHash, contractInfo } = verifyTokenContractInfoProof(proof.grovedbProof, tokenId, true, LATEST_PLATFORM_VERSION);
|
|
31
32
|
if (contractInfo == null) {
|
|
32
33
|
throw new Error('ContractInfo not found');
|
|
33
34
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import GRPCConnectionPool from '../grpcConnectionPool.js';
|
|
2
|
-
import { IdentifierLike, TokenDirectPurchasePrices } from '
|
|
2
|
+
import { IdentifierLike, TokenDirectPurchasePrices } from '../../types.js';
|
|
3
3
|
export default function getTokenDirectPurchasePrices(grpcPool: GRPCConnectionPool, tokenIdentifiers: IdentifierLike[]): Promise<TokenDirectPurchasePrices[]>;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { IdentifierWASM,
|
|
1
|
+
import { IdentifierWASM, verifyTokenDirectPurchasePrices } from 'pshenmic-dpp';
|
|
2
2
|
import { getQuorumPublicKey } from '../utils/getQuorumPublicKey.js';
|
|
3
3
|
import verifyTenderdashProof from '../utils/verifyTenderdashProof.js';
|
|
4
4
|
import bytesToHex from '../utils/bytesToHex.js';
|
|
5
5
|
import { GetTokenDirectPurchasePricesRequest } from '../../proto/generated/platform.js';
|
|
6
|
+
import { LATEST_PLATFORM_VERSION } from '../constants.js';
|
|
6
7
|
export default async function getTokenDirectPurchasePrices(grpcPool, tokenIdentifiers) {
|
|
7
8
|
const tokenIds = tokenIdentifiers.map(tokenId => new IdentifierWASM(tokenId).bytes());
|
|
8
9
|
const request = GetTokenDirectPurchasePricesRequest.create({
|
|
@@ -27,7 +28,7 @@ export default async function getTokenDirectPurchasePrices(grpcPool, tokenIdenti
|
|
|
27
28
|
if (metadata == null) {
|
|
28
29
|
throw new Error('Metadata not found');
|
|
29
30
|
}
|
|
30
|
-
const { rootHash, prices } = verifyTokenDirectPurchasePrices(proof.grovedbProof, tokenIds, true,
|
|
31
|
+
const { rootHash, prices } = verifyTokenDirectPurchasePrices(proof.grovedbProof, tokenIds, true, LATEST_PLATFORM_VERSION);
|
|
31
32
|
if (prices == null) {
|
|
32
33
|
throw new Error('Prices not found');
|
|
33
34
|
}
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import GRPCConnectionPool from '../grpcConnectionPool.js';
|
|
2
|
-
import { IdentifierLike, TokenTotalSupply } from '
|
|
2
|
+
import { IdentifierLike, TokenTotalSupply } from '../../types.js';
|
|
3
3
|
export default function getTokenTotalSupply(grpcPool: GRPCConnectionPool, tokenIdentifier: IdentifierLike): Promise<TokenTotalSupply>;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import { GetTokenTotalSupplyRequest } from '../../proto/generated/platform.js';
|
|
2
|
-
import { IdentifierWASM,
|
|
2
|
+
import { IdentifierWASM, verifyTokenTotalSupplyProof } from 'pshenmic-dpp';
|
|
3
3
|
import { getQuorumPublicKey } from '../utils/getQuorumPublicKey.js';
|
|
4
4
|
import bytesToHex from '../utils/bytesToHex.js';
|
|
5
5
|
import verifyTenderdashProof from '../utils/verifyTenderdashProof.js';
|
|
6
|
+
import { LATEST_PLATFORM_VERSION } from '../constants.js';
|
|
6
7
|
export default async function getTokenTotalSupply(grpcPool, tokenIdentifier) {
|
|
7
8
|
const tokenId = new IdentifierWASM(tokenIdentifier);
|
|
8
9
|
const getTokenTotalSupplyRequest = GetTokenTotalSupplyRequest.create({
|
|
@@ -27,7 +28,7 @@ export default async function getTokenTotalSupply(grpcPool, tokenIdentifier) {
|
|
|
27
28
|
if (metadata == null) {
|
|
28
29
|
throw new Error('Metadata not found');
|
|
29
30
|
}
|
|
30
|
-
const { rootHash, totalBalance } = verifyTokenTotalSupplyProof(proof.grovedbProof, tokenId, true,
|
|
31
|
+
const { rootHash, totalBalance } = verifyTokenTotalSupplyProof(proof.grovedbProof, tokenId, true, LATEST_PLATFORM_VERSION);
|
|
31
32
|
const quorumPublicKey = await getQuorumPublicKey(grpcPool.network, proof.quorumType, bytesToHex(proof.quorumHash));
|
|
32
33
|
const verify = await verifyTenderdashProof(proof, metadata, rootHash, quorumPublicKey);
|
|
33
34
|
if (!verify) {
|
package/src/tokens/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import GRPCConnectionPool from '../grpcConnectionPool.js';
|
|
2
|
-
import { IdentifierLike, TokenDirectPurchasePrices, TokenTotalSupply, TokenTransitionParams, TokenTransitionType } from '
|
|
2
|
+
import { IdentifierLike, 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';
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { MasternodeList, Network } from '
|
|
1
|
+
import { MasternodeList, Network } from '../../types.js';
|
|
2
2
|
export default function getDAPINodeList(network: Network): Promise<MasternodeList>;
|
package/src/utils/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { IdentifierWASM } from 'pshenmic-dpp';
|
|
2
|
+
import { IdentifierLike } from '../../types.js';
|
|
2
3
|
/**
|
|
3
4
|
* Collection of conversion functions
|
|
4
5
|
*
|
|
@@ -62,4 +63,11 @@ export declare class UtilsController {
|
|
|
62
63
|
* @return {string}
|
|
63
64
|
* */
|
|
64
65
|
createMasternodeIdentifier(proTxHash: string): IdentifierWASM;
|
|
66
|
+
/**
|
|
67
|
+
* Validates an identifier, accepts string or buffer
|
|
68
|
+
*
|
|
69
|
+
* @param identifier {IdentifierLike} identifier to test
|
|
70
|
+
* @return {boolean}
|
|
71
|
+
* */
|
|
72
|
+
validateIdentifier(identifier: IdentifierLike): boolean;
|
|
65
73
|
}
|
package/src/utils/index.js
CHANGED
|
@@ -3,6 +3,7 @@ import { base58 } from '@scure/base';
|
|
|
3
3
|
import hexToBytes from './hexToBytes.js';
|
|
4
4
|
import bytesToHex from './bytesToHex.js';
|
|
5
5
|
import { createVoterIdentityId } from './createVoterIdentityId.js';
|
|
6
|
+
import { IdentifierWASM } from 'pshenmic-dpp';
|
|
6
7
|
import { createMasternodeIdentityId } from './createMasternodeIdentityId.js';
|
|
7
8
|
/**
|
|
8
9
|
* Collection of conversion functions
|
|
@@ -81,4 +82,20 @@ export class UtilsController {
|
|
|
81
82
|
createMasternodeIdentifier(proTxHash) {
|
|
82
83
|
return createMasternodeIdentityId(proTxHash);
|
|
83
84
|
}
|
|
85
|
+
/**
|
|
86
|
+
* Validates an identifier, accepts string or buffer
|
|
87
|
+
*
|
|
88
|
+
* @param identifier {IdentifierLike} identifier to test
|
|
89
|
+
* @return {boolean}
|
|
90
|
+
* */
|
|
91
|
+
validateIdentifier(identifier) {
|
|
92
|
+
try {
|
|
93
|
+
// eslint-disable-next-line
|
|
94
|
+
new IdentifierWASM(identifier);
|
|
95
|
+
return true;
|
|
96
|
+
}
|
|
97
|
+
catch (e) {
|
|
98
|
+
return false;
|
|
99
|
+
}
|
|
100
|
+
}
|
|
84
101
|
}
|
package/src/voting/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { IdentifierLike, ResourceVoteChoice } from '
|
|
1
|
+
import { IdentifierLike, ResourceVoteChoice } from '../../types.js';
|
|
2
2
|
import { IdentifierWASM, StateTransitionWASM, VoteWASM } from 'pshenmic-dpp';
|
|
3
3
|
/**
|
|
4
4
|
* Voting controller for performing masternode votes
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { DataContractWASM,
|
|
2
|
-
import { DashPlatformSDK, ContestedStateResultType } from '../../
|
|
1
|
+
import { DataContractWASM, PrivateKeyWASM } from 'pshenmic-dpp';
|
|
2
|
+
import { DashPlatformSDK, ContestedStateResultType } from '../../types.js';
|
|
3
3
|
import stringToIndexValueBytes from '../../src/utils/stringToIndexValueBytes.js';
|
|
4
|
+
import { LATEST_PLATFORM_VERSION } from '../../src/constants.js';
|
|
4
5
|
let sdk;
|
|
5
6
|
let contract;
|
|
6
7
|
describe('Contested Resources', () => {
|
|
@@ -171,7 +172,7 @@ describe('Contested Resources', () => {
|
|
|
171
172
|
documentsMutable: false,
|
|
172
173
|
additionalProperties: false
|
|
173
174
|
}
|
|
174
|
-
}, undefined, undefined, true,
|
|
175
|
+
}, undefined, undefined, true, LATEST_PLATFORM_VERSION);
|
|
175
176
|
contract.id = 'GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec';
|
|
176
177
|
});
|
|
177
178
|
test('should be able to get contested resource vote state with finishedVoteInfo', async () => {
|
|
@@ -184,6 +185,7 @@ describe('Contested Resources', () => {
|
|
|
184
185
|
expect(voteState.contenders.length).toBeGreaterThan(0);
|
|
185
186
|
expect(voteState.abstainVoteTally).toBeDefined();
|
|
186
187
|
expect(voteState.lockVoteTally).toBeDefined();
|
|
188
|
+
expect(voteState.skipped).toBeDefined();
|
|
187
189
|
});
|
|
188
190
|
test('should be able to get contested resource vote state for incorrect values', async () => {
|
|
189
191
|
try {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { DataContractWASM, StateTransitionWASM } from 'pshenmic-dpp';
|
|
2
|
-
import { DashPlatformSDK } from '../../
|
|
2
|
+
import { DashPlatformSDK } from '../../types.js';
|
|
3
3
|
let sdk;
|
|
4
4
|
let ownerIdentifier;
|
|
5
5
|
let identityNonce;
|
|
@@ -11,7 +11,7 @@ describe('DataContract', () => {
|
|
|
11
11
|
ownerIdentifier = 'GARSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec';
|
|
12
12
|
identityNonce = BigInt(11);
|
|
13
13
|
config = {
|
|
14
|
-
$format_version: '
|
|
14
|
+
$format_version: '1',
|
|
15
15
|
canBeDeleted: true,
|
|
16
16
|
readonly: true,
|
|
17
17
|
keepsHistory: false,
|
|
@@ -19,7 +19,8 @@ describe('DataContract', () => {
|
|
|
19
19
|
documentsMutableContractDefault: false,
|
|
20
20
|
documentsCanBeDeletedContractDefault: true,
|
|
21
21
|
requiresIdentityEncryptionBoundedKey: null,
|
|
22
|
-
requiresIdentityDecryptionBoundedKey: null
|
|
22
|
+
requiresIdentityDecryptionBoundedKey: null,
|
|
23
|
+
sizedIntegerTypes: true
|
|
23
24
|
};
|
|
24
25
|
schema = {
|
|
25
26
|
note: {
|
|
@@ -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;
|
|
@@ -67,7 +67,7 @@ describe('Document', () => {
|
|
|
67
67
|
tokenContractPosition: 0,
|
|
68
68
|
minimumTokenCost: BigInt(1000),
|
|
69
69
|
maximumTokenCost: BigInt(100000),
|
|
70
|
-
gasFeesPaidBy: GasFeesPaidByWASM.ContractOwner
|
|
70
|
+
gasFeesPaidBy: 1 /* GasFeesPaidByWASM.ContractOwner */
|
|
71
71
|
};
|
|
72
72
|
const stateTransition = sdk.documents.createStateTransition(document, 'create', { identityContractNonce, tokenPaymentInfo });
|
|
73
73
|
expect(stateTransition).toEqual(expect.any(StateTransitionWASM));
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { IdentityPublicKeyWASM, IdentityWASM,
|
|
2
|
-
import { DashPlatformSDK } from '../../
|
|
1
|
+
import { CoreScriptWASM, IdentityPublicKeyWASM, IdentityWASM, PrivateKeyWASM, StateTransitionWASM } from 'pshenmic-dpp';
|
|
2
|
+
import { DashPlatformSDK } from '../../types.js';
|
|
3
|
+
import { base58 } from '@scure/base';
|
|
3
4
|
let sdk;
|
|
4
5
|
describe('Identity', () => {
|
|
5
6
|
beforeAll(() => {
|
|
@@ -49,18 +50,18 @@ describe('Identity', () => {
|
|
|
49
50
|
const privateKey1 = PrivateKeyWASM.fromHex('a1286dd195e2b8e1f6bdc946c56a53e0c544750d6452ddc0f4c593ef311f21af', 'testnet');
|
|
50
51
|
const identityPublicKeyInCreation1 = {
|
|
51
52
|
id: 0,
|
|
52
|
-
purpose: Purpose.AUTHENTICATION
|
|
53
|
-
securityLevel: SecurityLevel.MASTER
|
|
54
|
-
keyType: KeyType.ECDSA_SECP256K1
|
|
53
|
+
purpose: 0 /* Purpose.AUTHENTICATION */,
|
|
54
|
+
securityLevel: 0 /* SecurityLevel.MASTER */,
|
|
55
|
+
keyType: 0 /* KeyType.ECDSA_SECP256K1 */,
|
|
55
56
|
readOnly: false,
|
|
56
57
|
data: privateKey1.getPublicKey().bytes()
|
|
57
58
|
};
|
|
58
59
|
const privateKey2 = PrivateKeyWASM.fromHex('44a8195e242364b935e9d7ff2106ed109e9baf3800907f5e58a259fdfd1ca5e5', 'testnet');
|
|
59
60
|
const identityPublicKeyInCreation2 = {
|
|
60
61
|
id: 1,
|
|
61
|
-
purpose: Purpose.AUTHENTICATION
|
|
62
|
-
securityLevel: SecurityLevel.HIGH
|
|
63
|
-
keyType: KeyType.ECDSA_SECP256K1
|
|
62
|
+
purpose: 0 /* Purpose.AUTHENTICATION */,
|
|
63
|
+
securityLevel: 2 /* SecurityLevel.HIGH */,
|
|
64
|
+
keyType: 0 /* KeyType.ECDSA_SECP256K1 */,
|
|
64
65
|
readOnly: false,
|
|
65
66
|
data: privateKey2.getPublicKey().bytes()
|
|
66
67
|
};
|
|
@@ -75,7 +76,7 @@ describe('Identity', () => {
|
|
|
75
76
|
type: 'chainLock'
|
|
76
77
|
}
|
|
77
78
|
});
|
|
78
|
-
identityCreateStateTransition.signByPrivateKey(privateKey1, KeyType.ECDSA_SECP256K1);
|
|
79
|
+
identityCreateStateTransition.signByPrivateKey(privateKey1, 0 /* KeyType.ECDSA_SECP256K1 */);
|
|
79
80
|
identityPublicKeyInCreation1.signature = identityCreateStateTransition.signature;
|
|
80
81
|
// Set identity public key signature for public key 1
|
|
81
82
|
identityCreateStateTransition = sdk.identities.createStateTransition('create', {
|
|
@@ -87,7 +88,7 @@ describe('Identity', () => {
|
|
|
87
88
|
type: 'chainLock'
|
|
88
89
|
}
|
|
89
90
|
});
|
|
90
|
-
identityCreateStateTransition.signByPrivateKey(privateKey2, KeyType.ECDSA_SECP256K1);
|
|
91
|
+
identityCreateStateTransition.signByPrivateKey(privateKey2, 0 /* KeyType.ECDSA_SECP256K1 */);
|
|
91
92
|
identityPublicKeyInCreation2.signature = identityCreateStateTransition.signature;
|
|
92
93
|
// Finalize
|
|
93
94
|
identityCreateStateTransition = sdk.identities.createStateTransition('create', {
|
|
@@ -99,7 +100,7 @@ describe('Identity', () => {
|
|
|
99
100
|
type: 'chainLock'
|
|
100
101
|
}
|
|
101
102
|
});
|
|
102
|
-
identityCreateStateTransition.signByPrivateKey(assetLockPrivateKey, KeyType.ECDSA_SECP256K1);
|
|
103
|
+
identityCreateStateTransition.signByPrivateKey(assetLockPrivateKey, 0 /* KeyType.ECDSA_SECP256K1 */);
|
|
103
104
|
});
|
|
104
105
|
test('should be able to create IdentityCreateTransition via InstantSend', async () => {
|
|
105
106
|
const assetLockPrivateKey = PrivateKeyWASM.fromHex('edd04a71bddb31e530f6c2314fd42ada333f6656bb853ece13f0577a8fd30612', 'testnet');
|
|
@@ -109,18 +110,18 @@ describe('Identity', () => {
|
|
|
109
110
|
const privateKey1 = PrivateKeyWASM.fromHex('a1286dd195e2b8e1f6bdc946c56a53e0c544750d6452ddc0f4c593ef311f21af', 'testnet');
|
|
110
111
|
const identityPublicKeyInCreation1 = {
|
|
111
112
|
id: 0,
|
|
112
|
-
purpose: Purpose.AUTHENTICATION
|
|
113
|
-
securityLevel: SecurityLevel.MASTER
|
|
114
|
-
keyType: KeyType.ECDSA_SECP256K1
|
|
113
|
+
purpose: 0 /* Purpose.AUTHENTICATION */,
|
|
114
|
+
securityLevel: 0 /* SecurityLevel.MASTER */,
|
|
115
|
+
keyType: 0 /* KeyType.ECDSA_SECP256K1 */,
|
|
115
116
|
readOnly: false,
|
|
116
117
|
data: privateKey1.getPublicKey().bytes()
|
|
117
118
|
};
|
|
118
119
|
const privateKey2 = PrivateKeyWASM.fromHex('44a8195e242364b935e9d7ff2106ed109e9baf3800907f5e58a259fdfd1ca5e5', 'testnet');
|
|
119
120
|
const identityPublicKeyInCreation2 = {
|
|
120
121
|
id: 1,
|
|
121
|
-
purpose: Purpose.AUTHENTICATION
|
|
122
|
-
securityLevel: SecurityLevel.HIGH
|
|
123
|
-
keyType: KeyType.ECDSA_SECP256K1
|
|
122
|
+
purpose: 0 /* Purpose.AUTHENTICATION */,
|
|
123
|
+
securityLevel: 2 /* SecurityLevel.HIGH */,
|
|
124
|
+
keyType: 0 /* KeyType.ECDSA_SECP256K1 */,
|
|
124
125
|
readOnly: false,
|
|
125
126
|
data: privateKey2.getPublicKey().bytes()
|
|
126
127
|
};
|
|
@@ -135,7 +136,7 @@ describe('Identity', () => {
|
|
|
135
136
|
type: 'instantLock'
|
|
136
137
|
}
|
|
137
138
|
});
|
|
138
|
-
identityCreateStateTransition.signByPrivateKey(privateKey1, KeyType.ECDSA_SECP256K1);
|
|
139
|
+
identityCreateStateTransition.signByPrivateKey(privateKey1, 0 /* KeyType.ECDSA_SECP256K1 */);
|
|
139
140
|
identityPublicKeyInCreation1.signature = identityCreateStateTransition.signature;
|
|
140
141
|
// Set identity public key signature for public key 1
|
|
141
142
|
identityCreateStateTransition = sdk.identities.createStateTransition('create', {
|
|
@@ -147,7 +148,7 @@ describe('Identity', () => {
|
|
|
147
148
|
type: 'instantLock'
|
|
148
149
|
}
|
|
149
150
|
});
|
|
150
|
-
identityCreateStateTransition.signByPrivateKey(privateKey2, KeyType.ECDSA_SECP256K1);
|
|
151
|
+
identityCreateStateTransition.signByPrivateKey(privateKey2, 0 /* KeyType.ECDSA_SECP256K1 */);
|
|
151
152
|
identityPublicKeyInCreation2.signature = identityCreateStateTransition.signature;
|
|
152
153
|
// Finalize
|
|
153
154
|
identityCreateStateTransition = sdk.identities.createStateTransition('create', {
|
|
@@ -159,7 +160,7 @@ describe('Identity', () => {
|
|
|
159
160
|
type: 'instantLock'
|
|
160
161
|
}
|
|
161
162
|
});
|
|
162
|
-
identityCreateStateTransition.signByPrivateKey(assetLockPrivateKey, KeyType.ECDSA_SECP256K1);
|
|
163
|
+
identityCreateStateTransition.signByPrivateKey(assetLockPrivateKey, 0 /* KeyType.ECDSA_SECP256K1 */);
|
|
163
164
|
});
|
|
164
165
|
test('should be able to create IdentityTopUpTransition via InstantSend', async () => {
|
|
165
166
|
const transaction = '03000800011a468e6a7cf1c5111b09b7bca6743f2571a9bf13d2ff6d21d3d230fd1dea1e97000000006b483045022100fceb25c45e77e1a273660e4f4c9a09042fb858a57704806e14bf80a734af232a02201929893dd720cf5855e31dda577cda16df29520a9774b4f3e813a4cc468fe086012103e16ede6dc5c99f28e3a5733f47a7494992bc6ce4f98551c092645910b9888b8fffffffff0200e1f50500000000026a004054fa02000000001976a91416bbe230f46eea86fc4bf4dd550be45dc9adfcb488ac0000000024010100e1f505000000001976a9147f78813975a3282e09e284d97d93c083b202e34188ac';
|
|
@@ -176,7 +177,7 @@ describe('Identity', () => {
|
|
|
176
177
|
type: 'instantLock'
|
|
177
178
|
}
|
|
178
179
|
});
|
|
179
|
-
identityTopUpTransaction.signByPrivateKey(assetLockPrivateKey, undefined, KeyType.ECDSA_SECP256K1);
|
|
180
|
+
identityTopUpTransaction.signByPrivateKey(assetLockPrivateKey, undefined, 0 /* KeyType.ECDSA_SECP256K1 */);
|
|
180
181
|
});
|
|
181
182
|
test('should be able to create IdentityTopUpTransition via ChainLock', async () => {
|
|
182
183
|
const txid = '61aede830477254876d435a317241ad46753c4b1350dc991a45ebcf19ab80a11';
|
|
@@ -193,7 +194,7 @@ describe('Identity', () => {
|
|
|
193
194
|
type: 'chainLock'
|
|
194
195
|
}
|
|
195
196
|
});
|
|
196
|
-
identityTopUpTransaction.signByPrivateKey(assetLockPrivateKey, undefined, KeyType.ECDSA_SECP256K1);
|
|
197
|
+
identityTopUpTransaction.signByPrivateKey(assetLockPrivateKey, undefined, 0 /* KeyType.ECDSA_SECP256K1 */);
|
|
197
198
|
});
|
|
198
199
|
test('should be able to create IdentityUpdateTransition', async () => {
|
|
199
200
|
const identityId = 'HT3pUBM1Uv2mKgdPEN1gxa7A4PdsvNY89aJbdSKQb5wR';
|
|
@@ -206,9 +207,9 @@ describe('Identity', () => {
|
|
|
206
207
|
const identityPrivateKey = PrivateKeyWASM.fromHex('16f614c6242580628d849e3616491dda1eccce99642a85667eb9a364dc85324a', 'testnet');
|
|
207
208
|
const identityPublicKeyInCreation = {
|
|
208
209
|
id: keyId,
|
|
209
|
-
purpose: Purpose.AUTHENTICATION
|
|
210
|
-
securityLevel: SecurityLevel.HIGH
|
|
211
|
-
keyType: KeyType.ECDSA_SECP256K1
|
|
210
|
+
purpose: 0 /* Purpose.AUTHENTICATION */,
|
|
211
|
+
securityLevel: 2 /* SecurityLevel.HIGH */,
|
|
212
|
+
keyType: 0 /* KeyType.ECDSA_SECP256K1 */,
|
|
212
213
|
readOnly: false,
|
|
213
214
|
data: identityPrivateKey.getPublicKey().bytes()
|
|
214
215
|
};
|
|
@@ -218,7 +219,7 @@ describe('Identity', () => {
|
|
|
218
219
|
identityNonce,
|
|
219
220
|
addPublicKeys: [identityPublicKeyInCreation]
|
|
220
221
|
});
|
|
221
|
-
identityUpdateTransition.signByPrivateKey(masterPrivateKey, masterKeyId, KeyType.ECDSA_SECP256K1);
|
|
222
|
+
identityUpdateTransition.signByPrivateKey(masterPrivateKey, masterKeyId, 0 /* KeyType.ECDSA_SECP256K1 */);
|
|
222
223
|
identityPublicKeyInCreation.signature = identityUpdateTransition.signature;
|
|
223
224
|
identityUpdateTransition = sdk.identities.createStateTransition('update', {
|
|
224
225
|
identityId,
|
|
@@ -226,7 +227,40 @@ describe('Identity', () => {
|
|
|
226
227
|
identityNonce,
|
|
227
228
|
addPublicKeys: [identityPublicKeyInCreation]
|
|
228
229
|
});
|
|
229
|
-
identityUpdateTransition.signByPrivateKey(masterPrivateKey, masterKeyId, KeyType.ECDSA_SECP256K1);
|
|
230
|
+
identityUpdateTransition.signByPrivateKey(masterPrivateKey, masterKeyId, 0 /* KeyType.ECDSA_SECP256K1 */);
|
|
231
|
+
});
|
|
232
|
+
test('should able be create credit transfer transition', async () => {
|
|
233
|
+
const identityId = 'QMfCRPcjXoTnZa9sA9JR2KWgGxZXMRJ4akgS3Uia1Qv';
|
|
234
|
+
const recipientId = 'HT3pUBM1Uv2mKgdPEN1gxa7A4PdsvNY89aJbdSKQb5wR';
|
|
235
|
+
const amount = 100000n;
|
|
236
|
+
const identityNonce = await sdk.identities.getIdentityNonce(identityId);
|
|
237
|
+
const stateTransition = sdk.identities.createStateTransition('creditTransfer', { identityId, identityNonce, recipientId, amount });
|
|
238
|
+
expect(stateTransition).toEqual(expect.any(StateTransitionWASM));
|
|
239
|
+
});
|
|
240
|
+
test('should be able create credit withdrawal', async () => {
|
|
241
|
+
const identityId = 'QMfCRPcjXoTnZa9sA9JR2KWgGxZXMRJ4akgS3Uia1Qv';
|
|
242
|
+
const amount = 100000n;
|
|
243
|
+
const identityNonce = await sdk.identities.getIdentityNonce(identityId);
|
|
244
|
+
const withdrawalAddress = 'yjHVQ3dj37UJwXFmvMTKR9ZVfoJSc3opTD';
|
|
245
|
+
const stateTransition = sdk.identities.createStateTransition('withdrawal', { identityId, identityNonce, amount, withdrawalAddress });
|
|
246
|
+
expect(stateTransition).toEqual(expect.any(StateTransitionWASM));
|
|
247
|
+
});
|
|
248
|
+
test('should be able create credit withdrawal with custom CoreScript', async () => {
|
|
249
|
+
const identityId = 'QMfCRPcjXoTnZa9sA9JR2KWgGxZXMRJ4akgS3Uia1Qv';
|
|
250
|
+
const amount = 100000n;
|
|
251
|
+
const identityNonce = await sdk.identities.getIdentityNonce(identityId);
|
|
252
|
+
const withdrawalAddress = 'yjHVQ3dj37UJwXFmvMTKR9ZVfoJSc3opTD';
|
|
253
|
+
const outputScript = CoreScriptWASM.newP2PKH(base58.decode(withdrawalAddress).slice(1, 21));
|
|
254
|
+
const stateTransition = sdk.identities.createStateTransition('withdrawal', { identityId, identityNonce, amount, outputScript });
|
|
255
|
+
expect(stateTransition).toEqual(expect.any(StateTransitionWASM));
|
|
256
|
+
});
|
|
257
|
+
test('should be able create credit withdrawal with no withdrawal address', async () => {
|
|
258
|
+
const identityId = 'QMfCRPcjXoTnZa9sA9JR2KWgGxZXMRJ4akgS3Uia1Qv';
|
|
259
|
+
const recipientId = 'HT3pUBM1Uv2mKgdPEN1gxa7A4PdsvNY89aJbdSKQb5wR';
|
|
260
|
+
const amount = 100000n;
|
|
261
|
+
const identityNonce = await sdk.identities.getIdentityNonce(identityId);
|
|
262
|
+
const stateTransition = sdk.identities.createStateTransition('creditTransfer', { identityId, recipientId, amount, identityNonce });
|
|
263
|
+
expect(stateTransition).toEqual(expect.any(StateTransitionWASM));
|
|
230
264
|
});
|
|
231
265
|
});
|
|
232
266
|
});
|
package/test/unit/Names.spec.js
CHANGED
|
@@ -2,6 +2,7 @@ import broadcast from '../../src/stateTransitions/broadcast.js';
|
|
|
2
2
|
import { DocumentWASM, PrivateKeyWASM } from 'pshenmic-dpp';
|
|
3
3
|
import { DashPlatformSDK } from '../../src/DashPlatformSDK.js';
|
|
4
4
|
import sleep from '../../src/utils/sleep.js';
|
|
5
|
+
jest.mock('../../src/stateTransitions/waitForStateTransitionResult');
|
|
5
6
|
jest.mock('../../src/stateTransitions/broadcast');
|
|
6
7
|
jest.mock('../../src/utils/sleep');
|
|
7
8
|
let sdk;
|
|
@@ -11,6 +12,7 @@ describe('DPNS names', () => {
|
|
|
11
12
|
// @ts-expect-error
|
|
12
13
|
sleep.mockReturnValue(Promise.resolve());
|
|
13
14
|
sdk.stateTransitions.broadcast = jest.fn();
|
|
15
|
+
sdk.stateTransitions.waitForStateTransitionResult = jest.fn();
|
|
14
16
|
});
|
|
15
17
|
test('should be able to search names by DPNS name', async () => {
|
|
16
18
|
const documents = await sdk.names.searchByName('xyz.dash');
|
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);
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { DocumentWASM, GasFeesPaidByWASM, IdentifierWASM, KeyType, Purpose, SecurityLevel, TokenEmergencyActionWASM, TokenPricingScheduleWASM } from 'pshenmic-dpp';
|
|
2
|
-
export { IdentifierWASM,
|
|
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
3
|
export type IdentifierLike = IdentifierWASM | string | Uint8Array;
|
|
4
4
|
export type Network = 'mainnet' | 'testnet';
|
|
5
|
-
export { DashPlatformSDK } from './DashPlatformSDK.js';
|
|
5
|
+
export { DashPlatformSDK } from './src/DashPlatformSDK.js';
|
|
6
6
|
export type MasternodeList = Record<string, MasternodeInfo>;
|
|
7
|
-
export { AbstractSigner } from './signer/AbstractSigner.js';
|
|
8
7
|
export interface DocumentTransitionParams {
|
|
9
8
|
identityContractNonce: bigint;
|
|
10
9
|
amount?: bigint;
|
|
@@ -114,15 +113,16 @@ export interface Contender {
|
|
|
114
113
|
export interface FinishedVoteInfo {
|
|
115
114
|
type: string;
|
|
116
115
|
wonByIdentityId?: IdentifierWASM | undefined;
|
|
117
|
-
finishedAtBlockHeight:
|
|
116
|
+
finishedAtBlockHeight: bigint;
|
|
118
117
|
finishedAtCoreBlockHeight: number;
|
|
119
|
-
finishedAtBlockTimeMs:
|
|
120
|
-
finishedAtEpoch
|
|
118
|
+
finishedAtBlockTimeMs: bigint;
|
|
119
|
+
finishedAtEpoch?: number;
|
|
121
120
|
}
|
|
122
121
|
export interface ContestedResourceVoteState {
|
|
123
122
|
contenders: Contender[];
|
|
124
123
|
abstainVoteTally?: number | undefined;
|
|
125
124
|
lockVoteTally?: number | undefined;
|
|
125
|
+
skipped: boolean;
|
|
126
126
|
finishedVoteInfo?: FinishedVoteInfo;
|
|
127
127
|
}
|
|
128
128
|
export interface DataContractConfig {
|
|
@@ -135,6 +135,7 @@ export interface DataContractConfig {
|
|
|
135
135
|
documentsCanBeDeletedContractDefault: boolean;
|
|
136
136
|
requiresIdentityEncryptionBoundedKey?: number | null;
|
|
137
137
|
requiresIdentityDecryptionBoundedKey?: number | null;
|
|
138
|
+
sizedIntegerTypes: boolean;
|
|
138
139
|
}
|
|
139
140
|
export type TokenTransitionType = 'burn' | 'mint' | 'transfer' | 'freeze' | 'unfreeze' | 'destroyFrozenFunds' | 'emergencyAction' | 'directPurchase' | 'setPriceForDirectPurchase';
|
|
140
141
|
export interface TokenTransitionParams {
|
|
@@ -186,7 +187,13 @@ export interface IdentityTransitionParams {
|
|
|
186
187
|
disablePublicKeyIds?: number[];
|
|
187
188
|
revision?: bigint;
|
|
188
189
|
identityNonce?: bigint;
|
|
190
|
+
amount?: bigint;
|
|
189
191
|
identityId?: IdentifierLike;
|
|
192
|
+
recipientId?: IdentifierLike;
|
|
193
|
+
withdrawalAddress?: string;
|
|
194
|
+
outputScript?: CoreScriptWASM;
|
|
195
|
+
pooling?: 'Standard' | 'Never' | 'IfAvailable';
|
|
196
|
+
coreFeePerByte?: number;
|
|
190
197
|
userFeeIncrease?: number;
|
|
191
198
|
}
|
|
192
199
|
export interface TokenTotalSupply {
|
|
@@ -196,6 +203,6 @@ export interface TokenTotalSupply {
|
|
|
196
203
|
}
|
|
197
204
|
export interface TokenDirectPurchasePrices {
|
|
198
205
|
tokenId: IdentifierWASM;
|
|
199
|
-
|
|
206
|
+
pricingSchedule?: TokenPricingScheduleWASM | undefined;
|
|
200
207
|
}
|
|
201
208
|
export type ResourceVoteChoice = IdentifierLike | 'lock' | 'abstain';
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export { DashPlatformSDK } from './DashPlatformSDK.js';
|
|
1
|
+
export { CoreScriptWASM, DocumentWASM, IdentifierWASM, TokenPricingScheduleWASM, StateTransitionWASM, BatchTransitionWASM, IdentityPublicKeyWASM, PrivateKeyWASM, DataContractUpdateTransitionWASM, IdentityWASM, IdentityUpdateTransitionWASM, IdentityCreditTransferWASM, MasternodeVoteTransitionWASM } from 'pshenmic-dpp';
|
|
2
|
+
export { DashPlatformSDK } from './src/DashPlatformSDK.js';
|
|
3
3
|
export var ContestedStateResultType;
|
|
4
4
|
(function (ContestedStateResultType) {
|
|
5
5
|
ContestedStateResultType[ContestedStateResultType["DOCUMENTS"] = 0] = "DOCUMENTS";
|