dash 3.22.0-dev.12 → 3.22.0-dev.15

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.
@@ -36,6 +36,7 @@ var __generator = (this && this.__generator) || function (thisArg, body) {
36
36
  }
37
37
  };
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
+ var createFakeIntantLock_1 = require("../../../../../../utils/createFakeIntantLock");
39
40
  /**
40
41
  * Creates a funding transaction for the platform identity and returns one-time key to sign the state transition
41
42
  * @param {Platform} platform
@@ -46,7 +47,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
46
47
  */
47
48
  function createAssetLockProof(platform, assetLockTransaction, outputIndex) {
48
49
  return __awaiter(this, void 0, void 0, function () {
49
- var account, dpp, instantLock;
50
+ var account, dpp, instantLock, e_1;
50
51
  return __generator(this, function (_a) {
51
52
  switch (_a.label) {
52
53
  case 0: return [4 /*yield*/, platform.initialize()];
@@ -56,10 +57,23 @@ function createAssetLockProof(platform, assetLockTransaction, outputIndex) {
56
57
  case 2:
57
58
  account = _a.sent();
58
59
  dpp = platform.dpp;
59
- return [4 /*yield*/, account.waitForInstantLock(assetLockTransaction.hash)];
60
+ _a.label = 3;
60
61
  case 3:
62
+ _a.trys.push([3, 5, , 6]);
63
+ return [4 /*yield*/, account.waitForInstantLock(assetLockTransaction.hash)];
64
+ case 4:
61
65
  instantLock = _a.sent();
62
- // Create poof that the transaction won't be double spend
66
+ return [3 /*break*/, 6];
67
+ case 5:
68
+ e_1 = _a.sent();
69
+ // if block is mined before the transaction is instant locked instant lock won't be sent
70
+ if (!e_1.message || !e_1.message.startsWith('InstantLock waiting period for transaction')) {
71
+ throw e_1;
72
+ }
73
+ return [3 /*break*/, 6];
74
+ case 6:
75
+ // TODO: We should fallback to chainlock proofs instead
76
+ instantLock = createFakeIntantLock_1.createFakeInstantLock(assetLockTransaction.hash);
63
77
  // @ts-ignore
64
78
  return [2 /*return*/, dpp.identity.createInstantAssetLockProof(instantLock, assetLockTransaction, outputIndex)];
65
79
  }
@@ -1 +1 @@
1
- {"version":3,"file":"createAssetLockProof.js","sourceRoot":"","sources":["../../../../../../../../src/SDK/Client/Platform/methods/identities/internal/createAssetLockProof.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA;;;;;;;GAOG;AACH,SAA8B,oBAAoB,CAAC,QAAmB,EAAE,oBAAiC,EAAE,WAAmB;;;;;wBAC1H,qBAAM,QAAQ,CAAC,UAAU,EAAE,EAAA;;oBAA3B,SAA2B,CAAC;oBAEZ,qBAAM,QAAQ,CAAC,MAAM,CAAC,gBAAgB,EAAE,EAAA;;oBAAlD,OAAO,GAAG,SAAwC;oBAChD,GAAG,GAAK,QAAQ,IAAb,CAAc;oBAEP,qBAAM,OAAO,CAAC,kBAAkB,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAA;;oBAAzE,WAAW,GAAG,SAA2D;oBAC7E,yDAAyD;oBAEzD,aAAa;oBACb,sBAAO,GAAG,CAAC,QAAQ,CAAC,2BAA2B,CAAC,WAAW,EAAE,oBAAoB,EAAE,WAAW,CAAC,EAAC;;;;CACnG;AAXD,uCAWC"}
1
+ {"version":3,"file":"createAssetLockProof.js","sourceRoot":"","sources":["../../../../../../../../src/SDK/Client/Platform/methods/identities/internal/createAssetLockProof.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAGA,qFAAqF;AAErF;;;;;;;GAOG;AACH,SAA8B,oBAAoB,CAAC,QAAmB,EAAE,oBAAiC,EAAE,WAAmB;;;;;wBAC1H,qBAAM,QAAQ,CAAC,UAAU,EAAE,EAAA;;oBAA3B,SAA2B,CAAC;oBAEZ,qBAAM,QAAQ,CAAC,MAAM,CAAC,gBAAgB,EAAE,EAAA;;oBAAlD,OAAO,GAAG,SAAwC;oBAChD,GAAG,GAAK,QAAQ,IAAb,CAAc;;;;oBAOP,qBAAM,OAAO,CAAC,kBAAkB,CAAC,oBAAoB,CAAC,IAAI,CAAC,EAAA;;oBAAzE,WAAW,GAAG,SAA2D,CAAC;;;;oBAE1E,wFAAwF;oBACxF,IAAI,CAAC,GAAC,CAAC,OAAO,IAAI,CAAC,GAAC,CAAC,OAAO,CAAC,UAAU,CAAC,4CAA4C,CAAC,EAAE;wBACrF,MAAM,GAAC,CAAC;qBACT;;;oBAGL,uDAAuD;oBACvD,WAAW,GAAG,4CAAqB,CAAC,oBAAoB,CAAC,IAAI,CAAC,CAAA;oBAE9D,aAAa;oBACb,sBAAO,GAAG,CAAC,QAAQ,CAAC,2BAA2B,CAAC,WAAW,EAAE,oBAAoB,EAAE,WAAW,CAAC,EAAC;;;;CACnG;AAxBD,uCAwBC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "dash",
3
- "version": "3.22.0-dev.12",
3
+ "version": "3.22.0-dev.15",
4
4
  "description": "Dash library for JavaScript/TypeScript ecosystem (Wallet, DAPI, Primitives, BLS, ...)",
5
5
  "main": "build/src/index.js",
6
6
  "unpkg": "dist/dash.min.js",
@@ -34,14 +34,14 @@
34
34
  },
35
35
  "homepage": "https://github.com/dashevo/DashJS#readme",
36
36
  "dependencies": {
37
- "@dashevo/dapi-client": "~0.22.0-dev.12",
37
+ "@dashevo/dapi-client": "~0.22.0-dev.15",
38
38
  "@dashevo/dashcore-lib": "~0.19.30",
39
- "@dashevo/dashpay-contract": "~0.22.0-dev.12",
40
- "@dashevo/dpns-contract": "~0.22.0-dev.12",
41
- "@dashevo/dpp": "~0.22.0-dev.12",
42
- "@dashevo/grpc-common": "~0.22.0-dev.12",
43
- "@dashevo/masternode-reward-shares-contract": "~0.22.0-dev.12",
44
- "@dashevo/wallet-lib": "~7.22.0-dev.12",
39
+ "@dashevo/dashpay-contract": "~0.22.0-dev.15",
40
+ "@dashevo/dpns-contract": "~0.22.0-dev.15",
41
+ "@dashevo/dpp": "~0.22.0-dev.15",
42
+ "@dashevo/grpc-common": "~0.22.0-dev.15",
43
+ "@dashevo/masternode-reward-shares-contract": "~0.22.0-dev.15",
44
+ "@dashevo/wallet-lib": "~7.22.0-dev.15",
45
45
  "bs58": "^4.0.1",
46
46
  "node-inspect-extracted": "^1.0.8"
47
47
  },
@@ -1,6 +1,8 @@
1
1
  import { Transaction } from "@dashevo/dashcore-lib";
2
2
  import { Platform } from "../../../Platform";
3
3
 
4
+ import { createFakeInstantLock } from "../../../../../../utils/createFakeIntantLock";
5
+
4
6
  /**
5
7
  * Creates a funding transaction for the platform identity and returns one-time key to sign the state transition
6
8
  * @param {Platform} platform
@@ -15,9 +17,22 @@ export default async function createAssetLockProof(platform : Platform, assetLoc
15
17
  const account = await platform.client.getWalletAccount();
16
18
  const { dpp } = platform;
17
19
 
18
- let instantLock = await account.waitForInstantLock(assetLockTransaction.hash);
19
20
  // Create poof that the transaction won't be double spend
20
21
 
22
+ let instantLock;
23
+
24
+ try {
25
+ instantLock = await account.waitForInstantLock(assetLockTransaction.hash);
26
+ } catch (e) {
27
+ // if block is mined before the transaction is instant locked instant lock won't be sent
28
+ if (!e.message || !e.message.startsWith('InstantLock waiting period for transaction')) {
29
+ throw e;
30
+ }
31
+ }
32
+
33
+ // TODO: We should fallback to chainlock proofs instead
34
+ instantLock = createFakeInstantLock(assetLockTransaction.hash)
35
+
21
36
  // @ts-ignore
22
37
  return dpp.identity.createInstantAssetLockProof(instantLock, assetLockTransaction, outputIndex);
23
38
  }