@did-pay/util 1.12.18 → 1.12.19

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 (2) hide show
  1. package/lib/nft.js +8 -3
  2. package/package.json +2 -2
package/lib/nft.js CHANGED
@@ -11,8 +11,8 @@ const isNFTExpired = (asset) => {
11
11
 
12
12
  const isDateExpired = (expirationDate) => !!expirationDate && new Date(expirationDate).getTime() <= Date.now();
13
13
 
14
- const canRenewExpiredNFT = (expirationDate, retainDays) => {
15
- const isExpired = isDateExpired(expirationDate);
14
+ const canRenewExpiredNFT = (nft, retainDays) => {
15
+ const isExpired = isDateExpired(nft.expirationDate);
16
16
  if (!isExpired) {
17
17
  return false;
18
18
  }
@@ -21,7 +21,12 @@ const canRenewExpiredNFT = (expirationDate, retainDays) => {
21
21
  return false;
22
22
  }
23
23
 
24
- return moment(expirationDate).add(retainDays, 'days').isAfter(moment());
24
+ // FIXME: 不支持续期 BlockletServerOwnershipNFT
25
+ if ((get(nft, 'state.tags') || []).includes('BlockletServerOwnershipNFT')) {
26
+ return false;
27
+ }
28
+
29
+ return moment(nft.expirationDate).add(retainDays, 'days').isAfter(moment());
25
30
  };
26
31
 
27
32
  module.exports = { isNFTExpired, getNftExpirationDate, isDateExpired, canRenewExpiredNFT };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@did-pay/util",
3
- "version": "1.12.18",
3
+ "version": "1.12.19",
4
4
  "description": "Common library",
5
5
  "keywords": [
6
6
  "util"
@@ -36,5 +36,5 @@
36
36
  "lodash": "^4.17.21",
37
37
  "moment": "^2.29.4"
38
38
  },
39
- "gitHead": "bac7239bbd4d6efbcbd26bf2ba365dcd42be7150"
39
+ "gitHead": "e954f4dc12a40bf74da9c834776ebf7d09b7cd9e"
40
40
  }