dash-platform-sdk 1.4.0-dev.1 → 1.4.0-dev.11
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 -2
- 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/contestedResources/getContestedResourceVoteState.js +1 -1
- package/src/dataContracts/create.d.ts +2 -2
- package/src/dataContracts/getDataContractByIdentifier.d.ts +1 -2
- package/src/dataContracts/index.d.ts +2 -2
- package/src/documents/create.d.ts +1 -2
- package/src/documents/index.d.ts +2 -2
- package/src/documents/index.js +1 -1
- package/src/documents/query.d.ts +1 -2
- package/src/documents/query.js +4 -6
- 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/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 +17 -6
- package/src/tokens/getIdentitiesTokenBalances.d.ts +1 -2
- package/src/tokens/getIdentityTokensBalances.d.ts +1 -2
- 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/deserializeConsensusError.d.ts +1 -0
- package/src/utils/deserializeConsensusError.js +17 -0
- package/src/utils/index.d.ts +8 -2
- package/src/utils/index.js +10 -0
- package/src/voting/index.d.ts +2 -2
- package/test/unit/Document.spec.js +29 -0
- package/test/unit/PlatformAddress.spec.d.ts +1 -0
- package/test/unit/PlatformAddress.spec.js +22 -0
- package/test/unit/SDK.spec.js +4 -0
- package/types.d.ts +7 -3
|
@@ -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/SDK.spec.js
CHANGED
|
@@ -7,4 +7,8 @@ describe('DashPlatformSDK', () => {
|
|
|
7
7
|
test('should be constructable throw `new`', () => {
|
|
8
8
|
expect(sdk).toEqual(expect.any(DashPlatformSDK));
|
|
9
9
|
});
|
|
10
|
+
test('should be able to deserialize consensus error', () => {
|
|
11
|
+
const err = sdk.utils.deserializeConsensusError('AwIiSW52YWxpZCBTdGF0ZSBUcmFuc2l0aW9uIHNpZ25hdHVyZQ');
|
|
12
|
+
expect(err).toEqual('Invalid State Transition signature');
|
|
13
|
+
});
|
|
10
14
|
});
|
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>;
|
|
@@ -206,3 +205,8 @@ export interface TokenDirectPurchasePrices {
|
|
|
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
|
+
}
|