@eluvio/elv-client-js 3.2.42 → 3.2.44

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eluvio/elv-client-js",
3
- "version": "3.2.42",
3
+ "version": "3.2.44",
4
4
  "description": "Javascript client for the Eluvio Content Fabric",
5
5
  "main": "src/index.js",
6
6
  "author": "Kevin Talmadge",
@@ -126,60 +126,6 @@ exports.UserWalletBalance = async function(checkOnboard=false) {
126
126
  return balances;
127
127
  };
128
128
 
129
-
130
- /**
131
- * Returns basic contract info about the items the specified/current user owns, organized by contract address + token ID
132
- *
133
- * This method is significantly faster than <a href="#.UserItems">UserItems</a>, but does not include any NFT metadata.
134
- *
135
- * @methodGroup User
136
- * @namedParams
137
- * @param {string=} userAddress - Address of the user to query for. If unspecified, will use the currently logged in user.
138
- *
139
- * @returns {Promise<Object>} - Basic info about all owned items.
140
- */
141
- exports.UserItemInfo = async function ({userAddress}={}) {
142
- const accountId = `iusr${Utils.AddressToHash(userAddress || this.UserAddress())}`;
143
- this.profileData = await this.client.ethClient.MakeProviderCall({
144
- methodName: "send",
145
- args: [
146
- "elv_getAccountProfile",
147
- [this.client.contentSpaceId, accountId]
148
- ]
149
- });
150
-
151
- if(!this.profileData || !this.profileData.NFTs) { return {}; }
152
-
153
- let nftInfo = {};
154
- Object.keys(this.profileData.NFTs).map(tenantId =>
155
- this.profileData.NFTs[tenantId].forEach(details => {
156
- const versionHash = (details.TokenUri || "").split("/").find(s => (s || "").startsWith("hq__"));
157
-
158
- if(!versionHash) {
159
- return;
160
- }
161
-
162
- if(details.TokenHold) {
163
- details.TokenHoldDate = new Date(parseInt(details.TokenHold) * 1000);
164
- }
165
-
166
- const contractAddress = Utils.FormatAddress(details.ContractAddr);
167
- const key = `${contractAddress}-${details.TokenIdStr}`;
168
- nftInfo[key] = {
169
- ...details,
170
- ContractAddr: Utils.FormatAddress(details.ContractAddr),
171
- ContractId: `ictr${Utils.AddressToHash(details.ContractAddr)}`,
172
- VersionHash: versionHash
173
- };
174
- })
175
- );
176
-
177
- this.nftInfo = nftInfo;
178
-
179
- return this.nftInfo;
180
- };
181
-
182
-
183
129
  /**
184
130
  * Retrieve all valid names for filtering user items. Full item names are required for filtering results by name.
185
131
  *
@@ -286,7 +232,7 @@ exports.UserItemAttributes = async function({marketplaceParams, displayName, use
286
232
  * @param {string=} userAddress - Address of a user. If not specified, will return results for current user
287
233
  * @param {integer=} start=0 - PAGINATION: Index from which the results should start
288
234
  * @param {integer=} limit=50 - PAGINATION: Maximum number of results to return
289
- * @param {string=} sortBy="created" - Sort order. Options: `default`, `meta/display_name`
235
+ * @param {string=} sortBy="default" - Sort order. Options: `default`, `meta/display_name`
290
236
  * @param {boolean=} sortDesc=false - Sort results descending instead of ascending
291
237
  * @param {string=} filter - Filter results by item name.
292
238
  * @param {string=} contractAddress - Filter results by the address of the NFT contract
@@ -296,8 +242,8 @@ exports.UserItemAttributes = async function({marketplaceParams, displayName, use
296
242
  *
297
243
  * @returns {Promise<Object>} - Results of the query and pagination info
298
244
  */
299
- exports.UserItems = async function() {
300
- return this.FilteredQuery({mode: "owned", ...(arguments[0] || {})});
245
+ exports.UserItems = async function({sortBy="default"}={}) {
246
+ return this.FilteredQuery({mode: "owned", sortBy, ...(arguments[0] || {})});
301
247
  };
302
248
 
303
249
  /**
@@ -755,7 +755,7 @@ class ElvWalletClient {
755
755
  let marketplace = await this.client.ContentObjectMetadata({
756
756
  versionHash: marketplaceHash,
757
757
  metadataSubtree: "public/asset_metadata/info",
758
- linkDepthLimit: 2,
758
+ linkDepthLimit: 1,
759
759
  resolveLinks: true,
760
760
  resolveIgnoreErrors: true,
761
761
  resolveIncludeSource: true,
@@ -869,6 +869,11 @@ class ElvWalletClient {
869
869
  sort_descending: sortDesc
870
870
  };
871
871
 
872
+ // Created isn't a valid sort mode for owned
873
+ if(mode === "owned" && sortBy === "created") {
874
+ sortBy = "default";
875
+ }
876
+
872
877
  if(mode !== "leaderboard") {
873
878
  params.sort_by = sortBy;
874
879
  }