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

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/package.json +29 -30
  3. package/proto/generated/google/protobuf/wrappers.d.ts +260 -29
  4. package/proto/generated/platform.client.d.ts +251 -0
  5. package/proto/generated/platform.d.ts +3682 -1939
  6. package/src/DashPlatformSDK.d.ts +5 -4
  7. package/src/contestedResources/createStateTransition.d.ts +1 -2
  8. package/src/grpcConnectionPool.d.ts +30 -8
  9. package/src/keyPair/deriveChild.d.ts +2 -2
  10. package/src/keyPair/derivePath.d.ts +2 -2
  11. package/src/keyPair/index.d.ts +39 -114
  12. package/src/keyPair/mnemonicToSeed.d.ts +1 -1
  13. package/src/names/searchByIdentity.d.ts +1 -1
  14. package/src/node/index.d.ts +3 -3
  15. package/src/node/totalCredits.d.ts +2 -1
  16. package/src/types.d.ts +6 -12
  17. package/src/utils/bytesToTypedArray.d.ts +1 -0
  18. package/src/utils/calculateMsgHash.d.ts +1 -1
  19. package/src/utils/calculateSignHash.d.ts +1 -1
  20. package/src/utils/calculateStateIdHash.d.ts +1 -1
  21. package/src/utils/createVoterIdentityId.d.ts +1 -1
  22. package/src/utils/getEvonodeList.d.ts +2 -2
  23. package/src/utils/sha256.d.ts +1 -1
  24. package/src/utils/signHash.d.ts +1 -1
  25. package/src/utils/signRequestId.d.ts +1 -1
  26. package/src/utils/verifyTenderdashProof.d.ts +1 -1
  27. package/src/voting/createStateTransition.d.ts +1 -2
  28. package/src/voting/index.d.ts +3 -4
  29. package/bundle.min.js.LICENSE.txt +0 -1
  30. package/index.js +0 -5
  31. package/proto/generated/google/protobuf/wrappers.js +0 -398
  32. package/proto/generated/platform.js +0 -18524
  33. package/src/DashPlatformSDK.js +0 -91
  34. package/src/constants.js +0 -13
  35. package/src/contestedResources/createStateTransition.js +0 -9
  36. package/src/contestedResources/getContestedResourceVoteState.js +0 -123
  37. package/src/contestedResources/index.js +0 -76
  38. package/src/dataContracts/create.js +0 -14
  39. package/src/dataContracts/createStateTransition.js +0 -23
  40. package/src/dataContracts/getDataContractByIdentifier.js +0 -87
  41. package/src/dataContracts/index.js +0 -103
  42. package/src/documents/create.js +0 -7
  43. package/src/documents/createStateTransition.js +0 -64
  44. package/src/documents/index.js +0 -130
  45. package/src/documents/query.js +0 -94
  46. package/src/grpcConnectionPool.js +0 -137
  47. package/src/identities/createStateTransition.js +0 -46
  48. package/src/identities/getIdentityBalance.js +0 -83
  49. package/src/identities/getIdentityByIdentifier.js +0 -83
  50. package/src/identities/getIdentityByNonUniquePublicKeyHash.js +0 -85
  51. package/src/identities/getIdentityByPublicKeyHash.js +0 -83
  52. package/src/identities/getIdentityContractNonce.js +0 -86
  53. package/src/identities/getIdentityNonce.js +0 -84
  54. package/src/identities/getIdentityPublicKeys.js +0 -85
  55. package/src/identities/index.js +0 -237
  56. package/src/keyPair/deriveChild.js +0 -50
  57. package/src/keyPair/derivePath.js +0 -50
  58. package/src/keyPair/index.js +0 -323
  59. package/src/keyPair/keyToPublicKey.d.ts +0 -2
  60. package/src/keyPair/keyToPublicKey.js +0 -47
  61. package/src/keyPair/keyToWalletId.d.ts +0 -2
  62. package/src/keyPair/keyToWalletId.js +0 -50
  63. package/src/keyPair/keyToXPrivateKey.d.ts +0 -3
  64. package/src/keyPair/keyToXPrivateKey.js +0 -50
  65. package/src/keyPair/keyToXPublicKey.d.ts +0 -3
  66. package/src/keyPair/keyToXPublicKey.js +0 -50
  67. package/src/keyPair/mnemonicToIdentityKey.d.ts +0 -3
  68. package/src/keyPair/mnemonicToIdentityKey.js +0 -57
  69. package/src/keyPair/mnemonicToSeed.js +0 -47
  70. package/src/keyPair/mnemonicToWallet.d.ts +0 -2
  71. package/src/keyPair/mnemonicToWallet.js +0 -55
  72. package/src/keyPair/privateKeyToWif.d.ts +0 -2
  73. package/src/keyPair/privateKeyToWif.js +0 -50
  74. package/src/keyPair/publicKeyToAddress.d.ts +0 -2
  75. package/src/keyPair/publicKeyToAddress.js +0 -50
  76. package/src/keyPair/seedToWallet.d.ts +0 -2
  77. package/src/keyPair/seedToWallet.js +0 -50
  78. package/src/keyPair/walletToIdentityKey.d.ts +0 -3
  79. package/src/keyPair/walletToIdentityKey.js +0 -56
  80. package/src/keyPair/xkeyToHDXKey.d.ts +0 -2
  81. package/src/keyPair/xkeyToHDXKey.js +0 -50
  82. package/src/names/index.js +0 -170
  83. package/src/names/registerName.js +0 -131
  84. package/src/names/searchByIdentity.js +0 -51
  85. package/src/names/searchByName.js +0 -64
  86. package/src/names/testNameContested.js +0 -6
  87. package/src/names/validateName.js +0 -14
  88. package/src/node/epochs.js +0 -88
  89. package/src/node/index.js +0 -102
  90. package/src/node/status.js +0 -85
  91. package/src/node/totalCredits.js +0 -76
  92. package/src/signer/AbstractSigner.js +0 -2
  93. package/src/signer/PrivateKeySigner.d.ts +0 -0
  94. package/src/signer/PrivateKeySigner.js +0 -64
  95. package/src/signer/setSigner.js +0 -8
  96. package/src/stateTransitions/broadcast.js +0 -60
  97. package/src/stateTransitions/index.js +0 -87
  98. package/src/stateTransitions/waitForStateTransitionResult.js +0 -60
  99. package/src/tokens/createStateTransition.js +0 -79
  100. package/src/tokens/getIdentitiesTokenBalances.js +0 -86
  101. package/src/tokens/getIdentityTokensBalances.js +0 -86
  102. package/src/tokens/getTokenContractInfo.js +0 -86
  103. package/src/tokens/getTokenDirectPurchasePrices.js +0 -83
  104. package/src/tokens/getTokenTotalSupply.js +0 -84
  105. package/src/tokens/index.js +0 -193
  106. package/src/types.js +0 -25
  107. package/src/utils/base58ToBytes.js +0 -7
  108. package/src/utils/bytesToHex.js +0 -6
  109. package/src/utils/calculateMsgHash.js +0 -34
  110. package/src/utils/calculateSignHash.js +0 -11
  111. package/src/utils/calculateStateIdHash.js +0 -12
  112. package/src/utils/convertToHomographSafeChars.js +0 -14
  113. package/src/utils/createVoterIdentityId.js +0 -12
  114. package/src/utils/getEvonodeList.js +0 -63
  115. package/src/utils/getQuorumPublicKey.js +0 -69
  116. package/src/utils/getRandomArrayItem.js +0 -6
  117. package/src/utils/getRandomBytes.js +0 -7
  118. package/src/utils/hexToBytes.js +0 -7
  119. package/src/utils/index.js +0 -68
  120. package/src/utils/indexBytesToString.js +0 -7
  121. package/src/utils/sha256.js +0 -13
  122. package/src/utils/signHash.js +0 -25
  123. package/src/utils/signRequestId.js +0 -22
  124. package/src/utils/sleep.js +0 -51
  125. package/src/utils/stringToIndexValueBytes.js +0 -13
  126. package/src/utils/verifyTenderdashProof.js +0 -30
  127. package/src/voting/createStateTransition.js +0 -9
  128. package/src/voting/createVote.js +0 -8
  129. package/src/voting/index.js +0 -62
  130. package/test/unit/ContestedResources.spec.js +0 -344
  131. package/test/unit/DataContract.spec.js +0 -142
  132. package/test/unit/Document.spec.js +0 -199
  133. package/test/unit/Identity.spec.js +0 -357
  134. package/test/unit/KeyPair.spec.js +0 -149
  135. package/test/unit/Names.spec.js +0 -96
  136. package/test/unit/Node.spec.js +0 -129
  137. package/test/unit/SDK.spec.js +0 -12
  138. package/test/unit/Tokens.spec.js +0 -288
@@ -1,288 +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
- 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();
45
- });
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
- }
58
- });
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
- }
71
- });
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
- }
85
- });
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
- }
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
- }
116
- });
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
- }
128
- });
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
- });
288
- });