bitbadgesjs-sdk 0.1.0 → 0.1.2
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/README.md +1 -1
- package/dist/eip712/payload/samples/getSampleMsg.js +8 -8
- package/dist/eip712/payload/samples/getSampleMsg.js.map +1 -1
- package/dist/index.d.ts +9 -7
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -7
- package/dist/index.js.map +1 -1
- package/dist/transactions/messages/base.d.ts +5 -1
- package/dist/transactions/messages/base.d.ts.map +1 -1
- package/dist/transactions/messages/base.js +14 -7
- package/dist/transactions/messages/base.js.map +1 -1
- package/dist/transactions/messages/bitbadges/badges/msgCreateAddressLists.d.ts +2 -1
- package/dist/transactions/messages/bitbadges/badges/msgCreateAddressLists.d.ts.map +1 -1
- package/dist/transactions/messages/bitbadges/badges/msgCreateAddressLists.js +7 -6
- package/dist/transactions/messages/bitbadges/badges/msgCreateAddressLists.js.map +1 -1
- package/dist/transactions/messages/bitbadges/badges/msgCreateCollection.d.ts +6 -1
- package/dist/transactions/messages/bitbadges/badges/msgCreateCollection.d.ts.map +1 -1
- package/dist/transactions/messages/bitbadges/badges/msgCreateCollection.js +33 -28
- package/dist/transactions/messages/bitbadges/badges/msgCreateCollection.js.map +1 -1
- package/dist/transactions/messages/bitbadges/badges/msgDeleteCollection.d.ts +2 -2
- package/dist/transactions/messages/bitbadges/badges/msgDeleteCollection.d.ts.map +1 -1
- package/dist/transactions/messages/bitbadges/badges/msgDeleteCollection.js +7 -6
- package/dist/transactions/messages/bitbadges/badges/msgDeleteCollection.js.map +1 -1
- package/dist/transactions/messages/bitbadges/badges/msgTransferBadges.d.ts +3 -1
- package/dist/transactions/messages/bitbadges/badges/msgTransferBadges.d.ts.map +1 -1
- package/dist/transactions/messages/bitbadges/badges/msgTransferBadges.js +10 -8
- package/dist/transactions/messages/bitbadges/badges/msgTransferBadges.js.map +1 -1
- package/dist/transactions/messages/bitbadges/badges/msgUniversalUpdateCollection.d.ts +7 -2
- package/dist/transactions/messages/bitbadges/badges/msgUniversalUpdateCollection.d.ts.map +1 -1
- package/dist/transactions/messages/bitbadges/badges/msgUniversalUpdateCollection.js +33 -30
- package/dist/transactions/messages/bitbadges/badges/msgUniversalUpdateCollection.js.map +1 -1
- package/dist/transactions/messages/bitbadges/badges/msgUpdateCollection.d.ts +7 -2
- package/dist/transactions/messages/bitbadges/badges/msgUpdateCollection.d.ts.map +1 -1
- package/dist/transactions/messages/bitbadges/badges/msgUpdateCollection.js +30 -26
- package/dist/transactions/messages/bitbadges/badges/msgUpdateCollection.js.map +1 -1
- package/dist/transactions/messages/bitbadges/badges/msgUpdateUserApprovals.d.ts +4 -1
- package/dist/transactions/messages/bitbadges/badges/msgUpdateUserApprovals.d.ts.map +1 -1
- package/dist/transactions/messages/bitbadges/badges/msgUpdateUserApprovals.js +15 -12
- package/dist/transactions/messages/bitbadges/badges/msgUpdateUserApprovals.js.map +1 -1
- package/dist/transactions/messages/bitbadges/protocols/msgCreateProtocol.d.ts +1 -1
- package/dist/transactions/messages/bitbadges/protocols/msgCreateProtocol.d.ts.map +1 -1
- package/dist/transactions/messages/bitbadges/protocols/msgCreateProtocol.js +4 -4
- package/dist/transactions/messages/bitbadges/protocols/msgCreateProtocol.js.map +1 -1
- package/dist/transactions/messages/bitbadges/protocols/msgDeleteProtocol.d.ts +1 -1
- package/dist/transactions/messages/bitbadges/protocols/msgDeleteProtocol.d.ts.map +1 -1
- package/dist/transactions/messages/bitbadges/protocols/msgDeleteProtocol.js +4 -4
- package/dist/transactions/messages/bitbadges/protocols/msgDeleteProtocol.js.map +1 -1
- package/dist/transactions/messages/bitbadges/protocols/msgSetCollectionForProtocol.d.ts +2 -1
- package/dist/transactions/messages/bitbadges/protocols/msgSetCollectionForProtocol.d.ts.map +1 -1
- package/dist/transactions/messages/bitbadges/protocols/msgSetCollectionForProtocol.js +7 -6
- package/dist/transactions/messages/bitbadges/protocols/msgSetCollectionForProtocol.js.map +1 -1
- package/dist/transactions/messages/bitbadges/protocols/msgUnsetCollectionForProtocol.d.ts +1 -1
- package/dist/transactions/messages/bitbadges/protocols/msgUnsetCollectionForProtocol.d.ts.map +1 -1
- package/dist/transactions/messages/bitbadges/protocols/msgUnsetCollectionForProtocol.js +4 -4
- package/dist/transactions/messages/bitbadges/protocols/msgUnsetCollectionForProtocol.js.map +1 -1
- package/dist/transactions/messages/bitbadges/protocols/msgUpdateProtocol.d.ts +1 -1
- package/dist/transactions/messages/bitbadges/protocols/msgUpdateProtocol.d.ts.map +1 -1
- package/dist/transactions/messages/bitbadges/protocols/msgUpdateProtocol.js +4 -4
- package/dist/transactions/messages/bitbadges/protocols/msgUpdateProtocol.js.map +1 -1
- package/dist/transactions/messages/bitbadges/wasmx/msgExecuteContractCompat.d.ts +1 -1
- package/dist/transactions/messages/bitbadges/wasmx/msgExecuteContractCompat.d.ts.map +1 -1
- package/dist/transactions/messages/bitbadges/wasmx/msgExecuteContractCompat.js +4 -4
- package/dist/transactions/messages/bitbadges/wasmx/msgExecuteContractCompat.js.map +1 -1
- package/dist/transactions/messages/bitbadges/wasmx/msgInstantiateContractCompat.d.ts +1 -1
- package/dist/transactions/messages/bitbadges/wasmx/msgInstantiateContractCompat.d.ts.map +1 -1
- package/dist/transactions/messages/bitbadges/wasmx/msgInstantiateContractCompat.js +4 -4
- package/dist/transactions/messages/bitbadges/wasmx/msgInstantiateContractCompat.js.map +1 -1
- package/dist/transactions/messages/bitbadges/wasmx/msgStoreCodeCompat.d.ts +1 -1
- package/dist/transactions/messages/bitbadges/wasmx/msgStoreCodeCompat.d.ts.map +1 -1
- package/dist/transactions/messages/bitbadges/wasmx/msgStoreCodeCompat.js +4 -4
- package/dist/transactions/messages/bitbadges/wasmx/msgStoreCodeCompat.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/types/badges/addressLists.d.ts +39 -0
- package/dist/types/badges/addressLists.d.ts.map +1 -0
- package/dist/types/badges/addressLists.js +292 -0
- package/dist/types/badges/addressLists.js.map +1 -0
- package/dist/types/badges/{typeutils/approvals.d.ts → approvals.d.ts} +26 -39
- package/dist/types/badges/approvals.d.ts.map +1 -0
- package/dist/types/badges/{typeutils/approvals.js → approvals.js} +186 -151
- package/dist/types/badges/approvals.js.map +1 -0
- package/dist/types/badges/{typeutils/permissions.d.ts → permissions.d.ts} +140 -5
- package/dist/types/badges/permissions.d.ts.map +1 -0
- package/dist/types/badges/permissions.js +2030 -0
- package/dist/types/badges/permissions.js.map +1 -0
- package/dist/types/badges/{typeutils/typeUtils.d.ts → typeUtils.d.ts} +48 -47
- package/dist/types/badges/typeUtils.d.ts.map +1 -0
- package/dist/types/badges/{typeutils/typeUtils.js → typeUtils.js} +527 -283
- package/dist/types/badges/typeUtils.js.map +1 -0
- package/dist/types/badges/userBalances.d.ts +79 -0
- package/dist/types/badges/userBalances.d.ts.map +1 -0
- package/dist/types/badges/userBalances.js +154 -0
- package/dist/types/badges/userBalances.js.map +1 -0
- package/dist/types/base.d.ts +60 -5
- package/dist/types/base.d.ts.map +1 -1
- package/dist/types/base.js +203 -8
- package/dist/types/base.js.map +1 -1
- package/dist/{utils → types}/math.d.ts +4 -1
- package/dist/types/math.d.ts.map +1 -0
- package/dist/{utils → types}/math.js +10 -1
- package/dist/types/math.js.map +1 -0
- package/dist/types/protocols/types.d.ts +32 -6
- package/dist/types/protocols/types.d.ts.map +1 -1
- package/dist/types/protocols/types.js +53 -9
- package/dist/types/protocols/types.js.map +1 -1
- package/dist/types/string-numbers.d.ts.map +1 -0
- package/dist/types/string-numbers.js.map +1 -0
- package/dist/types/types.d.ts +27 -0
- package/dist/types/types.d.ts.map +1 -0
- package/dist/{utils/types → types}/types.js +1 -19
- package/dist/types/types.js.map +1 -0
- package/dist/utils/aliases.d.ts +1 -1
- package/dist/utils/aliases.d.ts.map +1 -1
- package/dist/utils/api/BitBadgesAddressList.d.ts +96 -0
- package/dist/utils/api/BitBadgesAddressList.d.ts.map +1 -0
- package/dist/utils/api/BitBadgesAddressList.js +139 -0
- package/dist/utils/api/BitBadgesAddressList.js.map +1 -0
- package/dist/utils/{api-sdk.d.ts → api/BitBadgesApi.d.ts} +10 -18
- package/dist/utils/api/BitBadgesApi.d.ts.map +1 -0
- package/dist/utils/{api-sdk.js → api/BitBadgesApi.js} +49 -191
- package/dist/utils/api/BitBadgesApi.js.map +1 -0
- package/dist/utils/api/BitBadgesCollection.d.ts +314 -0
- package/dist/utils/api/BitBadgesCollection.d.ts.map +1 -0
- package/dist/utils/api/BitBadgesCollection.js +765 -0
- package/dist/utils/api/BitBadgesCollection.js.map +1 -0
- package/dist/utils/api/BitBadgesUserInfo.d.ts +210 -0
- package/dist/utils/api/BitBadgesUserInfo.d.ts.map +1 -0
- package/dist/utils/{types/users.js → api/BitBadgesUserInfo.js} +157 -59
- package/dist/utils/api/BitBadgesUserInfo.js.map +1 -0
- package/dist/utils/approved_transfers_casts.d.ts +1 -1
- package/dist/utils/approved_transfers_casts.d.ts.map +1 -1
- package/dist/utils/approved_transfers_casts.js +11 -11
- package/dist/utils/approved_transfers_casts.js.map +1 -1
- package/dist/utils/badgeMetadata.d.ts +3 -5
- package/dist/utils/badgeMetadata.d.ts.map +1 -1
- package/dist/utils/badgeMetadata.js +20 -28
- package/dist/utils/badgeMetadata.js.map +1 -1
- package/dist/utils/balances.d.ts +5 -5
- package/dist/utils/balances.d.ts.map +1 -1
- package/dist/utils/balances.js +70 -79
- package/dist/utils/balances.js.map +1 -1
- package/dist/utils/batch-utils.d.ts +3 -1
- package/dist/utils/batch-utils.d.ts.map +1 -1
- package/dist/utils/batch-utils.js +13 -11
- package/dist/utils/batch-utils.js.map +1 -1
- package/dist/utils/chains.d.ts +1 -11
- package/dist/utils/chains.d.ts.map +1 -1
- package/dist/utils/chains.js +5 -144
- package/dist/utils/chains.js.map +1 -1
- package/dist/utils/converter.d.ts +10 -0
- package/dist/utils/converter.d.ts.map +1 -1
- package/dist/utils/converter.js +140 -1
- package/dist/utils/converter.js.map +1 -1
- package/dist/utils/display.d.ts +2 -2
- package/dist/utils/display.d.ts.map +1 -1
- package/dist/utils/display.js +7 -6
- package/dist/utils/display.js.map +1 -1
- package/dist/utils/distribution.d.ts +2 -1
- package/dist/utils/distribution.d.ts.map +1 -1
- package/dist/utils/distribution.js +30 -27
- package/dist/utils/distribution.js.map +1 -1
- package/dist/utils/firstMatches.d.ts +2 -2
- package/dist/utils/firstMatches.d.ts.map +1 -1
- package/dist/utils/firstMatches.js +19 -19
- package/dist/utils/firstMatches.js.map +1 -1
- package/dist/utils/index.d.ts +9 -13
- package/dist/utils/index.d.ts.map +1 -1
- package/dist/utils/index.js +9 -13
- package/dist/utils/index.js.map +1 -1
- package/dist/utils/metadataIds.d.ts +1 -7
- package/dist/utils/metadataIds.d.ts.map +1 -1
- package/dist/utils/metadataIds.js +6 -88
- package/dist/utils/metadataIds.js.map +1 -1
- package/dist/utils/overlaps.d.ts +1 -1
- package/dist/utils/overlaps.d.ts.map +1 -1
- package/dist/utils/overlaps.js +41 -40
- package/dist/utils/overlaps.js.map +1 -1
- package/dist/utils/types/activity.d.ts +3 -2
- package/dist/utils/types/activity.d.ts.map +1 -1
- package/dist/utils/types/activity.js +11 -10
- package/dist/utils/types/activity.js.map +1 -1
- package/dist/utils/types/api.d.ts +23 -274
- package/dist/utils/types/api.d.ts.map +1 -1
- package/dist/utils/types/api.js +50 -237
- package/dist/utils/types/api.js.map +1 -1
- package/dist/utils/types/coin.d.ts +2 -2
- package/dist/utils/types/coin.d.ts.map +1 -1
- package/dist/utils/types/coin.js +3 -3
- package/dist/utils/types/coin.js.map +1 -1
- package/dist/utils/types/collections.d.ts +55 -264
- package/dist/utils/types/collections.d.ts.map +1 -1
- package/dist/utils/types/collections.js +101 -562
- package/dist/utils/types/collections.js.map +1 -1
- package/dist/utils/types/db.d.ts +25 -63
- package/dist/utils/types/db.d.ts.map +1 -1
- package/dist/utils/types/db.js +107 -174
- package/dist/utils/types/db.js.map +1 -1
- package/dist/utils/types/metadata.d.ts +19 -59
- package/dist/utils/types/metadata.d.ts.map +1 -1
- package/dist/utils/types/metadata.js +23 -89
- package/dist/utils/types/metadata.js.map +1 -1
- package/dist/utils/types/routes.d.ts +1 -1
- package/dist/utils/types/routes.d.ts.map +1 -1
- package/dist/utils/types/routes.js.map +1 -1
- package/dist/utils/types/schemas.d.ts +1 -1
- package/dist/utils/types/schemas.d.ts.map +1 -1
- package/dist/utils/types/transfers.d.ts +6 -2
- package/dist/utils/types/transfers.d.ts.map +1 -1
- package/dist/utils/types/transfers.js +4 -3
- package/dist/utils/types/transfers.js.map +1 -1
- package/dist/utils/userApprovals.d.ts +1 -1
- package/dist/utils/userApprovals.d.ts.map +1 -1
- package/dist/utils/userApprovals.js +15 -15
- package/dist/utils/userApprovals.js.map +1 -1
- package/package.json +1 -1
- package/dist/types/badges/string-numbers.d.ts.map +0 -1
- package/dist/types/badges/string-numbers.js.map +0 -1
- package/dist/types/badges/typeutils/approvals.d.ts.map +0 -1
- package/dist/types/badges/typeutils/approvals.js.map +0 -1
- package/dist/types/badges/typeutils/permissions.d.ts.map +0 -1
- package/dist/types/badges/typeutils/permissions.js +0 -675
- package/dist/types/badges/typeutils/permissions.js.map +0 -1
- package/dist/types/badges/typeutils/typeUtils.d.ts.map +0 -1
- package/dist/types/badges/typeutils/typeUtils.js.map +0 -1
- package/dist/utils/addressLists.d.ts +0 -6
- package/dist/utils/addressLists.d.ts.map +0 -1
- package/dist/utils/addressLists.js +0 -202
- package/dist/utils/addressLists.js.map +0 -1
- package/dist/utils/api-sdk.d.ts.map +0 -1
- package/dist/utils/api-sdk.js.map +0 -1
- package/dist/utils/api-utils.d.ts +0 -6
- package/dist/utils/api-utils.d.ts.map +0 -1
- package/dist/utils/api-utils.js +0 -167
- package/dist/utils/api-utils.js.map +0 -1
- package/dist/utils/math.d.ts.map +0 -1
- package/dist/utils/math.js.map +0 -1
- package/dist/utils/permission_checks.d.ts +0 -51
- package/dist/utils/permission_checks.d.ts.map +0 -1
- package/dist/utils/permission_checks.js +0 -330
- package/dist/utils/permission_checks.js.map +0 -1
- package/dist/utils/permissions.d.ts +0 -17
- package/dist/utils/permissions.d.ts.map +0 -1
- package/dist/utils/permissions.js +0 -280
- package/dist/utils/permissions.js.map +0 -1
- package/dist/utils/types/types.d.ts +0 -42
- package/dist/utils/types/types.d.ts.map +0 -1
- package/dist/utils/types/types.js.map +0 -1
- package/dist/utils/types/users.d.ts +0 -163
- package/dist/utils/types/users.d.ts.map +0 -1
- package/dist/utils/types/users.js.map +0 -1
- package/dist/utils/uintRanges.d.ts +0 -12
- package/dist/utils/uintRanges.d.ts.map +0 -1
- package/dist/utils/uintRanges.js +0 -182
- package/dist/utils/uintRanges.js.map +0 -1
- package/dist/utils/update_checks.d.ts +0 -15
- package/dist/utils/update_checks.d.ts.map +0 -1
- package/dist/utils/update_checks.js +0 -565
- package/dist/utils/update_checks.js.map +0 -1
- package/dist/utils/validate_permissions_updates.d.ts +0 -11
- package/dist/utils/validate_permissions_updates.d.ts.map +0 -1
- package/dist/utils/validate_permissions_updates.js +0 -227
- package/dist/utils/validate_permissions_updates.js.map +0 -1
- /package/dist/types/{badges/string-numbers.d.ts → string-numbers.d.ts} +0 -0
- /package/dist/types/{badges/string-numbers.js → string-numbers.js} +0 -0
|
@@ -1,153 +1,78 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getFullIsArchivedTimeline = exports.getFullStandardsTimeline = exports.getFullCustomDataTimeline = exports.getOffChainBalancesMetadataTimeline = exports.getFullBadgeMetadataTimeline = exports.getFullCollectionMetadataTimeline = exports.getFullManagerTimeline = exports.getIdxAtTimeForTimeline = exports.getValueAtTimeForTimeline = exports.getCurrentIdxForTimeline = exports.getCurrentValueForTimeline = exports.
|
|
4
|
-
const
|
|
5
|
-
const
|
|
6
|
-
const
|
|
7
|
-
const
|
|
8
|
-
const
|
|
9
|
-
const
|
|
10
|
-
class
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
3
|
+
exports.getFullIsArchivedTimeline = exports.getFullStandardsTimeline = exports.getFullCustomDataTimeline = exports.getOffChainBalancesMetadataTimeline = exports.getFullBadgeMetadataTimeline = exports.getFullCollectionMetadataTimeline = exports.getFullManagerTimeline = exports.getIdxAtTimeForTimeline = exports.getValueAtTimeForTimeline = exports.getCurrentIdxForTimeline = exports.getCurrentValueForTimeline = exports.castCollectionApprovalToUniversalPermission = exports.CollectionApprovalWithDetails = exports.ApprovalCriteriaWithDetails = exports.MerkleChallengeWithDetails = exports.ApprovalInfoDetails = exports.ChallengeDetails = void 0;
|
|
4
|
+
const approvals_1 = require("../../types/badges/approvals");
|
|
5
|
+
const typeUtils_1 = require("../../types/badges/typeUtils");
|
|
6
|
+
const base_1 = require("../../types/base");
|
|
7
|
+
const constants_1 = require("../constants");
|
|
8
|
+
const { removeUintRangesFromUintRanges, searchForId } = typeUtils_1.UintRange;
|
|
9
|
+
const { getReservedTrackerList } = typeUtils_1.AddressList;
|
|
10
|
+
class ChallengeDetails extends base_1.BaseNumberTypeClass {
|
|
11
|
+
leavesDetails;
|
|
12
|
+
tree;
|
|
13
|
+
treeOptions;
|
|
14
|
+
numLeaves;
|
|
15
|
+
currCode;
|
|
16
|
+
hasPassword;
|
|
17
|
+
password;
|
|
17
18
|
constructor(data) {
|
|
18
19
|
super();
|
|
19
|
-
this.
|
|
20
|
-
this.
|
|
21
|
-
this.
|
|
22
|
-
this.
|
|
23
|
-
this.
|
|
24
|
-
this.
|
|
20
|
+
this.leavesDetails = data.leavesDetails;
|
|
21
|
+
this.tree = data.tree;
|
|
22
|
+
this.treeOptions = data.treeOptions;
|
|
23
|
+
this.numLeaves = data.numLeaves;
|
|
24
|
+
this.currCode = data.currCode;
|
|
25
|
+
this.hasPassword = data.hasPassword;
|
|
26
|
+
this.password = data.password;
|
|
25
27
|
}
|
|
26
28
|
convert(convertFunction) {
|
|
27
|
-
return new
|
|
29
|
+
return new ChallengeDetails((0, base_1.deepCopy)({
|
|
28
30
|
...this,
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
metadata: this.metadata.convert(convertFunction),
|
|
31
|
+
numLeaves: this.numLeaves ? convertFunction(this.numLeaves) : undefined,
|
|
32
|
+
currCode: this.currCode !== undefined && BigInt(this.currCode ?? -1n) >= 0 ? convertFunction(this.currCode) : undefined,
|
|
32
33
|
}));
|
|
33
34
|
}
|
|
34
35
|
}
|
|
35
|
-
exports.
|
|
36
|
-
class
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
36
|
+
exports.ChallengeDetails = ChallengeDetails;
|
|
37
|
+
class ApprovalInfoDetails extends base_1.BaseNumberTypeClass {
|
|
38
|
+
name;
|
|
39
|
+
description;
|
|
40
|
+
hasPassword;
|
|
41
|
+
password;
|
|
42
|
+
challengeDetails;
|
|
40
43
|
constructor(data) {
|
|
41
|
-
super(
|
|
42
|
-
this.
|
|
43
|
-
this.
|
|
44
|
-
this.
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
return new CollectionApprovalPermissionWithDetails((0, __2.deepCopy)({
|
|
48
|
-
...this,
|
|
49
|
-
...super.convert(convertFunction),
|
|
50
|
-
}));
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
exports.CollectionApprovalPermissionWithDetails = CollectionApprovalPermissionWithDetails;
|
|
54
|
-
class UserIncomingApprovalPermissionWithDetails extends __1.UserIncomingApprovalPermission {
|
|
55
|
-
fromList;
|
|
56
|
-
initiatedByList;
|
|
57
|
-
constructor(data) {
|
|
58
|
-
super(data);
|
|
59
|
-
this.fromList = new __1.AddressList(data.fromList);
|
|
60
|
-
this.initiatedByList = new __1.AddressList(data.initiatedByList);
|
|
44
|
+
super();
|
|
45
|
+
this.name = data.name;
|
|
46
|
+
this.description = data.description;
|
|
47
|
+
this.hasPassword = data.hasPassword;
|
|
48
|
+
this.password = data.password;
|
|
49
|
+
this.challengeDetails = data.challengeDetails ? new ChallengeDetails(data.challengeDetails) : undefined;
|
|
61
50
|
}
|
|
62
51
|
convert(convertFunction) {
|
|
63
|
-
return new
|
|
52
|
+
return new ApprovalInfoDetails((0, base_1.deepCopy)({
|
|
64
53
|
...this,
|
|
65
|
-
|
|
54
|
+
challengeDetails: this.challengeDetails ? this.challengeDetails.convert(convertFunction) : undefined,
|
|
66
55
|
}));
|
|
67
56
|
}
|
|
68
57
|
}
|
|
69
|
-
exports.
|
|
70
|
-
class
|
|
71
|
-
|
|
72
|
-
initiatedByList;
|
|
58
|
+
exports.ApprovalInfoDetails = ApprovalInfoDetails;
|
|
59
|
+
class MerkleChallengeWithDetails extends typeUtils_1.MerkleChallenge {
|
|
60
|
+
details;
|
|
73
61
|
constructor(data) {
|
|
74
62
|
super(data);
|
|
75
|
-
this.
|
|
76
|
-
this.initiatedByList = new __1.AddressList(data.initiatedByList);
|
|
63
|
+
this.details = data.details;
|
|
77
64
|
}
|
|
78
65
|
convert(convertFunction) {
|
|
79
|
-
|
|
66
|
+
const converted = new MerkleChallengeWithDetails((0, base_1.deepCopy)({
|
|
80
67
|
...this,
|
|
81
68
|
...super.convert(convertFunction),
|
|
69
|
+
details: this.details ? this.details.convert(convertFunction) : undefined,
|
|
82
70
|
}));
|
|
71
|
+
return converted;
|
|
83
72
|
}
|
|
84
73
|
}
|
|
85
|
-
exports.
|
|
86
|
-
class
|
|
87
|
-
canUpdateCollectionApprovals;
|
|
88
|
-
canDeleteCollection;
|
|
89
|
-
canArchiveCollection;
|
|
90
|
-
canUpdateOffChainBalancesMetadata;
|
|
91
|
-
canUpdateStandards;
|
|
92
|
-
canUpdateCustomData;
|
|
93
|
-
canUpdateManager;
|
|
94
|
-
canUpdateCollectionMetadata;
|
|
95
|
-
canCreateMoreBadges;
|
|
96
|
-
canUpdateBadgeMetadata;
|
|
97
|
-
constructor(data) {
|
|
98
|
-
super();
|
|
99
|
-
this.canUpdateCollectionApprovals = data.canUpdateCollectionApprovals.map((canUpdateCollectionApproval) => new CollectionApprovalPermissionWithDetails(canUpdateCollectionApproval));
|
|
100
|
-
this.canDeleteCollection = data.canDeleteCollection.map((actionPermission) => new __1.ActionPermission(actionPermission));
|
|
101
|
-
this.canArchiveCollection = data.canArchiveCollection.map((timedUpdatePermission) => new __1.TimedUpdatePermission(timedUpdatePermission));
|
|
102
|
-
this.canUpdateOffChainBalancesMetadata = data.canUpdateOffChainBalancesMetadata.map((timedUpdatePermission) => new __1.TimedUpdatePermission(timedUpdatePermission));
|
|
103
|
-
this.canUpdateStandards = data.canUpdateStandards.map((timedUpdatePermission) => new __1.TimedUpdatePermission(timedUpdatePermission));
|
|
104
|
-
this.canUpdateCustomData = data.canUpdateCustomData.map((timedUpdatePermission) => new __1.TimedUpdatePermission(timedUpdatePermission));
|
|
105
|
-
this.canUpdateManager = data.canUpdateManager.map((timedUpdatePermission) => new __1.TimedUpdatePermission(timedUpdatePermission));
|
|
106
|
-
this.canUpdateCollectionMetadata = data.canUpdateCollectionMetadata.map((timedUpdatePermission) => new __1.TimedUpdatePermission(timedUpdatePermission));
|
|
107
|
-
this.canCreateMoreBadges = data.canCreateMoreBadges.map((balancesActionPermission) => new __1.BalancesActionPermission(balancesActionPermission));
|
|
108
|
-
this.canUpdateBadgeMetadata = data.canUpdateBadgeMetadata.map((timedUpdateWithBadgeIdsPermission) => new __1.TimedUpdateWithBadgeIdsPermission(timedUpdateWithBadgeIdsPermission));
|
|
109
|
-
}
|
|
110
|
-
convert(convertFunction) {
|
|
111
|
-
return new CollectionPermissionsWithDetails((0, __2.deepCopy)({
|
|
112
|
-
...this,
|
|
113
|
-
canUpdateCollectionApprovals: this.canUpdateCollectionApprovals.map((canUpdateCollectionApproval) => canUpdateCollectionApproval.convert(convertFunction)),
|
|
114
|
-
canDeleteCollection: this.canDeleteCollection.map((actionPermission) => actionPermission.convert(convertFunction)),
|
|
115
|
-
canArchiveCollection: this.canArchiveCollection.map((timedUpdatePermission) => timedUpdatePermission.convert(convertFunction)),
|
|
116
|
-
canUpdateOffChainBalancesMetadata: this.canUpdateOffChainBalancesMetadata.map((timedUpdatePermission) => timedUpdatePermission.convert(convertFunction)),
|
|
117
|
-
canUpdateStandards: this.canUpdateStandards.map((timedUpdatePermission) => timedUpdatePermission.convert(convertFunction)),
|
|
118
|
-
canUpdateCustomData: this.canUpdateCustomData.map((timedUpdatePermission) => timedUpdatePermission.convert(convertFunction)),
|
|
119
|
-
canUpdateManager: this.canUpdateManager.map((timedUpdatePermission) => timedUpdatePermission.convert(convertFunction)),
|
|
120
|
-
canUpdateCollectionMetadata: this.canUpdateCollectionMetadata.map((timedUpdatePermission) => timedUpdatePermission.convert(convertFunction)),
|
|
121
|
-
canCreateMoreBadges: this.canCreateMoreBadges.map((balancesActionPermission) => balancesActionPermission.convert(convertFunction)),
|
|
122
|
-
canUpdateBadgeMetadata: this.canUpdateBadgeMetadata.map((timedUpdateWithBadgeIdsPermission) => timedUpdateWithBadgeIdsPermission.convert(convertFunction)),
|
|
123
|
-
}));
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
exports.CollectionPermissionsWithDetails = CollectionPermissionsWithDetails;
|
|
127
|
-
class UserPermissionsWithDetails extends __1.BaseNumberTypeClass {
|
|
128
|
-
canUpdateIncomingApprovals;
|
|
129
|
-
canUpdateOutgoingApprovals;
|
|
130
|
-
canUpdateAutoApproveSelfInitiatedOutgoingTransfers;
|
|
131
|
-
canUpdateAutoApproveSelfInitiatedIncomingTransfers;
|
|
132
|
-
constructor(data) {
|
|
133
|
-
super();
|
|
134
|
-
this.canUpdateIncomingApprovals = data.canUpdateIncomingApprovals.map((canUpdateUserIncomingApproval) => new UserIncomingApprovalPermissionWithDetails(canUpdateUserIncomingApproval));
|
|
135
|
-
this.canUpdateOutgoingApprovals = data.canUpdateOutgoingApprovals.map((canUpdateUserOutgoingApproval) => new UserOutgoingApprovalPermissionWithDetails(canUpdateUserOutgoingApproval));
|
|
136
|
-
this.canUpdateAutoApproveSelfInitiatedOutgoingTransfers = data.canUpdateAutoApproveSelfInitiatedOutgoingTransfers.map((actionPermission) => new __1.ActionPermission(actionPermission));
|
|
137
|
-
this.canUpdateAutoApproveSelfInitiatedIncomingTransfers = data.canUpdateAutoApproveSelfInitiatedIncomingTransfers.map((actionPermission) => new __1.ActionPermission(actionPermission));
|
|
138
|
-
}
|
|
139
|
-
convert(convertFunction) {
|
|
140
|
-
return new UserPermissionsWithDetails((0, __2.deepCopy)({
|
|
141
|
-
...this,
|
|
142
|
-
canUpdateIncomingApprovals: this.canUpdateIncomingApprovals.map((canUpdateUserIncomingApproval) => canUpdateUserIncomingApproval.convert(convertFunction)),
|
|
143
|
-
canUpdateOutgoingApprovals: this.canUpdateOutgoingApprovals.map((canUpdateUserOutgoingApproval) => canUpdateUserOutgoingApproval.convert(convertFunction)),
|
|
144
|
-
canUpdateAutoApproveSelfInitiatedOutgoingTransfers: this.canUpdateAutoApproveSelfInitiatedOutgoingTransfers.map((actionPermission) => actionPermission.convert(convertFunction)),
|
|
145
|
-
canUpdateAutoApproveSelfInitiatedIncomingTransfers: this.canUpdateAutoApproveSelfInitiatedIncomingTransfers.map((actionPermission) => actionPermission.convert(convertFunction)),
|
|
146
|
-
}));
|
|
147
|
-
}
|
|
148
|
-
}
|
|
149
|
-
exports.UserPermissionsWithDetails = UserPermissionsWithDetails;
|
|
150
|
-
class ApprovalCriteriaWithDetails extends __1.BaseNumberTypeClass {
|
|
74
|
+
exports.MerkleChallengeWithDetails = MerkleChallengeWithDetails;
|
|
75
|
+
class ApprovalCriteriaWithDetails extends base_1.BaseNumberTypeClass {
|
|
151
76
|
merkleChallenge;
|
|
152
77
|
mustOwnBadges;
|
|
153
78
|
predeterminedBalances;
|
|
@@ -162,10 +87,10 @@ class ApprovalCriteriaWithDetails extends __1.BaseNumberTypeClass {
|
|
|
162
87
|
constructor(data) {
|
|
163
88
|
super();
|
|
164
89
|
this.merkleChallenge = data.merkleChallenge;
|
|
165
|
-
this.mustOwnBadges = data.mustOwnBadges?.map((x) => new
|
|
166
|
-
this.predeterminedBalances = data.predeterminedBalances ? new
|
|
167
|
-
this.approvalAmounts = data.approvalAmounts ? new
|
|
168
|
-
this.maxNumTransfers = data.maxNumTransfers ? new
|
|
90
|
+
this.mustOwnBadges = data.mustOwnBadges?.map((x) => new typeUtils_1.MustOwnBadges(x));
|
|
91
|
+
this.predeterminedBalances = data.predeterminedBalances ? new approvals_1.PredeterminedBalances(data.predeterminedBalances) : undefined;
|
|
92
|
+
this.approvalAmounts = data.approvalAmounts ? new approvals_1.ApprovalAmounts(data.approvalAmounts) : undefined;
|
|
93
|
+
this.maxNumTransfers = data.maxNumTransfers ? new approvals_1.MaxNumTransfers(data.maxNumTransfers) : undefined;
|
|
169
94
|
this.requireToEqualsInitiatedBy = data.requireToEqualsInitiatedBy;
|
|
170
95
|
this.requireFromEqualsInitiatedBy = data.requireFromEqualsInitiatedBy;
|
|
171
96
|
this.requireToDoesNotEqualInitiatedBy = data.requireToDoesNotEqualInitiatedBy;
|
|
@@ -174,7 +99,7 @@ class ApprovalCriteriaWithDetails extends __1.BaseNumberTypeClass {
|
|
|
174
99
|
this.overridesToIncomingApprovals = data.overridesToIncomingApprovals;
|
|
175
100
|
}
|
|
176
101
|
convert(convertFunction) {
|
|
177
|
-
return new ApprovalCriteriaWithDetails((0,
|
|
102
|
+
return new ApprovalCriteriaWithDetails((0, base_1.deepCopy)({
|
|
178
103
|
...this,
|
|
179
104
|
merkleChallenge: this.merkleChallenge ? this.merkleChallenge.convert(convertFunction) : undefined,
|
|
180
105
|
mustOwnBadges: this.mustOwnBadges?.map((x) => x.convert(convertFunction)),
|
|
@@ -184,11 +109,11 @@ class ApprovalCriteriaWithDetails extends __1.BaseNumberTypeClass {
|
|
|
184
109
|
}));
|
|
185
110
|
}
|
|
186
111
|
toProto() {
|
|
187
|
-
return
|
|
112
|
+
return approvals_1.ApprovalCriteria.prototype.toProto.call(this);
|
|
188
113
|
}
|
|
189
114
|
}
|
|
190
115
|
exports.ApprovalCriteriaWithDetails = ApprovalCriteriaWithDetails;
|
|
191
|
-
class CollectionApprovalWithDetails extends
|
|
116
|
+
class CollectionApprovalWithDetails extends base_1.BaseNumberTypeClass {
|
|
192
117
|
approvalCriteria;
|
|
193
118
|
details;
|
|
194
119
|
toList;
|
|
@@ -208,16 +133,16 @@ class CollectionApprovalWithDetails extends __1.BaseNumberTypeClass {
|
|
|
208
133
|
constructor(data) {
|
|
209
134
|
super();
|
|
210
135
|
this.approvalCriteria = data.approvalCriteria ? new ApprovalCriteriaWithDetails(data.approvalCriteria) : undefined;
|
|
211
|
-
this.details = data.details ? new
|
|
212
|
-
this.toList = new
|
|
213
|
-
this.fromList = new
|
|
214
|
-
this.initiatedByList = new
|
|
136
|
+
this.details = data.details ? new ApprovalInfoDetails(data.details) : undefined;
|
|
137
|
+
this.toList = new typeUtils_1.AddressList(data.toList);
|
|
138
|
+
this.fromList = new typeUtils_1.AddressList(data.fromList);
|
|
139
|
+
this.initiatedByList = new typeUtils_1.AddressList(data.initiatedByList);
|
|
215
140
|
this.toListId = data.toListId;
|
|
216
141
|
this.fromListId = data.fromListId;
|
|
217
142
|
this.initiatedByListId = data.initiatedByListId;
|
|
218
|
-
this.transferTimes = data.transferTimes.map((range) => new
|
|
219
|
-
this.badgeIds = data.badgeIds.map((range) => new
|
|
220
|
-
this.ownershipTimes = data.ownershipTimes.map((range) => new
|
|
143
|
+
this.transferTimes = data.transferTimes.map((range) => new typeUtils_1.UintRange(range));
|
|
144
|
+
this.badgeIds = data.badgeIds.map((range) => new typeUtils_1.UintRange(range));
|
|
145
|
+
this.ownershipTimes = data.ownershipTimes.map((range) => new typeUtils_1.UintRange(range));
|
|
221
146
|
this.approvalId = data.approvalId;
|
|
222
147
|
this.amountTrackerId = data.amountTrackerId;
|
|
223
148
|
this.challengeTrackerId = data.challengeTrackerId;
|
|
@@ -225,7 +150,7 @@ class CollectionApprovalWithDetails extends __1.BaseNumberTypeClass {
|
|
|
225
150
|
this.customData = data.customData;
|
|
226
151
|
}
|
|
227
152
|
convert(convertFunction) {
|
|
228
|
-
return new CollectionApprovalWithDetails((0,
|
|
153
|
+
return new CollectionApprovalWithDetails((0, base_1.deepCopy)({
|
|
229
154
|
...this,
|
|
230
155
|
approvalCriteria: this.approvalCriteria?.convert(convertFunction),
|
|
231
156
|
details: this.details?.convert(convertFunction),
|
|
@@ -235,430 +160,44 @@ class CollectionApprovalWithDetails extends __1.BaseNumberTypeClass {
|
|
|
235
160
|
}));
|
|
236
161
|
}
|
|
237
162
|
toProto() {
|
|
238
|
-
return
|
|
163
|
+
return approvals_1.CollectionApproval.prototype.toProto.call(this);
|
|
239
164
|
}
|
|
240
165
|
}
|
|
241
166
|
exports.CollectionApprovalWithDetails = CollectionApprovalWithDetails;
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
_docId;
|
|
271
|
-
_id;
|
|
272
|
-
collectionId;
|
|
273
|
-
collectionMetadataTimeline;
|
|
274
|
-
badgeMetadataTimeline;
|
|
275
|
-
balancesType;
|
|
276
|
-
offChainBalancesMetadataTimeline;
|
|
277
|
-
customDataTimeline;
|
|
278
|
-
managerTimeline;
|
|
279
|
-
standardsTimeline;
|
|
280
|
-
isArchivedTimeline;
|
|
281
|
-
createdBy;
|
|
282
|
-
createdBlock;
|
|
283
|
-
createdTimestamp;
|
|
284
|
-
updateHistory;
|
|
285
|
-
aliasAddress;
|
|
286
|
-
collectionApprovals;
|
|
287
|
-
collectionPermissions;
|
|
288
|
-
defaultBalances;
|
|
289
|
-
cachedCollectionMetadata;
|
|
290
|
-
cachedBadgeMetadata;
|
|
291
|
-
activity;
|
|
292
|
-
reviews;
|
|
293
|
-
owners;
|
|
294
|
-
merkleChallenges;
|
|
295
|
-
approvalTrackers;
|
|
296
|
-
nsfw;
|
|
297
|
-
reported;
|
|
298
|
-
views;
|
|
299
|
-
constructor(data) {
|
|
300
|
-
super();
|
|
301
|
-
this._docId = data._docId;
|
|
302
|
-
this._id = data._id;
|
|
303
|
-
this.collectionId = data.collectionId;
|
|
304
|
-
this.collectionMetadataTimeline = data.collectionMetadataTimeline.map((timelineItem) => new __1.CollectionMetadataTimeline(timelineItem));
|
|
305
|
-
this.badgeMetadataTimeline = data.badgeMetadataTimeline.map((timelineItem) => new __1.BadgeMetadataTimeline(timelineItem));
|
|
306
|
-
this.balancesType = data.balancesType;
|
|
307
|
-
this.offChainBalancesMetadataTimeline = data.offChainBalancesMetadataTimeline.map((timelineItem) => new __1.OffChainBalancesMetadataTimeline(timelineItem));
|
|
308
|
-
this.customDataTimeline = data.customDataTimeline.map((timelineItem) => new __1.CustomDataTimeline(timelineItem));
|
|
309
|
-
this.managerTimeline = data.managerTimeline.map((timelineItem) => new __1.ManagerTimeline(timelineItem));
|
|
310
|
-
this.standardsTimeline = data.standardsTimeline.map((timelineItem) => new __1.StandardsTimeline(timelineItem));
|
|
311
|
-
this.isArchivedTimeline = data.isArchivedTimeline.map((timelineItem) => new __1.IsArchivedTimeline(timelineItem));
|
|
312
|
-
this.createdBy = data.createdBy;
|
|
313
|
-
this.createdBlock = data.createdBlock;
|
|
314
|
-
this.createdTimestamp = data.createdTimestamp;
|
|
315
|
-
this.updateHistory = data.updateHistory.map((updateHistoryItem) => ({ ...updateHistoryItem }));
|
|
316
|
-
this.aliasAddress = data.aliasAddress;
|
|
317
|
-
this.collectionApprovals = data.collectionApprovals.map((collectionApproval) => new CollectionApprovalWithDetails(collectionApproval));
|
|
318
|
-
this.collectionPermissions = new CollectionPermissionsWithDetails(data.collectionPermissions);
|
|
319
|
-
this.defaultBalances = new UserBalanceStoreWithDetails(data.defaultBalances);
|
|
320
|
-
this.cachedCollectionMetadata = data.cachedCollectionMetadata ? new metadata_1.Metadata(data.cachedCollectionMetadata) : undefined;
|
|
321
|
-
this.cachedBadgeMetadata = data.cachedBadgeMetadata.map((metadata) => new BadgeMetadataDetails(metadata));
|
|
322
|
-
this.activity = data.activity.map((activityItem) => new activity_1.TransferActivityDoc(activityItem));
|
|
323
|
-
this.reviews = data.reviews.map((activityItem) => new activity_1.ReviewDoc(activityItem));
|
|
324
|
-
this.owners = data.owners.map((balance) => new db_1.BalanceDocWithDetails(balance));
|
|
325
|
-
this.merkleChallenges = data.merkleChallenges.map((merkleChallenge) => new db_1.MerkleChallengeDoc(merkleChallenge));
|
|
326
|
-
this.approvalTrackers = data.approvalTrackers.map((approvalTracker) => new db_1.ApprovalTrackerDoc(approvalTracker));
|
|
327
|
-
this.nsfw = data.nsfw;
|
|
328
|
-
this.reported = data.reported;
|
|
329
|
-
this.views = data.views;
|
|
330
|
-
}
|
|
331
|
-
convert(convertFunction) {
|
|
332
|
-
return new BitBadgesCollection((0, __2.deepCopy)({
|
|
333
|
-
...this,
|
|
334
|
-
...new db_1.CollectionDoc(this).convert(convertFunction),
|
|
335
|
-
collectionApprovals: this.collectionApprovals.map((collectionApproval) => collectionApproval.convert(convertFunction)),
|
|
336
|
-
defaultBalances: this.defaultBalances.convert(convertFunction),
|
|
337
|
-
collectionPermissions: this.collectionPermissions.convert(convertFunction),
|
|
338
|
-
cachedCollectionMetadata: this.cachedCollectionMetadata ? this.cachedCollectionMetadata.convert(convertFunction) : undefined,
|
|
339
|
-
cachedBadgeMetadata: this.cachedBadgeMetadata.map((metadata) => metadata.convert(convertFunction)),
|
|
340
|
-
activity: this.activity.map((activityItem) => activityItem.convert(convertFunction)),
|
|
341
|
-
reviews: this.reviews.map((activityItem) => activityItem.convert(convertFunction)),
|
|
342
|
-
owners: this.owners.map((balance) => balance.convert(convertFunction)),
|
|
343
|
-
merkleChallenges: this.merkleChallenges.map((merkleChallenge) => merkleChallenge.convert(convertFunction)),
|
|
344
|
-
approvalTrackers: this.approvalTrackers.map((approvalTracker) => approvalTracker.convert(convertFunction)),
|
|
345
|
-
_rev: undefined,
|
|
346
|
-
_deleted: undefined,
|
|
347
|
-
nsfw: this.nsfw ? { ...this.nsfw, badgeIds: this.nsfw.badgeIds.map((UintRange) => UintRange.convert(convertFunction)) } : undefined,
|
|
348
|
-
reported: this.reported ? { ...this.reported, badgeIds: this.reported.badgeIds.map((UintRange) => UintRange.convert(convertFunction)) } : undefined,
|
|
349
|
-
}));
|
|
350
|
-
}
|
|
351
|
-
getOwnerInfo(address, throwIfNotFound = true) {
|
|
352
|
-
const owner = this.owners.find((x) => x.cosmosAddress === address);
|
|
353
|
-
if (!owner && throwIfNotFound)
|
|
354
|
-
throw new Error(`Owner not found for address ${address}. Balance not fetched yet. Missing doc for '${address}' in owners.`);
|
|
355
|
-
return owner;
|
|
356
|
-
}
|
|
357
|
-
getOwnerBalances(address, throwIfNotFound = true) {
|
|
358
|
-
return this.getOwnerInfo(address, throwIfNotFound)?.balances;
|
|
359
|
-
}
|
|
360
|
-
getMaxBadgeId() {
|
|
361
|
-
const totalSupplyBalance = this.getOwnerBalances('Total')?.map((balance) => balance.convert(__1.BigIntify)) ?? [];
|
|
362
|
-
const defaultBalances = this.defaultBalances.balances.map((balance) => balance.convert(__1.BigIntify));
|
|
363
|
-
let maxBadgeId = 0n;
|
|
364
|
-
for (const balance of [...totalSupplyBalance, ...defaultBalances]) {
|
|
365
|
-
for (const badgeIdRange of balance.badgeIds) {
|
|
366
|
-
if (badgeIdRange.end > maxBadgeId) {
|
|
367
|
-
maxBadgeId = badgeIdRange.end;
|
|
368
|
-
}
|
|
167
|
+
const castCollectionApprovalToUniversalPermission = (collectionApprovals) => {
|
|
168
|
+
const castedPermissions = [];
|
|
169
|
+
for (const approval of collectionApprovals) {
|
|
170
|
+
castedPermissions.push({
|
|
171
|
+
...typeUtils_1.AllDefaultValues,
|
|
172
|
+
badgeIds: approval.badgeIds,
|
|
173
|
+
transferTimes: approval.transferTimes,
|
|
174
|
+
ownershipTimes: approval.ownershipTimes,
|
|
175
|
+
fromList: approval.fromList,
|
|
176
|
+
toList: approval.toList,
|
|
177
|
+
initiatedByList: approval.initiatedByList,
|
|
178
|
+
approvalIdList: getReservedTrackerList(approval.approvalId),
|
|
179
|
+
amountTrackerIdList: getReservedTrackerList(approval.amountTrackerId),
|
|
180
|
+
challengeTrackerIdList: getReservedTrackerList(approval.challengeTrackerId),
|
|
181
|
+
usesAmountTrackerIdList: true,
|
|
182
|
+
usesChallengeTrackerIdList: true,
|
|
183
|
+
usesApprovalIdList: true,
|
|
184
|
+
usesBadgeIds: true,
|
|
185
|
+
usesTransferTimes: true,
|
|
186
|
+
usesToList: true,
|
|
187
|
+
usesFromList: true,
|
|
188
|
+
usesInitiatedByList: true,
|
|
189
|
+
usesOwnershipTimes: true,
|
|
190
|
+
arbitraryValue: {
|
|
191
|
+
approvalId: approval.approvalId,
|
|
192
|
+
amountTrackerId: approval.amountTrackerId,
|
|
193
|
+
challengeTrackerId: approval.challengeTrackerId,
|
|
194
|
+
approvalCriteria: approval.approvalCriteria,
|
|
369
195
|
}
|
|
370
|
-
}
|
|
371
|
-
return maxBadgeId;
|
|
372
|
-
}
|
|
373
|
-
getTimelineValuesAtTime(time) {
|
|
374
|
-
const coll = this.convert(__1.BigIntify);
|
|
375
|
-
return {
|
|
376
|
-
manager: getValueAtTimeForTimeline(coll.managerTimeline, time)?.manager ?? "",
|
|
377
|
-
collectionMetadata: getValueAtTimeForTimeline(coll.collectionMetadataTimeline, time)?.collectionMetadata ?? {
|
|
378
|
-
uri: '',
|
|
379
|
-
customData: '',
|
|
380
|
-
},
|
|
381
|
-
badgeMetadata: getValueAtTimeForTimeline(coll.badgeMetadataTimeline, time)?.badgeMetadata ?? [],
|
|
382
|
-
offChainBalancesMetadata: getValueAtTimeForTimeline(coll.offChainBalancesMetadataTimeline, time)?.offChainBalancesMetadata ?? {
|
|
383
|
-
uri: '',
|
|
384
|
-
customData: '',
|
|
385
|
-
},
|
|
386
|
-
customData: getValueAtTimeForTimeline(coll.customDataTimeline, time)?.customData ?? "",
|
|
387
|
-
standards: getValueAtTimeForTimeline(coll.standardsTimeline, time)?.standards ?? [],
|
|
388
|
-
isArchived: getValueAtTimeForTimeline(coll.isArchivedTimeline, time)?.isArchived ?? false,
|
|
389
|
-
};
|
|
390
|
-
}
|
|
391
|
-
getManager(time) {
|
|
392
|
-
return this.getTimelineValuesAtTime(time).manager;
|
|
393
|
-
}
|
|
394
|
-
getCollectionMetadata() {
|
|
395
|
-
return this.cachedCollectionMetadata;
|
|
396
|
-
}
|
|
397
|
-
getBadgeMetadata(badgeId) {
|
|
398
|
-
return (0, __1.getMetadataForBadgeId)(badgeId, this.cachedBadgeMetadata);
|
|
399
|
-
}
|
|
400
|
-
getBadgeMetadataDetails(badgeId) {
|
|
401
|
-
return (0, __1.getMetadataDetailsForBadgeId)(badgeId, this.cachedBadgeMetadata);
|
|
402
|
-
}
|
|
403
|
-
getCollectionMetadataTimelineValue(time) {
|
|
404
|
-
return this.getTimelineValuesAtTime(time).collectionMetadata;
|
|
405
|
-
}
|
|
406
|
-
getBadgeMetadataTimelineValue(time) {
|
|
407
|
-
return this.getTimelineValuesAtTime(time).badgeMetadata;
|
|
408
|
-
}
|
|
409
|
-
getOffChainBalancesMetadata(time) {
|
|
410
|
-
return this.getTimelineValuesAtTime(time).offChainBalancesMetadata;
|
|
411
|
-
}
|
|
412
|
-
getCustomData(time) {
|
|
413
|
-
return this.getTimelineValuesAtTime(time).customData;
|
|
414
|
-
}
|
|
415
|
-
getStandards(time) {
|
|
416
|
-
return this.getTimelineValuesAtTime(time).standards;
|
|
417
|
-
}
|
|
418
|
-
getIsArchived(time) {
|
|
419
|
-
return this.getTimelineValuesAtTime(time).isArchived;
|
|
420
|
-
}
|
|
421
|
-
getDefaultUserBalance() {
|
|
422
|
-
return (0, __2.deepCopy)(new __1.UserBalanceStore({ ...this.defaultBalances }));
|
|
423
|
-
}
|
|
424
|
-
pruneMetadataToFetch(metadataToFetch) {
|
|
425
|
-
return (0, __1.pruneMetadataToFetch)(this.convert(__1.BigIntify), metadataToFetch);
|
|
426
|
-
}
|
|
427
|
-
getMaxMetadataId() {
|
|
428
|
-
return (0, __1.getMaxMetadataId)(this.convert(__1.BigIntify).getBadgeMetadataTimelineValue());
|
|
429
|
-
}
|
|
430
|
-
validatePermissionsUpdate(newPermissions) {
|
|
431
|
-
const result = (0, __1.validatePermissionsUpdate)(this.convert(__1.BigIntify).collectionPermissions, newPermissions.convert(__1.BigIntify));
|
|
432
|
-
return result;
|
|
433
|
-
}
|
|
434
|
-
validatePermissionUpdate(permissionName, newPermissions) {
|
|
435
|
-
const { validatePermissionUpdateFunction } = (0, __1.getPermissionVariablesFromName)(permissionName);
|
|
436
|
-
const oldPermissions = this.collectionPermissions[permissionName];
|
|
437
|
-
const result = validatePermissionUpdateFunction(oldPermissions, newPermissions);
|
|
438
|
-
return result;
|
|
439
|
-
}
|
|
440
|
-
validateCollectionApprovalsUpdate(newApprovals) {
|
|
441
|
-
const result = (0, __1.validateCollectionApprovalsUpdate)(this.convert(__1.BigIntify).collectionApprovals, newApprovals.map(x => x.convert(__1.BigIntify)), this.convert(__1.BigIntify).collectionPermissions.canUpdateCollectionApprovals);
|
|
442
|
-
return result;
|
|
443
|
-
}
|
|
444
|
-
validateBadgeMetadataUpdate(newBadgeMetadata) {
|
|
445
|
-
const result = (0, __1.validateBadgeMetadataUpdate)(this.convert(__1.BigIntify).badgeMetadataTimeline, newBadgeMetadata.map(x => x.convert(__1.BigIntify)), this.convert(__1.BigIntify).collectionPermissions.canUpdateBadgeMetadata);
|
|
446
|
-
return result;
|
|
447
|
-
}
|
|
448
|
-
validateOffChainBalancesMetadataUpdate(newOffChainBalancesMetadata) {
|
|
449
|
-
const result = (0, __1.validateOffChainBalancesMetadataUpdate)(this.convert(__1.BigIntify).offChainBalancesMetadataTimeline, newOffChainBalancesMetadata.map(x => x.convert(__1.BigIntify)), this.convert(__1.BigIntify).collectionPermissions.canUpdateOffChainBalancesMetadata);
|
|
450
|
-
return result;
|
|
451
|
-
}
|
|
452
|
-
validateCustomDataUpdate(newCustomData) {
|
|
453
|
-
const result = (0, __1.validateCustomDataUpdate)(this.convert(__1.BigIntify).customDataTimeline, newCustomData.map(x => x.convert(__1.BigIntify)), this.convert(__1.BigIntify).collectionPermissions.canUpdateCustomData);
|
|
454
|
-
return result;
|
|
455
|
-
}
|
|
456
|
-
validateStandardsUpdate(newStandards) {
|
|
457
|
-
const result = (0, __1.validateStandardsUpdate)(this.convert(__1.BigIntify).standardsTimeline, newStandards.map(x => x.convert(__1.BigIntify)), this.convert(__1.BigIntify).collectionPermissions.canUpdateStandards);
|
|
458
|
-
return result;
|
|
459
|
-
}
|
|
460
|
-
validateIsArchivedUpdate(newIsArchived) {
|
|
461
|
-
const result = (0, __1.validateIsArchivedUpdate)(this.convert(__1.BigIntify).isArchivedTimeline, newIsArchived.map(x => x.convert(__1.BigIntify)), this.convert(__1.BigIntify).collectionPermissions.canArchiveCollection);
|
|
462
|
-
return result;
|
|
463
|
-
}
|
|
464
|
-
validateManagerUpdate(newManager) {
|
|
465
|
-
const result = (0, __1.validateManagerUpdate)(this.convert(__1.BigIntify).managerTimeline, newManager.map(x => x.convert(__1.BigIntify)), this.convert(__1.BigIntify).collectionPermissions.canUpdateManager);
|
|
466
|
-
return result;
|
|
467
|
-
}
|
|
468
|
-
checkCanDeleteCollection(time) {
|
|
469
|
-
return (0, __1.checkIfActionPermissionPermits)(this.convert(__1.BigIntify).collectionPermissions.canDeleteCollection, time ? BigInt(time) : BigInt(Date.now()));
|
|
470
|
-
}
|
|
471
|
-
checkCanArchiveCollection(timelineTimes, time) {
|
|
472
|
-
return (0, __1.checkIfTimedUpdatePermissionPermits)(timelineTimes.map(x => x.convert(__1.BigIntify)), this.convert(__1.BigIntify).collectionPermissions.canArchiveCollection, time ? BigInt(time) : BigInt(Date.now()));
|
|
473
|
-
}
|
|
474
|
-
checkCanUpdateManager(timelineTimes, time) {
|
|
475
|
-
return (0, __1.checkIfTimedUpdatePermissionPermits)(timelineTimes.map(x => x.convert(__1.BigIntify)), this.convert(__1.BigIntify).collectionPermissions.canUpdateManager, time ? BigInt(time) : BigInt(Date.now()));
|
|
476
|
-
}
|
|
477
|
-
checkCanUpdateOffChainBalancesMetadata(timelineTimes, time) {
|
|
478
|
-
return (0, __1.checkIfTimedUpdatePermissionPermits)(timelineTimes.map(x => x.convert(__1.BigIntify)), this.convert(__1.BigIntify).collectionPermissions.canUpdateOffChainBalancesMetadata, time ? BigInt(time) : BigInt(Date.now()));
|
|
479
|
-
}
|
|
480
|
-
checkCanUpdateStandards(timelineTimes, time) {
|
|
481
|
-
return (0, __1.checkIfTimedUpdatePermissionPermits)(timelineTimes.map(x => x.convert(__1.BigIntify)), this.convert(__1.BigIntify).collectionPermissions.canUpdateStandards, time ? BigInt(time) : BigInt(Date.now()));
|
|
482
|
-
}
|
|
483
|
-
checkCanUpdateCustomData(timelineTimes, time) {
|
|
484
|
-
return (0, __1.checkIfTimedUpdatePermissionPermits)(timelineTimes.map(x => x.convert(__1.BigIntify)), this.convert(__1.BigIntify).collectionPermissions.canUpdateCustomData, time ? BigInt(time) : BigInt(Date.now()));
|
|
485
|
-
}
|
|
486
|
-
checkCanUpdateCollectionMetadata(timelineTimes, time) {
|
|
487
|
-
return (0, __1.checkIfTimedUpdatePermissionPermits)(timelineTimes.map(x => x.convert(__1.BigIntify)), this.convert(__1.BigIntify).collectionPermissions.canUpdateCollectionMetadata, time ? BigInt(time) : BigInt(Date.now()));
|
|
488
|
-
}
|
|
489
|
-
checkCanCreateMoreBadges(balances, time) {
|
|
490
|
-
return (0, __1.checkIfBalancesActionPermissionPermits)(balances.map(x => x.convert(__1.BigIntify)), this.convert(__1.BigIntify).collectionPermissions.canCreateMoreBadges, time ? BigInt(time) : BigInt(Date.now()));
|
|
491
|
-
}
|
|
492
|
-
checkCanUpdateBadgeMetadata(details, time) {
|
|
493
|
-
return (0, __1.checkIfTimedUpdateWithBadgeIdsPermissionPermits)(details.map(x => {
|
|
494
|
-
return {
|
|
495
|
-
timelineTimes: x.timelineTimes.map(y => y.convert(__1.BigIntify)),
|
|
496
|
-
badgeIds: x.badgeIds.map(y => y.convert(__1.BigIntify))
|
|
497
|
-
};
|
|
498
|
-
}), this.convert(__1.BigIntify).collectionPermissions.canUpdateBadgeMetadata, time ? BigInt(time) : BigInt(Date.now()));
|
|
499
|
-
}
|
|
500
|
-
checkCanUpdateCollectionApprovals(details, time) {
|
|
501
|
-
return (0, __1.checkIfCollectionApprovalPermissionPermits)(details.map(x => {
|
|
502
|
-
return {
|
|
503
|
-
...x,
|
|
504
|
-
timelineTimes: x.timelineTimes.map(y => y.convert(__1.BigIntify)),
|
|
505
|
-
badgeIds: x.badgeIds.map(y => y.convert(__1.BigIntify)),
|
|
506
|
-
ownershipTimes: x.ownershipTimes.map(y => y.convert(__1.BigIntify)),
|
|
507
|
-
transferTimes: x.transferTimes.map(y => y.convert(__1.BigIntify)),
|
|
508
|
-
};
|
|
509
|
-
}), this.convert(__1.BigIntify).collectionPermissions.canUpdateCollectionApprovals, time ? BigInt(time) : BigInt(Date.now()));
|
|
510
|
-
}
|
|
511
|
-
static async FetchAndInitialize(api, options) {
|
|
512
|
-
const collection = await api.getCollections({ collectionsToFetch: [options] }).then((x) => x.collections[0]);
|
|
513
|
-
return new BitBadgesCollection(collection);
|
|
514
|
-
}
|
|
515
|
-
static async FetchAndInitializeBatch(api, collectionsToFetch) {
|
|
516
|
-
const collection = await api.getCollections({ collectionsToFetch: collectionsToFetch });
|
|
517
|
-
return collection.collections.map((x) => new BitBadgesCollection(x));
|
|
518
|
-
}
|
|
519
|
-
async fetchOwnerInfo(api, address, forceful) {
|
|
520
|
-
const currOwnerInfo = this.getOwnerInfo(address, false);
|
|
521
|
-
if (currOwnerInfo && !forceful)
|
|
522
|
-
return currOwnerInfo;
|
|
523
|
-
const newOwnerInfo = await api.getBadgeBalanceByAddress(this.collectionId, address);
|
|
524
|
-
if (currOwnerInfo) {
|
|
525
|
-
Object.assign(currOwnerInfo, newOwnerInfo);
|
|
526
|
-
return currOwnerInfo;
|
|
527
|
-
}
|
|
528
|
-
else {
|
|
529
|
-
this.owners.push(newOwnerInfo);
|
|
530
|
-
}
|
|
531
|
-
return newOwnerInfo;
|
|
532
|
-
}
|
|
533
|
-
isRedundantRequest(options) {
|
|
534
|
-
const cachedCollection = this.convert(__1.BigIntify);
|
|
535
|
-
const prunedMetadataToFetch = (0, __1.pruneMetadataToFetch)(cachedCollection, options.metadataToFetch);
|
|
536
|
-
const shouldFetchMetadata = (prunedMetadataToFetch.uris && prunedMetadataToFetch.uris.length > 0) || !prunedMetadataToFetch.doNotFetchCollectionMetadata;
|
|
537
|
-
const viewsToFetch = (options.viewsToFetch || []).filter(x => this.viewHasMore(x.viewId));
|
|
538
|
-
const hasTotalAndMint = cachedCollection.owners.find(x => x.cosmosAddress === "Mint") && cachedCollection.owners.find(x => x.cosmosAddress === "Total");
|
|
539
|
-
const shouldFetchTotalAndMint = !hasTotalAndMint && options.fetchTotalAndMintBalances;
|
|
540
|
-
const shouldFetchMerkleChallengeIds = (options.challengeTrackersToFetch ?? []).find(x => {
|
|
541
|
-
const match = cachedCollection.merkleChallenges.find(y => y.challengeId === x.challengeId && x.approverAddress === y.approverAddress && x.collectionId === y.collectionId && x.challengeLevel === y.challengeLevel);
|
|
542
|
-
return !match;
|
|
543
|
-
}) !== undefined;
|
|
544
|
-
const shouldFetchAmountTrackerIds = (options.approvalTrackersToFetch ?? []).find(x => {
|
|
545
|
-
const match = cachedCollection.approvalTrackers.find(y => y.amountTrackerId === x.amountTrackerId && x.approverAddress === y.approverAddress && x.collectionId === y.collectionId && y.approvedAddress === x.approvedAddress && y.trackerType === x.trackerType);
|
|
546
|
-
return !match;
|
|
547
|
-
}) !== undefined;
|
|
548
|
-
return !(shouldFetchMetadata || viewsToFetch.length > 0 || shouldFetchTotalAndMint || shouldFetchMerkleChallengeIds || shouldFetchAmountTrackerIds);
|
|
549
|
-
}
|
|
550
|
-
async fetchAndUpdate(api, options, forceful) {
|
|
551
|
-
if (!forceful) {
|
|
552
|
-
if (this.isRedundantRequest(options))
|
|
553
|
-
return;
|
|
554
|
-
if (options.metadataToFetch)
|
|
555
|
-
options.metadataToFetch = this.pruneMetadataToFetch(options.metadataToFetch);
|
|
556
|
-
options.viewsToFetch = (options.viewsToFetch || []).filter(x => this.viewHasMore(x.viewId));
|
|
557
|
-
}
|
|
558
|
-
const collection = await api.getCollections({ collectionsToFetch: [{ collectionId: this.collectionId, ...options }] }).then((x) => x.collections[0]);
|
|
559
|
-
this.updateWithNewResponse(collection, forceful);
|
|
560
|
-
}
|
|
561
|
-
updateWithNewResponse(newResponse, forceful) {
|
|
562
|
-
if (forceful) {
|
|
563
|
-
const newCollectionInfo = new BitBadgesCollection(newResponse);
|
|
564
|
-
Object.assign(this, newCollectionInfo);
|
|
565
|
-
return;
|
|
566
|
-
}
|
|
567
|
-
else {
|
|
568
|
-
const newCollectionInfo = (0, __1.updateCollectionWithResponse)(this, newResponse);
|
|
569
|
-
Object.assign(this, newCollectionInfo);
|
|
570
|
-
return;
|
|
571
|
-
}
|
|
572
|
-
}
|
|
573
|
-
async fetchMetadata(api, options, forceful) {
|
|
574
|
-
if (!forceful) {
|
|
575
|
-
if (options.metadataToFetch)
|
|
576
|
-
options.metadataToFetch = this.pruneMetadataToFetch(options.metadataToFetch);
|
|
577
|
-
}
|
|
578
|
-
await this.fetchAndUpdate(api, options, forceful);
|
|
579
|
-
}
|
|
580
|
-
viewHasMore(viewId) {
|
|
581
|
-
return this.views[viewId]?.pagination?.hasMore || true;
|
|
582
|
-
}
|
|
583
|
-
getViewPagination(viewId) {
|
|
584
|
-
return this.views[viewId]?.pagination;
|
|
585
|
-
}
|
|
586
|
-
getViewBookmark(viewId) {
|
|
587
|
-
return this.views[viewId]?.pagination?.bookmark;
|
|
588
|
-
}
|
|
589
|
-
async fetchNextForView(api, viewType, viewId) {
|
|
590
|
-
if (!this.viewHasMore(viewId))
|
|
591
|
-
return;
|
|
592
|
-
await this.fetchAndUpdate(api, {
|
|
593
|
-
viewsToFetch: [{
|
|
594
|
-
viewType: viewType,
|
|
595
|
-
viewId: viewId,
|
|
596
|
-
bookmark: this.views[viewId]?.pagination?.bookmark || ''
|
|
597
|
-
}]
|
|
598
|
-
});
|
|
599
|
-
}
|
|
600
|
-
async fetchAllForView(api, viewType, viewId) {
|
|
601
|
-
while (this.viewHasMore(viewId)) {
|
|
602
|
-
await this.fetchNextForView(api, viewType, viewId);
|
|
603
|
-
await new Promise(r => setTimeout(r, 1000));
|
|
604
|
-
}
|
|
605
|
-
}
|
|
606
|
-
getActivityView(viewId) {
|
|
607
|
-
return this.views[viewId]?.ids.map(x => {
|
|
608
|
-
return this.activity.find(y => y._docId === x);
|
|
609
|
-
});
|
|
610
|
-
}
|
|
611
|
-
getReviewsView(viewId) {
|
|
612
|
-
return this.views[viewId]?.ids.map(x => {
|
|
613
|
-
return this.reviews.find(y => y._docId === x);
|
|
614
196
|
});
|
|
615
197
|
}
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
});
|
|
620
|
-
}
|
|
621
|
-
getMerkleChallengesView(viewId) {
|
|
622
|
-
return this.views[viewId]?.ids.map(x => {
|
|
623
|
-
return this.merkleChallenges.find(y => y._docId === x);
|
|
624
|
-
});
|
|
625
|
-
}
|
|
626
|
-
getApprovalTrackersView(viewId) {
|
|
627
|
-
return this.views[viewId]?.ids.map(x => {
|
|
628
|
-
return this.approvalTrackers.find(y => y._docId === x);
|
|
629
|
-
});
|
|
630
|
-
}
|
|
631
|
-
generateAliasForBadgeId(badgeId) {
|
|
632
|
-
const moduleName = 'badges';
|
|
633
|
-
const derivationKeys = (0, __1.getAliasDerivationKeysForBadge)(this.collectionId, badgeId);
|
|
634
|
-
return (0, __1.generateAlias)(moduleName, derivationKeys);
|
|
635
|
-
}
|
|
636
|
-
getUnhandledCollectionApprovals() {
|
|
637
|
-
return (0, __1.getUnhandledCollectionApprovals)(this.convert(__1.BigIntify).collectionApprovals, true);
|
|
638
|
-
}
|
|
639
|
-
getNonMintCollectionApprovals() {
|
|
640
|
-
return (0, __1.getNonMintApprovals)(this.convert(__1.BigIntify).collectionApprovals);
|
|
641
|
-
}
|
|
642
|
-
getMintCollectionApprovals() {
|
|
643
|
-
return (0, __1.getMintApprovals)(this.convert(__1.BigIntify).collectionApprovals);
|
|
644
|
-
}
|
|
645
|
-
async getRefreshStatus(api) {
|
|
646
|
-
return await api.getRefreshStatus(this.collectionId);
|
|
647
|
-
}
|
|
648
|
-
async refresh(api) {
|
|
649
|
-
return await api.refreshMetadata(this.collectionId);
|
|
650
|
-
}
|
|
651
|
-
async getBadgeActivity(api, badgeId, body) {
|
|
652
|
-
return await api.getBadgeActivity(this.collectionId, badgeId, body);
|
|
653
|
-
}
|
|
654
|
-
async getOwnersForBadge(api, badgeId, body) {
|
|
655
|
-
return await api.getOwnersForBadge(this.collectionId, badgeId, body);
|
|
656
|
-
}
|
|
657
|
-
async filterBadgesInCollection(api, bodyOptions) {
|
|
658
|
-
return await api.filterBadgesInCollection({ ...bodyOptions, collectionId: this.collectionId });
|
|
659
|
-
}
|
|
660
|
-
}
|
|
661
|
-
exports.BitBadgesCollection = BitBadgesCollection;
|
|
198
|
+
return castedPermissions;
|
|
199
|
+
};
|
|
200
|
+
exports.castCollectionApprovalToUniversalPermission = castCollectionApprovalToUniversalPermission;
|
|
662
201
|
function getCurrentValueForTimeline(timeline) {
|
|
663
202
|
return getValueAtTimeForTimeline(timeline, BigInt(Date.now()));
|
|
664
203
|
}
|
|
@@ -671,7 +210,7 @@ function getValueAtTimeForTimeline(timeline, time) {
|
|
|
671
210
|
const timeToCheck = time ?? BigInt(Date.now());
|
|
672
211
|
for (const timelineItem of timeline) {
|
|
673
212
|
const timelineTimes = timelineItem.timelineTimes;
|
|
674
|
-
const [, found] = (
|
|
213
|
+
const [, found] = searchForId(BigInt(timeToCheck), timelineTimes);
|
|
675
214
|
if (found) {
|
|
676
215
|
return timelineItem;
|
|
677
216
|
}
|
|
@@ -683,7 +222,7 @@ function getIdxAtTimeForTimeline(timeline, time) {
|
|
|
683
222
|
const timeToCheck = time ?? BigInt(Date.now());
|
|
684
223
|
for (const timelineItem of timeline) {
|
|
685
224
|
const timelineTimes = timelineItem.timelineTimes;
|
|
686
|
-
const [idx, found] = (
|
|
225
|
+
const [idx, found] = searchForId(BigInt(timeToCheck), timelineTimes);
|
|
687
226
|
if (found) {
|
|
688
227
|
return Number(idx);
|
|
689
228
|
}
|
|
@@ -692,9 +231,9 @@ function getIdxAtTimeForTimeline(timeline, time) {
|
|
|
692
231
|
}
|
|
693
232
|
exports.getIdxAtTimeForTimeline = getIdxAtTimeForTimeline;
|
|
694
233
|
function getFullTimeline(timeline, fieldName, emptyValue, maxTime = 18446744073709551615n) {
|
|
695
|
-
let unhandledTimes = [new
|
|
234
|
+
let unhandledTimes = [new typeUtils_1.UintRange({ start: BigInt(1n), end: maxTime })];
|
|
696
235
|
for (const timelineVal of timeline) {
|
|
697
|
-
const [remaining, _removed] =
|
|
236
|
+
const [remaining, _removed] = removeUintRangesFromUintRanges(timelineVal.timelineTimes, unhandledTimes);
|
|
698
237
|
unhandledTimes = remaining;
|
|
699
238
|
}
|
|
700
239
|
if (unhandledTimes.length === 0) {
|
|
@@ -711,7 +250,7 @@ function getFullManagerTimeline(timeline) {
|
|
|
711
250
|
}
|
|
712
251
|
exports.getFullManagerTimeline = getFullManagerTimeline;
|
|
713
252
|
function getFullCollectionMetadataTimeline(timeline) {
|
|
714
|
-
return getFullTimeline(timeline, "collectionMetadata",
|
|
253
|
+
return getFullTimeline(timeline, "collectionMetadata", constants_1.DefaultPlaceholderMetadata);
|
|
715
254
|
}
|
|
716
255
|
exports.getFullCollectionMetadataTimeline = getFullCollectionMetadataTimeline;
|
|
717
256
|
function getFullBadgeMetadataTimeline(timeline) {
|