@0xsequence/metadata 0.0.0-20220825190100 → 0.0.0-20221124173317

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.
@@ -2,68 +2,64 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var fetch = require('cross-fetch');
6
-
7
- function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
8
-
9
- var fetch__default = /*#__PURE__*/_interopDefault(fetch);
10
-
11
5
  function _extends() {
12
- _extends = Object.assign || function (target) {
6
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
13
7
  for (var i = 1; i < arguments.length; i++) {
14
8
  var source = arguments[i];
15
-
16
9
  for (var key in source) {
17
10
  if (Object.prototype.hasOwnProperty.call(source, key)) {
18
11
  target[key] = source[key];
19
12
  }
20
13
  }
21
14
  }
22
-
23
15
  return target;
24
16
  };
25
-
26
17
  return _extends.apply(this, arguments);
27
18
  }
28
19
 
29
20
  /* eslint-disable */
30
- // sequence-metadata v0.4.0 3f6b0f4aa1a7b58488e9399c277fc17995d74f5a
21
+ // sequence-metadata v0.4.0 bc959039469c0907365b18237ae62c00bdd626e5
31
22
  // --
32
- // This file has been generated by https://github.com/webrpc/webrpc using gen/typescript
33
- // Do not edit by hand. Update your webrpc schema and re-generate.
23
+ // Code generated by webrpc-gen@v0.7.0 with typescript generator. DO NOT EDIT.
24
+ //
25
+ // webrpc-gen -schema=metadata.ridl -target=typescript -client -out=./clients/metadata.gen.ts
26
+
34
27
  // WebRPC description and code-gen version
35
- const WebRPCVersion = "v1"; // Schema version of your RIDL schema
28
+ const WebRPCVersion = "v1";
29
+
30
+ // Schema version of your RIDL schema
31
+ const WebRPCSchemaVersion = "v0.4.0";
36
32
 
37
- const WebRPCSchemaVersion = "v0.4.0"; // Schema hash generated from your RIDL schema
33
+ // Schema hash generated from your RIDL schema
34
+ const WebRPCSchemaHash = "bc959039469c0907365b18237ae62c00bdd626e5";
38
35
 
39
- const WebRPCSchemaHash = "3f6b0f4aa1a7b58488e9399c277fc17995d74f5a"; //
36
+ //
40
37
  // Types
41
38
  //
42
-
43
39
  exports.ContractType = void 0;
44
-
45
40
  (function (ContractType) {
46
41
  ContractType["UNKNOWN"] = "UNKNOWN";
47
42
  ContractType["ERC20"] = "ERC20";
48
43
  ContractType["ERC721"] = "ERC721";
49
44
  ContractType["ERC1155"] = "ERC1155";
50
45
  })(exports.ContractType || (exports.ContractType = {}));
51
-
46
+ exports.PropertyType = void 0;
47
+ (function (PropertyType) {
48
+ PropertyType["INT"] = "INT";
49
+ PropertyType["STRING"] = "STRING";
50
+ PropertyType["ARRAY"] = "ARRAY";
51
+ })(exports.PropertyType || (exports.PropertyType = {}));
52
52
  exports.SwapType = void 0;
53
-
54
53
  (function (SwapType) {
55
54
  SwapType["UNKNOWN"] = "UNKNOWN";
56
55
  SwapType["BUY"] = "BUY";
57
56
  SwapType["SELL"] = "SELL";
58
57
  })(exports.SwapType || (exports.SwapType = {}));
59
-
60
58
  exports.SortOrder = void 0;
61
-
62
59
  (function (SortOrder) {
63
60
  SortOrder["DESC"] = "DESC";
64
61
  SortOrder["ASC"] = "ASC";
65
62
  })(exports.SortOrder || (exports.SortOrder = {}));
66
-
67
63
  //
68
64
  // Client
69
65
  //
@@ -72,7 +68,6 @@ class Metadata {
72
68
  this.hostname = void 0;
73
69
  this.fetch = void 0;
74
70
  this.path = '/rpc/Metadata/';
75
-
76
71
  this.ping = headers => {
77
72
  return this.fetch(this.url('Ping'), createHTTPRequest({}, headers)).then(res => {
78
73
  return buildResponse(res).then(_data => {
@@ -82,7 +77,6 @@ class Metadata {
82
77
  });
83
78
  });
84
79
  };
85
-
86
80
  this.version = headers => {
87
81
  return this.fetch(this.url('Version'), createHTTPRequest({}, headers)).then(res => {
88
82
  return buildResponse(res).then(_data => {
@@ -92,7 +86,6 @@ class Metadata {
92
86
  });
93
87
  });
94
88
  };
95
-
96
89
  this.runtimeStatus = headers => {
97
90
  return this.fetch(this.url('RuntimeStatus'), createHTTPRequest({}, headers)).then(res => {
98
91
  return buildResponse(res).then(_data => {
@@ -102,7 +95,6 @@ class Metadata {
102
95
  });
103
96
  });
104
97
  };
105
-
106
98
  this.getTokenMetadata = (args, headers) => {
107
99
  return this.fetch(this.url('GetTokenMetadata'), createHTTPRequest(args, headers)).then(res => {
108
100
  return buildResponse(res).then(_data => {
@@ -112,7 +104,15 @@ class Metadata {
112
104
  });
113
105
  });
114
106
  };
115
-
107
+ this.refreshTokenMetadata = (args, headers) => {
108
+ return this.fetch(this.url('RefreshTokenMetadata'), createHTTPRequest(args, headers)).then(res => {
109
+ return buildResponse(res).then(_data => {
110
+ return {
111
+ status: _data.status
112
+ };
113
+ });
114
+ });
115
+ };
116
116
  this.getTokenMetadataBatch = (args, headers) => {
117
117
  return this.fetch(this.url('GetTokenMetadataBatch'), createHTTPRequest(args, headers)).then(res => {
118
118
  return buildResponse(res).then(_data => {
@@ -122,7 +122,6 @@ class Metadata {
122
122
  });
123
123
  });
124
124
  };
125
-
126
125
  this.searchTokenMetadata = (args, headers) => {
127
126
  return this.fetch(this.url('SearchTokenMetadata'), createHTTPRequest(args, headers)).then(res => {
128
127
  return buildResponse(res).then(_data => {
@@ -133,7 +132,6 @@ class Metadata {
133
132
  });
134
133
  });
135
134
  };
136
-
137
135
  this.searchTokenIDs = (args, headers) => {
138
136
  return this.fetch(this.url('SearchTokenIDs'), createHTTPRequest(args, headers)).then(res => {
139
137
  return buildResponse(res).then(_data => {
@@ -144,7 +142,15 @@ class Metadata {
144
142
  });
145
143
  });
146
144
  };
147
-
145
+ this.tokenCollectionFilters = (args, headers) => {
146
+ return this.fetch(this.url('TokenCollectionFilters'), createHTTPRequest(args, headers)).then(res => {
147
+ return buildResponse(res).then(_data => {
148
+ return {
149
+ filters: _data.filters
150
+ };
151
+ });
152
+ });
153
+ };
148
154
  this.getContractInfo = (args, headers) => {
149
155
  return this.fetch(this.url('GetContractInfo'), createHTTPRequest(args, headers)).then(res => {
150
156
  return buildResponse(res).then(_data => {
@@ -154,7 +160,6 @@ class Metadata {
154
160
  });
155
161
  });
156
162
  };
157
-
158
163
  this.getContractInfoBatch = (args, headers) => {
159
164
  return this.fetch(this.url('GetContractInfoBatch'), createHTTPRequest(args, headers)).then(res => {
160
165
  return buildResponse(res).then(_data => {
@@ -164,7 +169,6 @@ class Metadata {
164
169
  });
165
170
  });
166
171
  };
167
-
168
172
  this.searchContractInfo = (args, headers) => {
169
173
  return this.fetch(this.url('SearchContractInfo'), createHTTPRequest(args, headers)).then(res => {
170
174
  return buildResponse(res).then(_data => {
@@ -174,7 +178,6 @@ class Metadata {
174
178
  });
175
179
  });
176
180
  };
177
-
178
181
  this.searchContractInfoBatch = (args, headers) => {
179
182
  return this.fetch(this.url('SearchContractInfoBatch'), createHTTPRequest(args, headers)).then(res => {
180
183
  return buildResponse(res).then(_data => {
@@ -184,7 +187,6 @@ class Metadata {
184
187
  });
185
188
  });
186
189
  };
187
-
188
190
  this.getNiftyswapTokenQuantity = (args, headers) => {
189
191
  return this.fetch(this.url('GetNiftyswapTokenQuantity'), createHTTPRequest(args, headers)).then(res => {
190
192
  return buildResponse(res).then(_data => {
@@ -194,7 +196,6 @@ class Metadata {
194
196
  });
195
197
  });
196
198
  };
197
-
198
199
  this.getNiftyswapUnitPrices = (args, headers) => {
199
200
  return this.fetch(this.url('GetNiftyswapUnitPrices'), createHTTPRequest(args, headers)).then(res => {
200
201
  return buildResponse(res).then(_data => {
@@ -204,17 +205,13 @@ class Metadata {
204
205
  });
205
206
  });
206
207
  };
207
-
208
208
  this.hostname = hostname;
209
- this.fetch = fetch;
209
+ this.fetch = (input, init) => fetch(input, init);
210
210
  }
211
-
212
211
  url(name) {
213
212
  return this.hostname + this.path + name;
214
213
  }
215
-
216
214
  }
217
-
218
215
  const createHTTPRequest = (body = {}, headers = {}) => {
219
216
  return {
220
217
  method: 'POST',
@@ -224,11 +221,9 @@ const createHTTPRequest = (body = {}, headers = {}) => {
224
221
  body: JSON.stringify(body || {})
225
222
  };
226
223
  };
227
-
228
224
  const buildResponse = res => {
229
225
  return res.text().then(text => {
230
226
  let data;
231
-
232
227
  try {
233
228
  data = JSON.parse(text);
234
229
  } catch (err) {
@@ -238,7 +233,6 @@ const buildResponse = res => {
238
233
  status: res.status
239
234
  };
240
235
  }
241
-
242
236
  if (!res.ok) {
243
237
  throw data; // webrpc error response
244
238
  }
@@ -249,9 +243,8 @@ const buildResponse = res => {
249
243
 
250
244
  class SequenceMetadataClient extends Metadata {
251
245
  constructor(hostname = 'https://metadata.sequence.app') {
252
- super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, fetch__default["default"]);
246
+ super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, global.fetch);
253
247
  }
254
-
255
248
  }
256
249
 
257
250
  exports.Metadata = Metadata;
@@ -2,68 +2,64 @@
2
2
 
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
- var fetch = require('cross-fetch');
6
-
7
- function _interopDefault (e) { return e && e.__esModule ? e : { 'default': e }; }
8
-
9
- var fetch__default = /*#__PURE__*/_interopDefault(fetch);
10
-
11
5
  function _extends() {
12
- _extends = Object.assign || function (target) {
6
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
13
7
  for (var i = 1; i < arguments.length; i++) {
14
8
  var source = arguments[i];
15
-
16
9
  for (var key in source) {
17
10
  if (Object.prototype.hasOwnProperty.call(source, key)) {
18
11
  target[key] = source[key];
19
12
  }
20
13
  }
21
14
  }
22
-
23
15
  return target;
24
16
  };
25
-
26
17
  return _extends.apply(this, arguments);
27
18
  }
28
19
 
29
20
  /* eslint-disable */
30
- // sequence-metadata v0.4.0 3f6b0f4aa1a7b58488e9399c277fc17995d74f5a
21
+ // sequence-metadata v0.4.0 bc959039469c0907365b18237ae62c00bdd626e5
31
22
  // --
32
- // This file has been generated by https://github.com/webrpc/webrpc using gen/typescript
33
- // Do not edit by hand. Update your webrpc schema and re-generate.
23
+ // Code generated by webrpc-gen@v0.7.0 with typescript generator. DO NOT EDIT.
24
+ //
25
+ // webrpc-gen -schema=metadata.ridl -target=typescript -client -out=./clients/metadata.gen.ts
26
+
34
27
  // WebRPC description and code-gen version
35
- const WebRPCVersion = "v1"; // Schema version of your RIDL schema
28
+ const WebRPCVersion = "v1";
29
+
30
+ // Schema version of your RIDL schema
31
+ const WebRPCSchemaVersion = "v0.4.0";
36
32
 
37
- const WebRPCSchemaVersion = "v0.4.0"; // Schema hash generated from your RIDL schema
33
+ // Schema hash generated from your RIDL schema
34
+ const WebRPCSchemaHash = "bc959039469c0907365b18237ae62c00bdd626e5";
38
35
 
39
- const WebRPCSchemaHash = "3f6b0f4aa1a7b58488e9399c277fc17995d74f5a"; //
36
+ //
40
37
  // Types
41
38
  //
42
-
43
39
  exports.ContractType = void 0;
44
-
45
40
  (function (ContractType) {
46
41
  ContractType["UNKNOWN"] = "UNKNOWN";
47
42
  ContractType["ERC20"] = "ERC20";
48
43
  ContractType["ERC721"] = "ERC721";
49
44
  ContractType["ERC1155"] = "ERC1155";
50
45
  })(exports.ContractType || (exports.ContractType = {}));
51
-
46
+ exports.PropertyType = void 0;
47
+ (function (PropertyType) {
48
+ PropertyType["INT"] = "INT";
49
+ PropertyType["STRING"] = "STRING";
50
+ PropertyType["ARRAY"] = "ARRAY";
51
+ })(exports.PropertyType || (exports.PropertyType = {}));
52
52
  exports.SwapType = void 0;
53
-
54
53
  (function (SwapType) {
55
54
  SwapType["UNKNOWN"] = "UNKNOWN";
56
55
  SwapType["BUY"] = "BUY";
57
56
  SwapType["SELL"] = "SELL";
58
57
  })(exports.SwapType || (exports.SwapType = {}));
59
-
60
58
  exports.SortOrder = void 0;
61
-
62
59
  (function (SortOrder) {
63
60
  SortOrder["DESC"] = "DESC";
64
61
  SortOrder["ASC"] = "ASC";
65
62
  })(exports.SortOrder || (exports.SortOrder = {}));
66
-
67
63
  //
68
64
  // Client
69
65
  //
@@ -72,7 +68,6 @@ class Metadata {
72
68
  this.hostname = void 0;
73
69
  this.fetch = void 0;
74
70
  this.path = '/rpc/Metadata/';
75
-
76
71
  this.ping = headers => {
77
72
  return this.fetch(this.url('Ping'), createHTTPRequest({}, headers)).then(res => {
78
73
  return buildResponse(res).then(_data => {
@@ -82,7 +77,6 @@ class Metadata {
82
77
  });
83
78
  });
84
79
  };
85
-
86
80
  this.version = headers => {
87
81
  return this.fetch(this.url('Version'), createHTTPRequest({}, headers)).then(res => {
88
82
  return buildResponse(res).then(_data => {
@@ -92,7 +86,6 @@ class Metadata {
92
86
  });
93
87
  });
94
88
  };
95
-
96
89
  this.runtimeStatus = headers => {
97
90
  return this.fetch(this.url('RuntimeStatus'), createHTTPRequest({}, headers)).then(res => {
98
91
  return buildResponse(res).then(_data => {
@@ -102,7 +95,6 @@ class Metadata {
102
95
  });
103
96
  });
104
97
  };
105
-
106
98
  this.getTokenMetadata = (args, headers) => {
107
99
  return this.fetch(this.url('GetTokenMetadata'), createHTTPRequest(args, headers)).then(res => {
108
100
  return buildResponse(res).then(_data => {
@@ -112,7 +104,15 @@ class Metadata {
112
104
  });
113
105
  });
114
106
  };
115
-
107
+ this.refreshTokenMetadata = (args, headers) => {
108
+ return this.fetch(this.url('RefreshTokenMetadata'), createHTTPRequest(args, headers)).then(res => {
109
+ return buildResponse(res).then(_data => {
110
+ return {
111
+ status: _data.status
112
+ };
113
+ });
114
+ });
115
+ };
116
116
  this.getTokenMetadataBatch = (args, headers) => {
117
117
  return this.fetch(this.url('GetTokenMetadataBatch'), createHTTPRequest(args, headers)).then(res => {
118
118
  return buildResponse(res).then(_data => {
@@ -122,7 +122,6 @@ class Metadata {
122
122
  });
123
123
  });
124
124
  };
125
-
126
125
  this.searchTokenMetadata = (args, headers) => {
127
126
  return this.fetch(this.url('SearchTokenMetadata'), createHTTPRequest(args, headers)).then(res => {
128
127
  return buildResponse(res).then(_data => {
@@ -133,7 +132,6 @@ class Metadata {
133
132
  });
134
133
  });
135
134
  };
136
-
137
135
  this.searchTokenIDs = (args, headers) => {
138
136
  return this.fetch(this.url('SearchTokenIDs'), createHTTPRequest(args, headers)).then(res => {
139
137
  return buildResponse(res).then(_data => {
@@ -144,7 +142,15 @@ class Metadata {
144
142
  });
145
143
  });
146
144
  };
147
-
145
+ this.tokenCollectionFilters = (args, headers) => {
146
+ return this.fetch(this.url('TokenCollectionFilters'), createHTTPRequest(args, headers)).then(res => {
147
+ return buildResponse(res).then(_data => {
148
+ return {
149
+ filters: _data.filters
150
+ };
151
+ });
152
+ });
153
+ };
148
154
  this.getContractInfo = (args, headers) => {
149
155
  return this.fetch(this.url('GetContractInfo'), createHTTPRequest(args, headers)).then(res => {
150
156
  return buildResponse(res).then(_data => {
@@ -154,7 +160,6 @@ class Metadata {
154
160
  });
155
161
  });
156
162
  };
157
-
158
163
  this.getContractInfoBatch = (args, headers) => {
159
164
  return this.fetch(this.url('GetContractInfoBatch'), createHTTPRequest(args, headers)).then(res => {
160
165
  return buildResponse(res).then(_data => {
@@ -164,7 +169,6 @@ class Metadata {
164
169
  });
165
170
  });
166
171
  };
167
-
168
172
  this.searchContractInfo = (args, headers) => {
169
173
  return this.fetch(this.url('SearchContractInfo'), createHTTPRequest(args, headers)).then(res => {
170
174
  return buildResponse(res).then(_data => {
@@ -174,7 +178,6 @@ class Metadata {
174
178
  });
175
179
  });
176
180
  };
177
-
178
181
  this.searchContractInfoBatch = (args, headers) => {
179
182
  return this.fetch(this.url('SearchContractInfoBatch'), createHTTPRequest(args, headers)).then(res => {
180
183
  return buildResponse(res).then(_data => {
@@ -184,7 +187,6 @@ class Metadata {
184
187
  });
185
188
  });
186
189
  };
187
-
188
190
  this.getNiftyswapTokenQuantity = (args, headers) => {
189
191
  return this.fetch(this.url('GetNiftyswapTokenQuantity'), createHTTPRequest(args, headers)).then(res => {
190
192
  return buildResponse(res).then(_data => {
@@ -194,7 +196,6 @@ class Metadata {
194
196
  });
195
197
  });
196
198
  };
197
-
198
199
  this.getNiftyswapUnitPrices = (args, headers) => {
199
200
  return this.fetch(this.url('GetNiftyswapUnitPrices'), createHTTPRequest(args, headers)).then(res => {
200
201
  return buildResponse(res).then(_data => {
@@ -204,17 +205,13 @@ class Metadata {
204
205
  });
205
206
  });
206
207
  };
207
-
208
208
  this.hostname = hostname;
209
- this.fetch = fetch;
209
+ this.fetch = (input, init) => fetch(input, init);
210
210
  }
211
-
212
211
  url(name) {
213
212
  return this.hostname + this.path + name;
214
213
  }
215
-
216
214
  }
217
-
218
215
  const createHTTPRequest = (body = {}, headers = {}) => {
219
216
  return {
220
217
  method: 'POST',
@@ -224,11 +221,9 @@ const createHTTPRequest = (body = {}, headers = {}) => {
224
221
  body: JSON.stringify(body || {})
225
222
  };
226
223
  };
227
-
228
224
  const buildResponse = res => {
229
225
  return res.text().then(text => {
230
226
  let data;
231
-
232
227
  try {
233
228
  data = JSON.parse(text);
234
229
  } catch (err) {
@@ -238,7 +233,6 @@ const buildResponse = res => {
238
233
  status: res.status
239
234
  };
240
235
  }
241
-
242
236
  if (!res.ok) {
243
237
  throw data; // webrpc error response
244
238
  }
@@ -249,9 +243,8 @@ const buildResponse = res => {
249
243
 
250
244
  class SequenceMetadataClient extends Metadata {
251
245
  constructor(hostname = 'https://metadata.sequence.app') {
252
- super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, fetch__default["default"]);
246
+ super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, global.fetch);
253
247
  }
254
-
255
248
  }
256
249
 
257
250
  exports.Metadata = Metadata;
@@ -1,61 +1,61 @@
1
- import fetch from 'cross-fetch';
2
-
3
1
  function _extends() {
4
- _extends = Object.assign || function (target) {
2
+ _extends = Object.assign ? Object.assign.bind() : function (target) {
5
3
  for (var i = 1; i < arguments.length; i++) {
6
4
  var source = arguments[i];
7
-
8
5
  for (var key in source) {
9
6
  if (Object.prototype.hasOwnProperty.call(source, key)) {
10
7
  target[key] = source[key];
11
8
  }
12
9
  }
13
10
  }
14
-
15
11
  return target;
16
12
  };
17
-
18
13
  return _extends.apply(this, arguments);
19
14
  }
20
15
 
21
16
  /* eslint-disable */
22
- // sequence-metadata v0.4.0 3f6b0f4aa1a7b58488e9399c277fc17995d74f5a
17
+ // sequence-metadata v0.4.0 bc959039469c0907365b18237ae62c00bdd626e5
23
18
  // --
24
- // This file has been generated by https://github.com/webrpc/webrpc using gen/typescript
25
- // Do not edit by hand. Update your webrpc schema and re-generate.
19
+ // Code generated by webrpc-gen@v0.7.0 with typescript generator. DO NOT EDIT.
20
+ //
21
+ // webrpc-gen -schema=metadata.ridl -target=typescript -client -out=./clients/metadata.gen.ts
22
+
26
23
  // WebRPC description and code-gen version
27
- const WebRPCVersion = "v1"; // Schema version of your RIDL schema
24
+ const WebRPCVersion = "v1";
25
+
26
+ // Schema version of your RIDL schema
27
+ const WebRPCSchemaVersion = "v0.4.0";
28
28
 
29
- const WebRPCSchemaVersion = "v0.4.0"; // Schema hash generated from your RIDL schema
29
+ // Schema hash generated from your RIDL schema
30
+ const WebRPCSchemaHash = "bc959039469c0907365b18237ae62c00bdd626e5";
30
31
 
31
- const WebRPCSchemaHash = "3f6b0f4aa1a7b58488e9399c277fc17995d74f5a"; //
32
+ //
32
33
  // Types
33
34
  //
34
-
35
35
  let ContractType;
36
-
37
36
  (function (ContractType) {
38
37
  ContractType["UNKNOWN"] = "UNKNOWN";
39
38
  ContractType["ERC20"] = "ERC20";
40
39
  ContractType["ERC721"] = "ERC721";
41
40
  ContractType["ERC1155"] = "ERC1155";
42
41
  })(ContractType || (ContractType = {}));
43
-
42
+ let PropertyType;
43
+ (function (PropertyType) {
44
+ PropertyType["INT"] = "INT";
45
+ PropertyType["STRING"] = "STRING";
46
+ PropertyType["ARRAY"] = "ARRAY";
47
+ })(PropertyType || (PropertyType = {}));
44
48
  let SwapType;
45
-
46
49
  (function (SwapType) {
47
50
  SwapType["UNKNOWN"] = "UNKNOWN";
48
51
  SwapType["BUY"] = "BUY";
49
52
  SwapType["SELL"] = "SELL";
50
53
  })(SwapType || (SwapType = {}));
51
-
52
54
  let SortOrder;
53
-
54
55
  (function (SortOrder) {
55
56
  SortOrder["DESC"] = "DESC";
56
57
  SortOrder["ASC"] = "ASC";
57
58
  })(SortOrder || (SortOrder = {}));
58
-
59
59
  //
60
60
  // Client
61
61
  //
@@ -64,7 +64,6 @@ class Metadata {
64
64
  this.hostname = void 0;
65
65
  this.fetch = void 0;
66
66
  this.path = '/rpc/Metadata/';
67
-
68
67
  this.ping = headers => {
69
68
  return this.fetch(this.url('Ping'), createHTTPRequest({}, headers)).then(res => {
70
69
  return buildResponse(res).then(_data => {
@@ -74,7 +73,6 @@ class Metadata {
74
73
  });
75
74
  });
76
75
  };
77
-
78
76
  this.version = headers => {
79
77
  return this.fetch(this.url('Version'), createHTTPRequest({}, headers)).then(res => {
80
78
  return buildResponse(res).then(_data => {
@@ -84,7 +82,6 @@ class Metadata {
84
82
  });
85
83
  });
86
84
  };
87
-
88
85
  this.runtimeStatus = headers => {
89
86
  return this.fetch(this.url('RuntimeStatus'), createHTTPRequest({}, headers)).then(res => {
90
87
  return buildResponse(res).then(_data => {
@@ -94,7 +91,6 @@ class Metadata {
94
91
  });
95
92
  });
96
93
  };
97
-
98
94
  this.getTokenMetadata = (args, headers) => {
99
95
  return this.fetch(this.url('GetTokenMetadata'), createHTTPRequest(args, headers)).then(res => {
100
96
  return buildResponse(res).then(_data => {
@@ -104,7 +100,15 @@ class Metadata {
104
100
  });
105
101
  });
106
102
  };
107
-
103
+ this.refreshTokenMetadata = (args, headers) => {
104
+ return this.fetch(this.url('RefreshTokenMetadata'), createHTTPRequest(args, headers)).then(res => {
105
+ return buildResponse(res).then(_data => {
106
+ return {
107
+ status: _data.status
108
+ };
109
+ });
110
+ });
111
+ };
108
112
  this.getTokenMetadataBatch = (args, headers) => {
109
113
  return this.fetch(this.url('GetTokenMetadataBatch'), createHTTPRequest(args, headers)).then(res => {
110
114
  return buildResponse(res).then(_data => {
@@ -114,7 +118,6 @@ class Metadata {
114
118
  });
115
119
  });
116
120
  };
117
-
118
121
  this.searchTokenMetadata = (args, headers) => {
119
122
  return this.fetch(this.url('SearchTokenMetadata'), createHTTPRequest(args, headers)).then(res => {
120
123
  return buildResponse(res).then(_data => {
@@ -125,7 +128,6 @@ class Metadata {
125
128
  });
126
129
  });
127
130
  };
128
-
129
131
  this.searchTokenIDs = (args, headers) => {
130
132
  return this.fetch(this.url('SearchTokenIDs'), createHTTPRequest(args, headers)).then(res => {
131
133
  return buildResponse(res).then(_data => {
@@ -136,7 +138,15 @@ class Metadata {
136
138
  });
137
139
  });
138
140
  };
139
-
141
+ this.tokenCollectionFilters = (args, headers) => {
142
+ return this.fetch(this.url('TokenCollectionFilters'), createHTTPRequest(args, headers)).then(res => {
143
+ return buildResponse(res).then(_data => {
144
+ return {
145
+ filters: _data.filters
146
+ };
147
+ });
148
+ });
149
+ };
140
150
  this.getContractInfo = (args, headers) => {
141
151
  return this.fetch(this.url('GetContractInfo'), createHTTPRequest(args, headers)).then(res => {
142
152
  return buildResponse(res).then(_data => {
@@ -146,7 +156,6 @@ class Metadata {
146
156
  });
147
157
  });
148
158
  };
149
-
150
159
  this.getContractInfoBatch = (args, headers) => {
151
160
  return this.fetch(this.url('GetContractInfoBatch'), createHTTPRequest(args, headers)).then(res => {
152
161
  return buildResponse(res).then(_data => {
@@ -156,7 +165,6 @@ class Metadata {
156
165
  });
157
166
  });
158
167
  };
159
-
160
168
  this.searchContractInfo = (args, headers) => {
161
169
  return this.fetch(this.url('SearchContractInfo'), createHTTPRequest(args, headers)).then(res => {
162
170
  return buildResponse(res).then(_data => {
@@ -166,7 +174,6 @@ class Metadata {
166
174
  });
167
175
  });
168
176
  };
169
-
170
177
  this.searchContractInfoBatch = (args, headers) => {
171
178
  return this.fetch(this.url('SearchContractInfoBatch'), createHTTPRequest(args, headers)).then(res => {
172
179
  return buildResponse(res).then(_data => {
@@ -176,7 +183,6 @@ class Metadata {
176
183
  });
177
184
  });
178
185
  };
179
-
180
186
  this.getNiftyswapTokenQuantity = (args, headers) => {
181
187
  return this.fetch(this.url('GetNiftyswapTokenQuantity'), createHTTPRequest(args, headers)).then(res => {
182
188
  return buildResponse(res).then(_data => {
@@ -186,7 +192,6 @@ class Metadata {
186
192
  });
187
193
  });
188
194
  };
189
-
190
195
  this.getNiftyswapUnitPrices = (args, headers) => {
191
196
  return this.fetch(this.url('GetNiftyswapUnitPrices'), createHTTPRequest(args, headers)).then(res => {
192
197
  return buildResponse(res).then(_data => {
@@ -196,17 +201,13 @@ class Metadata {
196
201
  });
197
202
  });
198
203
  };
199
-
200
204
  this.hostname = hostname;
201
- this.fetch = fetch;
205
+ this.fetch = (input, init) => fetch(input, init);
202
206
  }
203
-
204
207
  url(name) {
205
208
  return this.hostname + this.path + name;
206
209
  }
207
-
208
210
  }
209
-
210
211
  const createHTTPRequest = (body = {}, headers = {}) => {
211
212
  return {
212
213
  method: 'POST',
@@ -216,11 +217,9 @@ const createHTTPRequest = (body = {}, headers = {}) => {
216
217
  body: JSON.stringify(body || {})
217
218
  };
218
219
  };
219
-
220
220
  const buildResponse = res => {
221
221
  return res.text().then(text => {
222
222
  let data;
223
-
224
223
  try {
225
224
  data = JSON.parse(text);
226
225
  } catch (err) {
@@ -230,7 +229,6 @@ const buildResponse = res => {
230
229
  status: res.status
231
230
  };
232
231
  }
233
-
234
232
  if (!res.ok) {
235
233
  throw data; // webrpc error response
236
234
  }
@@ -241,9 +239,8 @@ const buildResponse = res => {
241
239
 
242
240
  class SequenceMetadataClient extends Metadata {
243
241
  constructor(hostname = 'https://metadata.sequence.app') {
244
- super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, fetch);
242
+ super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, global.fetch);
245
243
  }
246
-
247
244
  }
248
245
 
249
- export { ContractType, Metadata, SequenceMetadataClient, SortOrder, SwapType, WebRPCSchemaHash, WebRPCSchemaVersion, WebRPCVersion };
246
+ export { ContractType, Metadata, PropertyType, SequenceMetadataClient, SortOrder, SwapType, WebRPCSchemaHash, WebRPCSchemaVersion, WebRPCVersion };
@@ -1,5 +1,5 @@
1
1
  export * from './metadata.gen';
2
- import { Metadata as BaseSequenceMetadata } from './metadata.gen';
3
- export declare class SequenceMetadataClient extends BaseSequenceMetadata {
2
+ import { Metadata as MetadataRpc } from './metadata.gen';
3
+ export declare class SequenceMetadataClient extends MetadataRpc {
4
4
  constructor(hostname?: string);
5
5
  }
@@ -1,12 +1,17 @@
1
1
  export declare const WebRPCVersion = "v1";
2
2
  export declare const WebRPCSchemaVersion = "v0.4.0";
3
- export declare const WebRPCSchemaHash = "3f6b0f4aa1a7b58488e9399c277fc17995d74f5a";
3
+ export declare const WebRPCSchemaHash = "bc959039469c0907365b18237ae62c00bdd626e5";
4
4
  export declare enum ContractType {
5
5
  UNKNOWN = "UNKNOWN",
6
6
  ERC20 = "ERC20",
7
7
  ERC721 = "ERC721",
8
8
  ERC1155 = "ERC1155"
9
9
  }
10
+ export declare enum PropertyType {
11
+ INT = "INT",
12
+ STRING = "STRING",
13
+ ARRAY = "ARRAY"
14
+ }
10
15
  export declare enum SwapType {
11
16
  UNKNOWN = "UNKNOWN",
12
17
  BUY = "BUY",
@@ -40,14 +45,18 @@ export interface ContractIndex {
40
45
  metadata: {
41
46
  [key: string]: any;
42
47
  };
48
+ contentHash: number;
49
+ notFound: boolean;
43
50
  }
44
51
  export interface TokenIndex {
52
+ key: string;
45
53
  chainId: number;
46
54
  contractAddress: string;
47
55
  tokenId: string;
48
56
  metadata: {
49
57
  [key: string]: any;
50
58
  };
59
+ notFound: boolean;
51
60
  }
52
61
  export interface ContractInfo {
53
62
  chainId: number;
@@ -87,6 +96,17 @@ export interface TokenMetadata {
87
96
  [key: string]: any;
88
97
  }>;
89
98
  }
99
+ export interface PropertyFilter {
100
+ name: string;
101
+ type: PropertyType;
102
+ min?: number;
103
+ max?: number;
104
+ values?: Array<any>;
105
+ }
106
+ export interface Filter {
107
+ text?: string;
108
+ properties?: Array<PropertyFilter>;
109
+ }
90
110
  export interface GetNiftyswapUnitPricesRequest {
91
111
  swapType: SwapType;
92
112
  ids: Array<string>;
@@ -105,9 +125,11 @@ export interface Metadata {
105
125
  version(headers?: object): Promise<VersionReturn>;
106
126
  runtimeStatus(headers?: object): Promise<RuntimeStatusReturn>;
107
127
  getTokenMetadata(args: GetTokenMetadataArgs, headers?: object): Promise<GetTokenMetadataReturn>;
128
+ refreshTokenMetadata(args: RefreshTokenMetadataArgs, headers?: object): Promise<RefreshTokenMetadataReturn>;
108
129
  getTokenMetadataBatch(args: GetTokenMetadataBatchArgs, headers?: object): Promise<GetTokenMetadataBatchReturn>;
109
130
  searchTokenMetadata(args: SearchTokenMetadataArgs, headers?: object): Promise<SearchTokenMetadataReturn>;
110
131
  searchTokenIDs(args: SearchTokenIDsArgs, headers?: object): Promise<SearchTokenIDsReturn>;
132
+ tokenCollectionFilters(args: TokenCollectionFiltersArgs, headers?: object): Promise<TokenCollectionFiltersReturn>;
111
133
  getContractInfo(args: GetContractInfoArgs, headers?: object): Promise<GetContractInfoReturn>;
112
134
  getContractInfoBatch(args: GetContractInfoBatchArgs, headers?: object): Promise<GetContractInfoBatchReturn>;
113
135
  searchContractInfo(args: SearchContractInfoArgs, headers?: object): Promise<SearchContractInfoReturn>;
@@ -138,6 +160,17 @@ export interface GetTokenMetadataArgs {
138
160
  export interface GetTokenMetadataReturn {
139
161
  tokenMetadata: Array<TokenMetadata>;
140
162
  }
163
+ export interface RefreshTokenMetadataArgs {
164
+ chainID: string;
165
+ contractAddress: string;
166
+ tokenIDs?: Array<string>;
167
+ refreshAll?: boolean;
168
+ }
169
+ export interface RefreshTokenMetadataReturn {
170
+ status: {
171
+ [key: string]: boolean;
172
+ };
173
+ }
141
174
  export interface GetTokenMetadataBatchArgs {
142
175
  chainID: string;
143
176
  contractTokenMap: {
@@ -152,7 +185,7 @@ export interface GetTokenMetadataBatchReturn {
152
185
  export interface SearchTokenMetadataArgs {
153
186
  chainID: string;
154
187
  contractAddress: string;
155
- filter: string;
188
+ filter: Filter;
156
189
  page?: Page;
157
190
  }
158
191
  export interface SearchTokenMetadataReturn {
@@ -162,13 +195,20 @@ export interface SearchTokenMetadataReturn {
162
195
  export interface SearchTokenIDsArgs {
163
196
  chainID: string;
164
197
  contractAddress: string;
165
- filter: string;
198
+ filter: Filter;
166
199
  page?: Page;
167
200
  }
168
201
  export interface SearchTokenIDsReturn {
169
202
  page: Page;
170
203
  tokenIds: Array<string>;
171
204
  }
205
+ export interface TokenCollectionFiltersArgs {
206
+ chainID: string;
207
+ contractAddress: string;
208
+ }
209
+ export interface TokenCollectionFiltersReturn {
210
+ filters: Array<PropertyFilter>;
211
+ }
172
212
  export interface GetContractInfoArgs {
173
213
  chainID: string;
174
214
  contractAddress: string;
@@ -229,9 +269,11 @@ export declare class Metadata implements Metadata {
229
269
  version: (headers?: object | undefined) => Promise<VersionReturn>;
230
270
  runtimeStatus: (headers?: object | undefined) => Promise<RuntimeStatusReturn>;
231
271
  getTokenMetadata: (args: GetTokenMetadataArgs, headers?: object | undefined) => Promise<GetTokenMetadataReturn>;
272
+ refreshTokenMetadata: (args: RefreshTokenMetadataArgs, headers?: object | undefined) => Promise<RefreshTokenMetadataReturn>;
232
273
  getTokenMetadataBatch: (args: GetTokenMetadataBatchArgs, headers?: object | undefined) => Promise<GetTokenMetadataBatchReturn>;
233
274
  searchTokenMetadata: (args: SearchTokenMetadataArgs, headers?: object | undefined) => Promise<SearchTokenMetadataReturn>;
234
275
  searchTokenIDs: (args: SearchTokenIDsArgs, headers?: object | undefined) => Promise<SearchTokenIDsReturn>;
276
+ tokenCollectionFilters: (args: TokenCollectionFiltersArgs, headers?: object | undefined) => Promise<TokenCollectionFiltersReturn>;
235
277
  getContractInfo: (args: GetContractInfoArgs, headers?: object | undefined) => Promise<GetContractInfoReturn>;
236
278
  getContractInfoBatch: (args: GetContractInfoBatchArgs, headers?: object | undefined) => Promise<GetContractInfoBatchReturn>;
237
279
  searchContractInfo: (args: SearchContractInfoArgs, headers?: object | undefined) => Promise<SearchContractInfoReturn>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@0xsequence/metadata",
3
- "version": "0.0.0-20220825190100",
3
+ "version": "0.0.0-20221124173317",
4
4
  "description": "metadata sub-package for Sequence",
5
5
  "repository": "https://github.com/0xsequence/sequence.js/tree/master/packages/metadata",
6
6
  "source": "src/index.ts",
@@ -12,9 +12,7 @@
12
12
  "test": "echo",
13
13
  "typecheck": "tsc --noEmit"
14
14
  },
15
- "dependencies": {
16
- "cross-fetch": "^3.1.5"
17
- },
15
+ "dependencies": {},
18
16
  "peerDependencies": {},
19
17
  "devDependencies": {},
20
18
  "files": [
package/src/index.ts CHANGED
@@ -1,11 +1,9 @@
1
1
  export * from './metadata.gen'
2
2
 
3
- import fetch from 'cross-fetch'
3
+ import { Metadata as MetadataRpc } from './metadata.gen'
4
4
 
5
- import { Metadata as BaseSequenceMetadata } from './metadata.gen'
6
-
7
- export class SequenceMetadataClient extends BaseSequenceMetadata {
5
+ export class SequenceMetadataClient extends MetadataRpc {
8
6
  constructor(hostname: string = 'https://metadata.sequence.app') {
9
- super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, fetch)
7
+ super(hostname.endsWith('/') ? hostname.slice(0, -1) : hostname, global.fetch)
10
8
  }
11
9
  }
@@ -1,8 +1,9 @@
1
1
  /* eslint-disable */
2
- // sequence-metadata v0.4.0 3f6b0f4aa1a7b58488e9399c277fc17995d74f5a
2
+ // sequence-metadata v0.4.0 bc959039469c0907365b18237ae62c00bdd626e5
3
3
  // --
4
- // This file has been generated by https://github.com/webrpc/webrpc using gen/typescript
5
- // Do not edit by hand. Update your webrpc schema and re-generate.
4
+ // Code generated by webrpc-gen@v0.7.0 with typescript generator. DO NOT EDIT.
5
+ //
6
+ // webrpc-gen -schema=metadata.ridl -target=typescript -client -out=./clients/metadata.gen.ts
6
7
 
7
8
  // WebRPC description and code-gen version
8
9
  export const WebRPCVersion = "v1"
@@ -11,8 +12,7 @@ export const WebRPCVersion = "v1"
11
12
  export const WebRPCSchemaVersion = "v0.4.0"
12
13
 
13
14
  // Schema hash generated from your RIDL schema
14
- export const WebRPCSchemaHash = "3f6b0f4aa1a7b58488e9399c277fc17995d74f5a"
15
-
15
+ export const WebRPCSchemaHash = "bc959039469c0907365b18237ae62c00bdd626e5"
16
16
 
17
17
  //
18
18
  // Types
@@ -24,6 +24,12 @@ export enum ContractType {
24
24
  ERC1155 = 'ERC1155'
25
25
  }
26
26
 
27
+ export enum PropertyType {
28
+ INT = 'INT',
29
+ STRING = 'STRING',
30
+ ARRAY = 'ARRAY'
31
+ }
32
+
27
33
  export enum SwapType {
28
34
  UNKNOWN = 'UNKNOWN',
29
35
  BUY = 'BUY',
@@ -60,14 +66,18 @@ export interface ContractIndex {
60
66
  address: string
61
67
  type: ContractType
62
68
  metadata: {[key: string]: any}
69
+ contentHash: number
70
+ notFound: boolean
63
71
  }
64
72
 
65
73
  export interface TokenIndex {
74
+ key: string
66
75
  chainId: number
67
76
  contractAddress: string
68
77
  tokenId: string
69
78
  metadata: {[key: string]: any}
70
79
 
80
+ notFound: boolean
71
81
  }
72
82
 
73
83
  export interface ContractInfo {
@@ -107,6 +117,19 @@ export interface TokenMetadata {
107
117
  attributes: Array<{[key: string]: any}>
108
118
  }
109
119
 
120
+ export interface PropertyFilter {
121
+ name: string
122
+ type: PropertyType
123
+ min?: number
124
+ max?: number
125
+ values?: Array<any>
126
+ }
127
+
128
+ export interface Filter {
129
+ text?: string
130
+ properties?: Array<PropertyFilter>
131
+ }
132
+
110
133
  export interface GetNiftyswapUnitPricesRequest {
111
134
  swapType: SwapType
112
135
  ids: Array<string>
@@ -128,9 +151,11 @@ export interface Metadata {
128
151
  version(headers?: object): Promise<VersionReturn>
129
152
  runtimeStatus(headers?: object): Promise<RuntimeStatusReturn>
130
153
  getTokenMetadata(args: GetTokenMetadataArgs, headers?: object): Promise<GetTokenMetadataReturn>
154
+ refreshTokenMetadata(args: RefreshTokenMetadataArgs, headers?: object): Promise<RefreshTokenMetadataReturn>
131
155
  getTokenMetadataBatch(args: GetTokenMetadataBatchArgs, headers?: object): Promise<GetTokenMetadataBatchReturn>
132
156
  searchTokenMetadata(args: SearchTokenMetadataArgs, headers?: object): Promise<SearchTokenMetadataReturn>
133
157
  searchTokenIDs(args: SearchTokenIDsArgs, headers?: object): Promise<SearchTokenIDsReturn>
158
+ tokenCollectionFilters(args: TokenCollectionFiltersArgs, headers?: object): Promise<TokenCollectionFiltersReturn>
134
159
  getContractInfo(args: GetContractInfoArgs, headers?: object): Promise<GetContractInfoReturn>
135
160
  getContractInfoBatch(args: GetContractInfoBatchArgs, headers?: object): Promise<GetContractInfoBatchReturn>
136
161
  searchContractInfo(args: SearchContractInfoArgs, headers?: object): Promise<SearchContractInfoReturn>
@@ -166,6 +191,16 @@ export interface GetTokenMetadataArgs {
166
191
  export interface GetTokenMetadataReturn {
167
192
  tokenMetadata: Array<TokenMetadata>
168
193
  }
194
+ export interface RefreshTokenMetadataArgs {
195
+ chainID: string
196
+ contractAddress: string
197
+ tokenIDs?: Array<string>
198
+ refreshAll?: boolean
199
+ }
200
+
201
+ export interface RefreshTokenMetadataReturn {
202
+ status: {[key: string]: boolean}
203
+ }
169
204
  export interface GetTokenMetadataBatchArgs {
170
205
  chainID: string
171
206
  contractTokenMap: {[key: string]: Array<string>}
@@ -177,7 +212,7 @@ export interface GetTokenMetadataBatchReturn {
177
212
  export interface SearchTokenMetadataArgs {
178
213
  chainID: string
179
214
  contractAddress: string
180
- filter: string
215
+ filter: Filter
181
216
  page?: Page
182
217
  }
183
218
 
@@ -188,7 +223,7 @@ export interface SearchTokenMetadataReturn {
188
223
  export interface SearchTokenIDsArgs {
189
224
  chainID: string
190
225
  contractAddress: string
191
- filter: string
226
+ filter: Filter
192
227
  page?: Page
193
228
  }
194
229
 
@@ -196,6 +231,14 @@ export interface SearchTokenIDsReturn {
196
231
  page: Page
197
232
  tokenIds: Array<string>
198
233
  }
234
+ export interface TokenCollectionFiltersArgs {
235
+ chainID: string
236
+ contractAddress: string
237
+ }
238
+
239
+ export interface TokenCollectionFiltersReturn {
240
+ filters: Array<PropertyFilter>
241
+ }
199
242
  export interface GetContractInfoArgs {
200
243
  chainID: string
201
244
  contractAddress: string
@@ -257,7 +300,7 @@ export class Metadata implements Metadata {
257
300
 
258
301
  constructor(hostname: string, fetch: Fetch) {
259
302
  this.hostname = hostname
260
- this.fetch = fetch
303
+ this.fetch = (input: RequestInfo, init?: RequestInit) => fetch(input, init)
261
304
  }
262
305
 
263
306
  private url(name: string): string {
@@ -315,6 +358,18 @@ export class Metadata implements Metadata {
315
358
  })
316
359
  }
317
360
 
361
+ refreshTokenMetadata = (args: RefreshTokenMetadataArgs, headers?: object): Promise<RefreshTokenMetadataReturn> => {
362
+ return this.fetch(
363
+ this.url('RefreshTokenMetadata'),
364
+ createHTTPRequest(args, headers)).then((res) => {
365
+ return buildResponse(res).then(_data => {
366
+ return {
367
+ status: <{[key: string]: boolean}>(_data.status)
368
+ }
369
+ })
370
+ })
371
+ }
372
+
318
373
  getTokenMetadataBatch = (args: GetTokenMetadataBatchArgs, headers?: object): Promise<GetTokenMetadataBatchReturn> => {
319
374
  return this.fetch(
320
375
  this.url('GetTokenMetadataBatch'),
@@ -353,6 +408,18 @@ export class Metadata implements Metadata {
353
408
  })
354
409
  }
355
410
 
411
+ tokenCollectionFilters = (args: TokenCollectionFiltersArgs, headers?: object): Promise<TokenCollectionFiltersReturn> => {
412
+ return this.fetch(
413
+ this.url('TokenCollectionFilters'),
414
+ createHTTPRequest(args, headers)).then((res) => {
415
+ return buildResponse(res).then(_data => {
416
+ return {
417
+ filters: <Array<PropertyFilter>>(_data.filters)
418
+ }
419
+ })
420
+ })
421
+ }
422
+
356
423
  getContractInfo = (args: GetContractInfoArgs, headers?: object): Promise<GetContractInfoReturn> => {
357
424
  return this.fetch(
358
425
  this.url('GetContractInfo'),