dash-platform-sdk 1.3.0-dev.4 → 1.3.0-dev.6

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 (138) hide show
  1. package/bundle.min.js +21 -2
  2. package/index.js +2 -5
  3. package/package.json +30 -31
  4. package/proto/generated/google/protobuf/wrappers.d.ts +260 -29
  5. package/proto/generated/google/protobuf/wrappers.js +562 -345
  6. package/proto/generated/platform.client.d.ts +251 -0
  7. package/proto/generated/platform.client.js +175 -0
  8. package/proto/generated/platform.d.ts +3682 -1939
  9. package/proto/generated/platform.js +8119 -18366
  10. package/src/DashPlatformSDK.d.ts +5 -4
  11. package/src/DashPlatformSDK.js +56 -46
  12. package/src/constants.js +7 -10
  13. package/src/contestedResources/createStateTransition.d.ts +1 -2
  14. package/src/contestedResources/createStateTransition.js +4 -7
  15. package/src/contestedResources/getContestedResourceVoteState.js +67 -118
  16. package/src/contestedResources/index.js +9 -55
  17. package/src/dataContracts/create.js +5 -8
  18. package/src/dataContracts/createStateTransition.js +10 -14
  19. package/src/dataContracts/getDataContractByIdentifier.js +40 -83
  20. package/src/dataContracts/index.js +17 -63
  21. package/src/documents/create.js +3 -6
  22. package/src/documents/createStateTransition.js +19 -31
  23. package/src/documents/index.js +25 -72
  24. package/src/documents/query.js +58 -90
  25. package/src/grpcConnectionPool.d.ts +30 -8
  26. package/src/grpcConnectionPool.js +63 -121
  27. package/src/identities/createStateTransition.js +14 -26
  28. package/src/identities/getIdentityBalance.js +37 -80
  29. package/src/identities/getIdentityByIdentifier.js +37 -80
  30. package/src/identities/getIdentityByNonUniquePublicKeyHash.js +41 -82
  31. package/src/identities/getIdentityByPublicKeyHash.js +37 -80
  32. package/src/identities/getIdentityContractNonce.js +40 -83
  33. package/src/identities/getIdentityNonce.js +38 -81
  34. package/src/identities/getIdentityPublicKeys.js +43 -81
  35. package/src/identities/index.js +57 -153
  36. package/src/keyPair/deriveChild.d.ts +2 -2
  37. package/src/keyPair/deriveChild.js +2 -49
  38. package/src/keyPair/derivePath.d.ts +2 -2
  39. package/src/keyPair/derivePath.js +2 -49
  40. package/src/keyPair/index.d.ts +39 -114
  41. package/src/keyPair/index.js +62 -296
  42. package/src/keyPair/mnemonicToSeed.d.ts +1 -1
  43. package/src/keyPair/mnemonicToSeed.js +3 -46
  44. package/src/names/index.js +43 -111
  45. package/src/names/registerName.js +60 -127
  46. package/src/names/searchByIdentity.d.ts +1 -1
  47. package/src/names/searchByIdentity.js +4 -50
  48. package/src/names/searchByName.js +15 -63
  49. package/src/names/testNameContested.js +1 -4
  50. package/src/names/validateName.js +3 -6
  51. package/src/node/epochs.js +43 -85
  52. package/src/node/index.d.ts +3 -3
  53. package/src/node/index.js +18 -77
  54. package/src/node/status.js +37 -81
  55. package/src/node/totalCredits.d.ts +2 -1
  56. package/src/node/totalCredits.js +32 -73
  57. package/src/signer/AbstractSigner.js +1 -2
  58. package/src/signer/setSigner.js +1 -4
  59. package/src/stateTransitions/broadcast.js +7 -57
  60. package/src/stateTransitions/index.js +13 -66
  61. package/src/stateTransitions/waitForStateTransitionResult.js +6 -58
  62. package/src/tokens/createStateTransition.js +23 -35
  63. package/src/tokens/getIdentitiesTokenBalances.js +40 -83
  64. package/src/tokens/getIdentityTokensBalances.js +40 -83
  65. package/src/tokens/getTokenContractInfo.js +40 -83
  66. package/src/tokens/getTokenDirectPurchasePrices.js +37 -80
  67. package/src/tokens/getTokenTotalSupply.js +38 -81
  68. package/src/tokens/index.js +39 -124
  69. package/src/types.d.ts +6 -12
  70. package/src/types.js +6 -16
  71. package/src/utils/base58ToBytes.js +3 -6
  72. package/src/utils/bytesToHex.js +2 -5
  73. package/src/utils/bytesToTypedArray.d.ts +1 -0
  74. package/src/utils/bytesToTypedArray.js +3 -0
  75. package/src/utils/calculateMsgHash.d.ts +1 -1
  76. package/src/utils/calculateMsgHash.js +10 -13
  77. package/src/utils/calculateSignHash.d.ts +1 -1
  78. package/src/utils/calculateSignHash.js +7 -10
  79. package/src/utils/calculateStateIdHash.d.ts +1 -1
  80. package/src/utils/calculateStateIdHash.js +8 -10
  81. package/src/utils/convertToHomographSafeChars.js +2 -5
  82. package/src/utils/createVoterIdentityId.d.ts +1 -1
  83. package/src/utils/createVoterIdentityId.js +12 -11
  84. package/src/utils/getEvonodeList.d.ts +2 -2
  85. package/src/utils/getEvonodeList.js +10 -61
  86. package/src/utils/getQuorumPublicKey.js +15 -66
  87. package/src/utils/getRandomArrayItem.js +1 -4
  88. package/src/utils/getRandomBytes.js +2 -5
  89. package/src/utils/hexToBytes.js +2 -6
  90. package/src/utils/index.js +21 -28
  91. package/src/utils/indexBytesToString.js +2 -5
  92. package/src/utils/sha256.d.ts +1 -1
  93. package/src/utils/sha256.js +10 -8
  94. package/src/utils/signHash.d.ts +1 -1
  95. package/src/utils/signHash.js +9 -12
  96. package/src/utils/signRequestId.d.ts +1 -1
  97. package/src/utils/signRequestId.js +9 -12
  98. package/src/utils/sleep.js +2 -50
  99. package/src/utils/stringToIndexValueBytes.js +4 -7
  100. package/src/utils/verifyTenderdashProof.d.ts +1 -1
  101. package/src/utils/verifyTenderdashProof.js +13 -17
  102. package/src/voting/createStateTransition.d.ts +1 -2
  103. package/src/voting/createStateTransition.js +4 -7
  104. package/src/voting/createVote.js +4 -7
  105. package/src/voting/index.d.ts +3 -4
  106. package/src/voting/index.js +19 -26
  107. package/test/unit/ContestedResources.spec.js +92 -177
  108. package/test/unit/DataContract.spec.js +44 -111
  109. package/test/unit/Document.spec.js +93 -183
  110. package/test/unit/Identity.spec.js +221 -346
  111. package/test/unit/KeyPair.spec.js +30 -145
  112. package/test/unit/Names.spec.js +27 -90
  113. package/test/unit/Node.spec.js +55 -126
  114. package/test/unit/SDK.spec.js +7 -9
  115. package/test/unit/Tokens.spec.js +111 -278
  116. package/bundle.min.js.LICENSE.txt +0 -1
  117. package/src/keyPair/keyToPublicKey.d.ts +0 -2
  118. package/src/keyPair/keyToPublicKey.js +0 -47
  119. package/src/keyPair/keyToWalletId.d.ts +0 -2
  120. package/src/keyPair/keyToWalletId.js +0 -50
  121. package/src/keyPair/keyToXPrivateKey.d.ts +0 -3
  122. package/src/keyPair/keyToXPrivateKey.js +0 -50
  123. package/src/keyPair/keyToXPublicKey.d.ts +0 -3
  124. package/src/keyPair/keyToXPublicKey.js +0 -50
  125. package/src/keyPair/mnemonicToIdentityKey.d.ts +0 -3
  126. package/src/keyPair/mnemonicToIdentityKey.js +0 -57
  127. package/src/keyPair/mnemonicToWallet.d.ts +0 -2
  128. package/src/keyPair/mnemonicToWallet.js +0 -55
  129. package/src/keyPair/privateKeyToWif.d.ts +0 -2
  130. package/src/keyPair/privateKeyToWif.js +0 -50
  131. package/src/keyPair/publicKeyToAddress.d.ts +0 -2
  132. package/src/keyPair/publicKeyToAddress.js +0 -50
  133. package/src/keyPair/seedToWallet.d.ts +0 -2
  134. package/src/keyPair/seedToWallet.js +0 -50
  135. package/src/keyPair/walletToIdentityKey.d.ts +0 -3
  136. package/src/keyPair/walletToIdentityKey.js +0 -56
  137. package/src/keyPair/xkeyToHDXKey.d.ts +0 -2
  138. package/src/keyPair/xkeyToHDXKey.js +0 -50
@@ -1,288 +1,121 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
1
+ import { StateTransitionWASM, TokenBaseTransitionWASM, TokenEmergencyActionWASM } from 'pshenmic-dpp';
2
+ import { DashPlatformSDK } from '../../src/DashPlatformSDK';
3
+ let sdk;
4
+ describe('Tokens', () => {
5
+ beforeAll(() => {
6
+ sdk = new DashPlatformSDK({ network: 'testnet' });
9
7
  });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
13
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- var types_1 = require("../../src/types");
40
- var pshenmic_dpp_1 = require("pshenmic-dpp");
41
- var sdk;
42
- describe('Tokens', function () {
43
- beforeAll(function () {
44
- sdk = new types_1.DashPlatformSDK();
8
+ test('should be able to get token total supply', async () => {
9
+ const tokenTotalSupply = await sdk.tokens.getTokenTotalSupply('9YxdbQUjJmQsmVPen95HjAU3Esj7tVkWSY2EQWT84ZQP');
10
+ expect(tokenTotalSupply.tokenId).toBeTruthy();
11
+ expect(tokenTotalSupply.totalSystemAmount).toBeTruthy();
12
+ expect(tokenTotalSupply.totalAggregatedAmountInUserAccounts).toBeTruthy();
45
13
  });
46
- test('should be able to get token total supply', function () { return __awaiter(void 0, void 0, void 0, function () {
47
- var tokenTotalSupply;
48
- return __generator(this, function (_a) {
49
- switch (_a.label) {
50
- case 0: return [4 /*yield*/, sdk.tokens.getTokenTotalSupply('9YxdbQUjJmQsmVPen95HjAU3Esj7tVkWSY2EQWT84ZQP')];
51
- case 1:
52
- tokenTotalSupply = _a.sent();
53
- expect(tokenTotalSupply.tokenId).toBeTruthy();
54
- expect(tokenTotalSupply.totalSystemAmount).toBeTruthy();
55
- expect(tokenTotalSupply.totalAggregatedAmountInUserAccounts).toBeTruthy();
56
- return [2 /*return*/];
57
- }
14
+ test('should be able to get token contract info', async () => {
15
+ const tokenContractInfo = await sdk.tokens.getTokenContractInfo('9YxdbQUjJmQsmVPen95HjAU3Esj7tVkWSY2EQWT84ZQP');
16
+ expect(tokenContractInfo.dataContractId.base58()).toEqual('Y189uedQG3CJCuu83P3DqnG7ngQaRKz69x3gY8uDzQe');
17
+ expect(tokenContractInfo.tokenContractPosition).toEqual(0);
18
+ });
19
+ test('should be able to get identity tokens balances', async () => {
20
+ const tokensIdentityBalance = await sdk.tokens.getIdentityTokensBalances('8eTDkBhpQjHeqgbVeriwLeZr1tCa6yBGw76SckvD1cwc', ['9YxdbQUjJmQsmVPen95HjAU3Esj7tVkWSY2EQWT84ZQP']);
21
+ expect(tokensIdentityBalance.length).toEqual(1);
22
+ expect(tokensIdentityBalance[0].tokenId).toBeTruthy();
23
+ expect(tokensIdentityBalance[0].balance).toBeTruthy();
24
+ });
25
+ test('should be able to get token identities token balances', async () => {
26
+ const tokensPrices = await sdk.tokens.getTokensDirectPurchasePrice([
27
+ '3oTHkj8nqn82QkZRHkmUmNBX696nzE1rg1fwPRpemEdz',
28
+ '6niNoQpsT9zyVDJtXcbpV3tR3qEGi6BC6xoDdJyx1u7C'
29
+ ]);
30
+ expect(tokensPrices.length).toEqual(2);
31
+ expect(tokensPrices[0].tokenId).toBeTruthy();
32
+ expect(tokensPrices[0].price).toBeTruthy();
33
+ });
34
+ test('should be able to get tokens direct purchase prices', async () => {
35
+ const tokensIdentityBalance = await sdk.tokens.getIdentitiesTokenBalances(['8eTDkBhpQjHeqgbVeriwLeZr1tCa6yBGw76SckvD1cwc'], '9YxdbQUjJmQsmVPen95HjAU3Esj7tVkWSY2EQWT84ZQP');
36
+ expect(tokensIdentityBalance.length).toEqual(1);
37
+ expect(tokensIdentityBalance[0].identityId).toBeTruthy();
38
+ expect(tokensIdentityBalance[0].balance).toBeTruthy();
39
+ });
40
+ test('should be able to create base token transition', async () => {
41
+ const tokenBaseTransition = await sdk.tokens.createBaseTransition('A36eJF2kyYXwxCtJGsgbR3CTAscUFaNxZN19UqUfM1kw', '34vkjdeUTP2z798SiXqoB6EAuobh51kXYURqVa9xkujf');
42
+ expect(tokenBaseTransition).toBeInstanceOf(TokenBaseTransitionWASM);
43
+ });
44
+ describe('create state transitions', () => {
45
+ test('should be able to create burn transition', async () => {
46
+ const tokenId = '6niNoQpsT9zyVDJtXcbpV3tR3qEGi6BC6xoDdJyx1u7C';
47
+ const owner = 'HT3pUBM1Uv2mKgdPEN1gxa7A4PdsvNY89aJbdSKQb5wR';
48
+ const amount = BigInt(10);
49
+ const tokenBaseTransition = await sdk.tokens.createBaseTransition(tokenId, owner);
50
+ const stateTransition = sdk.tokens.createStateTransition(tokenBaseTransition, owner, 'burn', { amount });
51
+ expect(stateTransition).toBeInstanceOf(StateTransitionWASM);
52
+ });
53
+ test('should be able to create mint transition', async () => {
54
+ const tokenId = '6niNoQpsT9zyVDJtXcbpV3tR3qEGi6BC6xoDdJyx1u7C';
55
+ const owner = 'HT3pUBM1Uv2mKgdPEN1gxa7A4PdsvNY89aJbdSKQb5wR';
56
+ const recipientId = '8GopLQQCViyroS2gHktesGaCMe2tueXWeQ6Y9vpMFTEC';
57
+ const amount = BigInt(10);
58
+ const tokenBaseTransition = await sdk.tokens.createBaseTransition(tokenId, owner);
59
+ const stateTransition = sdk.tokens.createStateTransition(tokenBaseTransition, owner, 'mint', { identityId: recipientId, amount });
60
+ expect(stateTransition).toBeInstanceOf(StateTransitionWASM);
61
+ });
62
+ test('should be able to create transfer transition', async () => {
63
+ const tokenId = '6niNoQpsT9zyVDJtXcbpV3tR3qEGi6BC6xoDdJyx1u7C';
64
+ const owner = 'HT3pUBM1Uv2mKgdPEN1gxa7A4PdsvNY89aJbdSKQb5wR';
65
+ const recipient = '8GopLQQCViyroS2gHktesGaCMe2tueXWeQ6Y9vpMFTEC';
66
+ const amount = BigInt(100);
67
+ const tokenBaseTransition = await sdk.tokens.createBaseTransition(tokenId, owner);
68
+ const stateTransition = sdk.tokens.createStateTransition(tokenBaseTransition, owner, 'transfer', { identityId: recipient, amount });
69
+ expect(stateTransition).toBeInstanceOf(StateTransitionWASM);
70
+ });
71
+ test('should be able to create freeze transition', async () => {
72
+ const tokenId = '6niNoQpsT9zyVDJtXcbpV3tR3qEGi6BC6xoDdJyx1u7C';
73
+ const owner = 'HT3pUBM1Uv2mKgdPEN1gxa7A4PdsvNY89aJbdSKQb5wR';
74
+ const identityId = '8GopLQQCViyroS2gHktesGaCMe2tueXWeQ6Y9vpMFTEC';
75
+ const tokenBaseTransition = await sdk.tokens.createBaseTransition(tokenId, owner);
76
+ const stateTransition = sdk.tokens.createStateTransition(tokenBaseTransition, owner, 'freeze', { identityId });
77
+ expect(stateTransition).toBeInstanceOf(StateTransitionWASM);
58
78
  });
59
- }); });
60
- test('should be able to get token contract info', function () { return __awaiter(void 0, void 0, void 0, function () {
61
- var tokenContractInfo;
62
- return __generator(this, function (_a) {
63
- switch (_a.label) {
64
- case 0: return [4 /*yield*/, sdk.tokens.getTokenContractInfo('9YxdbQUjJmQsmVPen95HjAU3Esj7tVkWSY2EQWT84ZQP')];
65
- case 1:
66
- tokenContractInfo = _a.sent();
67
- expect(tokenContractInfo.dataContractId.base58()).toEqual('Y189uedQG3CJCuu83P3DqnG7ngQaRKz69x3gY8uDzQe');
68
- expect(tokenContractInfo.tokenContractPosition).toEqual(0);
69
- return [2 /*return*/];
70
- }
79
+ test('should be able to create unfreeze transition', async () => {
80
+ const tokenId = '6niNoQpsT9zyVDJtXcbpV3tR3qEGi6BC6xoDdJyx1u7C';
81
+ const owner = 'HT3pUBM1Uv2mKgdPEN1gxa7A4PdsvNY89aJbdSKQb5wR';
82
+ const identityId = '8GopLQQCViyroS2gHktesGaCMe2tueXWeQ6Y9vpMFTEC';
83
+ const tokenBaseTransition = await sdk.tokens.createBaseTransition(tokenId, owner);
84
+ const stateTransition = sdk.tokens.createStateTransition(tokenBaseTransition, owner, 'unfreeze', { identityId });
85
+ expect(stateTransition).toBeInstanceOf(StateTransitionWASM);
71
86
  });
72
- }); });
73
- test('should be able to get identity tokens balances', function () { return __awaiter(void 0, void 0, void 0, function () {
74
- var tokensIdentityBalance;
75
- return __generator(this, function (_a) {
76
- switch (_a.label) {
77
- case 0: return [4 /*yield*/, sdk.tokens.getIdentityTokensBalances('8eTDkBhpQjHeqgbVeriwLeZr1tCa6yBGw76SckvD1cwc', ['9YxdbQUjJmQsmVPen95HjAU3Esj7tVkWSY2EQWT84ZQP'])];
78
- case 1:
79
- tokensIdentityBalance = _a.sent();
80
- expect(tokensIdentityBalance.length).toEqual(1);
81
- expect(tokensIdentityBalance[0].tokenId).toBeTruthy();
82
- expect(tokensIdentityBalance[0].balance).toBeTruthy();
83
- return [2 /*return*/];
84
- }
87
+ test('should be able to create destroyFrozenFunds transition', async () => {
88
+ const tokenId = '6niNoQpsT9zyVDJtXcbpV3tR3qEGi6BC6xoDdJyx1u7C';
89
+ const owner = 'HT3pUBM1Uv2mKgdPEN1gxa7A4PdsvNY89aJbdSKQb5wR';
90
+ const identityId = '8GopLQQCViyroS2gHktesGaCMe2tueXWeQ6Y9vpMFTEC';
91
+ const tokenBaseTransition = await sdk.tokens.createBaseTransition(tokenId, owner);
92
+ const stateTransition = sdk.tokens.createStateTransition(tokenBaseTransition, owner, 'destroyFrozenFunds', { identityId });
93
+ expect(stateTransition).toBeInstanceOf(StateTransitionWASM);
85
94
  });
86
- }); });
87
- test('should be able to get token identities token balances', function () { return __awaiter(void 0, void 0, void 0, function () {
88
- var tokensPrices;
89
- return __generator(this, function (_a) {
90
- switch (_a.label) {
91
- case 0: return [4 /*yield*/, sdk.tokens.getTokensDirectPurchasePrice([
92
- '3oTHkj8nqn82QkZRHkmUmNBX696nzE1rg1fwPRpemEdz',
93
- '6niNoQpsT9zyVDJtXcbpV3tR3qEGi6BC6xoDdJyx1u7C'
94
- ])];
95
- case 1:
96
- tokensPrices = _a.sent();
97
- expect(tokensPrices.length).toEqual(2);
98
- expect(tokensPrices[0].tokenId).toBeTruthy();
99
- expect(tokensPrices[0].price).toBeTruthy();
100
- return [2 /*return*/];
101
- }
95
+ test('should be able to create emergency action transition', async () => {
96
+ const tokenId = '6niNoQpsT9zyVDJtXcbpV3tR3qEGi6BC6xoDdJyx1u7C';
97
+ const owner = 'HT3pUBM1Uv2mKgdPEN1gxa7A4PdsvNY89aJbdSKQb5wR';
98
+ const emergencyAction = TokenEmergencyActionWASM.Pause;
99
+ const tokenBaseTransition = await sdk.tokens.createBaseTransition(tokenId, owner);
100
+ const stateTransition = sdk.tokens.createStateTransition(tokenBaseTransition, owner, 'emergencyAction', { emergencyAction });
101
+ expect(stateTransition).toBeInstanceOf(StateTransitionWASM);
102
102
  });
103
- }); });
104
- test('should be able to get tokens direct purchase prices', function () { return __awaiter(void 0, void 0, void 0, function () {
105
- var tokensIdentityBalance;
106
- return __generator(this, function (_a) {
107
- switch (_a.label) {
108
- case 0: return [4 /*yield*/, sdk.tokens.getIdentitiesTokenBalances(['8eTDkBhpQjHeqgbVeriwLeZr1tCa6yBGw76SckvD1cwc'], '9YxdbQUjJmQsmVPen95HjAU3Esj7tVkWSY2EQWT84ZQP')];
109
- case 1:
110
- tokensIdentityBalance = _a.sent();
111
- expect(tokensIdentityBalance.length).toEqual(1);
112
- expect(tokensIdentityBalance[0].identityId).toBeTruthy();
113
- expect(tokensIdentityBalance[0].balance).toBeTruthy();
114
- return [2 /*return*/];
115
- }
103
+ test('should be able to create setPriceForDirectPurchase transition', async () => {
104
+ const tokenId = '6niNoQpsT9zyVDJtXcbpV3tR3qEGi6BC6xoDdJyx1u7C';
105
+ const owner = 'HT3pUBM1Uv2mKgdPEN1gxa7A4PdsvNY89aJbdSKQb5wR';
106
+ const price = BigInt(10);
107
+ const tokenBaseTransition = await sdk.tokens.createBaseTransition(tokenId, owner);
108
+ const stateTransition = sdk.tokens.createStateTransition(tokenBaseTransition, owner, 'setPriceForDirectPurchase', { price });
109
+ expect(stateTransition).toBeInstanceOf(StateTransitionWASM);
116
110
  });
117
- }); });
118
- test('should be able to create base token transition', function () { return __awaiter(void 0, void 0, void 0, function () {
119
- var tokenBaseTransition;
120
- return __generator(this, function (_a) {
121
- switch (_a.label) {
122
- case 0: return [4 /*yield*/, sdk.tokens.createBaseTransition('A36eJF2kyYXwxCtJGsgbR3CTAscUFaNxZN19UqUfM1kw', '34vkjdeUTP2z798SiXqoB6EAuobh51kXYURqVa9xkujf')];
123
- case 1:
124
- tokenBaseTransition = _a.sent();
125
- expect(tokenBaseTransition).toBeInstanceOf(pshenmic_dpp_1.TokenBaseTransitionWASM);
126
- return [2 /*return*/];
127
- }
111
+ test('should be able to create directPurchase transition', async () => {
112
+ const tokenId = '6niNoQpsT9zyVDJtXcbpV3tR3qEGi6BC6xoDdJyx1u7C';
113
+ const owner = 'HT3pUBM1Uv2mKgdPEN1gxa7A4PdsvNY89aJbdSKQb5wR';
114
+ const amount = BigInt(10);
115
+ const totalAgreedPrice = BigInt(100);
116
+ const tokenBaseTransition = await sdk.tokens.createBaseTransition(tokenId, owner);
117
+ const stateTransition = sdk.tokens.createStateTransition(tokenBaseTransition, owner, 'directPurchase', { amount, totalAgreedPrice });
118
+ expect(stateTransition).toBeInstanceOf(StateTransitionWASM);
128
119
  });
129
- }); });
130
- describe('create state transitions', function () {
131
- test('should be able to create burn transition', function () { return __awaiter(void 0, void 0, void 0, function () {
132
- var tokenId, owner, amount, tokenBaseTransition, stateTransition;
133
- return __generator(this, function (_a) {
134
- switch (_a.label) {
135
- case 0:
136
- tokenId = '6niNoQpsT9zyVDJtXcbpV3tR3qEGi6BC6xoDdJyx1u7C';
137
- owner = 'HT3pUBM1Uv2mKgdPEN1gxa7A4PdsvNY89aJbdSKQb5wR';
138
- amount = BigInt(10);
139
- return [4 /*yield*/, sdk.tokens.createBaseTransition(tokenId, owner)];
140
- case 1:
141
- tokenBaseTransition = _a.sent();
142
- stateTransition = sdk.tokens.createStateTransition(tokenBaseTransition, owner, 'burn', { amount: amount });
143
- expect(stateTransition).toBeInstanceOf(pshenmic_dpp_1.StateTransitionWASM);
144
- return [2 /*return*/];
145
- }
146
- });
147
- }); });
148
- test('should be able to create mint transition', function () { return __awaiter(void 0, void 0, void 0, function () {
149
- var tokenId, owner, recipientId, amount, tokenBaseTransition, stateTransition;
150
- return __generator(this, function (_a) {
151
- switch (_a.label) {
152
- case 0:
153
- tokenId = '6niNoQpsT9zyVDJtXcbpV3tR3qEGi6BC6xoDdJyx1u7C';
154
- owner = 'HT3pUBM1Uv2mKgdPEN1gxa7A4PdsvNY89aJbdSKQb5wR';
155
- recipientId = '8GopLQQCViyroS2gHktesGaCMe2tueXWeQ6Y9vpMFTEC';
156
- amount = BigInt(10);
157
- return [4 /*yield*/, sdk.tokens.createBaseTransition(tokenId, owner)];
158
- case 1:
159
- tokenBaseTransition = _a.sent();
160
- stateTransition = sdk.tokens.createStateTransition(tokenBaseTransition, owner, 'mint', { identityId: recipientId, amount: amount });
161
- expect(stateTransition).toBeInstanceOf(pshenmic_dpp_1.StateTransitionWASM);
162
- return [2 /*return*/];
163
- }
164
- });
165
- }); });
166
- test('should be able to create transfer transition', function () { return __awaiter(void 0, void 0, void 0, function () {
167
- var tokenId, owner, recipient, amount, tokenBaseTransition, stateTransition;
168
- return __generator(this, function (_a) {
169
- switch (_a.label) {
170
- case 0:
171
- tokenId = '6niNoQpsT9zyVDJtXcbpV3tR3qEGi6BC6xoDdJyx1u7C';
172
- owner = 'HT3pUBM1Uv2mKgdPEN1gxa7A4PdsvNY89aJbdSKQb5wR';
173
- recipient = '8GopLQQCViyroS2gHktesGaCMe2tueXWeQ6Y9vpMFTEC';
174
- amount = BigInt(100);
175
- return [4 /*yield*/, sdk.tokens.createBaseTransition(tokenId, owner)];
176
- case 1:
177
- tokenBaseTransition = _a.sent();
178
- stateTransition = sdk.tokens.createStateTransition(tokenBaseTransition, owner, 'transfer', { identityId: recipient, amount: amount });
179
- expect(stateTransition).toBeInstanceOf(pshenmic_dpp_1.StateTransitionWASM);
180
- return [2 /*return*/];
181
- }
182
- });
183
- }); });
184
- test('should be able to create freeze transition', function () { return __awaiter(void 0, void 0, void 0, function () {
185
- var tokenId, owner, identityId, tokenBaseTransition, stateTransition;
186
- return __generator(this, function (_a) {
187
- switch (_a.label) {
188
- case 0:
189
- tokenId = '6niNoQpsT9zyVDJtXcbpV3tR3qEGi6BC6xoDdJyx1u7C';
190
- owner = 'HT3pUBM1Uv2mKgdPEN1gxa7A4PdsvNY89aJbdSKQb5wR';
191
- identityId = '8GopLQQCViyroS2gHktesGaCMe2tueXWeQ6Y9vpMFTEC';
192
- return [4 /*yield*/, sdk.tokens.createBaseTransition(tokenId, owner)];
193
- case 1:
194
- tokenBaseTransition = _a.sent();
195
- stateTransition = sdk.tokens.createStateTransition(tokenBaseTransition, owner, 'freeze', { identityId: identityId });
196
- expect(stateTransition).toBeInstanceOf(pshenmic_dpp_1.StateTransitionWASM);
197
- return [2 /*return*/];
198
- }
199
- });
200
- }); });
201
- test('should be able to create unfreeze transition', function () { return __awaiter(void 0, void 0, void 0, function () {
202
- var tokenId, owner, identityId, tokenBaseTransition, stateTransition;
203
- return __generator(this, function (_a) {
204
- switch (_a.label) {
205
- case 0:
206
- tokenId = '6niNoQpsT9zyVDJtXcbpV3tR3qEGi6BC6xoDdJyx1u7C';
207
- owner = 'HT3pUBM1Uv2mKgdPEN1gxa7A4PdsvNY89aJbdSKQb5wR';
208
- identityId = '8GopLQQCViyroS2gHktesGaCMe2tueXWeQ6Y9vpMFTEC';
209
- return [4 /*yield*/, sdk.tokens.createBaseTransition(tokenId, owner)];
210
- case 1:
211
- tokenBaseTransition = _a.sent();
212
- stateTransition = sdk.tokens.createStateTransition(tokenBaseTransition, owner, 'unfreeze', { identityId: identityId });
213
- expect(stateTransition).toBeInstanceOf(pshenmic_dpp_1.StateTransitionWASM);
214
- return [2 /*return*/];
215
- }
216
- });
217
- }); });
218
- test('should be able to create destroyFrozenFunds transition', function () { return __awaiter(void 0, void 0, void 0, function () {
219
- var tokenId, owner, identityId, tokenBaseTransition, stateTransition;
220
- return __generator(this, function (_a) {
221
- switch (_a.label) {
222
- case 0:
223
- tokenId = '6niNoQpsT9zyVDJtXcbpV3tR3qEGi6BC6xoDdJyx1u7C';
224
- owner = 'HT3pUBM1Uv2mKgdPEN1gxa7A4PdsvNY89aJbdSKQb5wR';
225
- identityId = '8GopLQQCViyroS2gHktesGaCMe2tueXWeQ6Y9vpMFTEC';
226
- return [4 /*yield*/, sdk.tokens.createBaseTransition(tokenId, owner)];
227
- case 1:
228
- tokenBaseTransition = _a.sent();
229
- stateTransition = sdk.tokens.createStateTransition(tokenBaseTransition, owner, 'destroyFrozenFunds', { identityId: identityId });
230
- expect(stateTransition).toBeInstanceOf(pshenmic_dpp_1.StateTransitionWASM);
231
- return [2 /*return*/];
232
- }
233
- });
234
- }); });
235
- test('should be able to create emergency action transition', function () { return __awaiter(void 0, void 0, void 0, function () {
236
- var tokenId, owner, emergencyAction, tokenBaseTransition, stateTransition;
237
- return __generator(this, function (_a) {
238
- switch (_a.label) {
239
- case 0:
240
- tokenId = '6niNoQpsT9zyVDJtXcbpV3tR3qEGi6BC6xoDdJyx1u7C';
241
- owner = 'HT3pUBM1Uv2mKgdPEN1gxa7A4PdsvNY89aJbdSKQb5wR';
242
- emergencyAction = pshenmic_dpp_1.TokenEmergencyActionWASM.Pause;
243
- return [4 /*yield*/, sdk.tokens.createBaseTransition(tokenId, owner)];
244
- case 1:
245
- tokenBaseTransition = _a.sent();
246
- stateTransition = sdk.tokens.createStateTransition(tokenBaseTransition, owner, 'emergencyAction', { emergencyAction: emergencyAction });
247
- expect(stateTransition).toBeInstanceOf(pshenmic_dpp_1.StateTransitionWASM);
248
- return [2 /*return*/];
249
- }
250
- });
251
- }); });
252
- test('should be able to create setPriceForDirectPurchase transition', function () { return __awaiter(void 0, void 0, void 0, function () {
253
- var tokenId, owner, price, tokenBaseTransition, stateTransition;
254
- return __generator(this, function (_a) {
255
- switch (_a.label) {
256
- case 0:
257
- tokenId = '6niNoQpsT9zyVDJtXcbpV3tR3qEGi6BC6xoDdJyx1u7C';
258
- owner = 'HT3pUBM1Uv2mKgdPEN1gxa7A4PdsvNY89aJbdSKQb5wR';
259
- price = BigInt(10);
260
- return [4 /*yield*/, sdk.tokens.createBaseTransition(tokenId, owner)];
261
- case 1:
262
- tokenBaseTransition = _a.sent();
263
- stateTransition = sdk.tokens.createStateTransition(tokenBaseTransition, owner, 'setPriceForDirectPurchase', { price: price });
264
- expect(stateTransition).toBeInstanceOf(pshenmic_dpp_1.StateTransitionWASM);
265
- return [2 /*return*/];
266
- }
267
- });
268
- }); });
269
- test('should be able to create directPurchase transition', function () { return __awaiter(void 0, void 0, void 0, function () {
270
- var tokenId, owner, amount, totalAgreedPrice, tokenBaseTransition, stateTransition;
271
- return __generator(this, function (_a) {
272
- switch (_a.label) {
273
- case 0:
274
- tokenId = '6niNoQpsT9zyVDJtXcbpV3tR3qEGi6BC6xoDdJyx1u7C';
275
- owner = 'HT3pUBM1Uv2mKgdPEN1gxa7A4PdsvNY89aJbdSKQb5wR';
276
- amount = BigInt(10);
277
- totalAgreedPrice = BigInt(100);
278
- return [4 /*yield*/, sdk.tokens.createBaseTransition(tokenId, owner)];
279
- case 1:
280
- tokenBaseTransition = _a.sent();
281
- stateTransition = sdk.tokens.createStateTransition(tokenBaseTransition, owner, 'directPurchase', { amount: amount, totalAgreedPrice: totalAgreedPrice });
282
- expect(stateTransition).toBeInstanceOf(pshenmic_dpp_1.StateTransitionWASM);
283
- return [2 /*return*/];
284
- }
285
- });
286
- }); });
287
120
  });
288
121
  });
@@ -1 +0,0 @@
1
- /*! scure-base - MIT License (c) 2022 Paul Miller (paulmillr.com) */
@@ -1,2 +0,0 @@
1
- import { HDKey } from 'dashhd';
2
- export default function keyToPublicKey(key: HDKey): Promise<HDKey>;
@@ -1,47 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
13
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.default = keyToPublicKey;
40
- var DashHD = require("dashhd");
41
- function keyToPublicKey(key) {
42
- return __awaiter(this, void 0, void 0, function () {
43
- return __generator(this, function (_a) {
44
- return [2 /*return*/, DashHD.toPublic(key)];
45
- });
46
- });
47
- }
@@ -1,2 +0,0 @@
1
- import { HDKey } from 'dashhd';
2
- export default function keyToWalletId(key: HDKey): Promise<string>;
@@ -1,50 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
13
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.default = keyToWalletId;
40
- var DashHD = require("dashhd");
41
- function keyToWalletId(key) {
42
- return __awaiter(this, void 0, void 0, function () {
43
- return __generator(this, function (_a) {
44
- switch (_a.label) {
45
- case 0: return [4 /*yield*/, DashHD.toId(key)];
46
- case 1: return [2 /*return*/, _a.sent()];
47
- }
48
- });
49
- });
50
- }
@@ -1,3 +0,0 @@
1
- import { HDKey } from 'dashhd';
2
- import { NetworkVersion } from '../types';
3
- export default function keyToXPrivateKey(hdKey: HDKey, opts?: NetworkVersion): Promise<string>;
@@ -1,50 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
13
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.default = keyToXPrivateKey;
40
- var DashHD = require("dashhd");
41
- function keyToXPrivateKey(hdKey, opts) {
42
- return __awaiter(this, void 0, void 0, function () {
43
- return __generator(this, function (_a) {
44
- switch (_a.label) {
45
- case 0: return [4 /*yield*/, DashHD.toXPrv(hdKey, opts)];
46
- case 1: return [2 /*return*/, _a.sent()];
47
- }
48
- });
49
- });
50
- }
@@ -1,3 +0,0 @@
1
- import { HDKey } from 'dashhd';
2
- import { NetworkVersion } from '../types';
3
- export default function keyToXPublicKey(hdKey: HDKey, opts?: NetworkVersion): Promise<Uint8Array>;
@@ -1,50 +0,0 @@
1
- "use strict";
2
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
4
- return new (P || (P = Promise))(function (resolve, reject) {
5
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
6
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
7
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
8
- step((generator = generator.apply(thisArg, _arguments || [])).next());
9
- });
10
- };
11
- var __generator = (this && this.__generator) || function (thisArg, body) {
12
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
13
- return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
14
- function verb(n) { return function (v) { return step([n, v]); }; }
15
- function step(op) {
16
- if (f) throw new TypeError("Generator is already executing.");
17
- while (g && (g = 0, op[0] && (_ = 0)), _) try {
18
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
19
- if (y = 0, t) op = [op[0] & 2, t.value];
20
- switch (op[0]) {
21
- case 0: case 1: t = op; break;
22
- case 4: _.label++; return { value: op[1], done: false };
23
- case 5: _.label++; y = op[1]; op = [0]; continue;
24
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
25
- default:
26
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
27
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
28
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
29
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
30
- if (t[2]) _.ops.pop();
31
- _.trys.pop(); continue;
32
- }
33
- op = body.call(thisArg, _);
34
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
35
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
36
- }
37
- };
38
- Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.default = keyToXPublicKey;
40
- var DashHD = require("dashhd");
41
- function keyToXPublicKey(hdKey, opts) {
42
- return __awaiter(this, void 0, void 0, function () {
43
- return __generator(this, function (_a) {
44
- switch (_a.label) {
45
- case 0: return [4 /*yield*/, DashHD.toXPub(hdKey, opts)];
46
- case 1: return [2 /*return*/, _a.sent()];
47
- }
48
- });
49
- });
50
- }
@@ -1,3 +0,0 @@
1
- import { HDFromSeedOptions, HDKey } from 'dashhd';
2
- import { WalletToIdentityKeyOpts } from '../types';
3
- export default function mnemonicToIdentityKey(mnemonic: string, identityIndex?: number | undefined, keyIndex?: number | undefined, salt?: string, verify?: boolean, opts?: HDFromSeedOptions & WalletToIdentityKeyOpts): Promise<HDKey>;