@abtnode/util 1.8.37 → 1.8.38
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.
- package/lib/nft.js +15 -0
- package/package.json +9 -9
package/lib/nft.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const last = require('lodash/last');
|
|
2
|
+
const get = require('lodash/get');
|
|
3
|
+
|
|
4
|
+
const getNftExpirationDate = (asset) => last(get(asset, 'data.value.expirationDate', []));
|
|
5
|
+
|
|
6
|
+
const isNFTExpired = (asset) => {
|
|
7
|
+
const expirationDate = getNftExpirationDate(asset);
|
|
8
|
+
return isDateExpired(expirationDate);
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
const isDateExpired = (expirationDate) => !!expirationDate && new Date(expirationDate).getTime() <= Date.now();
|
|
12
|
+
|
|
13
|
+
const isNFTConsumed = (asset) => !!asset.data.value.consumedTime;
|
|
14
|
+
|
|
15
|
+
module.exports = { isNFTExpired, getNftExpirationDate, isNFTConsumed };
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "1.8.
|
|
6
|
+
"version": "1.8.38",
|
|
7
7
|
"description": "ArcBlock's JavaScript utility",
|
|
8
8
|
"main": "lib/index.js",
|
|
9
9
|
"files": [
|
|
@@ -18,13 +18,13 @@
|
|
|
18
18
|
"author": "polunzh <polunzh@gmail.com> (http://github.com/polunzh)",
|
|
19
19
|
"license": "MIT",
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@abtnode/constant": "1.8.
|
|
22
|
-
"@abtnode/logger": "1.8.
|
|
23
|
-
"@arcblock/jwt": "^1.18.
|
|
24
|
-
"@blocklet/constant": "1.8.
|
|
25
|
-
"@ocap/mcrypto": "1.18.
|
|
26
|
-
"@ocap/util": "1.18.
|
|
27
|
-
"@ocap/wallet": "1.18.
|
|
21
|
+
"@abtnode/constant": "1.8.38",
|
|
22
|
+
"@abtnode/logger": "1.8.38",
|
|
23
|
+
"@arcblock/jwt": "^1.18.18",
|
|
24
|
+
"@blocklet/constant": "1.8.38",
|
|
25
|
+
"@ocap/mcrypto": "1.18.18",
|
|
26
|
+
"@ocap/util": "1.18.18",
|
|
27
|
+
"@ocap/wallet": "1.18.18",
|
|
28
28
|
"axios": "^0.27.2",
|
|
29
29
|
"axios-mock-adapter": "^1.21.2",
|
|
30
30
|
"axon": "^2.0.3",
|
|
@@ -63,5 +63,5 @@
|
|
|
63
63
|
"fs-extra": "^10.1.0",
|
|
64
64
|
"jest": "^27.5.1"
|
|
65
65
|
},
|
|
66
|
-
"gitHead": "
|
|
66
|
+
"gitHead": "cbb88f107eb6b403c8cd47a765920575860c7bc7"
|
|
67
67
|
}
|