dash-platform-sdk 1.3.0-dev.1 → 1.3.0-dev.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (189) hide show
  1. package/bundle.min.js +21 -2
  2. package/index.d.ts +1 -1
  3. package/index.js +2 -5
  4. package/package.json +32 -31
  5. package/proto/generated/google/protobuf/wrappers.d.ts +260 -29
  6. package/proto/generated/google/protobuf/wrappers.js +562 -345
  7. package/proto/generated/platform.client.d.ts +251 -0
  8. package/proto/generated/platform.client.js +175 -0
  9. package/proto/generated/platform.d.ts +3682 -1939
  10. package/proto/generated/platform.js +8119 -18366
  11. package/src/DashPlatformSDK.d.ts +18 -19
  12. package/src/DashPlatformSDK.js +52 -45
  13. package/src/constants.d.ts +2 -0
  14. package/src/constants.js +7 -8
  15. package/src/contestedResources/createStateTransition.d.ts +2 -0
  16. package/src/contestedResources/createStateTransition.js +6 -0
  17. package/src/contestedResources/getContestedResourceVoteState.d.ts +3 -3
  18. package/src/contestedResources/getContestedResourceVoteState.js +67 -118
  19. package/src/contestedResources/index.d.ts +3 -3
  20. package/src/contestedResources/index.js +9 -55
  21. package/src/dataContracts/create.d.ts +1 -1
  22. package/src/dataContracts/create.js +5 -8
  23. package/src/dataContracts/createStateTransition.js +10 -14
  24. package/src/dataContracts/getDataContractByIdentifier.d.ts +2 -2
  25. package/src/dataContracts/getDataContractByIdentifier.js +40 -79
  26. package/src/dataContracts/index.d.ts +2 -2
  27. package/src/dataContracts/index.js +17 -63
  28. package/src/documents/create.d.ts +1 -1
  29. package/src/documents/create.js +3 -6
  30. package/src/documents/createStateTransition.d.ts +1 -1
  31. package/src/documents/createStateTransition.js +19 -31
  32. package/src/documents/index.d.ts +2 -2
  33. package/src/documents/index.js +25 -72
  34. package/src/documents/query.d.ts +2 -2
  35. package/src/documents/query.js +58 -90
  36. package/src/grpcConnectionPool.d.ts +30 -8
  37. package/src/grpcConnectionPool.js +63 -121
  38. package/src/identities/createStateTransition.d.ts +2 -2
  39. package/src/identities/createStateTransition.js +24 -26
  40. package/src/identities/getIdentityBalance.d.ts +2 -2
  41. package/src/identities/getIdentityBalance.js +37 -80
  42. package/src/identities/getIdentityByIdentifier.d.ts +2 -2
  43. package/src/identities/getIdentityByIdentifier.js +37 -80
  44. package/src/identities/getIdentityByNonUniquePublicKeyHash.d.ts +1 -1
  45. package/src/identities/getIdentityByNonUniquePublicKeyHash.js +41 -82
  46. package/src/identities/getIdentityByPublicKeyHash.d.ts +1 -1
  47. package/src/identities/getIdentityByPublicKeyHash.js +37 -80
  48. package/src/identities/getIdentityContractNonce.d.ts +2 -2
  49. package/src/identities/getIdentityContractNonce.js +40 -83
  50. package/src/identities/getIdentityNonce.d.ts +2 -2
  51. package/src/identities/getIdentityNonce.js +38 -81
  52. package/src/identities/getIdentityPublicKeys.d.ts +2 -2
  53. package/src/identities/getIdentityPublicKeys.js +43 -81
  54. package/src/identities/index.d.ts +6 -4
  55. package/src/identities/index.js +70 -154
  56. package/src/keyPair/deriveChild.d.ts +2 -2
  57. package/src/keyPair/deriveChild.js +2 -49
  58. package/src/keyPair/derivePath.d.ts +2 -2
  59. package/src/keyPair/derivePath.js +2 -49
  60. package/src/keyPair/index.d.ts +39 -114
  61. package/src/keyPair/index.js +62 -296
  62. package/src/keyPair/mnemonicToSeed.d.ts +1 -1
  63. package/src/keyPair/mnemonicToSeed.js +3 -46
  64. package/src/names/index.d.ts +44 -3
  65. package/src/names/index.js +81 -69
  66. package/src/names/registerName.d.ts +3 -0
  67. package/src/names/registerName.js +64 -0
  68. package/src/names/searchByIdentity.d.ts +3 -0
  69. package/src/names/searchByIdentity.js +5 -0
  70. package/src/names/searchByName.d.ts +3 -0
  71. package/src/names/searchByName.js +16 -0
  72. package/src/names/testNameContested.d.ts +1 -0
  73. package/src/names/testNameContested.js +3 -0
  74. package/src/names/validateName.d.ts +1 -0
  75. package/src/names/validateName.js +11 -0
  76. package/src/node/epochs.d.ts +1 -1
  77. package/src/node/epochs.js +43 -85
  78. package/src/node/index.d.ts +5 -5
  79. package/src/node/index.js +18 -77
  80. package/src/node/status.d.ts +2 -2
  81. package/src/node/status.js +37 -81
  82. package/src/node/totalCredits.d.ts +3 -2
  83. package/src/node/totalCredits.js +32 -73
  84. package/src/stateTransitions/broadcast.d.ts +1 -1
  85. package/src/stateTransitions/broadcast.js +7 -57
  86. package/src/stateTransitions/index.d.ts +1 -1
  87. package/src/stateTransitions/index.js +13 -66
  88. package/src/stateTransitions/waitForStateTransitionResult.d.ts +1 -1
  89. package/src/stateTransitions/waitForStateTransitionResult.js +6 -62
  90. package/src/tokens/createStateTransition.d.ts +1 -1
  91. package/src/tokens/createStateTransition.js +23 -35
  92. package/src/tokens/getIdentitiesTokenBalances.d.ts +2 -2
  93. package/src/tokens/getIdentitiesTokenBalances.js +40 -83
  94. package/src/tokens/getIdentityTokensBalances.d.ts +2 -2
  95. package/src/tokens/getIdentityTokensBalances.js +40 -83
  96. package/src/tokens/getTokenContractInfo.d.ts +2 -2
  97. package/src/tokens/getTokenContractInfo.js +40 -83
  98. package/src/tokens/getTokenDirectPurchasePrices.d.ts +3 -0
  99. package/src/tokens/getTokenDirectPurchasePrices.js +40 -0
  100. package/src/tokens/getTokenTotalSupply.d.ts +2 -2
  101. package/src/tokens/getTokenTotalSupply.js +38 -81
  102. package/src/tokens/index.d.ts +13 -5
  103. package/src/tokens/index.js +46 -113
  104. package/src/types.d.ts +20 -16
  105. package/src/types.js +6 -16
  106. package/src/utils/base58ToBytes.js +3 -6
  107. package/src/utils/bytesToHex.js +2 -5
  108. package/src/utils/bytesToTypedArray.d.ts +1 -0
  109. package/src/utils/bytesToTypedArray.js +3 -0
  110. package/src/utils/calculateMsgHash.d.ts +1 -1
  111. package/src/utils/calculateMsgHash.js +10 -13
  112. package/src/utils/calculateSignHash.d.ts +2 -2
  113. package/src/utils/calculateSignHash.js +7 -10
  114. package/src/utils/calculateStateIdHash.d.ts +2 -2
  115. package/src/utils/calculateStateIdHash.js +8 -10
  116. package/src/utils/convertToHomographSafeChars.d.ts +0 -4
  117. package/src/utils/convertToHomographSafeChars.js +2 -9
  118. package/src/utils/createMasternodeIdentityId.d.ts +2 -0
  119. package/src/utils/createMasternodeIdentityId.js +4 -0
  120. package/src/utils/createVoterIdentityId.d.ts +2 -0
  121. package/src/utils/createVoterIdentityId.js +13 -0
  122. package/src/utils/getEvonodeList.d.ts +2 -2
  123. package/src/utils/getEvonodeList.js +10 -61
  124. package/src/utils/getQuorumPublicKey.js +15 -66
  125. package/src/utils/getRandomArrayItem.js +1 -4
  126. package/src/utils/getRandomBytes.d.ts +1 -0
  127. package/src/utils/getRandomBytes.js +4 -0
  128. package/src/utils/hexToBytes.js +2 -6
  129. package/src/utils/index.d.ts +19 -3
  130. package/src/utils/index.js +45 -31
  131. package/src/utils/indexBytesToString.js +2 -5
  132. package/src/utils/sha256.d.ts +1 -1
  133. package/src/utils/sha256.js +10 -8
  134. package/src/utils/signHash.d.ts +1 -1
  135. package/src/utils/signHash.js +9 -12
  136. package/src/utils/signRequestId.d.ts +1 -1
  137. package/src/utils/signRequestId.js +9 -12
  138. package/src/utils/sleep.d.ts +1 -0
  139. package/src/utils/sleep.js +3 -0
  140. package/src/utils/stringToIndexValueBytes.js +4 -7
  141. package/src/utils/verifyTenderdashProof.d.ts +2 -2
  142. package/src/utils/verifyTenderdashProof.js +13 -17
  143. package/src/voting/createStateTransition.d.ts +2 -0
  144. package/src/voting/createStateTransition.js +6 -0
  145. package/src/voting/createVote.d.ts +2 -0
  146. package/src/voting/createVote.js +5 -0
  147. package/src/voting/index.d.ts +37 -0
  148. package/src/voting/index.js +55 -0
  149. package/test/unit/ContestedResources.spec.js +91 -90
  150. package/test/unit/DataContract.spec.js +44 -111
  151. package/test/unit/Document.spec.js +93 -183
  152. package/test/unit/Identity.spec.js +254 -357
  153. package/test/unit/KeyPair.spec.js +30 -145
  154. package/test/unit/Names.spec.d.ts +1 -0
  155. package/test/unit/Names.spec.js +33 -0
  156. package/test/unit/Node.spec.js +55 -126
  157. package/test/unit/SDK.spec.js +7 -9
  158. package/test/unit/Tokens.spec.js +112 -262
  159. package/bundle.min.js.LICENSE.txt +0 -1
  160. package/src/keyPair/keyToPublicKey.d.ts +0 -2
  161. package/src/keyPair/keyToPublicKey.js +0 -47
  162. package/src/keyPair/keyToWalletId.d.ts +0 -2
  163. package/src/keyPair/keyToWalletId.js +0 -50
  164. package/src/keyPair/keyToXPrivateKey.d.ts +0 -3
  165. package/src/keyPair/keyToXPrivateKey.js +0 -50
  166. package/src/keyPair/keyToXPublicKey.d.ts +0 -3
  167. package/src/keyPair/keyToXPublicKey.js +0 -50
  168. package/src/keyPair/mnemonicToIdentityKey.d.ts +0 -3
  169. package/src/keyPair/mnemonicToIdentityKey.js +0 -57
  170. package/src/keyPair/mnemonicToWallet.d.ts +0 -2
  171. package/src/keyPair/mnemonicToWallet.js +0 -55
  172. package/src/keyPair/privateKeyToWif.d.ts +0 -2
  173. package/src/keyPair/privateKeyToWif.js +0 -50
  174. package/src/keyPair/publicKeyToAddress.d.ts +0 -2
  175. package/src/keyPair/publicKeyToAddress.js +0 -50
  176. package/src/keyPair/seedToWallet.d.ts +0 -2
  177. package/src/keyPair/seedToWallet.js +0 -50
  178. package/src/keyPair/walletToIdentityKey.d.ts +0 -3
  179. package/src/keyPair/walletToIdentityKey.js +0 -56
  180. package/src/keyPair/xkeyToHDXKey.d.ts +0 -2
  181. package/src/keyPair/xkeyToHDXKey.js +0 -50
  182. package/src/names/search.d.ts +0 -3
  183. package/src/names/search.js +0 -63
  184. package/src/signer/AbstractSigner.d.ts +0 -12
  185. package/src/signer/AbstractSigner.js +0 -2
  186. package/src/signer/PrivateKeySigner.d.ts +0 -0
  187. package/src/signer/PrivateKeySigner.js +0 -64
  188. package/src/signer/setSigner.d.ts +0 -2
  189. package/src/signer/setSigner.js +0 -8
@@ -1,57 +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 = mnemonicToIdentityKey;
40
- var mnemonicToWallet_1 = require("./mnemonicToWallet");
41
- var walletToIdentityKey_1 = require("./walletToIdentityKey");
42
- function mnemonicToIdentityKey(mnemonic_1) {
43
- return __awaiter(this, arguments, void 0, function (mnemonic, identityIndex, keyIndex, salt, verify, opts) {
44
- var wallet;
45
- if (identityIndex === void 0) { identityIndex = 0; }
46
- if (keyIndex === void 0) { keyIndex = 0; }
47
- return __generator(this, function (_a) {
48
- switch (_a.label) {
49
- case 0: return [4 /*yield*/, (0, mnemonicToWallet_1.default)(mnemonic, salt, verify, opts)];
50
- case 1:
51
- wallet = _a.sent();
52
- return [4 /*yield*/, (0, walletToIdentityKey_1.default)(wallet, identityIndex, keyIndex, opts)];
53
- case 2: return [2 /*return*/, _a.sent()];
54
- }
55
- });
56
- });
57
- }
@@ -1,2 +0,0 @@
1
- import { HDFromSeedOptions, HDWallet } from 'dashhd';
2
- export default function mnemonicToWallet(mnemonic: string, salt?: string, verify?: boolean, opts?: HDFromSeedOptions): Promise<HDWallet>;
@@ -1,55 +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 = mnemonicToWallet;
40
- var mnemonicToSeed_1 = require("./mnemonicToSeed");
41
- var seedToWallet_1 = require("./seedToWallet");
42
- function mnemonicToWallet(mnemonic, salt, verify, opts) {
43
- return __awaiter(this, void 0, void 0, function () {
44
- var seed;
45
- return __generator(this, function (_a) {
46
- switch (_a.label) {
47
- case 0: return [4 /*yield*/, (0, mnemonicToSeed_1.default)(mnemonic, salt, verify)];
48
- case 1:
49
- seed = _a.sent();
50
- return [4 /*yield*/, (0, seedToWallet_1.default)(seed, opts)];
51
- case 2: return [2 /*return*/, _a.sent()];
52
- }
53
- });
54
- });
55
- }
@@ -1,2 +0,0 @@
1
- import { NetworkVersion } from '../types';
2
- export default function privateKeyToWif(privateKeyBytes: Uint8Array, 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 = privateKeyToWif;
40
- var DashHD = require("dashhd");
41
- function privateKeyToWif(privateKeyBytes, 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.toWif(privateKeyBytes, opts)];
46
- case 1: return [2 /*return*/, _a.sent()];
47
- }
48
- });
49
- });
50
- }
@@ -1,2 +0,0 @@
1
- import { NetworkVersion } from '../types';
2
- export default function publicKeyToAddress(publicKeyBytes: Uint8Array, 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 = publicKeyToAddress;
40
- var DashHD = require("dashhd");
41
- function publicKeyToAddress(publicKeyBytes, 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.toAddr(publicKeyBytes, opts)];
46
- case 1: return [2 /*return*/, _a.sent()];
47
- }
48
- });
49
- });
50
- }
@@ -1,2 +0,0 @@
1
- import { HDFromSeedOptions, HDWallet } from 'dashhd';
2
- export default function seedToWallet(seed: Uint8Array, opts?: HDFromSeedOptions): Promise<HDWallet>;
@@ -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 = seedToWallet;
40
- var DashHd = require("dashhd");
41
- function seedToWallet(seed, 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.fromSeed(seed, opts)];
46
- case 1: return [2 /*return*/, _a.sent()];
47
- }
48
- });
49
- });
50
- }
@@ -1,3 +0,0 @@
1
- import { HDKey, HDWallet } from 'dashhd';
2
- import { WalletToIdentityKeyOpts } from '../types';
3
- export default function walletToIdentityKey(wallet: HDWallet | HDKey, identityIndex: number, keyIndex: number, opts?: WalletToIdentityKeyOpts): Promise<HDKey>;
@@ -1,56 +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 = walletToIdentityKey;
40
- var derivePath_1 = require("./derivePath");
41
- function walletToIdentityKey(wallet, identityIndex, keyIndex, opts) {
42
- return __awaiter(this, void 0, void 0, function () {
43
- var network, networkIndex, pathPostfix;
44
- var _a;
45
- return __generator(this, function (_b) {
46
- switch (_b.label) {
47
- case 0:
48
- network = (_a = opts === null || opts === void 0 ? void 0 : opts.network) !== null && _a !== void 0 ? _a : 'testnet';
49
- networkIndex = network === 'mainnet' ? 5 : 1;
50
- pathPostfix = "/5'/0'/0'/".concat(identityIndex, "'/").concat(keyIndex, "'");
51
- return [4 /*yield*/, (0, derivePath_1.default)(wallet, "m/9'/".concat(networkIndex, "'").concat(pathPostfix))];
52
- case 1: return [2 /*return*/, _b.sent()];
53
- }
54
- });
55
- });
56
- }
@@ -1,2 +0,0 @@
1
- import { HDFromXKeyOptions, HDXKey } from 'dashhd';
2
- export default function xkeyToHDXKey(xKey: string, opts?: HDFromXKeyOptions): Promise<HDXKey>;
@@ -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 = xkeyToHDXKey;
40
- var DashHD = require("dashhd");
41
- function xkeyToHDXKey(xKey, 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.fromXKey(xKey, opts)];
46
- case 1: return [2 /*return*/, _a.sent()];
47
- }
48
- });
49
- });
50
- }
@@ -1,3 +0,0 @@
1
- import { DocumentWASM } from 'pshenmic-dpp';
2
- import GRPCConnectionPool from '../grpcConnectionPool';
3
- export default function search(grpcPool: GRPCConnectionPool, label: string, parentDomainName: string): Promise<DocumentWASM[]>;
@@ -1,63 +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 = search;
40
- var convertToHomographSafeChars_1 = require("../utils/convertToHomographSafeChars");
41
- var query_1 = require("../documents/query");
42
- var DPNS_DATA_CONTRACT_ID = 'GWRSAVFMjXx8HpQFaNJMqBV7MBgMK4br5UESsB4S31Ec';
43
- function search(grpcPool, label, parentDomainName) {
44
- return __awaiter(this, void 0, void 0, function () {
45
- var normalizedParentDomainName, normalizedLabelPrefix, where, orderBy;
46
- return __generator(this, function (_a) {
47
- switch (_a.label) {
48
- case 0:
49
- normalizedParentDomainName = (0, convertToHomographSafeChars_1.default)(parentDomainName);
50
- normalizedLabelPrefix = (0, convertToHomographSafeChars_1.default)(label);
51
- where = [
52
- ['normalizedParentDomainName', '==', normalizedParentDomainName],
53
- ['normalizedLabel', 'startsWith', normalizedLabelPrefix]
54
- ];
55
- orderBy = [
56
- ['normalizedLabel', 'asc']
57
- ];
58
- return [4 /*yield*/, (0, query_1.default)(grpcPool, DPNS_DATA_CONTRACT_ID, 'domain', where, orderBy)];
59
- case 1: return [2 /*return*/, _a.sent()];
60
- }
61
- });
62
- });
63
- }
@@ -1,12 +0,0 @@
1
- import { StateTransitionWASM } from 'pshenmic-dpp';
2
- export interface WalletInfo {
3
- identities: string[];
4
- currentIdentity: string | null;
5
- }
6
- /**
7
- * Abstract interface for custom signer implementation
8
- */
9
- export interface AbstractSigner {
10
- connect: () => Promise<WalletInfo>;
11
- signAndBroadcast: (stateTransition: StateTransitionWASM) => Promise<StateTransitionWASM>;
12
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
File without changes
@@ -1,64 +0,0 @@
1
- // import { IdentityWASM, NetworkWASM, PrivateKeyWASM, StateTransitionWASM } from 'pshenmic-dpp'
2
- // import { base64 } from '@scure/base'
3
- // import { IdentitiesController } from '../identities'
4
- // import {AbstractSigner} from "./AbstractSigner";
5
- //
6
- // export class PrivateKeySigner implements AbstractSigner {
7
- // privateKey: PrivateKeyWASM
8
- // identity: IdentityWASM
9
- // identities: IdentitiesController
10
- //
11
- // constructor (identitiesController: IdentitiesController, privateKey: string | PrivateKeyWASM, network?: NetworkWASM | string) {
12
- // this.identities = identitiesController
13
- //
14
- // if (typeof privateKey === 'string') {
15
- // let privateKeyWASM
16
- //
17
- // try {
18
- // privateKeyWASM = PrivateKeyWASM.fromWIF(privateKey)
19
- // } catch (e) {
20
- // }
21
- //
22
- // if (privateKey.length === 64 && !network) {
23
- // throw new Error('Network must be specified if hex or base64 private key being used')
24
- // }
25
- //
26
- // try {
27
- // privateKeyWASM = PrivateKeyWASM.fromHex(privateKey, network)
28
- // } catch (e) {
29
- // }
30
- //
31
- // try {
32
- // privateKeyWASM = PrivateKeyWASM.fromBytes(base64.decode(privateKey), network)
33
- // } catch (e) {
34
- // }
35
- //
36
- // if (privateKeyWASM == null) {
37
- // throw new Error('Could not decode private key')
38
- // }
39
- // } else if (privateKey?.__type === 'PrivateKeyWASM') {
40
- // this.privateKey = privateKey
41
- // } else {
42
- // throw new Error('Unrecognized private key type')
43
- // }
44
- // }
45
- //
46
- // async connect (): Promise<void> {
47
- // this.identity = await this.identities.getIdentityByPublicKeyHash(this.privateKey.getPublicKeyHash())
48
- // }
49
- //
50
- // getCurrentIdentity (): IdentityWASM {
51
- // return this.identity
52
- // }
53
- //
54
- // signStateTransition (stateTransition: StateTransitionWASM): void {
55
- // const [identityPublicKey] = this.identity.getPublicKeys()
56
- // .filter(identityPublicKey => identityPublicKey.getPublicKeyHash() === this.privateKey.getPublicKeyHash())
57
- //
58
- // if (identityPublicKey == null) {
59
- // throw new Error('Could not find an identity public key of identity matching this private key')
60
- // }
61
- //
62
- // stateTransition.sign(this.privateKey, identityPublicKey)
63
- // }
64
- // }
@@ -1,2 +0,0 @@
1
- import { AbstractSigner } from './AbstractSigner';
2
- export default function setSigner(signer: AbstractSigner): void;
@@ -1,8 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = setSigner;
4
- function setSigner(signer) {
5
- this.signer = signer;
6
- this.signer.identities = this.identities;
7
- this.signer.setSigner = setSigner;
8
- }