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.
Files changed (51) hide show
  1. package/bundle.min.js +17 -17
  2. package/package.json +2 -2
  3. package/proto/generated/platform.client.d.ts +20 -0
  4. package/proto/generated/platform.client.js +14 -0
  5. package/proto/generated/platform.d.ts +293 -0
  6. package/proto/generated/platform.js +603 -1
  7. package/src/DashPlatformSDK.d.ts +3 -1
  8. package/src/DashPlatformSDK.js +8 -5
  9. package/src/contestedResources/getContestedResourceVoteState.js +1 -1
  10. package/src/dataContracts/create.d.ts +2 -2
  11. package/src/dataContracts/getDataContractByIdentifier.d.ts +1 -2
  12. package/src/dataContracts/index.d.ts +2 -2
  13. package/src/documents/create.d.ts +1 -2
  14. package/src/documents/index.d.ts +2 -2
  15. package/src/documents/index.js +1 -1
  16. package/src/documents/query.d.ts +1 -2
  17. package/src/documents/query.js +4 -6
  18. package/src/identities/getIdentityBalance.d.ts +1 -1
  19. package/src/identities/getIdentityByIdentifier.d.ts +1 -2
  20. package/src/identities/getIdentityContractNonce.d.ts +1 -1
  21. package/src/identities/getIdentityNonce.d.ts +1 -1
  22. package/src/identities/getIdentityPublicKeys.d.ts +1 -2
  23. package/src/identities/index.d.ts +2 -2
  24. package/src/names/index.d.ts +1 -2
  25. package/src/node/index.d.ts +2 -3
  26. package/src/node/index.js +2 -4
  27. package/src/node/totalCredits.d.ts +1 -2
  28. package/src/node/totalCredits.js +2 -2
  29. package/src/platformAddresses/getAddressInfo.d.ts +4 -0
  30. package/src/platformAddresses/getAddressInfo.js +45 -0
  31. package/src/platformAddresses/getAddressesInfos.d.ts +4 -0
  32. package/src/platformAddresses/getAddressesInfos.js +43 -0
  33. package/src/platformAddresses/index.d.ts +22 -0
  34. package/src/platformAddresses/index.js +27 -0
  35. package/src/stateTransitions/broadcast.js +17 -6
  36. package/src/tokens/getIdentitiesTokenBalances.d.ts +1 -2
  37. package/src/tokens/getIdentityTokensBalances.d.ts +1 -2
  38. package/src/tokens/getTokenContractInfo.d.ts +1 -2
  39. package/src/tokens/getTokenDirectPurchasePrices.d.ts +2 -1
  40. package/src/tokens/getTokenTotalSupply.d.ts +2 -1
  41. package/src/tokens/index.d.ts +2 -2
  42. package/src/utils/deserializeConsensusError.d.ts +1 -0
  43. package/src/utils/deserializeConsensusError.js +17 -0
  44. package/src/utils/index.d.ts +8 -2
  45. package/src/utils/index.js +10 -0
  46. package/src/voting/index.d.ts +2 -2
  47. package/test/unit/Document.spec.js +29 -0
  48. package/test/unit/PlatformAddress.spec.d.ts +1 -0
  49. package/test/unit/PlatformAddress.spec.js +22 -0
  50. package/test/unit/SDK.spec.js +4 -0
  51. 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
+ });
@@ -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
+ }